@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 +1070 -862
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +3 -3
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +7 -11
- package/src/helpers.ts +7 -0
- package/src/index.ts +10 -12
- package/src/models/aggregators/aggregated-async-iterator.ts +134 -81
- package/src/models/aggregators/aggregated-iterator.ts +133 -82
- package/src/models/aggregators/index.ts +1 -3
- package/src/models/aggregators/reduced-iterator.ts +118 -30
- package/src/models/aggregators/types.ts +15 -10
- package/src/models/exceptions/core.ts +3 -3
- package/src/models/exceptions/index.ts +13 -13
- package/src/models/game-loop.ts +2 -0
- package/src/models/index.ts +0 -2
- package/src/models/iterators/smart-async-iterator.ts +109 -23
- package/src/models/iterators/smart-iterator.ts +105 -12
- package/src/models/iterators/types.ts +17 -7
- package/src/models/json/json-storage.ts +2 -3
- package/src/models/json/types.ts +5 -1
- package/src/models/promises/deferred-promise.ts +1 -1
- package/src/models/promises/smart-promise.ts +6 -1
- package/src/models/promises/timed-promise.ts +1 -1
- package/src/models/publisher.ts +1 -1
- package/src/models/timers/clock.ts +3 -1
- package/src/models/timers/countdown.ts +3 -1
- package/src/models/types.ts +9 -9
- package/src/utils/async.ts +4 -4
- package/src/utils/date.ts +3 -0
- package/src/utils/random.ts +4 -3
- package/src/models/aggregators/aggregator.ts +0 -46
- package/src/models/aggregators/async-aggregator.ts +0 -56
package/dist/core.js
CHANGED
|
@@ -1,464 +1,415 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
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
|
|
21
|
+
if (e instanceof c)
|
|
12
22
|
return e;
|
|
13
23
|
if (e instanceof Error) {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
24
|
+
const n = new c(e.message);
|
|
25
|
+
return n.stack = e.stack, n.name = e.name, n;
|
|
16
26
|
}
|
|
17
|
-
return new
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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 (!
|
|
152
|
+
if (!t(n.value, e))
|
|
164
153
|
return !1;
|
|
165
|
-
|
|
154
|
+
e += 1;
|
|
166
155
|
}
|
|
167
156
|
}
|
|
168
|
-
some(
|
|
169
|
-
let
|
|
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 (
|
|
163
|
+
if (t(n.value, e))
|
|
175
164
|
return !0;
|
|
176
|
-
|
|
165
|
+
e += 1;
|
|
177
166
|
}
|
|
178
167
|
}
|
|
179
|
-
filter(
|
|
180
|
-
const
|
|
181
|
-
return new
|
|
168
|
+
filter(t) {
|
|
169
|
+
const e = this._iterator;
|
|
170
|
+
return new l(function* () {
|
|
182
171
|
let n = 0;
|
|
183
172
|
for (; ; ) {
|
|
184
|
-
const r =
|
|
173
|
+
const r = e.next();
|
|
185
174
|
if (r.done)
|
|
186
175
|
return r.value;
|
|
187
|
-
|
|
176
|
+
t(r.value, n) && (yield r.value), n += 1;
|
|
188
177
|
}
|
|
189
178
|
});
|
|
190
179
|
}
|
|
191
|
-
map(
|
|
192
|
-
const
|
|
193
|
-
return new
|
|
180
|
+
map(t) {
|
|
181
|
+
const e = this._iterator;
|
|
182
|
+
return new l(function* () {
|
|
194
183
|
let n = 0;
|
|
195
184
|
for (; ; ) {
|
|
196
|
-
const r =
|
|
185
|
+
const r = e.next();
|
|
197
186
|
if (r.done)
|
|
198
187
|
return r.value;
|
|
199
|
-
yield
|
|
188
|
+
yield t(r.value, n), n += 1;
|
|
200
189
|
}
|
|
201
190
|
});
|
|
202
191
|
}
|
|
203
|
-
reduce(
|
|
204
|
-
let n = 0, r =
|
|
192
|
+
reduce(t, e) {
|
|
193
|
+
let n = 0, r = e;
|
|
205
194
|
if (r === void 0) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
throw new
|
|
209
|
-
r =
|
|
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
|
|
213
|
-
if (
|
|
201
|
+
const s = this._iterator.next();
|
|
202
|
+
if (s.done)
|
|
214
203
|
return r;
|
|
215
|
-
r =
|
|
204
|
+
r = t(r, s.value, n), n += 1;
|
|
216
205
|
}
|
|
217
206
|
}
|
|
218
|
-
|
|
219
|
-
return this.map((e, t) => [t, e]);
|
|
220
|
-
}
|
|
221
|
-
unique() {
|
|
207
|
+
flatMap(t) {
|
|
222
208
|
const e = this._iterator;
|
|
223
|
-
return new
|
|
224
|
-
|
|
209
|
+
return new l(function* () {
|
|
210
|
+
let n = 0;
|
|
225
211
|
for (; ; ) {
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
return
|
|
229
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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 =
|
|
232
|
+
const r = e.next();
|
|
331
233
|
if (r.done)
|
|
332
234
|
return r.value;
|
|
333
|
-
|
|
235
|
+
yield r.value;
|
|
334
236
|
}
|
|
335
237
|
});
|
|
336
238
|
}
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
return new
|
|
239
|
+
take(t) {
|
|
240
|
+
const e = this._iterator;
|
|
241
|
+
return new l(function* () {
|
|
340
242
|
let n = 0;
|
|
341
|
-
for (; ; ) {
|
|
342
|
-
const r =
|
|
243
|
+
for (; n < t; ) {
|
|
244
|
+
const r = e.next();
|
|
343
245
|
if (r.done)
|
|
344
246
|
return r.value;
|
|
345
|
-
yield
|
|
247
|
+
yield r.value, n += 1;
|
|
346
248
|
}
|
|
347
249
|
});
|
|
348
250
|
}
|
|
349
|
-
|
|
350
|
-
let
|
|
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
|
|
359
|
-
if (
|
|
360
|
-
return
|
|
361
|
-
|
|
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((
|
|
263
|
+
return this.map((t, e) => [e, t]);
|
|
366
264
|
}
|
|
367
265
|
unique() {
|
|
368
|
-
const
|
|
369
|
-
return new
|
|
370
|
-
const
|
|
266
|
+
const t = this._iterator;
|
|
267
|
+
return new l(function* () {
|
|
268
|
+
const e = /* @__PURE__ */ new Set();
|
|
371
269
|
for (; ; ) {
|
|
372
|
-
const n =
|
|
270
|
+
const n = t.next();
|
|
373
271
|
if (n.done)
|
|
374
272
|
return n.value;
|
|
375
|
-
|
|
273
|
+
e.has(n.value) || (e.add(n.value), yield n.value);
|
|
376
274
|
}
|
|
377
275
|
});
|
|
378
276
|
}
|
|
379
|
-
|
|
380
|
-
let
|
|
277
|
+
count() {
|
|
278
|
+
let t = 0;
|
|
381
279
|
for (; ; ) {
|
|
382
|
-
if (
|
|
383
|
-
return
|
|
384
|
-
|
|
280
|
+
if (this._iterator.next().done)
|
|
281
|
+
return t;
|
|
282
|
+
t += 1;
|
|
385
283
|
}
|
|
386
284
|
}
|
|
387
|
-
|
|
388
|
-
let
|
|
285
|
+
forEach(t) {
|
|
286
|
+
let e = 0;
|
|
389
287
|
for (; ; ) {
|
|
390
|
-
const n =
|
|
288
|
+
const n = this._iterator.next();
|
|
391
289
|
if (n.done)
|
|
392
290
|
return;
|
|
393
|
-
|
|
291
|
+
t(n.value, e), e += 1;
|
|
394
292
|
}
|
|
395
293
|
}
|
|
396
|
-
next(...
|
|
397
|
-
return this._iterator.next(...
|
|
294
|
+
next(...t) {
|
|
295
|
+
return this._iterator.next(...t);
|
|
398
296
|
}
|
|
399
|
-
|
|
400
|
-
|
|
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
|
-
|
|
409
|
-
return
|
|
300
|
+
toArray() {
|
|
301
|
+
return Array.from(this);
|
|
410
302
|
}
|
|
411
|
-
[Symbol.
|
|
303
|
+
[(le = Symbol.toStringTag, Symbol.iterator)]() {
|
|
412
304
|
return this;
|
|
413
305
|
}
|
|
414
306
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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
|
-
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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(
|
|
428
|
-
const
|
|
429
|
-
return new
|
|
430
|
-
for (const [n, [r,
|
|
431
|
-
yield [r,
|
|
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(
|
|
435
|
-
let n = 0, r;
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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 [
|
|
445
|
-
r =
|
|
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
|
|
450
|
-
return new
|
|
451
|
-
for (const [
|
|
452
|
-
yield
|
|
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
|
|
460
|
-
return new
|
|
461
|
-
for (const [
|
|
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
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
class
|
|
479
|
-
constructor(
|
|
480
|
-
|
|
481
|
-
this
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
|
490
|
-
for (const [n, [r,
|
|
491
|
-
yield [n,
|
|
441
|
+
return new f(function* () {
|
|
442
|
+
for (const [n, [r, s]] of e)
|
|
443
|
+
yield [n, s];
|
|
492
444
|
});
|
|
493
445
|
}
|
|
494
|
-
some(
|
|
495
|
-
const
|
|
496
|
-
for (const [n, r] of this._elements) {
|
|
497
|
-
const [
|
|
498
|
-
o ||
|
|
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
|
|
501
|
-
for (const [n, [r,
|
|
502
|
-
yield [n,
|
|
452
|
+
return new f(function* () {
|
|
453
|
+
for (const [n, [r, s]] of e)
|
|
454
|
+
yield [n, s];
|
|
503
455
|
});
|
|
504
456
|
}
|
|
505
|
-
filter(
|
|
506
|
-
const
|
|
507
|
-
return new
|
|
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,
|
|
461
|
+
for await (const [r, s] of e) {
|
|
510
462
|
const o = n.get(r) ?? 0;
|
|
511
|
-
|
|
463
|
+
await t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
512
464
|
}
|
|
513
465
|
});
|
|
514
466
|
}
|
|
515
|
-
map(
|
|
516
|
-
const
|
|
517
|
-
return new
|
|
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,
|
|
471
|
+
for await (const [r, s] of e) {
|
|
520
472
|
const o = n.get(r) ?? 0;
|
|
521
|
-
|
|
473
|
+
yield [r, await t(r, s, o)], n.set(r, o + 1);
|
|
522
474
|
}
|
|
523
475
|
});
|
|
524
476
|
}
|
|
525
|
-
reduce(
|
|
477
|
+
async reduce(t, e) {
|
|
526
478
|
const n = /* @__PURE__ */ new Map();
|
|
527
|
-
for (const [r,
|
|
528
|
-
let o,
|
|
479
|
+
for await (const [r, s] of this._elements) {
|
|
480
|
+
let o, u;
|
|
529
481
|
if (n.has(r))
|
|
530
|
-
[o,
|
|
531
|
-
else if (
|
|
532
|
-
o = 0,
|
|
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,
|
|
486
|
+
n.set(r, [0, s]);
|
|
535
487
|
continue;
|
|
536
488
|
}
|
|
537
|
-
|
|
489
|
+
n.set(r, [o + 1, await t(r, u, s, o)]);
|
|
538
490
|
}
|
|
539
|
-
return new
|
|
540
|
-
for (const [r, [
|
|
491
|
+
return new f(function* () {
|
|
492
|
+
for (const [r, [s, o]] of n)
|
|
541
493
|
yield [r, o];
|
|
542
494
|
});
|
|
543
495
|
}
|
|
544
|
-
|
|
496
|
+
flatMap(t) {
|
|
545
497
|
const e = this._elements;
|
|
546
|
-
return new
|
|
547
|
-
const
|
|
548
|
-
for (const [
|
|
549
|
-
const
|
|
550
|
-
|
|
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
|
-
|
|
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 [
|
|
557
|
-
|
|
558
|
-
e.set(
|
|
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
|
|
561
|
-
for (const [
|
|
562
|
-
yield [
|
|
543
|
+
return new f(function* () {
|
|
544
|
+
for (const [n, [r, s]] of e)
|
|
545
|
+
yield [n, s];
|
|
563
546
|
});
|
|
564
547
|
}
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
e
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
yield [
|
|
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
|
-
|
|
575
|
-
const
|
|
576
|
-
for (const [
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
|
585
|
-
return new
|
|
586
|
-
const
|
|
587
|
-
for (const [n] of
|
|
588
|
-
|
|
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
|
|
596
|
-
return new
|
|
597
|
-
for (const [
|
|
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
|
-
|
|
594
|
+
async toArray() {
|
|
595
|
+
const t = await this.toMap();
|
|
596
|
+
return Array.from(t.values());
|
|
603
597
|
}
|
|
604
|
-
toMap() {
|
|
605
|
-
const
|
|
606
|
-
for (const [
|
|
607
|
-
const r =
|
|
608
|
-
r.push(n),
|
|
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
|
|
604
|
+
return t;
|
|
611
605
|
}
|
|
612
|
-
toObject() {
|
|
613
|
-
const
|
|
614
|
-
for (const [
|
|
615
|
-
const r = e
|
|
616
|
-
r.push(n), e
|
|
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
|
-
|
|
621
|
-
|
|
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
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
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
|
-
|
|
630
|
-
|
|
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
|
-
|
|
633
|
-
|
|
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
|
-
|
|
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
|
-
|
|
639
|
-
|
|
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
|
-
|
|
642
|
-
|
|
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
|
-
|
|
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
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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
|
|
657
|
-
for (const [n, [r,
|
|
658
|
-
yield [n,
|
|
833
|
+
return new f(function* () {
|
|
834
|
+
for (const [n, [r, s]] of e)
|
|
835
|
+
yield [n, s];
|
|
659
836
|
});
|
|
660
837
|
}
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
for
|
|
664
|
-
const [
|
|
665
|
-
o ||
|
|
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
|
|
668
|
-
for (const [n, [r,
|
|
669
|
-
yield [n,
|
|
844
|
+
return new f(function* () {
|
|
845
|
+
for (const [n, [r, s]] of e)
|
|
846
|
+
yield [n, s];
|
|
670
847
|
});
|
|
671
848
|
}
|
|
672
|
-
filter(
|
|
673
|
-
const
|
|
674
|
-
return new
|
|
849
|
+
filter(t) {
|
|
850
|
+
const e = this._elements;
|
|
851
|
+
return new w(function* () {
|
|
675
852
|
const n = /* @__PURE__ */ new Map();
|
|
676
|
-
for
|
|
853
|
+
for (const [r, s] of e) {
|
|
677
854
|
const o = n.get(r) ?? 0;
|
|
678
|
-
|
|
855
|
+
t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
679
856
|
}
|
|
680
857
|
});
|
|
681
858
|
}
|
|
682
|
-
map(
|
|
683
|
-
const
|
|
684
|
-
return new
|
|
859
|
+
map(t) {
|
|
860
|
+
const e = this._elements;
|
|
861
|
+
return new w(function* () {
|
|
685
862
|
const n = /* @__PURE__ */ new Map();
|
|
686
|
-
for
|
|
863
|
+
for (const [r, s] of e) {
|
|
687
864
|
const o = n.get(r) ?? 0;
|
|
688
|
-
|
|
865
|
+
yield [r, t(r, s, o)], n.set(r, o + 1);
|
|
689
866
|
}
|
|
690
867
|
});
|
|
691
868
|
}
|
|
692
|
-
|
|
869
|
+
reduce(t, e) {
|
|
693
870
|
const n = /* @__PURE__ */ new Map();
|
|
694
|
-
for
|
|
695
|
-
let o,
|
|
871
|
+
for (const [r, s] of this._elements) {
|
|
872
|
+
let o, u;
|
|
696
873
|
if (n.has(r))
|
|
697
|
-
[o,
|
|
698
|
-
else if (
|
|
699
|
-
o = 0,
|
|
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,
|
|
878
|
+
n.set(r, [0, s]);
|
|
702
879
|
continue;
|
|
703
880
|
}
|
|
704
|
-
|
|
881
|
+
n.set(r, [o + 1, t(r, u, s, o)]);
|
|
705
882
|
}
|
|
706
|
-
return new
|
|
707
|
-
for (const [r, [
|
|
883
|
+
return new f(function* () {
|
|
884
|
+
for (const [r, [s, o]] of n)
|
|
708
885
|
yield [r, o];
|
|
709
886
|
});
|
|
710
887
|
}
|
|
711
|
-
|
|
888
|
+
flatMap(t) {
|
|
712
889
|
const e = this._elements;
|
|
713
|
-
return new
|
|
714
|
-
const
|
|
715
|
-
for
|
|
716
|
-
const
|
|
717
|
-
|
|
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
|
-
|
|
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
|
|
724
|
-
|
|
725
|
-
e.set(
|
|
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
|
|
728
|
-
for (const [
|
|
729
|
-
yield [
|
|
935
|
+
return new f(function* () {
|
|
936
|
+
for (const [n, [r, s]] of e)
|
|
937
|
+
yield [n, s];
|
|
730
938
|
});
|
|
731
939
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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
|
-
|
|
742
|
-
const
|
|
743
|
-
for
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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
|
|
752
|
-
return new
|
|
753
|
-
const
|
|
754
|
-
for
|
|
755
|
-
|
|
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
|
|
763
|
-
return new
|
|
764
|
-
for
|
|
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
|
-
|
|
769
|
-
const
|
|
770
|
-
return Array.from(
|
|
989
|
+
toArray() {
|
|
990
|
+
const t = this.toMap();
|
|
991
|
+
return Array.from(t.values());
|
|
771
992
|
}
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
for
|
|
775
|
-
const r =
|
|
776
|
-
r.push(n),
|
|
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
|
|
999
|
+
return t;
|
|
779
1000
|
}
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
for
|
|
783
|
-
const r = e
|
|
784
|
-
r.push(n), e
|
|
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
|
|
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
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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 +=
|
|
1020
|
+
yield new Date(r), r += e;
|
|
823
1021
|
});
|
|
824
1022
|
}
|
|
825
|
-
function
|
|
826
|
-
return
|
|
1023
|
+
function Xe(i, t = 864e5) {
|
|
1024
|
+
return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
|
|
827
1025
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
this
|
|
836
|
-
|
|
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@${
|
|
1039
|
+
`Not a browser environment detected. Using setInterval@${e}fps instead of requestAnimationFrame...`
|
|
839
1040
|
), this._start = () => {
|
|
840
|
-
const n =
|
|
841
|
-
this._handle = setInterval(() =>
|
|
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(
|
|
1054
|
+
start(t = 0) {
|
|
854
1055
|
if (this._isRunning)
|
|
855
|
-
throw new
|
|
856
|
-
this._startTime = performance.now() -
|
|
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
|
|
1061
|
+
throw new p("The game loop hadn't yet started.");
|
|
861
1062
|
if (!this._handle)
|
|
862
|
-
throw new
|
|
1063
|
+
throw new x();
|
|
863
1064
|
this._stop(), this._handle = void 0, this._isRunning = !1;
|
|
864
1065
|
}
|
|
865
1066
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
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(
|
|
878
|
-
const r =
|
|
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 "${
|
|
885
|
-
),
|
|
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(
|
|
1093
|
+
_set(t, e, n) {
|
|
890
1094
|
const r = JSON.stringify(n);
|
|
891
|
-
r ?
|
|
1095
|
+
r ? t.setItem(e, r) : t.removeItem(e);
|
|
892
1096
|
}
|
|
893
|
-
get(
|
|
1097
|
+
get(t, e, n = this._preferPersistence) {
|
|
894
1098
|
const r = n ? this._persistent : this._volatile;
|
|
895
|
-
return this._get(r,
|
|
1099
|
+
return this._get(r, t, e);
|
|
896
1100
|
}
|
|
897
|
-
recall(
|
|
898
|
-
return this._get(this._volatile,
|
|
1101
|
+
recall(t, e) {
|
|
1102
|
+
return this._get(this._volatile, t, e);
|
|
899
1103
|
}
|
|
900
|
-
retrieve(
|
|
901
|
-
return this.recall(
|
|
1104
|
+
retrieve(t, e) {
|
|
1105
|
+
return this.recall(t) ?? this.read(t, e);
|
|
902
1106
|
}
|
|
903
|
-
read(
|
|
904
|
-
return this._get(this._persistent,
|
|
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(
|
|
915
|
-
return (
|
|
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(
|
|
925
|
-
return this._volatile.getItem(
|
|
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(
|
|
936
|
-
return this.knows(
|
|
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(
|
|
946
|
-
return this._persistent.getItem(
|
|
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(
|
|
1160
|
+
set(t, e, n = this._preferPersistence) {
|
|
957
1161
|
const r = n ? this._persistent : this._volatile;
|
|
958
|
-
this._set(r,
|
|
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(
|
|
968
|
-
this._set(this._volatile,
|
|
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(
|
|
978
|
-
this._set(this._persistent,
|
|
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(
|
|
986
|
-
this._volatile.removeItem(
|
|
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(
|
|
994
|
-
this._persistent.removeItem(
|
|
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(
|
|
1002
|
-
this._volatile.removeItem(
|
|
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
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
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
|
|
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(
|
|
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(
|
|
1030
|
-
return this._promise.then(
|
|
1236
|
+
then(t, e) {
|
|
1237
|
+
return this._promise.then(t, e);
|
|
1031
1238
|
}
|
|
1032
|
-
catch(
|
|
1033
|
-
return this._promise.catch(
|
|
1239
|
+
catch(t) {
|
|
1240
|
+
return this._promise.catch(t);
|
|
1034
1241
|
}
|
|
1035
|
-
finally(
|
|
1036
|
-
return this._promise.finally(
|
|
1242
|
+
finally(t) {
|
|
1243
|
+
return this._promise.finally(t);
|
|
1037
1244
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
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
|
-
|
|
1049
|
-
|
|
1050
|
-
this
|
|
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(
|
|
1059
|
-
return
|
|
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
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
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
|
-
|
|
1283
|
+
var ve;
|
|
1284
|
+
ve = Symbol.toStringTag;
|
|
1285
|
+
class je {
|
|
1081
1286
|
constructor() {
|
|
1082
|
-
|
|
1287
|
+
a(this, "_subscribers");
|
|
1288
|
+
a(this, ve, "Publisher");
|
|
1083
1289
|
this._subscribers = [];
|
|
1084
1290
|
}
|
|
1085
|
-
subscribe(
|
|
1086
|
-
return this._subscribers.push(
|
|
1087
|
-
const
|
|
1088
|
-
if (
|
|
1089
|
-
throw new
|
|
1090
|
-
this._subscribers.splice(
|
|
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(...
|
|
1094
|
-
return this._subscribers.slice().map((
|
|
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
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
this
|
|
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(
|
|
1311
|
+
start(e = 0) {
|
|
1107
1312
|
if (this._isRunning)
|
|
1108
|
-
throw new
|
|
1109
|
-
super.start(
|
|
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
|
|
1318
|
+
throw new p("The clock hadn't yet started.");
|
|
1114
1319
|
super.stop();
|
|
1115
1320
|
}
|
|
1116
|
-
onTick(
|
|
1321
|
+
onTick(e, n = 0) {
|
|
1117
1322
|
if (n < 0)
|
|
1118
|
-
throw new
|
|
1323
|
+
throw new Fe("The tick step must be a non-negative number.");
|
|
1119
1324
|
if (n === 0)
|
|
1120
|
-
return this._publisher.subscribe(
|
|
1325
|
+
return this._publisher.subscribe(e);
|
|
1121
1326
|
let r = 0;
|
|
1122
|
-
return this._publisher.subscribe((
|
|
1123
|
-
|
|
1327
|
+
return this._publisher.subscribe((s) => {
|
|
1328
|
+
s - r < n || (e(s), r = s);
|
|
1124
1329
|
});
|
|
1125
1330
|
}
|
|
1126
1331
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
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
|
|
1131
|
-
this._publisher.publish(
|
|
1336
|
+
const s = this.remainingTime;
|
|
1337
|
+
this._publisher.publish(s), s <= 0 && this.stop();
|
|
1132
1338
|
}, n);
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
this
|
|
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(
|
|
1351
|
+
start(e = this.duration) {
|
|
1145
1352
|
if (this._isRunning)
|
|
1146
|
-
throw new
|
|
1353
|
+
throw new p("The countdown has already been started.");
|
|
1147
1354
|
if (this._deferrer)
|
|
1148
|
-
throw new
|
|
1149
|
-
return this._deferrer = new
|
|
1355
|
+
throw new x();
|
|
1356
|
+
return this._deferrer = new qe(), super.start(this.duration - e), this._deferrer;
|
|
1150
1357
|
}
|
|
1151
|
-
stop(
|
|
1358
|
+
stop(e) {
|
|
1152
1359
|
if (!this._isRunning)
|
|
1153
|
-
throw new
|
|
1360
|
+
throw new p("The countdown hadn't yet started.");
|
|
1154
1361
|
if (!this._deferrer)
|
|
1155
|
-
throw new
|
|
1156
|
-
super.stop(),
|
|
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(
|
|
1365
|
+
onTick(e, n = 0) {
|
|
1159
1366
|
if (n < 0)
|
|
1160
|
-
throw new
|
|
1367
|
+
throw new Fe("The tick step must be a non-negative number.");
|
|
1161
1368
|
if (n === 0)
|
|
1162
|
-
return this._publisher.subscribe(
|
|
1369
|
+
return this._publisher.subscribe(e);
|
|
1163
1370
|
let r = 0;
|
|
1164
|
-
return this._publisher.subscribe((
|
|
1165
|
-
r -
|
|
1371
|
+
return this._publisher.subscribe((s) => {
|
|
1372
|
+
r - s < n || (e(s), r = s);
|
|
1166
1373
|
});
|
|
1167
1374
|
}
|
|
1168
1375
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1376
|
+
var Te;
|
|
1377
|
+
Te = Symbol.toStringTag;
|
|
1378
|
+
const T = class T {
|
|
1379
|
+
constructor() {
|
|
1380
|
+
a(this, Te, "Random");
|
|
1172
1381
|
}
|
|
1173
|
-
static
|
|
1174
|
-
return Math.
|
|
1382
|
+
static Boolean(t = 0.5) {
|
|
1383
|
+
return Math.random() < t;
|
|
1175
1384
|
}
|
|
1176
|
-
static
|
|
1177
|
-
return
|
|
1385
|
+
static Integer(t, e) {
|
|
1386
|
+
return Math.floor(e === void 0 ? Math.random() * t : Math.random() * (e - t) + t);
|
|
1178
1387
|
}
|
|
1179
|
-
static
|
|
1180
|
-
|
|
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
|
|
1185
|
-
|
|
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
|
-
|
|
1188
|
-
|
|
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
|
-
|
|
1192
|
-
return new Promise((
|
|
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
|
|
1198
|
-
return new Promise((
|
|
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 =
|
|
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
|
|
1204
|
-
return new
|
|
1205
|
-
for (const
|
|
1206
|
-
for (const
|
|
1207
|
-
yield
|
|
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
|
|
1211
|
-
if (Array.isArray(
|
|
1212
|
-
return
|
|
1213
|
-
let
|
|
1214
|
-
for (const
|
|
1215
|
-
|
|
1216
|
-
return
|
|
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
|
|
1219
|
-
return new
|
|
1220
|
-
let
|
|
1221
|
-
for (const
|
|
1222
|
-
yield [
|
|
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
|
|
1226
|
-
return new
|
|
1227
|
-
|
|
1228
|
-
for (let n =
|
|
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
|
|
1233
|
-
const
|
|
1234
|
-
for (let
|
|
1235
|
-
const n = Math.floor(Math.random() * (
|
|
1236
|
-
[e
|
|
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
|
|
1448
|
+
return t;
|
|
1239
1449
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return new
|
|
1242
|
-
const
|
|
1243
|
-
for (const
|
|
1244
|
-
|
|
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
|
|
1248
|
-
return new
|
|
1249
|
-
const
|
|
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 =
|
|
1252
|
-
if (r.done ||
|
|
1461
|
+
const r = e.next(), s = n.next();
|
|
1462
|
+
if (r.done || s.done)
|
|
1253
1463
|
break;
|
|
1254
|
-
yield [r.value,
|
|
1464
|
+
yield [r.value, s.value];
|
|
1255
1465
|
}
|
|
1256
1466
|
});
|
|
1257
1467
|
}
|
|
1258
|
-
function
|
|
1259
|
-
if (
|
|
1260
|
-
let
|
|
1261
|
-
for (const
|
|
1262
|
-
|
|
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
|
|
1265
|
-
return
|
|
1474
|
+
throw new d("You must provide at least one value.");
|
|
1475
|
+
return s / o;
|
|
1266
1476
|
}
|
|
1267
|
-
let
|
|
1268
|
-
for (const [
|
|
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
|
|
1271
|
-
|
|
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
|
|
1484
|
+
throw new d("You must provide at least one value and weight.");
|
|
1275
1485
|
if (n > 0)
|
|
1276
|
-
throw new
|
|
1277
|
-
return
|
|
1486
|
+
throw new d("The sum of weights must be greater than zero.");
|
|
1487
|
+
return e / n;
|
|
1278
1488
|
}
|
|
1279
|
-
function
|
|
1280
|
-
let
|
|
1281
|
-
for (let
|
|
1282
|
-
const n =
|
|
1283
|
-
|
|
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
|
|
1495
|
+
return t;
|
|
1286
1496
|
}
|
|
1287
|
-
function
|
|
1288
|
-
let
|
|
1289
|
-
for (const
|
|
1290
|
-
|
|
1291
|
-
return
|
|
1497
|
+
function dt(i) {
|
|
1498
|
+
let t = 0;
|
|
1499
|
+
for (const e of i)
|
|
1500
|
+
t += e;
|
|
1501
|
+
return t;
|
|
1292
1502
|
}
|
|
1293
|
-
function
|
|
1294
|
-
return `${
|
|
1503
|
+
function mt(i) {
|
|
1504
|
+
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
1295
1505
|
}
|
|
1296
|
-
const
|
|
1506
|
+
const wt = "2.0.0-rc.4";
|
|
1297
1507
|
export {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
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
|