@ztimson/utils 0.20.6 → 0.20.8

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/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
- var st = Object.defineProperty;
2
- var it = (n, t, e) => t in n ? st(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var c = (n, t, e) => it(n, typeof t != "symbol" ? t + "" : t, e);
4
- function ot(n, t = !1) {
1
+ var it = Object.defineProperty;
2
+ var ot = (n, t, e) => t in n ? it(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var c = (n, t, e) => ot(n, typeof t != "symbol" ? t + "" : t, e);
4
+ function ct(n, t = !1) {
5
5
  if (n == null) throw new Error("Cannot clean a NULL value");
6
6
  return Array.isArray(n) ? n = n.filter((e) => e != null) : Object.entries(n).forEach(([e, r]) => {
7
7
  (t && r === void 0 || !t && r == null) && delete n[e];
8
8
  }), n;
9
9
  }
10
- function xt(n) {
10
+ function Bt(n) {
11
11
  return structuredClone(n);
12
12
  }
13
- function ct(n, ...t) {
13
+ function ut(n, ...t) {
14
14
  return t.forEach((e) => {
15
15
  for (const r in e)
16
- e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ct(n[r], e[r])) : n[r] = e[r];
16
+ e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ut(n[r], e[r])) : n[r] = e[r];
17
17
  }), n;
18
18
  }
19
19
  function B(n, t, e) {
@@ -26,21 +26,21 @@ function B(n, t, e) {
26
26
  return e !== void 0 && i == o.length - 1 ? r[s] = e : r[s];
27
27
  }, n);
28
28
  }
29
- function Bt(n) {
29
+ function At(n) {
30
30
  return Object.entries(n).map(
31
31
  ([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
32
32
  ).join("&");
33
33
  }
34
- function H(n, t, e = {}) {
34
+ function K(n, t, e = {}) {
35
35
  if (typeof n == "object" && !Array.isArray(n)) {
36
36
  for (const r of Object.keys(n)) {
37
37
  const s = t ? t + "." + r : r;
38
- typeof n[r] == "object" ? H(n[r], s, e) : e[s] = n[r];
38
+ typeof n[r] == "object" ? K(n[r], s, e) : e[s] = n[r];
39
39
  }
40
40
  return e;
41
41
  }
42
42
  }
43
- function At(n) {
43
+ function Rt(n) {
44
44
  const t = new FormData();
45
45
  return Object.entries(n).forEach(([e, r]) => t.append(e, r)), t;
46
46
  }
@@ -54,7 +54,7 @@ function O(n, t) {
54
54
  const e = typeof n, r = typeof t;
55
55
  return e != "object" || n == null || r != "object" || t == null ? e == "function" && r == "function" ? n.toString() == t.toString() : n === t : Object.keys(n).length != Object.keys(t).length ? !1 : Object.keys(n).every((i) => O(n[i], t[i]));
56
56
  }
57
- function Rt(n, t) {
57
+ function Ot(n, t) {
58
58
  t.forEach((e) => {
59
59
  Object.getOwnPropertyNames(e.prototype).forEach((r) => {
60
60
  Object.defineProperty(
@@ -72,7 +72,7 @@ function I(n) {
72
72
  return n;
73
73
  }
74
74
  }
75
- function Ot(n, t) {
75
+ function $t(n, t) {
76
76
  let e = [];
77
77
  return JSON.stringify(n, (r, s) => {
78
78
  if (typeof s == "object" && s !== null) {
@@ -82,34 +82,34 @@ function Ot(n, t) {
82
82
  return s;
83
83
  }, t);
84
84
  }
85
- function $t(n, t) {
85
+ function Ct(n, t) {
86
86
  return n.indexOf(t) === -1 && n.push(t), n;
87
87
  }
88
- function Ct(n, t) {
89
- return at([
88
+ function Lt(n, t) {
89
+ return lt([
90
90
  ...n.filter((e) => !t.includes((r) => O(e, r))),
91
91
  ...t.filter((e) => !n.includes((r) => O(e, r)))
92
92
  ]);
93
93
  }
94
- function Lt(n) {
94
+ function Nt(n) {
95
95
  return function(t, e) {
96
96
  const r = B(t, n), s = B(e, n);
97
97
  return typeof r != "string" || typeof s != "string" ? 1 : r.toLowerCase().localeCompare(s.toLowerCase());
98
98
  };
99
99
  }
100
- function Nt(n, t) {
100
+ function jt(n, t) {
101
101
  return (e) => O(B(e, n), t);
102
102
  }
103
- function ut(n, t = []) {
104
- return n.forEach((e) => Array.isArray(e) ? ut(e, t) : t.push(e)), t;
103
+ function at(n, t = []) {
104
+ return n.forEach((e) => Array.isArray(e) ? at(e, t) : t.push(e)), t;
105
105
  }
106
- function jt(n, t = !1) {
106
+ function Tt(n, t = !1) {
107
107
  return function(e, r) {
108
108
  const s = B(e, n), i = B(r, n);
109
109
  return typeof s == "number" && typeof i == "number" ? (t ? -1 : 1) * (s - i) : s > i ? t ? -1 : 1 : s < i ? t ? 1 : -1 : 0;
110
110
  };
111
111
  }
112
- function at(n) {
112
+ function lt(n) {
113
113
  for (let t = n.length - 1; t >= 0; t--)
114
114
  n.slice(0, t).find((e) => O(e, n[t])) && n.splice(t, 1);
115
115
  return n;
@@ -211,7 +211,7 @@ class S extends Array {
211
211
  return new S([...this, ...t]);
212
212
  }
213
213
  }
214
- class Tt {
214
+ class It {
215
215
  /**
216
216
  * Create new cache
217
217
  *
@@ -228,7 +228,7 @@ class Tt {
228
228
  * @return {T[]} Array of items
229
229
  */
230
230
  c(this, "values", this.all());
231
- if (this.key = t, this.options = e, e.storageKey && !e.storage && window && (window != null && window.localStorage) && (e.storage = window.localStorage), e.storageKey && e.storage) {
231
+ if (this.key = t, this.options = e, e.storageKey && !e.storage && typeof Storage < "u" && (e.storage = localStorage), e.storageKey && e.storage) {
232
232
  const r = e.storage.getItem(e.storageKey);
233
233
  if (r)
234
234
  try {
@@ -333,8 +333,8 @@ class Tt {
333
333
  }, r * 1e3), this;
334
334
  }
335
335
  }
336
- function It(n, t = !0) {
337
- const e = n.reduce((r, s) => (Object.keys(t ? H(s) : s).forEach((i) => {
336
+ function Dt(n, t = !0) {
337
+ const e = n.reduce((r, s) => (Object.keys(t ? K(s) : s).forEach((i) => {
338
338
  r.includes(i) || r.push(i);
339
339
  }), r), []);
340
340
  return [
@@ -346,7 +346,7 @@ function It(n, t = !0) {
346
346
  ].join(`
347
347
  `);
348
348
  }
349
- class x extends Promise {
349
+ class b extends Promise {
350
350
  constructor(e) {
351
351
  super((r, s) => e(
352
352
  (i) => r(i),
@@ -363,10 +363,10 @@ class x extends Promise {
363
363
  e != this._progress && (this._progress = e, this.listeners.forEach((r) => r(e)));
364
364
  }
365
365
  static from(e) {
366
- return e instanceof x ? e : new x((r, s) => e.then((...i) => r(...i)).catch((...i) => s(...i)));
366
+ return e instanceof b ? e : new b((r, s) => e.then((...i) => r(...i)).catch((...i) => s(...i)));
367
367
  }
368
368
  from(e) {
369
- const r = x.from(e);
369
+ const r = b.from(e);
370
370
  return this.onProgress((s) => r.progress = s), r;
371
371
  }
372
372
  onProgress(e) {
@@ -383,16 +383,16 @@ class x extends Promise {
383
383
  return this.from(super.finally(e));
384
384
  }
385
385
  }
386
- function Dt(n, t) {
386
+ function Mt(n, t) {
387
387
  n instanceof Blob || (n = new Blob(m(n)));
388
388
  const e = URL.createObjectURL(n);
389
- lt(e, t), URL.revokeObjectURL(e);
389
+ ft(e, t), URL.revokeObjectURL(e);
390
390
  }
391
- function lt(n, t) {
391
+ function ft(n, t) {
392
392
  const e = document.createElement("a");
393
393
  e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
394
394
  }
395
- function Mt(n = {}) {
395
+ function kt(n = {}) {
396
396
  return new Promise((t) => {
397
397
  const e = document.createElement("input");
398
398
  e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
@@ -400,18 +400,18 @@ function Mt(n = {}) {
400
400
  }, document.body.appendChild(e), e.click();
401
401
  });
402
402
  }
403
- function kt(n, t = /* @__PURE__ */ new Date()) {
403
+ function Pt(n, t = /* @__PURE__ */ new Date()) {
404
404
  (typeof t == "number" || typeof t == "string") && (t = new Date(t));
405
405
  const e = `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}_${t.getHours().toString().padStart(2, "0")}-${t.getMinutes().toString().padStart(2, "0")}-${t.getSeconds().toString().padStart(2, "0")}`;
406
406
  return n ? n.replace("{{TIMESTAMP}}", e) : e;
407
407
  }
408
- function Pt(n) {
409
- return new x((t, e, r) => {
408
+ function Gt(n) {
409
+ return new b((t, e, r) => {
410
410
  const s = new XMLHttpRequest(), i = new FormData();
411
411
  n.files.forEach((o) => i.append("file", o)), s.withCredentials = !!n.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? r(o.loaded / o.total) : null), s.addEventListener("loadend", () => t(I(s.responseText))), s.addEventListener("error", () => e(I(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", n.url), Object.entries(n.headers || {}).forEach(([o, a]) => s.setRequestHeader(o, a)), s.send(i);
412
412
  });
413
413
  }
414
- class K {
414
+ class W {
415
415
  constructor() {
416
416
  c(this, "listeners", {});
417
417
  }
@@ -452,8 +452,8 @@ class K {
452
452
  });
453
453
  }
454
454
  }
455
- c(K, "listeners", {});
456
- class y extends Error {
455
+ c(W, "listeners", {});
456
+ class g extends Error {
457
457
  constructor(e, r) {
458
458
  super(e);
459
459
  c(this, "_code");
@@ -480,8 +480,8 @@ class y extends Error {
480
480
  return this.message || super.toString();
481
481
  }
482
482
  }
483
- c(y, "code", 500);
484
- class W extends y {
483
+ c(g, "code", 500);
484
+ class v extends g {
485
485
  constructor(t = "Bad Request") {
486
486
  super(t);
487
487
  }
@@ -489,8 +489,8 @@ class W extends y {
489
489
  return t.constructor.code == this.code;
490
490
  }
491
491
  }
492
- c(W, "code", 400);
493
- class v extends y {
492
+ c(v, "code", 400);
493
+ class J extends g {
494
494
  constructor(t = "Unauthorized") {
495
495
  super(t);
496
496
  }
@@ -498,8 +498,8 @@ class v extends y {
498
498
  return t.constructor.code == this.code;
499
499
  }
500
500
  }
501
- c(v, "code", 401);
502
- class J extends y {
501
+ c(J, "code", 401);
502
+ class z extends g {
503
503
  constructor(t = "Payment Required") {
504
504
  super(t);
505
505
  }
@@ -507,8 +507,8 @@ class J extends y {
507
507
  return t.constructor.code == this.code;
508
508
  }
509
509
  }
510
- c(J, "code", 402);
511
- class z extends y {
510
+ c(z, "code", 402);
511
+ class Z extends g {
512
512
  constructor(t = "Forbidden") {
513
513
  super(t);
514
514
  }
@@ -516,8 +516,8 @@ class z extends y {
516
516
  return t.constructor.code == this.code;
517
517
  }
518
518
  }
519
- c(z, "code", 403);
520
- class Z extends y {
519
+ c(Z, "code", 403);
520
+ class V extends g {
521
521
  constructor(t = "Not Found") {
522
522
  super(t);
523
523
  }
@@ -525,8 +525,8 @@ class Z extends y {
525
525
  return t.constructor.code == this.code;
526
526
  }
527
527
  }
528
- c(Z, "code", 404);
529
- class V extends y {
528
+ c(V, "code", 404);
529
+ class X extends g {
530
530
  constructor(t = "Method Not Allowed") {
531
531
  super(t);
532
532
  }
@@ -534,8 +534,8 @@ class V extends y {
534
534
  return t.constructor.code == this.code;
535
535
  }
536
536
  }
537
- c(V, "code", 405);
538
- class X extends y {
537
+ c(X, "code", 405);
538
+ class Q extends g {
539
539
  constructor(t = "Not Acceptable") {
540
540
  super(t);
541
541
  }
@@ -543,8 +543,8 @@ class X extends y {
543
543
  return t.constructor.code == this.code;
544
544
  }
545
545
  }
546
- c(X, "code", 406);
547
- class Q extends y {
546
+ c(Q, "code", 406);
547
+ class _ extends g {
548
548
  constructor(t = "Internal Server Error") {
549
549
  super(t);
550
550
  }
@@ -552,8 +552,8 @@ class Q extends y {
552
552
  return t.constructor.code == this.code;
553
553
  }
554
554
  }
555
- c(Q, "code", 500);
556
- class _ extends y {
555
+ c(_, "code", 500);
556
+ class tt extends g {
557
557
  constructor(t = "Not Implemented") {
558
558
  super(t);
559
559
  }
@@ -561,8 +561,8 @@ class _ extends y {
561
561
  return t.constructor.code == this.code;
562
562
  }
563
563
  }
564
- c(_, "code", 501);
565
- class tt extends y {
564
+ c(tt, "code", 501);
565
+ class et extends g {
566
566
  constructor(t = "Bad Gateway") {
567
567
  super(t);
568
568
  }
@@ -570,8 +570,8 @@ class tt extends y {
570
570
  return t.constructor.code == this.code;
571
571
  }
572
572
  }
573
- c(tt, "code", 502);
574
- class et extends y {
573
+ c(et, "code", 502);
574
+ class nt extends g {
575
575
  constructor(t = "Service Unavailable") {
576
576
  super(t);
577
577
  }
@@ -579,8 +579,8 @@ class et extends y {
579
579
  return t.constructor.code == this.code;
580
580
  }
581
581
  }
582
- c(et, "code", 503);
583
- class nt extends y {
582
+ c(nt, "code", 503);
583
+ class rt extends g {
584
584
  constructor(t = "Gateway Timeout") {
585
585
  super(t);
586
586
  }
@@ -588,36 +588,36 @@ class nt extends y {
588
588
  return t.constructor.code == this.code;
589
589
  }
590
590
  }
591
- c(nt, "code", 504);
592
- function Gt(n, t) {
591
+ c(rt, "code", 504);
592
+ function Ut(n, t) {
593
593
  if (n >= 200 && n < 300) return null;
594
594
  switch (n) {
595
595
  case 400:
596
- return new W(t);
597
- case 401:
598
596
  return new v(t);
599
- case 402:
597
+ case 401:
600
598
  return new J(t);
601
- case 403:
599
+ case 402:
602
600
  return new z(t);
603
- case 404:
601
+ case 403:
604
602
  return new Z(t);
605
- case 405:
603
+ case 404:
606
604
  return new V(t);
607
- case 406:
605
+ case 405:
608
606
  return new X(t);
609
- case 500:
607
+ case 406:
610
608
  return new Q(t);
611
- case 501:
609
+ case 500:
612
610
  return new _(t);
613
- case 502:
611
+ case 501:
614
612
  return new tt(t);
615
- case 503:
613
+ case 502:
616
614
  return new et(t);
617
- case 504:
615
+ case 503:
618
616
  return new nt(t);
617
+ case 504:
618
+ return new rt(t);
619
619
  default:
620
- return new y(t, n);
620
+ return new g(t, n);
621
621
  }
622
622
  }
623
623
  const E = class E {
@@ -647,13 +647,13 @@ const E = class E {
647
647
  const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
648
648
  e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
649
649
  }
650
- const r = ot({
650
+ const r = ct({
651
651
  "Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
652
652
  ...E.headers,
653
653
  ...this.headers,
654
654
  ...t.headers
655
655
  });
656
- return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
656
+ return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new b((i, o, a) => {
657
657
  try {
658
658
  fetch(e, {
659
659
  headers: r,
@@ -665,7 +665,7 @@ const E = class E {
665
665
  await new Promise((C) => l(u, () => C()));
666
666
  const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
667
667
  let P = 0;
668
- const T = (G = u.body) == null ? void 0 : G.getReader(), rt = new ReadableStream({
668
+ const T = (G = u.body) == null ? void 0 : G.getReader(), st = new ReadableStream({
669
669
  start(l) {
670
670
  function C() {
671
671
  T == null || T.read().then((A) => {
@@ -676,7 +676,7 @@ const E = class E {
676
676
  C();
677
677
  }
678
678
  });
679
- if (u.data = new Response(rt), t.decode == null || t.decode) {
679
+ if (u.data = new Response(st), t.decode == null || t.decode) {
680
680
  const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
681
681
  l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
682
682
  }
@@ -690,7 +690,7 @@ const E = class E {
690
690
  };
691
691
  c(E, "interceptors", {}), c(E, "headers", {});
692
692
  let F = E;
693
- function Ut(n) {
693
+ function qt(n) {
694
694
  const t = n.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
695
695
  return I(decodeURIComponent(atob(t).split("").map(function(e) {
696
696
  return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
@@ -721,7 +721,7 @@ const R = {
721
721
  LIGHT_MAGENTA: "\x1B[95m",
722
722
  LIGHT_CYAN: "\x1B[96m",
723
723
  WHITE: "\x1B[97m"
724
- }, qt = {
724
+ }, Ft = {
725
725
  BLACK: "\x1B[40m",
726
726
  RED: "\x1B[41m",
727
727
  GREEN: "\x1B[42m",
@@ -732,8 +732,8 @@ const R = {
732
732
  WHITE: "\x1B[47m",
733
733
  GREY: "\x1B[100m"
734
734
  };
735
- var ft = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(ft || {});
736
- const w = class w extends K {
735
+ var ht = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(ht || {});
736
+ const w = class w extends W {
737
737
  constructor(t) {
738
738
  super(), this.namespace = t;
739
739
  }
@@ -775,7 +775,7 @@ const w = class w extends K {
775
775
  };
776
776
  c(w, "LOG_LEVEL", 4);
777
777
  let Y = w;
778
- function Ft(n) {
778
+ function Yt(n) {
779
779
  const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = n.toString().length - 2;
780
780
  let r = Math.pow(10, e), s = n * r;
781
781
  const i = t(s, r);
@@ -783,38 +783,38 @@ function Ft(n) {
783
783
  const o = ~~(s / r);
784
784
  return s -= o * r, `${o ? o + " " : ""}${~~s}/${~~r}`;
785
785
  }
786
- function Yt(n) {
786
+ function Ht(n) {
787
787
  let t = n.split(" ");
788
788
  const e = t.length == 2 ? Number(t[0]) : 0;
789
789
  return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
790
790
  }
791
- const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = D + M + k;
792
- function Ht(n, t = 2) {
791
+ const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", dt = D + M + k;
792
+ function Kt(n, t = 2) {
793
793
  if (n === 0) return "0 Bytes";
794
794
  const e = 1024, r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(n) / Math.log(e));
795
795
  return parseFloat((n / Math.pow(e, s)).toFixed(t)) + " " + r[s];
796
796
  }
797
- function Kt(n) {
797
+ function Wt(n) {
798
798
  const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
799
799
  if (!t) throw new Error(`Number cannot be parsed: ${n}`);
800
800
  return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
801
801
  }
802
- function Wt(n, t, e) {
802
+ function vt(n, t, e) {
803
803
  return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
804
804
  }
805
- function vt(n, t, e = " ", r = !0) {
805
+ function Jt(n, t, e = " ", r = !0) {
806
806
  return r ? n.toString().padStart(t, e) : n.toString().padEnd(t, e);
807
807
  }
808
- function Jt(n) {
808
+ function zt(n) {
809
809
  return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
810
810
  }
811
- function zt(n, t = ht) {
811
+ function Zt(n, t = dt) {
812
812
  return Array(n).fill(null).map(() => {
813
813
  const e = ~~(Math.random() * t.length);
814
814
  return t[e];
815
815
  }).join("");
816
816
  }
817
- function Zt(n, t = !1, e = !1, r = !1) {
817
+ function Vt(n, t = !1, e = !1, r = !1) {
818
818
  if (!t && !e && !r) throw new Error("Must enable at least one: letters, numbers, symbols");
819
819
  return Array(n).fill(null).map(() => {
820
820
  let s;
@@ -825,7 +825,7 @@ function Zt(n, t = !1, e = !1, r = !1) {
825
825
  return s;
826
826
  }).join("");
827
827
  }
828
- function Vt(n, t) {
828
+ function Xt(n, t) {
829
829
  if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
830
830
  throw new TypeError("Regular expression must be global.");
831
831
  let e = [], r;
@@ -833,7 +833,7 @@ function Vt(n, t) {
833
833
  e.push(r);
834
834
  return e;
835
835
  }
836
- function Xt(n) {
836
+ function Qt(n) {
837
837
  const t = new RegExp(
838
838
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
839
839
  "gm"
@@ -847,11 +847,11 @@ function Xt(n) {
847
847
  }
848
848
  return e;
849
849
  }
850
- function dt(n) {
851
- var t = pt(yt(wt(gt(n), 8 * n.length)));
850
+ function pt(n) {
851
+ var t = yt(wt(Et(gt(n), 8 * n.length)));
852
852
  return t.toLowerCase();
853
853
  }
854
- function pt(n) {
854
+ function yt(n) {
855
855
  for (var t, e = "0123456789ABCDEF", r = "", s = 0; s < n.length; s++) t = n.charCodeAt(s), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
856
856
  return r;
857
857
  }
@@ -860,20 +860,20 @@ function gt(n) {
860
860
  for (e = 0; e < 8 * n.length; e += 8) t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32;
861
861
  return t;
862
862
  }
863
- function yt(n) {
863
+ function wt(n) {
864
864
  for (var t = "", e = 0; e < 32 * n.length; e += 8) t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255);
865
865
  return t;
866
866
  }
867
- function wt(n, t) {
867
+ function Et(n, t) {
868
868
  n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
869
869
  for (var e = 1732584193, r = -271733879, s = -1732584194, i = 271733878, o = 0; o < n.length; o += 16) {
870
870
  var a = e, u = r, $ = s, j = i;
871
- r = p(r = p(r = p(r = p(r = d(r = d(r = d(r = d(r = h(r = h(r = h(r = h(r = f(r = f(r = f(r = f(r, s = f(s, i = f(i, e = f(e, r, s, i, n[o + 0], 7, -680876936), r, s, n[o + 1], 12, -389564586), e, r, n[o + 2], 17, 606105819), i, e, n[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 4], 7, -176418897), r, s, n[o + 5], 12, 1200080426), e, r, n[o + 6], 17, -1473231341), i, e, n[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 8], 7, 1770035416), r, s, n[o + 9], 12, -1958414417), e, r, n[o + 10], 17, -42063), i, e, n[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 12], 7, 1804603682), r, s, n[o + 13], 12, -40341101), e, r, n[o + 14], 17, -1502002290), i, e, n[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 1], 5, -165796510), r, s, n[o + 6], 9, -1069501632), e, r, n[o + 11], 14, 643717713), i, e, n[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 5], 5, -701558691), r, s, n[o + 10], 9, 38016083), e, r, n[o + 15], 14, -660478335), i, e, n[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 9], 5, 568446438), r, s, n[o + 14], 9, -1019803690), e, r, n[o + 3], 14, -187363961), i, e, n[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 13], 5, -1444681467), r, s, n[o + 2], 9, -51403784), e, r, n[o + 7], 14, 1735328473), i, e, n[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 5], 4, -378558), r, s, n[o + 8], 11, -2022574463), e, r, n[o + 11], 16, 1839030562), i, e, n[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 1], 4, -1530992060), r, s, n[o + 4], 11, 1272893353), e, r, n[o + 7], 16, -155497632), i, e, n[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 13], 4, 681279174), r, s, n[o + 0], 11, -358537222), e, r, n[o + 3], 16, -722521979), i, e, n[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 9], 4, -640364487), r, s, n[o + 12], 11, -421815835), e, r, n[o + 15], 16, 530742520), i, e, n[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 0], 6, -198630844), r, s, n[o + 7], 10, 1126891415), e, r, n[o + 14], 15, -1416354905), i, e, n[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 12], 6, 1700485571), r, s, n[o + 3], 10, -1894986606), e, r, n[o + 10], 15, -1051523), i, e, n[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 8], 6, 1873313359), r, s, n[o + 15], 10, -30611744), e, r, n[o + 6], 15, -1560198380), i, e, n[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 4], 6, -145523070), r, s, n[o + 11], 10, -1120210379), e, r, n[o + 2], 15, 718787259), i, e, n[o + 9], 21, -343485551), e = b(e, a), r = b(r, u), s = b(s, $), i = b(i, j);
871
+ r = p(r = p(r = p(r = p(r = d(r = d(r = d(r = d(r = h(r = h(r = h(r = h(r = f(r = f(r = f(r = f(r, s = f(s, i = f(i, e = f(e, r, s, i, n[o + 0], 7, -680876936), r, s, n[o + 1], 12, -389564586), e, r, n[o + 2], 17, 606105819), i, e, n[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 4], 7, -176418897), r, s, n[o + 5], 12, 1200080426), e, r, n[o + 6], 17, -1473231341), i, e, n[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 8], 7, 1770035416), r, s, n[o + 9], 12, -1958414417), e, r, n[o + 10], 17, -42063), i, e, n[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 12], 7, 1804603682), r, s, n[o + 13], 12, -40341101), e, r, n[o + 14], 17, -1502002290), i, e, n[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 1], 5, -165796510), r, s, n[o + 6], 9, -1069501632), e, r, n[o + 11], 14, 643717713), i, e, n[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 5], 5, -701558691), r, s, n[o + 10], 9, 38016083), e, r, n[o + 15], 14, -660478335), i, e, n[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 9], 5, 568446438), r, s, n[o + 14], 9, -1019803690), e, r, n[o + 3], 14, -187363961), i, e, n[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 13], 5, -1444681467), r, s, n[o + 2], 9, -51403784), e, r, n[o + 7], 14, 1735328473), i, e, n[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 5], 4, -378558), r, s, n[o + 8], 11, -2022574463), e, r, n[o + 11], 16, 1839030562), i, e, n[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 1], 4, -1530992060), r, s, n[o + 4], 11, 1272893353), e, r, n[o + 7], 16, -155497632), i, e, n[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 13], 4, 681279174), r, s, n[o + 0], 11, -358537222), e, r, n[o + 3], 16, -722521979), i, e, n[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 9], 4, -640364487), r, s, n[o + 12], 11, -421815835), e, r, n[o + 15], 16, 530742520), i, e, n[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 0], 6, -198630844), r, s, n[o + 7], 10, 1126891415), e, r, n[o + 14], 15, -1416354905), i, e, n[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 12], 6, 1700485571), r, s, n[o + 3], 10, -1894986606), e, r, n[o + 10], 15, -1051523), i, e, n[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 8], 6, 1873313359), r, s, n[o + 15], 10, -30611744), e, r, n[o + 6], 15, -1560198380), i, e, n[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 4], 6, -145523070), r, s, n[o + 11], 10, -1120210379), e, r, n[o + 2], 15, 718787259), i, e, n[o + 9], 21, -343485551), e = x(e, a), r = x(r, u), s = x(s, $), i = x(i, j);
872
872
  }
873
873
  return Array(e, r, s, i);
874
874
  }
875
875
  function N(n, t, e, r, s, i) {
876
- return b(Et(b(b(t, n), b(r, i)), s), e);
876
+ return x(mt(x(x(t, n), x(r, i)), s), e);
877
877
  }
878
878
  function f(n, t, e, r, s, i, o) {
879
879
  return N(t & e | ~t & r, n, t, s, i, o);
@@ -887,36 +887,38 @@ function d(n, t, e, r, s, i, o) {
887
887
  function p(n, t, e, r, s, i, o) {
888
888
  return N(e ^ (t | ~r), n, t, s, i, o);
889
889
  }
890
- function b(n, t) {
890
+ function x(n, t) {
891
891
  var e = (65535 & n) + (65535 & t);
892
892
  return (n >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
893
893
  }
894
- function Et(n, t) {
894
+ function mt(n, t) {
895
895
  return n << t | n >>> 32 - t;
896
896
  }
897
- function Qt(n) {
897
+ function _t(n) {
898
898
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
899
899
  }
900
- function _t(n, t = "mp") {
901
- return n ? `https://www.gravatar.com/avatar/${dt(n)}?d=${t}` : "";
900
+ function te(n, t = "mp") {
901
+ return n ? `https://www.gravatar.com/avatar/${pt(n)}?d=${t}` : "";
902
902
  }
903
- function te(n) {
903
+ function ee(n) {
904
904
  return n.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
905
905
  }
906
- function ee(n, ...t) {
906
+ function ne(n, ...t) {
907
907
  const e = [];
908
908
  for (let r = 0; r < n.length || r < t.length; r++)
909
909
  n[r] && e.push(n[r]), t[r] && e.push(t[r]);
910
- return new g(e.join(""));
910
+ return new y(e.join(""));
911
911
  }
912
- function mt(n, ...t) {
912
+ function St(n, ...t) {
913
913
  let e = [];
914
914
  for (let i = 0; i < n.length || i < t.length; i++)
915
915
  n[i] && e.push(n[i]), t[i] && e.push(t[i]);
916
916
  const [r, s] = e.join("").split(":");
917
- return g.toString(r, s == null ? void 0 : s.split(""));
917
+ return y.toString(r, s == null ? void 0 : s.split(""));
918
918
  }
919
- class g {
919
+ class H extends Error {
920
+ }
921
+ class y {
920
922
  constructor(t) {
921
923
  /** First directory in path */
922
924
  c(this, "module");
@@ -956,11 +958,11 @@ class g {
956
958
  */
957
959
  static combine(t) {
958
960
  let e = !1;
959
- const r = t.map((s) => new g(s)).toSorted((s, i) => {
961
+ const r = t.map((s) => new y(s)).toSorted((s, i) => {
960
962
  const o = s.fullPath.length, a = i.fullPath.length;
961
963
  return o < a ? 1 : o > a ? -1 : 0;
962
964
  }).reduce((s, i) => (i.none && (e = !0), s ? (e || (i.all && (s.all = !0), (i.all || i.create) && (s.create = !0), (i.all || i.read) && (s.read = !0), (i.all || i.update) && (s.update = !0), (i.all || i.delete) && (s.delete = !0), s.methods = [...s.methods, ...i.methods]), s) : i), null);
963
- return r.all && (r.methods = ["*"]), r.none && (r.methods = ["n"]), r.methods = new S(r.methods), r.raw = mt`${r.fullPath}:${r.methods}`, r;
965
+ return r.all && (r.methods = ["*"]), r.none && (r.methods = ["n"]), r.methods = new S(r.methods), r.raw = St`${r.fullPath}:${r.methods}`, r;
964
966
  }
965
967
  /**
966
968
  * Squash 2 sets of paths & return true if any overlap is found
@@ -970,12 +972,12 @@ class g {
970
972
  * @return {boolean} Whether there is any overlap
971
973
  */
972
974
  static has(t, ...e) {
973
- const r = m(e).map((i) => new g(i)), s = m(t).map((i) => new g(i));
975
+ const r = m(e).map((i) => new y(i)), s = m(t).map((i) => new y(i));
974
976
  return !!r.find((i) => {
975
977
  if (!i.fullPath && i.all) return !0;
976
978
  const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
977
979
  if (!o.length) return !1;
978
- const a = g.combine(o);
980
+ const a = y.combine(o);
979
981
  return !a.none && (a.all || new S(a.methods).intersection(new S(i.methods)).length);
980
982
  });
981
983
  }
@@ -987,7 +989,7 @@ class g {
987
989
  * @return {boolean} Whether there is any overlap
988
990
  */
989
991
  static hasAll(t, ...e) {
990
- return e.filter((r) => g.has(t, r)).length == e.length;
992
+ return e.filter((r) => y.has(t, r)).length == e.length;
991
993
  }
992
994
  /**
993
995
  * Same as `has` but raises an error if there is no overlap
@@ -996,7 +998,7 @@ class g {
996
998
  * @param has Target must have at least one of these path
997
999
  */
998
1000
  static hasFatal(t, ...e) {
999
- if (!g.has(t, ...e)) throw new Error(`Requires one of: ${m(e).join(", ")}`);
1001
+ if (!y.has(t, ...e)) throw new H(`Requires one of: ${m(e).join(", ")}`);
1000
1002
  }
1001
1003
  /**
1002
1004
  * Same as `hasAll` but raises an error if the target is missing any paths
@@ -1005,7 +1007,7 @@ class g {
1005
1007
  * @param has Target must have all these paths
1006
1008
  */
1007
1009
  static hasAllFatal(t, ...e) {
1008
- if (!g.hasAll(t, ...e)) throw new Error(`Requires all: ${m(e).join(", ")}`);
1010
+ if (!y.hasAll(t, ...e)) throw new H(`Requires all: ${m(e).join(", ")}`);
1009
1011
  }
1010
1012
  /**
1011
1013
  * Create event string from its components
@@ -1024,22 +1026,22 @@ class g {
1024
1026
  * @return {string} String representation of Event
1025
1027
  */
1026
1028
  toString() {
1027
- return g.toString(this.fullPath, this.methods);
1029
+ return y.toString(this.fullPath, this.methods);
1028
1030
  }
1029
1031
  }
1030
- class ne {
1032
+ class re {
1031
1033
  constructor() {
1032
1034
  c(this, "listeners", []);
1033
1035
  }
1034
1036
  emit(t, ...e) {
1035
- const r = new g(t);
1036
- this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](r, ...e));
1037
+ const r = new y(t);
1038
+ this.listeners.filter((s) => y.has(s[0], t)).forEach(async (s) => s[1](r, ...e));
1037
1039
  }
1038
1040
  off(t) {
1039
1041
  this.listeners = this.listeners.filter((e) => e[1] != t);
1040
1042
  }
1041
1043
  on(t, e) {
1042
- return m(t).forEach((r) => this.listeners.push([new g(r), e])), () => this.off(e);
1044
+ return m(t).forEach((r) => this.listeners.push([new y(r), e])), () => this.off(e);
1043
1045
  }
1044
1046
  once(t, e) {
1045
1047
  return new Promise((r) => {
@@ -1052,98 +1054,99 @@ class ne {
1052
1054
  t.on("*", (e, ...r) => this.emit(e, ...r));
1053
1055
  }
1054
1056
  }
1055
- function re(n) {
1057
+ function se(n) {
1056
1058
  (typeof n == "number" || typeof n == "string") && (n = new Date(n));
1057
1059
  let t = n.getHours(), e = "AM";
1058
1060
  return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${n.getFullYear()}-${(n.getMonth() + 1).toString().padStart(2, "0")}-${n.getDate().toString().padStart(2, "0")}, ${t}:${n.getMinutes().toString().padStart(2, "0")} ${e}`;
1059
1061
  }
1060
- function St(n) {
1062
+ function xt(n) {
1061
1063
  return new Promise((t) => setTimeout(t, n));
1062
1064
  }
1063
- async function se(n, t = 100) {
1064
- for (; await n(); ) await St(t);
1065
+ async function ie(n, t = 100) {
1066
+ for (; await n(); ) await xt(t);
1065
1067
  }
1066
- function ie(n) {
1068
+ function oe(n) {
1067
1069
  return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
1068
1070
  }
1069
- function oe() {
1071
+ function ce() {
1070
1072
  return Object.keys({});
1071
1073
  }
1072
1074
  export {
1073
1075
  S as ASet,
1074
- tt as BadGatewayError,
1075
- W as BadRequestError,
1076
- Tt as Cache,
1077
- qt as CliBackground,
1076
+ et as BadGatewayError,
1077
+ v as BadRequestError,
1078
+ It as Cache,
1079
+ Ft as CliBackground,
1078
1080
  R as CliEffects,
1079
1081
  L as CliForeground,
1080
- y as CustomError,
1081
- z as ForbiddenError,
1082
- nt as GatewayTimeoutError,
1082
+ g as CustomError,
1083
+ Z as ForbiddenError,
1084
+ rt as GatewayTimeoutError,
1083
1085
  F as Http,
1084
- Q as InternalServerError,
1086
+ _ as InternalServerError,
1085
1087
  I as JSONAttemptParse,
1086
- Ot as JSONSanitize,
1087
- ft as LOG_LEVEL,
1088
+ $t as JSONSanitize,
1089
+ ht as LOG_LEVEL,
1088
1090
  Y as Logger,
1089
- V as MethodNotAllowedError,
1090
- X as NotAcceptableError,
1091
- Z as NotFoundError,
1092
- _ as NotImplementedError,
1093
- ee as PE,
1094
- mt as PES,
1095
- g as PathEvent,
1096
- ne as PathEventEmitter,
1097
- J as PaymentRequiredError,
1098
- x as PromiseProgress,
1099
- et as ServiceUnavailableError,
1100
- K as TypedEmitter,
1101
- v as UnauthorizedError,
1102
- $t as addUnique,
1103
- Ct as arrayDiff,
1104
- Lt as caseInsensitiveSort,
1105
- ot as clean,
1106
- It as csv,
1107
- Ft as dec2Frac,
1108
- xt as deepCopy,
1109
- ct as deepMerge,
1091
+ X as MethodNotAllowedError,
1092
+ Q as NotAcceptableError,
1093
+ V as NotFoundError,
1094
+ tt as NotImplementedError,
1095
+ ne as PE,
1096
+ St as PES,
1097
+ H as PathError,
1098
+ y as PathEvent,
1099
+ re as PathEventEmitter,
1100
+ z as PaymentRequiredError,
1101
+ b as PromiseProgress,
1102
+ nt as ServiceUnavailableError,
1103
+ W as TypedEmitter,
1104
+ J as UnauthorizedError,
1105
+ Ct as addUnique,
1106
+ Lt as arrayDiff,
1107
+ Nt as caseInsensitiveSort,
1108
+ ct as clean,
1109
+ Dt as csv,
1110
+ Yt as dec2Frac,
1111
+ Bt as deepCopy,
1112
+ ut as deepMerge,
1110
1113
  B as dotNotation,
1111
- Dt as downloadFile,
1112
- lt as downloadUrl,
1113
- Bt as encodeQuery,
1114
- Gt as errorFromCode,
1115
- te as escapeRegex,
1116
- Mt as fileBrowser,
1117
- Nt as findByProp,
1118
- ut as flattenArr,
1119
- H as flattenObj,
1120
- At as formData,
1121
- Ht as formatBytes,
1122
- re as formatDate,
1123
- Kt as formatPhoneNumber,
1124
- Yt as fracToDec,
1125
- _t as gravatar,
1114
+ Mt as downloadFile,
1115
+ ft as downloadUrl,
1116
+ At as encodeQuery,
1117
+ Ut as errorFromCode,
1118
+ ee as escapeRegex,
1119
+ kt as fileBrowser,
1120
+ jt as findByProp,
1121
+ at as flattenArr,
1122
+ K as flattenObj,
1123
+ Rt as formData,
1124
+ Kt as formatBytes,
1125
+ se as formatDate,
1126
+ Wt as formatPhoneNumber,
1127
+ Ht as fracToDec,
1128
+ te as gravatar,
1126
1129
  q as includes,
1127
- Wt as insertAt,
1130
+ vt as insertAt,
1128
1131
  O as isEqual,
1129
- Ut as jwtDecode,
1132
+ qt as jwtDecode,
1130
1133
  m as makeArray,
1131
- at as makeUnique,
1132
- Vt as matchAll,
1133
- dt as md5,
1134
- Rt as mixin,
1135
- vt as pad,
1136
- Xt as parseUrl,
1137
- Jt as randomHex,
1138
- zt as randomString,
1139
- Zt as randomStringBuilder,
1140
- St as sleep,
1141
- se as sleepWhile,
1142
- jt as sortByProp,
1143
- ie as timeUntil,
1144
- kt as timestampFilename,
1145
- oe as tyoeKeys,
1146
- Pt as uploadWithProgress,
1147
- Qt as validateEmail
1134
+ lt as makeUnique,
1135
+ Xt as matchAll,
1136
+ pt as md5,
1137
+ Ot as mixin,
1138
+ Jt as pad,
1139
+ Qt as parseUrl,
1140
+ zt as randomHex,
1141
+ Zt as randomString,
1142
+ Vt as randomStringBuilder,
1143
+ xt as sleep,
1144
+ ie as sleepWhile,
1145
+ Tt as sortByProp,
1146
+ oe as timeUntil,
1147
+ Pt as timestampFilename,
1148
+ ce as tyoeKeys,
1149
+ Gt as uploadWithProgress,
1150
+ _t as validateEmail
1148
1151
  };
1149
1152
  //# sourceMappingURL=index.mjs.map