@byloth/core 1.3.0 → 1.3.1
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 +277 -227
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +2 -1
- package/src/models/index.ts +1 -2
- package/src/models/promises/deferred-promise.ts +117 -0
- package/src/models/promises/index.ts +4 -0
- package/src/models/promises/smart-promise.ts +56 -0
- package/src/types.ts +1 -1
- package/src/models/deferred-promise.ts +0 -61
package/dist/core.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (s, e, t) => (
|
|
4
|
-
class
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var y = (s, e, t) => e in s ? w(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => (y(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class f extends Error {
|
|
5
5
|
static FromUnknown(e) {
|
|
6
|
-
if (e instanceof
|
|
6
|
+
if (e instanceof f)
|
|
7
7
|
return e;
|
|
8
8
|
if (e instanceof Error) {
|
|
9
|
-
const t = new
|
|
9
|
+
const t = new f(e.message);
|
|
10
10
|
return t.stack = e.stack, t.name = e.name, t;
|
|
11
11
|
}
|
|
12
|
-
return new
|
|
12
|
+
return new f(`${e}`);
|
|
13
13
|
}
|
|
14
|
-
constructor(e, t,
|
|
15
|
-
super(e), this.cause = t, this.name =
|
|
14
|
+
constructor(e, t, r = "Exception") {
|
|
15
|
+
super(e), this.cause = t, this.name = r, t && (t instanceof Error ? this.stack += `
|
|
16
16
|
|
|
17
17
|
Caused by ${t.stack}` : this.stack += `
|
|
18
18
|
|
|
19
19
|
Caused by ${t}`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class l {
|
|
23
23
|
constructor(e) {
|
|
24
24
|
u(this, "_iterator");
|
|
25
25
|
u(this, "return");
|
|
@@ -29,10 +29,10 @@ class c {
|
|
|
29
29
|
every(e) {
|
|
30
30
|
let t = 0;
|
|
31
31
|
for (; ; ) {
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
32
|
+
const r = this._iterator.next();
|
|
33
|
+
if (r.done)
|
|
34
34
|
return !0;
|
|
35
|
-
if (!e(
|
|
35
|
+
if (!e(r.value, t))
|
|
36
36
|
return !1;
|
|
37
37
|
t += 1;
|
|
38
38
|
}
|
|
@@ -40,51 +40,51 @@ class c {
|
|
|
40
40
|
some(e) {
|
|
41
41
|
let t = 0;
|
|
42
42
|
for (; ; ) {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
43
|
+
const r = this._iterator.next();
|
|
44
|
+
if (r.done)
|
|
45
45
|
return !1;
|
|
46
|
-
if (e(
|
|
46
|
+
if (e(r.value, t))
|
|
47
47
|
return !0;
|
|
48
48
|
t += 1;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
filter(e) {
|
|
52
52
|
const t = this._iterator;
|
|
53
|
-
return new
|
|
54
|
-
let
|
|
53
|
+
return new l(function* () {
|
|
54
|
+
let r = 0;
|
|
55
55
|
for (; ; ) {
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
e(
|
|
56
|
+
const n = t.next();
|
|
57
|
+
if (n.done)
|
|
58
|
+
return n.value;
|
|
59
|
+
e(n.value, r) && (yield n.value), r += 1;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
map(e) {
|
|
64
64
|
const t = this._iterator;
|
|
65
|
-
return new
|
|
66
|
-
let
|
|
65
|
+
return new l(function* () {
|
|
66
|
+
let r = 0;
|
|
67
67
|
for (; ; ) {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
yield e(
|
|
68
|
+
const n = t.next();
|
|
69
|
+
if (n.done)
|
|
70
|
+
return n.value;
|
|
71
|
+
yield e(n.value, r), r += 1;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
reduce(e, t) {
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
76
|
+
let r = 0, n = t;
|
|
77
|
+
if (n === void 0) {
|
|
78
|
+
const i = this._iterator.next();
|
|
79
|
+
if (i.done)
|
|
80
80
|
throw new TypeError("Reduce of empty iterator with no initial value");
|
|
81
|
-
|
|
81
|
+
n = i.value, r += 1;
|
|
82
82
|
}
|
|
83
83
|
for (; ; ) {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
87
|
-
|
|
84
|
+
const i = this._iterator.next();
|
|
85
|
+
if (i.done)
|
|
86
|
+
return n;
|
|
87
|
+
n = e(n, i.value, r), r += 1;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
enumerate() {
|
|
@@ -92,13 +92,13 @@ class c {
|
|
|
92
92
|
}
|
|
93
93
|
unique() {
|
|
94
94
|
const e = this._iterator;
|
|
95
|
-
return new
|
|
95
|
+
return new l(function* () {
|
|
96
96
|
const t = /* @__PURE__ */ new Set();
|
|
97
97
|
for (; ; ) {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
return
|
|
101
|
-
t.has(
|
|
98
|
+
const r = e.next();
|
|
99
|
+
if (r.done)
|
|
100
|
+
return r.value;
|
|
101
|
+
t.has(r.value) || (t.add(r.value), yield r.value);
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
}
|
|
@@ -113,10 +113,10 @@ class c {
|
|
|
113
113
|
forEach(e) {
|
|
114
114
|
let t = 0;
|
|
115
115
|
for (; ; ) {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
116
|
+
const r = this._iterator.next();
|
|
117
|
+
if (r.done)
|
|
118
118
|
return;
|
|
119
|
-
e(
|
|
119
|
+
e(r.value, t), t += 1;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
next(...e) {
|
|
@@ -129,23 +129,23 @@ class c {
|
|
|
129
129
|
return this;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
class
|
|
132
|
+
class h {
|
|
133
133
|
constructor(e) {
|
|
134
134
|
u(this, "_elements");
|
|
135
|
-
this._elements = new
|
|
135
|
+
this._elements = new l(e);
|
|
136
136
|
}
|
|
137
137
|
filter(e) {
|
|
138
138
|
const t = this._elements;
|
|
139
|
-
return new
|
|
140
|
-
for (const [
|
|
141
|
-
e(
|
|
139
|
+
return new h(function* () {
|
|
140
|
+
for (const [r, [n, i]] of t.enumerate())
|
|
141
|
+
e(n, i, r) && (yield [n, i]);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
map(e) {
|
|
145
145
|
const t = this._elements;
|
|
146
|
-
return new
|
|
147
|
-
for (const [
|
|
148
|
-
yield [
|
|
146
|
+
return new h(function* () {
|
|
147
|
+
for (const [r, [n, i]] of t.enumerate())
|
|
148
|
+
yield [n, e(n, i, r)];
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
toArray() {
|
|
@@ -158,91 +158,91 @@ class l {
|
|
|
158
158
|
return Object.fromEntries(this._elements.toArray());
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class d {
|
|
162
162
|
constructor(e) {
|
|
163
163
|
u(this, "_elements");
|
|
164
|
-
this._elements = new
|
|
164
|
+
this._elements = new l(e);
|
|
165
165
|
}
|
|
166
166
|
every(e) {
|
|
167
167
|
const t = /* @__PURE__ */ new Map();
|
|
168
|
-
for (const [
|
|
169
|
-
const [
|
|
170
|
-
|
|
168
|
+
for (const [r, n] of this._elements) {
|
|
169
|
+
const [i, o] = t.get(r) ?? [0, !0];
|
|
170
|
+
o && t.set(r, [i + 1, e(r, n, i)]);
|
|
171
171
|
}
|
|
172
|
-
return new
|
|
173
|
-
for (const [
|
|
174
|
-
yield [
|
|
172
|
+
return new h(function* () {
|
|
173
|
+
for (const [r, [n, i]] of t)
|
|
174
|
+
yield [r, i];
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
some(e) {
|
|
178
178
|
const t = /* @__PURE__ */ new Map();
|
|
179
|
-
for (const [
|
|
180
|
-
const [
|
|
181
|
-
|
|
179
|
+
for (const [r, n] of this._elements) {
|
|
180
|
+
const [i, o] = t.get(r) ?? [0, !1];
|
|
181
|
+
o || t.set(r, [i + 1, e(r, n, i)]);
|
|
182
182
|
}
|
|
183
|
-
return new
|
|
184
|
-
for (const [
|
|
185
|
-
yield [
|
|
183
|
+
return new h(function* () {
|
|
184
|
+
for (const [r, [n, i]] of t)
|
|
185
|
+
yield [r, i];
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
filter(e) {
|
|
189
189
|
const t = this._elements;
|
|
190
|
-
return new
|
|
191
|
-
const
|
|
192
|
-
for (const [
|
|
193
|
-
const
|
|
194
|
-
|
|
190
|
+
return new d(function* () {
|
|
191
|
+
const r = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const [n, i] of t) {
|
|
193
|
+
const o = r.get(n) ?? 0;
|
|
194
|
+
r.set(n, o + 1), e(n, i, o) && (yield [n, i]);
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
map(e) {
|
|
199
199
|
const t = this._elements;
|
|
200
|
-
return new
|
|
201
|
-
const
|
|
202
|
-
for (const [
|
|
203
|
-
const
|
|
204
|
-
|
|
200
|
+
return new d(function* () {
|
|
201
|
+
const r = /* @__PURE__ */ new Map();
|
|
202
|
+
for (const [n, i] of t) {
|
|
203
|
+
const o = r.get(n) ?? 0;
|
|
204
|
+
r.set(n, o + 1), yield [n, e(n, i, o)];
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
reduce(e, t) {
|
|
209
|
-
const
|
|
210
|
-
for (const [
|
|
211
|
-
let
|
|
212
|
-
if (
|
|
213
|
-
[
|
|
209
|
+
const r = /* @__PURE__ */ new Map();
|
|
210
|
+
for (const [n, i] of this._elements) {
|
|
211
|
+
let o, c;
|
|
212
|
+
if (r.has(n))
|
|
213
|
+
[o, c] = r.get(n), o += 1;
|
|
214
214
|
else if (t !== void 0)
|
|
215
|
-
|
|
215
|
+
o = 0, c = t;
|
|
216
216
|
else {
|
|
217
|
-
|
|
217
|
+
r.set(n, [0, i]);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
c = e(n, c, i, o), r.set(n, [o, c]);
|
|
221
221
|
}
|
|
222
|
-
return new
|
|
223
|
-
for (const [
|
|
224
|
-
yield [
|
|
222
|
+
return new h(function* () {
|
|
223
|
+
for (const [n, [i, o]] of r)
|
|
224
|
+
yield [n, o];
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
unique() {
|
|
228
228
|
const e = this._elements;
|
|
229
|
-
return new
|
|
229
|
+
return new d(function* () {
|
|
230
230
|
const t = /* @__PURE__ */ new Map();
|
|
231
|
-
for (const [
|
|
232
|
-
const
|
|
233
|
-
|
|
231
|
+
for (const [r, n] of e) {
|
|
232
|
+
const i = t.get(r) ?? /* @__PURE__ */ new Set();
|
|
233
|
+
i.has(n) || (i.add(n), t.set(r, i), yield [r, n]);
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
count() {
|
|
238
238
|
const e = /* @__PURE__ */ new Map();
|
|
239
239
|
for (const [t] of this._elements) {
|
|
240
|
-
const
|
|
241
|
-
e.set(t,
|
|
240
|
+
const r = e.get(t) ?? 0;
|
|
241
|
+
e.set(t, r + 1);
|
|
242
242
|
}
|
|
243
|
-
return new
|
|
244
|
-
for (const [t,
|
|
245
|
-
yield [t,
|
|
243
|
+
return new h(function* () {
|
|
244
|
+
for (const [t, r] of e)
|
|
245
|
+
yield [t, r];
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
toArray() {
|
|
@@ -250,69 +250,37 @@ class f {
|
|
|
250
250
|
}
|
|
251
251
|
toMap() {
|
|
252
252
|
const e = /* @__PURE__ */ new Map();
|
|
253
|
-
for (const [t,
|
|
254
|
-
const
|
|
255
|
-
|
|
253
|
+
for (const [t, r] of this._elements) {
|
|
254
|
+
const n = e.get(t) ?? [];
|
|
255
|
+
n.push(r), e.set(t, n);
|
|
256
256
|
}
|
|
257
257
|
return e;
|
|
258
258
|
}
|
|
259
259
|
toObject() {
|
|
260
260
|
const e = {};
|
|
261
|
-
for (const [t,
|
|
262
|
-
const
|
|
263
|
-
|
|
261
|
+
for (const [t, r] of this._elements) {
|
|
262
|
+
const n = e[t] ?? [];
|
|
263
|
+
n.push(r), e[t] = n;
|
|
264
264
|
}
|
|
265
265
|
return e;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
class
|
|
268
|
+
class _ {
|
|
269
269
|
constructor(e) {
|
|
270
270
|
u(this, "_elements");
|
|
271
|
-
this._elements = new
|
|
271
|
+
this._elements = new l(e);
|
|
272
272
|
}
|
|
273
273
|
filter(e) {
|
|
274
|
-
return new
|
|
274
|
+
return new _(this._elements.filter(e));
|
|
275
275
|
}
|
|
276
276
|
map(e) {
|
|
277
|
-
return new
|
|
277
|
+
return new _(this._elements.map(e));
|
|
278
278
|
}
|
|
279
279
|
unique() {
|
|
280
|
-
return new
|
|
280
|
+
return new _(this._elements.unique());
|
|
281
281
|
}
|
|
282
282
|
byKey(e) {
|
|
283
|
-
return new
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
class p {
|
|
287
|
-
constructor(e, t) {
|
|
288
|
-
u(this, "_resolve");
|
|
289
|
-
u(this, "_reject");
|
|
290
|
-
u(this, "_promise");
|
|
291
|
-
let n, r;
|
|
292
|
-
this._promise = new Promise((o, i) => {
|
|
293
|
-
n = o, r = i;
|
|
294
|
-
}).then(e, t), this._resolve = n, this._reject = r;
|
|
295
|
-
}
|
|
296
|
-
get resolve() {
|
|
297
|
-
return this._resolve;
|
|
298
|
-
}
|
|
299
|
-
get reject() {
|
|
300
|
-
return this._reject;
|
|
301
|
-
}
|
|
302
|
-
then(e, t) {
|
|
303
|
-
return this._promise.then(e, t);
|
|
304
|
-
}
|
|
305
|
-
catch(e) {
|
|
306
|
-
return this._promise.catch(e);
|
|
307
|
-
}
|
|
308
|
-
finally(e) {
|
|
309
|
-
return this._promise.finally(e);
|
|
310
|
-
}
|
|
311
|
-
watch(e) {
|
|
312
|
-
return e.then(this.resolve, this.reject), this;
|
|
313
|
-
}
|
|
314
|
-
get [Symbol.toStringTag]() {
|
|
315
|
-
return "DeferredPromise";
|
|
283
|
+
return new d(this._elements.map((t, r) => [e(t, r), t]));
|
|
316
284
|
}
|
|
317
285
|
}
|
|
318
286
|
class x {
|
|
@@ -322,25 +290,25 @@ class x {
|
|
|
322
290
|
u(this, "_persistent");
|
|
323
291
|
this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
324
292
|
}
|
|
325
|
-
_get(e, t,
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
293
|
+
_get(e, t, r) {
|
|
294
|
+
const n = e.getItem(t);
|
|
295
|
+
if (n)
|
|
328
296
|
try {
|
|
329
|
-
return JSON.parse(
|
|
297
|
+
return JSON.parse(n);
|
|
330
298
|
} catch {
|
|
331
299
|
console.warn(
|
|
332
|
-
`The "${
|
|
300
|
+
`The "${n}" value for "${t}" property cannot be parsed. Clearing the storage...`
|
|
333
301
|
), e.removeItem(t);
|
|
334
302
|
}
|
|
335
|
-
return
|
|
303
|
+
return r;
|
|
336
304
|
}
|
|
337
|
-
_set(e, t,
|
|
338
|
-
const
|
|
339
|
-
|
|
305
|
+
_set(e, t, r) {
|
|
306
|
+
const n = JSON.stringify(r);
|
|
307
|
+
n ? e.setItem(t, n) : e.removeItem(t);
|
|
340
308
|
}
|
|
341
|
-
get(e, t,
|
|
342
|
-
const
|
|
343
|
-
return this._get(
|
|
309
|
+
get(e, t, r = this._preferPersistence) {
|
|
310
|
+
const n = r ? this._persistent : this._volatile;
|
|
311
|
+
return this._get(n, e, t);
|
|
344
312
|
}
|
|
345
313
|
recall(e, t) {
|
|
346
314
|
return this._get(this._volatile, e, t);
|
|
@@ -401,9 +369,9 @@ class x {
|
|
|
401
369
|
* @param newValue The new value to set.
|
|
402
370
|
* @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
|
|
403
371
|
*/
|
|
404
|
-
set(e, t,
|
|
405
|
-
const
|
|
406
|
-
this._set(
|
|
372
|
+
set(e, t, r = this._preferPersistence) {
|
|
373
|
+
const n = r ? this._persistent : this._volatile;
|
|
374
|
+
this._set(n, e, t);
|
|
407
375
|
}
|
|
408
376
|
/**
|
|
409
377
|
* Sets the value with the specified name in the volatile `sessionStorage`.
|
|
@@ -461,14 +429,95 @@ class b {
|
|
|
461
429
|
remove(e) {
|
|
462
430
|
const t = this._subscribers.indexOf(e);
|
|
463
431
|
if (t < 0)
|
|
464
|
-
throw new
|
|
432
|
+
throw new f("Unable to remove the requested subscriber. It was not found.");
|
|
465
433
|
this._subscribers.splice(t, 1);
|
|
466
434
|
}
|
|
467
435
|
call(...e) {
|
|
468
436
|
return this._subscribers.slice().map((t) => t(...e));
|
|
469
437
|
}
|
|
470
438
|
}
|
|
471
|
-
class
|
|
439
|
+
class k {
|
|
440
|
+
constructor(e, t) {
|
|
441
|
+
u(this, "_isPending");
|
|
442
|
+
u(this, "_isFulfilled");
|
|
443
|
+
u(this, "_isRejected");
|
|
444
|
+
u(this, "_resolve");
|
|
445
|
+
u(this, "_reject");
|
|
446
|
+
u(this, "_promise");
|
|
447
|
+
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
448
|
+
let r, n;
|
|
449
|
+
const i = (a, m) => {
|
|
450
|
+
r = a, n = m;
|
|
451
|
+
};
|
|
452
|
+
let o;
|
|
453
|
+
e ? o = (a) => (this._isPending = !1, this._isFulfilled = !0, e(a)) : o = (a) => (this._isPending = !1, this._isFulfilled = !0, a);
|
|
454
|
+
let c;
|
|
455
|
+
t ? c = (a) => (this._isPending = !1, this._isRejected = !0, t(a)) : c = (a) => (this._isPending = !1, this._isRejected = !0, a), this._promise = new Promise(i).then(o, c), this._resolve = r, this._reject = n;
|
|
456
|
+
}
|
|
457
|
+
get isPending() {
|
|
458
|
+
return this._isPending;
|
|
459
|
+
}
|
|
460
|
+
get isFulfilled() {
|
|
461
|
+
return this._isFulfilled;
|
|
462
|
+
}
|
|
463
|
+
get isRejected() {
|
|
464
|
+
return this._isRejected;
|
|
465
|
+
}
|
|
466
|
+
get resolve() {
|
|
467
|
+
return this._resolve;
|
|
468
|
+
}
|
|
469
|
+
get reject() {
|
|
470
|
+
return this._reject;
|
|
471
|
+
}
|
|
472
|
+
then(e, t) {
|
|
473
|
+
return this._promise.then(e, t);
|
|
474
|
+
}
|
|
475
|
+
catch(e) {
|
|
476
|
+
return this._promise.catch(e);
|
|
477
|
+
}
|
|
478
|
+
finally(e) {
|
|
479
|
+
return this._promise.finally(e);
|
|
480
|
+
}
|
|
481
|
+
watch(e) {
|
|
482
|
+
return e.then(this.resolve, this.reject), this;
|
|
483
|
+
}
|
|
484
|
+
get [Symbol.toStringTag]() {
|
|
485
|
+
return "DeferredPromise";
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
class M {
|
|
489
|
+
constructor(e) {
|
|
490
|
+
u(this, "_isPending");
|
|
491
|
+
u(this, "_isFulfilled");
|
|
492
|
+
u(this, "_isRejected");
|
|
493
|
+
u(this, "_promise");
|
|
494
|
+
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
495
|
+
const t = (n) => (this._isPending = !1, this._isFulfilled = !0, n), r = (n) => (this._isPending = !1, this._isRejected = !0, n);
|
|
496
|
+
this._promise = new Promise(e).then(t, r);
|
|
497
|
+
}
|
|
498
|
+
get isPending() {
|
|
499
|
+
return this._isPending;
|
|
500
|
+
}
|
|
501
|
+
get isFulfilled() {
|
|
502
|
+
return this._isFulfilled;
|
|
503
|
+
}
|
|
504
|
+
get isRejected() {
|
|
505
|
+
return this._isRejected;
|
|
506
|
+
}
|
|
507
|
+
then(e, t) {
|
|
508
|
+
return this._promise.then(e, t);
|
|
509
|
+
}
|
|
510
|
+
catch(e) {
|
|
511
|
+
return this._promise.catch(e);
|
|
512
|
+
}
|
|
513
|
+
finally(e) {
|
|
514
|
+
return this._promise.finally(e);
|
|
515
|
+
}
|
|
516
|
+
get [Symbol.toStringTag]() {
|
|
517
|
+
return "SmartPromise";
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
class P {
|
|
472
521
|
static Boolean(e = 0.5) {
|
|
473
522
|
return Math.random() < e;
|
|
474
523
|
}
|
|
@@ -485,34 +534,34 @@ class g {
|
|
|
485
534
|
constructor() {
|
|
486
535
|
}
|
|
487
536
|
}
|
|
488
|
-
async function
|
|
537
|
+
async function j(s) {
|
|
489
538
|
return new Promise((e, t) => setTimeout(e, s));
|
|
490
539
|
}
|
|
491
|
-
async function
|
|
540
|
+
async function S() {
|
|
492
541
|
return new Promise((s, e) => requestAnimationFrame(() => s()));
|
|
493
542
|
}
|
|
494
|
-
var
|
|
495
|
-
function
|
|
543
|
+
var v = /* @__PURE__ */ ((s) => (s[s.Second = 1e3] = "Second", s[s.Minute = 6e4] = "Minute", s[s.Hour = 36e5] = "Hour", s[s.Day = 864e5] = "Day", s[s.Week = 6048e5] = "Week", s[s.Month = 2592e6] = "Month", s[s.Year = 31536e6] = "Year", s))(v || {});
|
|
544
|
+
function R(s, e, t = 864e5) {
|
|
496
545
|
return Math.floor((e.getTime() - s.getTime()) / t);
|
|
497
546
|
}
|
|
498
|
-
function
|
|
499
|
-
return new
|
|
500
|
-
const
|
|
501
|
-
let
|
|
502
|
-
for (;
|
|
503
|
-
yield new Date(
|
|
547
|
+
function F(s, e, t = 864e5) {
|
|
548
|
+
return new l(function* () {
|
|
549
|
+
const r = e.getTime();
|
|
550
|
+
let n = s.getTime();
|
|
551
|
+
for (; n < r; )
|
|
552
|
+
yield new Date(n), n += t;
|
|
504
553
|
});
|
|
505
554
|
}
|
|
506
555
|
function I(s, e = 864e5) {
|
|
507
556
|
return new Date(Math.floor(s.getTime() / e) * e);
|
|
508
557
|
}
|
|
509
|
-
async function
|
|
510
|
-
return new Promise((t,
|
|
511
|
-
const
|
|
512
|
-
|
|
558
|
+
async function T(s, e = "text/javascript") {
|
|
559
|
+
return new Promise((t, r) => {
|
|
560
|
+
const n = document.createElement("script");
|
|
561
|
+
n.async = !0, n.defer = !0, n.src = s, n.type = e, n.onload = () => t(), n.onerror = () => r(), document.body.appendChild(n);
|
|
513
562
|
});
|
|
514
563
|
}
|
|
515
|
-
function
|
|
564
|
+
function A(s) {
|
|
516
565
|
if (Array.isArray(s))
|
|
517
566
|
return s.length;
|
|
518
567
|
let e = 0;
|
|
@@ -520,95 +569,96 @@ function T(s) {
|
|
|
520
569
|
e += 1;
|
|
521
570
|
return e;
|
|
522
571
|
}
|
|
523
|
-
function
|
|
524
|
-
return new
|
|
572
|
+
function q(s, e, t = 1) {
|
|
573
|
+
return new l(function* () {
|
|
525
574
|
e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
|
|
526
|
-
for (let
|
|
527
|
-
yield
|
|
575
|
+
for (let r = s; r < e; r += t)
|
|
576
|
+
yield r;
|
|
528
577
|
});
|
|
529
578
|
}
|
|
530
|
-
function
|
|
579
|
+
function C(s) {
|
|
531
580
|
const e = Array.from(s);
|
|
532
581
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
533
|
-
const
|
|
534
|
-
[e[t], e[
|
|
582
|
+
const r = Math.floor(Math.random() * (t + 1));
|
|
583
|
+
[e[t], e[r]] = [e[r], e[t]];
|
|
535
584
|
}
|
|
536
585
|
return e;
|
|
537
586
|
}
|
|
538
|
-
function
|
|
539
|
-
return new
|
|
587
|
+
function E(s) {
|
|
588
|
+
return new l(function* () {
|
|
540
589
|
const e = /* @__PURE__ */ new Set();
|
|
541
590
|
for (const t of s)
|
|
542
591
|
e.has(t) || (e.add(t), yield t);
|
|
543
592
|
});
|
|
544
593
|
}
|
|
545
|
-
function
|
|
546
|
-
return new
|
|
547
|
-
const t = s[Symbol.iterator](),
|
|
594
|
+
function p(s, e) {
|
|
595
|
+
return new l(function* () {
|
|
596
|
+
const t = s[Symbol.iterator](), r = e[Symbol.iterator]();
|
|
548
597
|
for (; ; ) {
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
598
|
+
const n = t.next(), i = r.next();
|
|
599
|
+
if (n.done || i.done)
|
|
551
600
|
break;
|
|
552
|
-
yield [
|
|
601
|
+
yield [n.value, i.value];
|
|
553
602
|
}
|
|
554
603
|
});
|
|
555
604
|
}
|
|
556
|
-
function
|
|
605
|
+
function O(s, e) {
|
|
557
606
|
if (e === void 0) {
|
|
558
|
-
let
|
|
559
|
-
for (const
|
|
560
|
-
|
|
561
|
-
return
|
|
562
|
-
}
|
|
563
|
-
let t = 0,
|
|
564
|
-
for (const [
|
|
565
|
-
t +=
|
|
566
|
-
return t /
|
|
607
|
+
let n = 0, i = 0;
|
|
608
|
+
for (const o of s)
|
|
609
|
+
n += o, i += 1;
|
|
610
|
+
return n / i;
|
|
611
|
+
}
|
|
612
|
+
let t = 0, r = 0;
|
|
613
|
+
for (const [n, i] of p(s, e))
|
|
614
|
+
t += n * i, r += i;
|
|
615
|
+
return t / r;
|
|
567
616
|
}
|
|
568
|
-
function
|
|
617
|
+
function $(s) {
|
|
569
618
|
let e = 0;
|
|
570
619
|
for (let t = 0; t < s.length; t += 1) {
|
|
571
|
-
const
|
|
572
|
-
e = (e << 5) - e +
|
|
620
|
+
const r = s.charCodeAt(t);
|
|
621
|
+
e = (e << 5) - e + r, e |= 0;
|
|
573
622
|
}
|
|
574
623
|
return e;
|
|
575
624
|
}
|
|
576
|
-
function
|
|
625
|
+
function J(s) {
|
|
577
626
|
let e = 0;
|
|
578
627
|
for (const t of s)
|
|
579
628
|
e += t;
|
|
580
629
|
return e;
|
|
581
630
|
}
|
|
582
|
-
function
|
|
631
|
+
function V(s) {
|
|
583
632
|
return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
|
|
584
633
|
}
|
|
585
|
-
const
|
|
634
|
+
const z = "1.3.1";
|
|
586
635
|
export {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
636
|
+
d as AggregatedIterator,
|
|
637
|
+
_ as Aggregator,
|
|
638
|
+
v as DateUnit,
|
|
639
|
+
k as DeferredPromise,
|
|
640
|
+
f as Exception,
|
|
592
641
|
x as JsonStorage,
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
642
|
+
P as Random,
|
|
643
|
+
h as ReducedIterator,
|
|
644
|
+
l as SmartIterator,
|
|
645
|
+
M as SmartPromise,
|
|
596
646
|
b as Subscribers,
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
647
|
+
z as VERSION,
|
|
648
|
+
O as average,
|
|
649
|
+
V as capitalize,
|
|
650
|
+
A as count,
|
|
651
|
+
R as dateDifference,
|
|
652
|
+
F as dateRange,
|
|
603
653
|
I as dateRound,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
654
|
+
j as delay,
|
|
655
|
+
$ as hash,
|
|
656
|
+
T as loadScript,
|
|
657
|
+
S as nextAnimationFrame,
|
|
658
|
+
q as range,
|
|
659
|
+
C as shuffle,
|
|
660
|
+
J as sum,
|
|
661
|
+
E as unique,
|
|
662
|
+
p as zip
|
|
613
663
|
};
|
|
614
664
|
//# sourceMappingURL=core.js.map
|