esexts 1.5.7 → 2.0.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/esexts.js CHANGED
@@ -1,7 +1,7 @@
1
- function h(t, e) {
1
+ function c(t, e) {
2
2
  return Object.defineProperties(t, Object.fromEntries(Object.keys(e).map((n) => [n, { value: e[n], enumerable: !1, configurable: !0, writable: !0 }])));
3
3
  }
4
- function d() {
4
+ function p() {
5
5
  return {
6
6
  new: function(...t) {
7
7
  return new this(...t);
@@ -17,125 +17,90 @@ function b(...t) {
17
17
  return e;
18
18
  }
19
19
  function a(t, e, n, ...r) {
20
- const i = {};
21
- for (const [u, o] of r) {
22
- if (e === null && n === null) {
23
- i[o] = function(...s) {
24
- return t[u].apply(this, s);
20
+ const i = {}, s = (o, h, u) => (h !== null && o.splice(h >= 0 ? h : o.length + h + 1, 0, u), o);
21
+ for (const [o, h] of r)
22
+ if (n === null)
23
+ i[h] = function(...u) {
24
+ return t[o].apply(this, s(u, e, this));
25
25
  };
26
- continue;
27
- }
28
- if (e === null && n === !1) {
29
- i[o] = function(...s) {
30
- return t[u].apply(this, s), this;
26
+ else if (n === !1)
27
+ i[h] = function(...u) {
28
+ return t[o].apply(this, s(u, e, this)), this;
31
29
  };
32
- continue;
33
- }
34
- if (e === null && n === !0) {
35
- i[o] = function(...s) {
36
- return t[u].apply(this, s), s;
30
+ else if (n === !0)
31
+ i[h] = function(...u) {
32
+ return t[o].apply(this, s(u, e, this)), u;
37
33
  };
38
- continue;
39
- }
40
- if (e === null && n > 0) {
41
- i[o] = function(...s) {
42
- return t[u].apply(this, s), s[n - 1];
34
+ else if (n >= 0)
35
+ i[h] = function(...u) {
36
+ return t[o].apply(this, s(u, e, this)), u[n];
43
37
  };
44
- continue;
45
- }
46
- if (e === null && n < 0) {
47
- i[o] = function(...s) {
48
- return t[u].apply(this, s), s[s.length + n + 1];
38
+ else if (n < 0)
39
+ i[h] = function(...u) {
40
+ return t[o].apply(this, s(u, e, this)), u[u.length + n];
49
41
  };
50
- continue;
51
- }
52
- if (e !== null && n === null) {
53
- i[o] = function(...s) {
54
- return s.splice(e > 0 ? e - 1 : s.length + e + 1, 0, this), t[u].apply(this, s);
55
- };
56
- continue;
57
- }
58
- if (e !== null && n === !1) {
59
- i[o] = function(...s) {
60
- return s.splice(e > 0 ? e - 1 : s.length + e + 1, 0, this), t[u].apply(this, s), this;
61
- };
62
- continue;
63
- }
64
- if (e !== null && n === !0) {
65
- i[o] = function(...s) {
66
- return s.splice(e > 0 ? e - 1 : s.length + e + 1, 0, this), t[u].apply(this, s), s;
67
- };
68
- continue;
69
- }
70
- if (e !== null && n > 0) {
71
- i[o] = function(...s) {
72
- return s.splice(e > 0 ? e - 1 : s.length + e + 1, 0, this), t[u].apply(this, s), s[n - 1];
73
- };
74
- continue;
75
- }
76
- if (e !== null && n < 0) {
77
- i[o] = function(...s) {
78
- return s.splice(e > 0 ? e - 1 : s.length + e + 1, 0, this), t[u].apply(this, s), s[s.length + n + 1];
79
- };
80
- continue;
81
- }
82
- throw Error("unreachable");
83
- }
42
+ else
43
+ throw Error("unreachable");
84
44
  return i;
85
45
  }
86
46
  function m(t, ...e) {
87
47
  const n = {};
88
48
  for (const [r, i] of e)
89
- n[i] = function(...u) {
90
- return [...t[r].apply(this, u)];
49
+ n[i] = function(...s) {
50
+ return [...t[r].apply(this, s)];
91
51
  };
92
52
  return n;
93
53
  }
94
54
  function M(t = { array: !1 }) {
95
55
  return function(e = {}, ...n) {
96
- const r = (i, u) => {
97
- const o = Object.prototype.toString.call(i), s = Object.prototype.toString.call(u);
98
- if (o !== s)
99
- return u;
56
+ const r = (i, s) => {
57
+ const o = Object.prototype.toString.call(i), h = Object.prototype.toString.call(s);
58
+ if (o !== h)
59
+ return s;
100
60
  if (o === "[object Array]")
101
- return t.array ? i.concat(...u) : u;
61
+ return t.array ? i.concat(...s) : s;
102
62
  if (o === "[object Object]") {
103
- for (const l in u)
104
- i[l] = r(i[l], u[l]);
63
+ for (const u in s)
64
+ i[u] = r(i[u], s[u]);
105
65
  return i;
106
66
  } else
107
- return u;
67
+ return s;
108
68
  };
109
69
  for (const i of n)
110
70
  e = r(e, i);
111
71
  return e;
112
72
  };
113
73
  }
114
- const F = M({ array: !1 }), D = M({ array: !0 });
115
- h(Object, {
74
+ const x = M({ array: !1 }), F = M({ array: !0 });
75
+ c(Object, {
76
+ ...p(),
116
77
  isObject: function(t) {
117
78
  return Object.prototype.toString.call(t) === "[object Object]";
118
79
  },
119
80
  merge0: function(...t) {
120
- return F(this, ...t);
81
+ return x(this, ...t);
121
82
  },
122
83
  concat0: function(...t) {
123
- return D(this, ...t);
84
+ return F(this, ...t);
124
85
  }
125
86
  });
126
- h(Object.prototype, {
87
+ c(Object.prototype, {
127
88
  clone0: function() {
128
89
  return JSON.parse(JSON.stringify(this));
129
90
  },
130
91
  length0: function() {
131
92
  return Object.keys(this).length;
132
93
  },
133
- ...a(Object, 1, null, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"], ["assign", "assign0"]),
94
+ ...a(Object, 0, null, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"], ["assign", "assign0"]),
95
+ ...a(JSON, 0, null, ["stringify", "stringify0"]),
134
96
  merge0: function(...t) {
135
- return F(this, ...t);
97
+ return x(this, ...t);
136
98
  },
137
99
  concat0: function(...t) {
138
- return D(this, ...t);
100
+ return F(this, ...t);
101
+ },
102
+ in0: function(t) {
103
+ return t in this;
139
104
  },
140
105
  map0: function(t = (n, r, i) => [n, r], e = 0) {
141
106
  return Object.entries(this).map(([n, r]) => t(n, r, e++));
@@ -185,10 +150,10 @@ h(Object.prototype, {
185
150
  return r;
186
151
  },
187
152
  getChildrens0: function(t = !1, e = -1, n = "children") {
188
- const r = [], i = (u, o, s) => {
189
- if (o && r.push(u), !(s == 0 || !u[n] || u[n].length == 0))
190
- for (const l of u[n])
191
- i(l, !0, s - 1);
153
+ const r = [], i = (s, o, h) => {
154
+ if (o && r.push(s), !(h == 0 || !s[n] || s[n].length == 0))
155
+ for (const u of s[n])
156
+ i(u, !0, h - 1);
192
157
  };
193
158
  return i(this, t, e), r;
194
159
  },
@@ -198,9 +163,9 @@ h(Object.prototype, {
198
163
  if (n == 0 || !this[r] || this[r].length == 0)
199
164
  return null;
200
165
  for (const i of this[r]) {
201
- const u = i.treeFind0(t, !0, n - 1, r);
202
- if (u !== null)
203
- return u;
166
+ const s = i.treeFind0(t, !0, n - 1, r);
167
+ if (s !== null)
168
+ return s;
204
169
  }
205
170
  return null;
206
171
  },
@@ -212,16 +177,16 @@ h(Object.prototype, {
212
177
  }
213
178
  },
214
179
  treeMap0: function(t, e = !0, n = -1, r = "children", i = null) {
215
- const u = e ? t(this) : this, o = [];
180
+ const s = e ? t(this) : this, o = [];
216
181
  if (n == 0 || !this[r] || this[r].length == 0)
217
- return u;
218
- for (const s of this[r])
219
- o.push(s.treeMap0(t, !0, n - 1, r, i));
220
- return u[r] = o, u;
182
+ return s;
183
+ for (const h of this[r])
184
+ o.push(h.treeMap0(t, !0, n - 1, r, i));
185
+ return s[r] = o, s;
221
186
  }
222
187
  });
223
- h(Number.prototype, {
224
- ...a(Math, 1, null, ["ceil", "ceil"], ["floor", "floor"], ["trunc", "trunc"], ["abs", "abs"], ["max", "max"], ["min", "min"]),
188
+ c(Number.prototype, {
189
+ ...a(Math, 0, null, ["ceil", "ceil"], ["floor", "floor"], ["trunc", "trunc"], ["abs", "abs"], ["max", "max"], ["min", "min"]),
225
190
  round: function(t = 0) {
226
191
  return Math.round(this * 10 ** t) / 10 ** t;
227
192
  },
@@ -245,10 +210,10 @@ h(Number.prototype, {
245
210
  },
246
211
  unit: function(t, e = 0) {
247
212
  let n = this, r = "";
248
- for ([unit, size] of Object.entries(t)) {
249
- if (r = unit, size === 0 || n < size)
213
+ for (const [i, s] of Object.entries(t)) {
214
+ if (r = i, s === 0 || n < s)
250
215
  break;
251
- n = n / size;
216
+ n = n / s;
252
217
  }
253
218
  return e < 0 ? +n.toFixed(0 - e) + r : n.toFixed(e) + r;
254
219
  },
@@ -260,7 +225,7 @@ h(Number.prototype, {
260
225
  break;
261
226
  } else
262
227
  r.push([n % size, unit]), n = Math.floor(n / size);
263
- return e ? r : r.reverse().map(([i, u]) => i + u).join("");
228
+ return e ? r : r.reverse().map(([i, s]) => i + s).join("");
264
229
  },
265
230
  toFixed0: function(t = 0) {
266
231
  return +this.toFixed(t);
@@ -269,12 +234,13 @@ h(Number.prototype, {
269
234
  return Date.new(this);
270
235
  }
271
236
  });
272
- h(BigInt.prototype, {
237
+ c(BigInt.prototype, {
273
238
  toJSON: function() {
274
239
  return this < BigInt(Number.MIN_SAFE_INTEGER) || this > BigInt(Number.MAX_SAFE_INTEGER) ? this.toString() : Number(this);
275
240
  }
276
241
  });
277
- h(String.prototype, {
242
+ c(String.prototype, {
243
+ ...p(),
278
244
  ...b(["length", "length0"]),
279
245
  substring0: function(t = 0, e = this.length) {
280
246
  return t = t >= 0 ? t : this.length + t, e = e >= 0 ? e : this.length + e, this.substring(t, e);
@@ -304,14 +270,14 @@ h(String.prototype, {
304
270
  subOf: function(t, e, n = 0, r = 0) {
305
271
  for (let o = 0; o < n && r != -1; o++, r++)
306
272
  r = this.indexOf(t, r);
307
- let i = this.indexOf(t, r), u = this.indexOf(e, i);
308
- return i == -1 || u == -1 ? "" : (i += t.length, this.substring(i, u));
273
+ let i = this.indexOf(t, r), s = this.indexOf(e, i);
274
+ return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
309
275
  },
310
276
  lastSubOf: function(t, e, n = 0, r = 1 / 0) {
311
277
  for (let o = 0; o < n && r != -1; o++, r--)
312
278
  r = this.lastIndexOf(t, r);
313
- let i = this.lastIndexOf(t, r), u = this.indexOf(e, i);
314
- return i == -1 || u == -1 ? "" : (i += t.length, this.substring(i, u));
279
+ let i = this.lastIndexOf(t, r), s = this.indexOf(e, i);
280
+ return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
315
281
  },
316
282
  camel2under: function() {
317
283
  return this.substr(0, 1) + this.substr(1).replace(/([A-Z])/g, (t, e) => "_" + e.toLowerCase());
@@ -353,11 +319,11 @@ h(String.prototype, {
353
319
  return Uint8Array.fromBase64(this);
354
320
  }
355
321
  });
356
- h(Array, {
357
- ...d(),
322
+ c(Array, {
323
+ ...p(),
358
324
  // ====== from pinojs ======
359
325
  range: function(...t) {
360
- let e = [], n = 0, r = 0, i = 1, u = typeof t[t.length - 1] == "boolean" ? t.pop() : !0, o = typeof t[t.length - 1] == "function" ? t.pop() : (s, l, g) => s;
326
+ let e = [], n = 0, r = 0, i = 1, s = typeof t[t.length - 1] == "boolean" ? t.pop() : !0, o = typeof t[t.length - 1] == "function" ? t.pop() : (h, u, d) => h;
361
327
  switch (t.length) {
362
328
  case 1:
363
329
  [r] = t;
@@ -373,17 +339,18 @@ h(Array, {
373
339
  }
374
340
  if (i == 0)
375
341
  throw new Error("step cannot be 0!");
376
- for (let s = 0, l = 0, g = Math.abs(r - n), f = Math.abs(i), p = n <= r ? 1 : -1; l < g; l += f)
377
- e.push(u ? o(n + l * p, s++, e) : o());
342
+ for (let h = 0, u = 0, d = Math.abs(r - n), f = Math.abs(i), g = n <= r ? 1 : -1; u < d; u += f)
343
+ e.push(s ? o(n + u * g, h++, e) : o());
378
344
  return e;
379
345
  }
380
346
  });
381
- h(Array.prototype, {
347
+ c(Array.prototype, {
382
348
  ...b(["length", "length0"]),
383
349
  ...m(Array.prototype, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
384
350
  ...a(Array.prototype, null, !1, ["push", "push0"], ["pop", "pop0"], ["shift", "shift0"], ["unshift", "unshift0"]),
385
- ...a(Array.prototype, null, 1, ["push", "push1"], ["unshift", "unshift1"]),
351
+ ...a(Array.prototype, null, 0, ["push", "push1"], ["unshift", "unshift1"]),
386
352
  ...a(Array.prototype, null, !0, ["push", "push3"], ["unshift", "unshift3"]),
353
+ ...a(Array.prototype, null, !0, ["splice", "splice0"]),
387
354
  first0: function(t = null) {
388
355
  return this.length ? this[0] : t;
389
356
  },
@@ -412,6 +379,15 @@ h(Array.prototype, {
412
379
  e.push(await t(this[n], n, this));
413
380
  return e;
414
381
  },
382
+ shuffle: function(t = !1) {
383
+ const e = t ? e.clone0() : e;
384
+ let n = e.length;
385
+ for (; n; ) {
386
+ const r = Math.random() * n-- | 0;
387
+ [e[r], e[n]] = [e[n], e[r]];
388
+ }
389
+ return e;
390
+ },
415
391
  toMap: function(t = (e, n) => [n, e]) {
416
392
  return new Map(this.map(t));
417
393
  },
@@ -432,29 +408,29 @@ h(Array.prototype, {
432
408
  },
433
409
  // ====== Relational ======
434
410
  assoc: function(t, e, n = {}) {
435
- const r = this.unique0((u) => u[t]), i = r.length == 0 ? {} : typeof n == "function" ? n(r) : n;
436
- return this.each0((u) => u[e] = i[u[t]] ?? null);
411
+ const r = this.unique0((s) => s[t]), i = r.length == 0 ? {} : typeof n == "function" ? n(r) : n;
412
+ return this.each0((s) => s[e] = i[s[t]] ?? null);
437
413
  },
438
414
  // ====== Tree ======
439
415
  toTree: function(t = {}) {
440
- const { id: e = "id", pid: n = "pid", level: r = "level", root: i = "root", parent: u = "parent", children: o = "children", empty: s = null, hasRoot: l = !0 } = t, g = this.reduce((c, y) => c.attr0(y[e], y), {}), f = this.reduce((c, y) => (c.attr0(y[n], [], !1).attr0(y[n]).push0(y), c), {}), p = this.length && l ? this.find((c) => c[n] === 0) : { [e]: 0, [n]: -1, [i]: null, [u]: null, [o]: f[0] };
441
- h(p, { [i]: p });
442
- for (const c of this)
443
- h(c, { [i]: p, [u]: g[c[n]] }), c[o] = f[c[e]] || s;
444
- return p.treeEach0((c) => c[r] = c[u] ? c[u][r] + 1 : 0, -1, o), p;
416
+ const { id: e = "id", pid: n = "pid", level: r = "level", root: i = "root", parent: s = "parent", children: o = "children", empty: h = null, hasRoot: u = !0 } = t, d = this.reduce((l, y) => l.attr0(y[e], y), {}), f = this.reduce((l, y) => (l.attr0(y[n], [], !1).attr0(y[n]).push0(y), l), {}), g = this.length && u ? this.find((l) => l[n] === 0) : { [e]: 0, [n]: -1, [i]: null, [s]: null, [o]: f[0] };
417
+ c(g, { [i]: g });
418
+ for (const l of this)
419
+ c(l, { [i]: g, [s]: d[l[n]] }), l[o] = f[l[e]] || h;
420
+ return g.treeEach0((l) => l[r] = l[s] ? l[s][r] + 1 : 0, -1, o), g;
445
421
  },
446
422
  tree2tree: function(t = {}, e = null, n = null) {
447
- const { id: r = "id", pid: i = "pid", level: u = "level", root: o = "root", parent: s = "parent", children: l = "children", empty: g = null } = t;
448
- e = e || { [r]: 0, [i]: -1, [u]: 0, [o]: null, [s]: null, [l]: this }, n = n || e;
423
+ const { id: r = "id", pid: i = "pid", level: s = "level", root: o = "root", parent: h = "parent", children: u = "children", empty: d = null } = t;
424
+ e = e || { [r]: 0, [i]: -1, [s]: 0, [o]: null, [h]: null, [u]: this }, n = n || e;
449
425
  for (const f of this)
450
- h(f, { [o]: e, [s]: n }), f[i] = n[r], f[u] = n[u] + 1, f[l] = f[l] && f[l].length ? f[l] : g, f[l]?.tree2tree(t, e, f);
426
+ c(f, { [o]: e, [h]: n }), f[i] = n[r], f[s] = n[s] + 1, f[u] = f[u] && f[u].length ? f[u] : d, f[u]?.tree2tree(t, e, f);
451
427
  return e;
452
428
  },
453
429
  treeFind0: function(t, e = !0, n = -1, r = "children") {
454
430
  for (const i of this) {
455
- const u = i.treeFind0(t, e, n, r);
456
- if (u !== null)
457
- return u;
431
+ const s = i.treeFind0(t, e, n, r);
432
+ if (s !== null)
433
+ return s;
458
434
  }
459
435
  return null;
460
436
  },
@@ -464,17 +440,17 @@ h(Array.prototype, {
464
440
  return this;
465
441
  },
466
442
  treeMap0: function(t, e = !0, n = -1, r = "children", i = null) {
467
- return this.map((u) => u.treeMap0(t, e, n, r, i));
443
+ return this.map((s) => s.treeMap0(t, e, n, r, i));
468
444
  }
469
445
  });
470
- h(Map, {
471
- ...d()
446
+ c(Map, {
447
+ ...p()
472
448
  });
473
- h(Map.prototype, {
449
+ c(Map.prototype, {
474
450
  ...b(["size", "length0"]),
475
451
  ...m(Map.prototype, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
476
452
  ...a(Map.prototype, null, !1, ["set", "set0"], ["delete", "delete0"]),
477
- ...a(Map.prototype, null, 1, ["set", "set1"], ["delete", "delete1"]),
453
+ ...a(Map.prototype, null, 0, ["set", "set1"], ["delete", "delete1"]),
478
454
  ...a(Map.prototype, null, !0, ["set", "set3"], ["delete", "delete3"]),
479
455
  get0: function(t, e = null) {
480
456
  return this.has(t) ? this.get(t) : e;
@@ -495,14 +471,14 @@ h(Map.prototype, {
495
471
  return [...this];
496
472
  }
497
473
  });
498
- h(Set, {
499
- ...d()
474
+ c(Set, {
475
+ ...p()
500
476
  });
501
- h(Set.prototype, {
477
+ c(Set.prototype, {
502
478
  ...b(["size", "length0"]),
503
479
  ...m(Set.prototype, ["entries", "entries0"], ["keys", "keys0"], ["values", "values0"]),
504
480
  ...a(Set.prototype, null, !1, ["add", "add0"], ["delete", "delete0"]),
505
- ...a(Set.prototype, null, 1, ["add", "add1"], ["delete", "delete1"]),
481
+ ...a(Set.prototype, null, 0, ["add", "add1"], ["delete", "delete1"]),
506
482
  ...a(Set.prototype, null, !0, ["add", "add3"], ["delete", "delete3"]),
507
483
  toArray: function() {
508
484
  return [...this];
@@ -511,7 +487,7 @@ h(Set.prototype, {
511
487
  return [...this];
512
488
  }
513
489
  });
514
- h(Date, {
490
+ c(Date, {
515
491
  new: function(...t) {
516
492
  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);
517
493
  },
@@ -547,7 +523,7 @@ h(Date, {
547
523
  return [n, r];
548
524
  }
549
525
  });
550
- h(Date.prototype, {
526
+ c(Date.prototype, {
551
527
  format: function(t = "y-m-d h:i:s") {
552
528
  if (this.getTime() === 0)
553
529
  return "-";
@@ -572,9 +548,9 @@ h(Date.prototype, {
572
548
  getMonthDay: function() {
573
549
  return [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()] || (this.isLeapYear() ? 29 : 28);
574
550
  },
575
- expr: function({ y: t = 0, m: e = 0, d: n = 0, h: r = 0, i = 0, s: u = 0 }) {
551
+ expr: function({ y: t = 0, m: e = 0, d: n = 0, h: r = 0, i = 0, s = 0 }) {
576
552
  const o = new Date(this.getFullYear() + t, this.getMonth() + e + 1, 0);
577
- return new Date(this.getFullYear() + t, this.getMonth() + e, Math.min(o.getDate(), this.getDate()) + n, this.getHours() + r, this.getMinutes() + i, this.getSeconds() + u);
553
+ 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);
578
554
  },
579
555
  begin: function(t = 3) {
580
556
  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));
@@ -592,15 +568,16 @@ h(Date.prototype, {
592
568
  return this.getTime();
593
569
  }
594
570
  });
595
- h(RegExp, {
596
- ...d()
571
+ c(RegExp, {
572
+ ...p()
597
573
  });
598
- h(RegExp.prototype, {
574
+ c(RegExp.prototype, {
599
575
  toJSON: function() {
600
576
  return this.toString();
601
577
  }
602
578
  });
603
- h(Promise, {
579
+ c(Promise, {
580
+ ...p(),
604
581
  channel: function() {
605
582
  let t = null, e = null;
606
583
  return [new this((r, i) => {
@@ -608,12 +585,12 @@ h(Promise, {
608
585
  }), t, e];
609
586
  }
610
587
  });
611
- h(Promise.prototype, {
588
+ c(Promise.prototype, {
612
589
  tryCatch: function() {
613
590
  return new Promise((t) => this.then((e) => t([e, null])).catch((e) => t([null, e])));
614
591
  }
615
592
  });
616
- h(JSON, {
593
+ c(JSON, {
617
594
  parse0: function(t, e = null) {
618
595
  try {
619
596
  if (typeof t != "string")
@@ -624,17 +601,17 @@ h(JSON, {
624
601
  }
625
602
  }
626
603
  });
627
- typeof Iterator < "u" && h(Iterator.prototype, {
604
+ typeof Iterator < "u" && c(Iterator.prototype, {
628
605
  toArray: function() {
629
606
  return Array.from(this);
630
607
  }
631
608
  });
632
- h(ArrayBuffer.prototype, {
609
+ c(ArrayBuffer.prototype, {
633
610
  toUint8Array: function() {
634
611
  return new Uint8Array(this);
635
612
  }
636
613
  });
637
- typeof Uint8Array.fromBase64 > "u" && (h(Uint8Array, {
614
+ typeof Uint8Array.fromBase64 > "u" && (c(Uint8Array, {
638
615
  fromHex: function(t) {
639
616
  const e = [];
640
617
  for (let n = 0; n < t.length; n += 2)
@@ -643,23 +620,23 @@ typeof Uint8Array.fromBase64 > "u" && (h(Uint8Array, {
643
620
  },
644
621
  fromBase64: function(t) {
645
622
  const e = [], n = {}, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
646
- for (let u = 0; u < r.length; u++)
647
- n[r.charAt(u)] = u;
623
+ for (let s = 0; s < r.length; s++)
624
+ n[r.charAt(s)] = s;
648
625
  const i = t.charAt(t.length - 1) != "=" ? t.length : t.charAt(t.length - 2) != "=" ? t.length - 1 : t.length - 2;
649
- for (let u = 3; u < i; u += 4) {
650
- const o = (n[t.charAt(u - 3)] << 18) + (n[t.charAt(u - 2)] << 12) + (n[t.charAt(u - 1)] << 6) + n[t.charAt(u)];
626
+ for (let s = 3; s < i; s += 4) {
627
+ const o = (n[t.charAt(s - 3)] << 18) + (n[t.charAt(s - 2)] << 12) + (n[t.charAt(s - 1)] << 6) + n[t.charAt(s)];
651
628
  e.push((o & 16711680) >> 16, (o & 65280) >> 8, o & 255);
652
629
  }
653
630
  if (i % 4 == 3) {
654
- const u = (n[t.charAt(i - 3)] << 18) + (n[t.charAt(i - 2)] << 12) + (n[t.charAt(i - 1)] << 6);
655
- e.push((u & 16711680) >> 16, (u & 65280) >> 8);
631
+ const s = (n[t.charAt(i - 3)] << 18) + (n[t.charAt(i - 2)] << 12) + (n[t.charAt(i - 1)] << 6);
632
+ e.push((s & 16711680) >> 16, (s & 65280) >> 8);
656
633
  } else if (i % 4 == 2) {
657
- const u = (n[t.charAt(i - 2)] << 18) + (n[t.charAt(i - 1)] << 12);
658
- e.push((u & 16711680) >> 16);
634
+ const s = (n[t.charAt(i - 2)] << 18) + (n[t.charAt(i - 1)] << 12);
635
+ e.push((s & 16711680) >> 16);
659
636
  }
660
637
  return new Uint8Array(e);
661
638
  }
662
- }), h(Uint8Array.prototype, {
639
+ }), c(Uint8Array.prototype, {
663
640
  toHex: function() {
664
641
  let t = "";
665
642
  for (let e = 0; e < this.length; e++)
@@ -682,7 +659,10 @@ typeof Uint8Array.fromBase64 > "u" && (h(Uint8Array, {
682
659
  return t;
683
660
  }
684
661
  }));
685
- h(Uint8Array.prototype, {
662
+ c(Uint8Array, {
663
+ ...p()
664
+ });
665
+ c(Uint8Array.prototype, {
686
666
  bytes2string: function() {
687
667
  return new TextDecoder().decode(this);
688
668
  },
@@ -696,19 +676,19 @@ h(Uint8Array.prototype, {
696
676
  return new Array(...this);
697
677
  }
698
678
  });
699
- let O = 0, w = 0, A = 0;
700
- h(Math, {
679
+ let D = 0, w = 0, A = 0;
680
+ c(Math, {
701
681
  randstr: function(t = 16, e = 0, n = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", r = "~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/") {
702
682
  if (t < e)
703
683
  throw new Error("randstr: len < slen");
704
684
  const i = [];
705
- for (let u = 0; u < t; u++)
685
+ for (let s = 0; s < t; s++)
706
686
  i.push(n.charAt(Math.random() * n.length | 0));
707
- for (let u = /* @__PURE__ */ new Set(), o = 0, s = 0; s < e; s++) {
687
+ for (let s = /* @__PURE__ */ new Set(), o = 0, h = 0; h < e; h++) {
708
688
  do
709
689
  o = Math.random() * t | 0;
710
- while (u.has(o));
711
- u.set(o, !0), i[o] = r.charAt(Math.random() * r.length | 0);
690
+ while (s.has(o));
691
+ s.set(o, !0), i[o] = r.charAt(Math.random() * r.length | 0);
712
692
  }
713
693
  return i.join("");
714
694
  },
@@ -716,7 +696,7 @@ h(Math, {
716
696
  return Math.floor(Math.random() * (e - t) + t);
717
697
  },
718
698
  incrid: function() {
719
- return ++O;
699
+ return ++D;
720
700
  },
721
701
  incrstr: function() {
722
702
  return "" + Math.incrid();
@@ -732,11 +712,11 @@ h(Math, {
732
712
  },
733
713
  useTemplate: function(t) {
734
714
  let e = null;
735
- const n = { setup(i, { slots: u }) {
736
- return e = u.default, () => {
715
+ const n = { setup(i, { slots: s }) {
716
+ return e = s.default, () => {
737
717
  };
738
- }, name: t + "Template" }, r = { setup(i, { attrs: u }) {
739
- return () => e?.(u);
718
+ }, name: t + "Template" }, r = { setup(i, { attrs: s }) {
719
+ return () => e?.(s);
740
720
  }, name: t };
741
721
  return { [n.name]: n, [r.name]: r };
742
722
  }
@@ -1 +1 @@
1
- (function(h){typeof define=="function"&&define.amd?define(h):h()})((function(){"use strict";function h(t,e){return Object.defineProperties(t,Object.fromEntries(Object.keys(e).map(n=>[n,{value:e[n],enumerable:!1,configurable:!0,writable:!0}])))}function d(){return{new:function(...t){return new this(...t)}}}function b(...t){const e={};for(const[n,r]of t)e[r]=function(){return this[n]};return e}function a(t,e,n,...r){const i={};for(const[u,o]of r){if(e===null&&n===null){i[o]=function(...s){return t[u].apply(this,s)};continue}if(e===null&&n===!1){i[o]=function(...s){return t[u].apply(this,s),this};continue}if(e===null&&n===!0){i[o]=function(...s){return t[u].apply(this,s),s};continue}if(e===null&&n>0){i[o]=function(...s){return t[u].apply(this,s),s[n-1]};continue}if(e===null&&n<0){i[o]=function(...s){return t[u].apply(this,s),s[s.length+n+1]};continue}if(e!==null&&n===null){i[o]=function(...s){return s.splice(e>0?e-1:s.length+e+1,0,this),t[u].apply(this,s)};continue}if(e!==null&&n===!1){i[o]=function(...s){return s.splice(e>0?e-1:s.length+e+1,0,this),t[u].apply(this,s),this};continue}if(e!==null&&n===!0){i[o]=function(...s){return s.splice(e>0?e-1:s.length+e+1,0,this),t[u].apply(this,s),s};continue}if(e!==null&&n>0){i[o]=function(...s){return s.splice(e>0?e-1:s.length+e+1,0,this),t[u].apply(this,s),s[n-1]};continue}if(e!==null&&n<0){i[o]=function(...s){return s.splice(e>0?e-1:s.length+e+1,0,this),t[u].apply(this,s),s[s.length+n+1]};continue}throw Error("unreachable")}return i}function m(t,...e){const n={};for(const[r,i]of e)n[i]=function(...u){return[...t[r].apply(this,u)]};return n}function w(t={array:!1}){return function(e={},...n){const r=(i,u)=>{const o=Object.prototype.toString.call(i),s=Object.prototype.toString.call(u);if(o!==s)return u;if(o==="[object Array]")return t.array?i.concat(...u):u;if(o==="[object Object]"){for(const l in u)i[l]=r(i[l],u[l]);return i}else return u};for(const i of n)e=r(e,i);return e}}const A=w({array:!1}),M=w({array:!0});h(Object,{isObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},merge0:function(...t){return A(this,...t)},concat0:function(...t){return M(this,...t)}}),h(Object.prototype,{clone0:function(){return JSON.parse(JSON.stringify(this))},length0:function(){return Object.keys(this).length},...a(Object,1,null,["entries","entries0"],["keys","keys0"],["values","values0"],["assign","assign0"]),merge0:function(...t){return A(this,...t)},concat0:function(...t){return M(this,...t)},map0:function(t=(n,r,i)=>[n,r],e=0){return Object.entries(this).map(([n,r])=>t(n,r,e++))},pick0:function(...t){const e={};for(const n of t)e[n]=this[n];return e},omit0:function(...t){const e={},n=new Set(t);for(const r in this)n.has(r)||(e[r]=this[r]);return e},empty0:function(...t){return Object.keys(this).length==0},attr0:function(...t){if(typeof this!="object")return this;const[e,n,r,i]=t;return t.length==1?this[e]:t.length==2?(this[e]=n,this):typeof r=="boolean"?(e in this===r&&(this[e]=n),this):r=="define"||r===null?Object.defineProperty(this,e,{value:n,enumerable:!1,configurable:!0,writable:!0,...i}):r==="+"?(this[e]=(this[e]??i??0)+n,this):r==="-"?(this[e]=(this[e]??i??0)-n,this):r==="*"?(this[e]=(this[e]??i??0)*n,this):r==="/"?(this[e]=(this[e]??i??0)/n,this):this},pipe0:function(t,...e){return t(this,...e)},handle0:function(t,...e){return t(this,...e),this},toArray0:function(){return Array.isArray(this)?this:[this]},...a(console,-1,!1,["debug","debug0"],["log","log0"],["info","info0"],["warn","warn0"],["error","error0"],["dir","dir0"]),debugger0:function(...t){console.debug(this,...t);debugger;return this},getParents0:function(t=!1,e=-1,n="parent"){const r=t?[this]:[];let i=this[n];for(;i&&e--!=0;)r.push(i),i=i[n];return r},getChildrens0:function(t=!1,e=-1,n="children"){const r=[],i=(u,o,s)=>{if(o&&r.push(u),!(s==0||!u[n]||u[n].length==0))for(const l of u[n])i(l,!0,s-1)};return i(this,t,e),r},treeFind0:function(t,e=!0,n=-1,r="children"){if(e&&t(this))return this;if(n==0||!this[r]||this[r].length==0)return null;for(const i of this[r]){const u=i.treeFind0(t,!0,n-1,r);if(u!==null)return u}return null},treeEach0:function(t,e=!0,n=-1,r="children"){if(e&&t(this),!(n==0||!this[r]||this[r].length==0)){for(const i of this[r])i.treeEach0(t,!0,n-1,r);return this}},treeMap0:function(t,e=!0,n=-1,r="children",i=null){const u=e?t(this):this,o=[];if(n==0||!this[r]||this[r].length==0)return u;for(const s of this[r])o.push(s.treeMap0(t,!0,n-1,r,i));return u[r]=o,u}}),h(Number.prototype,{...a(Math,1,null,["ceil","ceil"],["floor","floor"],["trunc","trunc"],["abs","abs"],["max","max"],["min","min"]),round:function(t=0){return Math.round(this*10**t)/10**t},add:function(t,...e){return typeof t=="function"?t(this,...e):this+t},sub:function(t,...e){return typeof t=="function"?t(this,...e):this-t},mul:function(t,...e){return typeof t=="function"?t(this,...e):this*t},div:function(t,...e){return typeof t=="function"?t(this,...e):this/t},baseConvert:function(t=64){let e="",n=this,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(;n>0;)e=r.at(n%t)+e,n=Math.floor(n/t);return e||"0"},unit:function(t,e=0){let n=this,r="";for([unit,size]of Object.entries(t)){if(r=unit,size===0||n<size)break;n=n/size}return e<0?+n.toFixed(0-e)+r:n.toFixed(e)+r},units:function(t,e=!1){let n=this,r=[];for([unit,size]of Object.entries(t))if(size==0||n<size){r.push([n,unit]);break}else r.push([n%size,unit]),n=Math.floor(n/size);return e?r:r.reverse().map(([i,u])=>i+u).join("")},toFixed0:function(t=0){return+this.toFixed(t)},toDate:function(){return Date.new(this)}}),h(BigInt.prototype,{toJSON:function(){return this<BigInt(Number.MIN_SAFE_INTEGER)||this>BigInt(Number.MAX_SAFE_INTEGER)?this.toString():Number(this)}}),h(String.prototype,{...b(["length","length0"]),substring0:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=e>=0?e:this.length+e,this.substring(t,e)},substr0:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=t+e,this.substring(t,e)},split0:function(t=",",e=-1){const n=this?this.split(t):[];return e===-1?n:n.push0(n.splice(e-1).join(t))},splitNumber:function(t=","){return this.split0(t).map(e=>+e)},splitSegment:function(t=1){const e=[];for(let n=0;n<this.length;n+=t)e.push(this.substring(n,n+t));return e},sprintf:function(...t){let[e,...n]=this.split(/%[sd]/);for(let r=0;r<n.length;r++)e+=t[r]+n[r];return e},subOf:function(t,e,n=0,r=0){for(let o=0;o<n&&r!=-1;o++,r++)r=this.indexOf(t,r);let i=this.indexOf(t,r),u=this.indexOf(e,i);return i==-1||u==-1?"":(i+=t.length,this.substring(i,u))},lastSubOf:function(t,e,n=0,r=1/0){for(let o=0;o<n&&r!=-1;o++,r--)r=this.lastIndexOf(t,r);let i=this.lastIndexOf(t,r),u=this.indexOf(e,i);return i==-1||u==-1?"":(i+=t.length,this.substring(i,u))},camel2under:function(){return this.substr(0,1)+this.substr(1).replace(/([A-Z])/g,(t,e)=>"_"+e.toLowerCase())},under2camel:function(){return this.replace(/_([a-z])/g,(t,e)=>e.toUpperCase())},camel2pascal:function(){return this.substr(0,1).toUpperCase()+this.substr(1)},pascal2camel:function(){return this.substr(0,1).toLowerCase()+this.substr(1)},under2kebab:function(){return this.replace(/_/g,"-")},kebab2under:function(){return this.replace(/-/g,"_")},baseConvert:function(t=64){let e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(let r=0;r<this.length;r++)e=e*t+n.indexOf(this.at(r));return e},toFixed0:function(...t){return+(+this).toFixed(...t)},toDate:function(){return Date.new(this)},string2bytes:function(){return new TextEncoder().encode(this)},hex2bytes:function(){return Uint8Array.fromHex(this)},base64decode:function(){return Uint8Array.fromBase64(this)}}),h(Array,{...d(),range:function(...t){let e=[],n=0,r=0,i=1,u=typeof t[t.length-1]=="boolean"?t.pop():!0,o=typeof t[t.length-1]=="function"?t.pop():(s,l,g)=>s;switch(t.length){case 1:[r]=t;break;case 2:[n,r]=t;break;case 3:[n,r,i]=t;break;default:throw new Error("the number of parameters is incorrect!")}if(i==0)throw new Error("step cannot be 0!");for(let s=0,l=0,g=Math.abs(r-n),f=Math.abs(i),p=n<=r?1:-1;l<g;l+=f)e.push(u?o(n+l*p,s++,e):o());return e}}),h(Array.prototype,{...b(["length","length0"]),...m(Array.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...a(Array.prototype,null,!1,["push","push0"],["pop","pop0"],["shift","shift0"],["unshift","unshift0"]),...a(Array.prototype,null,1,["push","push1"],["unshift","unshift1"]),...a(Array.prototype,null,!0,["push","push3"],["unshift","unshift3"]),first0:function(t=null){return this.length?this[0]:t},last0:function(t=null){return this.length?this[this.length-1]:t},find0:function(t,e=null){return this.find(t)??e},equals0:function(t){return this.length===t.length&&(this===t||this.length===0||this.every((e,n)=>e===t[n]))},unique0:function(t=e=>e){const e=new Set;return this.filter(n=>e.has(t(n))?!1:!!e.add(t(n)))},...a(Array.prototype,null,!1,["forEach","each0"]),eachAsync:async function(t){for(let e=0;e<this.length;e++)await t(this[e],e,this);return this},mapAsync:async function(t){const e=[];for(let n=0;n<this.length;n++)e.push(await t(this[n],n,this));return e},toMap:function(t=(e,n)=>[n,e]){return new Map(this.map(t))},toSet:function(t=e=>e){return new Set(this.map(t))},bytes2string:function(){return this.toUint8Array().bytes2string()},bytes2hex:function(){return this.toUint8Array().toHex()},base64encode:function(){return this.toUint8Array().toBase64()},toUint8Array:function(){return new Uint8Array(this)},assoc:function(t,e,n={}){const r=this.unique0(u=>u[t]),i=r.length==0?{}:typeof n=="function"?n(r):n;return this.each0(u=>u[e]=i[u[t]]??null)},toTree:function(t={}){const{id:e="id",pid:n="pid",level:r="level",root:i="root",parent:u="parent",children:o="children",empty:s=null,hasRoot:l=!0}=t,g=this.reduce((c,y)=>c.attr0(y[e],y),{}),f=this.reduce((c,y)=>(c.attr0(y[n],[],!1).attr0(y[n]).push0(y),c),{}),p=this.length&&l?this.find(c=>c[n]===0):{[e]:0,[n]:-1,[i]:null,[u]:null,[o]:f[0]};h(p,{[i]:p});for(const c of this)h(c,{[i]:p,[u]:g[c[n]]}),c[o]=f[c[e]]||s;return p.treeEach0(c=>c[r]=c[u]?c[u][r]+1:0,-1,o),p},tree2tree:function(t={},e=null,n=null){const{id:r="id",pid:i="pid",level:u="level",root:o="root",parent:s="parent",children:l="children",empty:g=null}=t;e=e||{[r]:0,[i]:-1,[u]:0,[o]:null,[s]:null,[l]:this},n=n||e;for(const f of this)h(f,{[o]:e,[s]:n}),f[i]=n[r],f[u]=n[u]+1,f[l]=f[l]&&f[l].length?f[l]:g,f[l]?.tree2tree(t,e,f);return e},treeFind0:function(t,e=!0,n=-1,r="children"){for(const i of this){const u=i.treeFind0(t,e,n,r);if(u!==null)return u}return null},treeEach0:function(t,e=!0,n=-1,r="children"){for(const i of this)i.treeEach0(t,e,n,r);return this},treeMap0:function(t,e=!0,n=-1,r="children",i=null){return this.map(u=>u.treeMap0(t,e,n,r,i))}}),h(Map,{...d()}),h(Map.prototype,{...b(["size","length0"]),...m(Map.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...a(Map.prototype,null,!1,["set","set0"],["delete","delete0"]),...a(Map.prototype,null,1,["set","set1"],["delete","delete1"]),...a(Map.prototype,null,!0,["set","set3"],["delete","delete3"]),get0:function(t,e=null){return this.has(t)?this.get(t):e},get1:function(t,e,...n){return this.has(t)?this.get(t):this.set3(t,e(t,...n))[1]},getAsync1:async function(t,e,...n){return this.has(t)?this.get(t):this.set3(t,await e(t,...n))[1]},toObject:function(){return Object.fromEntries(this)},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),h(Set,{...d()}),h(Set.prototype,{...b(["size","length0"]),...m(Set.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...a(Set.prototype,null,!1,["add","add0"],["delete","delete0"]),...a(Set.prototype,null,1,["add","add1"],["delete","delete1"]),...a(Set.prototype,null,!0,["add","add3"],["delete","delete3"]),toArray:function(){return[...this]},toJSON:function(){return[...this]}}),h(Date,{new:function(...t){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)},format:function(t="y-m-d h:i:s"){return new Date().format(t)},unix:function(){return this.now()/1e3|0},fromUnix:function(t=0){return new Date((t||0)*1e3)},expr:function(t={}){return new Date().expr(t)},toDayRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400-1]},toWeekRange:function(){let t=new Date;for(;t.getDay()!=1;)t=new Date(t.getTime()-86400);const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400*7-1]},toMonthRange:function(){const t=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;return[r,i]},toYearRange:function(){const e=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;return[n,r]}}),h(Date.prototype,{format:function(t="y-m-d h:i:s"){if(this.getTime()===0)return"-";const e={y:this.getFullYear(),m:this.getMonth()+1,d:this.getDate(),h:this.getHours(),i:this.getMinutes(),s:this.getSeconds(),l:this.getMilliseconds(),e:this.getMonthDay()};return t.replace(/([ymdhisle])/ig,(n,r)=>r>="A"&&r<="Z"?e[r.toLowerCase()]:e[r].toString().padStart(r==="l"?3:2,"0"))},unix:function(){return this.getTime()/1e3|0},isLeapYear:function(){return this.getFullYear()%4===0&&this.getFullYear()%400!==0},getMonthDay:function(){return[31,0,31,30,31,30,31,31,30,31,30,31][this.getMonth()]||(this.isLeapYear()?29:28)},expr:function({y:t=0,m:e=0,d:n=0,h:r=0,i=0,s:u=0}){const o=new Date(this.getFullYear()+t,this.getMonth()+e+1,0);return new Date(this.getFullYear()+t,this.getMonth()+e,Math.min(o.getDate(),this.getDate())+n,this.getHours()+r,this.getMinutes()+i,this.getSeconds()+u)},begin:function(t=3){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))},end:function(t=3){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))},week:function(t,e=1){let n=new Date(this.getTime());for(;n.getDay()!==t;)n=new Date(n.getTime()+864e5*e);return n},toJSON:function(){return this.getTime()}}),h(RegExp,{...d()}),h(RegExp.prototype,{toJSON:function(){return this.toString()}}),h(Promise,{channel:function(){let t=null,e=null;return[new this((r,i)=>{t=r,e=i}),t,e]}}),h(Promise.prototype,{tryCatch:function(){return new Promise(t=>this.then(e=>t([e,null])).catch(e=>t([null,e])))}}),h(JSON,{parse0:function(t,e=null){try{if(typeof t!="string")throw new Error("not string");return JSON.parse(t)}catch{return e}}}),typeof Iterator<"u"&&h(Iterator.prototype,{toArray:function(){return Array.from(this)}}),h(ArrayBuffer.prototype,{toUint8Array:function(){return new Uint8Array(this)}}),typeof Uint8Array.fromBase64>"u"&&(h(Uint8Array,{fromHex:function(t){const e=[];for(let n=0;n<t.length;n+=2)e.push(Number.parseInt(t.substring(n,n+2),16));return new Uint8Array(e)},fromBase64:function(t){const e=[],n={},r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let u=0;u<r.length;u++)n[r.charAt(u)]=u;const i=t.charAt(t.length-1)!="="?t.length:t.charAt(t.length-2)!="="?t.length-1:t.length-2;for(let u=3;u<i;u+=4){const o=(n[t.charAt(u-3)]<<18)+(n[t.charAt(u-2)]<<12)+(n[t.charAt(u-1)]<<6)+n[t.charAt(u)];e.push((o&16711680)>>16,(o&65280)>>8,o&255)}if(i%4==3){const u=(n[t.charAt(i-3)]<<18)+(n[t.charAt(i-2)]<<12)+(n[t.charAt(i-1)]<<6);e.push((u&16711680)>>16,(u&65280)>>8)}else if(i%4==2){const u=(n[t.charAt(i-2)]<<18)+(n[t.charAt(i-1)]<<12);e.push((u&16711680)>>16)}return new Uint8Array(e)}}),h(Uint8Array.prototype,{toHex:function(){let t="";for(let e=0;e<this.length;e++)t+=(this[e]<16?"0":"")+this[e].toString(16);return t},toBase64:function(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let n=2;n<this.length;n+=3){const r=(this[n-2]<<16)+(this[n-1]<<8)+this[n];t+=e.charAt((r&16515072)>>18)+e.charAt((r&258048)>>12)+e.charAt((r&4032)>>6)+e.charAt(r&63)}if(this.length%3==2){const n=(this[this.length-2]<<16)+(this[this.length-1]<<8);t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+e.charAt((n&4032)>>6)+"="}else if(this.length%3==1){const n=this[this.length-1]<<16;t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+"=="}return t}})),h(Uint8Array.prototype,{bytes2string:function(){return new TextDecoder().decode(this)},bytes2hex:function(){return this.toHex()},base64encode:function(){return this.toBase64()},toArray:function(){return new Array(...this)}});let O=0,F=0,D=0;h(Math,{randstr:function(t=16,e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/"){if(t<e)throw new Error("randstr: len < slen");const i=[];for(let u=0;u<t;u++)i.push(n.charAt(Math.random()*n.length|0));for(let u=new Set,o=0,s=0;s<e;s++){do o=Math.random()*t|0;while(u.has(o));u.set(o,!0),i[o]=r.charAt(Math.random()*r.length|0)}return i.join("")},randint:function(t=0,e=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(e-t)+t)},incrid:function(){return++O},incrstr:function(){return""+Math.incrid()},uniqid:function(t=Date.now()){return t===D?t*2048+ ++F%2048:(D=t)*2048+(F=0)%2048},uniqstr:function(){return""+Math.uniqid()},sleep:function(t){return new Promise(e=>setTimeout(e,t))},useTemplate:function(t){let e=null;const n={setup(i,{slots:u}){return e=u.default,()=>{}},name:t+"Template"},r={setup(i,{attrs:u}){return()=>e?.(u)},name:t};return{[n.name]:n,[r.name]:r}}})}));
1
+ (function(h){typeof define=="function"&&define.amd?define(h):h()})((function(){"use strict";function h(t,e){return Object.defineProperties(t,Object.fromEntries(Object.keys(e).map(n=>[n,{value:e[n],enumerable:!1,configurable:!0,writable:!0}])))}function p(){return{new:function(...t){return new this(...t)}}}function b(...t){const e={};for(const[n,r]of t)e[r]=function(){return this[n]};return e}function l(t,e,n,...r){const i={},s=(o,c,u)=>(c!==null&&o.splice(c>=0?c:o.length+c+1,0,u),o);for(const[o,c]of r)if(n===null)i[c]=function(...u){return t[o].apply(this,s(u,e,this))};else if(n===!1)i[c]=function(...u){return t[o].apply(this,s(u,e,this)),this};else if(n===!0)i[c]=function(...u){return t[o].apply(this,s(u,e,this)),u};else if(n>=0)i[c]=function(...u){return t[o].apply(this,s(u,e,this)),u[n]};else if(n<0)i[c]=function(...u){return t[o].apply(this,s(u,e,this)),u[u.length+n]};else throw Error("unreachable");return i}function m(t,...e){const n={};for(const[r,i]of e)n[i]=function(...s){return[...t[r].apply(this,s)]};return n}function w(t={array:!1}){return function(e={},...n){const r=(i,s)=>{const o=Object.prototype.toString.call(i),c=Object.prototype.toString.call(s);if(o!==c)return s;if(o==="[object Array]")return t.array?i.concat(...s):s;if(o==="[object Object]"){for(const u in s)i[u]=r(i[u],s[u]);return i}else return s};for(const i of n)e=r(e,i);return e}}const A=w({array:!1}),M=w({array:!0});h(Object,{...p(),isObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},merge0:function(...t){return A(this,...t)},concat0:function(...t){return M(this,...t)}}),h(Object.prototype,{clone0:function(){return JSON.parse(JSON.stringify(this))},length0:function(){return Object.keys(this).length},...l(Object,0,null,["entries","entries0"],["keys","keys0"],["values","values0"],["assign","assign0"]),...l(JSON,0,null,["stringify","stringify0"]),merge0:function(...t){return A(this,...t)},concat0:function(...t){return M(this,...t)},in0:function(t){return t in this},map0:function(t=(n,r,i)=>[n,r],e=0){return Object.entries(this).map(([n,r])=>t(n,r,e++))},pick0:function(...t){const e={};for(const n of t)e[n]=this[n];return e},omit0:function(...t){const e={},n=new Set(t);for(const r in this)n.has(r)||(e[r]=this[r]);return e},empty0:function(...t){return Object.keys(this).length==0},attr0:function(...t){if(typeof this!="object")return this;const[e,n,r,i]=t;return t.length==1?this[e]:t.length==2?(this[e]=n,this):typeof r=="boolean"?(e in this===r&&(this[e]=n),this):r=="define"||r===null?Object.defineProperty(this,e,{value:n,enumerable:!1,configurable:!0,writable:!0,...i}):r==="+"?(this[e]=(this[e]??i??0)+n,this):r==="-"?(this[e]=(this[e]??i??0)-n,this):r==="*"?(this[e]=(this[e]??i??0)*n,this):r==="/"?(this[e]=(this[e]??i??0)/n,this):this},pipe0:function(t,...e){return t(this,...e)},handle0:function(t,...e){return t(this,...e),this},toArray0:function(){return Array.isArray(this)?this:[this]},...l(console,-1,!1,["debug","debug0"],["log","log0"],["info","info0"],["warn","warn0"],["error","error0"],["dir","dir0"]),debugger0:function(...t){console.debug(this,...t);debugger;return this},getParents0:function(t=!1,e=-1,n="parent"){const r=t?[this]:[];let i=this[n];for(;i&&e--!=0;)r.push(i),i=i[n];return r},getChildrens0:function(t=!1,e=-1,n="children"){const r=[],i=(s,o,c)=>{if(o&&r.push(s),!(c==0||!s[n]||s[n].length==0))for(const u of s[n])i(u,!0,c-1)};return i(this,t,e),r},treeFind0:function(t,e=!0,n=-1,r="children"){if(e&&t(this))return this;if(n==0||!this[r]||this[r].length==0)return null;for(const i of this[r]){const s=i.treeFind0(t,!0,n-1,r);if(s!==null)return s}return null},treeEach0:function(t,e=!0,n=-1,r="children"){if(e&&t(this),!(n==0||!this[r]||this[r].length==0)){for(const i of this[r])i.treeEach0(t,!0,n-1,r);return this}},treeMap0:function(t,e=!0,n=-1,r="children",i=null){const s=e?t(this):this,o=[];if(n==0||!this[r]||this[r].length==0)return s;for(const c of this[r])o.push(c.treeMap0(t,!0,n-1,r,i));return s[r]=o,s}}),h(Number.prototype,{...l(Math,0,null,["ceil","ceil"],["floor","floor"],["trunc","trunc"],["abs","abs"],["max","max"],["min","min"]),round:function(t=0){return Math.round(this*10**t)/10**t},add:function(t,...e){return typeof t=="function"?t(this,...e):this+t},sub:function(t,...e){return typeof t=="function"?t(this,...e):this-t},mul:function(t,...e){return typeof t=="function"?t(this,...e):this*t},div:function(t,...e){return typeof t=="function"?t(this,...e):this/t},baseConvert:function(t=64){let e="",n=this,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(;n>0;)e=r.at(n%t)+e,n=Math.floor(n/t);return e||"0"},unit:function(t,e=0){let n=this,r="";for(const[i,s]of Object.entries(t)){if(r=i,s===0||n<s)break;n=n/s}return e<0?+n.toFixed(0-e)+r:n.toFixed(e)+r},units:function(t,e=!1){let n=this,r=[];for([unit,size]of Object.entries(t))if(size==0||n<size){r.push([n,unit]);break}else r.push([n%size,unit]),n=Math.floor(n/size);return e?r:r.reverse().map(([i,s])=>i+s).join("")},toFixed0:function(t=0){return+this.toFixed(t)},toDate:function(){return Date.new(this)}}),h(BigInt.prototype,{toJSON:function(){return this<BigInt(Number.MIN_SAFE_INTEGER)||this>BigInt(Number.MAX_SAFE_INTEGER)?this.toString():Number(this)}}),h(String.prototype,{...p(),...b(["length","length0"]),substring0:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=e>=0?e:this.length+e,this.substring(t,e)},substr0:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=t+e,this.substring(t,e)},split0:function(t=",",e=-1){const n=this?this.split(t):[];return e===-1?n:n.push0(n.splice(e-1).join(t))},splitNumber:function(t=","){return this.split0(t).map(e=>+e)},splitSegment:function(t=1){const e=[];for(let n=0;n<this.length;n+=t)e.push(this.substring(n,n+t));return e},sprintf:function(...t){let[e,...n]=this.split(/%[sd]/);for(let r=0;r<n.length;r++)e+=t[r]+n[r];return e},subOf:function(t,e,n=0,r=0){for(let o=0;o<n&&r!=-1;o++,r++)r=this.indexOf(t,r);let i=this.indexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},lastSubOf:function(t,e,n=0,r=1/0){for(let o=0;o<n&&r!=-1;o++,r--)r=this.lastIndexOf(t,r);let i=this.lastIndexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},camel2under:function(){return this.substr(0,1)+this.substr(1).replace(/([A-Z])/g,(t,e)=>"_"+e.toLowerCase())},under2camel:function(){return this.replace(/_([a-z])/g,(t,e)=>e.toUpperCase())},camel2pascal:function(){return this.substr(0,1).toUpperCase()+this.substr(1)},pascal2camel:function(){return this.substr(0,1).toLowerCase()+this.substr(1)},under2kebab:function(){return this.replace(/_/g,"-")},kebab2under:function(){return this.replace(/-/g,"_")},baseConvert:function(t=64){let e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(let r=0;r<this.length;r++)e=e*t+n.indexOf(this.at(r));return e},toFixed0:function(...t){return+(+this).toFixed(...t)},toDate:function(){return Date.new(this)},string2bytes:function(){return new TextEncoder().encode(this)},hex2bytes:function(){return Uint8Array.fromHex(this)},base64decode:function(){return Uint8Array.fromBase64(this)}}),h(Array,{...p(),range:function(...t){let e=[],n=0,r=0,i=1,s=typeof t[t.length-1]=="boolean"?t.pop():!0,o=typeof t[t.length-1]=="function"?t.pop():(c,u,d)=>c;switch(t.length){case 1:[r]=t;break;case 2:[n,r]=t;break;case 3:[n,r,i]=t;break;default:throw new Error("the number of parameters is incorrect!")}if(i==0)throw new Error("step cannot be 0!");for(let c=0,u=0,d=Math.abs(r-n),f=Math.abs(i),g=n<=r?1:-1;u<d;u+=f)e.push(s?o(n+u*g,c++,e):o());return e}}),h(Array.prototype,{...b(["length","length0"]),...m(Array.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...l(Array.prototype,null,!1,["push","push0"],["pop","pop0"],["shift","shift0"],["unshift","unshift0"]),...l(Array.prototype,null,0,["push","push1"],["unshift","unshift1"]),...l(Array.prototype,null,!0,["push","push3"],["unshift","unshift3"]),...l(Array.prototype,null,!0,["splice","splice0"]),first0:function(t=null){return this.length?this[0]:t},last0:function(t=null){return this.length?this[this.length-1]:t},find0:function(t,e=null){return this.find(t)??e},equals0:function(t){return this.length===t.length&&(this===t||this.length===0||this.every((e,n)=>e===t[n]))},unique0:function(t=e=>e){const e=new Set;return this.filter(n=>e.has(t(n))?!1:!!e.add(t(n)))},...l(Array.prototype,null,!1,["forEach","each0"]),eachAsync:async function(t){for(let e=0;e<this.length;e++)await t(this[e],e,this);return this},mapAsync:async function(t){const e=[];for(let n=0;n<this.length;n++)e.push(await t(this[n],n,this));return e},shuffle:function(t=!1){const e=t?e.clone0():e;let n=e.length;for(;n;){const r=Math.random()*n--|0;[e[r],e[n]]=[e[n],e[r]]}return e},toMap:function(t=(e,n)=>[n,e]){return new Map(this.map(t))},toSet:function(t=e=>e){return new Set(this.map(t))},bytes2string:function(){return this.toUint8Array().bytes2string()},bytes2hex:function(){return this.toUint8Array().toHex()},base64encode:function(){return this.toUint8Array().toBase64()},toUint8Array:function(){return new Uint8Array(this)},assoc:function(t,e,n={}){const r=this.unique0(s=>s[t]),i=r.length==0?{}:typeof n=="function"?n(r):n;return this.each0(s=>s[e]=i[s[t]]??null)},toTree:function(t={}){const{id:e="id",pid:n="pid",level:r="level",root:i="root",parent:s="parent",children:o="children",empty:c=null,hasRoot:u=!0}=t,d=this.reduce((a,y)=>a.attr0(y[e],y),{}),f=this.reduce((a,y)=>(a.attr0(y[n],[],!1).attr0(y[n]).push0(y),a),{}),g=this.length&&u?this.find(a=>a[n]===0):{[e]:0,[n]:-1,[i]:null,[s]:null,[o]:f[0]};h(g,{[i]:g});for(const a of this)h(a,{[i]:g,[s]:d[a[n]]}),a[o]=f[a[e]]||c;return g.treeEach0(a=>a[r]=a[s]?a[s][r]+1:0,-1,o),g},tree2tree:function(t={},e=null,n=null){const{id:r="id",pid:i="pid",level:s="level",root:o="root",parent:c="parent",children:u="children",empty:d=null}=t;e=e||{[r]:0,[i]:-1,[s]:0,[o]:null,[c]:null,[u]:this},n=n||e;for(const f of this)h(f,{[o]:e,[c]:n}),f[i]=n[r],f[s]=n[s]+1,f[u]=f[u]&&f[u].length?f[u]:d,f[u]?.tree2tree(t,e,f);return e},treeFind0:function(t,e=!0,n=-1,r="children"){for(const i of this){const s=i.treeFind0(t,e,n,r);if(s!==null)return s}return null},treeEach0:function(t,e=!0,n=-1,r="children"){for(const i of this)i.treeEach0(t,e,n,r);return this},treeMap0:function(t,e=!0,n=-1,r="children",i=null){return this.map(s=>s.treeMap0(t,e,n,r,i))}}),h(Map,{...p()}),h(Map.prototype,{...b(["size","length0"]),...m(Map.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...l(Map.prototype,null,!1,["set","set0"],["delete","delete0"]),...l(Map.prototype,null,0,["set","set1"],["delete","delete1"]),...l(Map.prototype,null,!0,["set","set3"],["delete","delete3"]),get0:function(t,e=null){return this.has(t)?this.get(t):e},get1:function(t,e,...n){return this.has(t)?this.get(t):this.set3(t,e(t,...n))[1]},getAsync1:async function(t,e,...n){return this.has(t)?this.get(t):this.set3(t,await e(t,...n))[1]},toObject:function(){return Object.fromEntries(this)},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),h(Set,{...p()}),h(Set.prototype,{...b(["size","length0"]),...m(Set.prototype,["entries","entries0"],["keys","keys0"],["values","values0"]),...l(Set.prototype,null,!1,["add","add0"],["delete","delete0"]),...l(Set.prototype,null,0,["add","add1"],["delete","delete1"]),...l(Set.prototype,null,!0,["add","add3"],["delete","delete3"]),toArray:function(){return[...this]},toJSON:function(){return[...this]}}),h(Date,{new:function(...t){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)},format:function(t="y-m-d h:i:s"){return new Date().format(t)},unix:function(){return this.now()/1e3|0},fromUnix:function(t=0){return new Date((t||0)*1e3)},expr:function(t={}){return new Date().expr(t)},toDayRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400-1]},toWeekRange:function(){let t=new Date;for(;t.getDay()!=1;)t=new Date(t.getTime()-86400);const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400*7-1]},toMonthRange:function(){const t=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;return[r,i]},toYearRange:function(){const e=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;return[n,r]}}),h(Date.prototype,{format:function(t="y-m-d h:i:s"){if(this.getTime()===0)return"-";const e={y:this.getFullYear(),m:this.getMonth()+1,d:this.getDate(),h:this.getHours(),i:this.getMinutes(),s:this.getSeconds(),l:this.getMilliseconds(),e:this.getMonthDay()};return t.replace(/([ymdhisle])/ig,(n,r)=>r>="A"&&r<="Z"?e[r.toLowerCase()]:e[r].toString().padStart(r==="l"?3:2,"0"))},unix:function(){return this.getTime()/1e3|0},isLeapYear:function(){return this.getFullYear()%4===0&&this.getFullYear()%400!==0},getMonthDay:function(){return[31,0,31,30,31,30,31,31,30,31,30,31][this.getMonth()]||(this.isLeapYear()?29:28)},expr:function({y:t=0,m:e=0,d:n=0,h:r=0,i=0,s=0}){const o=new Date(this.getFullYear()+t,this.getMonth()+e+1,0);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)},begin:function(t=3){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))},end:function(t=3){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))},week:function(t,e=1){let n=new Date(this.getTime());for(;n.getDay()!==t;)n=new Date(n.getTime()+864e5*e);return n},toJSON:function(){return this.getTime()}}),h(RegExp,{...p()}),h(RegExp.prototype,{toJSON:function(){return this.toString()}}),h(Promise,{...p(),channel:function(){let t=null,e=null;return[new this((r,i)=>{t=r,e=i}),t,e]}}),h(Promise.prototype,{tryCatch:function(){return new Promise(t=>this.then(e=>t([e,null])).catch(e=>t([null,e])))}}),h(JSON,{parse0:function(t,e=null){try{if(typeof t!="string")throw new Error("not string");return JSON.parse(t)}catch{return e}}}),typeof Iterator<"u"&&h(Iterator.prototype,{toArray:function(){return Array.from(this)}}),h(ArrayBuffer.prototype,{toUint8Array:function(){return new Uint8Array(this)}}),typeof Uint8Array.fromBase64>"u"&&(h(Uint8Array,{fromHex:function(t){const e=[];for(let n=0;n<t.length;n+=2)e.push(Number.parseInt(t.substring(n,n+2),16));return new Uint8Array(e)},fromBase64:function(t){const e=[],n={},r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let s=0;s<r.length;s++)n[r.charAt(s)]=s;const i=t.charAt(t.length-1)!="="?t.length:t.charAt(t.length-2)!="="?t.length-1:t.length-2;for(let s=3;s<i;s+=4){const o=(n[t.charAt(s-3)]<<18)+(n[t.charAt(s-2)]<<12)+(n[t.charAt(s-1)]<<6)+n[t.charAt(s)];e.push((o&16711680)>>16,(o&65280)>>8,o&255)}if(i%4==3){const s=(n[t.charAt(i-3)]<<18)+(n[t.charAt(i-2)]<<12)+(n[t.charAt(i-1)]<<6);e.push((s&16711680)>>16,(s&65280)>>8)}else if(i%4==2){const s=(n[t.charAt(i-2)]<<18)+(n[t.charAt(i-1)]<<12);e.push((s&16711680)>>16)}return new Uint8Array(e)}}),h(Uint8Array.prototype,{toHex:function(){let t="";for(let e=0;e<this.length;e++)t+=(this[e]<16?"0":"")+this[e].toString(16);return t},toBase64:function(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let n=2;n<this.length;n+=3){const r=(this[n-2]<<16)+(this[n-1]<<8)+this[n];t+=e.charAt((r&16515072)>>18)+e.charAt((r&258048)>>12)+e.charAt((r&4032)>>6)+e.charAt(r&63)}if(this.length%3==2){const n=(this[this.length-2]<<16)+(this[this.length-1]<<8);t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+e.charAt((n&4032)>>6)+"="}else if(this.length%3==1){const n=this[this.length-1]<<16;t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+"=="}return t}})),h(Uint8Array,{...p()}),h(Uint8Array.prototype,{bytes2string:function(){return new TextDecoder().decode(this)},bytes2hex:function(){return this.toHex()},base64encode:function(){return this.toBase64()},toArray:function(){return new Array(...this)}});let D=0,x=0,F=0;h(Math,{randstr:function(t=16,e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/"){if(t<e)throw new Error("randstr: len < slen");const i=[];for(let s=0;s<t;s++)i.push(n.charAt(Math.random()*n.length|0));for(let s=new Set,o=0,c=0;c<e;c++){do o=Math.random()*t|0;while(s.has(o));s.set(o,!0),i[o]=r.charAt(Math.random()*r.length|0)}return i.join("")},randint:function(t=0,e=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(e-t)+t)},incrid:function(){return++D},incrstr:function(){return""+Math.incrid()},uniqid:function(t=Date.now()){return t===F?t*2048+ ++x%2048:(F=t)*2048+(x=0)%2048},uniqstr:function(){return""+Math.uniqid()},sleep:function(t){return new Promise(e=>setTimeout(e,t))},useTemplate:function(t){let e=null;const n={setup(i,{slots:s}){return e=s.default,()=>{}},name:t+"Template"},r={setup(i,{attrs:s}){return()=>e?.(s)},name:t};return{[n.name]:n,[r.name]:r}}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esexts",
3
- "version": "1.5.7",
3
+ "version": "2.0.1",
4
4
  "description": "esexts",
5
5
  "author": "dotcoo <dotcoo@163.com> (http://blog.dotcoo.com)",
6
6
  "homepage": "https://github.com/dotcoo/esexts#readme",