esexts 1.3.4 → 1.4.0
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/esexts.js +634 -828
- package/dist/esexts.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/esexts.js
CHANGED
|
@@ -1,942 +1,748 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const u = (t, e) => Object.defineProperties(t, Object.fromEntries(Object.keys(e).map((n) => [n, { value: e[n], enumerable: !1, configurable: !0, writable: !0 }])));
|
|
2
|
+
function d() {
|
|
3
3
|
return {
|
|
4
|
-
new: {
|
|
5
|
-
|
|
6
|
-
return new this(...t);
|
|
7
|
-
},
|
|
8
|
-
...s
|
|
4
|
+
new: function(...t) {
|
|
5
|
+
return new this(...t);
|
|
9
6
|
}
|
|
10
7
|
};
|
|
11
8
|
}
|
|
12
|
-
function
|
|
9
|
+
function p(...t) {
|
|
13
10
|
const e = {};
|
|
14
11
|
for (const n of t) {
|
|
15
12
|
const [r, i] = Array.isArray(n) ? n : [n, n];
|
|
16
|
-
e[i] = {
|
|
17
|
-
|
|
18
|
-
return this[r](...u), this;
|
|
19
|
-
},
|
|
20
|
-
...s
|
|
13
|
+
e[i] = function(...s) {
|
|
14
|
+
return this[r](...s), this;
|
|
21
15
|
};
|
|
22
16
|
}
|
|
23
17
|
return e;
|
|
24
18
|
}
|
|
25
|
-
function
|
|
19
|
+
function F(...t) {
|
|
26
20
|
const e = {};
|
|
27
21
|
for (const n of t) {
|
|
28
22
|
const [r, i] = Array.isArray(n) ? n : [n, n];
|
|
29
|
-
e[i] = {
|
|
30
|
-
|
|
31
|
-
return this[r](...u), u[0];
|
|
32
|
-
},
|
|
33
|
-
...s
|
|
23
|
+
e[i] = function(...s) {
|
|
24
|
+
return this[r](...s), s[0];
|
|
34
25
|
};
|
|
35
26
|
}
|
|
36
27
|
return e;
|
|
37
28
|
}
|
|
38
|
-
function
|
|
29
|
+
function b(...t) {
|
|
39
30
|
const e = {};
|
|
40
31
|
for (const n of t) {
|
|
41
32
|
const [r, i] = Array.isArray(n) ? n : [n, n];
|
|
42
|
-
e[i] = {
|
|
43
|
-
|
|
44
|
-
return this[r](...u), u;
|
|
45
|
-
},
|
|
46
|
-
...s
|
|
33
|
+
e[i] = function(...s) {
|
|
34
|
+
return this[r](...s), s;
|
|
47
35
|
};
|
|
48
36
|
}
|
|
49
37
|
return e;
|
|
50
38
|
}
|
|
51
|
-
function
|
|
39
|
+
function m(...t) {
|
|
52
40
|
const e = {};
|
|
53
41
|
for (const n of t) {
|
|
54
42
|
const [r, i] = Array.isArray(n) ? n : [n, n];
|
|
55
|
-
e[i] = {
|
|
56
|
-
|
|
57
|
-
return this[r];
|
|
58
|
-
},
|
|
59
|
-
...s
|
|
43
|
+
e[i] = function() {
|
|
44
|
+
return this[r];
|
|
60
45
|
};
|
|
61
46
|
}
|
|
62
47
|
return e;
|
|
63
48
|
}
|
|
64
|
-
function
|
|
49
|
+
function A(...t) {
|
|
65
50
|
const e = {};
|
|
66
51
|
for (const n of t) {
|
|
67
52
|
const [r, i] = Array.isArray(n) ? n : [n, n];
|
|
68
|
-
e[i] = {
|
|
69
|
-
|
|
70
|
-
return [...this[r](...u)];
|
|
71
|
-
},
|
|
72
|
-
...s
|
|
53
|
+
e[i] = function(...s) {
|
|
54
|
+
return [...this[r](...s)];
|
|
73
55
|
};
|
|
74
56
|
}
|
|
75
57
|
return e;
|
|
76
58
|
}
|
|
77
|
-
function
|
|
59
|
+
function I(t, ...e) {
|
|
78
60
|
const n = {};
|
|
79
61
|
for (const r of e) {
|
|
80
|
-
const [i,
|
|
81
|
-
n[
|
|
82
|
-
value: t[i],
|
|
83
|
-
...s
|
|
84
|
-
};
|
|
62
|
+
const [i, s] = Array.isArray(r) ? r : [r, r];
|
|
63
|
+
n[s] = t[i];
|
|
85
64
|
}
|
|
86
65
|
return n;
|
|
87
66
|
}
|
|
88
|
-
function
|
|
67
|
+
function x(t, ...e) {
|
|
89
68
|
const n = {};
|
|
90
69
|
for (const r of e) {
|
|
91
|
-
const [i,
|
|
92
|
-
n[
|
|
93
|
-
|
|
94
|
-
return t[i](this, ...o);
|
|
95
|
-
},
|
|
96
|
-
...s
|
|
70
|
+
const [i, s] = Array.isArray(r) ? r : [r, r];
|
|
71
|
+
n[s] = function(...o) {
|
|
72
|
+
return t[i](this, ...o);
|
|
97
73
|
};
|
|
98
74
|
}
|
|
99
75
|
return n;
|
|
100
76
|
}
|
|
101
|
-
function
|
|
77
|
+
function j(t, ...e) {
|
|
102
78
|
const n = {};
|
|
103
79
|
for (const r of e) {
|
|
104
|
-
const [i,
|
|
105
|
-
n[
|
|
106
|
-
|
|
107
|
-
return t[i](this, ...o), this;
|
|
108
|
-
},
|
|
109
|
-
...s
|
|
80
|
+
const [i, s] = Array.isArray(r) ? r : [r, r];
|
|
81
|
+
n[s] = function(...o) {
|
|
82
|
+
return t[i](this, ...o), this;
|
|
110
83
|
};
|
|
111
84
|
}
|
|
112
85
|
return n;
|
|
113
86
|
}
|
|
114
|
-
function
|
|
87
|
+
function M(t = { array: !1 }) {
|
|
115
88
|
return function(e = {}, ...n) {
|
|
116
|
-
const r = (i,
|
|
117
|
-
const o = Object.prototype.toString.call(i),
|
|
118
|
-
if (o !==
|
|
119
|
-
return
|
|
89
|
+
const r = (i, s) => {
|
|
90
|
+
const o = Object.prototype.toString.call(i), l = Object.prototype.toString.call(s);
|
|
91
|
+
if (o !== l)
|
|
92
|
+
return s;
|
|
120
93
|
if (o === "[object Array]")
|
|
121
|
-
return t.array ? i.concat(...
|
|
94
|
+
return t.array ? i.concat(...s) : s;
|
|
122
95
|
if (o === "[object Object]") {
|
|
123
|
-
for (const
|
|
124
|
-
i[
|
|
96
|
+
for (const f in s)
|
|
97
|
+
i[f] = r(i[f], s[f]);
|
|
125
98
|
return i;
|
|
126
99
|
} else
|
|
127
|
-
return
|
|
100
|
+
return s;
|
|
128
101
|
};
|
|
129
102
|
for (const i of n)
|
|
130
103
|
e = r(e, i);
|
|
131
104
|
return e;
|
|
132
105
|
};
|
|
133
106
|
}
|
|
134
|
-
const D =
|
|
135
|
-
|
|
136
|
-
isObject: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
...
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return D(this, ...t);
|
|
145
|
-
},
|
|
146
|
-
...s
|
|
147
|
-
},
|
|
148
|
-
concat0: {
|
|
149
|
-
value: function(...t) {
|
|
150
|
-
return F(this, ...t);
|
|
151
|
-
},
|
|
152
|
-
...s
|
|
107
|
+
const D = M({ array: !1 }), O = M({ array: !0 });
|
|
108
|
+
u(Object, {
|
|
109
|
+
isObject: function(t) {
|
|
110
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
111
|
+
},
|
|
112
|
+
merge0: function(...t) {
|
|
113
|
+
return D(this, ...t);
|
|
114
|
+
},
|
|
115
|
+
concat0: function(...t) {
|
|
116
|
+
return O(this, ...t);
|
|
153
117
|
}
|
|
154
118
|
});
|
|
155
|
-
|
|
156
|
-
clone0: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
...
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
e[n] = this[n];
|
|
192
|
-
return e;
|
|
193
|
-
},
|
|
194
|
-
...s
|
|
195
|
-
},
|
|
196
|
-
omit0: {
|
|
197
|
-
value: function(...t) {
|
|
198
|
-
const e = {}, n = new Set(t);
|
|
199
|
-
for (const r in this)
|
|
200
|
-
n.has(r) || (e[r] = this[r]);
|
|
201
|
-
return e;
|
|
202
|
-
},
|
|
203
|
-
...s
|
|
204
|
-
},
|
|
205
|
-
attr0: {
|
|
206
|
-
value: function(t, ...e) {
|
|
207
|
-
return typeof this != "object" ? this : typeof t == "function" ? t(this, ...e) : this[t];
|
|
208
|
-
},
|
|
209
|
-
...s
|
|
210
|
-
},
|
|
211
|
-
toArray0: {
|
|
212
|
-
value: function() {
|
|
213
|
-
return Array.isArray(this) ? this : [this];
|
|
214
|
-
},
|
|
215
|
-
...s
|
|
216
|
-
},
|
|
217
|
-
...M(console, ["debug", "debug0"], ["log", "log0"], ["info", "info0"], ["warn", "warn0"], ["error", "error0"], ["dir", "dir0"]),
|
|
119
|
+
u(Object.prototype, {
|
|
120
|
+
clone0: function() {
|
|
121
|
+
return JSON.parse(JSON.stringify(this));
|
|
122
|
+
},
|
|
123
|
+
length0: function() {
|
|
124
|
+
return Object.keys(this).length;
|
|
125
|
+
},
|
|
126
|
+
...x(Object, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
|
|
127
|
+
merge0: function(...t) {
|
|
128
|
+
return D(this, ...t);
|
|
129
|
+
},
|
|
130
|
+
concat0: function(...t) {
|
|
131
|
+
return O(this, ...t);
|
|
132
|
+
},
|
|
133
|
+
map0: function(t = (n, r, i) => [n, r], e = 0) {
|
|
134
|
+
return Object.entries(this).map(([n, r]) => t(n, r, e++));
|
|
135
|
+
},
|
|
136
|
+
pick0: function(...t) {
|
|
137
|
+
const e = {};
|
|
138
|
+
for (const n of t)
|
|
139
|
+
e[n] = this[n];
|
|
140
|
+
return e;
|
|
141
|
+
},
|
|
142
|
+
omit0: function(...t) {
|
|
143
|
+
const e = {}, n = new Set(t);
|
|
144
|
+
for (const r in this)
|
|
145
|
+
n.has(r) || (e[r] = this[r]);
|
|
146
|
+
return e;
|
|
147
|
+
},
|
|
148
|
+
attr0: function(t, ...e) {
|
|
149
|
+
return typeof this != "object" ? this : typeof t == "function" ? t(this, ...e) : this[t];
|
|
150
|
+
},
|
|
151
|
+
toArray0: function() {
|
|
152
|
+
return Array.isArray(this) ? this : [this];
|
|
153
|
+
},
|
|
154
|
+
...j(console, ["debug", "debug0"], ["log", "log0"], ["info", "info0"], ["warn", "warn0"], ["error", "error0"], ["dir", "dir0"]),
|
|
218
155
|
// ====== Tree ======
|
|
219
|
-
getParents0: {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
...s
|
|
239
|
-
},
|
|
240
|
-
treeFind0: {
|
|
241
|
-
value: function(t, e = !0, n = -1, r = "children") {
|
|
242
|
-
if (e && t(this))
|
|
243
|
-
return this;
|
|
244
|
-
if (n == 0 || !this[r] || this[r].length == 0)
|
|
245
|
-
return null;
|
|
246
|
-
for (const i of this[r]) {
|
|
247
|
-
const u = i.treeFind0(t, !0, n - 1, r);
|
|
248
|
-
if (u !== null)
|
|
249
|
-
return u;
|
|
250
|
-
}
|
|
156
|
+
getParents0: function(t = !1, e = -1, n = "parent") {
|
|
157
|
+
const r = t ? [this] : [];
|
|
158
|
+
let i = this[n];
|
|
159
|
+
for (; i && e-- != 0; )
|
|
160
|
+
r.push(i), i = i[n];
|
|
161
|
+
return r;
|
|
162
|
+
},
|
|
163
|
+
getChildrens0: function(t = !1, e = -1, n = "children") {
|
|
164
|
+
const r = [], i = (s, o, l) => {
|
|
165
|
+
if (o && r.push(s), !(l == 0 || !s[n] || s[n].length == 0))
|
|
166
|
+
for (const f of s[n])
|
|
167
|
+
i(f, !0, l - 1);
|
|
168
|
+
};
|
|
169
|
+
return i(this, t, e), r;
|
|
170
|
+
},
|
|
171
|
+
treeFind0: function(t, e = !0, n = -1, r = "children") {
|
|
172
|
+
if (e && t(this))
|
|
173
|
+
return this;
|
|
174
|
+
if (n == 0 || !this[r] || this[r].length == 0)
|
|
251
175
|
return null;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
...s
|
|
176
|
+
for (const i of this[r]) {
|
|
177
|
+
const s = i.treeFind0(t, !0, n - 1, r);
|
|
178
|
+
if (s !== null)
|
|
179
|
+
return s;
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
},
|
|
183
|
+
treeEach0: function(t, e = !0, n = -1, r = "children") {
|
|
184
|
+
if (e && t(this), !(n == 0 || !this[r] || this[r].length == 0)) {
|
|
185
|
+
for (const i of this[r])
|
|
186
|
+
i.treeEach0(t, !0, n - 1, r);
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
treeMap0: function(t, e = !0, n = -1, r = "children", i = null) {
|
|
191
|
+
const s = e ? t(this) : this, o = [];
|
|
192
|
+
if (n == 0 || !this[r] || this[r].length == 0)
|
|
193
|
+
return s;
|
|
194
|
+
for (const l of this[r])
|
|
195
|
+
o.push(l.treeMap0(t, !0, n - 1, r, i));
|
|
196
|
+
return s[r] = o, s;
|
|
275
197
|
}
|
|
276
198
|
});
|
|
277
|
-
|
|
278
|
-
...
|
|
279
|
-
baseConvert: {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
toFixed0: {
|
|
295
|
-
value: function(...t) {
|
|
296
|
-
return +this.toFixed(...t);
|
|
297
|
-
},
|
|
298
|
-
...s
|
|
299
|
-
},
|
|
300
|
-
toDate: {
|
|
301
|
-
value: function() {
|
|
302
|
-
return Date.new(this);
|
|
303
|
-
},
|
|
304
|
-
...s
|
|
199
|
+
u(Number.prototype, {
|
|
200
|
+
...x(Math, "ceil", "floor", "trunc", "abs", "max", "min"),
|
|
201
|
+
baseConvert: function(t = 64) {
|
|
202
|
+
let e = "", n = this, r = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
203
|
+
for (; n > 0; )
|
|
204
|
+
e = r.at(n % t) + e, n = Math.floor(n / t);
|
|
205
|
+
return e || "0";
|
|
206
|
+
},
|
|
207
|
+
round: function(t = 0) {
|
|
208
|
+
return t == 0 ? Math.round(this) : Math.round(this * 10 ** t) / 10 ** t;
|
|
209
|
+
},
|
|
210
|
+
toFixed0: function(...t) {
|
|
211
|
+
return +this.toFixed(...t);
|
|
212
|
+
},
|
|
213
|
+
toDate: function() {
|
|
214
|
+
return Date.new(this);
|
|
305
215
|
}
|
|
306
216
|
});
|
|
307
|
-
|
|
308
|
-
toJSON: {
|
|
309
|
-
|
|
310
|
-
return this < BigInt(Number.MIN_SAFE_INTEGER) || this > BigInt(Number.MAX_SAFE_INTEGER) ? this.toString() : Number(this);
|
|
311
|
-
},
|
|
312
|
-
...s
|
|
217
|
+
u(BigInt.prototype, {
|
|
218
|
+
toJSON: function() {
|
|
219
|
+
return this < BigInt(Number.MIN_SAFE_INTEGER) || this > BigInt(Number.MAX_SAFE_INTEGER) ? this.toString() : Number(this);
|
|
313
220
|
}
|
|
314
221
|
});
|
|
315
|
-
|
|
316
|
-
...
|
|
317
|
-
substring0: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
},
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
},
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
},
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
value: function(t = 64) {
|
|
416
|
-
let e = 0, n = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
417
|
-
for (let r = 0; r < this.length; r++)
|
|
418
|
-
e = e * t + n.indexOf(this.at(r));
|
|
419
|
-
return e;
|
|
420
|
-
},
|
|
421
|
-
...s
|
|
422
|
-
},
|
|
423
|
-
toFixed0: {
|
|
424
|
-
value: function(...t) {
|
|
425
|
-
return +(+this).toFixed(...t);
|
|
426
|
-
},
|
|
427
|
-
...s
|
|
428
|
-
},
|
|
429
|
-
toDate: {
|
|
430
|
-
value: function() {
|
|
431
|
-
return Date.new(this);
|
|
432
|
-
},
|
|
433
|
-
...s
|
|
434
|
-
},
|
|
435
|
-
hex2bytes: {
|
|
436
|
-
value: function() {
|
|
437
|
-
const t = [];
|
|
438
|
-
for (let e = 0; e < this.length; e += 2)
|
|
439
|
-
t.push(Number.parseInt(this.substring(e, e + 2), 16));
|
|
440
|
-
return t;
|
|
441
|
-
},
|
|
442
|
-
...s
|
|
443
|
-
},
|
|
444
|
-
string2bytes: {
|
|
445
|
-
value: function() {
|
|
446
|
-
if (typeof TextEncoder < "u")
|
|
447
|
-
return Array.from(new TextEncoder().encode(this));
|
|
448
|
-
const t = [], e = encodeURIComponent(this);
|
|
449
|
-
for (let n = 0; n < e.length; )
|
|
450
|
-
t.push(e.charAt(n) == "%" ? Number.parseInt(e.substring(n + 1, n += 3), 16) : e.charCodeAt(n++));
|
|
451
|
-
return t;
|
|
452
|
-
},
|
|
453
|
-
...s
|
|
454
|
-
},
|
|
455
|
-
base64decode: {
|
|
456
|
-
value: function(t) {
|
|
457
|
-
const e = [], n = {}, r = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
458
|
-
for (let u = 0; u < r.length; u++)
|
|
459
|
-
n[r.charAt(u)] = u;
|
|
460
|
-
const i = this.charAt(this.length - 1) != "=" ? this.length : this.charAt(this.length - 2) != "=" ? this.length - 1 : this.length - 2;
|
|
461
|
-
for (let u = 3; u < i; u += 4) {
|
|
462
|
-
const o = (n[this.charAt(u - 3)] << 18) + (n[this.charAt(u - 2)] << 12) + (n[this.charAt(u - 1)] << 6) + n[this.charAt(u)];
|
|
463
|
-
e.push((o & 16711680) >> 16, (o & 65280) >> 8, o & 255);
|
|
464
|
-
}
|
|
465
|
-
if (i % 4 == 3) {
|
|
466
|
-
const u = (n[this.charAt(i - 3)] << 18) + (n[this.charAt(i - 2)] << 12) + (n[this.charAt(i - 1)] << 6);
|
|
467
|
-
e.push((u & 16711680) >> 16, (u & 65280) >> 8);
|
|
468
|
-
} else if (i % 4 == 2) {
|
|
469
|
-
const u = (n[this.charAt(i - 2)] << 18) + (n[this.charAt(i - 1)] << 12);
|
|
470
|
-
e.push((u & 16711680) >> 16);
|
|
471
|
-
}
|
|
472
|
-
return e;
|
|
473
|
-
},
|
|
474
|
-
...s
|
|
222
|
+
u(String.prototype, {
|
|
223
|
+
...m(["length", "length0"]),
|
|
224
|
+
substring0: function(t = 0, e = this.length) {
|
|
225
|
+
return t = t >= 0 ? t : this.length + t, e = e >= 0 ? e : this.length + e, this.substring(t, e);
|
|
226
|
+
},
|
|
227
|
+
substr0: function(t = 0, e = this.length) {
|
|
228
|
+
return t = t >= 0 ? t : this.length + t, e = t + e, this.substring(t, e);
|
|
229
|
+
},
|
|
230
|
+
split0: function(t = ",", e = -1) {
|
|
231
|
+
const n = this ? this.split(t) : [];
|
|
232
|
+
return e === -1 ? n : n.push0(n.splice(e - 1).join(t));
|
|
233
|
+
},
|
|
234
|
+
splitNumber: function(t = ",") {
|
|
235
|
+
return this.split0(t).map((e) => +e);
|
|
236
|
+
},
|
|
237
|
+
splitSegment: function(t = 1) {
|
|
238
|
+
const e = [];
|
|
239
|
+
for (let n = 0; n < this.length; n += t)
|
|
240
|
+
e.push(this.substring(n, n + t));
|
|
241
|
+
return e;
|
|
242
|
+
},
|
|
243
|
+
sprintf: function(...t) {
|
|
244
|
+
let [e, ...n] = this.split(/%[sd]/);
|
|
245
|
+
for (let r = 0; r < n.length; r++)
|
|
246
|
+
e += t[r] + n[r];
|
|
247
|
+
return e;
|
|
248
|
+
},
|
|
249
|
+
subOf: function(t, e, n = 0, r = 0) {
|
|
250
|
+
for (let o = 0; o < n && r != -1; o++, r++)
|
|
251
|
+
r = this.indexOf(t, r);
|
|
252
|
+
let i = this.indexOf(t, r), s = this.indexOf(e, i);
|
|
253
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
254
|
+
},
|
|
255
|
+
lastSubOf: function(t, e, n = 0, r = 1 / 0) {
|
|
256
|
+
for (let o = 0; o < n && r != -1; o++, r--)
|
|
257
|
+
r = this.lastIndexOf(t, r);
|
|
258
|
+
let i = this.lastIndexOf(t, r), s = this.indexOf(e, i);
|
|
259
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
260
|
+
},
|
|
261
|
+
camel2under: function() {
|
|
262
|
+
return this.substr(0, 1) + this.substr(1).replace(/([A-Z])/g, (t, e) => "_" + e.toLowerCase());
|
|
263
|
+
},
|
|
264
|
+
under2camel: function() {
|
|
265
|
+
return this.replace(/_([a-z])/g, (t, e) => e.toUpperCase());
|
|
266
|
+
},
|
|
267
|
+
camel2pascal: function() {
|
|
268
|
+
return this.substr(0, 1).toUpperCase() + this.substr(1);
|
|
269
|
+
},
|
|
270
|
+
pascal2camel: function() {
|
|
271
|
+
return this.substr(0, 1).toLowerCase() + this.substr(1);
|
|
272
|
+
},
|
|
273
|
+
under2kebab: function() {
|
|
274
|
+
return this.replace(/_/g, "-");
|
|
275
|
+
},
|
|
276
|
+
kebab2under: function() {
|
|
277
|
+
return this.replace(/-/g, "_");
|
|
278
|
+
},
|
|
279
|
+
baseConvert: function(t = 64) {
|
|
280
|
+
let e = 0, n = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
281
|
+
for (let r = 0; r < this.length; r++)
|
|
282
|
+
e = e * t + n.indexOf(this.at(r));
|
|
283
|
+
return e;
|
|
284
|
+
},
|
|
285
|
+
toFixed0: function(...t) {
|
|
286
|
+
return +(+this).toFixed(...t);
|
|
287
|
+
},
|
|
288
|
+
toDate: function() {
|
|
289
|
+
return Date.new(this);
|
|
290
|
+
},
|
|
291
|
+
hex2bytes: function() {
|
|
292
|
+
const t = [];
|
|
293
|
+
for (let e = 0; e < this.length; e += 2)
|
|
294
|
+
t.push(Number.parseInt(this.substring(e, e + 2), 16));
|
|
295
|
+
return t;
|
|
296
|
+
},
|
|
297
|
+
string2bytes: function() {
|
|
298
|
+
if (typeof TextEncoder < "u")
|
|
299
|
+
return Array.from(new TextEncoder().encode(this));
|
|
300
|
+
const t = [], e = encodeURIComponent(this);
|
|
301
|
+
for (let n = 0; n < e.length; )
|
|
302
|
+
t.push(e.charAt(n) == "%" ? Number.parseInt(e.substring(n + 1, n += 3), 16) : e.charCodeAt(n++));
|
|
303
|
+
return t;
|
|
304
|
+
},
|
|
305
|
+
base64decode: function(t) {
|
|
306
|
+
const e = [], n = {}, r = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
307
|
+
for (let s = 0; s < r.length; s++)
|
|
308
|
+
n[r.charAt(s)] = s;
|
|
309
|
+
const i = this.charAt(this.length - 1) != "=" ? this.length : this.charAt(this.length - 2) != "=" ? this.length - 1 : this.length - 2;
|
|
310
|
+
for (let s = 3; s < i; s += 4) {
|
|
311
|
+
const o = (n[this.charAt(s - 3)] << 18) + (n[this.charAt(s - 2)] << 12) + (n[this.charAt(s - 1)] << 6) + n[this.charAt(s)];
|
|
312
|
+
e.push((o & 16711680) >> 16, (o & 65280) >> 8, o & 255);
|
|
313
|
+
}
|
|
314
|
+
if (i % 4 == 3) {
|
|
315
|
+
const s = (n[this.charAt(i - 3)] << 18) + (n[this.charAt(i - 2)] << 12) + (n[this.charAt(i - 1)] << 6);
|
|
316
|
+
e.push((s & 16711680) >> 16, (s & 65280) >> 8);
|
|
317
|
+
} else if (i % 4 == 2) {
|
|
318
|
+
const s = (n[this.charAt(i - 2)] << 18) + (n[this.charAt(i - 1)] << 12);
|
|
319
|
+
e.push((s & 16711680) >> 16);
|
|
320
|
+
}
|
|
321
|
+
return e;
|
|
475
322
|
}
|
|
476
323
|
});
|
|
477
|
-
typeof Iterator < "u" &&
|
|
478
|
-
toArray: {
|
|
479
|
-
|
|
480
|
-
return Array.from(this);
|
|
481
|
-
},
|
|
482
|
-
...s
|
|
324
|
+
typeof Iterator < "u" && u(Iterator.prototype, {
|
|
325
|
+
toArray: function() {
|
|
326
|
+
return Array.from(this);
|
|
483
327
|
}
|
|
484
328
|
});
|
|
485
|
-
|
|
486
|
-
...
|
|
329
|
+
u(Array, {
|
|
330
|
+
...d()
|
|
487
331
|
});
|
|
488
|
-
|
|
489
|
-
...
|
|
490
|
-
...
|
|
491
|
-
...
|
|
492
|
-
...
|
|
493
|
-
...
|
|
494
|
-
first0: {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
},
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
value: function() {
|
|
566
|
-
let t = "";
|
|
567
|
-
for (let e = 0; e < this.length; e++)
|
|
568
|
-
t += (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
569
|
-
return t;
|
|
570
|
-
},
|
|
571
|
-
...s
|
|
572
|
-
},
|
|
573
|
-
bytes2string: {
|
|
574
|
-
value: function() {
|
|
575
|
-
if (typeof TextDecoder < "u")
|
|
576
|
-
return new TextDecoder().decode(new Uint8Array(this));
|
|
577
|
-
let t = "";
|
|
578
|
-
for (let e = 0; e < this.length; e++)
|
|
579
|
-
t += "%" + (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
580
|
-
return decodeURIComponent(t);
|
|
581
|
-
},
|
|
582
|
-
...s
|
|
583
|
-
},
|
|
584
|
-
base64encode: {
|
|
585
|
-
value: function(t = !1, e = !0) {
|
|
586
|
-
let n = "", r = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
587
|
-
for (let i = 2; i < this.length; i += 3) {
|
|
588
|
-
const u = (this[i - 2] << 16) + (this[i - 1] << 8) + this[i];
|
|
589
|
-
n += r.charAt((u & 16515072) >> 18) + r.charAt((u & 258048) >> 12) + r.charAt((u & 4032) >> 6) + r.charAt(u & 63);
|
|
590
|
-
}
|
|
591
|
-
if (this.length % 3 == 2) {
|
|
592
|
-
const i = (this[this.length - 2] << 16) + (this[this.length - 1] << 8);
|
|
593
|
-
n += r.charAt((i & 16515072) >> 18) + r.charAt((i & 258048) >> 12) + r.charAt((i & 4032) >> 6) + (e === !1 ? "" : "=");
|
|
594
|
-
} else if (this.length % 3 == 1) {
|
|
595
|
-
const i = this[this.length - 1] << 16;
|
|
596
|
-
n += r.charAt((i & 16515072) >> 18) + r.charAt((i & 258048) >> 12) + (e === !1 ? "" : "==");
|
|
597
|
-
}
|
|
598
|
-
return n;
|
|
599
|
-
},
|
|
600
|
-
...s
|
|
601
|
-
},
|
|
602
|
-
toUint8Array: {
|
|
603
|
-
value: function() {
|
|
604
|
-
return new Uint8Array(this);
|
|
605
|
-
},
|
|
606
|
-
...s
|
|
332
|
+
u(Array.prototype, {
|
|
333
|
+
...m(["length", "length0"]),
|
|
334
|
+
...A(["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
|
|
335
|
+
...p(["push", "push0"], ["pop", "pop0"], ["shift", "shift0"], ["unshift", "unshift0"]),
|
|
336
|
+
...F(["push", "push1"], ["unshift", "unshift1"]),
|
|
337
|
+
...b(["push", "push3"], ["unshift", "unshift3"]),
|
|
338
|
+
first0: function(t = null) {
|
|
339
|
+
return this.length ? this[0] : t;
|
|
340
|
+
},
|
|
341
|
+
last0: function(t = null) {
|
|
342
|
+
return this.length ? this[this.length - 1] : t;
|
|
343
|
+
},
|
|
344
|
+
find0: function(t, e = null) {
|
|
345
|
+
return this.find(t) ?? e;
|
|
346
|
+
},
|
|
347
|
+
equals0: function(t) {
|
|
348
|
+
return this.length === t.length && (this === t || this.length === 0 || this.every((e, n) => e === t[n]));
|
|
349
|
+
},
|
|
350
|
+
unique0: function(t = (e) => e) {
|
|
351
|
+
const e = /* @__PURE__ */ new Set();
|
|
352
|
+
return this.filter((n) => e.has(t(n)) ? !1 : !!e.add(t(n)));
|
|
353
|
+
},
|
|
354
|
+
...p(["forEach", "each0"]),
|
|
355
|
+
toObject: function(t = (e, n) => [n, e]) {
|
|
356
|
+
return Object.fromEntries(this.map(t));
|
|
357
|
+
},
|
|
358
|
+
toMap: function(t = (e, n) => [n, e]) {
|
|
359
|
+
return new Map(this.map(t));
|
|
360
|
+
},
|
|
361
|
+
toSet: function(t = (e) => e) {
|
|
362
|
+
return new Set(this.map(t));
|
|
363
|
+
},
|
|
364
|
+
toGroup: function(t = (e) => [e.id, e]) {
|
|
365
|
+
const e = {};
|
|
366
|
+
for (const n of this) {
|
|
367
|
+
const [r, i] = t(n);
|
|
368
|
+
r in e || (e[r] = []), e[r].push(i);
|
|
369
|
+
}
|
|
370
|
+
return e;
|
|
371
|
+
},
|
|
372
|
+
toMerge: function(t = (r) => r.id, e = (r) => ({ ...r, children: [] }), n = (r, i) => r.children.push(i)) {
|
|
373
|
+
const r = [];
|
|
374
|
+
for (const i of this)
|
|
375
|
+
n(r.find((s) => t(s) == t(i)) ?? r.push1(e(i)), i);
|
|
376
|
+
return r;
|
|
377
|
+
},
|
|
378
|
+
bytes2hex: function() {
|
|
379
|
+
let t = "";
|
|
380
|
+
for (let e = 0; e < this.length; e++)
|
|
381
|
+
t += (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
382
|
+
return t;
|
|
383
|
+
},
|
|
384
|
+
bytes2string: function() {
|
|
385
|
+
if (typeof TextDecoder < "u")
|
|
386
|
+
return new TextDecoder().decode(new Uint8Array(this));
|
|
387
|
+
let t = "";
|
|
388
|
+
for (let e = 0; e < this.length; e++)
|
|
389
|
+
t += "%" + (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
390
|
+
return decodeURIComponent(t);
|
|
391
|
+
},
|
|
392
|
+
base64encode: function(t = !1, e = !0) {
|
|
393
|
+
let n = "", r = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
394
|
+
for (let i = 2; i < this.length; i += 3) {
|
|
395
|
+
const s = (this[i - 2] << 16) + (this[i - 1] << 8) + this[i];
|
|
396
|
+
n += r.charAt((s & 16515072) >> 18) + r.charAt((s & 258048) >> 12) + r.charAt((s & 4032) >> 6) + r.charAt(s & 63);
|
|
397
|
+
}
|
|
398
|
+
if (this.length % 3 == 2) {
|
|
399
|
+
const i = (this[this.length - 2] << 16) + (this[this.length - 1] << 8);
|
|
400
|
+
n += r.charAt((i & 16515072) >> 18) + r.charAt((i & 258048) >> 12) + r.charAt((i & 4032) >> 6) + (e === !1 ? "" : "=");
|
|
401
|
+
} else if (this.length % 3 == 1) {
|
|
402
|
+
const i = this[this.length - 1] << 16;
|
|
403
|
+
n += r.charAt((i & 16515072) >> 18) + r.charAt((i & 258048) >> 12) + (e === !1 ? "" : "==");
|
|
404
|
+
}
|
|
405
|
+
return n;
|
|
406
|
+
},
|
|
407
|
+
toUint8Array: function() {
|
|
408
|
+
return new Uint8Array(this);
|
|
607
409
|
},
|
|
608
410
|
// ====== Relational ======
|
|
609
|
-
assoc: {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
return this.each0((u) => u[e] = i[u[t]] ?? null);
|
|
613
|
-
},
|
|
614
|
-
...s
|
|
411
|
+
assoc: function(t, e, n = {}) {
|
|
412
|
+
const r = this.unique0((s) => s[t]), i = r.length == 0 ? {} : typeof n == "function" ? n(r) : n;
|
|
413
|
+
return this.each0((s) => s[e] = i[s[t]] ?? null);
|
|
615
414
|
},
|
|
616
415
|
// ====== Tree ======
|
|
617
|
-
toTree: {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
[o]: { value: e, enumerable: !1, configurable: !0, writable: !0 },
|
|
638
|
-
[f]: { value: n, enumerable: !1, configurable: !0, writable: !0 }
|
|
639
|
-
}), h[i] = n[r], h[u] = n[u] + 1, h[c] = h[c] && h[c].length ? h[c] : y, (g = h[c]) == null || g.tree2tree(t, e, h);
|
|
640
|
-
return e;
|
|
641
|
-
},
|
|
642
|
-
...s
|
|
643
|
-
},
|
|
644
|
-
treeFind0: {
|
|
645
|
-
value: function(t, e = !0, n = -1, r = "children") {
|
|
646
|
-
for (const i of this) {
|
|
647
|
-
const u = i.treeFind0(t, e, n, r);
|
|
648
|
-
if (u !== null)
|
|
649
|
-
return u;
|
|
650
|
-
}
|
|
651
|
-
return null;
|
|
652
|
-
},
|
|
653
|
-
...s
|
|
416
|
+
toTree: function(t = {}) {
|
|
417
|
+
const { id: e = "id", pid: n = "pid", level: r = "level", root: i = "root", parent: s = "parent", children: o = "children", empty: l = null, hasRoot: f = !0 } = t, y = this.toObject((h) => [h[e], h]), g = this.toGroup((h) => [h[n], h]), a = this.length && f ? this.find((h) => h[n] === 0) : { [e]: 0, [n]: -1, [i]: null, [s]: null, [o]: g[0] };
|
|
418
|
+
u(a, { [i]: { value: a, enumerable: !1, configurable: !0, writable: !0 } });
|
|
419
|
+
for (const h of this)
|
|
420
|
+
u(h, {
|
|
421
|
+
[i]: { value: a, enumerable: !1, configurable: !0, writable: !0 },
|
|
422
|
+
[s]: { value: y[h[n]], enumerable: !1, configurable: !0, writable: !0 }
|
|
423
|
+
}), h[o] = g[h[e]] || l;
|
|
424
|
+
return a.treeEach0((h) => h[r] = h[s] ? h[s][r] + 1 : 0, -1, o), a;
|
|
425
|
+
},
|
|
426
|
+
tree2tree: function(t = {}, e = null, n = null) {
|
|
427
|
+
var g;
|
|
428
|
+
const { id: r = "id", pid: i = "pid", level: s = "level", root: o = "root", parent: l = "parent", children: f = "children", empty: y = null } = t;
|
|
429
|
+
e = e || { [r]: 0, [i]: -1, [s]: 0, [o]: null, [l]: null, [f]: this }, n = n || e;
|
|
430
|
+
for (const a of this)
|
|
431
|
+
u(a, {
|
|
432
|
+
[o]: { value: e, enumerable: !1, configurable: !0, writable: !0 },
|
|
433
|
+
[l]: { value: n, enumerable: !1, configurable: !0, writable: !0 }
|
|
434
|
+
}), a[i] = n[r], a[s] = n[s] + 1, a[f] = a[f] && a[f].length ? a[f] : y, (g = a[f]) == null || g.tree2tree(t, e, a);
|
|
435
|
+
return e;
|
|
654
436
|
},
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
},
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
437
|
+
treeFind0: function(t, e = !0, n = -1, r = "children") {
|
|
438
|
+
for (const i of this) {
|
|
439
|
+
const s = i.treeFind0(t, e, n, r);
|
|
440
|
+
if (s !== null)
|
|
441
|
+
return s;
|
|
442
|
+
}
|
|
443
|
+
return null;
|
|
444
|
+
},
|
|
445
|
+
treeEach0: function(t, e = !0, n = -1, r = "children") {
|
|
446
|
+
for (const i of this)
|
|
447
|
+
i.treeEach0(t, e, n, r);
|
|
448
|
+
return this;
|
|
449
|
+
},
|
|
450
|
+
treeMap0: function(t, e = !0, n = -1, r = "children", i = null) {
|
|
451
|
+
return this.map((s) => s.treeMap0(t, e, n, r, i));
|
|
668
452
|
}
|
|
669
453
|
});
|
|
670
|
-
|
|
671
|
-
toUint8Array: {
|
|
672
|
-
|
|
673
|
-
return new Uint8Array(this);
|
|
674
|
-
},
|
|
675
|
-
...s
|
|
454
|
+
u(ArrayBuffer.prototype, {
|
|
455
|
+
toUint8Array: function() {
|
|
456
|
+
return new Uint8Array(this);
|
|
676
457
|
}
|
|
677
458
|
});
|
|
678
|
-
|
|
679
|
-
...
|
|
680
|
-
toArray: {
|
|
681
|
-
|
|
682
|
-
return new Array(...this);
|
|
683
|
-
},
|
|
684
|
-
...s
|
|
459
|
+
u(Uint8Array.prototype, {
|
|
460
|
+
...I(Array.prototype, "bytes2hex", "bytes2string", "base64encode"),
|
|
461
|
+
toArray: function() {
|
|
462
|
+
return new Array(...this);
|
|
685
463
|
}
|
|
686
464
|
});
|
|
687
|
-
|
|
688
|
-
...
|
|
465
|
+
u(Map, {
|
|
466
|
+
...d()
|
|
689
467
|
});
|
|
690
|
-
|
|
691
|
-
...
|
|
692
|
-
...
|
|
693
|
-
...
|
|
694
|
-
...
|
|
695
|
-
get0: {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
...
|
|
700
|
-
},
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
},
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
...
|
|
712
|
-
},
|
|
713
|
-
toObject: {
|
|
714
|
-
value: function() {
|
|
715
|
-
return Object.fromEntries(this);
|
|
716
|
-
},
|
|
717
|
-
...s
|
|
718
|
-
},
|
|
719
|
-
toArray: {
|
|
720
|
-
value: function() {
|
|
721
|
-
return [...this];
|
|
722
|
-
},
|
|
723
|
-
...s
|
|
724
|
-
},
|
|
725
|
-
toJSON: {
|
|
726
|
-
value: function() {
|
|
727
|
-
return [...this];
|
|
728
|
-
},
|
|
729
|
-
...s
|
|
468
|
+
u(Map.prototype, {
|
|
469
|
+
...m(["size", "length0"]),
|
|
470
|
+
...A(["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
|
|
471
|
+
...p(["set", "set0"], ["delete", "delete0"]),
|
|
472
|
+
...b(["set", "set3"]),
|
|
473
|
+
get0: function(t, e = null) {
|
|
474
|
+
return this.has(t) ? this.get(t) : e;
|
|
475
|
+
},
|
|
476
|
+
get1: function(t, e, ...n) {
|
|
477
|
+
return this.has(t) ? this.get(t) : this.set3(t, e(t, ...n))[1];
|
|
478
|
+
},
|
|
479
|
+
getAsync1: async function(t, e, ...n) {
|
|
480
|
+
return this.has(t) ? this.get(t) : this.set3(t, await e(t, ...n))[1];
|
|
481
|
+
},
|
|
482
|
+
toObject: function() {
|
|
483
|
+
return Object.fromEntries(this);
|
|
484
|
+
},
|
|
485
|
+
toArray: function() {
|
|
486
|
+
return [...this];
|
|
487
|
+
},
|
|
488
|
+
toJSON: function() {
|
|
489
|
+
return [...this];
|
|
730
490
|
}
|
|
731
491
|
});
|
|
732
|
-
|
|
733
|
-
...
|
|
492
|
+
u(Set, {
|
|
493
|
+
...d()
|
|
734
494
|
});
|
|
735
|
-
|
|
736
|
-
...
|
|
737
|
-
...
|
|
738
|
-
...
|
|
739
|
-
...
|
|
740
|
-
toArray: {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
...
|
|
745
|
-
},
|
|
746
|
-
toJSON: {
|
|
747
|
-
value: function() {
|
|
748
|
-
return [...this];
|
|
749
|
-
},
|
|
750
|
-
...s
|
|
495
|
+
u(Set.prototype, {
|
|
496
|
+
...m(["size", "length0"]),
|
|
497
|
+
...A(["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
|
|
498
|
+
...p(["add", "add0"], ["delete", "delete0"]),
|
|
499
|
+
...b(["add", "add3"]),
|
|
500
|
+
toArray: function() {
|
|
501
|
+
return [...this];
|
|
502
|
+
},
|
|
503
|
+
toJSON: function() {
|
|
504
|
+
return [...this];
|
|
751
505
|
}
|
|
752
506
|
});
|
|
753
|
-
|
|
754
|
-
new: {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
},
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
},
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
},
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
return [i, i + 86400 - 1];
|
|
788
|
-
},
|
|
789
|
-
...s
|
|
790
|
-
},
|
|
791
|
-
toWeekRange: {
|
|
792
|
-
value: function() {
|
|
793
|
-
let t = /* @__PURE__ */ new Date();
|
|
794
|
-
for (; t.getDay() != 1; )
|
|
795
|
-
t = new Date(t.getTime() - 86400);
|
|
796
|
-
const e = t.getFullYear(), n = t.getMonth(), r = t.getDate(), i = new Date(e, n, r).getTime() / 1e3 | 0;
|
|
797
|
-
return [i, i + 86400 * 7 - 1];
|
|
798
|
-
},
|
|
799
|
-
...s
|
|
800
|
-
},
|
|
801
|
-
toMonthRange: {
|
|
802
|
-
value: function() {
|
|
803
|
-
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), n = t.getMonth(), r = new Date(e, n, 1).getTime() / 1e3 | 0, i = new Date(e, n + 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
804
|
-
return [r, i];
|
|
805
|
-
},
|
|
806
|
-
...s
|
|
807
|
-
},
|
|
808
|
-
toYearRange: {
|
|
809
|
-
value: function() {
|
|
810
|
-
const e = (/* @__PURE__ */ new Date()).getFullYear(), n = new Date(e, 1, 1).getTime() / 1e3 | 0, r = new Date(e + 1, 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
811
|
-
return [n, r];
|
|
812
|
-
},
|
|
813
|
-
...s
|
|
507
|
+
u(Date, {
|
|
508
|
+
new: function(...t) {
|
|
509
|
+
return t.length != 1 ? new Date(...t) : Number.isNaN(+t[0]) ? new Date(t[0].includes("T") ? t[0] : t[0].replace(/-/g, "/")) : new Date(t[0] > 25e8 ? t[0] : t[0] * 1e3);
|
|
510
|
+
},
|
|
511
|
+
format: function(t = "y-m-d h:i:s") {
|
|
512
|
+
return (/* @__PURE__ */ new Date()).format(t);
|
|
513
|
+
},
|
|
514
|
+
unix: function() {
|
|
515
|
+
return this.now() / 1e3 | 0;
|
|
516
|
+
},
|
|
517
|
+
fromUnix: function(t = 0) {
|
|
518
|
+
return new Date((t || 0) * 1e3);
|
|
519
|
+
},
|
|
520
|
+
expr: function(t = {}) {
|
|
521
|
+
return (/* @__PURE__ */ new Date()).expr(t);
|
|
522
|
+
},
|
|
523
|
+
toDayRange: function() {
|
|
524
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), n = t.getMonth(), r = t.getDate(), i = new Date(e, n, r).getTime() / 1e3 | 0;
|
|
525
|
+
return [i, i + 86400 - 1];
|
|
526
|
+
},
|
|
527
|
+
toWeekRange: function() {
|
|
528
|
+
let t = /* @__PURE__ */ new Date();
|
|
529
|
+
for (; t.getDay() != 1; )
|
|
530
|
+
t = new Date(t.getTime() - 86400);
|
|
531
|
+
const e = t.getFullYear(), n = t.getMonth(), r = t.getDate(), i = new Date(e, n, r).getTime() / 1e3 | 0;
|
|
532
|
+
return [i, i + 86400 * 7 - 1];
|
|
533
|
+
},
|
|
534
|
+
toMonthRange: function() {
|
|
535
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), n = t.getMonth(), r = new Date(e, n, 1).getTime() / 1e3 | 0, i = new Date(e, n + 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
536
|
+
return [r, i];
|
|
537
|
+
},
|
|
538
|
+
toYearRange: function() {
|
|
539
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear(), n = new Date(e, 1, 1).getTime() / 1e3 | 0, r = new Date(e + 1, 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
540
|
+
return [n, r];
|
|
814
541
|
}
|
|
815
542
|
});
|
|
816
|
-
|
|
817
|
-
format: {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
},
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
},
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
},
|
|
860
|
-
begin: {
|
|
861
|
-
value: function(t = 3) {
|
|
862
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 0, 1, 0, 0, 0].slice(t));
|
|
863
|
-
},
|
|
864
|
-
...s
|
|
865
|
-
},
|
|
866
|
-
end: {
|
|
867
|
-
value: function(t = 3) {
|
|
868
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 11, t < 2 ? 31 : this.getMonthDay(), 23, 59, 59].slice(t));
|
|
869
|
-
},
|
|
870
|
-
...s
|
|
871
|
-
},
|
|
872
|
-
week: {
|
|
873
|
-
value: function(t, e = 1) {
|
|
874
|
-
let n = new Date(this.getTime());
|
|
875
|
-
for (; n.getDay() !== t; )
|
|
876
|
-
n = new Date(n.getTime() + 864e5 * e);
|
|
877
|
-
return n;
|
|
878
|
-
},
|
|
879
|
-
...s
|
|
880
|
-
},
|
|
881
|
-
toJSON: {
|
|
882
|
-
value: function() {
|
|
883
|
-
return this.getTime();
|
|
884
|
-
},
|
|
885
|
-
...s
|
|
543
|
+
u(Date.prototype, {
|
|
544
|
+
format: function(t = "y-m-d h:i:s") {
|
|
545
|
+
if (this.getTime() === 0)
|
|
546
|
+
return "-";
|
|
547
|
+
const e = {
|
|
548
|
+
y: this.getFullYear(),
|
|
549
|
+
m: this.getMonth() + 1,
|
|
550
|
+
d: this.getDate(),
|
|
551
|
+
h: this.getHours(),
|
|
552
|
+
i: this.getMinutes(),
|
|
553
|
+
s: this.getSeconds(),
|
|
554
|
+
l: this.getMilliseconds(),
|
|
555
|
+
e: this.getMonthDay()
|
|
556
|
+
};
|
|
557
|
+
return t.replace(/([ymdhisle])/ig, (n, r) => r >= "A" && r <= "Z" ? e[r.toLowerCase()] : e[r].toString().padStart(r === "l" ? 3 : 2, "0"));
|
|
558
|
+
},
|
|
559
|
+
unix: function() {
|
|
560
|
+
return this.getTime() / 1e3 | 0;
|
|
561
|
+
},
|
|
562
|
+
isLeapYear: function() {
|
|
563
|
+
return this.getFullYear() % 4 === 0 && this.getFullYear() % 400 !== 0;
|
|
564
|
+
},
|
|
565
|
+
getMonthDay: function() {
|
|
566
|
+
return [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()] || (this.isLeapYear() ? 29 : 28);
|
|
567
|
+
},
|
|
568
|
+
expr: function({ y: t = 0, m: e = 0, d: n = 0, h: r = 0, i = 0, s = 0 }) {
|
|
569
|
+
const o = new Date(this.getFullYear() + t, this.getMonth() + e + 1, 0);
|
|
570
|
+
return new Date(this.getFullYear() + t, this.getMonth() + e, Math.min(o.getDate(), this.getDate()) + n, this.getHours() + r, this.getMinutes() + i, this.getSeconds() + s);
|
|
571
|
+
},
|
|
572
|
+
begin: function(t = 3) {
|
|
573
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 0, 1, 0, 0, 0].slice(t));
|
|
574
|
+
},
|
|
575
|
+
end: function(t = 3) {
|
|
576
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 11, t < 2 ? 31 : this.getMonthDay(), 23, 59, 59].slice(t));
|
|
577
|
+
},
|
|
578
|
+
week: function(t, e = 1) {
|
|
579
|
+
let n = new Date(this.getTime());
|
|
580
|
+
for (; n.getDay() !== t; )
|
|
581
|
+
n = new Date(n.getTime() + 864e5 * e);
|
|
582
|
+
return n;
|
|
583
|
+
},
|
|
584
|
+
toJSON: function() {
|
|
585
|
+
return this.getTime();
|
|
886
586
|
}
|
|
887
587
|
});
|
|
888
|
-
|
|
889
|
-
...
|
|
588
|
+
u(RegExp, {
|
|
589
|
+
...d()
|
|
890
590
|
});
|
|
891
|
-
|
|
892
|
-
toJSON: {
|
|
893
|
-
|
|
894
|
-
return this.toString();
|
|
895
|
-
},
|
|
896
|
-
...s
|
|
591
|
+
u(RegExp.prototype, {
|
|
592
|
+
toJSON: function() {
|
|
593
|
+
return this.toString();
|
|
897
594
|
}
|
|
898
595
|
});
|
|
899
|
-
typeof Promise.withResolvers > "u" &&
|
|
900
|
-
withResolvers: {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}), resolve: t, reject: e };
|
|
906
|
-
},
|
|
907
|
-
...s
|
|
596
|
+
typeof Promise.withResolvers > "u" && u(Promise, {
|
|
597
|
+
withResolvers: function() {
|
|
598
|
+
let t = null, e = null;
|
|
599
|
+
return { promise: new this((r, i) => {
|
|
600
|
+
t = r, e = i;
|
|
601
|
+
}), resolve: t, reject: e };
|
|
908
602
|
}
|
|
909
603
|
});
|
|
910
|
-
|
|
911
|
-
channel: {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}), t, e];
|
|
917
|
-
},
|
|
918
|
-
...s
|
|
604
|
+
u(Promise, {
|
|
605
|
+
channel: function() {
|
|
606
|
+
let t = null, e = null;
|
|
607
|
+
return [new this((r, i) => {
|
|
608
|
+
t = r, e = i;
|
|
609
|
+
}), t, e];
|
|
919
610
|
}
|
|
920
611
|
});
|
|
921
|
-
|
|
922
|
-
tryCatch: {
|
|
923
|
-
|
|
924
|
-
return new Promise((t) => this.then((e) => t([e, null])).catch((e) => t([null, e])));
|
|
925
|
-
},
|
|
926
|
-
...s
|
|
612
|
+
u(Promise.prototype, {
|
|
613
|
+
tryCatch: function() {
|
|
614
|
+
return new Promise((t) => this.then((e) => t([e, null])).catch((e) => t([null, e])));
|
|
927
615
|
}
|
|
928
616
|
});
|
|
929
|
-
|
|
930
|
-
parse0: {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
617
|
+
u(JSON, {
|
|
618
|
+
parse0: function(t, e = null) {
|
|
619
|
+
try {
|
|
620
|
+
if (typeof t != "string")
|
|
621
|
+
throw new Error("not string");
|
|
622
|
+
return JSON.parse(t);
|
|
623
|
+
} catch {
|
|
624
|
+
return e;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
let c = "", E = 0, S = 0, w = 0;
|
|
629
|
+
u(Math, {
|
|
630
|
+
prefix: function(t = null) {
|
|
631
|
+
return c = t ?? c;
|
|
632
|
+
},
|
|
633
|
+
cookieSet: function(t, e, n = { Path: "/" }) {
|
|
634
|
+
let r = `${encodeURIComponent(t)}=${encodeURIComponent(e)}`;
|
|
635
|
+
r += n.Expires ? `; Expires=${n.Expires.toGMTString()}` : "", r += n.MaxAge ? `; Max-Age=${n.MaxAge}` : "", r += n.Domain ? `; Domain=${n.Domain}` : "", r += n.Path ? `; Path=${n.Path}` : "", r += n.SameSite ? `; SameSite=${n.SameSite}` : "", r += n.Partitioned ? "; Partitioned" : "", r += n.HttpOnly ? "; HttpOnly" : "", r += n.Secure ? "; Secure" : "", document.cookie = r;
|
|
636
|
+
},
|
|
637
|
+
cookieGet: function(t = null) {
|
|
638
|
+
const e = document.cookie == "" ? {} : Object.fromEntries(document.cookie.split("; ").map((n) => n.split("=").map(decodeURIComponent)));
|
|
639
|
+
return t ? e[t] : e;
|
|
640
|
+
},
|
|
641
|
+
cookieRemove: function(t) {
|
|
642
|
+
document.cookie = `${t}=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/`;
|
|
643
|
+
},
|
|
644
|
+
cookieClear: function(...t) {
|
|
645
|
+
const e = Math.cookieGet();
|
|
646
|
+
for (const n in e)
|
|
647
|
+
t.includes(n) || Math.cookieRemove(n);
|
|
648
|
+
},
|
|
649
|
+
localSet: function(t, e) {
|
|
650
|
+
return localStorage.setItem(c + t, JSON.stringify(e)) || e;
|
|
651
|
+
},
|
|
652
|
+
localGet: function(t, e = null) {
|
|
653
|
+
try {
|
|
654
|
+
return c + t in localStorage ? JSON.parse(localStorage.getItem(c + t)) : e;
|
|
655
|
+
} catch {
|
|
656
|
+
return e;
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
localSetString: function(t, e) {
|
|
660
|
+
return localStorage.setItem(c + t, e) || e;
|
|
661
|
+
},
|
|
662
|
+
localGetString: function(t, e = "") {
|
|
663
|
+
return c + t in localStorage ? localStorage.getItem(c + t) : e;
|
|
664
|
+
},
|
|
665
|
+
localRemove: function(...t) {
|
|
666
|
+
for (const e of t)
|
|
667
|
+
localStorage.removeItem(c + e);
|
|
668
|
+
},
|
|
669
|
+
localClear: function(...t) {
|
|
670
|
+
for (let e = 0; e < localStorage.length; e++) {
|
|
671
|
+
const n = localStorage.key(e);
|
|
672
|
+
!n.startsWith(c) || t.includes(n.substring(c.length)) || localStorage.removeItem(n);
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
sessionSet: function(t, e) {
|
|
676
|
+
return sessionStorage.setItem(c + t, JSON.stringify(e)) || e;
|
|
677
|
+
},
|
|
678
|
+
sessionGet: function(t, e = null) {
|
|
679
|
+
try {
|
|
680
|
+
return c + t in sessionStorage ? JSON.parse(sessionStorage.getItem(c + t)) : e;
|
|
681
|
+
} catch {
|
|
682
|
+
return e;
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
sessionSetString: function(t, e) {
|
|
686
|
+
return sessionStorage.setItem(c + t, e) || e;
|
|
687
|
+
},
|
|
688
|
+
sessionGetString: function(t, e = "") {
|
|
689
|
+
return c + t in sessionStorage ? sessionStorage.getItem(c + t) : e;
|
|
690
|
+
},
|
|
691
|
+
sessionRemove: function(...t) {
|
|
692
|
+
for (const e of t)
|
|
693
|
+
sessionStorage.removeItem(c + e);
|
|
694
|
+
},
|
|
695
|
+
sessionClear: function(...t) {
|
|
696
|
+
for (let e = 0; e < sessionStorage.length; e++) {
|
|
697
|
+
const n = sessionStorage.key(e);
|
|
698
|
+
!n.startsWith(c) || t.includes(n.substring(c.length)) || sessionStorage.removeItem(n);
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
randstr: function(t = 16, e = 0, n = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", r = "~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/") {
|
|
702
|
+
if (t < e)
|
|
703
|
+
throw new Error("randstr: len < slen");
|
|
704
|
+
const i = [];
|
|
705
|
+
for (let s = 0; s < t; s++)
|
|
706
|
+
i.push(n.charAt(Math.random() * n.length | 0));
|
|
707
|
+
for (let s = /* @__PURE__ */ new Set(), o = 0, l = 0; l < e; l++) {
|
|
708
|
+
do
|
|
709
|
+
o = Math.random() * t | 0;
|
|
710
|
+
while (s.has(o));
|
|
711
|
+
s.set(o, !0), i[o] = r.charAt(Math.random() * r.length | 0);
|
|
712
|
+
}
|
|
713
|
+
return i.join("");
|
|
714
|
+
},
|
|
715
|
+
randint: function(t = 0, e = Number.MAX_SAFE_INTEGER) {
|
|
716
|
+
return Math.floor(Math.random() * (e - t) + t);
|
|
717
|
+
},
|
|
718
|
+
incrid: function() {
|
|
719
|
+
return ++E;
|
|
720
|
+
},
|
|
721
|
+
incrstr: function() {
|
|
722
|
+
return "" + Math.incrid();
|
|
723
|
+
},
|
|
724
|
+
uniqid: function(t = Date.now()) {
|
|
725
|
+
return t === w ? t * 2048 + ++S % 2048 : (w = t) * 2048 + (S = 0) % 2048;
|
|
726
|
+
},
|
|
727
|
+
uniqstr: function() {
|
|
728
|
+
return "" + Math.uniqid();
|
|
729
|
+
},
|
|
730
|
+
filesize: function(t, e = 2) {
|
|
731
|
+
const n = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
732
|
+
let r = Math.log(t) / Math.log(1024) | 0;
|
|
733
|
+
return r = r < n.length ? r : n.length - 1, (t / Math.pow(1024, r)).toFixed(e) - 0 + n[r];
|
|
734
|
+
},
|
|
735
|
+
sleep: function(t) {
|
|
736
|
+
return new Promise((e) => setTimeout(e, t));
|
|
737
|
+
},
|
|
738
|
+
useTemplate: function(t) {
|
|
739
|
+
let e = null;
|
|
740
|
+
const n = { setup(i, { slots: s }) {
|
|
741
|
+
return e = s.default, () => {
|
|
742
|
+
};
|
|
743
|
+
}, name: t + "Template" }, r = { setup(i, { attrs: s }) {
|
|
744
|
+
return () => e == null ? void 0 : e(s);
|
|
745
|
+
}, name: t };
|
|
746
|
+
return { [n.name]: n, [r.name]: r };
|
|
941
747
|
}
|
|
942
748
|
});
|