@arkyn/shared 3.0.1-beta.71 → 3.0.1-beta.73

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/bundle.js CHANGED
@@ -1,23 +1,23 @@
1
- function R(n, _) {
2
- const s = (a) => a.toString().padStart(2, "0"), e = {
1
+ function L(n, s) {
2
+ const a = (e) => e.toString().padStart(2, "0"), _ = {
3
3
  YYYY: n.getFullYear().toString(),
4
4
  YY: n.getFullYear().toString().slice(-2),
5
- MM: s(n.getMonth() + 1),
6
- DD: s(n.getDate()),
7
- hh: s(n.getHours()),
8
- mm: s(n.getMinutes()),
9
- ss: s(n.getSeconds())
5
+ MM: a(n.getMonth() + 1),
6
+ DD: a(n.getDate()),
7
+ hh: a(n.getHours()),
8
+ mm: a(n.getMinutes()),
9
+ ss: a(n.getSeconds())
10
10
  };
11
- return _.replace(
11
+ return s.replace(
12
12
  /YYYY|YY|MM|DD|hh|mm|ss/g,
13
- (a) => e[a]
13
+ (e) => _[e]
14
14
  );
15
15
  }
16
- const sn = ([n, _ = "00:00:00"], s, e, a = 0) => {
17
- const t = n.split(/[-/]/).map(Number), c = _.split(".")[0].split(":").map(Number);
16
+ const dn = ([n, s = "00:00:00"], a, _, e = 0) => {
17
+ const t = n.split(/[-/]/).map(Number), c = s.split(".")[0].split(":").map(Number);
18
18
  let r, o, i;
19
- const [m = 0, d = 0, f = 0] = c;
20
- switch (s) {
19
+ const [m = 0, d = 0, k = 0] = c;
20
+ switch (a) {
21
21
  case "brazilianDate":
22
22
  [r, o, i] = t;
23
23
  break;
@@ -30,71 +30,71 @@ const sn = ([n, _ = "00:00:00"], s, e, a = 0) => {
30
30
  default:
31
31
  throw new Error("Invalid input format");
32
32
  }
33
- const u = new Date(i, o - 1, r, m, d, f);
33
+ const u = new Date(i, o - 1, r, m, d, k);
34
34
  if (isNaN(u.getTime())) throw new Error("Invalid date");
35
- return u.setUTCHours(u.getUTCHours() + a), R(u, e);
36
- }, h = (n, _) => {
37
- const s = " ".repeat(_);
38
- let e = "";
35
+ return u.setUTCHours(u.getUTCHours() + e), L(u, _);
36
+ }, h = (n, s) => {
37
+ const a = " ".repeat(s);
38
+ let _ = "";
39
39
  if (typeof n == "object" && n !== null)
40
40
  if (Array.isArray(n))
41
- n.length === 0 ? e += "[]" : (e += `[
42
- `, n.forEach((a, t) => {
43
- e += s + " " + h(a, _ + 1), t < n.length - 1 && (e += ","), e += `
41
+ n.length === 0 ? _ += "[]" : (_ += `[
42
+ `, n.forEach((e, t) => {
43
+ _ += a + " " + h(e, s + 1), t < n.length - 1 && (_ += ","), _ += `
44
44
  `;
45
- }), e += s + "]");
45
+ }), _ += a + "]");
46
46
  else {
47
- const a = Object.keys(n);
48
- a.length === 0 ? e += "{}" : (e += `{
49
- `, a.forEach((t, c) => {
50
- e += s + ' "' + t + '": ' + h(n[t], _ + 1), c < a.length - 1 && (e += ","), e += `
47
+ const e = Object.keys(n);
48
+ e.length === 0 ? _ += "{}" : (_ += `{
49
+ `, e.forEach((t, c) => {
50
+ _ += a + ' "' + t + '": ' + h(n[t], s + 1), c < e.length - 1 && (_ += ","), _ += `
51
51
  `;
52
- }), e += s + "}");
52
+ }), _ += a + "}");
53
53
  }
54
54
  else if (typeof n == "string")
55
55
  try {
56
- const a = JSON.parse(n);
57
- e += h(a, _);
56
+ const e = JSON.parse(n);
57
+ _ += h(e, s);
58
58
  } catch {
59
- e += '"' + n + '"';
59
+ _ += '"' + n + '"';
60
60
  }
61
61
  else
62
- e += n;
63
- return e;
64
- }, en = (n) => {
62
+ _ += n;
63
+ return _;
64
+ }, kn = (n) => {
65
65
  try {
66
- const _ = JSON.parse(n);
67
- return h(_, 0);
68
- } catch (_) {
66
+ const s = JSON.parse(n);
67
+ return h(s, 0);
68
+ } catch (s) {
69
69
  throw new Error(`Invalid JSON string
70
- ${_}`);
70
+ ${s}`);
71
71
  }
72
72
  };
73
- function tn(n) {
74
- return n.split(" ").map((e) => {
75
- const a = e.charAt(0).toUpperCase(), t = e.slice(1).toLowerCase();
76
- return a + t;
73
+ function pn(n) {
74
+ return n.split(" ").map((_) => {
75
+ const e = _.charAt(0).toUpperCase(), t = _.slice(1).toLowerCase();
76
+ return e + t;
77
77
  }).join(" ");
78
78
  }
79
- const k = (n) => n.replace(/[^0-9]/g, ""), on = (n) => {
80
- const s = k(n).match(/^(\d{5})(\d{3})$/);
81
- if (s) return `${s[1]}-${s[2]}`;
79
+ const f = (n) => n.replace(/[^0-9]/g, ""), hn = (n) => {
80
+ const a = f(n).match(/^(\d{5})(\d{3})$/);
81
+ if (a) return `${a[1]}-${a[2]}`;
82
82
  throw new Error("Invalid CEP format");
83
83
  }, w = (n) => {
84
- const s = k(n).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/);
85
- if (s)
86
- return `${s[1]}.${s[2]}.${s[3]}/${s[4]}-${s[5]}`;
84
+ const a = f(n).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/);
85
+ if (a)
86
+ return `${a[1]}.${a[2]}.${a[3]}/${a[4]}-${a[5]}`;
87
87
  throw new Error("Invalid CNPJ length");
88
88
  }, G = (n) => {
89
- const s = k(n).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/);
90
- if (s) return `${s[1]}.${s[2]}.${s[3]}-${s[4]}`;
89
+ const a = f(n).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/);
90
+ if (a) return `${a[1]}.${a[2]}.${a[3]}-${a[4]}`;
91
91
  throw new Error("Invalid CPF format");
92
- }, cn = (n) => {
93
- const _ = n.replace(/\D/g, "");
94
- if (_.length === 11)
95
- return G(_);
96
- if (_.length === 14)
97
- return w(_);
92
+ }, yn = (n) => {
93
+ const s = n.replace(/\D/g, "");
94
+ if (s.length === 11)
95
+ return G(s);
96
+ if (s.length === 14)
97
+ return w(s);
98
98
  throw new Error("Invalid CPF or CNPJ length");
99
99
  }, C = [
100
100
  {
@@ -2072,131 +2072,131 @@ const k = (n) => n.replace(/[^0-9]/g, ""), on = (n) => {
2072
2072
  TRY: { countryLanguage: "tr-TR", countryCurrency: "TRY" },
2073
2073
  IDR: { countryLanguage: "id-ID", countryCurrency: "IDR" },
2074
2074
  THB: { countryLanguage: "th-TH", countryCurrency: "THB" }
2075
- }, P = (n) => n.replace(new RegExp("(?:R\\$|\\p{Sc}|[$€¥£])", "gu"), "").trim(), rn = (n, _, s = { showPrefix: !0 }) => {
2076
- if (!v[_])
2075
+ }, B = (n) => n.replace(new RegExp("(?:R\\$|\\p{Sc}|[$€¥£])", "gu"), "").trim(), Cn = (n, s, a = { showPrefix: !0 }) => {
2076
+ if (!v[s])
2077
2077
  throw new Error("Unsupported currency code");
2078
- const { countryCurrency: e, countryLanguage: a } = v[_], t = new Intl.NumberFormat(a, {
2078
+ const { countryCurrency: _, countryLanguage: e } = v[s], t = new Intl.NumberFormat(e, {
2079
2079
  style: "currency",
2080
- currency: e
2080
+ currency: _
2081
2081
  }).format(n);
2082
- return s.showPrefix ? t.replace(/\s/g, " ") : P(t).replace(/\s/g, " ");
2083
- }, ln = ([n, _ = "00:00:00"], s, e = 0) => {
2084
- const a = n.split(/[-/]/).map(Number), t = _.split(".")[0].split(":").map(Number);
2082
+ return a.showPrefix ? t.replace(/\s/g, " ") : B(t).replace(/\s/g, " ");
2083
+ }, vn = ([n, s = "00:00:00"], a, _ = 0) => {
2084
+ const e = n.split(/[-/]/).map(Number), t = s.split(".")[0].split(":").map(Number);
2085
2085
  let c, r, o;
2086
2086
  const [i = 0, m = 0, d = 0] = t;
2087
- switch (s) {
2087
+ switch (a) {
2088
2088
  case "brazilianDate":
2089
- [c, r, o] = a;
2089
+ [c, r, o] = e;
2090
2090
  break;
2091
2091
  case "isoDate":
2092
- [o, r, c] = a;
2092
+ [o, r, c] = e;
2093
2093
  break;
2094
2094
  case "timestamp":
2095
- [o, r, c] = a.map(Number);
2095
+ [o, r, c] = e.map(Number);
2096
2096
  break;
2097
2097
  default:
2098
2098
  throw new Error("Invalid input format");
2099
2099
  }
2100
- const f = new Date(
2101
- Date.UTC(o, r - 1, c, i - e, m, d)
2100
+ const k = new Date(
2101
+ Date.UTC(o, r - 1, c, i - _, m, d)
2102
2102
  );
2103
- if (isNaN(f.getTime())) throw new Error("Invalid date");
2104
- return f;
2105
- }, un = (n, _) => {
2106
- if (n.length > _) {
2107
- let s = n.substring(0, _).trimEnd();
2108
- return s = s.replace(/[.,!?;:]$/, ""), `${s}...`;
2103
+ if (isNaN(k.getTime())) throw new Error("Invalid date");
2104
+ return k;
2105
+ }, xn = (n, s) => {
2106
+ if (n.length > s) {
2107
+ let a = n.substring(0, s).trimEnd();
2108
+ return a = a.replace(/[.,!?;:]$/, ""), `${a}...`;
2109
2109
  }
2110
2110
  return n;
2111
- }, B = /^\d$/, Y = (n) => {
2112
- let _ = 0;
2113
- const s = n.split("").map((e) => B.test(e) ? { character: e, kind: "digit", digit: ++_ } : { character: e, kind: "other" });
2114
- return { digits: _, children: s, kind: "root" };
2115
- }, U = (n, _) => Array.isArray(n) ? n : n >= 0 ? [0, n] : [_ + 1 - Math.abs(n), _], H = (n, _) => _ >= n[0] && _ <= n[1], gn = (n, _) => {
2116
- const s = Y(n), e = U(_.range ?? 3, s.digits);
2117
- return s.children.map((a) => a.kind === "digit" && H(e, a.digit) ? _.hider ?? "*" : a.character).join("");
2111
+ }, P = /^\d$/, Y = (n) => {
2112
+ let s = 0;
2113
+ const a = n.split("").map((_) => P.test(_) ? { character: _, kind: "digit", digit: ++s } : { character: _, kind: "other" });
2114
+ return { digits: s, children: a, kind: "root" };
2115
+ }, $ = (n, s) => Array.isArray(n) ? n : n >= 0 ? [0, n] : [s + 1 - Math.abs(n), s], U = (n, s) => s >= n[0] && s <= n[1], Fn = (n, s) => {
2116
+ const a = Y(n), _ = $(s.range ?? 3, a.digits);
2117
+ return a.children.map((e) => e.kind === "digit" && U(_, e.digit) ? s.hider ?? "*" : e.character).join("");
2118
2118
  };
2119
- function $(n) {
2119
+ function z(n) {
2120
2120
  return n.length > 10 ? "NINE" : "EIGTH";
2121
2121
  }
2122
- const E = {
2122
+ const D = {
2123
2123
  EIGTH: "(99) 9999-9999",
2124
2124
  NINE: "(99) 99999-9999"
2125
- }, K = k(E.NINE).length;
2126
- function z(n, _) {
2127
- let s = "", e = 0;
2128
- for (let a = 0; a < _.length; a++)
2129
- if (_[a] === "9")
2130
- if (e < n.length)
2131
- s += n[e], e++;
2125
+ }, H = f(D.NINE).length;
2126
+ function K(n, s) {
2127
+ let a = "", _ = 0;
2128
+ for (let e = 0; e < s.length; e++)
2129
+ if (s[e] === "9")
2130
+ if (_ < n.length)
2131
+ a += n[_], _++;
2132
2132
  else
2133
2133
  break;
2134
- else if (e < n.length)
2135
- s += _[a];
2134
+ else if (_ < n.length)
2135
+ a += s[e];
2136
2136
  else
2137
2137
  break;
2138
- return s;
2138
+ return a;
2139
2139
  }
2140
- function x(n, _) {
2141
- if (_.code === "+55") {
2142
- let a = k(n);
2143
- const t = $(a);
2144
- return a.length > K || (a = z(a, E[t])), a;
2140
+ function x(n, s) {
2141
+ if (s.code === "+55") {
2142
+ let e = f(n);
2143
+ const t = z(e);
2144
+ return e.length > H || (e = K(e, D[t])), e;
2145
2145
  }
2146
- let e = _.mask;
2147
- if (_.prefix) {
2148
- const a = /\$+/g;
2149
- e = e.replace(a, _.prefix);
2146
+ let _ = s.mask;
2147
+ if (s.prefix) {
2148
+ const e = /\$+/g;
2149
+ _ = _.replace(e, s.prefix);
2150
2150
  }
2151
- for (let a = 0, t = 0; a < e.length && t < n.length; a++)
2152
- e[a] === "_" && (e = e.substring(0, a) + n[t] + e.substring(a + 1), t++);
2153
- return e;
2151
+ for (let e = 0, t = 0; e < _.length && t < n.length; e++)
2152
+ _[e] === "_" && (_ = _.substring(0, e) + n[t] + _.substring(e + 1), t++);
2153
+ return _;
2154
2154
  }
2155
- function O(n, _) {
2156
- const s = C.find(
2157
- (e) => e.code === n && e.prefix === _
2155
+ function O(n, s) {
2156
+ const a = C.find(
2157
+ (_) => _.code === n && _.prefix === s
2158
2158
  );
2159
- if (!s) throw new Error("Invalid country code or prefix");
2160
- if (s.prefix !== _)
2159
+ if (!a) throw new Error("Invalid country code or prefix");
2160
+ if (a.prefix !== s)
2161
2161
  throw new Error("Invalid country code or prefix");
2162
- if (!s.prefix)
2162
+ if (!a.prefix)
2163
2163
  throw new Error("Invalid country code or prefix");
2164
- return s;
2164
+ return a;
2165
2165
  }
2166
2166
  function J(n) {
2167
- const _ = C.find((s) => s.code === n);
2168
- if (!_) throw new Error("Invalid country code");
2169
- if (_.prefix) throw new Error("Invalid country code");
2170
- return _;
2167
+ const s = C.find((a) => a.code === n);
2168
+ if (!s) throw new Error("Invalid country code");
2169
+ if (s.prefix) throw new Error("Invalid country code");
2170
+ return s;
2171
2171
  }
2172
- const mn = (n) => {
2172
+ const Sn = (n) => {
2173
2173
  if (!/^\+\d{1,4}(-\d{1,4})? \d+$/.test(n))
2174
2174
  throw new Error(
2175
2175
  "Invalid phone number format. Expected format: +<countryCode>-<optionalPrefix> <phoneNumber>"
2176
2176
  );
2177
- const s = n.split(" ")[0].split("-")[0], e = n.split(" ")[0].split("-")[1], a = n.split(" ")[1];
2178
- if (!s || !a)
2177
+ const a = n.split(" ")[0].split("-")[0], _ = n.split(" ")[0].split("-")[1], e = n.split(" ")[1];
2178
+ if (!a || !e)
2179
2179
  throw new Error("Invalid phone number format");
2180
- if (e) {
2181
- const c = O(s, e);
2182
- return x(a, c);
2180
+ if (_) {
2181
+ const c = O(a, _);
2182
+ return x(e, c);
2183
2183
  }
2184
- const t = J(s);
2185
- return x(a, t);
2186
- }, kn = (n) => {
2187
- for (var _ = 0, s = 0; s < n.length; s++)
2188
- _ = n.charCodeAt(s) + ((_ << 5) - _);
2189
- var e = (_ & 16711680) >> 16, a = (_ & 65280) >> 8, t = _ & 255, c = e.toString(16).padStart(2, "0"), r = a.toString(16).padStart(2, "0"), o = t.toString(16).padStart(2, "0");
2184
+ const t = J(a);
2185
+ return x(e, t);
2186
+ }, bn = (n) => {
2187
+ for (var s = 0, a = 0; a < n.length; a++)
2188
+ s = n.charCodeAt(a) + ((s << 5) - s);
2189
+ var _ = (s & 16711680) >> 16, e = (s & 65280) >> 8, t = s & 255, c = _.toString(16).padStart(2, "0"), r = e.toString(16).padStart(2, "0"), o = t.toString(16).padStart(2, "0");
2190
2190
  return "#" + c + r + o;
2191
2191
  };
2192
2192
  var l = [];
2193
2193
  for (var y = 0; y < 256; ++y)
2194
2194
  l.push((y + 256).toString(16).slice(1));
2195
- function T(n, _ = 0) {
2196
- return (l[n[_ + 0]] + l[n[_ + 1]] + l[n[_ + 2]] + l[n[_ + 3]] + "-" + l[n[_ + 4]] + l[n[_ + 5]] + "-" + l[n[_ + 6]] + l[n[_ + 7]] + "-" + l[n[_ + 8]] + l[n[_ + 9]] + "-" + l[n[_ + 10]] + l[n[_ + 11]] + l[n[_ + 12]] + l[n[_ + 13]] + l[n[_ + 14]] + l[n[_ + 15]]).toLowerCase();
2195
+ function T(n, s = 0) {
2196
+ return (l[n[s + 0]] + l[n[s + 1]] + l[n[s + 2]] + l[n[s + 3]] + "-" + l[n[s + 4]] + l[n[s + 5]] + "-" + l[n[s + 6]] + l[n[s + 7]] + "-" + l[n[s + 8]] + l[n[s + 9]] + "-" + l[n[s + 10]] + l[n[s + 11]] + l[n[s + 12]] + l[n[s + 13]] + l[n[s + 14]] + l[n[s + 15]]).toLowerCase();
2197
2197
  }
2198
2198
  var p, V = new Uint8Array(16);
2199
- function A() {
2199
+ function E() {
2200
2200
  if (!p && (p = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !p))
2201
2201
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2202
2202
  return p(V);
@@ -2205,182 +2205,182 @@ var Z = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypt
2205
2205
  const F = {
2206
2206
  randomUUID: Z
2207
2207
  };
2208
- function W(n, _, s) {
2208
+ function W(n, s, a) {
2209
2209
  if (F.randomUUID && !n)
2210
2210
  return F.randomUUID();
2211
2211
  n = n || {};
2212
- var e = n.random || (n.rng || A)();
2213
- return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, T(e);
2212
+ var _ = n.random || (n.rng || E)();
2213
+ return _[6] = _[6] & 15 | 64, _[8] = _[8] & 63 | 128, T(_);
2214
2214
  }
2215
2215
  var S = null, b = null, g = 0;
2216
- function q(n, _, s) {
2216
+ function q(n, s, a) {
2217
2217
  n = n || {};
2218
- var e = 0, a = new Uint8Array(16), t = n.random || (n.rng || A)(), c = n.msecs !== void 0 ? n.msecs : Date.now(), r = n.seq !== void 0 ? n.seq : null, o = b, i = S;
2219
- return c > g && n.msecs === void 0 && (g = c, r !== null && (o = null, i = null)), r !== null && (r > 2147483647 && (r = 2147483647), o = r >>> 19 & 4095, i = r & 524287), (o === null || i === null) && (o = t[6] & 127, o = o << 8 | t[7], i = t[8] & 63, i = i << 8 | t[9], i = i << 5 | t[10] >>> 3), c + 1e4 > g && r === null ? ++i > 524287 && (i = 0, ++o > 4095 && (o = 0, g++)) : g = c, b = o, S = i, a[e++] = g / 1099511627776 & 255, a[e++] = g / 4294967296 & 255, a[e++] = g / 16777216 & 255, a[e++] = g / 65536 & 255, a[e++] = g / 256 & 255, a[e++] = g & 255, a[e++] = o >>> 4 & 15 | 112, a[e++] = o & 255, a[e++] = i >>> 13 & 63 | 128, a[e++] = i >>> 5 & 255, a[e++] = i << 3 & 255 | t[10] & 7, a[e++] = t[11], a[e++] = t[12], a[e++] = t[13], a[e++] = t[14], a[e++] = t[15], _ || T(a);
2218
+ var _ = 0, e = new Uint8Array(16), t = n.random || (n.rng || E)(), c = n.msecs !== void 0 ? n.msecs : Date.now(), r = n.seq !== void 0 ? n.seq : null, o = b, i = S;
2219
+ return c > g && n.msecs === void 0 && (g = c, r !== null && (o = null, i = null)), r !== null && (r > 2147483647 && (r = 2147483647), o = r >>> 19 & 4095, i = r & 524287), (o === null || i === null) && (o = t[6] & 127, o = o << 8 | t[7], i = t[8] & 63, i = i << 8 | t[9], i = i << 5 | t[10] >>> 3), c + 1e4 > g && r === null ? ++i > 524287 && (i = 0, ++o > 4095 && (o = 0, g++)) : g = c, b = o, S = i, e[_++] = g / 1099511627776 & 255, e[_++] = g / 4294967296 & 255, e[_++] = g / 16777216 & 255, e[_++] = g / 65536 & 255, e[_++] = g / 256 & 255, e[_++] = g & 255, e[_++] = o >>> 4 & 15 | 112, e[_++] = o & 255, e[_++] = i >>> 13 & 63 | 128, e[_++] = i >>> 5 & 255, e[_++] = i << 3 & 255 | t[10] & 7, e[_++] = t[11], e[_++] = t[12], e[_++] = t[13], e[_++] = t[14], e[_++] = t[15], s || T(e);
2220
2220
  }
2221
- function L(n) {
2221
+ function R(n) {
2222
2222
  n = n.replace(/-/g, "");
2223
- const _ = new Uint8Array(n.length / 2);
2224
- for (let s = 0; s < n.length; s += 2)
2225
- _[s / 2] = parseInt(n.substring(s, s + 2), 16);
2226
- return _;
2223
+ const s = new Uint8Array(n.length / 2);
2224
+ for (let a = 0; a < n.length; a += 2)
2225
+ s[a / 2] = parseInt(n.substring(a, a + 2), 16);
2226
+ return s;
2227
2227
  }
2228
2228
  function N() {
2229
2229
  const n = W();
2230
- return { text: n, binary: L(n) };
2230
+ return { text: n, binary: R(n) };
2231
2231
  }
2232
2232
  function I() {
2233
2233
  const n = q();
2234
- return { text: n, binary: L(n) };
2234
+ return { text: n, binary: R(n) };
2235
2235
  }
2236
- function dn(n, _) {
2237
- if (n === "text" && _ === "v4") return N().text;
2238
- if (n === "binary" && _ === "v4") return N().binary;
2239
- if (n === "text" && _ === "v7") return I().text;
2240
- if (n === "binary" && _ === "v7") return I().binary;
2236
+ function Nn(n, s) {
2237
+ if (n === "text" && s === "v4") return N().text;
2238
+ if (n === "binary" && s === "v4") return N().binary;
2239
+ if (n === "text" && s === "v7") return I().text;
2240
+ if (n === "binary" && s === "v7") return I().binary;
2241
2241
  throw new Error("Invalid type or format");
2242
2242
  }
2243
- function fn(n) {
2244
- let _ = n.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
2245
- return _ = _.replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").toLowerCase(), _ = _.replace(/-{2,}/g, "-"), _ = _.replace(/^-+|-+$/g, ""), _;
2243
+ function In(n) {
2244
+ let s = n.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
2245
+ return s = s.replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").toLowerCase(), s = s.replace(/-{2,}/g, "-"), s = s.replace(/^-+|-+$/g, ""), s;
2246
2246
  }
2247
- const pn = (n) => {
2248
- const { cashPrice: _, numberInstallments: s, fees: e = 0.0349 } = n;
2249
- if (e === 0 || s === 1)
2247
+ const Mn = (n) => {
2248
+ const { cashPrice: s, numberInstallments: a, fees: _ = 0.0349 } = n;
2249
+ if (_ === 0 || a === 1)
2250
2250
  return {
2251
- totalPrice: _,
2252
- installmentPrice: _ / s
2251
+ totalPrice: s,
2252
+ installmentPrice: s / a
2253
2253
  };
2254
- if (s <= 0)
2254
+ if (a <= 0)
2255
2255
  throw new Error("Number of installments must be greater than 0");
2256
- if (e < 0)
2256
+ if (_ < 0)
2257
2257
  throw new Error("Fees must be greater than or equal to 0");
2258
- let a = 0, t = 0, c = Math.pow(1 + e, s) * e, r = Math.pow(1 + e, s) - 1;
2259
- return a = _ * (c / r), t = s * a, {
2258
+ let e = 0, t = 0, c = Math.pow(1 + _, a) * _, r = Math.pow(1 + _, a) - 1;
2259
+ return e = s * (c / r), t = a * e, {
2260
2260
  totalPrice: +t.toFixed(2),
2261
- installmentPrice: +a.toFixed(2)
2261
+ installmentPrice: +e.toFixed(2)
2262
2262
  };
2263
- }, hn = (n) => {
2264
- const _ = n.startsWith("'") && n.endsWith("'"), s = n.startsWith('"') && n.endsWith('"');
2265
- return _ || s ? n : `"${n}"`;
2263
+ }, An = (n) => {
2264
+ const s = n.startsWith("'") && n.endsWith("'"), a = n.startsWith('"') && n.endsWith('"');
2265
+ return s || a ? n : `"${n}"`;
2266
2266
  };
2267
- function yn(n) {
2267
+ function Dn(n) {
2268
2268
  return /<\/?[a-z][\s\S]*>/i.test(n);
2269
2269
  }
2270
- const Cn = (n, _ = ["password", "confirmPassword", "creditCard"]) => {
2271
- function s(a, t) {
2272
- return _.includes(a) ? "****" : t;
2270
+ const Tn = (n, s = ["password", "confirmPassword", "creditCard"]) => {
2271
+ function a(e, t) {
2272
+ return s.includes(e) ? "****" : t;
2273
2273
  }
2274
- function e(a) {
2275
- return Array.isArray(a) ? a.map((t) => e(t)) : a !== null && typeof a == "object" ? Object.keys(a).reduce((t, c) => {
2276
- let r = a[c];
2274
+ function _(e) {
2275
+ return Array.isArray(e) ? e.map((t) => _(t)) : e !== null && typeof e == "object" ? Object.keys(e).reduce((t, c) => {
2276
+ let r = e[c];
2277
2277
  if (typeof r == "string")
2278
2278
  try {
2279
2279
  const o = JSON.parse(r);
2280
- typeof o == "object" && (r = JSON.stringify(e(o)));
2280
+ typeof o == "object" && (r = JSON.stringify(_(o)));
2281
2281
  } catch {
2282
2282
  }
2283
- return t[c] = e(s(c, r)), t;
2284
- }, {}) : a;
2283
+ return t[c] = _(a(c, r)), t;
2284
+ }, {}) : e;
2285
2285
  }
2286
2286
  try {
2287
- const a = JSON.parse(n), t = e(a);
2287
+ const e = JSON.parse(n), t = _(e);
2288
2288
  return JSON.stringify(t);
2289
2289
  } catch {
2290
2290
  return n;
2291
2291
  }
2292
- }, vn = (n) => n.replace(/<\/?[^>]+(>|$)/g, ""), xn = (n, _ = 1e3) => {
2293
- function s(a) {
2294
- return typeof a == "string" && a.length > _ ? `To large information: field as ${a.length} characters` : a;
2292
+ }, En = (n) => n.replace(/<\/?[^>]+(>|$)/g, ""), Rn = (n, s = 1e3) => {
2293
+ function a(e) {
2294
+ return typeof e == "string" && e.length > s ? `To large information: field as ${e.length} characters` : e;
2295
2295
  }
2296
- function e(a) {
2297
- return Array.isArray(a) ? a.map((t) => e(t)) : a !== null && typeof a == "object" ? Object.fromEntries(
2298
- Object.entries(a).map(([t, c]) => [
2296
+ function _(e) {
2297
+ return Array.isArray(e) ? e.map((t) => _(t)) : e !== null && typeof e == "object" ? Object.fromEntries(
2298
+ Object.entries(e).map(([t, c]) => [
2299
2299
  t,
2300
- e(c)
2300
+ _(c)
2301
2301
  // Corrigido para aplicar recursão corretamente
2302
2302
  ])
2303
- ) : s(a);
2303
+ ) : a(e);
2304
2304
  }
2305
2305
  try {
2306
- const a = JSON.parse(n), t = e(a);
2306
+ const e = JSON.parse(n), t = _(e);
2307
2307
  return JSON.stringify(t);
2308
2308
  } catch {
2309
2309
  throw new Error("Invalid JSON string");
2310
2310
  }
2311
- }, Fn = (n) => {
2311
+ }, Ln = (n) => {
2312
2312
  if (!n || !/^[0-9-]+$/.test(n)) return !1;
2313
- const s = k(n), e = 8, a = /^\d{8}$/.test(s);
2314
- return s.length === e && a;
2313
+ const a = f(n), _ = 8, e = /^\d{8}$/.test(a);
2314
+ return a.length === _ && e;
2315
2315
  };
2316
2316
  function j(n) {
2317
2317
  return n.length !== 14;
2318
2318
  }
2319
2319
  function X(n) {
2320
- const [_] = n;
2321
- return [...n].every((s) => s === _);
2320
+ const [s] = n;
2321
+ return [...n].every((a) => a === s);
2322
2322
  }
2323
- function M(n, _) {
2324
- let s = 0;
2325
- for (let a = 0; a < _.length; a++)
2326
- s += parseInt(n[a]) * _[a];
2327
- const e = s % 11;
2328
- return e < 2 ? 0 : 11 - e;
2323
+ function M(n, s) {
2324
+ let a = 0;
2325
+ for (let e = 0; e < s.length; e++)
2326
+ a += parseInt(n[e]) * s[e];
2327
+ const _ = a % 11;
2328
+ return _ < 2 ? 0 : 11 - _;
2329
2329
  }
2330
2330
  function Q(n) {
2331
2331
  return n.slice(12);
2332
2332
  }
2333
- const Sn = (n) => {
2333
+ const wn = (n) => {
2334
2334
  if (!n) return !1;
2335
- const _ = k(n);
2336
- if (j(_) || X(_)) return !1;
2337
- const s = _.slice(0, 12), e = M(s, [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]), a = M(
2338
- s + e,
2335
+ const s = f(n);
2336
+ if (j(s) || X(s)) return !1;
2337
+ const a = s.slice(0, 12), _ = M(a, [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]), e = M(
2338
+ a + _,
2339
2339
  [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
2340
2340
  );
2341
- return Q(_) === `${e}${a}`;
2341
+ return Q(s) === `${_}${e}`;
2342
2342
  };
2343
2343
  function nn(n) {
2344
2344
  return n.length !== 11;
2345
2345
  }
2346
- function _n(n) {
2347
- const [_] = n;
2348
- return [...n].every((s) => s === _);
2346
+ function sn(n) {
2347
+ const [s] = n;
2348
+ return [...n].every((a) => a === s);
2349
2349
  }
2350
- function D(n, _) {
2351
- let s = 0;
2352
- for (const a of n)
2353
- _ > 1 && (s += parseInt(a) * _--);
2354
- const e = s % 11;
2355
- return e < 2 ? 0 : 11 - e;
2350
+ function A(n, s) {
2351
+ let a = 0;
2352
+ for (const e of n)
2353
+ s > 1 && (a += parseInt(e) * s--);
2354
+ const _ = a % 11;
2355
+ return _ < 2 ? 0 : 11 - _;
2356
2356
  }
2357
2357
  function an(n) {
2358
2358
  return n.slice(9);
2359
2359
  }
2360
- const bn = (n) => {
2360
+ const Gn = (n) => {
2361
2361
  if (!n) return !1;
2362
- const _ = k(n);
2363
- if (nn(_) || _n(_)) return !1;
2364
- const s = D(_, 10), e = D(_, 11);
2365
- return an(_) === `${s}${e}`;
2366
- }, Nn = (n, _) => {
2367
- let s, e, a;
2368
- const t = (_ == null ? void 0 : _.inputFormat) || "DD/MM/YYYY", c = (_ == null ? void 0 : _.minYear) || 1900, r = (_ == null ? void 0 : _.maxYear) || 3e3;
2362
+ const s = f(n);
2363
+ if (nn(s) || sn(s)) return !1;
2364
+ const a = A(s, 10), _ = A(s, 11);
2365
+ return an(s) === `${a}${_}`;
2366
+ }, Bn = (n, s) => {
2367
+ let a, _, e;
2368
+ const t = (s == null ? void 0 : s.inputFormat) || "DD/MM/YYYY", c = (s == null ? void 0 : s.minYear) || 1900, r = (s == null ? void 0 : s.maxYear) || 3e3;
2369
2369
  if (t === "DD/MM/YYYY") {
2370
2370
  const u = /^(\d{2})\/(\d{2})\/(\d{4})$/;
2371
2371
  if (!u.test(n)) return !1;
2372
- [, s, e, a] = n.match(u) || [];
2372
+ [, a, _, e] = n.match(u) || [];
2373
2373
  } else if (t === "MM-DD-YYYY") {
2374
2374
  const u = /^(\d{2})-(\d{2})-(\d{4})$/;
2375
2375
  if (!u.test(n)) return !1;
2376
- [, e, s, a] = n.match(u) || [];
2376
+ [, _, a, e] = n.match(u) || [];
2377
2377
  } else if (t === "YYYY-MM-DD") {
2378
2378
  const u = /^(\d{4})-(\d{2})-(\d{2})$/;
2379
2379
  if (!u.test(n)) return !1;
2380
- [, a, e, s] = n.match(u) || [];
2380
+ [, e, _, a] = n.match(u) || [];
2381
2381
  } else
2382
2382
  throw new Error("Invalid date format");
2383
- const o = parseInt(s, 10), i = parseInt(e, 10), m = parseInt(a, 10);
2383
+ const o = parseInt(a, 10), i = parseInt(_, 10), m = parseInt(e, 10);
2384
2384
  if (o < 1 || o > 31 || i < 1 || i > 12) return !1;
2385
2385
  const d = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2386
2386
  if (i === 2) {
@@ -2389,63 +2389,112 @@ const bn = (n) => {
2389
2389
  } else if (o > d[i - 1])
2390
2390
  return !1;
2391
2391
  return m < c || m > r ? !1 : new Date(m, i - 1, o).getDate() === o;
2392
- }, In = (n) => {
2392
+ }, en = {}, _n = en.promises.resolve;
2393
+ function tn(n) {
2394
+ return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(n);
2395
+ }
2396
+ function on(n) {
2397
+ return !(n.length === 0 || n.length > 64 || n.startsWith(".") || n.endsWith(".") || n.includes("..") || !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+$/.test(n));
2398
+ }
2399
+ function cn(n) {
2400
+ return !(n.length === 0 || n.length > 63 || n.startsWith("-") || n.endsWith("-") || !/^[a-zA-Z0-9-]+$/.test(n));
2401
+ }
2402
+ function rn(n) {
2403
+ if (n.length === 0 || n.length > 253 || n.startsWith(".") || n.endsWith(".") || n.startsWith("-") || n.endsWith("-"))
2404
+ return !1;
2405
+ const s = n.split(".");
2406
+ if (s.length < 2) return !1;
2407
+ for (const _ of s) if (!cn(_)) return !1;
2408
+ const a = s[s.length - 1];
2409
+ return !(a.length < 2 || !/^[a-zA-Z]+$/.test(a));
2410
+ }
2411
+ function ln(n) {
2412
+ const s = n.split("@");
2413
+ if (s.length !== 2) return !1;
2414
+ const [a, _] = s;
2415
+ return !(!on(a) || !rn(_));
2416
+ }
2417
+ function un(n) {
2418
+ const s = n.split("@");
2419
+ return s.length === 2 ? s[1].toLowerCase() : null;
2420
+ }
2421
+ const gn = ["MX", "A", "AAAA"];
2422
+ async function mn(n, s) {
2423
+ try {
2424
+ return await _n(n, s), !0;
2425
+ } catch {
2426
+ return !1;
2427
+ }
2428
+ }
2429
+ async function fn(n) {
2430
+ for (const s of gn)
2431
+ if (await mn(n, s)) return !0;
2432
+ return !1;
2433
+ }
2434
+ const Pn = async (n) => {
2435
+ if (!n || typeof n != "string") return !1;
2436
+ const s = n.trim();
2437
+ if (!tn(s) || !ln(s)) return !1;
2438
+ const a = un(s);
2439
+ return a ? await fn(a) : !1;
2440
+ }, Yn = (n) => {
2393
2441
  if (!n) return !1;
2394
- const _ = n.length >= 8, s = /[A-Z]/.test(n), e = /[a-z]/.test(n), a = /\d/.test(n), t = /[!@#$%^&*(),.?":{}|<>_\-+=~`[\]\\\/]/.test(
2442
+ const s = n.length >= 8, a = /[A-Z]/.test(n), _ = /[a-z]/.test(n), e = /\d/.test(n), t = /[!@#$%^&*(),.?":{}|<>_\-+=~`[\]\\\/]/.test(
2395
2443
  n
2396
2444
  );
2397
2445
  return [
2398
- _,
2399
2446
  s,
2400
- e,
2401
2447
  a,
2448
+ _,
2449
+ e,
2402
2450
  t
2403
2451
  ].every((c) => c);
2404
- }, Mn = (n) => {
2405
- for (const _ of C) {
2406
- const s = _.code, e = _.prefix ? `-${_.prefix}` : "", a = _.mask.replace(/[^_]/g, "").length;
2407
- if (_.iso === "BR") {
2408
- if (new RegExp(`^\\${s} \\d{2}9?\\d{8}$`).test(n)) return !0;
2452
+ }, $n = (n) => {
2453
+ for (const s of C) {
2454
+ const a = s.code, _ = s.prefix ? `-${s.prefix}` : "", e = s.mask.replace(/[^_]/g, "").length;
2455
+ if (s.iso === "BR") {
2456
+ if (new RegExp(`^\\${a} \\d{2}9?\\d{8}$`).test(n)) return !0;
2409
2457
  continue;
2410
2458
  }
2411
- if (new RegExp(`^\\${s}${e} \\d{${a}}$`).test(n)) return !0;
2459
+ if (new RegExp(`^\\${a}${_} \\d{${e}}$`).test(n)) return !0;
2412
2460
  }
2413
2461
  return !1;
2414
- }, Dn = (n) => {
2462
+ }, Un = (n) => {
2415
2463
  if (!n || !/^[0-9a-zA-Z.-]+$/.test(n)) return !1;
2416
- const s = n.replace(/[^a-zA-Z0-9]/g, "");
2417
- return s.length < 7 || s.length > 9 ? !1 : /^[0-9]{7,8}[0-9Xx]?$/.test(s);
2464
+ const a = n.replace(/[^a-zA-Z0-9]/g, "");
2465
+ return a.length < 7 || a.length > 9 ? !1 : /^[0-9]{7,8}[0-9Xx]?$/.test(a);
2418
2466
  };
2419
2467
  export {
2420
- pn as calculateCardInstallment,
2421
- hn as ensureQuotes,
2422
- sn as formatDate,
2468
+ Mn as calculateCardInstallment,
2469
+ An as ensureQuotes,
2470
+ dn as formatDate,
2423
2471
  h as formatJsonObject,
2424
- en as formatJsonString,
2425
- tn as formatToCapitalizeFirstWordLetter,
2426
- on as formatToCep,
2472
+ kn as formatJsonString,
2473
+ pn as formatToCapitalizeFirstWordLetter,
2474
+ hn as formatToCep,
2427
2475
  w as formatToCnpj,
2428
2476
  G as formatToCpf,
2429
- cn as formatToCpfCnpj,
2430
- rn as formatToCurrency,
2431
- ln as formatToDate,
2432
- un as formatToEllipsis,
2433
- gn as formatToHiddenDigits,
2434
- mn as formatToPhone,
2435
- kn as generateColorByString,
2436
- dn as generateId,
2437
- fn as generateSlug,
2438
- yn as isHtml,
2439
- Cn as maskSensitiveData,
2440
- P as removeCurrencySymbols,
2441
- k as removeNonNumeric,
2442
- vn as stripHtmlTags,
2443
- xn as truncateLargeFields,
2444
- Fn as validateCep,
2445
- Sn as validateCnpj,
2446
- bn as validateCpf,
2447
- Nn as validateDate,
2448
- In as validatePassword,
2449
- Mn as validatePhone,
2450
- Dn as validateRg
2477
+ yn as formatToCpfCnpj,
2478
+ Cn as formatToCurrency,
2479
+ vn as formatToDate,
2480
+ xn as formatToEllipsis,
2481
+ Fn as formatToHiddenDigits,
2482
+ Sn as formatToPhone,
2483
+ bn as generateColorByString,
2484
+ Nn as generateId,
2485
+ In as generateSlug,
2486
+ Dn as isHtml,
2487
+ Tn as maskSensitiveData,
2488
+ B as removeCurrencySymbols,
2489
+ f as removeNonNumeric,
2490
+ En as stripHtmlTags,
2491
+ Rn as truncateLargeFields,
2492
+ Ln as validateCep,
2493
+ wn as validateCnpj,
2494
+ Gn as validateCpf,
2495
+ Bn as validateDate,
2496
+ Pn as validateEmail,
2497
+ Yn as validatePassword,
2498
+ $n as validatePhone,
2499
+ Un as validateRg
2451
2500
  };