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