@arkyn/shared 3.0.1-beta.72 → 3.0.1-beta.74

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,102 +1,102 @@
1
- function R(n, _) {
2
- const s = (a) => a.toString().padStart(2, "0"), e = {
3
- YYYY: n.getFullYear().toString(),
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())
1
+ function E(_, n) {
2
+ const e = (a) => a.toString().padStart(2, "0"), s = {
3
+ YYYY: _.getFullYear().toString(),
4
+ YY: _.getFullYear().toString().slice(-2),
5
+ MM: e(_.getMonth() + 1),
6
+ DD: e(_.getDate()),
7
+ hh: e(_.getHours()),
8
+ mm: e(_.getMinutes()),
9
+ ss: e(_.getSeconds())
10
10
  };
11
- return _.replace(
11
+ return n.replace(
12
12
  /YYYY|YY|MM|DD|hh|mm|ss/g,
13
- (a) => e[a]
13
+ (a) => s[a]
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);
18
- let r, o, i;
19
- const [m = 0, d = 0, f = 0] = c;
20
- switch (s) {
16
+ const Z = ([_, n = "00:00:00"], e, s, a = 0) => {
17
+ const o = _.split(/[-/]/).map(Number), c = n.split(".")[0].split(":").map(Number);
18
+ let r, t, i;
19
+ const [p = 0, y = 0, m = 0] = c;
20
+ switch (e) {
21
21
  case "brazilianDate":
22
- [r, o, i] = t;
22
+ [r, t, i] = o;
23
23
  break;
24
24
  case "isoDate":
25
- [i, o, r] = t;
25
+ [i, t, r] = o;
26
26
  break;
27
27
  case "timestamp":
28
- [i, o, r] = t.map(Number);
28
+ [i, t, r] = o.map(Number);
29
29
  break;
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);
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 = "";
39
- if (typeof n == "object" && n !== null)
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 += `
33
+ const k = new Date(i, t - 1, r, p, y, m);
34
+ if (isNaN(k.getTime())) throw new Error("Invalid date");
35
+ return k.setUTCHours(k.getUTCHours() + a), E(k, s);
36
+ }, f = (_, n) => {
37
+ const e = " ".repeat(n);
38
+ let s = "";
39
+ if (typeof _ == "object" && _ !== null)
40
+ if (Array.isArray(_))
41
+ _.length === 0 ? s += "[]" : (s += `[
42
+ `, _.forEach((a, o) => {
43
+ s += e + " " + f(a, n + 1), o < _.length - 1 && (s += ","), s += `
44
44
  `;
45
- }), e += s + "]");
45
+ }), s += e + "]");
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 a = Object.keys(_);
48
+ a.length === 0 ? s += "{}" : (s += `{
49
+ `, a.forEach((o, c) => {
50
+ s += e + ' "' + o + '": ' + f(_[o], n + 1), c < a.length - 1 && (s += ","), s += `
51
51
  `;
52
- }), e += s + "}");
52
+ }), s += e + "}");
53
53
  }
54
- else if (typeof n == "string")
54
+ else if (typeof _ == "string")
55
55
  try {
56
- const a = JSON.parse(n);
57
- e += h(a, _);
56
+ const a = JSON.parse(_);
57
+ s += f(a, n);
58
58
  } catch {
59
- e += '"' + n + '"';
59
+ s += '"' + _ + '"';
60
60
  }
61
61
  else
62
- e += n;
63
- return e;
64
- }, en = (n) => {
62
+ s += _;
63
+ return s;
64
+ }, q = (_) => {
65
65
  try {
66
- const _ = JSON.parse(n);
67
- return h(_, 0);
68
- } catch (_) {
66
+ const n = JSON.parse(_);
67
+ return f(n, 0);
68
+ } catch (n) {
69
69
  throw new Error(`Invalid JSON string
70
- ${_}`);
70
+ ${n}`);
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 j(_) {
74
+ return _.split(" ").map((s) => {
75
+ const a = s.charAt(0).toUpperCase(), o = s.slice(1).toLowerCase();
76
+ return a + o;
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 g = (_) => _.replace(/[^0-9]/g, ""), Q = (_) => {
80
+ const e = g(_).match(/^(\d{5})(\d{3})$/);
81
+ if (e) return `${e[1]}-${e[2]}`;
82
82
  throw new Error("Invalid CEP format");
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]}`;
83
+ }, D = (_) => {
84
+ const e = g(_).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/);
85
+ if (e)
86
+ return `${e[1]}.${e[2]}.${e[3]}/${e[4]}-${e[5]}`;
87
87
  throw new Error("Invalid CNPJ length");
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]}`;
88
+ }, L = (_) => {
89
+ const e = g(_).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/);
90
+ if (e) return `${e[1]}.${e[2]}.${e[3]}-${e[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
+ }, X = (_) => {
93
+ const n = _.replace(/\D/g, "");
94
+ if (n.length === 11)
95
+ return L(n);
96
+ if (n.length === 14)
97
+ return D(n);
98
98
  throw new Error("Invalid CPF or CNPJ length");
99
- }, C = [
99
+ }, N = [
100
100
  {
101
101
  name: "Afghanistan",
102
102
  code: "+93",
@@ -2049,7 +2049,7 @@ const k = (n) => n.replace(/[^0-9]/g, ""), on = (n) => {
2049
2049
  flag: "https://cdn.kcak11.com/CountryFlags/countries/zw.svg",
2050
2050
  mask: "_-______"
2051
2051
  }
2052
- ], v = {
2052
+ ], C = {
2053
2053
  USD: { countryLanguage: "en-US", countryCurrency: "USD" },
2054
2054
  EUR: { countryLanguage: "de-DE", countryCurrency: "EUR" },
2055
2055
  JPY: { countryLanguage: "ja-JP", countryCurrency: "JPY" },
@@ -2072,380 +2072,266 @@ 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
+ }, R = (_) => _.replace(new RegExp("(?:R\\$|\\p{Sc}|[$€¥£])", "gu"), "").trim(), __ = (_, n, e = { showPrefix: !0 }) => {
2076
+ if (!C[n])
2077
2077
  throw new Error("Unsupported currency code");
2078
- const { countryCurrency: e, countryLanguage: a } = v[_], t = new Intl.NumberFormat(a, {
2078
+ const { countryCurrency: s, countryLanguage: a } = C[n], o = new Intl.NumberFormat(a, {
2079
2079
  style: "currency",
2080
- currency: e
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);
2085
- let c, r, o;
2086
- const [i = 0, m = 0, d = 0] = t;
2087
- switch (s) {
2080
+ currency: s
2081
+ }).format(_);
2082
+ return e.showPrefix ? o.replace(/\s/g, " ") : R(o).replace(/\s/g, " ");
2083
+ }, n_ = ([_, n = "00:00:00"], e, s = 0) => {
2084
+ const a = _.split(/[-/]/).map(Number), o = n.split(".")[0].split(":").map(Number);
2085
+ let c, r, t;
2086
+ const [i = 0, p = 0, y = 0] = o;
2087
+ switch (e) {
2088
2088
  case "brazilianDate":
2089
- [c, r, o] = a;
2089
+ [c, r, t] = a;
2090
2090
  break;
2091
2091
  case "isoDate":
2092
- [o, r, c] = a;
2092
+ [t, r, c] = a;
2093
2093
  break;
2094
2094
  case "timestamp":
2095
- [o, r, c] = a.map(Number);
2095
+ [t, r, c] = a.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 m = new Date(
2101
+ Date.UTC(t, r - 1, c, i - s, p, y)
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(m.getTime())) throw new Error("Invalid date");
2104
+ return m;
2105
+ }, a_ = (_, n) => {
2106
+ if (_.length > n) {
2107
+ let e = _.substring(0, n).trimEnd();
2108
+ return e = e.replace(/[.,!?;:]$/, ""), `${e}...`;
2109
2109
  }
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("");
2110
+ return _;
2111
+ }, G = /^\d$/, P = (_) => {
2112
+ let n = 0;
2113
+ const e = _.split("").map((s) => G.test(s) ? { character: s, kind: "digit", digit: ++n } : { character: s, kind: "other" });
2114
+ return { digits: n, children: e, kind: "root" };
2115
+ }, B = (_, n) => Array.isArray(_) ? _ : _ >= 0 ? [0, _] : [n + 1 - Math.abs(_), n], U = (_, n) => n >= _[0] && n <= _[1], s_ = (_, n) => {
2116
+ const e = P(_), s = B(n.range ?? 3, e.digits);
2117
+ return e.children.map((a) => a.kind === "digit" && U(s, a.digit) ? n.hider ?? "*" : a.character).join("");
2118
2118
  };
2119
- function $(n) {
2120
- return n.length > 10 ? "NINE" : "EIGTH";
2119
+ function K(_) {
2120
+ return _.length > 10 ? "NINE" : "EIGTH";
2121
2121
  }
2122
- const E = {
2122
+ const w = {
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 = g(w.NINE).length;
2126
+ function O(_, n) {
2127
+ let e = "", s = 0;
2128
+ for (let a = 0; a < n.length; a++)
2129
+ if (n[a] === "9")
2130
+ if (s < _.length)
2131
+ e += _[s], s++;
2132
2132
  else
2133
2133
  break;
2134
- else if (e < n.length)
2135
- s += _[a];
2134
+ else if (s < _.length)
2135
+ e += n[a];
2136
2136
  else
2137
2137
  break;
2138
- return s;
2138
+ return e;
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 v(_, n) {
2141
+ if (n.code === "+55") {
2142
+ let a = g(_);
2143
+ const o = K(a);
2144
+ return a.length > H || (a = O(a, w[o])), a;
2145
2145
  }
2146
- let e = _.mask;
2147
- if (_.prefix) {
2146
+ let s = n.mask;
2147
+ if (n.prefix) {
2148
2148
  const a = /\$+/g;
2149
- e = e.replace(a, _.prefix);
2149
+ s = s.replace(a, n.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 a = 0, o = 0; a < s.length && o < _.length; a++)
2152
+ s[a] === "_" && (s = s.substring(0, a) + _[o] + s.substring(a + 1), o++);
2153
+ return s;
2154
2154
  }
2155
- function O(n, _) {
2156
- const s = C.find(
2157
- (e) => e.code === n && e.prefix === _
2155
+ function z(_, n) {
2156
+ const e = N.find(
2157
+ (s) => s.code === _ && s.prefix === n
2158
2158
  );
2159
- if (!s) throw new Error("Invalid country code or prefix");
2160
- if (s.prefix !== _)
2159
+ if (!e) throw new Error("Invalid country code or prefix");
2160
+ if (e.prefix !== n)
2161
2161
  throw new Error("Invalid country code or prefix");
2162
- if (!s.prefix)
2162
+ if (!e.prefix)
2163
2163
  throw new Error("Invalid country code or prefix");
2164
- return s;
2164
+ return e;
2165
2165
  }
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 _;
2166
+ function J(_) {
2167
+ const n = N.find((e) => e.code === _);
2168
+ if (!n) throw new Error("Invalid country code");
2169
+ if (n.prefix) throw new Error("Invalid country code");
2170
+ return n;
2171
2171
  }
2172
- const mn = (n) => {
2173
- if (!/^\+\d{1,4}(-\d{1,4})? \d+$/.test(n))
2172
+ const e_ = (_) => {
2173
+ if (!/^\+\d{1,4}(-\d{1,4})? \d+$/.test(_))
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 e = _.split(" ")[0].split("-")[0], s = _.split(" ")[0].split("-")[1], a = _.split(" ")[1];
2178
+ if (!e || !a)
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 (s) {
2181
+ const c = z(e, s);
2182
+ return v(a, 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");
2190
- return "#" + c + r + o;
2184
+ const o = J(e);
2185
+ return v(a, o);
2186
+ }, o_ = (_) => {
2187
+ for (var n = 0, e = 0; e < _.length; e++)
2188
+ n = _.charCodeAt(e) + ((n << 5) - n);
2189
+ var s = (n & 16711680) >> 16, a = (n & 65280) >> 8, o = n & 255, c = s.toString(16).padStart(2, "0"), r = a.toString(16).padStart(2, "0"), t = o.toString(16).padStart(2, "0");
2190
+ return "#" + c + r + t;
2191
2191
  };
2192
2192
  var l = [];
2193
- for (var y = 0; y < 256; ++y)
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();
2193
+ for (var h = 0; h < 256; ++h)
2194
+ l.push((h + 256).toString(16).slice(1));
2195
+ function M(_, 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();
2197
2197
  }
2198
- var p, V = new Uint8Array(16);
2199
- function A() {
2200
- if (!p && (p = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !p))
2198
+ var d, Y = new Uint8Array(16);
2199
+ function T() {
2200
+ if (!d && (d = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !d))
2201
2201
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2202
- return p(V);
2202
+ return d(Y);
2203
2203
  }
2204
- var Z = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2205
- const F = {
2206
- randomUUID: Z
2204
+ var $ = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2205
+ const x = {
2206
+ randomUUID: $
2207
2207
  };
2208
- function W(n, _, s) {
2209
- if (F.randomUUID && !n)
2210
- return F.randomUUID();
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);
2208
+ function V(_, n, e) {
2209
+ if (x.randomUUID && !_)
2210
+ return x.randomUUID();
2211
+ _ = _ || {};
2212
+ var s = _.random || (_.rng || T)();
2213
+ return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, M(s);
2214
2214
  }
2215
- var S = null, b = null, g = 0;
2216
- function q(n, _, s) {
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);
2215
+ var F = null, S = null, u = 0;
2216
+ function W(_, n, e) {
2217
+ _ = _ || {};
2218
+ var s = 0, a = new Uint8Array(16), o = _.random || (_.rng || T)(), c = _.msecs !== void 0 ? _.msecs : Date.now(), r = _.seq !== void 0 ? _.seq : null, t = S, i = F;
2219
+ return c > u && _.msecs === void 0 && (u = c, r !== null && (t = null, i = null)), r !== null && (r > 2147483647 && (r = 2147483647), t = r >>> 19 & 4095, i = r & 524287), (t === null || i === null) && (t = o[6] & 127, t = t << 8 | o[7], i = o[8] & 63, i = i << 8 | o[9], i = i << 5 | o[10] >>> 3), c + 1e4 > u && r === null ? ++i > 524287 && (i = 0, ++t > 4095 && (t = 0, u++)) : u = c, S = t, F = i, a[s++] = u / 1099511627776 & 255, a[s++] = u / 4294967296 & 255, a[s++] = u / 16777216 & 255, a[s++] = u / 65536 & 255, a[s++] = u / 256 & 255, a[s++] = u & 255, a[s++] = t >>> 4 & 15 | 112, a[s++] = t & 255, a[s++] = i >>> 13 & 63 | 128, a[s++] = i >>> 5 & 255, a[s++] = i << 3 & 255 | o[10] & 7, a[s++] = o[11], a[s++] = o[12], a[s++] = o[13], a[s++] = o[14], a[s++] = o[15], n || M(a);
2220
2220
  }
2221
- function L(n) {
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 _;
2221
+ function A(_) {
2222
+ _ = _.replace(/-/g, "");
2223
+ const n = new Uint8Array(_.length / 2);
2224
+ for (let e = 0; e < _.length; e += 2)
2225
+ n[e / 2] = parseInt(_.substring(e, e + 2), 16);
2226
+ return n;
2227
2227
  }
2228
- function N() {
2229
- const n = W();
2230
- return { text: n, binary: L(n) };
2228
+ function b() {
2229
+ const _ = V();
2230
+ return { text: _, binary: A(_) };
2231
2231
  }
2232
2232
  function I() {
2233
- const n = q();
2234
- return { text: n, binary: L(n) };
2233
+ const _ = W();
2234
+ return { text: _, binary: A(_) };
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 t_(_, n) {
2237
+ if (_ === "text" && n === "v4") return b().text;
2238
+ if (_ === "binary" && n === "v4") return b().binary;
2239
+ if (_ === "text" && n === "v7") return I().text;
2240
+ if (_ === "binary" && n === "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 c_(_) {
2244
+ let n = _.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
2245
+ return n = n.replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").toLowerCase(), n = n.replace(/-{2,}/g, "-"), n = n.replace(/^-+|-+$/g, ""), n;
2246
2246
  }
2247
- const pn = (n) => {
2248
- const { cashPrice: _, numberInstallments: s, fees: e = 0.0349 } = n;
2249
- if (e === 0 || s === 1)
2247
+ const r_ = (_) => {
2248
+ const { cashPrice: n, numberInstallments: e, fees: s = 0.0349 } = _;
2249
+ if (s === 0 || e === 1)
2250
2250
  return {
2251
- totalPrice: _,
2252
- installmentPrice: _ / s
2251
+ totalPrice: n,
2252
+ installmentPrice: n / e
2253
2253
  };
2254
- if (s <= 0)
2254
+ if (e <= 0)
2255
2255
  throw new Error("Number of installments must be greater than 0");
2256
- if (e < 0)
2256
+ if (s < 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, {
2260
- totalPrice: +t.toFixed(2),
2258
+ let a = 0, o = 0, c = Math.pow(1 + s, e) * s, r = Math.pow(1 + s, e) - 1;
2259
+ return a = n * (c / r), o = e * a, {
2260
+ totalPrice: +o.toFixed(2),
2261
2261
  installmentPrice: +a.toFixed(2)
2262
2262
  };
2263
- }, hn = (n) => {
2264
- const _ = n.startsWith("'") && n.endsWith("'"), s = n.startsWith('"') && n.endsWith('"');
2265
- return _ || s ? n : `"${n}"`;
2263
+ }, i_ = (_) => {
2264
+ const n = _.startsWith("'") && _.endsWith("'"), e = _.startsWith('"') && _.endsWith('"');
2265
+ return n || e ? _ : `"${_}"`;
2266
2266
  };
2267
- function yn(n) {
2268
- return /<\/?[a-z][\s\S]*>/i.test(n);
2267
+ function l_(_) {
2268
+ return /<\/?[a-z][\s\S]*>/i.test(_);
2269
2269
  }
2270
- const Cn = (n, _ = ["password", "confirmPassword", "creditCard"]) => {
2271
- function s(a, t) {
2272
- return _.includes(a) ? "****" : t;
2270
+ const u_ = (_, n = ["password", "confirmPassword", "creditCard"]) => {
2271
+ function e(a, o) {
2272
+ return n.includes(a) ? "****" : o;
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) => {
2274
+ function s(a) {
2275
+ return Array.isArray(a) ? a.map((o) => s(o)) : a !== null && typeof a == "object" ? Object.keys(a).reduce((o, c) => {
2276
2276
  let r = a[c];
2277
2277
  if (typeof r == "string")
2278
2278
  try {
2279
- const o = JSON.parse(r);
2280
- typeof o == "object" && (r = JSON.stringify(e(o)));
2279
+ const t = JSON.parse(r);
2280
+ typeof t == "object" && (r = JSON.stringify(s(t)));
2281
2281
  } catch {
2282
2282
  }
2283
- return t[c] = e(s(c, r)), t;
2283
+ return o[c] = s(e(c, r)), o;
2284
2284
  }, {}) : a;
2285
2285
  }
2286
2286
  try {
2287
- const a = JSON.parse(n), t = e(a);
2288
- return JSON.stringify(t);
2287
+ const a = JSON.parse(_), o = s(a);
2288
+ return JSON.stringify(o);
2289
2289
  } catch {
2290
- return n;
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;
2290
+ return _;
2295
2291
  }
2292
+ }, g_ = (_) => _.replace(/<\/?[^>]+(>|$)/g, ""), m_ = (_, n = 1e3) => {
2296
2293
  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]) => [
2299
- t,
2300
- e(c)
2294
+ return typeof a == "string" && a.length > n ? `To large information: field as ${a.length} characters` : a;
2295
+ }
2296
+ function s(a) {
2297
+ return Array.isArray(a) ? a.map((o) => s(o)) : a !== null && typeof a == "object" ? Object.fromEntries(
2298
+ Object.entries(a).map(([o, c]) => [
2299
+ o,
2300
+ s(c)
2301
2301
  // Corrigido para aplicar recursão corretamente
2302
2302
  ])
2303
- ) : s(a);
2303
+ ) : e(a);
2304
2304
  }
2305
2305
  try {
2306
- const a = JSON.parse(n), t = e(a);
2307
- return JSON.stringify(t);
2306
+ const a = JSON.parse(_), o = s(a);
2307
+ return JSON.stringify(o);
2308
2308
  } catch {
2309
2309
  throw new Error("Invalid JSON string");
2310
2310
  }
2311
- }, Fn = (n) => {
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;
2315
- };
2316
- function j(n) {
2317
- return n.length !== 14;
2318
- }
2319
- function X(n) {
2320
- const [_] = n;
2321
- return [...n].every((s) => s === _);
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;
2329
- }
2330
- function Q(n) {
2331
- return n.slice(12);
2332
- }
2333
- const Sn = (n) => {
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,
2339
- [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
2340
- );
2341
- return Q(_) === `${e}${a}`;
2342
- };
2343
- function nn(n) {
2344
- return n.length !== 11;
2345
- }
2346
- function _n(n) {
2347
- const [_] = n;
2348
- return [...n].every((s) => s === _);
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;
2356
- }
2357
- function an(n) {
2358
- return n.slice(9);
2359
- }
2360
- const bn = (n) => {
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;
2369
- if (t === "DD/MM/YYYY") {
2370
- const u = /^(\d{2})\/(\d{2})\/(\d{4})$/;
2371
- if (!u.test(n)) return !1;
2372
- [, s, e, a] = n.match(u) || [];
2373
- } else if (t === "MM-DD-YYYY") {
2374
- const u = /^(\d{2})-(\d{2})-(\d{4})$/;
2375
- if (!u.test(n)) return !1;
2376
- [, e, s, a] = n.match(u) || [];
2377
- } else if (t === "YYYY-MM-DD") {
2378
- const u = /^(\d{4})-(\d{2})-(\d{2})$/;
2379
- if (!u.test(n)) return !1;
2380
- [, a, e, s] = n.match(u) || [];
2381
- } else
2382
- throw new Error("Invalid date format");
2383
- const o = parseInt(s, 10), i = parseInt(e, 10), m = parseInt(a, 10);
2384
- if (o < 1 || o > 31 || i < 1 || i > 12) return !1;
2385
- const d = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2386
- if (i === 2) {
2387
- const u = m % 4 === 0 && m % 100 !== 0 || m % 400 === 0;
2388
- if (o > (u ? 29 : 28)) return !1;
2389
- } else if (o > d[i - 1])
2390
- return !1;
2391
- return m < c || m > r ? !1 : new Date(m, i - 1, o).getDate() === o;
2392
- }, In = (n) => {
2393
- 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(
2395
- n
2396
- );
2397
- return [
2398
- _,
2399
- s,
2400
- e,
2401
- a,
2402
- t
2403
- ].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;
2409
- continue;
2410
- }
2411
- if (new RegExp(`^\\${s}${e} \\d{${a}}$`).test(n)) return !0;
2412
- }
2413
- return !1;
2414
- }, Dn = (n) => {
2415
- 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);
2418
2311
  };
2419
2312
  export {
2420
- pn as calculateCardInstallment,
2421
- hn as ensureQuotes,
2422
- sn as formatDate,
2423
- h as formatJsonObject,
2424
- en as formatJsonString,
2425
- tn as formatToCapitalizeFirstWordLetter,
2426
- on as formatToCep,
2427
- w as formatToCnpj,
2428
- 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
2313
+ r_ as calculateCardInstallment,
2314
+ i_ as ensureQuotes,
2315
+ Z as formatDate,
2316
+ f as formatJsonObject,
2317
+ q as formatJsonString,
2318
+ j as formatToCapitalizeFirstWordLetter,
2319
+ Q as formatToCep,
2320
+ D as formatToCnpj,
2321
+ L as formatToCpf,
2322
+ X as formatToCpfCnpj,
2323
+ __ as formatToCurrency,
2324
+ n_ as formatToDate,
2325
+ a_ as formatToEllipsis,
2326
+ s_ as formatToHiddenDigits,
2327
+ e_ as formatToPhone,
2328
+ o_ as generateColorByString,
2329
+ t_ as generateId,
2330
+ c_ as generateSlug,
2331
+ l_ as isHtml,
2332
+ u_ as maskSensitiveData,
2333
+ R as removeCurrencySymbols,
2334
+ g as removeNonNumeric,
2335
+ g_ as stripHtmlTags,
2336
+ m_ as truncateLargeFields
2451
2337
  };