@arkyn/shared 3.0.1-beta.73 → 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 +255 -418
- package/dist/bundle.umd.cjs +6 -6
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -9
- package/package.json +1 -1
- package/dist/validations/validateCep.d.ts +0 -24
- package/dist/validations/validateCep.d.ts.map +0 -1
- package/dist/validations/validateCep.js +0 -33
- package/dist/validations/validateCnpj.d.ts +0 -22
- package/dist/validations/validateCnpj.d.ts.map +0 -1
- package/dist/validations/validateCnpj.js +0 -52
- package/dist/validations/validateCpf.d.ts +0 -24
- package/dist/validations/validateCpf.d.ts.map +0 -1
- package/dist/validations/validateCpf.js +0 -54
- package/dist/validations/validateDate.d.ts +0 -34
- package/dist/validations/validateDate.d.ts.map +0 -1
- package/dist/validations/validateDate.js +0 -73
- package/dist/validations/validateEmail.d.ts +0 -22
- package/dist/validations/validateEmail.d.ts.map +0 -1
- package/dist/validations/validateEmail.js +0 -121
- package/dist/validations/validatePassword.d.ts +0 -21
- package/dist/validations/validatePassword.d.ts.map +0 -1
- package/dist/validations/validatePassword.js +0 -34
- package/dist/validations/validatePhone.d.ts +0 -29
- package/dist/validations/validatePhone.d.ts.map +0 -1
- package/dist/validations/validatePhone.js +0 -44
- package/dist/validations/validateRg.d.ts +0 -22
- package/dist/validations/validateRg.d.ts.map +0 -1
- package/dist/validations/validateRg.js +0 -31
package/dist/bundle.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
YYYY:
|
|
4
|
-
YY:
|
|
5
|
-
MM:
|
|
6
|
-
DD:
|
|
7
|
-
hh:
|
|
8
|
-
mm:
|
|
9
|
-
ss:
|
|
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
|
|
11
|
+
return n.replace(
|
|
12
12
|
/YYYY|YY|MM|DD|hh|mm|ss/g,
|
|
13
|
-
(
|
|
13
|
+
(a) => s[a]
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
let r,
|
|
19
|
-
const [
|
|
20
|
-
switch (
|
|
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,
|
|
22
|
+
[r, t, i] = o;
|
|
23
23
|
break;
|
|
24
24
|
case "isoDate":
|
|
25
|
-
[i,
|
|
25
|
+
[i, t, r] = o;
|
|
26
26
|
break;
|
|
27
27
|
case "timestamp":
|
|
28
|
-
[i,
|
|
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
|
|
34
|
-
if (isNaN(
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
const
|
|
38
|
-
let
|
|
39
|
-
if (typeof
|
|
40
|
-
if (Array.isArray(
|
|
41
|
-
|
|
42
|
-
`,
|
|
43
|
-
|
|
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
|
-
}),
|
|
45
|
+
}), s += e + "]");
|
|
46
46
|
else {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
`,
|
|
50
|
-
|
|
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
|
-
}),
|
|
52
|
+
}), s += e + "}");
|
|
53
53
|
}
|
|
54
|
-
else if (typeof
|
|
54
|
+
else if (typeof _ == "string")
|
|
55
55
|
try {
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const a = JSON.parse(_);
|
|
57
|
+
s += f(a, n);
|
|
58
58
|
} catch {
|
|
59
|
-
|
|
59
|
+
s += '"' + _ + '"';
|
|
60
60
|
}
|
|
61
61
|
else
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
},
|
|
62
|
+
s += _;
|
|
63
|
+
return s;
|
|
64
|
+
}, q = (_) => {
|
|
65
65
|
try {
|
|
66
|
-
const
|
|
67
|
-
return
|
|
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
|
|
74
|
-
return
|
|
75
|
-
const
|
|
76
|
-
return
|
|
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
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
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
|
-
},
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
return `${
|
|
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
|
-
},
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
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
|
-
},
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
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
|
-
},
|
|
99
|
+
}, N = [
|
|
100
100
|
{
|
|
101
101
|
name: "Afghanistan",
|
|
102
102
|
code: "+93",
|
|
@@ -2049,7 +2049,7 @@ const f = (n) => n.replace(/[^0-9]/g, ""), hn = (n) => {
|
|
|
2049
2049
|
flag: "https://cdn.kcak11.com/CountryFlags/countries/zw.svg",
|
|
2050
2050
|
mask: "_-______"
|
|
2051
2051
|
}
|
|
2052
|
-
],
|
|
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,429 +2072,266 @@ const f = (n) => n.replace(/[^0-9]/g, ""), hn = (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
|
-
},
|
|
2076
|
-
if (!
|
|
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:
|
|
2078
|
+
const { countryCurrency: s, countryLanguage: a } = C[n], o = new Intl.NumberFormat(a, {
|
|
2079
2079
|
style: "currency",
|
|
2080
|
-
currency:
|
|
2081
|
-
}).format(
|
|
2082
|
-
return
|
|
2083
|
-
},
|
|
2084
|
-
const
|
|
2085
|
-
let c, r,
|
|
2086
|
-
const [i = 0,
|
|
2087
|
-
switch (
|
|
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,
|
|
2089
|
+
[c, r, t] = a;
|
|
2090
2090
|
break;
|
|
2091
2091
|
case "isoDate":
|
|
2092
|
-
[
|
|
2092
|
+
[t, r, c] = a;
|
|
2093
2093
|
break;
|
|
2094
2094
|
case "timestamp":
|
|
2095
|
-
[
|
|
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
|
|
2101
|
-
Date.UTC(
|
|
2100
|
+
const m = new Date(
|
|
2101
|
+
Date.UTC(t, r - 1, c, i - s, p, y)
|
|
2102
2102
|
);
|
|
2103
|
-
if (isNaN(
|
|
2104
|
-
return
|
|
2105
|
-
},
|
|
2106
|
-
if (
|
|
2107
|
-
let
|
|
2108
|
-
return
|
|
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
|
|
2111
|
-
},
|
|
2112
|
-
let
|
|
2113
|
-
const
|
|
2114
|
-
return { digits:
|
|
2115
|
-
},
|
|
2116
|
-
const
|
|
2117
|
-
return
|
|
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
|
|
2120
|
-
return
|
|
2119
|
+
function K(_) {
|
|
2120
|
+
return _.length > 10 ? "NINE" : "EIGTH";
|
|
2121
2121
|
}
|
|
2122
|
-
const
|
|
2122
|
+
const w = {
|
|
2123
2123
|
EIGTH: "(99) 9999-9999",
|
|
2124
2124
|
NINE: "(99) 99999-9999"
|
|
2125
|
-
}, H =
|
|
2126
|
-
function
|
|
2127
|
-
let
|
|
2128
|
-
for (let
|
|
2129
|
-
if (
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
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 (
|
|
2135
|
-
|
|
2134
|
+
else if (s < _.length)
|
|
2135
|
+
e += n[a];
|
|
2136
2136
|
else
|
|
2137
2137
|
break;
|
|
2138
|
-
return
|
|
2138
|
+
return e;
|
|
2139
2139
|
}
|
|
2140
|
-
function
|
|
2141
|
-
if (
|
|
2142
|
-
let
|
|
2143
|
-
const
|
|
2144
|
-
return
|
|
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
|
|
2147
|
-
if (
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2146
|
+
let s = n.mask;
|
|
2147
|
+
if (n.prefix) {
|
|
2148
|
+
const a = /\$+/g;
|
|
2149
|
+
s = s.replace(a, n.prefix);
|
|
2150
2150
|
}
|
|
2151
|
-
for (let
|
|
2152
|
-
|
|
2153
|
-
return
|
|
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
|
|
2156
|
-
const
|
|
2157
|
-
(
|
|
2155
|
+
function z(_, n) {
|
|
2156
|
+
const e = N.find(
|
|
2157
|
+
(s) => s.code === _ && s.prefix === n
|
|
2158
2158
|
);
|
|
2159
|
-
if (!
|
|
2160
|
-
if (
|
|
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 (!
|
|
2162
|
+
if (!e.prefix)
|
|
2163
2163
|
throw new Error("Invalid country code or prefix");
|
|
2164
|
-
return
|
|
2164
|
+
return e;
|
|
2165
2165
|
}
|
|
2166
|
-
function J(
|
|
2167
|
-
const
|
|
2168
|
-
if (!
|
|
2169
|
-
if (
|
|
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
|
|
2173
|
-
if (!/^\+\d{1,4}(-\d{1,4})? \d+$/.test(
|
|
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
|
|
2178
|
-
if (!
|
|
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 (
|
|
2181
|
-
const c =
|
|
2182
|
-
return
|
|
2180
|
+
if (s) {
|
|
2181
|
+
const c = z(e, s);
|
|
2182
|
+
return v(a, c);
|
|
2183
2183
|
}
|
|
2184
|
-
const
|
|
2185
|
-
return
|
|
2186
|
-
},
|
|
2187
|
-
for (var
|
|
2188
|
-
|
|
2189
|
-
var
|
|
2190
|
-
return "#" + c + r +
|
|
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
|
|
2194
|
-
l.push((
|
|
2195
|
-
function
|
|
2196
|
-
return (l[n
|
|
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
|
|
2199
|
-
function
|
|
2200
|
-
if (!
|
|
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
|
|
2202
|
+
return d(Y);
|
|
2203
2203
|
}
|
|
2204
|
-
var
|
|
2205
|
-
const
|
|
2206
|
-
randomUUID:
|
|
2204
|
+
var $ = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
2205
|
+
const x = {
|
|
2206
|
+
randomUUID: $
|
|
2207
2207
|
};
|
|
2208
|
-
function
|
|
2209
|
-
if (
|
|
2210
|
-
return
|
|
2211
|
-
|
|
2212
|
-
var
|
|
2213
|
-
return
|
|
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
|
|
2216
|
-
function
|
|
2217
|
-
|
|
2218
|
-
var
|
|
2219
|
-
return c >
|
|
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
|
|
2222
|
-
|
|
2223
|
-
const
|
|
2224
|
-
for (let
|
|
2225
|
-
|
|
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
|
|
2229
|
-
const
|
|
2230
|
-
return { text:
|
|
2228
|
+
function b() {
|
|
2229
|
+
const _ = V();
|
|
2230
|
+
return { text: _, binary: A(_) };
|
|
2231
2231
|
}
|
|
2232
2232
|
function I() {
|
|
2233
|
-
const
|
|
2234
|
-
return { text:
|
|
2233
|
+
const _ = W();
|
|
2234
|
+
return { text: _, binary: A(_) };
|
|
2235
2235
|
}
|
|
2236
|
-
function
|
|
2237
|
-
if (
|
|
2238
|
-
if (
|
|
2239
|
-
if (
|
|
2240
|
-
if (
|
|
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
|
|
2244
|
-
let
|
|
2245
|
-
return
|
|
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
|
|
2248
|
-
const { cashPrice:
|
|
2249
|
-
if (
|
|
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:
|
|
2251
|
+
totalPrice: n,
|
|
2252
|
+
installmentPrice: n / e
|
|
2253
2253
|
};
|
|
2254
|
-
if (
|
|
2254
|
+
if (e <= 0)
|
|
2255
2255
|
throw new Error("Number of installments must be greater than 0");
|
|
2256
|
-
if (
|
|
2256
|
+
if (s < 0)
|
|
2257
2257
|
throw new Error("Fees must be greater than or equal to 0");
|
|
2258
|
-
let
|
|
2259
|
-
return
|
|
2260
|
-
totalPrice: +
|
|
2261
|
-
installmentPrice: +
|
|
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
|
+
installmentPrice: +a.toFixed(2)
|
|
2262
2262
|
};
|
|
2263
|
-
},
|
|
2264
|
-
const
|
|
2265
|
-
return
|
|
2263
|
+
}, i_ = (_) => {
|
|
2264
|
+
const n = _.startsWith("'") && _.endsWith("'"), e = _.startsWith('"') && _.endsWith('"');
|
|
2265
|
+
return n || e ? _ : `"${_}"`;
|
|
2266
2266
|
};
|
|
2267
|
-
function
|
|
2268
|
-
return /<\/?[a-z][\s\S]*>/i.test(
|
|
2267
|
+
function l_(_) {
|
|
2268
|
+
return /<\/?[a-z][\s\S]*>/i.test(_);
|
|
2269
2269
|
}
|
|
2270
|
-
const
|
|
2271
|
-
function a
|
|
2272
|
-
return
|
|
2270
|
+
const u_ = (_, n = ["password", "confirmPassword", "creditCard"]) => {
|
|
2271
|
+
function e(a, o) {
|
|
2272
|
+
return n.includes(a) ? "****" : o;
|
|
2273
2273
|
}
|
|
2274
|
-
function
|
|
2275
|
-
return Array.isArray(
|
|
2276
|
-
let r =
|
|
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
|
+
let r = a[c];
|
|
2277
2277
|
if (typeof r == "string")
|
|
2278
2278
|
try {
|
|
2279
|
-
const
|
|
2280
|
-
typeof
|
|
2279
|
+
const t = JSON.parse(r);
|
|
2280
|
+
typeof t == "object" && (r = JSON.stringify(s(t)));
|
|
2281
2281
|
} catch {
|
|
2282
2282
|
}
|
|
2283
|
-
return
|
|
2284
|
-
}, {}) :
|
|
2283
|
+
return o[c] = s(e(c, r)), o;
|
|
2284
|
+
}, {}) : a;
|
|
2285
2285
|
}
|
|
2286
2286
|
try {
|
|
2287
|
-
const
|
|
2288
|
-
return JSON.stringify(
|
|
2287
|
+
const a = JSON.parse(_), o = s(a);
|
|
2288
|
+
return JSON.stringify(o);
|
|
2289
2289
|
} catch {
|
|
2290
|
-
return
|
|
2290
|
+
return _;
|
|
2291
2291
|
}
|
|
2292
|
-
},
|
|
2293
|
-
function a
|
|
2294
|
-
return typeof
|
|
2292
|
+
}, g_ = (_) => _.replace(/<\/?[^>]+(>|$)/g, ""), m_ = (_, n = 1e3) => {
|
|
2293
|
+
function e(a) {
|
|
2294
|
+
return typeof a == "string" && a.length > n ? `To large information: field as ${a.length} characters` : a;
|
|
2295
2295
|
}
|
|
2296
|
-
function
|
|
2297
|
-
return Array.isArray(
|
|
2298
|
-
Object.entries(
|
|
2299
|
-
|
|
2300
|
-
|
|
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
|
-
) : a
|
|
2303
|
+
) : e(a);
|
|
2304
2304
|
}
|
|
2305
2305
|
try {
|
|
2306
|
-
const
|
|
2307
|
-
return JSON.stringify(
|
|
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
|
-
}, Ln = (n) => {
|
|
2312
|
-
if (!n || !/^[0-9-]+$/.test(n)) return !1;
|
|
2313
|
-
const a = f(n), _ = 8, e = /^\d{8}$/.test(a);
|
|
2314
|
-
return a.length === _ && e;
|
|
2315
|
-
};
|
|
2316
|
-
function j(n) {
|
|
2317
|
-
return n.length !== 14;
|
|
2318
|
-
}
|
|
2319
|
-
function X(n) {
|
|
2320
|
-
const [s] = n;
|
|
2321
|
-
return [...n].every((a) => a === s);
|
|
2322
|
-
}
|
|
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
|
-
}
|
|
2330
|
-
function Q(n) {
|
|
2331
|
-
return n.slice(12);
|
|
2332
|
-
}
|
|
2333
|
-
const wn = (n) => {
|
|
2334
|
-
if (!n) return !1;
|
|
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
|
-
[6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
|
|
2340
|
-
);
|
|
2341
|
-
return Q(s) === `${_}${e}`;
|
|
2342
|
-
};
|
|
2343
|
-
function nn(n) {
|
|
2344
|
-
return n.length !== 11;
|
|
2345
|
-
}
|
|
2346
|
-
function sn(n) {
|
|
2347
|
-
const [s] = n;
|
|
2348
|
-
return [...n].every((a) => a === s);
|
|
2349
|
-
}
|
|
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
|
-
}
|
|
2357
|
-
function an(n) {
|
|
2358
|
-
return n.slice(9);
|
|
2359
|
-
}
|
|
2360
|
-
const Gn = (n) => {
|
|
2361
|
-
if (!n) return !1;
|
|
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
|
-
if (t === "DD/MM/YYYY") {
|
|
2370
|
-
const u = /^(\d{2})\/(\d{2})\/(\d{4})$/;
|
|
2371
|
-
if (!u.test(n)) return !1;
|
|
2372
|
-
[, a, _, e] = 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
|
-
[, _, a, e] = 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
|
-
[, e, _, a] = n.match(u) || [];
|
|
2381
|
-
} else
|
|
2382
|
-
throw new Error("Invalid date format");
|
|
2383
|
-
const o = parseInt(a, 10), i = parseInt(_, 10), m = parseInt(e, 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
|
-
}, 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) => {
|
|
2441
|
-
if (!n) return !1;
|
|
2442
|
-
const s = n.length >= 8, a = /[A-Z]/.test(n), _ = /[a-z]/.test(n), e = /\d/.test(n), t = /[!@#$%^&*(),.?":{}|<>_\-+=~`[\]\\\/]/.test(
|
|
2443
|
-
n
|
|
2444
|
-
);
|
|
2445
|
-
return [
|
|
2446
|
-
s,
|
|
2447
|
-
a,
|
|
2448
|
-
_,
|
|
2449
|
-
e,
|
|
2450
|
-
t
|
|
2451
|
-
].every((c) => c);
|
|
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;
|
|
2457
|
-
continue;
|
|
2458
|
-
}
|
|
2459
|
-
if (new RegExp(`^\\${a}${_} \\d{${e}}$`).test(n)) return !0;
|
|
2460
|
-
}
|
|
2461
|
-
return !1;
|
|
2462
|
-
}, Un = (n) => {
|
|
2463
|
-
if (!n || !/^[0-9a-zA-Z.-]+$/.test(n)) return !1;
|
|
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);
|
|
2466
2311
|
};
|
|
2467
2312
|
export {
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
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
|
|
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
|
|
2500
2337
|
};
|