@nice2dev/ui-security 1.1.7 → 1.1.10
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/CHANGELOG.md +59 -0
- package/dist/core/cssColor.d.ts +7 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +868 -827
- package/dist/ui-security.css +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { useContext as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as c, jsxs as P, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as Ee, createContext as Fe, useRef as ee, useState as j, useCallback as G, useEffect as ne, useMemo as ae } from "react";
|
|
3
|
+
const ze = {
|
|
4
4
|
low: 0.7,
|
|
5
5
|
medium: 0.8,
|
|
6
6
|
high: 0.85,
|
|
7
7
|
critical: 0.95
|
|
8
|
-
},
|
|
8
|
+
}, Ne = {
|
|
9
9
|
matchThreshold: 0.85,
|
|
10
10
|
timeout: 3e4,
|
|
11
11
|
maxRetries: 3,
|
|
@@ -18,69 +18,69 @@ const Ee = {
|
|
|
18
18
|
securityLevel: "high",
|
|
19
19
|
antiSpoofing: !0
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
const t = { ...
|
|
23
|
-
return e != null && e.matchThreshold || (t.matchThreshold =
|
|
21
|
+
function fe(e) {
|
|
22
|
+
const t = { ...Ne, ...e };
|
|
23
|
+
return e != null && e.matchThreshold || (t.matchThreshold = ze[t.securityLevel]), t;
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
25
|
+
async function ue(e) {
|
|
26
26
|
const t = new TextEncoder().encode(e), r = await crypto.subtle.digest("SHA-256", t);
|
|
27
27
|
return Array.from(new Uint8Array(r)).map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function ye(e = 8) {
|
|
30
30
|
const t = new Uint8Array(e);
|
|
31
31
|
return crypto.getRandomValues(t), Array.from(t).map((r) => r.toString(36).padStart(2, "0")).join("").slice(0, e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Le(e) {
|
|
34
34
|
const t = new Uint32Array(1);
|
|
35
35
|
return crypto.getRandomValues(t), t[0] % e;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function $e(e, t) {
|
|
38
38
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
39
39
|
}
|
|
40
|
-
async function
|
|
40
|
+
async function pe(e = "user") {
|
|
41
41
|
return navigator.mediaDevices.getUserMedia({
|
|
42
42
|
video: { facingMode: e, width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
43
43
|
audio: !1
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const n = t ?? e.videoWidth,
|
|
48
|
-
|
|
49
|
-
const o =
|
|
50
|
-
o.drawImage(e, 0, 0, n,
|
|
51
|
-
const a = o.getImageData(0, 0, n,
|
|
52
|
-
return { canvas:
|
|
46
|
+
function le(e, t, r) {
|
|
47
|
+
const n = t ?? e.videoWidth, s = r ?? e.videoHeight, i = document.createElement("canvas");
|
|
48
|
+
i.width = n, i.height = s;
|
|
49
|
+
const o = i.getContext("2d");
|
|
50
|
+
o.drawImage(e, 0, 0, n, s);
|
|
51
|
+
const a = o.getImageData(0, 0, n, s);
|
|
52
|
+
return { canvas: i, ctx: o, imageData: a };
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function ce(e) {
|
|
55
55
|
const t = new Uint8Array(e.width * e.height), r = e.data;
|
|
56
56
|
for (let n = 0; n < t.length; n++) {
|
|
57
|
-
const
|
|
58
|
-
t[n] = Math.round(0.299 * r[
|
|
57
|
+
const s = n * 4;
|
|
58
|
+
t[n] = Math.round(0.299 * r[s] + 0.587 * r[s + 1] + 0.114 * r[s + 2]);
|
|
59
59
|
}
|
|
60
60
|
return t;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const n = new Uint8Array(t * r),
|
|
62
|
+
function Ae(e, t, r) {
|
|
63
|
+
const n = new Uint8Array(t * r), s = [1, 2, 1, 2, 4, 2, 1, 2, 1], i = 16;
|
|
64
64
|
for (let o = 1; o < r - 1; o++)
|
|
65
65
|
for (let a = 1; a < t - 1; a++) {
|
|
66
66
|
let g = 0, v = 0;
|
|
67
67
|
for (let f = -1; f <= 1; f++)
|
|
68
68
|
for (let m = -1; m <= 1; m++)
|
|
69
|
-
g += e[(o + f) * t + (a + m)] *
|
|
70
|
-
n[o * t + a] = Math.round(g /
|
|
69
|
+
g += e[(o + f) * t + (a + m)] * s[v++];
|
|
70
|
+
n[o * t + a] = Math.round(g / i);
|
|
71
71
|
}
|
|
72
72
|
return n;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function je(e, t, r) {
|
|
75
75
|
const n = new Uint8Array(t * r);
|
|
76
|
-
for (let
|
|
77
|
-
for (let
|
|
78
|
-
const o = -e[(
|
|
79
|
-
n[
|
|
76
|
+
for (let s = 1; s < r - 1; s++)
|
|
77
|
+
for (let i = 1; i < t - 1; i++) {
|
|
78
|
+
const o = -e[(s - 1) * t + (i - 1)] + e[(s - 1) * t + (i + 1)] + -2 * e[s * t + (i - 1)] + 2 * e[s * t + (i + 1)] + -e[(s + 1) * t + (i - 1)] + e[(s + 1) * t + (i + 1)], a = -e[(s - 1) * t + (i - 1)] - 2 * e[(s - 1) * t + i] - e[(s - 1) * t + (i + 1)] + e[(s + 1) * t + (i - 1)] + 2 * e[(s + 1) * t + i] + e[(s + 1) * t + (i + 1)];
|
|
79
|
+
n[s * t + i] = Math.min(255, Math.round(Math.sqrt(o * o + a * a)));
|
|
80
80
|
}
|
|
81
81
|
return n;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Be(e) {
|
|
84
84
|
const t = new Array(256).fill(0);
|
|
85
85
|
for (const v of e)
|
|
86
86
|
t[v]++;
|
|
@@ -88,30 +88,30 @@ function $e(e) {
|
|
|
88
88
|
let n = 0;
|
|
89
89
|
for (let v = 0; v < 256; v++)
|
|
90
90
|
n += v * t[v];
|
|
91
|
-
let
|
|
91
|
+
let s = 0, i = 0, o = 0, a = 0;
|
|
92
92
|
for (let v = 0; v < 256; v++) {
|
|
93
|
-
if (
|
|
93
|
+
if (i += t[v], i === 0)
|
|
94
94
|
continue;
|
|
95
|
-
const f = r -
|
|
95
|
+
const f = r - i;
|
|
96
96
|
if (f === 0)
|
|
97
97
|
break;
|
|
98
|
-
|
|
99
|
-
const m =
|
|
100
|
-
|
|
98
|
+
s += v * t[v];
|
|
99
|
+
const m = s / i, k = (n - s) / f, y = i * f * (m - k) ** 2;
|
|
100
|
+
y > o && (o = y, a = v);
|
|
101
101
|
}
|
|
102
102
|
const g = new Uint8Array(e.length);
|
|
103
103
|
for (let v = 0; v < e.length; v++)
|
|
104
104
|
g[v] = e[v] > a ? 255 : 0;
|
|
105
105
|
return { threshold: a, binary: g };
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
var
|
|
109
|
-
const r = e.width, n = e.height,
|
|
107
|
+
function _e(e, t = 0.3) {
|
|
108
|
+
var p;
|
|
109
|
+
const r = e.width, n = e.height, s = ce(e), i = Ae(s, r, n), o = je(i, r, n), { binary: a } = Be(o), g = [], v = [], f = [];
|
|
110
110
|
for (let S = 2; S < n - 2; S++)
|
|
111
111
|
for (let u = 2; u < r - 2; u++) {
|
|
112
112
|
if (a[S * r + u] === 0)
|
|
113
113
|
continue;
|
|
114
|
-
const
|
|
114
|
+
const w = [
|
|
115
115
|
a[(S - 1) * r + u],
|
|
116
116
|
a[(S - 1) * r + (u + 1)],
|
|
117
117
|
a[S * r + (u + 1)],
|
|
@@ -122,33 +122,33 @@ function je(e, t = 0.3) {
|
|
|
122
122
|
a[(S - 1) * r + (u - 1)]
|
|
123
123
|
];
|
|
124
124
|
let l = 0;
|
|
125
|
-
for (let
|
|
126
|
-
const H =
|
|
127
|
-
l += Math.abs(H -
|
|
125
|
+
for (let _ = 0; _ < 8; _++) {
|
|
126
|
+
const H = w[_] > 0 ? 1 : 0, J = w[(_ + 1) % 8] > 0 ? 1 : 0;
|
|
127
|
+
l += Math.abs(H - J);
|
|
128
128
|
}
|
|
129
129
|
l /= 2;
|
|
130
130
|
let h = 0, L = 0;
|
|
131
|
-
for (let
|
|
131
|
+
for (let _ = -2; _ <= 2; _++)
|
|
132
132
|
for (let H = -2; H <= 2; H++)
|
|
133
|
-
h += o[(S +
|
|
133
|
+
h += o[(S + _) * r + (u + H)], L++;
|
|
134
134
|
const q = h / L / 255;
|
|
135
135
|
if (q < t)
|
|
136
136
|
continue;
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
const Z = Math.atan2(
|
|
138
|
+
s[(S + 1) * r + u] - s[(S - 1) * r + u],
|
|
139
|
+
s[S * r + (u + 1)] - s[S * r + (u - 1)]
|
|
140
140
|
);
|
|
141
|
-
l === 1 ? g.push({ x: u / r, y: S / n, angle:
|
|
141
|
+
l === 1 ? g.push({ x: u / r, y: S / n, angle: Z, type: "ending", quality: q }) : l === 3 && g.push({ x: u / r, y: S / n, angle: Z, type: "bifurcation", quality: q });
|
|
142
142
|
}
|
|
143
143
|
g.sort((S, u) => u.quality - S.quality);
|
|
144
144
|
const m = g.slice(0, 120);
|
|
145
145
|
if (m.length > 5) {
|
|
146
|
-
const S = m.reduce((
|
|
146
|
+
const S = m.reduce((w, l) => w + l.x, 0) / m.length, u = m.reduce((w, l) => w + l.y, 0) / m.length;
|
|
147
147
|
v.push({ x: S, y: u });
|
|
148
148
|
}
|
|
149
|
-
const k = m.length,
|
|
149
|
+
const k = m.length, y = m.filter((S) => S.type === "ending").length, R = m.filter((S) => S.type === "bifurcation").length / (y + 1);
|
|
150
150
|
let b = "loop-right";
|
|
151
|
-
R > 1.5 ? b = "whorl" : R < 0.5 ? b = "arch" : ((
|
|
151
|
+
R > 1.5 ? b = "whorl" : R < 0.5 ? b = "arch" : ((p = v[0]) == null ? void 0 : p.x) < 0.45 && (b = "loop-left");
|
|
152
152
|
const T = m.length > 20 ? m.reduce((S, u) => S + u.quality, 0) / m.length : 0;
|
|
153
153
|
return {
|
|
154
154
|
minutiae: m,
|
|
@@ -159,31 +159,31 @@ function je(e, t = 0.3) {
|
|
|
159
159
|
quality: T
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function We(e, t) {
|
|
163
163
|
if (e.minutiae.length < 5 || t.minutiae.length < 5)
|
|
164
164
|
return 0;
|
|
165
165
|
let r = 0;
|
|
166
|
-
const n = 0.05,
|
|
166
|
+
const n = 0.05, s = 0.5, i = /* @__PURE__ */ new Set();
|
|
167
167
|
for (const a of e.minutiae) {
|
|
168
168
|
let g = 1 / 0, v = -1;
|
|
169
169
|
for (let f = 0; f < t.minutiae.length; f++) {
|
|
170
|
-
if (
|
|
170
|
+
if (i.has(f))
|
|
171
171
|
continue;
|
|
172
172
|
const m = t.minutiae[f];
|
|
173
173
|
if (a.type !== m.type)
|
|
174
174
|
continue;
|
|
175
|
-
const k =
|
|
176
|
-
k < n &&
|
|
175
|
+
const k = $e(a, m), y = Math.abs(a.angle - m.angle);
|
|
176
|
+
k < n && y < s && k < g && (g = k, v = f);
|
|
177
177
|
}
|
|
178
|
-
v >= 0 && (r++,
|
|
178
|
+
v >= 0 && (r++, i.add(v));
|
|
179
179
|
}
|
|
180
180
|
const o = Math.min(e.minutiae.length, t.minutiae.length);
|
|
181
181
|
return o > 0 ? r / o : 0;
|
|
182
182
|
}
|
|
183
|
-
async function
|
|
184
|
-
const r = JSON.stringify(e), n = await
|
|
183
|
+
async function Ue(e, t) {
|
|
184
|
+
const r = JSON.stringify(e), n = await ue(r);
|
|
185
185
|
return {
|
|
186
|
-
id: `fp_${Date.now()}_${
|
|
186
|
+
id: `fp_${Date.now()}_${ye()}`,
|
|
187
187
|
method: "fingerprint",
|
|
188
188
|
templateData: btoa(r),
|
|
189
189
|
enrolled: Date.now(),
|
|
@@ -191,22 +191,22 @@ async function Be(e, t) {
|
|
|
191
191
|
hash: n
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function He(e) {
|
|
195
195
|
return JSON.parse(atob(e.templateData));
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const r = e.width, n = e.height,
|
|
197
|
+
function Oe(e, t = "left") {
|
|
198
|
+
const r = e.width, n = e.height, s = ce(e), i = Ae(s, r, n);
|
|
199
199
|
let o = { cx: r / 2, cy: n / 2, r: Math.min(r, n) * 0.08, score: 1 / 0 };
|
|
200
200
|
for (let D = Math.round(n * 0.3); D < Math.round(n * 0.7); D += 2)
|
|
201
201
|
for (let R = Math.round(r * 0.3); R < Math.round(r * 0.7); R += 2)
|
|
202
202
|
for (let b = Math.round(Math.min(r, n) * 0.04); b < Math.round(Math.min(r, n) * 0.15); b += 2) {
|
|
203
|
-
let T = 0,
|
|
203
|
+
let T = 0, p = 0;
|
|
204
204
|
for (let l = 0; l < Math.PI * 2; l += 0.3) {
|
|
205
205
|
const h = Math.round(R + b * Math.cos(l)), L = Math.round(D + b * Math.sin(l));
|
|
206
|
-
h >= 0 && h < r && L >= 0 && L < n && (T +=
|
|
206
|
+
h >= 0 && h < r && L >= 0 && L < n && (T += i[L * r + h], p++);
|
|
207
207
|
}
|
|
208
|
-
const S =
|
|
209
|
-
|
|
208
|
+
const S = p > 0 ? T / p : 255, u = i[D * r + R], w = S * 0.5 + u * 0.5;
|
|
209
|
+
w < o.score && (o = { cx: R, cy: D, r: b, score: w });
|
|
210
210
|
}
|
|
211
211
|
const a = o.r * 3, g = {
|
|
212
212
|
cx: o.cx,
|
|
@@ -214,45 +214,45 @@ function Ue(e, t = "left") {
|
|
|
214
214
|
r: Math.min(a, Math.min(r, n) * 0.4)
|
|
215
215
|
}, v = 256, f = [];
|
|
216
216
|
for (let D = 0; D < v; D++) {
|
|
217
|
-
const R = D / v * Math.PI * 2, b = o.r + (g.r - o.r) * 0.5, T = Math.round(o.cx + b * Math.cos(R)),
|
|
218
|
-
if (T >= 0 && T < r &&
|
|
219
|
-
const S = Math.round(o.cx + b * Math.cos(R + 0.1)), u = Math.round(o.cy + b * Math.sin(R + 0.1)),
|
|
220
|
-
f.push(
|
|
217
|
+
const R = D / v * Math.PI * 2, b = o.r + (g.r - o.r) * 0.5, T = Math.round(o.cx + b * Math.cos(R)), p = Math.round(o.cy + b * Math.sin(R));
|
|
218
|
+
if (T >= 0 && T < r && p >= 0 && p < n) {
|
|
219
|
+
const S = Math.round(o.cx + b * Math.cos(R + 0.1)), u = Math.round(o.cy + b * Math.sin(R + 0.1)), w = i[p * r + T], l = S >= 0 && S < r && u >= 0 && u < n ? i[u * r + S] : w;
|
|
220
|
+
f.push(w > l ? 1 : 0);
|
|
221
221
|
} else
|
|
222
222
|
f.push(0);
|
|
223
223
|
}
|
|
224
|
-
const m = f.join(""), k = Math.PI * o.r ** 2,
|
|
224
|
+
const m = f.join(""), k = Math.PI * o.r ** 2, y = Math.min(1, Math.max(0, k / (r * n) * 100));
|
|
225
225
|
return {
|
|
226
226
|
irisCode: m,
|
|
227
227
|
pupil: o,
|
|
228
228
|
iris: g,
|
|
229
|
-
quality:
|
|
229
|
+
quality: y,
|
|
230
230
|
eye: t
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function qe(e, t) {
|
|
234
234
|
if (!e.irisCode || !t.irisCode)
|
|
235
235
|
return 0;
|
|
236
236
|
const r = Math.min(e.irisCode.length, t.irisCode.length);
|
|
237
237
|
if (r === 0)
|
|
238
238
|
return 0;
|
|
239
|
-
let n = 0,
|
|
239
|
+
let n = 0, s = r;
|
|
240
240
|
for (let o = -8; o <= 8; o++) {
|
|
241
241
|
let a = 0;
|
|
242
242
|
for (let g = 0; g < r; g++) {
|
|
243
243
|
const v = (g + o + r) % r;
|
|
244
244
|
e.irisCode[g] !== t.irisCode[v] && a++;
|
|
245
245
|
}
|
|
246
|
-
a <
|
|
246
|
+
a < s && (s = a);
|
|
247
247
|
}
|
|
248
|
-
n =
|
|
249
|
-
const
|
|
250
|
-
return Math.max(0, 1 -
|
|
248
|
+
n = s;
|
|
249
|
+
const i = n / r;
|
|
250
|
+
return Math.max(0, 1 - i * 2.5);
|
|
251
251
|
}
|
|
252
|
-
async function
|
|
253
|
-
const r = JSON.stringify(e), n = await
|
|
252
|
+
async function Ke(e, t) {
|
|
253
|
+
const r = JSON.stringify(e), n = await ue(r);
|
|
254
254
|
return {
|
|
255
|
-
id: `iris_${Date.now()}_${
|
|
255
|
+
id: `iris_${Date.now()}_${ye()}`,
|
|
256
256
|
method: "iris",
|
|
257
257
|
templateData: btoa(r),
|
|
258
258
|
enrolled: Date.now(),
|
|
@@ -260,62 +260,62 @@ async function Oe(e, t) {
|
|
|
260
260
|
hash: n
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Ge(e) {
|
|
264
264
|
return JSON.parse(atob(e.templateData));
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
const t = e.width, r = e.height, n = e.data,
|
|
266
|
+
function he(e) {
|
|
267
|
+
const t = e.width, r = e.height, n = e.data, s = new Uint8Array(t * r);
|
|
268
268
|
for (let u = 0; u < t * r; u++) {
|
|
269
|
-
const
|
|
270
|
-
|
|
269
|
+
const w = u * 4, l = n[w], h = n[w + 1], L = n[w + 2], q = 0.299 * l + 0.587 * h + 0.114 * L, Z = 128 - 0.169 * l - 0.331 * h + 0.5 * L, _ = 128 + 0.5 * l - 0.419 * h - 0.081 * L;
|
|
270
|
+
Z >= 77 && Z <= 127 && _ >= 133 && _ <= 173 && q > 80 && (s[u] = 1);
|
|
271
271
|
}
|
|
272
|
-
let
|
|
272
|
+
let i = t, o = r, a = 0, g = 0, v = 0;
|
|
273
273
|
for (let u = 0; u < r; u++)
|
|
274
|
-
for (let
|
|
275
|
-
|
|
276
|
-
const f = a -
|
|
274
|
+
for (let w = 0; w < t; w++)
|
|
275
|
+
s[u * t + w] && (v++, w < i && (i = w), w > a && (a = w), u < o && (o = u), u > g && (g = u));
|
|
276
|
+
const f = a - i, m = g - o;
|
|
277
277
|
if (f < t * 0.1 || m < r * 0.1)
|
|
278
278
|
return null;
|
|
279
|
-
const k = { x:
|
|
279
|
+
const k = { x: i, y: o, width: f, height: m }, y = [], D = ce(e), R = Math.max(1, Math.floor(f / 8)), b = Math.max(1, Math.floor(m / 16));
|
|
280
280
|
for (let u = 0; u < 16; u++)
|
|
281
|
-
for (let
|
|
282
|
-
const l =
|
|
283
|
-
l < t && h < r ?
|
|
281
|
+
for (let w = 0; w < 8; w++) {
|
|
282
|
+
const l = i + w * R + Math.floor(R / 2), h = o + u * b + Math.floor(b / 2);
|
|
283
|
+
l < t && h < r ? y.push(D[h * t + l] / 255) : y.push(0);
|
|
284
284
|
}
|
|
285
|
-
const T = [],
|
|
285
|
+
const T = [], p = { x: i + f / 2, y: o + m / 2 };
|
|
286
286
|
for (let u = 0; u < 68; u++) {
|
|
287
|
-
const
|
|
287
|
+
const w = u / 68 * Math.PI * 2, l = f * 0.4 * Math.cos(w), h = m * 0.45 * Math.sin(w);
|
|
288
288
|
T.push({
|
|
289
|
-
x: (
|
|
290
|
-
y: (
|
|
289
|
+
x: (p.x + l) / t,
|
|
290
|
+
y: (p.y + h) / r
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
const S = Math.min(1, v / (f * m) * 2);
|
|
294
294
|
return {
|
|
295
|
-
embedding:
|
|
295
|
+
embedding: y,
|
|
296
296
|
boundingBox: k,
|
|
297
297
|
landmarks: T,
|
|
298
298
|
headPose: { yaw: 0, pitch: 0, roll: 0 },
|
|
299
299
|
quality: S
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Te(e, t) {
|
|
303
303
|
if (e.embedding.length !== t.embedding.length)
|
|
304
304
|
return 0;
|
|
305
|
-
let r = 0, n = 0,
|
|
305
|
+
let r = 0, n = 0, s = 0;
|
|
306
306
|
for (let o = 0; o < e.embedding.length; o++)
|
|
307
|
-
r += e.embedding[o] * t.embedding[o], n += e.embedding[o] ** 2,
|
|
308
|
-
const
|
|
309
|
-
return
|
|
307
|
+
r += e.embedding[o] * t.embedding[o], n += e.embedding[o] ** 2, s += t.embedding[o] ** 2;
|
|
308
|
+
const i = Math.sqrt(n) * Math.sqrt(s);
|
|
309
|
+
return i > 0 ? (r / i + 1) / 2 : 0;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
const r =
|
|
313
|
-
return !r || !n ? { similarity: 0, cameraFeatures: r, refFeatures: n } : { similarity:
|
|
311
|
+
function Je(e, t) {
|
|
312
|
+
const r = he(e), n = he(t);
|
|
313
|
+
return !r || !n ? { similarity: 0, cameraFeatures: r, refFeatures: n } : { similarity: Te(r, n), cameraFeatures: r, refFeatures: n };
|
|
314
314
|
}
|
|
315
|
-
async function
|
|
316
|
-
const r = JSON.stringify(e), n = await
|
|
315
|
+
async function Ze(e, t) {
|
|
316
|
+
const r = JSON.stringify(e), n = await ue(r);
|
|
317
317
|
return {
|
|
318
|
-
id: `face_${Date.now()}_${
|
|
318
|
+
id: `face_${Date.now()}_${ye()}`,
|
|
319
319
|
method: "face",
|
|
320
320
|
templateData: btoa(r),
|
|
321
321
|
enrolled: Date.now(),
|
|
@@ -323,7 +323,7 @@ async function Ge(e, t) {
|
|
|
323
323
|
hash: n
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Ye(e) {
|
|
327
327
|
return JSON.parse(atob(e.templateData));
|
|
328
328
|
}
|
|
329
329
|
function It() {
|
|
@@ -334,7 +334,7 @@ function It() {
|
|
|
334
334
|
"turn-right",
|
|
335
335
|
"nod",
|
|
336
336
|
"raise-eyebrows"
|
|
337
|
-
], t = e[
|
|
337
|
+
], t = e[Le(e.length)];
|
|
338
338
|
return { type: t, instruction: {
|
|
339
339
|
blink: "Please blink your eyes",
|
|
340
340
|
smile: "Please smile",
|
|
@@ -344,21 +344,21 @@ function It() {
|
|
|
344
344
|
"raise-eyebrows": "Please raise your eyebrows"
|
|
345
345
|
}[t], completed: !1, confidence: 0 };
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Ie(e, t = 0.02) {
|
|
348
348
|
if (e.length < 2)
|
|
349
349
|
return { isLive: !1, confidence: 0, motionScore: 0 };
|
|
350
350
|
let r = 0;
|
|
351
351
|
for (let o = 1; o < e.length; o++) {
|
|
352
|
-
const a =
|
|
352
|
+
const a = ce(e[o - 1]), g = ce(e[o]);
|
|
353
353
|
let v = 0;
|
|
354
354
|
for (let f = 0; f < a.length; f++)
|
|
355
355
|
v += Math.abs(a[f] - g[f]);
|
|
356
356
|
r += v / (a.length * 255);
|
|
357
357
|
}
|
|
358
|
-
const n = r / (e.length - 1),
|
|
359
|
-
return { isLive:
|
|
358
|
+
const n = r / (e.length - 1), s = n > t, i = Math.min(1, n / (t * 3));
|
|
359
|
+
return { isLive: s, confidence: i, motionScore: n };
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function De() {
|
|
362
362
|
return {
|
|
363
363
|
userAgent: navigator.userAgent,
|
|
364
364
|
platform: navigator.platform,
|
|
@@ -369,15 +369,15 @@ function Te() {
|
|
|
369
369
|
hardwareConcurrency: navigator.hardwareConcurrency ?? 0
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
|
-
async function
|
|
373
|
-
const e =
|
|
374
|
-
return
|
|
372
|
+
async function de() {
|
|
373
|
+
const e = De(), t = JSON.stringify(e);
|
|
374
|
+
return ue(t);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Ce() {
|
|
377
377
|
return typeof window < "u" && !!window.PublicKeyCredential;
|
|
378
378
|
}
|
|
379
|
-
async function
|
|
380
|
-
if (!
|
|
379
|
+
async function Xe() {
|
|
380
|
+
if (!Ce())
|
|
381
381
|
return !1;
|
|
382
382
|
try {
|
|
383
383
|
return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();
|
|
@@ -385,7 +385,7 @@ async function Ze() {
|
|
|
385
385
|
return !1;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
async function
|
|
388
|
+
async function Qe(e) {
|
|
389
389
|
const t = {
|
|
390
390
|
rp: { name: e.rpName, id: e.rpId },
|
|
391
391
|
user: {
|
|
@@ -410,7 +410,7 @@ async function Ye(e) {
|
|
|
410
410
|
};
|
|
411
411
|
return await navigator.credentials.create({ publicKey: t });
|
|
412
412
|
}
|
|
413
|
-
async function
|
|
413
|
+
async function Ve(e) {
|
|
414
414
|
const t = {
|
|
415
415
|
rpId: e.rpId,
|
|
416
416
|
challenge: e.challenge,
|
|
@@ -420,27 +420,38 @@ async function Xe(e) {
|
|
|
420
420
|
};
|
|
421
421
|
return await navigator.credentials.get({ publicKey: t });
|
|
422
422
|
}
|
|
423
|
-
async function
|
|
423
|
+
async function ge(e, t, r) {
|
|
424
424
|
const n = { "Content-Type": "application/json" };
|
|
425
425
|
r && (n.Authorization = `Bearer ${r}`);
|
|
426
|
-
const
|
|
426
|
+
const s = await fetch(e, {
|
|
427
427
|
method: "POST",
|
|
428
428
|
headers: n,
|
|
429
429
|
body: JSON.stringify(t)
|
|
430
430
|
});
|
|
431
|
-
return
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
431
|
+
return s.ok ? s.json() : { verified: !1, message: `Server error: ${s.status}` };
|
|
432
|
+
}
|
|
433
|
+
function re(e, t) {
|
|
434
|
+
var o;
|
|
435
|
+
const r = e.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);
|
|
436
|
+
if (!r)
|
|
437
|
+
return e;
|
|
438
|
+
const n = (o = r[2]) == null ? void 0 : o.trim();
|
|
439
|
+
if (typeof document > "u" || typeof getComputedStyle > "u")
|
|
440
|
+
return n ? re(n) : e;
|
|
441
|
+
const s = typeof Element < "u" && t instanceof Element && t.isConnected ? t : document.documentElement, i = getComputedStyle(s).getPropertyValue(r[1]).trim();
|
|
442
|
+
return i || (n ? re(n, t) : e);
|
|
443
|
+
}
|
|
444
|
+
const et = (e, t) => t, Re = Fe(et), Dt = ({ t: e, children: t }) => /* @__PURE__ */ c(Re.Provider, { value: e, children: t });
|
|
445
|
+
function te() {
|
|
446
|
+
return { t: Ee(Re) };
|
|
447
|
+
}
|
|
448
|
+
const tt = { sm: 200, md: 280, lg: 380 }, Ct = (e) => {
|
|
438
449
|
const {
|
|
439
450
|
mode: t,
|
|
440
451
|
enrolledTemplates: r = [],
|
|
441
452
|
fingerPosition: n = "right-index",
|
|
442
|
-
onEnroll:
|
|
443
|
-
onVerify:
|
|
453
|
+
onEnroll: s,
|
|
454
|
+
onVerify: i,
|
|
444
455
|
onStatusChange: o,
|
|
445
456
|
onError: a,
|
|
446
457
|
className: g,
|
|
@@ -448,71 +459,71 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
448
459
|
label: f,
|
|
449
460
|
showQuality: m = !0,
|
|
450
461
|
showMinutiae: k = !1,
|
|
451
|
-
instructionText:
|
|
462
|
+
instructionText: y,
|
|
452
463
|
cameraFacing: D = "environment",
|
|
453
464
|
...R
|
|
454
|
-
} = e, { t: b } =
|
|
465
|
+
} = e, { t: b } = te(), T = fe(R), p = tt[v], S = ee(null), u = ee(null), w = ee(null), [l, h] = j("idle"), [L, q] = j(0), [Z, _] = j(null), [H, J] = j(0), [W, $] = j(""), B = G(
|
|
455
466
|
(E) => {
|
|
456
467
|
h(E), o == null || o(E);
|
|
457
468
|
},
|
|
458
469
|
[o]
|
|
459
470
|
), F = G(async () => {
|
|
460
471
|
try {
|
|
461
|
-
const E = await
|
|
462
|
-
|
|
472
|
+
const E = await pe(D);
|
|
473
|
+
w.current = E, S.current && (S.current.srcObject = E, await S.current.play()), B("idle"), $(b("security.fingerprint.placeFingerPrompt", "Place your finger on the scanner"));
|
|
463
474
|
} catch (E) {
|
|
464
|
-
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.cameraError", "Camera access denied")),
|
|
475
|
+
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.cameraError", "Camera access denied")), B("error");
|
|
465
476
|
}
|
|
466
|
-
}, [D, b,
|
|
477
|
+
}, [D, b, B, a]), K = G(() => {
|
|
467
478
|
var E;
|
|
468
|
-
(E =
|
|
479
|
+
(E = w.current) == null || E.getTracks().forEach((C) => C.stop()), w.current = null;
|
|
469
480
|
}, []);
|
|
470
|
-
|
|
481
|
+
ne(() => (F(), K), [F, K]);
|
|
471
482
|
const U = G(async () => {
|
|
472
483
|
if (!(!S.current || l === "processing" || l === "success")) {
|
|
473
|
-
|
|
484
|
+
B("scanning"), $(b("security.fingerprint.scanning", "Scanning…"));
|
|
474
485
|
try {
|
|
475
|
-
const { imageData: E } =
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
479
|
-
$(b("security.fingerprint.lowQuality", "Low quality — try again")),
|
|
486
|
+
const { imageData: E } = le(S.current);
|
|
487
|
+
B("processing"), $(b("security.fingerprint.processing", "Processing fingerprint…"));
|
|
488
|
+
const C = _e(E);
|
|
489
|
+
if (_(C), q(C.quality), C.quality < 0.2) {
|
|
490
|
+
$(b("security.fingerprint.lowQuality", "Low quality — try again")), B("idle");
|
|
480
491
|
return;
|
|
481
492
|
}
|
|
482
493
|
if (t === "enroll") {
|
|
483
|
-
const z = await
|
|
484
|
-
|
|
494
|
+
const z = await Ue(C, f ?? n);
|
|
495
|
+
s == null || s(z, C), $(b("security.fingerprint.enrolled", "Fingerprint enrolled successfully")), B("success");
|
|
485
496
|
} else {
|
|
486
497
|
let z = 0;
|
|
487
498
|
for (const d of r) {
|
|
488
|
-
const A =
|
|
499
|
+
const A = He(d), N = We(C, A);
|
|
489
500
|
N > z && (z = N);
|
|
490
501
|
}
|
|
491
|
-
const
|
|
492
|
-
success:
|
|
502
|
+
const I = z >= T.matchThreshold, x = {
|
|
503
|
+
success: I,
|
|
493
504
|
confidence: z,
|
|
494
505
|
method: "fingerprint",
|
|
495
506
|
timestamp: Date.now(),
|
|
496
507
|
duration: 0,
|
|
497
|
-
payload: btoa(JSON.stringify(
|
|
508
|
+
payload: btoa(JSON.stringify(C))
|
|
498
509
|
};
|
|
499
|
-
if (
|
|
500
|
-
const d = await
|
|
510
|
+
if (I && T.verifyEndpoint) {
|
|
511
|
+
const d = await de(), A = await ge(
|
|
501
512
|
T.verifyEndpoint,
|
|
502
513
|
{
|
|
503
514
|
method: "fingerprint",
|
|
504
|
-
templateData:
|
|
515
|
+
templateData: x.payload,
|
|
505
516
|
matchScore: z,
|
|
506
517
|
deviceFingerprint: d
|
|
507
518
|
},
|
|
508
519
|
T.authToken
|
|
509
520
|
);
|
|
510
|
-
|
|
521
|
+
x.success = A.verified;
|
|
511
522
|
}
|
|
512
|
-
|
|
523
|
+
x.success ? ($(b("security.fingerprint.verified", "Fingerprint verified")), B("success")) : (J((d) => d + 1), H + 1 >= T.maxRetries ? ($(b("security.fingerprint.maxAttempts", "Maximum attempts reached")), B("failure")) : ($(b("security.fingerprint.noMatch", "No match — try again")), B("idle"))), i == null || i(x);
|
|
513
524
|
}
|
|
514
525
|
} catch (E) {
|
|
515
|
-
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.error", "Scan error — try again")),
|
|
526
|
+
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.error", "Scan error — try again")), B("error");
|
|
516
527
|
}
|
|
517
528
|
}
|
|
518
529
|
}, [
|
|
@@ -521,41 +532,45 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
521
532
|
r,
|
|
522
533
|
T,
|
|
523
534
|
b,
|
|
524
|
-
|
|
525
|
-
i,
|
|
535
|
+
B,
|
|
526
536
|
s,
|
|
537
|
+
i,
|
|
527
538
|
a,
|
|
528
539
|
f,
|
|
529
540
|
n,
|
|
530
541
|
H
|
|
531
542
|
]);
|
|
532
|
-
|
|
533
|
-
if (!k || !
|
|
543
|
+
ne(() => {
|
|
544
|
+
if (!k || !Z || !u.current)
|
|
534
545
|
return;
|
|
535
546
|
const E = u.current.getContext("2d");
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
547
|
+
if (!E)
|
|
548
|
+
return;
|
|
549
|
+
E.clearRect(0, 0, p, p);
|
|
550
|
+
const C = re("var(--nice-success, #10b981)", E.canvas), z = re("var(--nice-warning, #f59e0b)", E.canvas);
|
|
551
|
+
Z.minutiae.forEach((I) => {
|
|
552
|
+
E.beginPath(), E.arc(I.x * p, I.y * p, 2, 0, Math.PI * 2), E.fillStyle = I.type === "ending" ? C : z, E.fill(), E.beginPath(), E.moveTo(I.x * p, I.y * p), E.lineTo(I.x * p + Math.cos(I.angle) * 8, I.y * p + Math.sin(I.angle) * 8), E.strokeStyle = E.fillStyle, E.lineWidth = 1, E.stroke();
|
|
553
|
+
});
|
|
554
|
+
}, [Z, k, p]);
|
|
555
|
+
const Q = l === "success" ? "var(--security-success)" : l === "failure" || l === "error" ? "var(--security-error)" : l === "scanning" || l === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
556
|
+
return /* @__PURE__ */ P(
|
|
542
557
|
"div",
|
|
543
558
|
{
|
|
544
559
|
className: g,
|
|
545
560
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
546
561
|
children: [
|
|
547
562
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
548
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ P(
|
|
549
564
|
"div",
|
|
550
565
|
{
|
|
551
566
|
style: {
|
|
552
|
-
width:
|
|
553
|
-
height:
|
|
567
|
+
width: p,
|
|
568
|
+
height: p,
|
|
554
569
|
position: "relative",
|
|
555
570
|
borderRadius: "var(--security-radius-lg)",
|
|
556
571
|
overflow: "hidden",
|
|
557
|
-
border: `3px solid ${
|
|
558
|
-
boxShadow: l === "scanning" ? `0 0 20px ${
|
|
572
|
+
border: `3px solid ${Q}`,
|
|
573
|
+
boxShadow: l === "scanning" ? `0 0 20px ${Q}` : "var(--security-shadow)",
|
|
559
574
|
transition: "border-color 0.3s, box-shadow 0.3s"
|
|
560
575
|
},
|
|
561
576
|
children: [
|
|
@@ -572,12 +587,12 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
572
587
|
"canvas",
|
|
573
588
|
{
|
|
574
589
|
ref: u,
|
|
575
|
-
width:
|
|
576
|
-
height:
|
|
590
|
+
width: p,
|
|
591
|
+
height: p,
|
|
577
592
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
578
593
|
}
|
|
579
594
|
),
|
|
580
|
-
/* @__PURE__ */
|
|
595
|
+
/* @__PURE__ */ P(
|
|
581
596
|
"svg",
|
|
582
597
|
{
|
|
583
598
|
viewBox: "0 0 100 100",
|
|
@@ -638,7 +653,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
638
653
|
height: 60,
|
|
639
654
|
borderRadius: "50%",
|
|
640
655
|
border: "3px solid transparent",
|
|
641
|
-
borderTopColor:
|
|
656
|
+
borderTopColor: Q,
|
|
642
657
|
animation: "spin 0.8s linear infinite"
|
|
643
658
|
}
|
|
644
659
|
}
|
|
@@ -652,7 +667,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
652
667
|
"div",
|
|
653
668
|
{
|
|
654
669
|
style: {
|
|
655
|
-
width:
|
|
670
|
+
width: p,
|
|
656
671
|
height: 4,
|
|
657
672
|
background: "var(--security-bg-panel)",
|
|
658
673
|
borderRadius: 2,
|
|
@@ -680,7 +695,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
680
695
|
textAlign: "center",
|
|
681
696
|
minHeight: 20
|
|
682
697
|
},
|
|
683
|
-
children:
|
|
698
|
+
children: y ?? W
|
|
684
699
|
}
|
|
685
700
|
),
|
|
686
701
|
l !== "success" && l !== "failure" && /* @__PURE__ */ c(
|
|
@@ -693,20 +708,20 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
693
708
|
fontSize: 14,
|
|
694
709
|
fontWeight: 600,
|
|
695
710
|
background: "var(--security-biometric)",
|
|
696
|
-
color: "var(--nice-
|
|
711
|
+
color: "var(--nice-text-on-primary, #fff)",
|
|
697
712
|
border: "none",
|
|
698
713
|
borderRadius: "var(--security-radius)",
|
|
699
714
|
cursor: "pointer",
|
|
700
715
|
opacity: l === "scanning" || l === "processing" ? 0.6 : 1
|
|
701
716
|
},
|
|
702
|
-
children: t === "enroll" ? b("security.fingerprint.captureBtn", "
|
|
717
|
+
children: t === "enroll" ? b("security.fingerprint.captureBtn", "Capture Fingerprint") : b("security.fingerprint.verifyBtn", "Verify Fingerprint")
|
|
703
718
|
}
|
|
704
719
|
),
|
|
705
720
|
(l === "failure" || l === "error") && /* @__PURE__ */ c(
|
|
706
721
|
"button",
|
|
707
722
|
{
|
|
708
723
|
onClick: () => {
|
|
709
|
-
|
|
724
|
+
J(0), B("idle"), $("");
|
|
710
725
|
},
|
|
711
726
|
style: {
|
|
712
727
|
padding: "8px 20px",
|
|
@@ -724,13 +739,13 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
724
739
|
]
|
|
725
740
|
}
|
|
726
741
|
);
|
|
727
|
-
},
|
|
742
|
+
}, rt = { sm: 220, md: 300, lg: 400 }, Rt = (e) => {
|
|
728
743
|
const {
|
|
729
744
|
mode: t,
|
|
730
745
|
enrolledTemplates: r = [],
|
|
731
746
|
eye: n = "right",
|
|
732
|
-
onEnroll:
|
|
733
|
-
onVerify:
|
|
747
|
+
onEnroll: s,
|
|
748
|
+
onVerify: i,
|
|
734
749
|
onStatusChange: o,
|
|
735
750
|
onError: a,
|
|
736
751
|
className: g,
|
|
@@ -738,106 +753,106 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
738
753
|
label: f,
|
|
739
754
|
showQuality: m = !0,
|
|
740
755
|
showSegmentation: k = !0,
|
|
741
|
-
showGuide:
|
|
756
|
+
showGuide: y = !0,
|
|
742
757
|
instructionText: D,
|
|
743
758
|
...R
|
|
744
|
-
} = e, { t: b } =
|
|
745
|
-
(
|
|
746
|
-
L(
|
|
759
|
+
} = e, { t: b } = te(), T = fe(R), p = rt[v], S = ee(null), u = ee(null), w = ee(null), l = ee([]), [h, L] = j("idle"), [q, Z] = j(0), [_, H] = j(null), [J, W] = j(0), [$, B] = j(""), F = G(
|
|
760
|
+
(C) => {
|
|
761
|
+
L(C), o == null || o(C);
|
|
747
762
|
},
|
|
748
763
|
[o]
|
|
749
764
|
), K = G(async () => {
|
|
750
765
|
try {
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
} catch (
|
|
754
|
-
a == null || a(
|
|
766
|
+
const C = await pe("user");
|
|
767
|
+
w.current = C, S.current && (S.current.srcObject = C, await S.current.play()), F("idle"), B(b("security.iris.alignEyePrompt", "Align your eye with the circle"));
|
|
768
|
+
} catch (C) {
|
|
769
|
+
a == null || a(C instanceof Error ? C : new Error(String(C))), B(b("security.iris.cameraError", "Camera access denied")), F("error");
|
|
755
770
|
}
|
|
756
771
|
}, [b, F, a]), U = G(() => {
|
|
757
|
-
var
|
|
758
|
-
(
|
|
772
|
+
var C;
|
|
773
|
+
(C = w.current) == null || C.getTracks().forEach((z) => z.stop()), w.current = null;
|
|
759
774
|
}, []);
|
|
760
|
-
|
|
761
|
-
const
|
|
775
|
+
ne(() => (K(), U), [K, U]);
|
|
776
|
+
const Q = G(async () => {
|
|
762
777
|
if (!(!S.current || h === "processing" || h === "success")) {
|
|
763
|
-
F("scanning"),
|
|
778
|
+
F("scanning"), B(b("security.iris.scanning", "Scanning iris…"));
|
|
764
779
|
try {
|
|
765
|
-
const
|
|
766
|
-
for (let
|
|
767
|
-
const { imageData: d } =
|
|
768
|
-
|
|
780
|
+
const C = [];
|
|
781
|
+
for (let x = 0; x < 5; x++) {
|
|
782
|
+
const { imageData: d } = le(S.current);
|
|
783
|
+
C.push(d), await new Promise((A) => setTimeout(A, 200));
|
|
769
784
|
}
|
|
770
|
-
if (l.current =
|
|
771
|
-
|
|
785
|
+
if (l.current = C, T.livenessDetection && !Ie(C).isLive) {
|
|
786
|
+
B(
|
|
772
787
|
b("security.iris.notLive", "Liveness check failed — please blink or move slightly")
|
|
773
788
|
), F("idle");
|
|
774
789
|
return;
|
|
775
790
|
}
|
|
776
|
-
F("processing"),
|
|
777
|
-
const z =
|
|
778
|
-
if (!
|
|
779
|
-
|
|
791
|
+
F("processing"), B(b("security.iris.processing", "Processing iris pattern…"));
|
|
792
|
+
const z = C[C.length - 1], I = Oe(z, n === "both" ? "left" : n);
|
|
793
|
+
if (!I) {
|
|
794
|
+
B(b("security.iris.noIrisDetected", "No iris detected — adjust position")), F("idle");
|
|
780
795
|
return;
|
|
781
796
|
}
|
|
782
|
-
if (H(
|
|
783
|
-
|
|
797
|
+
if (H(I), Z(I.quality), I.quality < 0.1) {
|
|
798
|
+
B(b("security.iris.lowQuality", "Low quality — move closer")), F("idle");
|
|
784
799
|
return;
|
|
785
800
|
}
|
|
786
801
|
if (k && u.current) {
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
|
|
790
|
-
const d =
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
802
|
+
const x = u.current.getContext("2d");
|
|
803
|
+
if (x) {
|
|
804
|
+
x.clearRect(0, 0, p, p);
|
|
805
|
+
const d = p / z.width, A = p / z.height;
|
|
806
|
+
x.beginPath(), x.arc(
|
|
807
|
+
I.pupil.cx * d,
|
|
808
|
+
I.pupil.cy * A,
|
|
809
|
+
I.pupil.r * d,
|
|
795
810
|
0,
|
|
796
811
|
Math.PI * 2
|
|
797
|
-
),
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
812
|
+
), x.strokeStyle = re("var(--nice-danger, #ef4444)", x.canvas), x.lineWidth = 2, x.stroke(), x.beginPath(), x.arc(
|
|
813
|
+
I.iris.cx * d,
|
|
814
|
+
I.iris.cy * A,
|
|
815
|
+
I.iris.r * d,
|
|
801
816
|
0,
|
|
802
817
|
Math.PI * 2
|
|
803
|
-
),
|
|
818
|
+
), x.strokeStyle = re("var(--nice-primary, #3b82f6)", x.canvas), x.lineWidth = 2, x.stroke();
|
|
804
819
|
}
|
|
805
820
|
}
|
|
806
821
|
if (t === "enroll") {
|
|
807
|
-
const
|
|
808
|
-
|
|
822
|
+
const x = await Ke(I, f ?? `${n} eye`);
|
|
823
|
+
s == null || s(x, I), B(b("security.iris.enrolled", "Iris enrolled successfully")), F("success");
|
|
809
824
|
} else {
|
|
810
|
-
let
|
|
825
|
+
let x = 0;
|
|
811
826
|
for (const N of r) {
|
|
812
|
-
const
|
|
813
|
-
O >
|
|
827
|
+
const M = Ge(N), O = qe(I, M);
|
|
828
|
+
O > x && (x = O);
|
|
814
829
|
}
|
|
815
|
-
const d =
|
|
830
|
+
const d = x >= T.matchThreshold, A = {
|
|
816
831
|
success: d,
|
|
817
|
-
confidence:
|
|
832
|
+
confidence: x,
|
|
818
833
|
method: "iris",
|
|
819
834
|
timestamp: Date.now(),
|
|
820
835
|
duration: 0,
|
|
821
836
|
livenessPassed: T.livenessDetection ? !0 : void 0,
|
|
822
|
-
payload: btoa(JSON.stringify(
|
|
837
|
+
payload: btoa(JSON.stringify(I))
|
|
823
838
|
};
|
|
824
839
|
if (d && T.verifyEndpoint) {
|
|
825
|
-
const N = await
|
|
840
|
+
const N = await de(), M = await ge(
|
|
826
841
|
T.verifyEndpoint,
|
|
827
842
|
{
|
|
828
843
|
method: "iris",
|
|
829
844
|
templateData: A.payload,
|
|
830
|
-
matchScore:
|
|
845
|
+
matchScore: x,
|
|
831
846
|
deviceFingerprint: N
|
|
832
847
|
},
|
|
833
848
|
T.authToken
|
|
834
849
|
);
|
|
835
|
-
A.success =
|
|
850
|
+
A.success = M.verified;
|
|
836
851
|
}
|
|
837
|
-
A.success ? (
|
|
852
|
+
A.success ? (B(b("security.iris.verified", "Iris verified")), F("success")) : (W((N) => N + 1), J + 1 >= T.maxRetries ? (B(b("security.iris.maxAttempts", "Maximum attempts reached")), F("failure")) : (B(b("security.iris.noMatch", "No match — try again")), F("idle"))), i == null || i(A);
|
|
838
853
|
}
|
|
839
|
-
} catch (
|
|
840
|
-
a == null || a(
|
|
854
|
+
} catch (C) {
|
|
855
|
+
a == null || a(C instanceof Error ? C : new Error(String(C))), B(b("security.iris.error", "Scan error")), F("error");
|
|
841
856
|
}
|
|
842
857
|
}
|
|
843
858
|
}, [
|
|
@@ -847,28 +862,28 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
847
862
|
T,
|
|
848
863
|
b,
|
|
849
864
|
F,
|
|
850
|
-
i,
|
|
851
865
|
s,
|
|
866
|
+
i,
|
|
852
867
|
a,
|
|
853
868
|
f,
|
|
854
869
|
n,
|
|
855
|
-
|
|
870
|
+
J,
|
|
856
871
|
k,
|
|
857
|
-
|
|
872
|
+
p
|
|
858
873
|
]), E = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
859
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ P(
|
|
860
875
|
"div",
|
|
861
876
|
{
|
|
862
877
|
className: g,
|
|
863
878
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
864
879
|
children: [
|
|
865
880
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
866
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ P(
|
|
867
882
|
"div",
|
|
868
883
|
{
|
|
869
884
|
style: {
|
|
870
|
-
width:
|
|
871
|
-
height:
|
|
885
|
+
width: p,
|
|
886
|
+
height: p,
|
|
872
887
|
position: "relative",
|
|
873
888
|
borderRadius: "50%",
|
|
874
889
|
overflow: "hidden",
|
|
@@ -890,12 +905,12 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
890
905
|
"canvas",
|
|
891
906
|
{
|
|
892
907
|
ref: u,
|
|
893
|
-
width:
|
|
894
|
-
height:
|
|
908
|
+
width: p,
|
|
909
|
+
height: p,
|
|
895
910
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
896
911
|
}
|
|
897
912
|
),
|
|
898
|
-
|
|
913
|
+
y && h === "idle" && /* @__PURE__ */ P(
|
|
899
914
|
"svg",
|
|
900
915
|
{
|
|
901
916
|
viewBox: "0 0 100 100",
|
|
@@ -954,7 +969,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
954
969
|
"div",
|
|
955
970
|
{
|
|
956
971
|
style: {
|
|
957
|
-
width:
|
|
972
|
+
width: p * 0.7,
|
|
958
973
|
height: 3,
|
|
959
974
|
background: E,
|
|
960
975
|
animation: "irisLineAnim 1.5s ease-in-out infinite",
|
|
@@ -984,7 +999,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
984
999
|
"div",
|
|
985
1000
|
{
|
|
986
1001
|
style: {
|
|
987
|
-
width:
|
|
1002
|
+
width: p * 0.6,
|
|
988
1003
|
height: 4,
|
|
989
1004
|
background: "var(--security-bg-panel)",
|
|
990
1005
|
borderRadius: 2,
|
|
@@ -1018,27 +1033,27 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1018
1033
|
h !== "success" && h !== "failure" && /* @__PURE__ */ c(
|
|
1019
1034
|
"button",
|
|
1020
1035
|
{
|
|
1021
|
-
onClick:
|
|
1036
|
+
onClick: Q,
|
|
1022
1037
|
disabled: h === "scanning" || h === "processing",
|
|
1023
1038
|
style: {
|
|
1024
1039
|
padding: "10px 24px",
|
|
1025
1040
|
fontSize: 14,
|
|
1026
1041
|
fontWeight: 600,
|
|
1027
1042
|
background: "var(--security-biometric)",
|
|
1028
|
-
color: "var(--nice-
|
|
1043
|
+
color: "var(--nice-text-on-primary, #fff)",
|
|
1029
1044
|
border: "none",
|
|
1030
1045
|
borderRadius: "var(--security-radius)",
|
|
1031
1046
|
cursor: "pointer",
|
|
1032
1047
|
opacity: h === "scanning" || h === "processing" ? 0.6 : 1
|
|
1033
1048
|
},
|
|
1034
|
-
children: t === "enroll" ? b("security.iris.captureBtn", "
|
|
1049
|
+
children: t === "enroll" ? b("security.iris.captureBtn", "Capture Iris") : b("security.iris.verifyBtn", "Verify Iris")
|
|
1035
1050
|
}
|
|
1036
1051
|
),
|
|
1037
1052
|
(h === "failure" || h === "error") && /* @__PURE__ */ c(
|
|
1038
1053
|
"button",
|
|
1039
1054
|
{
|
|
1040
1055
|
onClick: () => {
|
|
1041
|
-
W(0), F("idle"),
|
|
1056
|
+
W(0), F("idle"), B("");
|
|
1042
1057
|
},
|
|
1043
1058
|
style: {
|
|
1044
1059
|
padding: "8px 20px",
|
|
@@ -1054,20 +1069,20 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1054
1069
|
),
|
|
1055
1070
|
/* @__PURE__ */ c("style", { children: `
|
|
1056
1071
|
@keyframes irisLineAnim {
|
|
1057
|
-
0%, 100% { transform: translateY(-${
|
|
1058
|
-
50% { transform: translateY(${
|
|
1072
|
+
0%, 100% { transform: translateY(-${p * 0.3}px); opacity: 0.3; }
|
|
1073
|
+
50% { transform: translateY(${p * 0.3}px); opacity: 0.8; }
|
|
1059
1074
|
}
|
|
1060
1075
|
` })
|
|
1061
1076
|
]
|
|
1062
1077
|
}
|
|
1063
1078
|
);
|
|
1064
|
-
},
|
|
1079
|
+
}, nt = { sm: 240, md: 320, lg: 440 }, Mt = (e) => {
|
|
1065
1080
|
const {
|
|
1066
1081
|
mode: t,
|
|
1067
1082
|
enrolledTemplates: r = [],
|
|
1068
1083
|
referencePhoto: n,
|
|
1069
|
-
onEnroll:
|
|
1070
|
-
onVerify:
|
|
1084
|
+
onEnroll: s,
|
|
1085
|
+
onVerify: i,
|
|
1071
1086
|
onStatusChange: o,
|
|
1072
1087
|
onError: a,
|
|
1073
1088
|
className: g,
|
|
@@ -1075,122 +1090,125 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1075
1090
|
label: f,
|
|
1076
1091
|
showQuality: m = !0,
|
|
1077
1092
|
showBoundingBox: k = !0,
|
|
1078
|
-
livenessSteps:
|
|
1093
|
+
livenessSteps: y = 1,
|
|
1079
1094
|
showReference: D = !0,
|
|
1080
1095
|
instructionText: R,
|
|
1081
1096
|
...b
|
|
1082
|
-
} = e, { t: T } =
|
|
1083
|
-
(
|
|
1084
|
-
L(
|
|
1097
|
+
} = e, { t: T } = te(), p = fe(b), S = nt[v], u = ee(null), w = ee(null), l = ee(null), [h, L] = j("idle"), [q, Z] = j(0), [_, H] = j(0), [J, W] = j(""), [$, B] = j(null), [F, K] = j(0), U = G(
|
|
1098
|
+
(x) => {
|
|
1099
|
+
L(x), o == null || o(x);
|
|
1085
1100
|
},
|
|
1086
1101
|
[o]
|
|
1087
|
-
),
|
|
1102
|
+
), Q = G(async () => {
|
|
1088
1103
|
try {
|
|
1089
|
-
const
|
|
1090
|
-
l.current =
|
|
1091
|
-
} catch (
|
|
1092
|
-
a == null || a(
|
|
1104
|
+
const x = await pe("user");
|
|
1105
|
+
l.current = x, u.current && (u.current.srcObject = x, await u.current.play()), U("idle"), W(T("security.face.lookAtCamera", "Look at the camera"));
|
|
1106
|
+
} catch (x) {
|
|
1107
|
+
a == null || a(x instanceof Error ? x : new Error(String(x))), W(T("security.face.cameraError", "Camera access denied")), U("error");
|
|
1093
1108
|
}
|
|
1094
1109
|
}, [T, U, a]), E = G(() => {
|
|
1095
|
-
var
|
|
1096
|
-
(
|
|
1110
|
+
var x;
|
|
1111
|
+
(x = l.current) == null || x.getTracks().forEach((d) => d.stop()), l.current = null;
|
|
1097
1112
|
}, []);
|
|
1098
|
-
|
|
1099
|
-
const
|
|
1100
|
-
(
|
|
1101
|
-
var
|
|
1102
|
-
const d = (
|
|
1113
|
+
ne(() => (Q(), E), [Q, E]);
|
|
1114
|
+
const C = G(
|
|
1115
|
+
(x) => {
|
|
1116
|
+
var ie, ve, be;
|
|
1117
|
+
const d = (ie = w.current) == null ? void 0 : ie.getContext("2d");
|
|
1103
1118
|
if (!d)
|
|
1104
1119
|
return;
|
|
1105
|
-
const A =
|
|
1106
|
-
if (d.clearRect(0, 0, A, N), !
|
|
1120
|
+
const A = w.current.width, N = w.current.height;
|
|
1121
|
+
if (d.clearRect(0, 0, A, N), !x || !k)
|
|
1107
1122
|
return;
|
|
1108
|
-
const
|
|
1109
|
-
d.strokeStyle =
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
[
|
|
1115
|
-
|
|
1123
|
+
const M = x.boundingBox, O = A / (((ve = u.current) == null ? void 0 : ve.videoWidth) ?? A), Y = N / (((be = u.current) == null ? void 0 : be.videoHeight) ?? N);
|
|
1124
|
+
d.strokeStyle = re(
|
|
1125
|
+
h === "success" ? "var(--nice-success, #10b981)" : "var(--nice-primary, #3b82f6)",
|
|
1126
|
+
d.canvas
|
|
1127
|
+
), d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(M.x * O, M.y * Y, M.width * O, M.height * Y), d.setLineDash([]);
|
|
1128
|
+
const V = [
|
|
1129
|
+
[M.x * O, M.y * Y],
|
|
1130
|
+
[(M.x + M.width) * O, M.y * Y],
|
|
1131
|
+
[M.x * O, (M.y + M.height) * Y],
|
|
1132
|
+
[(M.x + M.width) * O, (M.y + M.height) * Y]
|
|
1133
|
+
], X = 12;
|
|
1116
1134
|
d.lineWidth = 3;
|
|
1117
|
-
for (const [
|
|
1118
|
-
d.beginPath(), d.moveTo(
|
|
1135
|
+
for (const [se, oe] of V)
|
|
1136
|
+
d.beginPath(), d.moveTo(se === M.x * O ? se : se - X, oe), d.lineTo(se, oe), d.lineTo(se, oe === M.y * Y ? oe + X : oe - X), d.stroke();
|
|
1119
1137
|
},
|
|
1120
1138
|
[k, h]
|
|
1121
1139
|
), z = G(async () => {
|
|
1122
1140
|
if (!(!u.current || h === "processing" || h === "success")) {
|
|
1123
1141
|
U("scanning"), W(T("security.face.scanning", "Scanning face…"));
|
|
1124
1142
|
try {
|
|
1125
|
-
if (
|
|
1143
|
+
if (p.livenessDetection) {
|
|
1126
1144
|
const A = [];
|
|
1127
|
-
for (let
|
|
1128
|
-
A.push(
|
|
1129
|
-
if (!
|
|
1145
|
+
for (let M = 0; M < 8; M++)
|
|
1146
|
+
A.push(le(u.current).imageData), await new Promise((O) => setTimeout(O, 200));
|
|
1147
|
+
if (!Ie(A).isLive) {
|
|
1130
1148
|
W(T("security.face.notLive", "Liveness check failed — move naturally")), U("idle");
|
|
1131
1149
|
return;
|
|
1132
1150
|
}
|
|
1133
1151
|
}
|
|
1134
1152
|
U("processing"), W(T("security.face.processing", "Analysing face…"));
|
|
1135
|
-
const { imageData:
|
|
1153
|
+
const { imageData: x } = le(u.current);
|
|
1136
1154
|
if (t === "compare" && n) {
|
|
1137
|
-
const A = typeof n == "string" ? await
|
|
1155
|
+
const A = typeof n == "string" ? await it(n) : st(n), {
|
|
1138
1156
|
similarity: N,
|
|
1139
|
-
cameraFeatures:
|
|
1157
|
+
cameraFeatures: M,
|
|
1140
1158
|
refFeatures: O
|
|
1141
|
-
} =
|
|
1142
|
-
K(N),
|
|
1143
|
-
const
|
|
1144
|
-
success: N >=
|
|
1159
|
+
} = Je(x, A);
|
|
1160
|
+
K(N), Z((M == null ? void 0 : M.quality) ?? 0), C(M);
|
|
1161
|
+
const V = {
|
|
1162
|
+
success: N >= p.matchThreshold,
|
|
1145
1163
|
confidence: N,
|
|
1146
1164
|
method: "face",
|
|
1147
1165
|
timestamp: Date.now(),
|
|
1148
1166
|
duration: 0,
|
|
1149
|
-
livenessPassed:
|
|
1167
|
+
livenessPassed: p.livenessDetection
|
|
1150
1168
|
};
|
|
1151
|
-
|
|
1169
|
+
V.success ? (W(T("security.face.matchFound", `Match: ${(N * 100).toFixed(0)}%`)), U("success")) : (H((X) => X + 1), _ + 1 >= p.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), i == null || i(V);
|
|
1152
1170
|
return;
|
|
1153
1171
|
}
|
|
1154
|
-
const d =
|
|
1172
|
+
const d = he(x);
|
|
1155
1173
|
if (!d) {
|
|
1156
1174
|
W(T("security.face.noFaceDetected", "No face detected")), U("idle");
|
|
1157
1175
|
return;
|
|
1158
1176
|
}
|
|
1159
|
-
if (
|
|
1160
|
-
const A = await
|
|
1161
|
-
|
|
1177
|
+
if (Z(d.quality), C(d), t === "enroll") {
|
|
1178
|
+
const A = await Ze(d, f ?? "face");
|
|
1179
|
+
s == null || s(A, d), W(T("security.face.enrolled", "Face enrolled successfully")), U("success");
|
|
1162
1180
|
} else {
|
|
1163
1181
|
let A = 0;
|
|
1164
1182
|
for (const O of r) {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1183
|
+
const Y = Ye(O), V = Te(d, Y);
|
|
1184
|
+
V > A && (A = V);
|
|
1167
1185
|
}
|
|
1168
1186
|
K(A);
|
|
1169
|
-
const N = A >=
|
|
1187
|
+
const N = A >= p.matchThreshold, M = {
|
|
1170
1188
|
success: N,
|
|
1171
1189
|
confidence: A,
|
|
1172
1190
|
method: "face",
|
|
1173
1191
|
timestamp: Date.now(),
|
|
1174
1192
|
duration: 0,
|
|
1175
|
-
livenessPassed:
|
|
1193
|
+
livenessPassed: p.livenessDetection
|
|
1176
1194
|
};
|
|
1177
|
-
if (N &&
|
|
1178
|
-
const O = await
|
|
1179
|
-
|
|
1195
|
+
if (N && p.verifyEndpoint) {
|
|
1196
|
+
const O = await de(), Y = await ge(
|
|
1197
|
+
p.verifyEndpoint,
|
|
1180
1198
|
{
|
|
1181
1199
|
method: "face",
|
|
1182
1200
|
templateData: btoa(JSON.stringify(d)),
|
|
1183
1201
|
matchScore: A,
|
|
1184
1202
|
deviceFingerprint: O
|
|
1185
1203
|
},
|
|
1186
|
-
|
|
1204
|
+
p.authToken
|
|
1187
1205
|
);
|
|
1188
|
-
|
|
1206
|
+
M.success = Y.verified;
|
|
1189
1207
|
}
|
|
1190
|
-
|
|
1208
|
+
M.success ? (W(T("security.face.verified", "Face verified")), U("success")) : (H((O) => O + 1), _ + 1 >= p.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), i == null || i(M);
|
|
1191
1209
|
}
|
|
1192
|
-
} catch (
|
|
1193
|
-
a == null || a(
|
|
1210
|
+
} catch (x) {
|
|
1211
|
+
a == null || a(x instanceof Error ? x : new Error(String(x))), W(T("security.face.error", "Error — try again")), U("error");
|
|
1194
1212
|
}
|
|
1195
1213
|
}
|
|
1196
1214
|
}, [
|
|
@@ -1198,17 +1216,17 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1198
1216
|
t,
|
|
1199
1217
|
r,
|
|
1200
1218
|
n,
|
|
1201
|
-
|
|
1219
|
+
p,
|
|
1202
1220
|
T,
|
|
1203
1221
|
U,
|
|
1204
|
-
i,
|
|
1205
1222
|
s,
|
|
1223
|
+
i,
|
|
1206
1224
|
a,
|
|
1207
1225
|
f,
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
]),
|
|
1211
|
-
return /* @__PURE__ */
|
|
1226
|
+
_,
|
|
1227
|
+
C
|
|
1228
|
+
]), I = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
1229
|
+
return /* @__PURE__ */ P(
|
|
1212
1230
|
"div",
|
|
1213
1231
|
{
|
|
1214
1232
|
className: g,
|
|
@@ -1220,8 +1238,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1220
1238
|
},
|
|
1221
1239
|
children: [
|
|
1222
1240
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 16, alignItems: "center" }, children: [
|
|
1242
|
+
/* @__PURE__ */ P(
|
|
1225
1243
|
"div",
|
|
1226
1244
|
{
|
|
1227
1245
|
style: {
|
|
@@ -1230,8 +1248,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1230
1248
|
position: "relative",
|
|
1231
1249
|
borderRadius: "var(--security-radius-lg)",
|
|
1232
1250
|
overflow: "hidden",
|
|
1233
|
-
border: `3px solid ${
|
|
1234
|
-
boxShadow: h === "scanning" ? `0 0 20px ${
|
|
1251
|
+
border: `3px solid ${I}`,
|
|
1252
|
+
boxShadow: h === "scanning" ? `0 0 20px ${I}` : "var(--security-shadow)",
|
|
1235
1253
|
transition: "border-color 0.3s, box-shadow 0.3s"
|
|
1236
1254
|
},
|
|
1237
1255
|
children: [
|
|
@@ -1247,7 +1265,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1247
1265
|
/* @__PURE__ */ c(
|
|
1248
1266
|
"canvas",
|
|
1249
1267
|
{
|
|
1250
|
-
ref:
|
|
1268
|
+
ref: w,
|
|
1251
1269
|
width: S,
|
|
1252
1270
|
height: S * 0.75,
|
|
1253
1271
|
style: {
|
|
@@ -1304,7 +1322,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1304
1322
|
height: 50,
|
|
1305
1323
|
borderRadius: "50%",
|
|
1306
1324
|
border: "3px solid transparent",
|
|
1307
|
-
borderTopColor:
|
|
1325
|
+
borderTopColor: I,
|
|
1308
1326
|
animation: "spin 0.8s linear infinite"
|
|
1309
1327
|
}
|
|
1310
1328
|
}
|
|
@@ -1314,7 +1332,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1314
1332
|
]
|
|
1315
1333
|
}
|
|
1316
1334
|
),
|
|
1317
|
-
t === "compare" && D && n && /* @__PURE__ */
|
|
1335
|
+
t === "compare" && D && n && /* @__PURE__ */ P(
|
|
1318
1336
|
"div",
|
|
1319
1337
|
{
|
|
1320
1338
|
style: {
|
|
@@ -1350,8 +1368,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1350
1368
|
}
|
|
1351
1369
|
)
|
|
1352
1370
|
] }),
|
|
1353
|
-
F > 0 && /* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
1371
|
+
F > 0 && /* @__PURE__ */ P("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
|
|
1372
|
+
/* @__PURE__ */ P("span", { style: { color: "var(--security-text-secondary)" }, children: [
|
|
1355
1373
|
T("security.face.confidence", "Confidence"),
|
|
1356
1374
|
":"
|
|
1357
1375
|
] }),
|
|
@@ -1371,18 +1389,18 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1371
1389
|
style: {
|
|
1372
1390
|
width: `${F * 100}%`,
|
|
1373
1391
|
height: "100%",
|
|
1374
|
-
background: F >=
|
|
1392
|
+
background: F >= p.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
|
|
1375
1393
|
}
|
|
1376
1394
|
}
|
|
1377
1395
|
)
|
|
1378
1396
|
}
|
|
1379
1397
|
),
|
|
1380
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ P(
|
|
1381
1399
|
"span",
|
|
1382
1400
|
{
|
|
1383
1401
|
style: {
|
|
1384
1402
|
fontWeight: 600,
|
|
1385
|
-
color: F >=
|
|
1403
|
+
color: F >= p.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
|
|
1386
1404
|
},
|
|
1387
1405
|
children: [
|
|
1388
1406
|
(F * 100).toFixed(0),
|
|
@@ -1400,7 +1418,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1400
1418
|
textAlign: "center",
|
|
1401
1419
|
minHeight: 20
|
|
1402
1420
|
},
|
|
1403
|
-
children: R ??
|
|
1421
|
+
children: R ?? J
|
|
1404
1422
|
}
|
|
1405
1423
|
),
|
|
1406
1424
|
h !== "success" && h !== "failure" && /* @__PURE__ */ c(
|
|
@@ -1413,13 +1431,13 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1413
1431
|
fontSize: 14,
|
|
1414
1432
|
fontWeight: 600,
|
|
1415
1433
|
background: "var(--security-biometric)",
|
|
1416
|
-
color: "var(--nice-
|
|
1434
|
+
color: "var(--nice-text-on-primary, #fff)",
|
|
1417
1435
|
border: "none",
|
|
1418
1436
|
borderRadius: "var(--security-radius)",
|
|
1419
1437
|
cursor: "pointer",
|
|
1420
1438
|
opacity: h === "scanning" || h === "processing" ? 0.6 : 1
|
|
1421
1439
|
},
|
|
1422
|
-
children: t === "enroll" ? T("security.face.captureBtn", "
|
|
1440
|
+
children: t === "enroll" ? T("security.face.captureBtn", "Capture Face") : t === "compare" ? T("security.face.compareBtn", "Compare") : T("security.face.verifyBtn", "Verify Face")
|
|
1423
1441
|
}
|
|
1424
1442
|
),
|
|
1425
1443
|
(h === "failure" || h === "error") && /* @__PURE__ */ c(
|
|
@@ -1445,30 +1463,30 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1445
1463
|
}
|
|
1446
1464
|
);
|
|
1447
1465
|
};
|
|
1448
|
-
async function
|
|
1466
|
+
async function it(e) {
|
|
1449
1467
|
return new Promise((t, r) => {
|
|
1450
1468
|
const n = new Image();
|
|
1451
1469
|
n.crossOrigin = "anonymous", n.onload = () => {
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1470
|
+
const s = document.createElement("canvas");
|
|
1471
|
+
s.width = n.naturalWidth, s.height = n.naturalHeight;
|
|
1472
|
+
const i = s.getContext("2d");
|
|
1473
|
+
i.drawImage(n, 0, 0), t(i.getImageData(0, 0, s.width, s.height));
|
|
1456
1474
|
}, n.onerror = () => r(new Error("Failed to load reference image")), n.src = e;
|
|
1457
1475
|
});
|
|
1458
1476
|
}
|
|
1459
|
-
function
|
|
1477
|
+
function st(e) {
|
|
1460
1478
|
const t = document.createElement("canvas");
|
|
1461
1479
|
t.width = e.naturalWidth || e.width, t.height = e.naturalHeight || e.height;
|
|
1462
1480
|
const r = t.getContext("2d");
|
|
1463
1481
|
return r.drawImage(e, 0, 0), r.getImageData(0, 0, t.width, t.height);
|
|
1464
1482
|
}
|
|
1465
|
-
const
|
|
1483
|
+
const ot = 4, at = 5, ct = 3e4, Pt = (e) => {
|
|
1466
1484
|
const {
|
|
1467
|
-
length: t =
|
|
1485
|
+
length: t = ot,
|
|
1468
1486
|
scramble: r = !1,
|
|
1469
1487
|
showDigits: n = !1,
|
|
1470
|
-
maxAttempts:
|
|
1471
|
-
lockoutDuration:
|
|
1488
|
+
maxAttempts: s = at,
|
|
1489
|
+
lockoutDuration: i = ct,
|
|
1472
1490
|
keySize: o = 64,
|
|
1473
1491
|
haptic: a = !0,
|
|
1474
1492
|
keyLabels: g,
|
|
@@ -1476,36 +1494,36 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1476
1494
|
expectedPin: f,
|
|
1477
1495
|
mode: m = "verify",
|
|
1478
1496
|
onComplete: k,
|
|
1479
|
-
onVerify:
|
|
1497
|
+
onVerify: y,
|
|
1480
1498
|
onStatusChange: D,
|
|
1481
1499
|
onError: R,
|
|
1482
1500
|
showBiometricFallback: b = !1,
|
|
1483
1501
|
onBiometricFallback: T,
|
|
1484
|
-
label:
|
|
1502
|
+
label: p,
|
|
1485
1503
|
className: S
|
|
1486
|
-
} = e, { t: u } =
|
|
1504
|
+
} = e, { t: u } = te(), [w, l] = j([]), [h, L] = j("idle"), [q, Z] = j(0), [_, H] = j(0), [J, W] = j(null), $ = ee(void 0), B = ae(() => {
|
|
1487
1505
|
const z = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "", "0", "back"];
|
|
1488
1506
|
if (!r)
|
|
1489
1507
|
return z;
|
|
1490
|
-
const
|
|
1491
|
-
for (let
|
|
1508
|
+
const I = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
1509
|
+
for (let x = I.length - 1; x > 0; x--) {
|
|
1492
1510
|
const d = new Uint32Array(1);
|
|
1493
1511
|
crypto.getRandomValues(d);
|
|
1494
|
-
const A = d[0] % (
|
|
1495
|
-
[
|
|
1512
|
+
const A = d[0] % (x + 1);
|
|
1513
|
+
[I[x], I[A]] = [I[A], I[x]];
|
|
1496
1514
|
}
|
|
1497
1515
|
return [
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1516
|
+
I[0],
|
|
1517
|
+
I[1],
|
|
1518
|
+
I[2],
|
|
1519
|
+
I[3],
|
|
1520
|
+
I[4],
|
|
1521
|
+
I[5],
|
|
1522
|
+
I[6],
|
|
1523
|
+
I[7],
|
|
1524
|
+
I[8],
|
|
1507
1525
|
"",
|
|
1508
|
-
|
|
1526
|
+
I[9],
|
|
1509
1527
|
"back"
|
|
1510
1528
|
];
|
|
1511
1529
|
}, [r, h]), F = G(
|
|
@@ -1514,15 +1532,15 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1514
1532
|
},
|
|
1515
1533
|
[D]
|
|
1516
1534
|
);
|
|
1517
|
-
|
|
1518
|
-
if (!(
|
|
1535
|
+
ne(() => {
|
|
1536
|
+
if (!(_ <= Date.now()))
|
|
1519
1537
|
return $.current = setInterval(() => {
|
|
1520
|
-
Date.now() >=
|
|
1538
|
+
Date.now() >= _ && (clearInterval($.current), F("idle"), Z(0), l([]));
|
|
1521
1539
|
}, 500), () => clearInterval($.current);
|
|
1522
|
-
}, [
|
|
1523
|
-
const K =
|
|
1540
|
+
}, [_, F]);
|
|
1541
|
+
const K = _ > Date.now(), U = G(() => {
|
|
1524
1542
|
a && navigator.vibrate && navigator.vibrate(20);
|
|
1525
|
-
}, [a]),
|
|
1543
|
+
}, [a]), Q = G(
|
|
1526
1544
|
async (z) => {
|
|
1527
1545
|
if (K || h === "success")
|
|
1528
1546
|
return;
|
|
@@ -1532,50 +1550,50 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1532
1550
|
}
|
|
1533
1551
|
if (z === "")
|
|
1534
1552
|
return;
|
|
1535
|
-
const
|
|
1536
|
-
if (l(
|
|
1553
|
+
const I = [...w, z];
|
|
1554
|
+
if (l(I), I.length < t)
|
|
1537
1555
|
return;
|
|
1538
|
-
const
|
|
1556
|
+
const x = I.join("");
|
|
1539
1557
|
if (F("processing"), m === "set") {
|
|
1540
|
-
if (
|
|
1541
|
-
W(
|
|
1558
|
+
if (J === null) {
|
|
1559
|
+
W(x), l([]), F("idle");
|
|
1542
1560
|
return;
|
|
1543
1561
|
}
|
|
1544
|
-
if (
|
|
1562
|
+
if (J !== x) {
|
|
1545
1563
|
W(null), l([]), F("failure"), setTimeout(() => F("idle"), 1200);
|
|
1546
1564
|
return;
|
|
1547
1565
|
}
|
|
1548
|
-
k == null || k(
|
|
1566
|
+
k == null || k(x), F("success");
|
|
1549
1567
|
return;
|
|
1550
1568
|
}
|
|
1551
1569
|
let d = !1;
|
|
1552
1570
|
if (v) {
|
|
1553
|
-
const A = new TextEncoder(), N = await crypto.subtle.digest("SHA-256", A.encode(
|
|
1571
|
+
const A = new TextEncoder(), N = await crypto.subtle.digest("SHA-256", A.encode(x));
|
|
1554
1572
|
d = Array.from(new Uint8Array(N)).map((O) => O.toString(16).padStart(2, "0")).join("") === v;
|
|
1555
1573
|
} else if (f)
|
|
1556
|
-
d =
|
|
1574
|
+
d = x === f;
|
|
1557
1575
|
else {
|
|
1558
|
-
k == null || k(
|
|
1576
|
+
k == null || k(x), F("success");
|
|
1559
1577
|
return;
|
|
1560
1578
|
}
|
|
1561
1579
|
if (d)
|
|
1562
|
-
F("success"),
|
|
1580
|
+
F("success"), y == null || y({
|
|
1563
1581
|
success: !0,
|
|
1564
1582
|
confidence: 1,
|
|
1565
1583
|
method: "pin",
|
|
1566
1584
|
timestamp: Date.now(),
|
|
1567
1585
|
duration: 0
|
|
1568
|
-
}), k == null || k(
|
|
1586
|
+
}), k == null || k(x);
|
|
1569
1587
|
else {
|
|
1570
1588
|
const A = q + 1;
|
|
1571
|
-
if (
|
|
1572
|
-
const N = Date.now() +
|
|
1589
|
+
if (Z(A), A >= s) {
|
|
1590
|
+
const N = Date.now() + i;
|
|
1573
1591
|
H(N), F("failure"), R == null || R(new Error("Too many failed PIN attempts"));
|
|
1574
1592
|
} else
|
|
1575
1593
|
F("failure"), setTimeout(() => {
|
|
1576
1594
|
F("idle"), l([]);
|
|
1577
1595
|
}, 800);
|
|
1578
|
-
|
|
1596
|
+
y == null || y({
|
|
1579
1597
|
success: !1,
|
|
1580
1598
|
confidence: 0,
|
|
1581
1599
|
method: "pin",
|
|
@@ -1585,25 +1603,25 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1585
1603
|
}
|
|
1586
1604
|
},
|
|
1587
1605
|
[
|
|
1588
|
-
|
|
1606
|
+
w,
|
|
1589
1607
|
t,
|
|
1590
1608
|
K,
|
|
1591
1609
|
h,
|
|
1592
1610
|
m,
|
|
1593
|
-
|
|
1611
|
+
J,
|
|
1594
1612
|
v,
|
|
1595
1613
|
f,
|
|
1596
1614
|
q,
|
|
1597
|
-
i,
|
|
1598
1615
|
s,
|
|
1616
|
+
i,
|
|
1599
1617
|
U,
|
|
1600
1618
|
F,
|
|
1601
1619
|
k,
|
|
1602
|
-
|
|
1620
|
+
y,
|
|
1603
1621
|
R
|
|
1604
1622
|
]
|
|
1605
|
-
), E = Math.max(0, Math.ceil((
|
|
1606
|
-
return /* @__PURE__ */
|
|
1623
|
+
), E = Math.max(0, Math.ceil((_ - Date.now()) / 1e3)), C = h === "success" ? "var(--security-success)" : h === "failure" ? "var(--security-error)" : "var(--security-border)";
|
|
1624
|
+
return /* @__PURE__ */ P(
|
|
1607
1625
|
"div",
|
|
1608
1626
|
{
|
|
1609
1627
|
className: S,
|
|
@@ -1616,7 +1634,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1616
1634
|
color: "var(--security-text)"
|
|
1617
1635
|
},
|
|
1618
1636
|
children: [
|
|
1619
|
-
|
|
1637
|
+
p && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600 }, children: p }),
|
|
1620
1638
|
/* @__PURE__ */ c(
|
|
1621
1639
|
"div",
|
|
1622
1640
|
{
|
|
@@ -1626,22 +1644,22 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1626
1644
|
minHeight: 18,
|
|
1627
1645
|
textAlign: "center"
|
|
1628
1646
|
},
|
|
1629
|
-
children: K ? u("security.pin.locked", `Locked — try again in ${E}s`) : m === "set" &&
|
|
1647
|
+
children: K ? u("security.pin.locked", `Locked — try again in ${E}s`) : m === "set" && J !== null ? u("security.pin.confirm", "Confirm your PIN") : m === "set" ? u("security.pin.setNew", "Enter a new PIN") : u("security.pin.enter", "Enter your PIN")
|
|
1630
1648
|
}
|
|
1631
1649
|
),
|
|
1632
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 12 }, children: Array.from({ length: t }, (z,
|
|
1650
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 12 }, children: Array.from({ length: t }, (z, I) => /* @__PURE__ */ c(
|
|
1633
1651
|
"div",
|
|
1634
1652
|
{
|
|
1635
1653
|
style: {
|
|
1636
1654
|
width: 16,
|
|
1637
1655
|
height: 16,
|
|
1638
1656
|
borderRadius: "50%",
|
|
1639
|
-
border: `2px solid ${
|
|
1640
|
-
background:
|
|
1657
|
+
border: `2px solid ${C}`,
|
|
1658
|
+
background: I < w.length ? C : "transparent",
|
|
1641
1659
|
transition: "background 0.15s, border-color 0.15s"
|
|
1642
1660
|
}
|
|
1643
1661
|
},
|
|
1644
|
-
|
|
1662
|
+
I
|
|
1645
1663
|
)) }),
|
|
1646
1664
|
/* @__PURE__ */ c(
|
|
1647
1665
|
"div",
|
|
@@ -1653,16 +1671,16 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1653
1671
|
opacity: K ? 0.4 : 1,
|
|
1654
1672
|
pointerEvents: K ? "none" : "auto"
|
|
1655
1673
|
},
|
|
1656
|
-
children:
|
|
1674
|
+
children: B.map((z, I) => {
|
|
1657
1675
|
if (z === "")
|
|
1658
|
-
return /* @__PURE__ */ c("div", {},
|
|
1659
|
-
const
|
|
1676
|
+
return /* @__PURE__ */ c("div", {}, I);
|
|
1677
|
+
const x = z === "back";
|
|
1660
1678
|
return /* @__PURE__ */ c(
|
|
1661
1679
|
"button",
|
|
1662
1680
|
{
|
|
1663
|
-
onClick: () =>
|
|
1681
|
+
onClick: () => Q(z),
|
|
1664
1682
|
disabled: K || h === "success",
|
|
1665
|
-
"aria-label":
|
|
1683
|
+
"aria-label": x ? "Backspace" : z,
|
|
1666
1684
|
style: {
|
|
1667
1685
|
width: o,
|
|
1668
1686
|
height: o,
|
|
@@ -1670,7 +1688,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1670
1688
|
border: "1px solid var(--security-key-border, var(--security-border))",
|
|
1671
1689
|
background: "var(--security-key-bg, var(--security-bg-panel))",
|
|
1672
1690
|
color: "var(--security-key-text, var(--security-text))",
|
|
1673
|
-
fontSize:
|
|
1691
|
+
fontSize: x ? 20 : 22,
|
|
1674
1692
|
fontWeight: 600,
|
|
1675
1693
|
cursor: "pointer",
|
|
1676
1694
|
display: "flex",
|
|
@@ -1688,14 +1706,14 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1688
1706
|
onMouseLeave: (d) => {
|
|
1689
1707
|
d.currentTarget.style.transform = "";
|
|
1690
1708
|
},
|
|
1691
|
-
children:
|
|
1709
|
+
children: x ? "⌫" : (g == null ? void 0 : g[z]) ?? z
|
|
1692
1710
|
},
|
|
1693
|
-
|
|
1711
|
+
I
|
|
1694
1712
|
);
|
|
1695
1713
|
})
|
|
1696
1714
|
}
|
|
1697
1715
|
),
|
|
1698
|
-
|
|
1716
|
+
w.length > 0 && h !== "success" && /* @__PURE__ */ c(
|
|
1699
1717
|
"button",
|
|
1700
1718
|
{
|
|
1701
1719
|
onClick: () => l([]),
|
|
@@ -1710,7 +1728,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1710
1728
|
children: u("security.pin.clear", "Clear")
|
|
1711
1729
|
}
|
|
1712
1730
|
),
|
|
1713
|
-
b && /* @__PURE__ */
|
|
1731
|
+
b && /* @__PURE__ */ c(
|
|
1714
1732
|
"button",
|
|
1715
1733
|
{
|
|
1716
1734
|
onClick: T,
|
|
@@ -1723,79 +1741,79 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1723
1741
|
color: "var(--security-biometric)",
|
|
1724
1742
|
cursor: "pointer"
|
|
1725
1743
|
},
|
|
1726
|
-
children:
|
|
1727
|
-
"🔐 ",
|
|
1728
|
-
u("security.pin.biometricFallback", "Use biometrics instead")
|
|
1729
|
-
]
|
|
1744
|
+
children: u("security.pin.biometricFallback", "Use biometrics instead")
|
|
1730
1745
|
}
|
|
1731
1746
|
),
|
|
1732
|
-
q > 0 && h !== "success" && !K && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: u("security.pin.attempts", `${q}/${
|
|
1747
|
+
q > 0 && h !== "success" && !K && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: u("security.pin.attempts", `${q}/${s} attempts`) })
|
|
1733
1748
|
]
|
|
1734
1749
|
}
|
|
1735
1750
|
);
|
|
1736
|
-
},
|
|
1751
|
+
}, lt = 3, ut = 4, dt = 5, ht = 14, Et = (e) => {
|
|
1737
1752
|
const {
|
|
1738
|
-
gridSize: t =
|
|
1739
|
-
minLength: r =
|
|
1753
|
+
gridSize: t = lt,
|
|
1754
|
+
minLength: r = ut,
|
|
1740
1755
|
showTrail: n = !0,
|
|
1741
|
-
showError:
|
|
1742
|
-
maxAttempts:
|
|
1743
|
-
dotSize: o =
|
|
1756
|
+
showError: s = !0,
|
|
1757
|
+
maxAttempts: i = dt,
|
|
1758
|
+
dotSize: o = ht,
|
|
1744
1759
|
trailColor: a,
|
|
1745
1760
|
mode: g = "verify",
|
|
1746
1761
|
expectedHash: v,
|
|
1747
1762
|
expectedPattern: f,
|
|
1748
1763
|
onComplete: m,
|
|
1749
1764
|
onVerify: k,
|
|
1750
|
-
onStatusChange:
|
|
1765
|
+
onStatusChange: y,
|
|
1751
1766
|
onError: D,
|
|
1752
1767
|
label: R,
|
|
1753
1768
|
className: b,
|
|
1754
1769
|
canvasSize: T
|
|
1755
|
-
} = e, { t:
|
|
1770
|
+
} = e, { t: p } = te(), S = ee(null), [u, w] = j([]), [l, h] = j(!1), [L, q] = j("idle"), [Z, _] = j(0), [H, J] = j(null), [W, $] = j(null), B = T ?? t * 80, F = B / t, K = G(
|
|
1756
1771
|
(d) => {
|
|
1757
|
-
q(d),
|
|
1772
|
+
q(d), y == null || y(d);
|
|
1758
1773
|
},
|
|
1759
|
-
[
|
|
1774
|
+
[y]
|
|
1760
1775
|
), U = G(() => {
|
|
1761
1776
|
const d = [];
|
|
1762
1777
|
for (let A = 0; A < t; A++)
|
|
1763
1778
|
for (let N = 0; N < t; N++)
|
|
1764
1779
|
d.push({ x: N * F + F / 2, y: A * F + F / 2 });
|
|
1765
1780
|
return d;
|
|
1766
|
-
}, [t, F]),
|
|
1767
|
-
const A = S.current.getBoundingClientRect(), N = "touches" in d ? d.touches[0].clientX : d.clientX,
|
|
1768
|
-
return { x: N - A.left, y:
|
|
1781
|
+
}, [t, F]), Q = G((d) => {
|
|
1782
|
+
const A = S.current.getBoundingClientRect(), N = "touches" in d ? d.touches[0].clientX : d.clientX, M = "touches" in d ? d.touches[0].clientY : d.clientY;
|
|
1783
|
+
return { x: N - A.left, y: M - A.top };
|
|
1769
1784
|
}, []), E = G(
|
|
1770
1785
|
(d, A) => {
|
|
1771
|
-
const N = U(),
|
|
1786
|
+
const N = U(), M = F * 0.38;
|
|
1772
1787
|
for (let O = 0; O < N.length; O++) {
|
|
1773
|
-
const
|
|
1774
|
-
if (
|
|
1788
|
+
const Y = N[O].x - d, V = N[O].y - A;
|
|
1789
|
+
if (Y * Y + V * V < M * M)
|
|
1775
1790
|
return O;
|
|
1776
1791
|
}
|
|
1777
1792
|
return -1;
|
|
1778
1793
|
},
|
|
1779
1794
|
[U, F]
|
|
1780
|
-
),
|
|
1781
|
-
var
|
|
1782
|
-
const d = (
|
|
1795
|
+
), C = G(() => {
|
|
1796
|
+
var V;
|
|
1797
|
+
const d = (V = S.current) == null ? void 0 : V.getContext("2d");
|
|
1783
1798
|
if (!d)
|
|
1784
1799
|
return;
|
|
1785
|
-
d.clearRect(0, 0,
|
|
1786
|
-
const A = U(),
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1800
|
+
d.clearRect(0, 0, B, B);
|
|
1801
|
+
const A = U(), N = L === "failure", M = d.canvas, O = re(
|
|
1802
|
+
N && s ? "var(--security-error)" : a ?? "var(--security-biometric)",
|
|
1803
|
+
M
|
|
1804
|
+
), Y = re("var(--security-border)", M);
|
|
1805
|
+
for (let X = 0; X < A.length; X++) {
|
|
1806
|
+
const ie = u.includes(X);
|
|
1807
|
+
d.beginPath(), d.arc(A[X].x, A[X].y, ie ? o * 0.75 : o * 0.5, 0, Math.PI * 2), d.fillStyle = ie ? O : Y, d.fill(), ie && (d.beginPath(), d.arc(A[X].x, A[X].y, o * 1.2, 0, Math.PI * 2), d.strokeStyle = O, d.lineWidth = 1.5, d.globalAlpha = 0.3, d.stroke(), d.globalAlpha = 1);
|
|
1790
1808
|
}
|
|
1791
1809
|
if (n && u.length > 1) {
|
|
1792
1810
|
d.beginPath(), d.moveTo(A[u[0]].x, A[u[0]].y);
|
|
1793
|
-
for (let
|
|
1794
|
-
d.lineTo(A[u[
|
|
1795
|
-
l && W && d.lineTo(W.x, W.y), d.strokeStyle =
|
|
1796
|
-
} else n && u.length === 1 && l && W && (d.beginPath(), d.moveTo(A[u[0]].x, A[u[0]].y), d.lineTo(W.x, W.y), d.strokeStyle = a ?? "var(--security-biometric)", d.lineWidth = 3, d.globalAlpha = 0.4, d.stroke(), d.globalAlpha = 1);
|
|
1811
|
+
for (let X = 1; X < u.length; X++)
|
|
1812
|
+
d.lineTo(A[u[X]].x, A[u[X]].y);
|
|
1813
|
+
l && W && d.lineTo(W.x, W.y), d.strokeStyle = O, d.lineWidth = 3, d.lineCap = "round", d.lineJoin = "round", d.globalAlpha = 0.5, d.stroke(), d.globalAlpha = 1;
|
|
1814
|
+
} else n && u.length === 1 && l && W && (d.beginPath(), d.moveTo(A[u[0]].x, A[u[0]].y), d.lineTo(W.x, W.y), d.strokeStyle = re(a ?? "var(--security-biometric)", M), d.lineWidth = 3, d.globalAlpha = 0.4, d.stroke(), d.globalAlpha = 1);
|
|
1797
1815
|
}, [
|
|
1798
|
-
|
|
1816
|
+
B,
|
|
1799
1817
|
U,
|
|
1800
1818
|
o,
|
|
1801
1819
|
u,
|
|
@@ -1803,48 +1821,48 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1803
1821
|
W,
|
|
1804
1822
|
L,
|
|
1805
1823
|
n,
|
|
1806
|
-
|
|
1824
|
+
s,
|
|
1807
1825
|
a
|
|
1808
1826
|
]);
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
}, [
|
|
1827
|
+
ne(() => {
|
|
1828
|
+
C();
|
|
1829
|
+
}, [C]);
|
|
1812
1830
|
const z = G(
|
|
1813
1831
|
(d) => {
|
|
1814
1832
|
if (L === "success" || L === "failure")
|
|
1815
1833
|
return;
|
|
1816
1834
|
d.preventDefault();
|
|
1817
|
-
const { x: A, y: N } =
|
|
1818
|
-
|
|
1835
|
+
const { x: A, y: N } = Q(d), M = E(A, N);
|
|
1836
|
+
M >= 0 && (h(!0), w([M]), $({ x: A, y: N }));
|
|
1819
1837
|
},
|
|
1820
|
-
[L,
|
|
1821
|
-
),
|
|
1838
|
+
[L, Q, E]
|
|
1839
|
+
), I = G(
|
|
1822
1840
|
(d) => {
|
|
1823
1841
|
if (!l)
|
|
1824
1842
|
return;
|
|
1825
1843
|
d.preventDefault();
|
|
1826
|
-
const { x: A, y: N } =
|
|
1844
|
+
const { x: A, y: N } = Q(d);
|
|
1827
1845
|
$({ x: A, y: N });
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1846
|
+
const M = E(A, N);
|
|
1847
|
+
M >= 0 && !u.includes(M) && w((O) => [...O, M]);
|
|
1830
1848
|
},
|
|
1831
|
-
[l,
|
|
1832
|
-
),
|
|
1849
|
+
[l, Q, E, u]
|
|
1850
|
+
), x = G(async () => {
|
|
1833
1851
|
if (!l)
|
|
1834
1852
|
return;
|
|
1835
1853
|
if (h(!1), $(null), u.length < r) {
|
|
1836
|
-
|
|
1854
|
+
w([]);
|
|
1837
1855
|
return;
|
|
1838
1856
|
}
|
|
1839
1857
|
const d = u.join(",");
|
|
1840
1858
|
if (g === "set") {
|
|
1841
1859
|
if (H === null) {
|
|
1842
|
-
|
|
1860
|
+
J([...u]), w([]);
|
|
1843
1861
|
return;
|
|
1844
1862
|
}
|
|
1845
1863
|
if (H.join(",") !== d) {
|
|
1846
|
-
|
|
1847
|
-
K("idle"),
|
|
1864
|
+
J(null), K("failure"), setTimeout(() => {
|
|
1865
|
+
K("idle"), w([]);
|
|
1848
1866
|
}, 800);
|
|
1849
1867
|
return;
|
|
1850
1868
|
}
|
|
@@ -1854,8 +1872,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1854
1872
|
K("processing");
|
|
1855
1873
|
let A = !1;
|
|
1856
1874
|
if (v) {
|
|
1857
|
-
const N = new TextEncoder(),
|
|
1858
|
-
A = Array.from(new Uint8Array(
|
|
1875
|
+
const N = new TextEncoder(), M = await crypto.subtle.digest("SHA-256", N.encode(d));
|
|
1876
|
+
A = Array.from(new Uint8Array(M)).map((Y) => Y.toString(16).padStart(2, "0")).join("") === v;
|
|
1859
1877
|
} else if (f)
|
|
1860
1878
|
A = d === f;
|
|
1861
1879
|
else {
|
|
@@ -1871,9 +1889,9 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1871
1889
|
duration: 0
|
|
1872
1890
|
}), m == null || m([...u]);
|
|
1873
1891
|
else {
|
|
1874
|
-
const N =
|
|
1875
|
-
|
|
1876
|
-
K("idle"),
|
|
1892
|
+
const N = Z + 1;
|
|
1893
|
+
_(N), K("failure"), N >= i && (D == null || D(new Error("Too many failed pattern attempts"))), setTimeout(() => {
|
|
1894
|
+
K("idle"), w([]);
|
|
1877
1895
|
}, 900), k == null || k({
|
|
1878
1896
|
success: !1,
|
|
1879
1897
|
confidence: 0,
|
|
@@ -1890,14 +1908,14 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1890
1908
|
H,
|
|
1891
1909
|
v,
|
|
1892
1910
|
f,
|
|
1893
|
-
|
|
1894
|
-
|
|
1911
|
+
Z,
|
|
1912
|
+
i,
|
|
1895
1913
|
K,
|
|
1896
1914
|
m,
|
|
1897
1915
|
k,
|
|
1898
1916
|
D
|
|
1899
1917
|
]);
|
|
1900
|
-
return /* @__PURE__ */
|
|
1918
|
+
return /* @__PURE__ */ P(
|
|
1901
1919
|
"div",
|
|
1902
1920
|
{
|
|
1903
1921
|
className: b,
|
|
@@ -1920,15 +1938,15 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1920
1938
|
minHeight: 18,
|
|
1921
1939
|
textAlign: "center"
|
|
1922
1940
|
},
|
|
1923
|
-
children: L === "success" ?
|
|
1941
|
+
children: L === "success" ? p("security.pattern.success", "Pattern accepted") : L === "failure" ? p("security.pattern.wrong", "Wrong pattern") : g === "set" && H !== null ? p("security.pattern.confirm", "Draw pattern again to confirm") : g === "set" ? p("security.pattern.setNew", "Draw a new pattern") : p("security.pattern.draw", "Draw your pattern")
|
|
1924
1942
|
}
|
|
1925
1943
|
),
|
|
1926
1944
|
/* @__PURE__ */ c(
|
|
1927
1945
|
"canvas",
|
|
1928
1946
|
{
|
|
1929
1947
|
ref: S,
|
|
1930
|
-
width:
|
|
1931
|
-
height:
|
|
1948
|
+
width: B,
|
|
1949
|
+
height: B,
|
|
1932
1950
|
style: {
|
|
1933
1951
|
touchAction: "none",
|
|
1934
1952
|
borderRadius: "var(--security-radius-lg)",
|
|
@@ -1938,19 +1956,19 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1938
1956
|
transition: "border-color 0.3s"
|
|
1939
1957
|
},
|
|
1940
1958
|
onMouseDown: z,
|
|
1941
|
-
onMouseMove:
|
|
1942
|
-
onMouseUp:
|
|
1943
|
-
onMouseLeave:
|
|
1959
|
+
onMouseMove: I,
|
|
1960
|
+
onMouseUp: x,
|
|
1961
|
+
onMouseLeave: x,
|
|
1944
1962
|
onTouchStart: z,
|
|
1945
|
-
onTouchMove:
|
|
1946
|
-
onTouchEnd:
|
|
1963
|
+
onTouchMove: I,
|
|
1964
|
+
onTouchEnd: x
|
|
1947
1965
|
}
|
|
1948
1966
|
),
|
|
1949
1967
|
(L === "failure" || L === "success") && /* @__PURE__ */ c(
|
|
1950
1968
|
"button",
|
|
1951
1969
|
{
|
|
1952
1970
|
onClick: () => {
|
|
1953
|
-
|
|
1971
|
+
w([]), _(0), J(null), K("idle");
|
|
1954
1972
|
},
|
|
1955
1973
|
style: {
|
|
1956
1974
|
fontSize: 13,
|
|
@@ -1961,20 +1979,20 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1961
1979
|
color: "var(--security-text)",
|
|
1962
1980
|
cursor: "pointer"
|
|
1963
1981
|
},
|
|
1964
|
-
children:
|
|
1982
|
+
children: p("security.common.retry", "Try Again")
|
|
1965
1983
|
}
|
|
1966
1984
|
),
|
|
1967
|
-
|
|
1985
|
+
Z > 0 && L !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: p("security.pattern.attempts", `${Z}/${i} attempts`) })
|
|
1968
1986
|
]
|
|
1969
1987
|
}
|
|
1970
1988
|
);
|
|
1971
|
-
},
|
|
1989
|
+
}, ft = { sm: "8px 16px", md: "12px 24px", lg: "14px 32px" }, yt = { sm: 13, md: 14, lg: 16 }, Ft = (e) => {
|
|
1972
1990
|
const {
|
|
1973
1991
|
mode: t,
|
|
1974
1992
|
credentialIds: r = [],
|
|
1975
1993
|
challenge: n,
|
|
1976
|
-
rpName:
|
|
1977
|
-
rpId:
|
|
1994
|
+
rpName: s = window.location.hostname,
|
|
1995
|
+
rpId: i = window.location.hostname,
|
|
1978
1996
|
user: o,
|
|
1979
1997
|
attestation: a = "none",
|
|
1980
1998
|
authenticatorAttachment: g,
|
|
@@ -1982,29 +2000,29 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1982
2000
|
userVerification: f = "preferred",
|
|
1983
2001
|
onRegister: m,
|
|
1984
2002
|
onAuthenticate: k,
|
|
1985
|
-
onVerify:
|
|
2003
|
+
onVerify: y,
|
|
1986
2004
|
onStatusChange: D,
|
|
1987
2005
|
onError: R,
|
|
1988
2006
|
label: b,
|
|
1989
2007
|
className: T,
|
|
1990
|
-
variant:
|
|
2008
|
+
variant: p = "primary",
|
|
1991
2009
|
size: S = "md",
|
|
1992
2010
|
fullWidth: u = !1,
|
|
1993
|
-
icon:
|
|
1994
|
-
} = e, { t: l } =
|
|
1995
|
-
(
|
|
1996
|
-
L(
|
|
2011
|
+
icon: w
|
|
2012
|
+
} = e, { t: l } = te(), [h, L] = j("idle"), [q, Z] = j(!0), [_, H] = j(!1), J = G(
|
|
2013
|
+
(C) => {
|
|
2014
|
+
L(C), D == null || D(C);
|
|
1997
2015
|
},
|
|
1998
2016
|
[D]
|
|
1999
2017
|
);
|
|
2000
|
-
|
|
2001
|
-
|
|
2018
|
+
ne(() => {
|
|
2019
|
+
Z(Ce()), Xe().then(H);
|
|
2002
2020
|
}, []);
|
|
2003
2021
|
const W = G(() => {
|
|
2004
2022
|
if (n) {
|
|
2005
|
-
const
|
|
2006
|
-
for (let
|
|
2007
|
-
z[
|
|
2023
|
+
const C = atob(n.replace(/-/g, "+").replace(/_/g, "/")), z = new Uint8Array(C.length);
|
|
2024
|
+
for (let I = 0; I < C.length; I++)
|
|
2025
|
+
z[I] = C.charCodeAt(I);
|
|
2008
2026
|
return z.buffer;
|
|
2009
2027
|
}
|
|
2010
2028
|
return crypto.getRandomValues(new Uint8Array(32)).buffer;
|
|
@@ -2013,18 +2031,18 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2013
2031
|
R == null || R(new Error("WebAuthn not available"));
|
|
2014
2032
|
return;
|
|
2015
2033
|
}
|
|
2016
|
-
|
|
2034
|
+
J("processing");
|
|
2017
2035
|
try {
|
|
2018
2036
|
if (t === "register") {
|
|
2019
|
-
const
|
|
2020
|
-
rpName:
|
|
2021
|
-
rpId:
|
|
2022
|
-
userId: typeof
|
|
2037
|
+
const C = (o == null ? void 0 : o.id) ?? crypto.getRandomValues(new Uint8Array(16)), z = (o == null ? void 0 : o.name) ?? "user", I = (o == null ? void 0 : o.displayName) ?? z, x = W(), d = await Qe({
|
|
2038
|
+
rpName: s,
|
|
2039
|
+
rpId: i,
|
|
2040
|
+
userId: typeof C == "string" ? C : Array.from(C).join(""),
|
|
2023
2041
|
userName: z,
|
|
2024
|
-
userDisplayName:
|
|
2025
|
-
challenge:
|
|
2042
|
+
userDisplayName: I,
|
|
2043
|
+
challenge: x
|
|
2026
2044
|
});
|
|
2027
|
-
|
|
2045
|
+
J("success"), d && (m == null || m(d)), y == null || y({
|
|
2028
2046
|
success: !0,
|
|
2029
2047
|
confidence: 1,
|
|
2030
2048
|
method: "webauthn",
|
|
@@ -2032,15 +2050,15 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2032
2050
|
duration: 0
|
|
2033
2051
|
});
|
|
2034
2052
|
} else {
|
|
2035
|
-
const
|
|
2036
|
-
rpId:
|
|
2053
|
+
const C = await Ve({
|
|
2054
|
+
rpId: i,
|
|
2037
2055
|
challenge: W(),
|
|
2038
2056
|
allowCredentials: r == null ? void 0 : r.map((z) => ({
|
|
2039
2057
|
id: new TextEncoder().encode(z),
|
|
2040
2058
|
type: "public-key"
|
|
2041
2059
|
}))
|
|
2042
2060
|
});
|
|
2043
|
-
|
|
2061
|
+
J("success"), C && (k == null || k(C)), y == null || y({
|
|
2044
2062
|
success: !0,
|
|
2045
2063
|
confidence: 1,
|
|
2046
2064
|
method: "webauthn",
|
|
@@ -2048,9 +2066,9 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2048
2066
|
duration: 0
|
|
2049
2067
|
});
|
|
2050
2068
|
}
|
|
2051
|
-
} catch (
|
|
2052
|
-
const z =
|
|
2053
|
-
z.name === "NotAllowedError" ?
|
|
2069
|
+
} catch (C) {
|
|
2070
|
+
const z = C instanceof Error ? C : new Error(String(C));
|
|
2071
|
+
z.name === "NotAllowedError" ? J("idle") : (J("error"), R == null || R(z), y == null || y({
|
|
2054
2072
|
success: !1,
|
|
2055
2073
|
confidence: 0,
|
|
2056
2074
|
method: "webauthn",
|
|
@@ -2063,19 +2081,19 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2063
2081
|
t,
|
|
2064
2082
|
r,
|
|
2065
2083
|
o,
|
|
2066
|
-
i,
|
|
2067
2084
|
s,
|
|
2085
|
+
i,
|
|
2068
2086
|
a,
|
|
2069
2087
|
g,
|
|
2070
2088
|
v,
|
|
2071
2089
|
f,
|
|
2072
2090
|
W,
|
|
2073
|
-
|
|
2091
|
+
J,
|
|
2074
2092
|
m,
|
|
2075
2093
|
k,
|
|
2076
|
-
|
|
2094
|
+
y,
|
|
2077
2095
|
R
|
|
2078
|
-
]),
|
|
2096
|
+
]), B = t === "register" ? _ ? l("security.webauthn.registerPasskey", "Register Passkey") : l("security.webauthn.register", "Register Security Key") : _ ? l("security.webauthn.signInPasskey", "Sign in with Passkey") : l("security.webauthn.signIn", "Sign in with Security Key"), F = b ?? B, K = {
|
|
2079
2097
|
primary: "var(--security-biometric)",
|
|
2080
2098
|
outline: "transparent",
|
|
2081
2099
|
ghost: "transparent"
|
|
@@ -2083,31 +2101,32 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2083
2101
|
primary: "none",
|
|
2084
2102
|
outline: "2px solid var(--security-biometric)",
|
|
2085
2103
|
ghost: "none"
|
|
2086
|
-
},
|
|
2087
|
-
|
|
2104
|
+
}, Q = {
|
|
2105
|
+
// Label on the brand-coloured button: the on-primary text token, not a surface token.
|
|
2106
|
+
primary: "var(--nice-text-on-primary, #fff)",
|
|
2088
2107
|
outline: "var(--security-biometric)",
|
|
2089
2108
|
ghost: "var(--security-biometric)"
|
|
2090
2109
|
}, E = !q || h === "processing" || h === "success";
|
|
2091
|
-
return /* @__PURE__ */
|
|
2110
|
+
return /* @__PURE__ */ P(
|
|
2092
2111
|
"div",
|
|
2093
2112
|
{
|
|
2094
2113
|
className: T,
|
|
2095
2114
|
style: { display: u ? "block" : "inline-block", textAlign: "center" },
|
|
2096
2115
|
children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
2116
|
+
/* @__PURE__ */ P(
|
|
2098
2117
|
"button",
|
|
2099
2118
|
{
|
|
2100
2119
|
onClick: $,
|
|
2101
2120
|
disabled: E,
|
|
2102
2121
|
style: {
|
|
2103
2122
|
width: u ? "100%" : "auto",
|
|
2104
|
-
padding:
|
|
2105
|
-
fontSize:
|
|
2123
|
+
padding: ft[S],
|
|
2124
|
+
fontSize: yt[S],
|
|
2106
2125
|
fontWeight: 600,
|
|
2107
2126
|
fontFamily: "var(--security-font)",
|
|
2108
|
-
background: K[
|
|
2109
|
-
color:
|
|
2110
|
-
border: U[
|
|
2127
|
+
background: K[p],
|
|
2128
|
+
color: Q[p],
|
|
2129
|
+
border: U[p],
|
|
2111
2130
|
borderRadius: "var(--security-radius)",
|
|
2112
2131
|
cursor: E ? "not-allowed" : "pointer",
|
|
2113
2132
|
opacity: E ? 0.6 : 1,
|
|
@@ -2132,8 +2151,22 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2132
2151
|
}
|
|
2133
2152
|
}
|
|
2134
2153
|
),
|
|
2135
|
-
h === "success" && /* @__PURE__ */ c(
|
|
2136
|
-
|
|
2154
|
+
h === "success" && /* @__PURE__ */ c(
|
|
2155
|
+
"span",
|
|
2156
|
+
{
|
|
2157
|
+
"aria-hidden": "true",
|
|
2158
|
+
style: {
|
|
2159
|
+
display: "inline-block",
|
|
2160
|
+
width: "0.3em",
|
|
2161
|
+
height: "0.6em",
|
|
2162
|
+
marginBottom: "0.15em",
|
|
2163
|
+
borderRight: "0.12em solid currentColor",
|
|
2164
|
+
borderBottom: "0.12em solid currentColor",
|
|
2165
|
+
transform: "rotate(45deg)"
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
),
|
|
2169
|
+
w && h !== "processing" && h !== "success" && w,
|
|
2137
2170
|
F
|
|
2138
2171
|
]
|
|
2139
2172
|
}
|
|
@@ -2144,39 +2177,31 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2144
2177
|
]
|
|
2145
2178
|
}
|
|
2146
2179
|
);
|
|
2147
|
-
},
|
|
2148
|
-
success: "✅",
|
|
2149
|
-
failure: "❌",
|
|
2150
|
-
error: "⚠️",
|
|
2151
|
-
idle: "⏸️",
|
|
2152
|
-
scanning: "🔍",
|
|
2153
|
-
processing: "⏳",
|
|
2154
|
-
timeout: "⏰"
|
|
2155
|
-
}, yt = (e) => e >= 80 ? "var(--security-error)" : e >= 50 ? "var(--security-warning)" : "var(--security-success)", zt = ({
|
|
2180
|
+
}, pt = (e) => e >= 80 ? "var(--security-error)" : e >= 50 ? "var(--security-warning)" : "var(--security-success)", zt = ({
|
|
2156
2181
|
entries: e,
|
|
2157
2182
|
pageSize: t = 20,
|
|
2158
2183
|
showExport: r = !0,
|
|
2159
2184
|
filterMethods: n,
|
|
2160
|
-
onEntryClick:
|
|
2161
|
-
className:
|
|
2185
|
+
onEntryClick: s,
|
|
2186
|
+
className: i,
|
|
2162
2187
|
label: o
|
|
2163
2188
|
}) => {
|
|
2164
|
-
const { t: a } =
|
|
2189
|
+
const { t: a } = te(), [g, v] = j("all"), [f, m] = j("all"), [k, y] = j(0), D = ae(() => {
|
|
2165
2190
|
let l = [...e];
|
|
2166
2191
|
return g !== "all" && (l = l.filter((h) => h.method === g)), f !== "all" && (l = l.filter((h) => h.status === f)), l.sort((h, L) => L.timestamp - h.timestamp), l;
|
|
2167
|
-
}, [e, g, f]), R = Math.max(1, Math.ceil(D.length / t)), b = D.slice(k * t, (k + 1) * t), T =
|
|
2192
|
+
}, [e, g, f]), R = Math.max(1, Math.ceil(D.length / t)), b = D.slice(k * t, (k + 1) * t), T = ae(() => n || Array.from(new Set(e.map((l) => l.method))), [e, n]), p = ae(() => Array.from(new Set(e.map((l) => l.status))), [e]), S = G(() => {
|
|
2168
2193
|
const l = new Blob([JSON.stringify(D, null, 2)], { type: "application/json" }), h = URL.createObjectURL(l), L = document.createElement("a");
|
|
2169
2194
|
L.href = h, L.download = `security-audit-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, L.click(), URL.revokeObjectURL(h);
|
|
2170
|
-
}, [D]), u = (l) => new Date(l).toLocaleString(),
|
|
2195
|
+
}, [D]), u = (l) => new Date(l).toLocaleString(), w = {
|
|
2171
2196
|
padding: "8px 12px",
|
|
2172
2197
|
borderBottom: "1px solid var(--security-border)",
|
|
2173
2198
|
fontSize: 13,
|
|
2174
2199
|
whiteSpace: "nowrap"
|
|
2175
2200
|
};
|
|
2176
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ P(
|
|
2177
2202
|
"div",
|
|
2178
2203
|
{
|
|
2179
|
-
className:
|
|
2204
|
+
className: i,
|
|
2180
2205
|
style: {
|
|
2181
2206
|
fontFamily: "var(--security-font)",
|
|
2182
2207
|
color: "var(--security-text)",
|
|
@@ -2186,7 +2211,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2186
2211
|
overflow: "hidden"
|
|
2187
2212
|
},
|
|
2188
2213
|
children: [
|
|
2189
|
-
/* @__PURE__ */
|
|
2214
|
+
/* @__PURE__ */ P(
|
|
2190
2215
|
"div",
|
|
2191
2216
|
{
|
|
2192
2217
|
style: {
|
|
@@ -2198,33 +2223,33 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2198
2223
|
borderBottom: "1px solid var(--security-border)"
|
|
2199
2224
|
},
|
|
2200
2225
|
children: [
|
|
2201
|
-
/* @__PURE__ */ c("div", { style: { fontWeight: 600, fontSize: 15 }, children: o ?? a("security.audit.title", "
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ c("div", { style: { fontWeight: 600, fontSize: 15 }, children: o ?? a("security.audit.title", "Security Audit Log") }),
|
|
2227
|
+
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
2228
|
+
/* @__PURE__ */ P(
|
|
2204
2229
|
"select",
|
|
2205
2230
|
{
|
|
2206
2231
|
value: g,
|
|
2207
2232
|
onChange: (l) => {
|
|
2208
|
-
v(l.target.value),
|
|
2233
|
+
v(l.target.value), y(0);
|
|
2209
2234
|
},
|
|
2210
|
-
style:
|
|
2235
|
+
style: xe,
|
|
2211
2236
|
children: [
|
|
2212
2237
|
/* @__PURE__ */ c("option", { value: "all", children: a("security.audit.allMethods", "All methods") }),
|
|
2213
2238
|
T.map((l) => /* @__PURE__ */ c("option", { value: l, children: l }, l))
|
|
2214
2239
|
]
|
|
2215
2240
|
}
|
|
2216
2241
|
),
|
|
2217
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ P(
|
|
2218
2243
|
"select",
|
|
2219
2244
|
{
|
|
2220
2245
|
value: f,
|
|
2221
2246
|
onChange: (l) => {
|
|
2222
|
-
m(l.target.value),
|
|
2247
|
+
m(l.target.value), y(0);
|
|
2223
2248
|
},
|
|
2224
|
-
style:
|
|
2249
|
+
style: xe,
|
|
2225
2250
|
children: [
|
|
2226
2251
|
/* @__PURE__ */ c("option", { value: "all", children: a("security.audit.allStatuses", "All statuses") }),
|
|
2227
|
-
|
|
2252
|
+
p.map((l) => /* @__PURE__ */ c("option", { value: l, children: l }, l))
|
|
2228
2253
|
]
|
|
2229
2254
|
}
|
|
2230
2255
|
),
|
|
@@ -2232,17 +2257,17 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2232
2257
|
"button",
|
|
2233
2258
|
{
|
|
2234
2259
|
onClick: S,
|
|
2235
|
-
style:
|
|
2260
|
+
style: gt,
|
|
2236
2261
|
title: a("security.audit.exportJson", "Export JSON"),
|
|
2237
|
-
children: "
|
|
2262
|
+
children: "JSON"
|
|
2238
2263
|
}
|
|
2239
2264
|
)
|
|
2240
2265
|
] })
|
|
2241
2266
|
]
|
|
2242
2267
|
}
|
|
2243
2268
|
),
|
|
2244
|
-
/* @__PURE__ */ c("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */
|
|
2269
|
+
/* @__PURE__ */ c("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ P("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
2270
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ P(
|
|
2246
2271
|
"tr",
|
|
2247
2272
|
{
|
|
2248
2273
|
style: {
|
|
@@ -2253,22 +2278,22 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2253
2278
|
letterSpacing: 0.5
|
|
2254
2279
|
},
|
|
2255
2280
|
children: [
|
|
2256
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2257
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2258
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2259
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2260
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2261
|
-
/* @__PURE__ */ c("th", { style: { ...
|
|
2281
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: a("security.audit.time", "Time") }),
|
|
2282
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: a("security.audit.action", "Action") }),
|
|
2283
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: a("security.audit.method", "Method") }),
|
|
2284
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: a("security.audit.status", "Status") }),
|
|
2285
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: a("security.audit.risk", "Risk") }),
|
|
2286
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: a("security.audit.device", "Device") })
|
|
2262
2287
|
]
|
|
2263
2288
|
}
|
|
2264
2289
|
) }),
|
|
2265
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ P("tbody", { children: [
|
|
2266
2291
|
b.length === 0 && /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c(
|
|
2267
2292
|
"td",
|
|
2268
2293
|
{
|
|
2269
2294
|
colSpan: 6,
|
|
2270
2295
|
style: {
|
|
2271
|
-
...
|
|
2296
|
+
...w,
|
|
2272
2297
|
textAlign: "center",
|
|
2273
2298
|
color: "var(--security-text-muted)",
|
|
2274
2299
|
padding: 24
|
|
@@ -2276,11 +2301,11 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2276
2301
|
children: a("security.audit.noEntries", "No entries to show")
|
|
2277
2302
|
}
|
|
2278
2303
|
) }),
|
|
2279
|
-
b.map((l) => /* @__PURE__ */
|
|
2304
|
+
b.map((l) => /* @__PURE__ */ P(
|
|
2280
2305
|
"tr",
|
|
2281
2306
|
{
|
|
2282
|
-
onClick: () =>
|
|
2283
|
-
style: { cursor:
|
|
2307
|
+
onClick: () => s == null ? void 0 : s(l),
|
|
2308
|
+
style: { cursor: s ? "pointer" : "default" },
|
|
2284
2309
|
onMouseEnter: (h) => {
|
|
2285
2310
|
h.currentTarget.style.background = "var(--security-bg-panel)";
|
|
2286
2311
|
},
|
|
@@ -2288,9 +2313,9 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2288
2313
|
h.currentTarget.style.background = "";
|
|
2289
2314
|
},
|
|
2290
2315
|
children: [
|
|
2291
|
-
/* @__PURE__ */ c("td", { style:
|
|
2292
|
-
/* @__PURE__ */ c("td", { style:
|
|
2293
|
-
/* @__PURE__ */ c("td", { style: { ...
|
|
2316
|
+
/* @__PURE__ */ c("td", { style: w, children: u(l.timestamp) }),
|
|
2317
|
+
/* @__PURE__ */ c("td", { style: w, children: l.action }),
|
|
2318
|
+
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: /* @__PURE__ */ c(
|
|
2294
2319
|
"span",
|
|
2295
2320
|
{
|
|
2296
2321
|
style: {
|
|
@@ -2304,17 +2329,13 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2304
2329
|
children: l.method
|
|
2305
2330
|
}
|
|
2306
2331
|
) }),
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
|
|
2309
|
-
" ",
|
|
2310
|
-
l.status
|
|
2311
|
-
] }),
|
|
2312
|
-
/* @__PURE__ */ c("td", { style: { ...x, textAlign: "center" }, children: l.riskScore != null && /* @__PURE__ */ c("span", { style: { color: yt(l.riskScore), fontWeight: 600 }, children: l.riskScore }) }),
|
|
2332
|
+
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: l.status }),
|
|
2333
|
+
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: l.riskScore != null && /* @__PURE__ */ c("span", { style: { color: pt(l.riskScore), fontWeight: 600 }, children: l.riskScore }) }),
|
|
2313
2334
|
/* @__PURE__ */ c(
|
|
2314
2335
|
"td",
|
|
2315
2336
|
{
|
|
2316
2337
|
style: {
|
|
2317
|
-
...
|
|
2338
|
+
...w,
|
|
2318
2339
|
maxWidth: 200,
|
|
2319
2340
|
overflow: "hidden",
|
|
2320
2341
|
textOverflow: "ellipsis"
|
|
@@ -2328,7 +2349,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2328
2349
|
))
|
|
2329
2350
|
] })
|
|
2330
2351
|
] }) }),
|
|
2331
|
-
R > 1 && /* @__PURE__ */
|
|
2352
|
+
R > 1 && /* @__PURE__ */ P(
|
|
2332
2353
|
"div",
|
|
2333
2354
|
{
|
|
2334
2355
|
style: {
|
|
@@ -2342,21 +2363,21 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2342
2363
|
borderTop: "1px solid var(--security-border)"
|
|
2343
2364
|
},
|
|
2344
2365
|
children: [
|
|
2345
|
-
/* @__PURE__ */
|
|
2366
|
+
/* @__PURE__ */ P("button", { disabled: k === 0, onClick: () => y(k - 1), style: we, children: [
|
|
2346
2367
|
"← ",
|
|
2347
2368
|
a("security.audit.prev", "Prev")
|
|
2348
2369
|
] }),
|
|
2349
|
-
/* @__PURE__ */
|
|
2370
|
+
/* @__PURE__ */ P("span", { children: [
|
|
2350
2371
|
k + 1,
|
|
2351
2372
|
" / ",
|
|
2352
2373
|
R
|
|
2353
2374
|
] }),
|
|
2354
|
-
/* @__PURE__ */
|
|
2375
|
+
/* @__PURE__ */ P(
|
|
2355
2376
|
"button",
|
|
2356
2377
|
{
|
|
2357
2378
|
disabled: k >= R - 1,
|
|
2358
|
-
onClick: () =>
|
|
2359
|
-
style:
|
|
2379
|
+
onClick: () => y(k + 1),
|
|
2380
|
+
style: we,
|
|
2360
2381
|
children: [
|
|
2361
2382
|
a("security.audit.next", "Next"),
|
|
2362
2383
|
" →"
|
|
@@ -2381,50 +2402,49 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2381
2402
|
]
|
|
2382
2403
|
}
|
|
2383
2404
|
);
|
|
2384
|
-
},
|
|
2405
|
+
}, xe = {
|
|
2385
2406
|
fontSize: 12,
|
|
2386
2407
|
padding: "4px 8px",
|
|
2387
2408
|
background: "var(--security-bg)",
|
|
2388
2409
|
color: "var(--security-text)",
|
|
2389
2410
|
border: "1px solid var(--security-border)",
|
|
2390
2411
|
borderRadius: "var(--security-radius)"
|
|
2391
|
-
},
|
|
2412
|
+
}, gt = {
|
|
2392
2413
|
background: "none",
|
|
2393
2414
|
border: "1px solid var(--security-border)",
|
|
2394
2415
|
borderRadius: "var(--security-radius)",
|
|
2395
2416
|
padding: "4px 8px",
|
|
2396
2417
|
cursor: "pointer",
|
|
2397
2418
|
fontSize: 16
|
|
2398
|
-
},
|
|
2419
|
+
}, we = {
|
|
2399
2420
|
background: "none",
|
|
2400
2421
|
border: "none",
|
|
2401
2422
|
cursor: "pointer",
|
|
2402
2423
|
color: "var(--security-biometric)",
|
|
2403
2424
|
fontWeight: 600,
|
|
2404
2425
|
fontSize: 13
|
|
2405
|
-
},
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
passphrase: "🔤"
|
|
2426
|
+
}, Se = {
|
|
2427
|
+
display: "inline-block",
|
|
2428
|
+
width: "0.3em",
|
|
2429
|
+
height: "0.6em",
|
|
2430
|
+
margin: "0 0.35em 0.15em 0.1em",
|
|
2431
|
+
borderRight: "0.12em solid currentColor",
|
|
2432
|
+
borderBottom: "0.12em solid currentColor",
|
|
2433
|
+
transform: "rotate(45deg)"
|
|
2414
2434
|
}, Nt = ({
|
|
2415
2435
|
options: e,
|
|
2416
2436
|
requiredCount: t = 1,
|
|
2417
2437
|
onSelect: r,
|
|
2418
2438
|
onComplete: n,
|
|
2419
|
-
className:
|
|
2420
|
-
label:
|
|
2439
|
+
className: s,
|
|
2440
|
+
label: i,
|
|
2421
2441
|
layout: o = "grid"
|
|
2422
2442
|
}) => {
|
|
2423
|
-
const { t: a } =
|
|
2424
|
-
return /* @__PURE__ */
|
|
2443
|
+
const { t: a } = te(), g = e.filter((f) => f.verified).length, v = g >= t;
|
|
2444
|
+
return /* @__PURE__ */ P(
|
|
2425
2445
|
"div",
|
|
2426
2446
|
{
|
|
2427
|
-
className:
|
|
2447
|
+
className: s,
|
|
2428
2448
|
style: {
|
|
2429
2449
|
fontFamily: "var(--security-font)",
|
|
2430
2450
|
color: "var(--security-text)",
|
|
@@ -2433,7 +2453,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2433
2453
|
gap: 16
|
|
2434
2454
|
},
|
|
2435
2455
|
children: [
|
|
2436
|
-
|
|
2456
|
+
i && /* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: i }),
|
|
2437
2457
|
t > 1 && /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-secondary)" }, children: a("security.mfa.progress", `Verified ${g} of ${t} required`) }),
|
|
2438
2458
|
/* @__PURE__ */ c(
|
|
2439
2459
|
"div",
|
|
@@ -2446,7 +2466,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2446
2466
|
},
|
|
2447
2467
|
children: e.map((f) => {
|
|
2448
2468
|
const m = f.verified ?? !1, k = f.disabled || v;
|
|
2449
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ P(
|
|
2450
2470
|
"button",
|
|
2451
2471
|
{
|
|
2452
2472
|
onClick: () => !k && !m && (r == null ? void 0 : r(f.method)),
|
|
@@ -2466,8 +2486,14 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2466
2486
|
textAlign: o === "grid" ? "center" : "left"
|
|
2467
2487
|
},
|
|
2468
2488
|
children: [
|
|
2469
|
-
/* @__PURE__ */ c("span", { style: { fontSize: 28 }, children: m ?
|
|
2470
|
-
|
|
2489
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 28 }, children: m ? /* @__PURE__ */ c(
|
|
2490
|
+
"span",
|
|
2491
|
+
{
|
|
2492
|
+
"aria-label": "verified",
|
|
2493
|
+
style: { ...Se, color: "var(--security-success)" }
|
|
2494
|
+
}
|
|
2495
|
+
) : f.icon }),
|
|
2496
|
+
/* @__PURE__ */ P("div", { children: [
|
|
2471
2497
|
/* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f.label ?? f.method }),
|
|
2472
2498
|
f.description && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 2 }, children: f.description })
|
|
2473
2499
|
] })
|
|
@@ -2478,7 +2504,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2478
2504
|
})
|
|
2479
2505
|
}
|
|
2480
2506
|
),
|
|
2481
|
-
v && /* @__PURE__ */
|
|
2507
|
+
v && /* @__PURE__ */ P(
|
|
2482
2508
|
"div",
|
|
2483
2509
|
{
|
|
2484
2510
|
style: {
|
|
@@ -2489,7 +2515,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2489
2515
|
padding: 8
|
|
2490
2516
|
},
|
|
2491
2517
|
children: [
|
|
2492
|
-
"
|
|
2518
|
+
/* @__PURE__ */ c("span", { "aria-hidden": "true", style: Se }),
|
|
2493
2519
|
a("security.mfa.complete", "All factors verified")
|
|
2494
2520
|
]
|
|
2495
2521
|
}
|
|
@@ -2502,25 +2528,25 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2502
2528
|
onRevoke: t,
|
|
2503
2529
|
onRevokeAll: r,
|
|
2504
2530
|
onTrust: n,
|
|
2505
|
-
className:
|
|
2506
|
-
label:
|
|
2531
|
+
className: s,
|
|
2532
|
+
label: i,
|
|
2507
2533
|
showRevokeAll: o = !0
|
|
2508
2534
|
}) => {
|
|
2509
|
-
const { t: a } =
|
|
2535
|
+
const { t: a } = te(), [g, v] = j(/* @__PURE__ */ new Set()), f = ae(
|
|
2510
2536
|
() => [...e].sort(
|
|
2511
|
-
(
|
|
2537
|
+
(y, D) => (D.current ? 1 : 0) - (y.current ? 1 : 0) || D.lastActive - y.lastActive
|
|
2512
2538
|
),
|
|
2513
2539
|
[e]
|
|
2514
|
-
), m = (
|
|
2515
|
-
const D = new Date(
|
|
2540
|
+
), m = (y) => {
|
|
2541
|
+
const D = new Date(y), b = Date.now() - y;
|
|
2516
2542
|
return b < 6e4 ? a("security.session.justNow", "Just now") : b < 36e5 ? `${Math.floor(b / 6e4)}m ago` : b < 864e5 ? `${Math.floor(b / 36e5)}h ago` : D.toLocaleDateString();
|
|
2517
|
-
}, k = (
|
|
2518
|
-
v((D) => new Set(D).add(
|
|
2543
|
+
}, k = (y) => {
|
|
2544
|
+
v((D) => new Set(D).add(y)), t == null || t(y);
|
|
2519
2545
|
};
|
|
2520
|
-
return /* @__PURE__ */
|
|
2546
|
+
return /* @__PURE__ */ P(
|
|
2521
2547
|
"div",
|
|
2522
2548
|
{
|
|
2523
|
-
className:
|
|
2549
|
+
className: s,
|
|
2524
2550
|
style: {
|
|
2525
2551
|
fontFamily: "var(--security-font)",
|
|
2526
2552
|
color: "var(--security-text)",
|
|
@@ -2530,7 +2556,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2530
2556
|
overflow: "hidden"
|
|
2531
2557
|
},
|
|
2532
2558
|
children: [
|
|
2533
|
-
/* @__PURE__ */
|
|
2559
|
+
/* @__PURE__ */ P(
|
|
2534
2560
|
"div",
|
|
2535
2561
|
{
|
|
2536
2562
|
style: {
|
|
@@ -2542,7 +2568,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2542
2568
|
borderBottom: "1px solid var(--security-border)"
|
|
2543
2569
|
},
|
|
2544
2570
|
children: [
|
|
2545
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children:
|
|
2571
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: i ?? a("security.session.title", "Active Sessions") }),
|
|
2546
2572
|
o && e.length > 1 && /* @__PURE__ */ c(
|
|
2547
2573
|
"button",
|
|
2548
2574
|
{
|
|
@@ -2562,8 +2588,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2562
2588
|
]
|
|
2563
2589
|
}
|
|
2564
2590
|
),
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
f.map((
|
|
2591
|
+
/* @__PURE__ */ P("div", { children: [
|
|
2592
|
+
f.map((y) => /* @__PURE__ */ P(
|
|
2567
2593
|
"div",
|
|
2568
2594
|
{
|
|
2569
2595
|
style: {
|
|
@@ -2572,16 +2598,28 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2572
2598
|
justifyContent: "space-between",
|
|
2573
2599
|
padding: "12px 16px",
|
|
2574
2600
|
borderBottom: "1px solid var(--security-border)",
|
|
2575
|
-
opacity: g.has(
|
|
2576
|
-
background:
|
|
2601
|
+
opacity: g.has(y.id) ? 0.5 : 1,
|
|
2602
|
+
background: y.current ? "rgba(59,130,246,0.04)" : void 0
|
|
2577
2603
|
},
|
|
2578
2604
|
children: [
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */ c(
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2605
|
+
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
|
|
2606
|
+
/* @__PURE__ */ c(
|
|
2607
|
+
"span",
|
|
2608
|
+
{
|
|
2609
|
+
style: {
|
|
2610
|
+
fontSize: 10,
|
|
2611
|
+
fontWeight: 600,
|
|
2612
|
+
textTransform: "uppercase",
|
|
2613
|
+
color: "var(--security-text-muted)",
|
|
2614
|
+
minWidth: 48
|
|
2615
|
+
},
|
|
2616
|
+
children: y.device.toLowerCase().includes("mobile") ? a("security.session.mobile", "Mobile") : a("security.session.desktop", "Desktop")
|
|
2617
|
+
}
|
|
2618
|
+
),
|
|
2619
|
+
/* @__PURE__ */ P("div", { children: [
|
|
2620
|
+
/* @__PURE__ */ P("div", { style: { fontSize: 14, fontWeight: 500 }, children: [
|
|
2621
|
+
y.device,
|
|
2622
|
+
y.current && /* @__PURE__ */ c(
|
|
2585
2623
|
"span",
|
|
2586
2624
|
{
|
|
2587
2625
|
style: {
|
|
@@ -2589,41 +2627,44 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2589
2627
|
fontSize: 10,
|
|
2590
2628
|
padding: "1px 6px",
|
|
2591
2629
|
background: "var(--security-biometric)",
|
|
2592
|
-
color: "var(--nice-
|
|
2630
|
+
color: "var(--nice-text-on-primary, #fff)",
|
|
2593
2631
|
borderRadius: 8
|
|
2594
2632
|
},
|
|
2595
2633
|
children: a("security.session.current", "Current")
|
|
2596
2634
|
}
|
|
2597
2635
|
),
|
|
2598
|
-
|
|
2636
|
+
y.trusted && /* @__PURE__ */ c(
|
|
2599
2637
|
"span",
|
|
2600
2638
|
{
|
|
2601
2639
|
style: {
|
|
2602
2640
|
marginLeft: 6,
|
|
2603
2641
|
fontSize: 10,
|
|
2604
2642
|
padding: "1px 6px",
|
|
2605
|
-
|
|
2606
|
-
|
|
2643
|
+
// The success tint pair: --security-success turns into the BRIGHT
|
|
2644
|
+
// shade in dark themes (it is a text colour there), so white sat on
|
|
2645
|
+
// pale green.
|
|
2646
|
+
background: "var(--nice-success-bg, #ecfdf5)",
|
|
2647
|
+
color: "var(--nice-success-text, #065f46)",
|
|
2607
2648
|
borderRadius: 8
|
|
2608
2649
|
},
|
|
2609
2650
|
children: a("security.session.trusted", "Trusted")
|
|
2610
2651
|
}
|
|
2611
2652
|
)
|
|
2612
2653
|
] }),
|
|
2613
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-text-muted)", marginTop: 2 }, children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-text-muted)", marginTop: 2 }, children: [y.browser, y.os, y.location].filter(Boolean).join(" · ") }),
|
|
2655
|
+
/* @__PURE__ */ P("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 1 }, children: [
|
|
2615
2656
|
a("security.session.lastActive", "Last active"),
|
|
2616
2657
|
":",
|
|
2617
2658
|
" ",
|
|
2618
|
-
m(
|
|
2659
|
+
m(y.lastActive)
|
|
2619
2660
|
] })
|
|
2620
2661
|
] })
|
|
2621
2662
|
] }),
|
|
2622
|
-
/* @__PURE__ */
|
|
2623
|
-
n && !
|
|
2663
|
+
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 6 }, children: [
|
|
2664
|
+
n && !y.current && /* @__PURE__ */ c(
|
|
2624
2665
|
"button",
|
|
2625
2666
|
{
|
|
2626
|
-
onClick: () => n(
|
|
2667
|
+
onClick: () => n(y.id, !y.trusted),
|
|
2627
2668
|
style: {
|
|
2628
2669
|
fontSize: 11,
|
|
2629
2670
|
padding: "4px 8px",
|
|
@@ -2633,14 +2674,14 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2633
2674
|
cursor: "pointer",
|
|
2634
2675
|
color: "var(--security-text-secondary)"
|
|
2635
2676
|
},
|
|
2636
|
-
children:
|
|
2677
|
+
children: y.trusted ? a("security.session.untrust", "Untrust") : a("security.session.trust", "Trust")
|
|
2637
2678
|
}
|
|
2638
2679
|
),
|
|
2639
|
-
!
|
|
2680
|
+
!y.current && /* @__PURE__ */ c(
|
|
2640
2681
|
"button",
|
|
2641
2682
|
{
|
|
2642
|
-
onClick: () => k(
|
|
2643
|
-
disabled: g.has(
|
|
2683
|
+
onClick: () => k(y.id),
|
|
2684
|
+
disabled: g.has(y.id),
|
|
2644
2685
|
style: {
|
|
2645
2686
|
fontSize: 11,
|
|
2646
2687
|
padding: "4px 10px",
|
|
@@ -2656,7 +2697,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2656
2697
|
] })
|
|
2657
2698
|
]
|
|
2658
2699
|
},
|
|
2659
|
-
|
|
2700
|
+
y.id
|
|
2660
2701
|
)),
|
|
2661
2702
|
e.length === 0 && /* @__PURE__ */ c(
|
|
2662
2703
|
"div",
|
|
@@ -2679,47 +2720,47 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2679
2720
|
onScoreComputed: t,
|
|
2680
2721
|
trustThreshold: r = 60,
|
|
2681
2722
|
showFactors: n = !0,
|
|
2682
|
-
showFingerprint:
|
|
2683
|
-
className:
|
|
2723
|
+
showFingerprint: s = !1,
|
|
2724
|
+
className: i,
|
|
2684
2725
|
label: o
|
|
2685
2726
|
}) => {
|
|
2686
|
-
const { t: a } =
|
|
2727
|
+
const { t: a } = te(), [g, v] = j(e ?? null), [f, m] = j(!e), k = G(async () => {
|
|
2687
2728
|
var D;
|
|
2688
2729
|
m(!0);
|
|
2689
2730
|
try {
|
|
2690
|
-
const R =
|
|
2691
|
-
let
|
|
2731
|
+
const R = De(), b = await de(), T = [];
|
|
2732
|
+
let p = 50;
|
|
2692
2733
|
R.platform && !R.platform.includes("Linux") && (T.push({
|
|
2693
2734
|
name: "Known platform",
|
|
2694
2735
|
score: 5,
|
|
2695
2736
|
description: "Running on a recognized platform",
|
|
2696
2737
|
weight: 0.05
|
|
2697
|
-
}),
|
|
2738
|
+
}), p += 5), navigator.cookieEnabled && (T.push({
|
|
2698
2739
|
name: "Cookies enabled",
|
|
2699
2740
|
score: 5,
|
|
2700
2741
|
description: "Browser cookies are enabled",
|
|
2701
2742
|
weight: 0.05
|
|
2702
|
-
}),
|
|
2743
|
+
}), p += 5), R.screenResolution[0] >= 360 && R.screenResolution[1] >= 640 && (T.push({
|
|
2703
2744
|
name: "Standard resolution",
|
|
2704
2745
|
score: 5,
|
|
2705
2746
|
description: "Screen resolution within normal range",
|
|
2706
2747
|
weight: 0.05
|
|
2707
|
-
}),
|
|
2748
|
+
}), p += 5), typeof window < "u" && window.isSecureContext && (T.push({
|
|
2708
2749
|
name: "Secure context",
|
|
2709
2750
|
score: 10,
|
|
2710
2751
|
description: "Running in HTTPS secure context",
|
|
2711
2752
|
weight: 0.1
|
|
2712
|
-
}),
|
|
2753
|
+
}), p += 10), ((D = navigator.languages) == null ? void 0 : D.length) > 0 && (T.push({
|
|
2713
2754
|
name: "Language configured",
|
|
2714
2755
|
score: 5,
|
|
2715
2756
|
description: "Browser language is set",
|
|
2716
2757
|
weight: 0.05
|
|
2717
|
-
}),
|
|
2758
|
+
}), p += 5), R.touchSupport && (T.push({
|
|
2718
2759
|
name: "Touch device",
|
|
2719
2760
|
score: 5,
|
|
2720
2761
|
description: "Touch input is supported",
|
|
2721
2762
|
weight: 0.05
|
|
2722
|
-
}),
|
|
2763
|
+
}), p += 5);
|
|
2723
2764
|
try {
|
|
2724
2765
|
const l = document.createElement("canvas").getContext("webgl");
|
|
2725
2766
|
l && l.getExtension("WEBGL_debug_renderer_info") && (T.push({
|
|
@@ -2727,7 +2768,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2727
2768
|
score: 10,
|
|
2728
2769
|
description: "Hardware GPU detected",
|
|
2729
2770
|
weight: 0.1
|
|
2730
|
-
}),
|
|
2771
|
+
}), p += 10);
|
|
2731
2772
|
} catch {
|
|
2732
2773
|
}
|
|
2733
2774
|
navigator.credentials && (T.push({
|
|
@@ -2735,11 +2776,11 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2735
2776
|
score: 5,
|
|
2736
2777
|
description: "Credential Management API available",
|
|
2737
2778
|
weight: 0.05
|
|
2738
|
-
}),
|
|
2779
|
+
}), p += 5), p = Math.min(100, Math.max(0, p));
|
|
2739
2780
|
const S = Date.now(), u = {
|
|
2740
|
-
score:
|
|
2781
|
+
score: p,
|
|
2741
2782
|
factors: T,
|
|
2742
|
-
trusted:
|
|
2783
|
+
trusted: p >= r,
|
|
2743
2784
|
firstSeen: S,
|
|
2744
2785
|
lastSeen: S,
|
|
2745
2786
|
fingerprint: b
|
|
@@ -2749,16 +2790,16 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2749
2790
|
m(!1);
|
|
2750
2791
|
}
|
|
2751
2792
|
}, [r, t]);
|
|
2752
|
-
|
|
2793
|
+
ne(() => {
|
|
2753
2794
|
e || k();
|
|
2754
|
-
}, [e, k]),
|
|
2795
|
+
}, [e, k]), ne(() => {
|
|
2755
2796
|
e && v(e);
|
|
2756
2797
|
}, [e]);
|
|
2757
|
-
const
|
|
2758
|
-
return /* @__PURE__ */
|
|
2798
|
+
const y = g ? g.score >= 80 ? "var(--security-success)" : g.score >= 50 ? "var(--security-warning)" : "var(--security-error)" : "var(--security-text-muted)";
|
|
2799
|
+
return /* @__PURE__ */ P(
|
|
2759
2800
|
"div",
|
|
2760
2801
|
{
|
|
2761
|
-
className:
|
|
2802
|
+
className: i,
|
|
2762
2803
|
style: {
|
|
2763
2804
|
fontFamily: "var(--security-font)",
|
|
2764
2805
|
color: "var(--security-text)",
|
|
@@ -2772,10 +2813,10 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2772
2813
|
alignItems: "center"
|
|
2773
2814
|
},
|
|
2774
2815
|
children: [
|
|
2775
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: o ?? a("security.trust.title", "
|
|
2776
|
-
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: a("security.trust.computing", "Analysing device…") }) : g ? /* @__PURE__ */
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: o ?? a("security.trust.title", "Device Trust") }),
|
|
2817
|
+
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: a("security.trust.computing", "Analysing device…") }) : g ? /* @__PURE__ */ P(Pe, { children: [
|
|
2818
|
+
/* @__PURE__ */ P("div", { style: { position: "relative", width: 100, height: 100 }, children: [
|
|
2819
|
+
/* @__PURE__ */ P(
|
|
2779
2820
|
"svg",
|
|
2780
2821
|
{
|
|
2781
2822
|
viewBox: "0 0 36 36",
|
|
@@ -2799,7 +2840,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2799
2840
|
cy: "18",
|
|
2800
2841
|
r: "15.9",
|
|
2801
2842
|
fill: "none",
|
|
2802
|
-
stroke:
|
|
2843
|
+
stroke: y,
|
|
2803
2844
|
strokeWidth: "2.5",
|
|
2804
2845
|
strokeDasharray: `${g.score}, 100`,
|
|
2805
2846
|
strokeLinecap: "round"
|
|
@@ -2808,7 +2849,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2808
2849
|
]
|
|
2809
2850
|
}
|
|
2810
2851
|
),
|
|
2811
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ P(
|
|
2812
2853
|
"div",
|
|
2813
2854
|
{
|
|
2814
2855
|
style: {
|
|
@@ -2820,7 +2861,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2820
2861
|
justifyContent: "center"
|
|
2821
2862
|
},
|
|
2822
2863
|
children: [
|
|
2823
|
-
/* @__PURE__ */ c("span", { style: { fontSize: 24, fontWeight: 700, color:
|
|
2864
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 24, fontWeight: 700, color: y }, children: g.score }),
|
|
2824
2865
|
/* @__PURE__ */ c("span", { style: { fontSize: 10, color: "var(--security-text-muted)" }, children: "/100" })
|
|
2825
2866
|
]
|
|
2826
2867
|
}
|
|
@@ -2834,11 +2875,11 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2834
2875
|
fontWeight: 600,
|
|
2835
2876
|
color: g.trusted ? "var(--security-success)" : "var(--security-warning)"
|
|
2836
2877
|
},
|
|
2837
|
-
children: g.trusted ? a("security.trust.trusted", "
|
|
2878
|
+
children: g.trusted ? a("security.trust.trusted", "Device Trusted") : a("security.trust.untrusted", "Low Trust Score")
|
|
2838
2879
|
}
|
|
2839
2880
|
),
|
|
2840
|
-
n && g.factors.length > 0 && /* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2881
|
+
n && g.factors.length > 0 && /* @__PURE__ */ P("div", { style: { width: "100%", fontSize: 12 }, children: [
|
|
2882
|
+
/* @__PURE__ */ P(
|
|
2842
2883
|
"div",
|
|
2843
2884
|
{
|
|
2844
2885
|
style: {
|
|
@@ -2854,7 +2895,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2854
2895
|
),
|
|
2855
2896
|
/* @__PURE__ */ c("ul", { style: { margin: 0, paddingLeft: 18, color: "var(--security-text-muted)" }, children: g.factors.map((D, R) => /* @__PURE__ */ c("li", { style: { marginBottom: 2 }, children: D.name }, R)) })
|
|
2856
2897
|
] }),
|
|
2857
|
-
|
|
2898
|
+
s && g.fingerprint && /* @__PURE__ */ c(
|
|
2858
2899
|
"div",
|
|
2859
2900
|
{
|
|
2860
2901
|
style: {
|
|
@@ -2879,7 +2920,7 @@ function mt(e) {
|
|
|
2879
2920
|
let t = 0;
|
|
2880
2921
|
return e.length >= 8 && t++, e.length >= 12 && t++, /[a-z]/.test(e) && /[A-Z]/.test(e) && t++, /\d/.test(e) && t++, /[^a-zA-Z0-9]/.test(e) && t++, /(.)\1{3,}/.test(e) && t--, Math.max(0, Math.min(4, t));
|
|
2881
2922
|
}
|
|
2882
|
-
const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"],
|
|
2923
|
+
const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
|
|
2883
2924
|
"var(--nice-danger, #ef4444)",
|
|
2884
2925
|
"var(--nice-warning, #f97316)",
|
|
2885
2926
|
"var(--nice-warning, #eab308)",
|
|
@@ -2890,8 +2931,8 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
2890
2931
|
expectedHash: t,
|
|
2891
2932
|
minStrength: r = 2,
|
|
2892
2933
|
minLength: n = 8,
|
|
2893
|
-
onComplete:
|
|
2894
|
-
onVerify:
|
|
2934
|
+
onComplete: s,
|
|
2935
|
+
onVerify: i,
|
|
2895
2936
|
onStatusChange: o,
|
|
2896
2937
|
onError: a,
|
|
2897
2938
|
label: g,
|
|
@@ -2900,41 +2941,41 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
2900
2941
|
showStrength: m = !0,
|
|
2901
2942
|
maxAttempts: k = 5
|
|
2902
2943
|
}) => {
|
|
2903
|
-
const { t:
|
|
2944
|
+
const { t: y } = te(), [D, R] = j(""), [b, T] = j(""), [p, S] = j(!1), [u, w] = j("idle"), [l, h] = j(0), [L, q] = j(""), Z = ee(null), _ = mt(D), H = G(
|
|
2904
2945
|
($) => {
|
|
2905
|
-
|
|
2946
|
+
w($), o == null || o($);
|
|
2906
2947
|
},
|
|
2907
2948
|
[o]
|
|
2908
|
-
),
|
|
2949
|
+
), J = G(async () => {
|
|
2909
2950
|
if (q(""), H("processing"), e === "set") {
|
|
2910
2951
|
if (D.length < n) {
|
|
2911
|
-
q(
|
|
2952
|
+
q(y("security.passphrase.tooShort", `Minimum ${n} characters`)), H("idle");
|
|
2912
2953
|
return;
|
|
2913
2954
|
}
|
|
2914
|
-
if (
|
|
2915
|
-
q(
|
|
2955
|
+
if (_ < r) {
|
|
2956
|
+
q(y("security.passphrase.tooWeak", "Passphrase is too weak")), H("idle");
|
|
2916
2957
|
return;
|
|
2917
2958
|
}
|
|
2918
2959
|
if (D !== b) {
|
|
2919
|
-
q(
|
|
2960
|
+
q(y("security.passphrase.noMatch", "Passphrases do not match")), H("failure"), setTimeout(() => H("idle"), 1e3);
|
|
2920
2961
|
return;
|
|
2921
2962
|
}
|
|
2922
|
-
|
|
2963
|
+
s == null || s(D), H("success");
|
|
2923
2964
|
return;
|
|
2924
2965
|
}
|
|
2925
2966
|
if (t) {
|
|
2926
|
-
const $ = new TextEncoder(),
|
|
2927
|
-
if (Array.from(new Uint8Array(
|
|
2928
|
-
H("success"),
|
|
2967
|
+
const $ = new TextEncoder(), B = await crypto.subtle.digest("SHA-256", $.encode(D));
|
|
2968
|
+
if (Array.from(new Uint8Array(B)).map((U) => U.toString(16).padStart(2, "0")).join("") === t)
|
|
2969
|
+
H("success"), i == null || i({
|
|
2929
2970
|
success: !0,
|
|
2930
2971
|
confidence: 1,
|
|
2931
2972
|
method: "passphrase",
|
|
2932
2973
|
timestamp: Date.now(),
|
|
2933
2974
|
duration: 0
|
|
2934
|
-
}),
|
|
2975
|
+
}), s == null || s(D);
|
|
2935
2976
|
else {
|
|
2936
2977
|
const U = l + 1;
|
|
2937
|
-
h(U), U >= k ? (H("failure"), a == null || a(new Error("Too many failed attempts"))) : (q(
|
|
2978
|
+
h(U), U >= k ? (H("failure"), a == null || a(new Error("Too many failed attempts"))) : (q(y("security.passphrase.incorrect", "Incorrect passphrase")), H("idle")), i == null || i({
|
|
2938
2979
|
success: !1,
|
|
2939
2980
|
confidence: 0,
|
|
2940
2981
|
method: "passphrase",
|
|
@@ -2943,21 +2984,21 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
2943
2984
|
});
|
|
2944
2985
|
}
|
|
2945
2986
|
} else
|
|
2946
|
-
|
|
2987
|
+
s == null || s(D), H("success");
|
|
2947
2988
|
}, [
|
|
2948
2989
|
D,
|
|
2949
2990
|
b,
|
|
2950
2991
|
e,
|
|
2951
2992
|
t,
|
|
2952
|
-
|
|
2993
|
+
_,
|
|
2953
2994
|
r,
|
|
2954
2995
|
n,
|
|
2955
2996
|
l,
|
|
2956
2997
|
k,
|
|
2957
|
-
|
|
2998
|
+
y,
|
|
2958
2999
|
H,
|
|
2959
|
-
i,
|
|
2960
3000
|
s,
|
|
3001
|
+
i,
|
|
2961
3002
|
a
|
|
2962
3003
|
]), W = {
|
|
2963
3004
|
width: "100%",
|
|
@@ -2970,7 +3011,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
2970
3011
|
boxSizing: "border-box",
|
|
2971
3012
|
fontFamily: "var(--security-font)"
|
|
2972
3013
|
};
|
|
2973
|
-
return /* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ P(
|
|
2974
3015
|
"div",
|
|
2975
3016
|
{
|
|
2976
3017
|
className: f,
|
|
@@ -2984,25 +3025,25 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
2984
3025
|
},
|
|
2985
3026
|
children: [
|
|
2986
3027
|
g && /* @__PURE__ */ c("label", { style: { fontSize: 14, fontWeight: 600 }, children: g }),
|
|
2987
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ P("div", { style: { position: "relative" }, children: [
|
|
2988
3029
|
/* @__PURE__ */ c(
|
|
2989
3030
|
"input",
|
|
2990
3031
|
{
|
|
2991
|
-
ref:
|
|
2992
|
-
type:
|
|
3032
|
+
ref: Z,
|
|
3033
|
+
type: p ? "text" : "password",
|
|
2993
3034
|
value: D,
|
|
2994
3035
|
onChange: ($) => R($.target.value),
|
|
2995
|
-
placeholder: v ??
|
|
3036
|
+
placeholder: v ?? y("security.passphrase.placeholder", "Enter passphrase"),
|
|
2996
3037
|
style: W,
|
|
2997
3038
|
disabled: u === "success",
|
|
2998
|
-
onKeyDown: ($) => $.key === "Enter" &&
|
|
3039
|
+
onKeyDown: ($) => $.key === "Enter" && J()
|
|
2999
3040
|
}
|
|
3000
3041
|
),
|
|
3001
3042
|
/* @__PURE__ */ c(
|
|
3002
3043
|
"button",
|
|
3003
3044
|
{
|
|
3004
3045
|
type: "button",
|
|
3005
|
-
onClick: () => S(!
|
|
3046
|
+
onClick: () => S(!p),
|
|
3006
3047
|
style: {
|
|
3007
3048
|
position: "absolute",
|
|
3008
3049
|
right: 8,
|
|
@@ -3015,35 +3056,35 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
3015
3056
|
color: "var(--security-text-muted)"
|
|
3016
3057
|
},
|
|
3017
3058
|
tabIndex: -1,
|
|
3018
|
-
children:
|
|
3059
|
+
children: p ? y("security.passphrase.hide", "Hide") : y("security.passphrase.show", "Show")
|
|
3019
3060
|
}
|
|
3020
3061
|
)
|
|
3021
3062
|
] }),
|
|
3022
|
-
e === "set" && m && D.length > 0 && /* @__PURE__ */
|
|
3063
|
+
e === "set" && m && D.length > 0 && /* @__PURE__ */ P("div", { children: [
|
|
3023
3064
|
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 3, height: 4 }, children: [0, 1, 2, 3].map(($) => /* @__PURE__ */ c(
|
|
3024
3065
|
"div",
|
|
3025
3066
|
{
|
|
3026
3067
|
style: {
|
|
3027
3068
|
flex: 1,
|
|
3028
3069
|
borderRadius: 2,
|
|
3029
|
-
background: $ <
|
|
3070
|
+
background: $ < _ ? ke[_] : "var(--security-border)",
|
|
3030
3071
|
transition: "background 0.2s"
|
|
3031
3072
|
}
|
|
3032
3073
|
},
|
|
3033
3074
|
$
|
|
3034
3075
|
)) }),
|
|
3035
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color:
|
|
3076
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: ke[_] }, children: y(`security.passphrase.strength${_}`, vt[_]) })
|
|
3036
3077
|
] }),
|
|
3037
3078
|
e === "set" && /* @__PURE__ */ c(
|
|
3038
3079
|
"input",
|
|
3039
3080
|
{
|
|
3040
|
-
type:
|
|
3081
|
+
type: p ? "text" : "password",
|
|
3041
3082
|
value: b,
|
|
3042
3083
|
onChange: ($) => T($.target.value),
|
|
3043
|
-
placeholder:
|
|
3084
|
+
placeholder: y("security.passphrase.confirmPlaceholder", "Confirm passphrase"),
|
|
3044
3085
|
style: W,
|
|
3045
3086
|
disabled: u === "success",
|
|
3046
|
-
onKeyDown: ($) => $.key === "Enter" &&
|
|
3087
|
+
onKeyDown: ($) => $.key === "Enter" && J(),
|
|
3047
3088
|
onPaste: ($) => $.preventDefault()
|
|
3048
3089
|
}
|
|
3049
3090
|
),
|
|
@@ -3051,28 +3092,28 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = [
|
|
|
3051
3092
|
/* @__PURE__ */ c(
|
|
3052
3093
|
"button",
|
|
3053
3094
|
{
|
|
3054
|
-
onClick:
|
|
3095
|
+
onClick: J,
|
|
3055
3096
|
disabled: !D || u === "processing" || u === "success",
|
|
3056
3097
|
style: {
|
|
3057
3098
|
padding: "10px 20px",
|
|
3058
3099
|
fontSize: 14,
|
|
3059
3100
|
fontWeight: 600,
|
|
3060
3101
|
background: u === "success" ? "var(--security-success)" : "var(--security-biometric)",
|
|
3061
|
-
color: "var(--nice-
|
|
3102
|
+
color: "var(--nice-text-on-primary, #fff)",
|
|
3062
3103
|
border: "none",
|
|
3063
3104
|
borderRadius: "var(--security-radius)",
|
|
3064
3105
|
cursor: u === "success" ? "default" : "pointer",
|
|
3065
3106
|
opacity: !D || u === "processing" ? 0.6 : 1
|
|
3066
3107
|
},
|
|
3067
|
-
children: u === "success" ?
|
|
3108
|
+
children: u === "success" ? y("security.passphrase.accepted", "Accepted") : e === "set" ? y("security.passphrase.setBtn", "Set Passphrase") : y("security.passphrase.verifyBtn", "Verify")
|
|
3068
3109
|
}
|
|
3069
3110
|
),
|
|
3070
|
-
l > 0 && u !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children:
|
|
3111
|
+
l > 0 && u !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: y("security.passphrase.attempts", `${l}/${k} attempts`) })
|
|
3071
3112
|
]
|
|
3072
3113
|
}
|
|
3073
3114
|
);
|
|
3074
3115
|
};
|
|
3075
|
-
function
|
|
3116
|
+
function Bt(e) {
|
|
3076
3117
|
const t = [], r = {
|
|
3077
3118
|
defaultSrc: "default-src",
|
|
3078
3119
|
scriptSrc: "script-src",
|
|
@@ -3093,21 +3134,21 @@ function _t(e) {
|
|
|
3093
3134
|
upgradeInsecureRequests: "upgrade-insecure-requests",
|
|
3094
3135
|
blockAllMixedContent: "block-all-mixed-content"
|
|
3095
3136
|
};
|
|
3096
|
-
return Object.entries(e.directives).forEach(([n,
|
|
3097
|
-
const
|
|
3098
|
-
if (
|
|
3099
|
-
if (typeof
|
|
3100
|
-
|
|
3101
|
-
else if (typeof
|
|
3102
|
-
t.push(`${
|
|
3103
|
-
else if (Array.isArray(
|
|
3104
|
-
let o =
|
|
3105
|
-
e.nonce && (n === "scriptSrc" || n === "styleSrc") && (o = [...o, `'nonce-${e.nonce}'`]), t.push(`${
|
|
3137
|
+
return Object.entries(e.directives).forEach(([n, s]) => {
|
|
3138
|
+
const i = r[n];
|
|
3139
|
+
if (i) {
|
|
3140
|
+
if (typeof s == "boolean")
|
|
3141
|
+
s && t.push(i);
|
|
3142
|
+
else if (typeof s == "string")
|
|
3143
|
+
t.push(`${i} ${s}`);
|
|
3144
|
+
else if (Array.isArray(s)) {
|
|
3145
|
+
let o = s;
|
|
3146
|
+
e.nonce && (n === "scriptSrc" || n === "styleSrc") && (o = [...o, `'nonce-${e.nonce}'`]), t.push(`${i} ${o.join(" ")}`);
|
|
3106
3147
|
}
|
|
3107
3148
|
}
|
|
3108
3149
|
}), t.join("; ");
|
|
3109
3150
|
}
|
|
3110
|
-
function
|
|
3151
|
+
function _t(e) {
|
|
3111
3152
|
const t = "'self'";
|
|
3112
3153
|
return {
|
|
3113
3154
|
defaultSrc: [t],
|
|
@@ -3159,26 +3200,26 @@ function Ht(e) {
|
|
|
3159
3200
|
function Ot(e) {
|
|
3160
3201
|
const t = ["script", "iframe", "object", "embed", "form"];
|
|
3161
3202
|
let r = e;
|
|
3162
|
-
t.forEach((
|
|
3163
|
-
const o = new RegExp(`<${
|
|
3203
|
+
t.forEach((i) => {
|
|
3204
|
+
const o = new RegExp(`<${i}[^>]*>.*?</${i}>`, "gi");
|
|
3164
3205
|
r = r.replace(o, "");
|
|
3165
|
-
const a = new RegExp(`<${
|
|
3206
|
+
const a = new RegExp(`<${i}[^>]*/>`, "gi");
|
|
3166
3207
|
r = r.replace(a, "");
|
|
3167
3208
|
});
|
|
3168
3209
|
const n = /\s+on\w+\s*=/gi;
|
|
3169
3210
|
r = r.replace(n, " data-removed=");
|
|
3170
|
-
const
|
|
3171
|
-
return r = r.replace(
|
|
3211
|
+
const s = /javascript:/gi;
|
|
3212
|
+
return r = r.replace(s, ""), r;
|
|
3172
3213
|
}
|
|
3173
3214
|
function qt(e, t) {
|
|
3174
3215
|
let r = e;
|
|
3175
3216
|
if (t != null && t.allowedTags) {
|
|
3176
3217
|
const n = /<\/?([a-z][a-z0-9]*)[^>]*>/gi;
|
|
3177
|
-
r = r.replace(n, (
|
|
3218
|
+
r = r.replace(n, (s, i) => t.allowedTags.includes(i.toLowerCase()) ? s : "");
|
|
3178
3219
|
}
|
|
3179
3220
|
return r = r.replace(/\s+on\w+\s*=/gi, " data-removed="), r = r.replace(/javascript:/gi, ""), { __html: r };
|
|
3180
3221
|
}
|
|
3181
|
-
const
|
|
3222
|
+
const me = {
|
|
3182
3223
|
headerName: "X-CSRF-Token",
|
|
3183
3224
|
cookieName: "XSRF-TOKEN",
|
|
3184
3225
|
fieldName: "_csrf"
|
|
@@ -3190,21 +3231,21 @@ function Kt() {
|
|
|
3190
3231
|
}
|
|
3191
3232
|
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
3192
3233
|
}
|
|
3193
|
-
function Me(e =
|
|
3234
|
+
function Me(e = me.cookieName) {
|
|
3194
3235
|
if (typeof document > "u")
|
|
3195
3236
|
return null;
|
|
3196
3237
|
const t = document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));
|
|
3197
3238
|
return t ? decodeURIComponent(t[2]) : null;
|
|
3198
3239
|
}
|
|
3199
|
-
function Gt(e =
|
|
3240
|
+
function Gt(e = me) {
|
|
3200
3241
|
return async function(r, n = {}) {
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3203
|
-
const
|
|
3204
|
-
return
|
|
3242
|
+
const s = Me(e.cookieName);
|
|
3243
|
+
s || console.warn("CSRF token not found");
|
|
3244
|
+
const i = new Headers(n.headers);
|
|
3245
|
+
return s && e.headerName && i.set(e.headerName, s), fetch(r, { ...n, headers: i });
|
|
3205
3246
|
};
|
|
3206
3247
|
}
|
|
3207
|
-
function Jt(e =
|
|
3248
|
+
function Jt(e = me) {
|
|
3208
3249
|
const t = Me(e.cookieName);
|
|
3209
3250
|
return {
|
|
3210
3251
|
token: t,
|
|
@@ -3217,9 +3258,9 @@ function Jt(e = pe) {
|
|
|
3217
3258
|
};
|
|
3218
3259
|
}
|
|
3219
3260
|
function wt(e) {
|
|
3220
|
-
const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((
|
|
3221
|
-
function n(
|
|
3222
|
-
const o = r(
|
|
3261
|
+
const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((i) => i.url);
|
|
3262
|
+
function n(i) {
|
|
3263
|
+
const o = r(i), a = Date.now();
|
|
3223
3264
|
let g = t.get(o);
|
|
3224
3265
|
(!g || a > g.resetAt) && (g = {
|
|
3225
3266
|
count: 0,
|
|
@@ -3228,20 +3269,20 @@ function wt(e) {
|
|
|
3228
3269
|
const v = g.count <= e.maxRequests, f = Math.max(0, e.maxRequests - g.count);
|
|
3229
3270
|
return { allowed: v, remaining: f, resetAt: g.resetAt };
|
|
3230
3271
|
}
|
|
3231
|
-
function i
|
|
3232
|
-
|
|
3272
|
+
function s(i) {
|
|
3273
|
+
i ? t.delete(i) : t.clear();
|
|
3233
3274
|
}
|
|
3234
|
-
return { checkLimit: n, reset:
|
|
3275
|
+
return { checkLimit: n, reset: s };
|
|
3235
3276
|
}
|
|
3236
3277
|
function Zt(e) {
|
|
3237
3278
|
const t = wt(e);
|
|
3238
|
-
return { checkAndFetch: async (n,
|
|
3239
|
-
const
|
|
3240
|
-
if (!
|
|
3241
|
-
const o = Math.ceil((
|
|
3279
|
+
return { checkAndFetch: async (n, s) => {
|
|
3280
|
+
const i = t.checkLimit({ url: n, method: s == null ? void 0 : s.method });
|
|
3281
|
+
if (!i.allowed) {
|
|
3282
|
+
const o = Math.ceil((i.resetAt - Date.now()) / 1e3);
|
|
3242
3283
|
throw new Error(`Rate limit exceeded. Retry after ${o} seconds.`);
|
|
3243
3284
|
}
|
|
3244
|
-
return fetch(n,
|
|
3285
|
+
return fetch(n, s);
|
|
3245
3286
|
}, checkLimit: t.checkLimit, reset: t.reset };
|
|
3246
3287
|
}
|
|
3247
3288
|
function St(e, t) {
|
|
@@ -3249,13 +3290,13 @@ function St(e, t) {
|
|
|
3249
3290
|
if (t.allowedTypes && t.allowedTypes.length > 0 && (t.allowedTypes.includes(e.type) || r.push(
|
|
3250
3291
|
`File type '${e.type}' is not allowed. Allowed types: ${t.allowedTypes.join(", ")}`
|
|
3251
3292
|
)), t.maxSize && e.size > t.maxSize) {
|
|
3252
|
-
const
|
|
3253
|
-
r.push(`File size (${o}MB) exceeds maximum allowed size (${
|
|
3293
|
+
const i = (t.maxSize / 1048576).toFixed(2), o = (e.size / (1024 * 1024)).toFixed(2);
|
|
3294
|
+
r.push(`File size (${o}MB) exceeds maximum allowed size (${i}MB)`);
|
|
3254
3295
|
}
|
|
3255
|
-
const n = [".exe", ".bat", ".cmd", ".sh", ".ps1", ".vbs", ".js", ".jar"],
|
|
3256
|
-
for (const
|
|
3257
|
-
if (
|
|
3258
|
-
r.push(`File extension '${
|
|
3296
|
+
const n = [".exe", ".bat", ".cmd", ".sh", ".ps1", ".vbs", ".js", ".jar"], s = e.name.toLowerCase();
|
|
3297
|
+
for (const i of n)
|
|
3298
|
+
if (s.includes(i + ".") || s.endsWith(i)) {
|
|
3299
|
+
r.push(`File extension '${i}' is not allowed`);
|
|
3259
3300
|
break;
|
|
3260
3301
|
}
|
|
3261
3302
|
return {
|
|
@@ -3265,21 +3306,21 @@ function St(e, t) {
|
|
|
3265
3306
|
};
|
|
3266
3307
|
}
|
|
3267
3308
|
function Yt(e, t) {
|
|
3268
|
-
const r = [], n = [],
|
|
3309
|
+
const r = [], n = [], s = [];
|
|
3269
3310
|
t.maxFiles && e.length > t.maxFiles && r.push(`Too many files. Maximum allowed: ${t.maxFiles}`);
|
|
3270
|
-
const
|
|
3271
|
-
if (t.maxTotalSize &&
|
|
3272
|
-
const o = (t.maxTotalSize / 1048576).toFixed(2), a = (
|
|
3311
|
+
const i = e.reduce((o, a) => o + a.size, 0);
|
|
3312
|
+
if (t.maxTotalSize && i > t.maxTotalSize) {
|
|
3313
|
+
const o = (t.maxTotalSize / 1048576).toFixed(2), a = (i / (1024 * 1024)).toFixed(2);
|
|
3273
3314
|
r.push(`Total file size (${a}MB) exceeds maximum (${o}MB)`);
|
|
3274
3315
|
}
|
|
3275
3316
|
return e.forEach((o) => {
|
|
3276
3317
|
const a = St(o, t);
|
|
3277
|
-
a.valid ? n.push(o) :
|
|
3318
|
+
a.valid ? n.push(o) : s.push({ file: o, errors: a.errors });
|
|
3278
3319
|
}), {
|
|
3279
|
-
valid: r.length === 0 &&
|
|
3280
|
-
errors: [...r, ...
|
|
3320
|
+
valid: r.length === 0 && s.length === 0,
|
|
3321
|
+
errors: [...r, ...s.flatMap((o) => o.errors)],
|
|
3281
3322
|
validFiles: n,
|
|
3282
|
-
invalidFiles:
|
|
3323
|
+
invalidFiles: s
|
|
3283
3324
|
};
|
|
3284
3325
|
}
|
|
3285
3326
|
async function Xt(e, t) {
|
|
@@ -3338,12 +3379,12 @@ async function tr(e, t, r = fetch) {
|
|
|
3338
3379
|
userId: e
|
|
3339
3380
|
};
|
|
3340
3381
|
return await Promise.all(
|
|
3341
|
-
Object.entries(t).map(async ([
|
|
3382
|
+
Object.entries(t).map(async ([s, i]) => {
|
|
3342
3383
|
try {
|
|
3343
|
-
const o = await r(
|
|
3344
|
-
o.ok && (n[
|
|
3384
|
+
const o = await r(i);
|
|
3385
|
+
o.ok && (n[s] = await o.json());
|
|
3345
3386
|
} catch (o) {
|
|
3346
|
-
console.error(`Failed to fetch ${
|
|
3387
|
+
console.error(`Failed to fetch ${s} data:`, o), n[s] = { error: "Failed to retrieve data" };
|
|
3347
3388
|
}
|
|
3348
3389
|
})
|
|
3349
3390
|
), n;
|
|
@@ -3375,19 +3416,19 @@ function nr(e, t) {
|
|
|
3375
3416
|
}
|
|
3376
3417
|
function ir(e) {
|
|
3377
3418
|
let t = null, r = null, n = Date.now();
|
|
3378
|
-
const
|
|
3419
|
+
const s = e.timeoutMinutes * 60 * 1e3, i = e.warningBeforeMs || 6e4;
|
|
3379
3420
|
function o() {
|
|
3380
3421
|
n = Date.now(), t && clearTimeout(t), r && clearTimeout(r), e.onWarning && (r = setTimeout(() => {
|
|
3381
3422
|
var f;
|
|
3382
|
-
const v =
|
|
3423
|
+
const v = s - (Date.now() - n);
|
|
3383
3424
|
(f = e.onWarning) == null || f.call(e, v);
|
|
3384
|
-
},
|
|
3425
|
+
}, s - i)), t = setTimeout(e.onTimeout, s);
|
|
3385
3426
|
}
|
|
3386
3427
|
function a() {
|
|
3387
3428
|
t && clearTimeout(t), r && clearTimeout(r);
|
|
3388
3429
|
}
|
|
3389
3430
|
function g() {
|
|
3390
|
-
return Math.max(0,
|
|
3431
|
+
return Math.max(0, s - (Date.now() - n));
|
|
3391
3432
|
}
|
|
3392
3433
|
return o(), typeof window < "u" && ["mousedown", "keypress", "touchstart", "scroll"].forEach((f) => {
|
|
3393
3434
|
window.addEventListener(f, o, { passive: !0 });
|
|
@@ -3397,51 +3438,51 @@ function sr(e, t) {
|
|
|
3397
3438
|
const r = (o) => {
|
|
3398
3439
|
const a = o.replace("#", ""), g = parseInt(a.substr(0, 2), 16) / 255, v = parseInt(a.substr(2, 2), 16) / 255, f = parseInt(a.substr(4, 2), 16) / 255, m = (k) => k <= 0.03928 ? k / 12.92 : Math.pow((k + 0.055) / 1.055, 2.4);
|
|
3399
3440
|
return 0.2126 * m(g) + 0.7152 * m(v) + 0.0722 * m(f);
|
|
3400
|
-
}, n = r(e),
|
|
3441
|
+
}, n = r(e), s = r(t), i = (Math.max(n, s) + 0.05) / (Math.min(n, s) + 0.05);
|
|
3401
3442
|
return {
|
|
3402
|
-
ratio: Math.round(
|
|
3403
|
-
passesAA:
|
|
3443
|
+
ratio: Math.round(i * 100) / 100,
|
|
3444
|
+
passesAA: i >= 4.5,
|
|
3404
3445
|
// Normal text
|
|
3405
|
-
passesAAA:
|
|
3446
|
+
passesAAA: i >= 7,
|
|
3406
3447
|
// Normal text enhanced
|
|
3407
|
-
passesAALarge:
|
|
3448
|
+
passesAALarge: i >= 3,
|
|
3408
3449
|
// Large text (18pt+ or 14pt bold)
|
|
3409
|
-
passesAAALarge:
|
|
3450
|
+
passesAAALarge: i >= 4.5
|
|
3410
3451
|
// Large text enhanced
|
|
3411
3452
|
};
|
|
3412
3453
|
}
|
|
3413
3454
|
function or(e) {
|
|
3414
|
-
var r, n,
|
|
3455
|
+
var r, n, s;
|
|
3415
3456
|
if (e.getAttribute("aria-label"))
|
|
3416
3457
|
return !0;
|
|
3417
3458
|
const t = e.getAttribute("aria-labelledby");
|
|
3418
3459
|
if (t) {
|
|
3419
|
-
const
|
|
3420
|
-
if ((r =
|
|
3460
|
+
const i = document.getElementById(t);
|
|
3461
|
+
if ((r = i == null ? void 0 : i.textContent) != null && r.trim())
|
|
3421
3462
|
return !0;
|
|
3422
3463
|
}
|
|
3423
3464
|
if (e.id) {
|
|
3424
|
-
const
|
|
3425
|
-
if ((n =
|
|
3465
|
+
const i = document.querySelector(`label[for="${e.id}"]`);
|
|
3466
|
+
if ((n = i == null ? void 0 : i.textContent) != null && n.trim())
|
|
3426
3467
|
return !0;
|
|
3427
3468
|
}
|
|
3428
|
-
return !!((
|
|
3469
|
+
return !!((s = e.textContent) != null && s.trim() || e.getAttribute("title") || e.placeholder);
|
|
3429
3470
|
}
|
|
3430
3471
|
function ar(e) {
|
|
3431
3472
|
const r = (e || document.body).querySelectorAll("h1, h2, h3, h4, h5, h6"), n = [];
|
|
3432
|
-
let
|
|
3473
|
+
let s = 0, i = !1;
|
|
3433
3474
|
return r.forEach((o) => {
|
|
3434
3475
|
const a = parseInt(o.tagName[1]);
|
|
3435
|
-
a === 1 && (
|
|
3476
|
+
a === 1 && (i && n.push({
|
|
3436
3477
|
level: a,
|
|
3437
3478
|
element: o,
|
|
3438
3479
|
issue: "Multiple H1 elements found"
|
|
3439
|
-
}),
|
|
3480
|
+
}), i = !0), a > s + 1 && s !== 0 && n.push({
|
|
3440
3481
|
level: a,
|
|
3441
3482
|
element: o,
|
|
3442
|
-
issue: `Skipped heading level: H${
|
|
3443
|
-
}),
|
|
3444
|
-
}), !
|
|
3483
|
+
issue: `Skipped heading level: H${s} to H${a}`
|
|
3484
|
+
}), s = a;
|
|
3485
|
+
}), !i && r.length > 0 && n.push({
|
|
3445
3486
|
level: 0,
|
|
3446
3487
|
element: r[0],
|
|
3447
3488
|
issue: "Missing H1 element"
|
|
@@ -3450,8 +3491,8 @@ function ar(e) {
|
|
|
3450
3491
|
function cr(e) {
|
|
3451
3492
|
const t = [];
|
|
3452
3493
|
let r = null;
|
|
3453
|
-
const n = e.batchSize || 10,
|
|
3454
|
-
async function
|
|
3494
|
+
const n = e.batchSize || 10, s = e.flushInterval || 5e3;
|
|
3495
|
+
async function i() {
|
|
3455
3496
|
if (t.length === 0)
|
|
3456
3497
|
return;
|
|
3457
3498
|
const v = t.splice(0, n);
|
|
@@ -3467,8 +3508,8 @@ function cr(e) {
|
|
|
3467
3508
|
}
|
|
3468
3509
|
function o() {
|
|
3469
3510
|
r || (r = setTimeout(() => {
|
|
3470
|
-
r = null,
|
|
3471
|
-
},
|
|
3511
|
+
r = null, i();
|
|
3512
|
+
}, s));
|
|
3472
3513
|
}
|
|
3473
3514
|
function a(v) {
|
|
3474
3515
|
var m;
|
|
@@ -3478,12 +3519,12 @@ function cr(e) {
|
|
|
3478
3519
|
timestamp: /* @__PURE__ */ new Date(),
|
|
3479
3520
|
userAgent: e.includeUserAgent && typeof navigator < "u" ? navigator.userAgent : void 0
|
|
3480
3521
|
};
|
|
3481
|
-
t.push(f), t.length >= n ?
|
|
3522
|
+
t.push(f), t.length >= n ? i() : o();
|
|
3482
3523
|
}
|
|
3483
3524
|
function g() {
|
|
3484
|
-
r && clearTimeout(r),
|
|
3525
|
+
r && clearTimeout(r), i();
|
|
3485
3526
|
}
|
|
3486
|
-
return { log: a, flush:
|
|
3527
|
+
return { log: a, flush: i, destroy: g };
|
|
3487
3528
|
}
|
|
3488
3529
|
function lr() {
|
|
3489
3530
|
return [
|
|
@@ -3937,10 +3978,10 @@ We will not pursue legal action against researchers who:
|
|
|
3937
3978
|
}
|
|
3938
3979
|
export {
|
|
3939
3980
|
$t as NiceDeviceTrust,
|
|
3940
|
-
|
|
3941
|
-
|
|
3981
|
+
Mt as NiceFaceRecognition,
|
|
3982
|
+
Ct as NiceFingerprintScanner,
|
|
3942
3983
|
Dt as NiceI18nProvider,
|
|
3943
|
-
|
|
3984
|
+
Rt as NiceIrisScanner,
|
|
3944
3985
|
Nt as NiceMfaSelector,
|
|
3945
3986
|
jt as NicePassphraseInput,
|
|
3946
3987
|
Et as NicePatternLock,
|
|
@@ -3950,29 +3991,29 @@ export {
|
|
|
3950
3991
|
Ft as NiceWebAuthnButton,
|
|
3951
3992
|
fr as SECRET_PATTERNS,
|
|
3952
3993
|
ur as SECURITY_PATTERNS,
|
|
3953
|
-
|
|
3954
|
-
|
|
3994
|
+
Ve as authenticateWebAuthn,
|
|
3995
|
+
le as captureFrame,
|
|
3955
3996
|
sr as checkColorContrast,
|
|
3956
3997
|
ar as checkHeadingHierarchy,
|
|
3957
|
-
|
|
3998
|
+
Ie as checkLiveness,
|
|
3958
3999
|
er as clearNonEssentialCookies,
|
|
3959
|
-
|
|
3960
|
-
|
|
4000
|
+
De as collectDeviceInfo,
|
|
4001
|
+
Je as compareFaceToPhoto,
|
|
3961
4002
|
cr as createAuditLogger,
|
|
3962
4003
|
Gt as createCSRFFetch,
|
|
3963
4004
|
ir as createHIPAASession,
|
|
3964
4005
|
wt as createRateLimiter,
|
|
3965
4006
|
qt as createSafeHtml,
|
|
3966
|
-
|
|
4007
|
+
Oe as detectIris,
|
|
3967
4008
|
xt as escapeHtml,
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
4009
|
+
he as extractFaceFeatures,
|
|
4010
|
+
_e as extractMinutiae,
|
|
4011
|
+
Ze as faceToTemplate,
|
|
4012
|
+
Ue as fingerprintToTemplate,
|
|
4013
|
+
Bt as generateCSPHeader,
|
|
3973
4014
|
Kt as generateCSRFToken,
|
|
3974
4015
|
tr as generateDataExport,
|
|
3975
|
-
|
|
4016
|
+
de as generateDeviceFingerprint,
|
|
3976
4017
|
It as generateLivenessChallenge,
|
|
3977
4018
|
Wt as generateNonce,
|
|
3978
4019
|
yr as generatePreCommitHook,
|
|
@@ -3982,34 +4023,34 @@ export {
|
|
|
3982
4023
|
gr as generateSecurityAdvisory,
|
|
3983
4024
|
mr as generateSecurityMd,
|
|
3984
4025
|
Me as getCSRFTokenFromCookie,
|
|
3985
|
-
|
|
4026
|
+
pe as getCameraStream,
|
|
3986
4027
|
kt as getConsentPreferences,
|
|
3987
|
-
|
|
4028
|
+
_t as getRecommendedCSP,
|
|
3988
4029
|
lr as getSOC2Checklist,
|
|
3989
4030
|
or as hasAccessibleName,
|
|
3990
4031
|
Vt as hasConsent,
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
4032
|
+
Ke as irisToTemplate,
|
|
4033
|
+
Xe as isPasskeyAvailable,
|
|
4034
|
+
Ce as isWebAuthnAvailable,
|
|
3994
4035
|
nr as logPHIAccess,
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4036
|
+
Te as matchFaces,
|
|
4037
|
+
We as matchFingerprints,
|
|
4038
|
+
qe as matchIris,
|
|
4039
|
+
Qe as registerWebAuthn,
|
|
3999
4040
|
rr as requestDataDeletion,
|
|
4000
|
-
|
|
4041
|
+
fe as resolveConfig,
|
|
4001
4042
|
Ut as sanitizeInput,
|
|
4002
4043
|
Ot as sanitizeSvg,
|
|
4003
4044
|
Ht as sanitizeUrl,
|
|
4004
4045
|
Qt as saveConsentPreferences,
|
|
4005
4046
|
Xt as scanFileForViruses,
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4047
|
+
Ye as templateToFace,
|
|
4048
|
+
He as templateToFingerprint,
|
|
4049
|
+
Ge as templateToIris,
|
|
4009
4050
|
Jt as useCSRFToken,
|
|
4010
|
-
|
|
4051
|
+
te as useNiceTranslation,
|
|
4011
4052
|
Zt as useRateLimiter,
|
|
4012
4053
|
St as validateFile,
|
|
4013
4054
|
Yt as validateFiles,
|
|
4014
|
-
|
|
4055
|
+
ge as verifyWithBackend
|
|
4015
4056
|
};
|