@jpmorgan-payments/embedded-finance-components 0.5.67 → 0.5.68

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.
@@ -0,0 +1,121 @@
1
+ const m = "[a-fA-F\\d:]", u = (e) => e && e.includeBoundaries ? `(?:(?<=\\s|^)(?=${m})|(?<=${m})(?=\\s|$))` : "", c = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", t = "[a-fA-F\\d]{1,4}", i = `
2
+ (?:
3
+ (?:${t}:){7}(?:${t}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
4
+ (?:${t}:){6}(?:${c}|:${t}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
5
+ (?:${t}:){5}(?::${c}|(?::${t}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
6
+ (?:${t}:){4}(?:(?::${t}){0,1}:${c}|(?::${t}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
7
+ (?:${t}:){3}(?:(?::${t}){0,2}:${c}|(?::${t}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
8
+ (?:${t}:){2}(?:(?::${t}){0,3}:${c}|(?::${t}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
9
+ (?:${t}:){1}(?:(?::${t}){0,4}:${c}|(?::${t}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
10
+ (?::(?:(?::${t}){0,5}:${c}|(?::${t}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
11
+ )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
12
+ `.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), g = new RegExp(`(?:^${c}$)|(?:^${i}$)`), h = new RegExp(`^${c}$`), E = new RegExp(`^${i}$`), p = (e) => e && e.exact ? g : new RegExp(`(?:${u(e)}${c}${u(e)})|(?:${u(e)}${i}${u(e)})`, "g");
13
+ p.v4 = (e) => e && e.exact ? h : new RegExp(`${u(e)}${c}${u(e)}`, "g");
14
+ p.v6 = (e) => e && e.exact ? E : new RegExp(`${u(e)}${i}${u(e)}`, "g");
15
+ function v(e) {
16
+ const n = (...o) => e(...o);
17
+ return Object.defineProperty(n, "name", {
18
+ value: `functionTimeout(${e.name || "<anonymous>"})`,
19
+ configurable: !0
20
+ }), n;
21
+ }
22
+ const { toString: w } = Object.prototype;
23
+ function y(e) {
24
+ return w.call(e) === "[object RegExp]";
25
+ }
26
+ const x = {
27
+ global: "g",
28
+ ignoreCase: "i",
29
+ multiline: "m",
30
+ dotAll: "s",
31
+ sticky: "y",
32
+ unicode: "u"
33
+ };
34
+ function R(e, n = {}) {
35
+ if (!y(e))
36
+ throw new TypeError("Expected a RegExp instance");
37
+ const o = Object.keys(x).map((s) => (typeof n[s] == "boolean" ? n[s] : e[s]) ? x[s] : "").join(""), r = new RegExp(n.source || e.source, o);
38
+ return r.lastIndex = typeof n.lastIndex == "number" ? n.lastIndex : e.lastIndex, r;
39
+ }
40
+ function b(e, n, { timeout: o } = {}) {
41
+ try {
42
+ return v(() => R(e).test(n), { timeout: o })();
43
+ } catch (r) {
44
+ throw r;
45
+ }
46
+ }
47
+ const I = 15, C = {
48
+ timeout: 400
49
+ };
50
+ function F(e) {
51
+ return e.length > I ? !1 : b(p.v4({ exact: !0 }), e, C);
52
+ }
53
+ class L extends Error {
54
+ constructor(n) {
55
+ super("Could not get the public IP address", n), this.name = "IpNotFoundError";
56
+ }
57
+ }
58
+ class f extends Error {
59
+ constructor() {
60
+ super("Request was cancelled"), this.name = "CancelError";
61
+ }
62
+ get isCanceled() {
63
+ return !0;
64
+ }
65
+ }
66
+ const P = {
67
+ timeout: 5e3
68
+ }, T = {
69
+ v4: [
70
+ "https://ipv4.icanhazip.com/",
71
+ "https://api.ipify.org/"
72
+ ],
73
+ v6: [
74
+ "https://ipv6.icanhazip.com/",
75
+ "https://api6.ipify.org/"
76
+ ]
77
+ }, q = (e, n, o) => {
78
+ const r = new XMLHttpRequest();
79
+ let s;
80
+ const $ = new Promise((d, a) => {
81
+ s = a, r.addEventListener("error", a, { once: !0 }), r.addEventListener("timeout", a, { once: !0 }), r.addEventListener("load", () => {
82
+ const l = r.responseText.trim();
83
+ if (!l || !F(l)) {
84
+ a();
85
+ return;
86
+ }
87
+ d(l);
88
+ }, { once: !0 }), r.open("GET", e), r.timeout = n.timeout, r.send();
89
+ });
90
+ return $.cancel = () => {
91
+ r.abort(), s(new f());
92
+ }, $;
93
+ }, A = (e, n) => {
94
+ let o;
95
+ const r = async function() {
96
+ const s = [
97
+ ...T[e],
98
+ ...n.fallbackUrls ?? []
99
+ ];
100
+ let $;
101
+ for (const d of s)
102
+ try {
103
+ return o = q(d, n, e), await o;
104
+ } catch (a) {
105
+ if ($ = a, a instanceof f)
106
+ throw a;
107
+ }
108
+ throw new L({ cause: $ });
109
+ }();
110
+ return r.cancel = () => {
111
+ o.cancel();
112
+ }, r;
113
+ };
114
+ function k(e) {
115
+ return A("v4", { ...P, ...e });
116
+ }
117
+ export {
118
+ f as CancelError,
119
+ L as IpNotFoundError,
120
+ k as publicIpv4
121
+ };