@nice2dev/ui-security 1.1.6 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as c, jsxs as C, Fragment as Ce } from "react/jsx-runtime";
2
- import { useContext as Re, createContext as Pe, useRef as V, useState as j, useCallback as G, useEffect as te, useMemo as se } from "react";
3
- const Ee = {
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
- }, Fe = {
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 de(e) {
22
- const t = { ...Fe, ...e };
23
- return e != null && e.matchThreshold || (t.matchThreshold = Ee[t.securityLevel]), t;
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 ce(e) {
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 he(e = 8) {
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 ze(e) {
33
+ function Le(e) {
34
34
  const t = new Uint32Array(1);
35
35
  return crypto.getRandomValues(t), t[0] % e;
36
36
  }
37
- function Ne(e, t) {
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 fe(e = "user") {
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 ae(e, t, r) {
47
- const n = t ?? e.videoWidth, i = r ?? e.videoHeight, s = document.createElement("canvas");
48
- s.width = n, s.height = i;
49
- const o = s.getContext("2d");
50
- o.drawImage(e, 0, 0, n, i);
51
- const a = o.getImageData(0, 0, n, i);
52
- return { canvas: s, ctx: o, imageData: a };
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 oe(e) {
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 i = n * 4;
58
- t[n] = Math.round(0.299 * r[i] + 0.587 * r[i + 1] + 0.114 * r[i + 2]);
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 Se(e, t, r) {
63
- const n = new Uint8Array(t * r), i = [1, 2, 1, 2, 4, 2, 1, 2, 1], s = 16;
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)] * i[v++];
70
- n[o * t + a] = Math.round(g / s);
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 Le(e, t, r) {
74
+ function je(e, t, r) {
75
75
  const n = new Uint8Array(t * r);
76
- for (let i = 1; i < r - 1; i++)
77
- for (let s = 1; s < t - 1; s++) {
78
- const o = -e[(i - 1) * t + (s - 1)] + e[(i - 1) * t + (s + 1)] + -2 * e[i * t + (s - 1)] + 2 * e[i * t + (s + 1)] + -e[(i + 1) * t + (s - 1)] + e[(i + 1) * t + (s + 1)], a = -e[(i - 1) * t + (s - 1)] - 2 * e[(i - 1) * t + s] - e[(i - 1) * t + (s + 1)] + e[(i + 1) * t + (s - 1)] + 2 * e[(i + 1) * t + s] + e[(i + 1) * t + (s + 1)];
79
- n[i * t + s] = Math.min(255, Math.round(Math.sqrt(o * o + a * a)));
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 $e(e) {
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 i = 0, s = 0, o = 0, a = 0;
91
+ let s = 0, i = 0, o = 0, a = 0;
92
92
  for (let v = 0; v < 256; v++) {
93
- if (s += t[v], s === 0)
93
+ if (i += t[v], i === 0)
94
94
  continue;
95
- const f = r - s;
95
+ const f = r - i;
96
96
  if (f === 0)
97
97
  break;
98
- i += v * t[v];
99
- const m = i / s, k = (n - i) / f, p = s * f * (m - k) ** 2;
100
- p > o && (o = p, a = v);
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 je(e, t = 0.3) {
108
- var y;
109
- const r = e.width, n = e.height, i = oe(e), s = Se(i, r, n), o = Le(s, r, n), { binary: a } = $e(o), g = [], v = [], f = [];
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 x = [
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 B = 0; B < 8; B++) {
126
- const H = x[B] > 0 ? 1 : 0, Z = x[(B + 1) % 8] > 0 ? 1 : 0;
127
- l += Math.abs(H - Z);
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 B = -2; B <= 2; B++)
131
+ for (let _ = -2; _ <= 2; _++)
132
132
  for (let H = -2; H <= 2; H++)
133
- h += o[(S + B) * r + (u + H)], L++;
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 Y = Math.atan2(
138
- i[(S + 1) * r + u] - i[(S - 1) * r + u],
139
- i[S * r + (u + 1)] - i[S * r + (u - 1)]
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: Y, type: "ending", quality: q }) : l === 3 && g.push({ x: u / r, y: S / n, angle: Y, type: "bifurcation", quality: q });
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((x, l) => x + l.x, 0) / m.length, u = m.reduce((x, l) => x + l.y, 0) / m.length;
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, p = m.filter((S) => S.type === "ending").length, R = m.filter((S) => S.type === "bifurcation").length / (p + 1);
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" : ((y = v[0]) == null ? void 0 : y.x) < 0.45 && (b = "loop-left");
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 _e(e, t) {
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, i = 0.5, s = /* @__PURE__ */ new Set();
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 (s.has(f))
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 = Ne(a, m), p = Math.abs(a.angle - m.angle);
176
- k < n && p < i && k < g && (g = k, v = f);
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++, s.add(v));
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 Be(e, t) {
184
- const r = JSON.stringify(e), n = await ce(r);
183
+ async function Ue(e, t) {
184
+ const r = JSON.stringify(e), n = await ue(r);
185
185
  return {
186
- id: `fp_${Date.now()}_${he()}`,
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 We(e) {
194
+ function He(e) {
195
195
  return JSON.parse(atob(e.templateData));
196
196
  }
197
- function Ue(e, t = "left") {
198
- const r = e.width, n = e.height, i = oe(e), s = Se(i, r, n);
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, y = 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 += s[L * r + h], y++);
206
+ h >= 0 && h < r && L >= 0 && L < n && (T += i[L * r + h], p++);
207
207
  }
208
- const S = y > 0 ? T / y : 255, u = s[D * r + R], x = S * 0.5 + u * 0.5;
209
- x < o.score && (o = { cx: R, cy: D, r: b, score: x });
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)), y = Math.round(o.cy + b * Math.sin(R));
218
- if (T >= 0 && T < r && y >= 0 && y < 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)), x = s[y * r + T], l = S >= 0 && S < r && u >= 0 && u < n ? s[u * r + S] : x;
220
- f.push(x > l ? 1 : 0);
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, p = Math.min(1, Math.max(0, k / (r * n) * 100));
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: p,
229
+ quality: y,
230
230
  eye: t
231
231
  };
232
232
  }
233
- function He(e, t) {
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, i = r;
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 < i && (i = a);
246
+ a < s && (s = a);
247
247
  }
248
- n = i;
249
- const s = n / r;
250
- return Math.max(0, 1 - s * 2.5);
248
+ n = s;
249
+ const i = n / r;
250
+ return Math.max(0, 1 - i * 2.5);
251
251
  }
252
- async function Oe(e, t) {
253
- const r = JSON.stringify(e), n = await ce(r);
252
+ async function Ke(e, t) {
253
+ const r = JSON.stringify(e), n = await ue(r);
254
254
  return {
255
- id: `iris_${Date.now()}_${he()}`,
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 qe(e) {
263
+ function Ge(e) {
264
264
  return JSON.parse(atob(e.templateData));
265
265
  }
266
- function ue(e) {
267
- const t = e.width, r = e.height, n = e.data, i = new Uint8Array(t * r);
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 x = u * 4, l = n[x], h = n[x + 1], L = n[x + 2], q = 0.299 * l + 0.587 * h + 0.114 * L, Y = 128 - 0.169 * l - 0.331 * h + 0.5 * L, B = 128 + 0.5 * l - 0.419 * h - 0.081 * L;
270
- Y >= 77 && Y <= 127 && B >= 133 && B <= 173 && q > 80 && (i[u] = 1);
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 s = t, o = r, a = 0, g = 0, v = 0;
272
+ let i = t, o = r, a = 0, g = 0, v = 0;
273
273
  for (let u = 0; u < r; u++)
274
- for (let x = 0; x < t; x++)
275
- i[u * t + x] && (v++, x < s && (s = x), x > a && (a = x), u < o && (o = u), u > g && (g = u));
276
- const f = a - s, m = g - o;
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: s, y: o, width: f, height: m }, p = [], D = oe(e), R = Math.max(1, Math.floor(f / 8)), b = Math.max(1, Math.floor(m / 16));
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 x = 0; x < 8; x++) {
282
- const l = s + x * R + Math.floor(R / 2), h = o + u * b + Math.floor(b / 2);
283
- l < t && h < r ? p.push(D[h * t + l] / 255) : p.push(0);
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 = [], y = { x: s + f / 2, y: o + m / 2 };
285
+ const T = [], p = { x: i + f / 2, y: o + m / 2 };
286
286
  for (let u = 0; u < 68; u++) {
287
- const x = u / 68 * Math.PI * 2, l = f * 0.4 * Math.cos(x), h = m * 0.45 * Math.sin(x);
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: (y.x + l) / t,
290
- y: (y.y + h) / r
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: p,
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 ke(e, t) {
302
+ function Te(e, t) {
303
303
  if (e.embedding.length !== t.embedding.length)
304
304
  return 0;
305
- let r = 0, n = 0, i = 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, i += t.embedding[o] ** 2;
308
- const s = Math.sqrt(n) * Math.sqrt(i);
309
- return s > 0 ? (r / s + 1) / 2 : 0;
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 Ke(e, t) {
312
- const r = ue(e), n = ue(t);
313
- return !r || !n ? { similarity: 0, cameraFeatures: r, refFeatures: n } : { similarity: ke(r, n), cameraFeatures: r, refFeatures: n };
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 Ge(e, t) {
316
- const r = JSON.stringify(e), n = await ce(r);
315
+ async function Ze(e, t) {
316
+ const r = JSON.stringify(e), n = await ue(r);
317
317
  return {
318
- id: `face_${Date.now()}_${he()}`,
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 Je(e) {
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[ze(e.length)];
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 Ae(e, t = 0.02) {
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 = oe(e[o - 1]), g = oe(e[o]);
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), i = n > t, s = Math.min(1, n / (t * 3));
359
- return { isLive: i, confidence: s, motionScore: n };
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 Te() {
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 le() {
373
- const e = Te(), t = JSON.stringify(e);
374
- return ce(t);
372
+ async function de() {
373
+ const e = De(), t = JSON.stringify(e);
374
+ return ue(t);
375
375
  }
376
- function Ie() {
376
+ function Ce() {
377
377
  return typeof window < "u" && !!window.PublicKeyCredential;
378
378
  }
379
- async function Ze() {
380
- if (!Ie())
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 Ye(e) {
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 Xe(e) {
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 ye(e, t, r) {
423
+ async function ge(e, t, r) {
424
424
  const n = { "Content-Type": "application/json" };
425
425
  r && (n.Authorization = `Bearer ${r}`);
426
- const i = await fetch(e, {
426
+ const s = await fetch(e, {
427
427
  method: "POST",
428
428
  headers: n,
429
429
  body: JSON.stringify(t)
430
430
  });
431
- return i.ok ? i.json() : { verified: !1, message: `Server error: ${i.status}` };
432
- }
433
- const Qe = (e, t) => t, De = Pe(Qe), Dt = ({ t: e, children: t }) => /* @__PURE__ */ c(De.Provider, { value: e, children: t });
434
- function ee() {
435
- return { t: Re(De) };
436
- }
437
- const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
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: i,
443
- onVerify: s,
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: p,
462
+ instructionText: y,
452
463
  cameraFacing: D = "environment",
453
464
  ...R
454
- } = e, { t: b } = ee(), T = de(R), y = Ve[v], S = V(null), u = V(null), x = V(null), [l, h] = j("idle"), [L, q] = j(0), [Y, B] = j(null), [H, Z] = j(0), [W, $] = j(""), _ = G(
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 fe(D);
462
- x.current = E, S.current && (S.current.srcObject = E, await S.current.play()), _("idle"), $(b("security.fingerprint.placeFingerPrompt", "Place your finger on the scanner"));
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")), _("error");
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, _, a]), K = G(() => {
477
+ }, [D, b, B, a]), K = G(() => {
467
478
  var E;
468
- (E = x.current) == null || E.getTracks().forEach((I) => I.stop()), x.current = null;
479
+ (E = w.current) == null || E.getTracks().forEach((C) => C.stop()), w.current = null;
469
480
  }, []);
470
- te(() => (F(), K), [F, K]);
481
+ ne(() => (F(), K), [F, K]);
471
482
  const U = G(async () => {
472
483
  if (!(!S.current || l === "processing" || l === "success")) {
473
- _("scanning"), $(b("security.fingerprint.scanning", "Scanning…"));
484
+ B("scanning"), $(b("security.fingerprint.scanning", "Scanning…"));
474
485
  try {
475
- const { imageData: E } = ae(S.current);
476
- _("processing"), $(b("security.fingerprint.processing", "Processing fingerprint…"));
477
- const I = je(E);
478
- if (B(I), q(I.quality), I.quality < 0.2) {
479
- $(b("security.fingerprint.lowQuality", "Low quality — try again")), _("idle");
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 Be(I, f ?? n);
484
- i == null || i(z, I), $(b("security.fingerprint.enrolled", "Fingerprint enrolled successfully")), _("success");
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 = We(d), N = _e(I, A);
499
+ const A = He(d), N = We(C, A);
489
500
  N > z && (z = N);
490
501
  }
491
- const M = z >= T.matchThreshold, w = {
492
- success: M,
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(I))
508
+ payload: btoa(JSON.stringify(C))
498
509
  };
499
- if (M && T.verifyEndpoint) {
500
- const d = await le(), A = await ye(
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: w.payload,
515
+ templateData: x.payload,
505
516
  matchScore: z,
506
517
  deviceFingerprint: d
507
518
  },
508
519
  T.authToken
509
520
  );
510
- w.success = A.verified;
521
+ x.success = A.verified;
511
522
  }
512
- w.success ? ($(b("security.fingerprint.verified", "Fingerprint verified")), _("success")) : (Z((d) => d + 1), H + 1 >= T.maxRetries ? ($(b("security.fingerprint.maxAttempts", "Maximum attempts reached")), _("failure")) : ($(b("security.fingerprint.noMatch", "No match — try again")), _("idle"))), s == null || s(w);
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")), _("error");
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
- te(() => {
533
- if (!k || !Y || !u.current)
543
+ ne(() => {
544
+ if (!k || !Z || !u.current)
534
545
  return;
535
546
  const E = u.current.getContext("2d");
536
- E && (E.clearRect(0, 0, y, y), Y.minutiae.forEach((I) => {
537
- E.beginPath(), E.arc(I.x * y, I.y * y, 2, 0, Math.PI * 2), E.fillStyle = I.type === "ending" ? "var(--nice-success, #10b981)" : "var(--nice-warning, #f59e0b)", E.fill(), E.beginPath(), E.moveTo(I.x * y, I.y * y), E.lineTo(I.x * y + Math.cos(I.angle) * 8, I.y * y + Math.sin(I.angle) * 8), E.strokeStyle = E.fillStyle, E.lineWidth = 1, E.stroke();
538
- }));
539
- }, [Y, k, y]);
540
- const X = l === "success" ? "var(--security-success)" : l === "failure" || l === "error" ? "var(--security-error)" : l === "scanning" || l === "processing" ? "var(--security-biometric)" : "var(--security-border)";
541
- return /* @__PURE__ */ C(
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__ */ C(
563
+ /* @__PURE__ */ P(
549
564
  "div",
550
565
  {
551
566
  style: {
552
- width: y,
553
- height: y,
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 ${X}`,
558
- boxShadow: l === "scanning" ? `0 0 20px ${X}` : "var(--security-shadow)",
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: y,
576
- height: y,
590
+ width: p,
591
+ height: p,
577
592
  style: { position: "absolute", inset: 0, pointerEvents: "none" }
578
593
  }
579
594
  ),
580
- /* @__PURE__ */ C(
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: X,
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: y,
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: p ?? W
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-bg, #fff)",
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", "🖐️ Capture Fingerprint") : b("security.fingerprint.verifyBtn", "🖐️ Verify Fingerprint")
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
- Z(0), _("idle"), $("");
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
- }, et = { sm: 220, md: 300, lg: 400 }, Ct = (e) => {
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: i,
733
- onVerify: s,
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: p = !0,
756
+ showGuide: y = !0,
742
757
  instructionText: D,
743
758
  ...R
744
- } = e, { t: b } = ee(), T = de(R), y = et[v], S = V(null), u = V(null), x = V(null), l = V([]), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(null), [Z, W] = j(0), [$, _] = j(""), F = G(
745
- (I) => {
746
- L(I), o == null || o(I);
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 I = await fe("user");
752
- x.current = I, S.current && (S.current.srcObject = I, await S.current.play()), F("idle"), _(b("security.iris.alignEyePrompt", "Align your eye with the circle"));
753
- } catch (I) {
754
- a == null || a(I instanceof Error ? I : new Error(String(I))), _(b("security.iris.cameraError", "Camera access denied")), F("error");
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 I;
758
- (I = x.current) == null || I.getTracks().forEach((z) => z.stop()), x.current = null;
772
+ var C;
773
+ (C = w.current) == null || C.getTracks().forEach((z) => z.stop()), w.current = null;
759
774
  }, []);
760
- te(() => (K(), U), [K, U]);
761
- const X = G(async () => {
775
+ ne(() => (K(), U), [K, U]);
776
+ const Q = G(async () => {
762
777
  if (!(!S.current || h === "processing" || h === "success")) {
763
- F("scanning"), _(b("security.iris.scanning", "Scanning iris…"));
778
+ F("scanning"), B(b("security.iris.scanning", "Scanning iris…"));
764
779
  try {
765
- const I = [];
766
- for (let w = 0; w < 5; w++) {
767
- const { imageData: d } = ae(S.current);
768
- I.push(d), await new Promise((A) => setTimeout(A, 200));
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 = I, T.livenessDetection && !Ae(I).isLive) {
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"), _(b("security.iris.processing", "Processing iris pattern…"));
777
- const z = I[I.length - 1], M = Ue(z, n === "both" ? "left" : n);
778
- if (!M) {
779
- _(b("security.iris.noIrisDetected", "No iris detected — adjust position")), F("idle");
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(M), Y(M.quality), M.quality < 0.1) {
783
- _(b("security.iris.lowQuality", "Low quality — move closer")), F("idle");
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 w = u.current.getContext("2d");
788
- if (w) {
789
- w.clearRect(0, 0, y, y);
790
- const d = y / z.width, A = y / z.height;
791
- w.beginPath(), w.arc(
792
- M.pupil.cx * d,
793
- M.pupil.cy * A,
794
- M.pupil.r * d,
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
- ), w.strokeStyle = "var(--nice-danger, #ef4444)", w.lineWidth = 2, w.stroke(), w.beginPath(), w.arc(
798
- M.iris.cx * d,
799
- M.iris.cy * A,
800
- M.iris.r * d,
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
- ), w.strokeStyle = "var(--nice-primary, #3b82f6)", w.lineWidth = 2, w.stroke();
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 w = await Oe(M, f ?? `${n} eye`);
808
- i == null || i(w, M), _(b("security.iris.enrolled", "Iris enrolled successfully")), F("success");
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 w = 0;
825
+ let x = 0;
811
826
  for (const N of r) {
812
- const P = qe(N), O = He(M, P);
813
- O > w && (w = O);
827
+ const M = Ge(N), O = qe(I, M);
828
+ O > x && (x = O);
814
829
  }
815
- const d = w >= T.matchThreshold, A = {
830
+ const d = x >= T.matchThreshold, A = {
816
831
  success: d,
817
- confidence: w,
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(M))
837
+ payload: btoa(JSON.stringify(I))
823
838
  };
824
839
  if (d && T.verifyEndpoint) {
825
- const N = await le(), P = await ye(
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: w,
845
+ matchScore: x,
831
846
  deviceFingerprint: N
832
847
  },
833
848
  T.authToken
834
849
  );
835
- A.success = P.verified;
850
+ A.success = M.verified;
836
851
  }
837
- A.success ? (_(b("security.iris.verified", "Iris verified")), F("success")) : (W((N) => N + 1), Z + 1 >= T.maxRetries ? (_(b("security.iris.maxAttempts", "Maximum attempts reached")), F("failure")) : (_(b("security.iris.noMatch", "No match — try again")), F("idle"))), s == null || s(A);
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 (I) {
840
- a == null || a(I instanceof Error ? I : new Error(String(I))), _(b("security.iris.error", "Scan error")), F("error");
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
- Z,
870
+ J,
856
871
  k,
857
- y
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__ */ C(
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__ */ C(
881
+ /* @__PURE__ */ P(
867
882
  "div",
868
883
  {
869
884
  style: {
870
- width: y,
871
- height: y,
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: y,
894
- height: y,
908
+ width: p,
909
+ height: p,
895
910
  style: { position: "absolute", inset: 0, pointerEvents: "none" }
896
911
  }
897
912
  ),
898
- p && h === "idle" && /* @__PURE__ */ C(
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: y * 0.7,
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: y * 0.6,
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: X,
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-bg, #fff)",
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", "👁️ Capture Iris") : b("security.iris.verifyBtn", "👁️ Verify Iris")
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(-${y * 0.3}px); opacity: 0.3; }
1058
- 50% { transform: translateY(${y * 0.3}px); opacity: 0.8; }
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
- }, tt = { sm: 240, md: 320, lg: 440 }, Rt = (e) => {
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: i,
1070
- onVerify: s,
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: p = 1,
1093
+ livenessSteps: y = 1,
1079
1094
  showReference: D = !0,
1080
1095
  instructionText: R,
1081
1096
  ...b
1082
- } = e, { t: T } = ee(), y = de(b), S = tt[v], u = V(null), x = V(null), l = V(null), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(0), [Z, W] = j(""), [$, _] = j(null), [F, K] = j(0), U = G(
1083
- (w) => {
1084
- L(w), o == null || o(w);
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
- ), X = G(async () => {
1102
+ ), Q = G(async () => {
1088
1103
  try {
1089
- const w = await fe("user");
1090
- l.current = w, u.current && (u.current.srcObject = w, await u.current.play()), U("idle"), W(T("security.face.lookAtCamera", "Look at the camera"));
1091
- } catch (w) {
1092
- a == null || a(w instanceof Error ? w : new Error(String(w))), W(T("security.face.cameraError", "Camera access denied")), U("error");
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 w;
1096
- (w = l.current) == null || w.getTracks().forEach((d) => d.stop()), l.current = null;
1110
+ var x;
1111
+ (x = l.current) == null || x.getTracks().forEach((d) => d.stop()), l.current = null;
1097
1112
  }, []);
1098
- te(() => (X(), E), [X, E]);
1099
- const I = G(
1100
- (w) => {
1101
- var ge, me, ve;
1102
- const d = (ge = x.current) == null ? void 0 : ge.getContext("2d");
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 = x.current.width, N = x.current.height;
1106
- if (d.clearRect(0, 0, A, N), !w || !k)
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 P = w.boundingBox, O = A / (((me = u.current) == null ? void 0 : me.videoWidth) ?? A), J = N / (((ve = u.current) == null ? void 0 : ve.videoHeight) ?? N);
1109
- d.strokeStyle = h === "success" ? "var(--nice-success, #10b981)" : "var(--nice-primary, #3b82f6)", d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(P.x * O, P.y * J, P.width * O, P.height * J), d.setLineDash([]);
1110
- const Q = [
1111
- [P.x * O, P.y * J],
1112
- [(P.x + P.width) * O, P.y * J],
1113
- [P.x * O, (P.y + P.height) * J],
1114
- [(P.x + P.width) * O, (P.y + P.height) * J]
1115
- ], re = 12;
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 [ne, ie] of Q)
1118
- d.beginPath(), d.moveTo(ne === P.x * O ? ne : ne - re, ie), d.lineTo(ne, ie), d.lineTo(ne, ie === P.y * J ? ie + re : ie - re), d.stroke();
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 (y.livenessDetection) {
1143
+ if (p.livenessDetection) {
1126
1144
  const A = [];
1127
- for (let P = 0; P < 8; P++)
1128
- A.push(ae(u.current).imageData), await new Promise((O) => setTimeout(O, 200));
1129
- if (!Ae(A).isLive) {
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: w } = ae(u.current);
1153
+ const { imageData: x } = le(u.current);
1136
1154
  if (t === "compare" && n) {
1137
- const A = typeof n == "string" ? await rt(n) : nt(n), {
1155
+ const A = typeof n == "string" ? await it(n) : st(n), {
1138
1156
  similarity: N,
1139
- cameraFeatures: P,
1157
+ cameraFeatures: M,
1140
1158
  refFeatures: O
1141
- } = Ke(w, A);
1142
- K(N), Y((P == null ? void 0 : P.quality) ?? 0), I(P);
1143
- const Q = {
1144
- success: N >= y.matchThreshold,
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: y.livenessDetection
1167
+ livenessPassed: p.livenessDetection
1150
1168
  };
1151
- Q.success ? (W(T("security.face.matchFound", `Match: ${(N * 100).toFixed(0)}%`)), U("success")) : (H((re) => re + 1), B + 1 >= y.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), s == null || s(Q);
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 = ue(w);
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 (Y(d.quality), I(d), t === "enroll") {
1160
- const A = await Ge(d, f ?? "face");
1161
- i == null || i(A, d), W(T("security.face.enrolled", "Face enrolled successfully")), U("success");
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 J = Je(O), Q = ke(d, J);
1166
- Q > A && (A = Q);
1183
+ const Y = Ye(O), V = Te(d, Y);
1184
+ V > A && (A = V);
1167
1185
  }
1168
1186
  K(A);
1169
- const N = A >= y.matchThreshold, P = {
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: y.livenessDetection
1193
+ livenessPassed: p.livenessDetection
1176
1194
  };
1177
- if (N && y.verifyEndpoint) {
1178
- const O = await le(), J = await ye(
1179
- y.verifyEndpoint,
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
- y.authToken
1204
+ p.authToken
1187
1205
  );
1188
- P.success = J.verified;
1206
+ M.success = Y.verified;
1189
1207
  }
1190
- P.success ? (W(T("security.face.verified", "Face verified")), U("success")) : (H((O) => O + 1), B + 1 >= y.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), s == null || s(P);
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 (w) {
1193
- a == null || a(w instanceof Error ? w : new Error(String(w))), W(T("security.face.error", "Error — try again")), U("error");
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
- y,
1219
+ p,
1202
1220
  T,
1203
1221
  U,
1204
- i,
1205
1222
  s,
1223
+ i,
1206
1224
  a,
1207
1225
  f,
1208
- B,
1209
- I
1210
- ]), M = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
1211
- return /* @__PURE__ */ C(
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__ */ C("div", { style: { display: "flex", gap: 16, alignItems: "center" }, children: [
1224
- /* @__PURE__ */ C(
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 ${M}`,
1234
- boxShadow: h === "scanning" ? `0 0 20px ${M}` : "var(--security-shadow)",
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: x,
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: M,
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__ */ C(
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__ */ C("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
1354
- /* @__PURE__ */ C("span", { style: { color: "var(--security-text-secondary)" }, children: [
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 >= y.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
1392
+ background: F >= p.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
1375
1393
  }
1376
1394
  }
1377
1395
  )
1378
1396
  }
1379
1397
  ),
1380
- /* @__PURE__ */ C(
1398
+ /* @__PURE__ */ P(
1381
1399
  "span",
1382
1400
  {
1383
1401
  style: {
1384
1402
  fontWeight: 600,
1385
- color: F >= y.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
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 ?? Z
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-bg, #fff)",
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", "📸 Capture Face") : t === "compare" ? T("security.face.compareBtn", "📸 Compare") : T("security.face.verifyBtn", "📸 Verify Face")
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 rt(e) {
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 i = document.createElement("canvas");
1453
- i.width = n.naturalWidth, i.height = n.naturalHeight;
1454
- const s = i.getContext("2d");
1455
- s.drawImage(n, 0, 0), t(s.getImageData(0, 0, i.width, i.height));
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 nt(e) {
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 it = 4, st = 5, ot = 3e4, Pt = (e) => {
1483
+ const ot = 4, at = 5, ct = 3e4, Pt = (e) => {
1466
1484
  const {
1467
- length: t = it,
1485
+ length: t = ot,
1468
1486
  scramble: r = !1,
1469
1487
  showDigits: n = !1,
1470
- maxAttempts: i = st,
1471
- lockoutDuration: s = ot,
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: p,
1497
+ onVerify: y,
1480
1498
  onStatusChange: D,
1481
1499
  onError: R,
1482
1500
  showBiometricFallback: b = !1,
1483
1501
  onBiometricFallback: T,
1484
- label: y,
1502
+ label: p,
1485
1503
  className: S
1486
- } = e, { t: u } = ee(), [x, l] = j([]), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(0), [Z, W] = j(null), $ = V(void 0), _ = se(() => {
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 M = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
1491
- for (let w = M.length - 1; w > 0; w--) {
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] % (w + 1);
1495
- [M[w], M[A]] = [M[A], M[w]];
1512
+ const A = d[0] % (x + 1);
1513
+ [I[x], I[A]] = [I[A], I[x]];
1496
1514
  }
1497
1515
  return [
1498
- M[0],
1499
- M[1],
1500
- M[2],
1501
- M[3],
1502
- M[4],
1503
- M[5],
1504
- M[6],
1505
- M[7],
1506
- M[8],
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
- M[9],
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
- te(() => {
1518
- if (!(B <= Date.now()))
1535
+ ne(() => {
1536
+ if (!(_ <= Date.now()))
1519
1537
  return $.current = setInterval(() => {
1520
- Date.now() >= B && (clearInterval($.current), F("idle"), Y(0), l([]));
1538
+ Date.now() >= _ && (clearInterval($.current), F("idle"), Z(0), l([]));
1521
1539
  }, 500), () => clearInterval($.current);
1522
- }, [B, F]);
1523
- const K = B > Date.now(), U = G(() => {
1540
+ }, [_, F]);
1541
+ const K = _ > Date.now(), U = G(() => {
1524
1542
  a && navigator.vibrate && navigator.vibrate(20);
1525
- }, [a]), X = G(
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 M = [...x, z];
1536
- if (l(M), M.length < t)
1553
+ const I = [...w, z];
1554
+ if (l(I), I.length < t)
1537
1555
  return;
1538
- const w = M.join("");
1556
+ const x = I.join("");
1539
1557
  if (F("processing"), m === "set") {
1540
- if (Z === null) {
1541
- W(w), l([]), F("idle");
1558
+ if (J === null) {
1559
+ W(x), l([]), F("idle");
1542
1560
  return;
1543
1561
  }
1544
- if (Z !== w) {
1562
+ if (J !== x) {
1545
1563
  W(null), l([]), F("failure"), setTimeout(() => F("idle"), 1200);
1546
1564
  return;
1547
1565
  }
1548
- k == null || k(w), F("success");
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(w));
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 = w === f;
1574
+ d = x === f;
1557
1575
  else {
1558
- k == null || k(w), F("success");
1576
+ k == null || k(x), F("success");
1559
1577
  return;
1560
1578
  }
1561
1579
  if (d)
1562
- F("success"), p == null || p({
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(w);
1586
+ }), k == null || k(x);
1569
1587
  else {
1570
1588
  const A = q + 1;
1571
- if (Y(A), A >= i) {
1572
- const N = Date.now() + s;
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
- p == null || p({
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
- x,
1606
+ w,
1589
1607
  t,
1590
1608
  K,
1591
1609
  h,
1592
1610
  m,
1593
- Z,
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
- p,
1620
+ y,
1603
1621
  R
1604
1622
  ]
1605
- ), E = Math.max(0, Math.ceil((B - Date.now()) / 1e3)), I = h === "success" ? "var(--security-success)" : h === "failure" ? "var(--security-error)" : "var(--security-border)";
1606
- return /* @__PURE__ */ C(
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
- y && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600 }, children: y }),
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" && Z !== 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")
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, M) => /* @__PURE__ */ c(
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 ${I}`,
1640
- background: M < x.length ? I : "transparent",
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
- M
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: _.map((z, M) => {
1674
+ children: B.map((z, I) => {
1657
1675
  if (z === "")
1658
- return /* @__PURE__ */ c("div", {}, M);
1659
- const w = z === "back";
1676
+ return /* @__PURE__ */ c("div", {}, I);
1677
+ const x = z === "back";
1660
1678
  return /* @__PURE__ */ c(
1661
1679
  "button",
1662
1680
  {
1663
- onClick: () => X(z),
1681
+ onClick: () => Q(z),
1664
1682
  disabled: K || h === "success",
1665
- "aria-label": w ? "Backspace" : z,
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: w ? 20 : 22,
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: w ? "⌫" : (g == null ? void 0 : g[z]) ?? z
1709
+ children: x ? "⌫" : (g == null ? void 0 : g[z]) ?? z
1692
1710
  },
1693
- M
1711
+ I
1694
1712
  );
1695
1713
  })
1696
1714
  }
1697
1715
  ),
1698
- x.length > 0 && h !== "success" && /* @__PURE__ */ c(
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__ */ C(
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}/${i} attempts`) })
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
- }, at = 3, ct = 4, lt = 5, ut = 14, Et = (e) => {
1751
+ }, lt = 3, ut = 4, dt = 5, ht = 14, Et = (e) => {
1737
1752
  const {
1738
- gridSize: t = at,
1739
- minLength: r = ct,
1753
+ gridSize: t = lt,
1754
+ minLength: r = ut,
1740
1755
  showTrail: n = !0,
1741
- showError: i = !0,
1742
- maxAttempts: s = lt,
1743
- dotSize: o = ut,
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: p,
1765
+ onStatusChange: y,
1751
1766
  onError: D,
1752
1767
  label: R,
1753
1768
  className: b,
1754
1769
  canvasSize: T
1755
- } = e, { t: y } = ee(), S = V(null), [u, x] = j([]), [l, h] = j(!1), [L, q] = j("idle"), [Y, B] = j(0), [H, Z] = j(null), [W, $] = j(null), _ = T ?? t * 80, F = _ / t, K = G(
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), p == null || p(d);
1772
+ q(d), y == null || y(d);
1758
1773
  },
1759
- [p]
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]), X = G((d) => {
1767
- const A = S.current.getBoundingClientRect(), N = "touches" in d ? d.touches[0].clientX : d.clientX, P = "touches" in d ? d.touches[0].clientY : d.clientY;
1768
- return { x: N - A.left, y: P - A.top };
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(), P = F * 0.38;
1786
+ const N = U(), M = F * 0.38;
1772
1787
  for (let O = 0; O < N.length; O++) {
1773
- const J = N[O].x - d, Q = N[O].y - A;
1774
- if (J * J + Q * Q < P * P)
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
- ), I = G(() => {
1781
- var O;
1782
- const d = (O = S.current) == null ? void 0 : O.getContext("2d");
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(), P = L === "failure" && i ? "var(--security-error)" : a ?? "var(--security-biometric)";
1787
- for (let J = 0; J < A.length; J++) {
1788
- const Q = u.includes(J);
1789
- d.beginPath(), d.arc(A[J].x, A[J].y, Q ? o * 0.75 : o * 0.5, 0, Math.PI * 2), d.fillStyle = Q ? P : "var(--security-border)", d.fill(), Q && (d.beginPath(), d.arc(A[J].x, A[J].y, o * 1.2, 0, Math.PI * 2), d.strokeStyle = P, d.lineWidth = 1.5, d.globalAlpha = 0.3, d.stroke(), d.globalAlpha = 1);
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 J = 1; J < u.length; J++)
1794
- d.lineTo(A[u[J]].x, A[u[J]].y);
1795
- l && W && d.lineTo(W.x, W.y), d.strokeStyle = P, d.lineWidth = 3, d.lineCap = "round", d.lineJoin = "round", d.globalAlpha = 0.5, d.stroke(), d.globalAlpha = 1;
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
- i,
1824
+ s,
1807
1825
  a
1808
1826
  ]);
1809
- te(() => {
1810
- I();
1811
- }, [I]);
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 } = X(d), P = E(A, N);
1818
- P >= 0 && (h(!0), x([P]), $({ x: A, y: N }));
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, X, E]
1821
- ), M = G(
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 } = X(d);
1844
+ const { x: A, y: N } = Q(d);
1827
1845
  $({ x: A, y: N });
1828
- const P = E(A, N);
1829
- P >= 0 && !u.includes(P) && x((O) => [...O, P]);
1846
+ const M = E(A, N);
1847
+ M >= 0 && !u.includes(M) && w((O) => [...O, M]);
1830
1848
  },
1831
- [l, X, E, u]
1832
- ), w = G(async () => {
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
- x([]);
1854
+ w([]);
1837
1855
  return;
1838
1856
  }
1839
1857
  const d = u.join(",");
1840
1858
  if (g === "set") {
1841
1859
  if (H === null) {
1842
- Z([...u]), x([]);
1860
+ J([...u]), w([]);
1843
1861
  return;
1844
1862
  }
1845
1863
  if (H.join(",") !== d) {
1846
- Z(null), K("failure"), setTimeout(() => {
1847
- K("idle"), x([]);
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(), P = await crypto.subtle.digest("SHA-256", N.encode(d));
1858
- A = Array.from(new Uint8Array(P)).map((J) => J.toString(16).padStart(2, "0")).join("") === v;
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 = Y + 1;
1875
- B(N), K("failure"), N >= s && (D == null || D(new Error("Too many failed pattern attempts"))), setTimeout(() => {
1876
- K("idle"), x([]);
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
- Y,
1894
- s,
1911
+ Z,
1912
+ i,
1895
1913
  K,
1896
1914
  m,
1897
1915
  k,
1898
1916
  D
1899
1917
  ]);
1900
- return /* @__PURE__ */ C(
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" ? y("security.pattern.success", "Pattern accepted") : L === "failure" ? y("security.pattern.wrong", "Wrong pattern") : g === "set" && H !== null ? y("security.pattern.confirm", "Draw pattern again to confirm") : g === "set" ? y("security.pattern.setNew", "Draw a new pattern") : y("security.pattern.draw", "Draw your pattern")
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: M,
1942
- onMouseUp: w,
1943
- onMouseLeave: w,
1959
+ onMouseMove: I,
1960
+ onMouseUp: x,
1961
+ onMouseLeave: x,
1944
1962
  onTouchStart: z,
1945
- onTouchMove: M,
1946
- onTouchEnd: w
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
- x([]), B(0), Z(null), K("idle");
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: y("security.common.retry", "Try Again")
1982
+ children: p("security.common.retry", "Try Again")
1965
1983
  }
1966
1984
  ),
1967
- Y > 0 && L !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: y("security.pattern.attempts", `${Y}/${s} attempts`) })
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
- }, dt = { sm: "8px 16px", md: "12px 24px", lg: "14px 32px" }, ht = { sm: 13, md: 14, lg: 16 }, Ft = (e) => {
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: i = window.location.hostname,
1977
- rpId: s = window.location.hostname,
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: p,
2003
+ onVerify: y,
1986
2004
  onStatusChange: D,
1987
2005
  onError: R,
1988
2006
  label: b,
1989
2007
  className: T,
1990
- variant: y = "primary",
2008
+ variant: p = "primary",
1991
2009
  size: S = "md",
1992
2010
  fullWidth: u = !1,
1993
- icon: x
1994
- } = e, { t: l } = ee(), [h, L] = j("idle"), [q, Y] = j(!0), [B, H] = j(!1), Z = G(
1995
- (I) => {
1996
- L(I), D == null || D(I);
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
- te(() => {
2001
- Y(Ie()), Ze().then(H);
2018
+ ne(() => {
2019
+ Z(Ce()), Xe().then(H);
2002
2020
  }, []);
2003
2021
  const W = G(() => {
2004
2022
  if (n) {
2005
- const I = atob(n.replace(/-/g, "+").replace(/_/g, "/")), z = new Uint8Array(I.length);
2006
- for (let M = 0; M < I.length; M++)
2007
- z[M] = I.charCodeAt(M);
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
- Z("processing");
2034
+ J("processing");
2017
2035
  try {
2018
2036
  if (t === "register") {
2019
- const I = (o == null ? void 0 : o.id) ?? crypto.getRandomValues(new Uint8Array(16)), z = (o == null ? void 0 : o.name) ?? "user", M = (o == null ? void 0 : o.displayName) ?? z, w = W(), d = await Ye({
2020
- rpName: i,
2021
- rpId: s,
2022
- userId: typeof I == "string" ? I : Array.from(I).join(""),
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: M,
2025
- challenge: w
2042
+ userDisplayName: I,
2043
+ challenge: x
2026
2044
  });
2027
- Z("success"), d && (m == null || m(d)), p == null || p({
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 I = await Xe({
2036
- rpId: s,
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
- Z("success"), I && (k == null || k(I)), p == null || p({
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 (I) {
2052
- const z = I instanceof Error ? I : new Error(String(I));
2053
- z.name === "NotAllowedError" ? Z("idle") : (Z("error"), R == null || R(z), p == null || p({
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
- Z,
2091
+ J,
2074
2092
  m,
2075
2093
  k,
2076
- p,
2094
+ y,
2077
2095
  R
2078
- ]), _ = t === "register" ? B ? l("security.webauthn.registerPasskey", "🔑 Register Passkey") : l("security.webauthn.register", "🔐 Register Security Key") : B ? l("security.webauthn.signInPasskey", "🔑 Sign in with Passkey") : l("security.webauthn.signIn", "🔐 Sign in with Security Key"), F = b ?? _, K = {
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
- }, X = {
2087
- primary: "var(--nice-bg, #fff)",
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__ */ C(
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__ */ C(
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: dt[S],
2105
- fontSize: ht[S],
2123
+ padding: ft[S],
2124
+ fontSize: yt[S],
2106
2125
  fontWeight: 600,
2107
2126
  fontFamily: "var(--security-font)",
2108
- background: K[y],
2109
- color: X[y],
2110
- border: U[y],
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("span", { children: "✓" }),
2136
- x && h !== "processing" && h !== "success" && x,
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
- }, ft = {
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: i,
2161
- className: s,
2185
+ onEntryClick: s,
2186
+ className: i,
2162
2187
  label: o
2163
2188
  }) => {
2164
- const { t: a } = ee(), [g, v] = j("all"), [f, m] = j("all"), [k, p] = j(0), D = se(() => {
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 = se(() => n || Array.from(new Set(e.map((l) => l.method))), [e, n]), y = se(() => Array.from(new Set(e.map((l) => l.status))), [e]), S = G(() => {
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(), x = {
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__ */ C(
2201
+ return /* @__PURE__ */ P(
2177
2202
  "div",
2178
2203
  {
2179
- className: s,
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__ */ C(
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", "🔒 Security Audit Log") }),
2202
- /* @__PURE__ */ C("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
2203
- /* @__PURE__ */ C(
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), p(0);
2233
+ v(l.target.value), y(0);
2209
2234
  },
2210
- style: be,
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__ */ C(
2242
+ /* @__PURE__ */ P(
2218
2243
  "select",
2219
2244
  {
2220
2245
  value: f,
2221
2246
  onChange: (l) => {
2222
- m(l.target.value), p(0);
2247
+ m(l.target.value), y(0);
2223
2248
  },
2224
- style: be,
2249
+ style: xe,
2225
2250
  children: [
2226
2251
  /* @__PURE__ */ c("option", { value: "all", children: a("security.audit.allStatuses", "All statuses") }),
2227
- y.map((l) => /* @__PURE__ */ c("option", { value: l, children: l }, l))
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: pt,
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__ */ C("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
2245
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ C(
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: { ...x, textAlign: "left" }, children: a("security.audit.time", "Time") }),
2257
- /* @__PURE__ */ c("th", { style: { ...x, textAlign: "left" }, children: a("security.audit.action", "Action") }),
2258
- /* @__PURE__ */ c("th", { style: { ...x, textAlign: "center" }, children: a("security.audit.method", "Method") }),
2259
- /* @__PURE__ */ c("th", { style: { ...x, textAlign: "center" }, children: a("security.audit.status", "Status") }),
2260
- /* @__PURE__ */ c("th", { style: { ...x, textAlign: "center" }, children: a("security.audit.risk", "Risk") }),
2261
- /* @__PURE__ */ c("th", { style: { ...x, textAlign: "left" }, children: a("security.audit.device", "Device") })
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__ */ C("tbody", { children: [
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
- ...x,
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__ */ C(
2304
+ b.map((l) => /* @__PURE__ */ P(
2280
2305
  "tr",
2281
2306
  {
2282
- onClick: () => i == null ? void 0 : i(l),
2283
- style: { cursor: i ? "pointer" : "default" },
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: x, children: u(l.timestamp) }),
2292
- /* @__PURE__ */ c("td", { style: x, children: l.action }),
2293
- /* @__PURE__ */ c("td", { style: { ...x, textAlign: "center" }, children: /* @__PURE__ */ c(
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__ */ C("td", { style: { ...x, textAlign: "center" }, children: [
2308
- ft[l.status] ?? "•",
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
- ...x,
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__ */ C(
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__ */ C("button", { disabled: k === 0, onClick: () => p(k - 1), style: xe, children: [
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__ */ C("span", { children: [
2370
+ /* @__PURE__ */ P("span", { children: [
2350
2371
  k + 1,
2351
2372
  " / ",
2352
2373
  R
2353
2374
  ] }),
2354
- /* @__PURE__ */ C(
2375
+ /* @__PURE__ */ P(
2355
2376
  "button",
2356
2377
  {
2357
2378
  disabled: k >= R - 1,
2358
- onClick: () => p(k + 1),
2359
- style: xe,
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
- }, be = {
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
- }, pt = {
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
- }, xe = {
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
- }, gt = {
2406
- fingerprint: "👆",
2407
- iris: "👁️",
2408
- face: "🧑",
2409
- voice: "🎙️",
2410
- webauthn: "🔑",
2411
- pattern: "✦",
2412
- pin: "🔢",
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: i,
2420
- label: s,
2439
+ className: s,
2440
+ label: i,
2421
2441
  layout: o = "grid"
2422
2442
  }) => {
2423
- const { t: a } = ee(), g = e.filter((f) => f.verified).length, v = g >= t;
2424
- return /* @__PURE__ */ C(
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: i,
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
- s && /* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: s }),
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__ */ C(
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 ? "✅" : f.icon ?? gt[f.method] ?? "🔐" }),
2470
- /* @__PURE__ */ C("div", { children: [
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__ */ C(
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: i,
2506
- label: s,
2531
+ className: s,
2532
+ label: i,
2507
2533
  showRevokeAll: o = !0
2508
2534
  }) => {
2509
- const { t: a } = ee(), [g, v] = j(/* @__PURE__ */ new Set()), f = se(
2535
+ const { t: a } = te(), [g, v] = j(/* @__PURE__ */ new Set()), f = ae(
2510
2536
  () => [...e].sort(
2511
- (p, D) => (D.current ? 1 : 0) - (p.current ? 1 : 0) || D.lastActive - p.lastActive
2537
+ (y, D) => (D.current ? 1 : 0) - (y.current ? 1 : 0) || D.lastActive - y.lastActive
2512
2538
  ),
2513
2539
  [e]
2514
- ), m = (p) => {
2515
- const D = new Date(p), b = Date.now() - p;
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 = (p) => {
2518
- v((D) => new Set(D).add(p)), t == null || t(p);
2543
+ }, k = (y) => {
2544
+ v((D) => new Set(D).add(y)), t == null || t(y);
2519
2545
  };
2520
- return /* @__PURE__ */ C(
2546
+ return /* @__PURE__ */ P(
2521
2547
  "div",
2522
2548
  {
2523
- className: i,
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__ */ C(
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: s ?? a("security.session.title", "🖥️ Active Sessions") }),
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__ */ C("div", { children: [
2566
- f.map((p) => /* @__PURE__ */ C(
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(p.id) ? 0.5 : 1,
2576
- background: p.current ? "rgba(59,130,246,0.04)" : void 0
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__ */ C("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
2580
- /* @__PURE__ */ c("span", { style: { fontSize: 24 }, children: p.device.toLowerCase().includes("mobile") ? "📱" : "💻" }),
2581
- /* @__PURE__ */ C("div", { children: [
2582
- /* @__PURE__ */ C("div", { style: { fontSize: 14, fontWeight: 500 }, children: [
2583
- p.device,
2584
- p.current && /* @__PURE__ */ c(
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-bg, #fff)",
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
- p.trusted && /* @__PURE__ */ c(
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
- background: "var(--security-success)",
2606
- color: "var(--nice-bg, #fff)",
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: [p.browser, p.os, p.location].filter(Boolean).join(" · ") }),
2614
- /* @__PURE__ */ C("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 1 }, children: [
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(p.lastActive)
2659
+ m(y.lastActive)
2619
2660
  ] })
2620
2661
  ] })
2621
2662
  ] }),
2622
- /* @__PURE__ */ C("div", { style: { display: "flex", gap: 6 }, children: [
2623
- n && !p.current && /* @__PURE__ */ c(
2663
+ /* @__PURE__ */ P("div", { style: { display: "flex", gap: 6 }, children: [
2664
+ n && !y.current && /* @__PURE__ */ c(
2624
2665
  "button",
2625
2666
  {
2626
- onClick: () => n(p.id, !p.trusted),
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: p.trusted ? "🚫" : "✅"
2677
+ children: y.trusted ? a("security.session.untrust", "Untrust") : a("security.session.trust", "Trust")
2637
2678
  }
2638
2679
  ),
2639
- !p.current && /* @__PURE__ */ c(
2680
+ !y.current && /* @__PURE__ */ c(
2640
2681
  "button",
2641
2682
  {
2642
- onClick: () => k(p.id),
2643
- disabled: g.has(p.id),
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
- p.id
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: i = !1,
2683
- className: s,
2723
+ showFingerprint: s = !1,
2724
+ className: i,
2684
2725
  label: o
2685
2726
  }) => {
2686
- const { t: a } = ee(), [g, v] = j(e ?? null), [f, m] = j(!e), k = G(async () => {
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 = Te(), b = await le(), T = [];
2691
- let y = 50;
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
- }), y += 5), navigator.cookieEnabled && (T.push({
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
- }), y += 5), R.screenResolution[0] >= 360 && R.screenResolution[1] >= 640 && (T.push({
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
- }), y += 5), typeof window < "u" && window.isSecureContext && (T.push({
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
- }), y += 10), ((D = navigator.languages) == null ? void 0 : D.length) > 0 && (T.push({
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
- }), y += 5), R.touchSupport && (T.push({
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
- }), y += 5);
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
- }), y += 10);
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
- }), y += 5), y = Math.min(100, Math.max(0, y));
2779
+ }), p += 5), p = Math.min(100, Math.max(0, p));
2739
2780
  const S = Date.now(), u = {
2740
- score: y,
2781
+ score: p,
2741
2782
  factors: T,
2742
- trusted: y >= r,
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
- te(() => {
2793
+ ne(() => {
2753
2794
  e || k();
2754
- }, [e, k]), te(() => {
2795
+ }, [e, k]), ne(() => {
2755
2796
  e && v(e);
2756
2797
  }, [e]);
2757
- const p = g ? g.score >= 80 ? "var(--security-success)" : g.score >= 50 ? "var(--security-warning)" : "var(--security-error)" : "var(--security-text-muted)";
2758
- return /* @__PURE__ */ C(
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: s,
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", "🛡️ Device Trust") }),
2776
- f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: a("security.trust.computing", "Analysing device…") }) : g ? /* @__PURE__ */ C(Ce, { children: [
2777
- /* @__PURE__ */ C("div", { style: { position: "relative", width: 100, height: 100 }, children: [
2778
- /* @__PURE__ */ C(
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: p,
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__ */ C(
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: p }, children: g.score }),
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", "✅ Device Trusted") : a("security.trust.untrusted", "⚠️ Low Trust Score")
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__ */ C("div", { style: { width: "100%", fontSize: 12 }, children: [
2841
- /* @__PURE__ */ C(
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
- i && g.fingerprint && /* @__PURE__ */ c(
2898
+ s && g.fingerprint && /* @__PURE__ */ c(
2858
2899
  "div",
2859
2900
  {
2860
2901
  style: {
@@ -2879,13 +2920,19 @@ 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"], we = ["var(--nice-danger, #ef4444)", "var(--nice-warning, #f97316)", "var(--nice-warning, #eab308)", "var(--nice-success, #22c55e)", "var(--nice-success, #10b981)"], jt = ({
2923
+ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
2924
+ "var(--nice-danger, #ef4444)",
2925
+ "var(--nice-warning, #f97316)",
2926
+ "var(--nice-warning, #eab308)",
2927
+ "var(--nice-success, #22c55e)",
2928
+ "var(--nice-success, #10b981)"
2929
+ ], jt = ({
2883
2930
  mode: e = "verify",
2884
2931
  expectedHash: t,
2885
2932
  minStrength: r = 2,
2886
2933
  minLength: n = 8,
2887
- onComplete: i,
2888
- onVerify: s,
2934
+ onComplete: s,
2935
+ onVerify: i,
2889
2936
  onStatusChange: o,
2890
2937
  onError: a,
2891
2938
  label: g,
@@ -2894,41 +2941,41 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
2894
2941
  showStrength: m = !0,
2895
2942
  maxAttempts: k = 5
2896
2943
  }) => {
2897
- const { t: p } = ee(), [D, R] = j(""), [b, T] = j(""), [y, S] = j(!1), [u, x] = j("idle"), [l, h] = j(0), [L, q] = j(""), Y = V(null), B = mt(D), H = G(
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(
2898
2945
  ($) => {
2899
- x($), o == null || o($);
2946
+ w($), o == null || o($);
2900
2947
  },
2901
2948
  [o]
2902
- ), Z = G(async () => {
2949
+ ), J = G(async () => {
2903
2950
  if (q(""), H("processing"), e === "set") {
2904
2951
  if (D.length < n) {
2905
- q(p("security.passphrase.tooShort", `Minimum ${n} characters`)), H("idle");
2952
+ q(y("security.passphrase.tooShort", `Minimum ${n} characters`)), H("idle");
2906
2953
  return;
2907
2954
  }
2908
- if (B < r) {
2909
- q(p("security.passphrase.tooWeak", "Passphrase is too weak")), H("idle");
2955
+ if (_ < r) {
2956
+ q(y("security.passphrase.tooWeak", "Passphrase is too weak")), H("idle");
2910
2957
  return;
2911
2958
  }
2912
2959
  if (D !== b) {
2913
- q(p("security.passphrase.noMatch", "Passphrases do not match")), H("failure"), setTimeout(() => H("idle"), 1e3);
2960
+ q(y("security.passphrase.noMatch", "Passphrases do not match")), H("failure"), setTimeout(() => H("idle"), 1e3);
2914
2961
  return;
2915
2962
  }
2916
- i == null || i(D), H("success");
2963
+ s == null || s(D), H("success");
2917
2964
  return;
2918
2965
  }
2919
2966
  if (t) {
2920
- const $ = new TextEncoder(), _ = await crypto.subtle.digest("SHA-256", $.encode(D));
2921
- if (Array.from(new Uint8Array(_)).map((U) => U.toString(16).padStart(2, "0")).join("") === t)
2922
- H("success"), s == null || s({
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({
2923
2970
  success: !0,
2924
2971
  confidence: 1,
2925
2972
  method: "passphrase",
2926
2973
  timestamp: Date.now(),
2927
2974
  duration: 0
2928
- }), i == null || i(D);
2975
+ }), s == null || s(D);
2929
2976
  else {
2930
2977
  const U = l + 1;
2931
- h(U), U >= k ? (H("failure"), a == null || a(new Error("Too many failed attempts"))) : (q(p("security.passphrase.incorrect", "Incorrect passphrase")), H("idle")), s == null || s({
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({
2932
2979
  success: !1,
2933
2980
  confidence: 0,
2934
2981
  method: "passphrase",
@@ -2937,21 +2984,21 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
2937
2984
  });
2938
2985
  }
2939
2986
  } else
2940
- i == null || i(D), H("success");
2987
+ s == null || s(D), H("success");
2941
2988
  }, [
2942
2989
  D,
2943
2990
  b,
2944
2991
  e,
2945
2992
  t,
2946
- B,
2993
+ _,
2947
2994
  r,
2948
2995
  n,
2949
2996
  l,
2950
2997
  k,
2951
- p,
2998
+ y,
2952
2999
  H,
2953
- i,
2954
3000
  s,
3001
+ i,
2955
3002
  a
2956
3003
  ]), W = {
2957
3004
  width: "100%",
@@ -2964,7 +3011,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
2964
3011
  boxSizing: "border-box",
2965
3012
  fontFamily: "var(--security-font)"
2966
3013
  };
2967
- return /* @__PURE__ */ C(
3014
+ return /* @__PURE__ */ P(
2968
3015
  "div",
2969
3016
  {
2970
3017
  className: f,
@@ -2978,25 +3025,25 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
2978
3025
  },
2979
3026
  children: [
2980
3027
  g && /* @__PURE__ */ c("label", { style: { fontSize: 14, fontWeight: 600 }, children: g }),
2981
- /* @__PURE__ */ C("div", { style: { position: "relative" }, children: [
3028
+ /* @__PURE__ */ P("div", { style: { position: "relative" }, children: [
2982
3029
  /* @__PURE__ */ c(
2983
3030
  "input",
2984
3031
  {
2985
- ref: Y,
2986
- type: y ? "text" : "password",
3032
+ ref: Z,
3033
+ type: p ? "text" : "password",
2987
3034
  value: D,
2988
3035
  onChange: ($) => R($.target.value),
2989
- placeholder: v ?? p("security.passphrase.placeholder", "Enter passphrase"),
3036
+ placeholder: v ?? y("security.passphrase.placeholder", "Enter passphrase"),
2990
3037
  style: W,
2991
3038
  disabled: u === "success",
2992
- onKeyDown: ($) => $.key === "Enter" && Z()
3039
+ onKeyDown: ($) => $.key === "Enter" && J()
2993
3040
  }
2994
3041
  ),
2995
3042
  /* @__PURE__ */ c(
2996
3043
  "button",
2997
3044
  {
2998
3045
  type: "button",
2999
- onClick: () => S(!y),
3046
+ onClick: () => S(!p),
3000
3047
  style: {
3001
3048
  position: "absolute",
3002
3049
  right: 8,
@@ -3009,35 +3056,35 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
3009
3056
  color: "var(--security-text-muted)"
3010
3057
  },
3011
3058
  tabIndex: -1,
3012
- children: y ? "🙈" : "👁️"
3059
+ children: p ? y("security.passphrase.hide", "Hide") : y("security.passphrase.show", "Show")
3013
3060
  }
3014
3061
  )
3015
3062
  ] }),
3016
- e === "set" && m && D.length > 0 && /* @__PURE__ */ C("div", { children: [
3063
+ e === "set" && m && D.length > 0 && /* @__PURE__ */ P("div", { children: [
3017
3064
  /* @__PURE__ */ c("div", { style: { display: "flex", gap: 3, height: 4 }, children: [0, 1, 2, 3].map(($) => /* @__PURE__ */ c(
3018
3065
  "div",
3019
3066
  {
3020
3067
  style: {
3021
3068
  flex: 1,
3022
3069
  borderRadius: 2,
3023
- background: $ < B ? we[B] : "var(--security-border)",
3070
+ background: $ < _ ? ke[_] : "var(--security-border)",
3024
3071
  transition: "background 0.2s"
3025
3072
  }
3026
3073
  },
3027
3074
  $
3028
3075
  )) }),
3029
- /* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: we[B] }, children: p(`security.passphrase.strength${B}`, vt[B]) })
3076
+ /* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: ke[_] }, children: y(`security.passphrase.strength${_}`, vt[_]) })
3030
3077
  ] }),
3031
3078
  e === "set" && /* @__PURE__ */ c(
3032
3079
  "input",
3033
3080
  {
3034
- type: y ? "text" : "password",
3081
+ type: p ? "text" : "password",
3035
3082
  value: b,
3036
3083
  onChange: ($) => T($.target.value),
3037
- placeholder: p("security.passphrase.confirmPlaceholder", "Confirm passphrase"),
3084
+ placeholder: y("security.passphrase.confirmPlaceholder", "Confirm passphrase"),
3038
3085
  style: W,
3039
3086
  disabled: u === "success",
3040
- onKeyDown: ($) => $.key === "Enter" && Z(),
3087
+ onKeyDown: ($) => $.key === "Enter" && J(),
3041
3088
  onPaste: ($) => $.preventDefault()
3042
3089
  }
3043
3090
  ),
@@ -3045,28 +3092,28 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--
3045
3092
  /* @__PURE__ */ c(
3046
3093
  "button",
3047
3094
  {
3048
- onClick: Z,
3095
+ onClick: J,
3049
3096
  disabled: !D || u === "processing" || u === "success",
3050
3097
  style: {
3051
3098
  padding: "10px 20px",
3052
3099
  fontSize: 14,
3053
3100
  fontWeight: 600,
3054
3101
  background: u === "success" ? "var(--security-success)" : "var(--security-biometric)",
3055
- color: "var(--nice-bg, #fff)",
3102
+ color: "var(--nice-text-on-primary, #fff)",
3056
3103
  border: "none",
3057
3104
  borderRadius: "var(--security-radius)",
3058
3105
  cursor: u === "success" ? "default" : "pointer",
3059
3106
  opacity: !D || u === "processing" ? 0.6 : 1
3060
3107
  },
3061
- children: u === "success" ? "✓ " + p("security.passphrase.accepted", "Accepted") : e === "set" ? p("security.passphrase.setBtn", "Set Passphrase") : p("security.passphrase.verifyBtn", "Verify")
3108
+ children: u === "success" ? y("security.passphrase.accepted", "Accepted") : e === "set" ? y("security.passphrase.setBtn", "Set Passphrase") : y("security.passphrase.verifyBtn", "Verify")
3062
3109
  }
3063
3110
  ),
3064
- l > 0 && u !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: p("security.passphrase.attempts", `${l}/${k} attempts`) })
3111
+ l > 0 && u !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: y("security.passphrase.attempts", `${l}/${k} attempts`) })
3065
3112
  ]
3066
3113
  }
3067
3114
  );
3068
3115
  };
3069
- function _t(e) {
3116
+ function Bt(e) {
3070
3117
  const t = [], r = {
3071
3118
  defaultSrc: "default-src",
3072
3119
  scriptSrc: "script-src",
@@ -3087,21 +3134,21 @@ function _t(e) {
3087
3134
  upgradeInsecureRequests: "upgrade-insecure-requests",
3088
3135
  blockAllMixedContent: "block-all-mixed-content"
3089
3136
  };
3090
- return Object.entries(e.directives).forEach(([n, i]) => {
3091
- const s = r[n];
3092
- if (s) {
3093
- if (typeof i == "boolean")
3094
- i && t.push(s);
3095
- else if (typeof i == "string")
3096
- t.push(`${s} ${i}`);
3097
- else if (Array.isArray(i)) {
3098
- let o = i;
3099
- e.nonce && (n === "scriptSrc" || n === "styleSrc") && (o = [...o, `'nonce-${e.nonce}'`]), t.push(`${s} ${o.join(" ")}`);
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(" ")}`);
3100
3147
  }
3101
3148
  }
3102
3149
  }), t.join("; ");
3103
3150
  }
3104
- function Bt(e) {
3151
+ function _t(e) {
3105
3152
  const t = "'self'";
3106
3153
  return {
3107
3154
  defaultSrc: [t],
@@ -3153,26 +3200,26 @@ function Ht(e) {
3153
3200
  function Ot(e) {
3154
3201
  const t = ["script", "iframe", "object", "embed", "form"];
3155
3202
  let r = e;
3156
- t.forEach((s) => {
3157
- const o = new RegExp(`<${s}[^>]*>.*?</${s}>`, "gi");
3203
+ t.forEach((i) => {
3204
+ const o = new RegExp(`<${i}[^>]*>.*?</${i}>`, "gi");
3158
3205
  r = r.replace(o, "");
3159
- const a = new RegExp(`<${s}[^>]*/>`, "gi");
3206
+ const a = new RegExp(`<${i}[^>]*/>`, "gi");
3160
3207
  r = r.replace(a, "");
3161
3208
  });
3162
3209
  const n = /\s+on\w+\s*=/gi;
3163
3210
  r = r.replace(n, " data-removed=");
3164
- const i = /javascript:/gi;
3165
- return r = r.replace(i, ""), r;
3211
+ const s = /javascript:/gi;
3212
+ return r = r.replace(s, ""), r;
3166
3213
  }
3167
3214
  function qt(e, t) {
3168
3215
  let r = e;
3169
3216
  if (t != null && t.allowedTags) {
3170
3217
  const n = /<\/?([a-z][a-z0-9]*)[^>]*>/gi;
3171
- r = r.replace(n, (i, s) => t.allowedTags.includes(s.toLowerCase()) ? i : "");
3218
+ r = r.replace(n, (s, i) => t.allowedTags.includes(i.toLowerCase()) ? s : "");
3172
3219
  }
3173
3220
  return r = r.replace(/\s+on\w+\s*=/gi, " data-removed="), r = r.replace(/javascript:/gi, ""), { __html: r };
3174
3221
  }
3175
- const pe = {
3222
+ const me = {
3176
3223
  headerName: "X-CSRF-Token",
3177
3224
  cookieName: "XSRF-TOKEN",
3178
3225
  fieldName: "_csrf"
@@ -3184,21 +3231,21 @@ function Kt() {
3184
3231
  }
3185
3232
  return Math.random().toString(36).substring(2) + Date.now().toString(36);
3186
3233
  }
3187
- function Me(e = pe.cookieName) {
3234
+ function Me(e = me.cookieName) {
3188
3235
  if (typeof document > "u")
3189
3236
  return null;
3190
3237
  const t = document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));
3191
3238
  return t ? decodeURIComponent(t[2]) : null;
3192
3239
  }
3193
- function Gt(e = pe) {
3240
+ function Gt(e = me) {
3194
3241
  return async function(r, n = {}) {
3195
- const i = Me(e.cookieName);
3196
- i || console.warn("CSRF token not found");
3197
- const s = new Headers(n.headers);
3198
- return i && e.headerName && s.set(e.headerName, i), fetch(r, { ...n, headers: s });
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 });
3199
3246
  };
3200
3247
  }
3201
- function Jt(e = pe) {
3248
+ function Jt(e = me) {
3202
3249
  const t = Me(e.cookieName);
3203
3250
  return {
3204
3251
  token: t,
@@ -3211,9 +3258,9 @@ function Jt(e = pe) {
3211
3258
  };
3212
3259
  }
3213
3260
  function wt(e) {
3214
- const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((s) => s.url);
3215
- function n(s) {
3216
- const o = r(s), a = Date.now();
3261
+ const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((i) => i.url);
3262
+ function n(i) {
3263
+ const o = r(i), a = Date.now();
3217
3264
  let g = t.get(o);
3218
3265
  (!g || a > g.resetAt) && (g = {
3219
3266
  count: 0,
@@ -3222,20 +3269,20 @@ function wt(e) {
3222
3269
  const v = g.count <= e.maxRequests, f = Math.max(0, e.maxRequests - g.count);
3223
3270
  return { allowed: v, remaining: f, resetAt: g.resetAt };
3224
3271
  }
3225
- function i(s) {
3226
- s ? t.delete(s) : t.clear();
3272
+ function s(i) {
3273
+ i ? t.delete(i) : t.clear();
3227
3274
  }
3228
- return { checkLimit: n, reset: i };
3275
+ return { checkLimit: n, reset: s };
3229
3276
  }
3230
3277
  function Zt(e) {
3231
3278
  const t = wt(e);
3232
- return { checkAndFetch: async (n, i) => {
3233
- const s = t.checkLimit({ url: n, method: i == null ? void 0 : i.method });
3234
- if (!s.allowed) {
3235
- const o = Math.ceil((s.resetAt - Date.now()) / 1e3);
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);
3236
3283
  throw new Error(`Rate limit exceeded. Retry after ${o} seconds.`);
3237
3284
  }
3238
- return fetch(n, i);
3285
+ return fetch(n, s);
3239
3286
  }, checkLimit: t.checkLimit, reset: t.reset };
3240
3287
  }
3241
3288
  function St(e, t) {
@@ -3243,13 +3290,13 @@ function St(e, t) {
3243
3290
  if (t.allowedTypes && t.allowedTypes.length > 0 && (t.allowedTypes.includes(e.type) || r.push(
3244
3291
  `File type '${e.type}' is not allowed. Allowed types: ${t.allowedTypes.join(", ")}`
3245
3292
  )), t.maxSize && e.size > t.maxSize) {
3246
- const s = (t.maxSize / 1048576).toFixed(2), o = (e.size / (1024 * 1024)).toFixed(2);
3247
- r.push(`File size (${o}MB) exceeds maximum allowed size (${s}MB)`);
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)`);
3248
3295
  }
3249
- const n = [".exe", ".bat", ".cmd", ".sh", ".ps1", ".vbs", ".js", ".jar"], i = e.name.toLowerCase();
3250
- for (const s of n)
3251
- if (i.includes(s + ".") || i.endsWith(s)) {
3252
- r.push(`File extension '${s}' is not allowed`);
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`);
3253
3300
  break;
3254
3301
  }
3255
3302
  return {
@@ -3259,21 +3306,21 @@ function St(e, t) {
3259
3306
  };
3260
3307
  }
3261
3308
  function Yt(e, t) {
3262
- const r = [], n = [], i = [];
3309
+ const r = [], n = [], s = [];
3263
3310
  t.maxFiles && e.length > t.maxFiles && r.push(`Too many files. Maximum allowed: ${t.maxFiles}`);
3264
- const s = e.reduce((o, a) => o + a.size, 0);
3265
- if (t.maxTotalSize && s > t.maxTotalSize) {
3266
- const o = (t.maxTotalSize / 1048576).toFixed(2), a = (s / (1024 * 1024)).toFixed(2);
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);
3267
3314
  r.push(`Total file size (${a}MB) exceeds maximum (${o}MB)`);
3268
3315
  }
3269
3316
  return e.forEach((o) => {
3270
3317
  const a = St(o, t);
3271
- a.valid ? n.push(o) : i.push({ file: o, errors: a.errors });
3318
+ a.valid ? n.push(o) : s.push({ file: o, errors: a.errors });
3272
3319
  }), {
3273
- valid: r.length === 0 && i.length === 0,
3274
- errors: [...r, ...i.flatMap((o) => o.errors)],
3320
+ valid: r.length === 0 && s.length === 0,
3321
+ errors: [...r, ...s.flatMap((o) => o.errors)],
3275
3322
  validFiles: n,
3276
- invalidFiles: i
3323
+ invalidFiles: s
3277
3324
  };
3278
3325
  }
3279
3326
  async function Xt(e, t) {
@@ -3332,12 +3379,12 @@ async function tr(e, t, r = fetch) {
3332
3379
  userId: e
3333
3380
  };
3334
3381
  return await Promise.all(
3335
- Object.entries(t).map(async ([i, s]) => {
3382
+ Object.entries(t).map(async ([s, i]) => {
3336
3383
  try {
3337
- const o = await r(s);
3338
- o.ok && (n[i] = await o.json());
3384
+ const o = await r(i);
3385
+ o.ok && (n[s] = await o.json());
3339
3386
  } catch (o) {
3340
- console.error(`Failed to fetch ${i} data:`, o), n[i] = { error: "Failed to retrieve data" };
3387
+ console.error(`Failed to fetch ${s} data:`, o), n[s] = { error: "Failed to retrieve data" };
3341
3388
  }
3342
3389
  })
3343
3390
  ), n;
@@ -3369,19 +3416,19 @@ function nr(e, t) {
3369
3416
  }
3370
3417
  function ir(e) {
3371
3418
  let t = null, r = null, n = Date.now();
3372
- const i = e.timeoutMinutes * 60 * 1e3, s = e.warningBeforeMs || 6e4;
3419
+ const s = e.timeoutMinutes * 60 * 1e3, i = e.warningBeforeMs || 6e4;
3373
3420
  function o() {
3374
3421
  n = Date.now(), t && clearTimeout(t), r && clearTimeout(r), e.onWarning && (r = setTimeout(() => {
3375
3422
  var f;
3376
- const v = i - (Date.now() - n);
3423
+ const v = s - (Date.now() - n);
3377
3424
  (f = e.onWarning) == null || f.call(e, v);
3378
- }, i - s)), t = setTimeout(e.onTimeout, i);
3425
+ }, s - i)), t = setTimeout(e.onTimeout, s);
3379
3426
  }
3380
3427
  function a() {
3381
3428
  t && clearTimeout(t), r && clearTimeout(r);
3382
3429
  }
3383
3430
  function g() {
3384
- return Math.max(0, i - (Date.now() - n));
3431
+ return Math.max(0, s - (Date.now() - n));
3385
3432
  }
3386
3433
  return o(), typeof window < "u" && ["mousedown", "keypress", "touchstart", "scroll"].forEach((f) => {
3387
3434
  window.addEventListener(f, o, { passive: !0 });
@@ -3391,51 +3438,51 @@ function sr(e, t) {
3391
3438
  const r = (o) => {
3392
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);
3393
3440
  return 0.2126 * m(g) + 0.7152 * m(v) + 0.0722 * m(f);
3394
- }, n = r(e), i = r(t), s = (Math.max(n, i) + 0.05) / (Math.min(n, i) + 0.05);
3441
+ }, n = r(e), s = r(t), i = (Math.max(n, s) + 0.05) / (Math.min(n, s) + 0.05);
3395
3442
  return {
3396
- ratio: Math.round(s * 100) / 100,
3397
- passesAA: s >= 4.5,
3443
+ ratio: Math.round(i * 100) / 100,
3444
+ passesAA: i >= 4.5,
3398
3445
  // Normal text
3399
- passesAAA: s >= 7,
3446
+ passesAAA: i >= 7,
3400
3447
  // Normal text enhanced
3401
- passesAALarge: s >= 3,
3448
+ passesAALarge: i >= 3,
3402
3449
  // Large text (18pt+ or 14pt bold)
3403
- passesAAALarge: s >= 4.5
3450
+ passesAAALarge: i >= 4.5
3404
3451
  // Large text enhanced
3405
3452
  };
3406
3453
  }
3407
3454
  function or(e) {
3408
- var r, n, i;
3455
+ var r, n, s;
3409
3456
  if (e.getAttribute("aria-label"))
3410
3457
  return !0;
3411
3458
  const t = e.getAttribute("aria-labelledby");
3412
3459
  if (t) {
3413
- const s = document.getElementById(t);
3414
- if ((r = s == null ? void 0 : s.textContent) != null && r.trim())
3460
+ const i = document.getElementById(t);
3461
+ if ((r = i == null ? void 0 : i.textContent) != null && r.trim())
3415
3462
  return !0;
3416
3463
  }
3417
3464
  if (e.id) {
3418
- const s = document.querySelector(`label[for="${e.id}"]`);
3419
- if ((n = s == null ? void 0 : s.textContent) != null && n.trim())
3465
+ const i = document.querySelector(`label[for="${e.id}"]`);
3466
+ if ((n = i == null ? void 0 : i.textContent) != null && n.trim())
3420
3467
  return !0;
3421
3468
  }
3422
- return !!((i = e.textContent) != null && i.trim() || e.getAttribute("title") || e.placeholder);
3469
+ return !!((s = e.textContent) != null && s.trim() || e.getAttribute("title") || e.placeholder);
3423
3470
  }
3424
3471
  function ar(e) {
3425
3472
  const r = (e || document.body).querySelectorAll("h1, h2, h3, h4, h5, h6"), n = [];
3426
- let i = 0, s = !1;
3473
+ let s = 0, i = !1;
3427
3474
  return r.forEach((o) => {
3428
3475
  const a = parseInt(o.tagName[1]);
3429
- a === 1 && (s && n.push({
3476
+ a === 1 && (i && n.push({
3430
3477
  level: a,
3431
3478
  element: o,
3432
3479
  issue: "Multiple H1 elements found"
3433
- }), s = !0), a > i + 1 && i !== 0 && n.push({
3480
+ }), i = !0), a > s + 1 && s !== 0 && n.push({
3434
3481
  level: a,
3435
3482
  element: o,
3436
- issue: `Skipped heading level: H${i} to H${a}`
3437
- }), i = a;
3438
- }), !s && r.length > 0 && n.push({
3483
+ issue: `Skipped heading level: H${s} to H${a}`
3484
+ }), s = a;
3485
+ }), !i && r.length > 0 && n.push({
3439
3486
  level: 0,
3440
3487
  element: r[0],
3441
3488
  issue: "Missing H1 element"
@@ -3444,8 +3491,8 @@ function ar(e) {
3444
3491
  function cr(e) {
3445
3492
  const t = [];
3446
3493
  let r = null;
3447
- const n = e.batchSize || 10, i = e.flushInterval || 5e3;
3448
- async function s() {
3494
+ const n = e.batchSize || 10, s = e.flushInterval || 5e3;
3495
+ async function i() {
3449
3496
  if (t.length === 0)
3450
3497
  return;
3451
3498
  const v = t.splice(0, n);
@@ -3461,8 +3508,8 @@ function cr(e) {
3461
3508
  }
3462
3509
  function o() {
3463
3510
  r || (r = setTimeout(() => {
3464
- r = null, s();
3465
- }, i));
3511
+ r = null, i();
3512
+ }, s));
3466
3513
  }
3467
3514
  function a(v) {
3468
3515
  var m;
@@ -3472,12 +3519,12 @@ function cr(e) {
3472
3519
  timestamp: /* @__PURE__ */ new Date(),
3473
3520
  userAgent: e.includeUserAgent && typeof navigator < "u" ? navigator.userAgent : void 0
3474
3521
  };
3475
- t.push(f), t.length >= n ? s() : o();
3522
+ t.push(f), t.length >= n ? i() : o();
3476
3523
  }
3477
3524
  function g() {
3478
- r && clearTimeout(r), s();
3525
+ r && clearTimeout(r), i();
3479
3526
  }
3480
- return { log: a, flush: s, destroy: g };
3527
+ return { log: a, flush: i, destroy: g };
3481
3528
  }
3482
3529
  function lr() {
3483
3530
  return [
@@ -3931,10 +3978,10 @@ We will not pursue legal action against researchers who:
3931
3978
  }
3932
3979
  export {
3933
3980
  $t as NiceDeviceTrust,
3934
- Rt as NiceFaceRecognition,
3935
- Mt as NiceFingerprintScanner,
3981
+ Mt as NiceFaceRecognition,
3982
+ Ct as NiceFingerprintScanner,
3936
3983
  Dt as NiceI18nProvider,
3937
- Ct as NiceIrisScanner,
3984
+ Rt as NiceIrisScanner,
3938
3985
  Nt as NiceMfaSelector,
3939
3986
  jt as NicePassphraseInput,
3940
3987
  Et as NicePatternLock,
@@ -3944,29 +3991,29 @@ export {
3944
3991
  Ft as NiceWebAuthnButton,
3945
3992
  fr as SECRET_PATTERNS,
3946
3993
  ur as SECURITY_PATTERNS,
3947
- Xe as authenticateWebAuthn,
3948
- ae as captureFrame,
3994
+ Ve as authenticateWebAuthn,
3995
+ le as captureFrame,
3949
3996
  sr as checkColorContrast,
3950
3997
  ar as checkHeadingHierarchy,
3951
- Ae as checkLiveness,
3998
+ Ie as checkLiveness,
3952
3999
  er as clearNonEssentialCookies,
3953
- Te as collectDeviceInfo,
3954
- Ke as compareFaceToPhoto,
4000
+ De as collectDeviceInfo,
4001
+ Je as compareFaceToPhoto,
3955
4002
  cr as createAuditLogger,
3956
4003
  Gt as createCSRFFetch,
3957
4004
  ir as createHIPAASession,
3958
4005
  wt as createRateLimiter,
3959
4006
  qt as createSafeHtml,
3960
- Ue as detectIris,
4007
+ Oe as detectIris,
3961
4008
  xt as escapeHtml,
3962
- ue as extractFaceFeatures,
3963
- je as extractMinutiae,
3964
- Ge as faceToTemplate,
3965
- Be as fingerprintToTemplate,
3966
- _t as generateCSPHeader,
4009
+ he as extractFaceFeatures,
4010
+ _e as extractMinutiae,
4011
+ Ze as faceToTemplate,
4012
+ Ue as fingerprintToTemplate,
4013
+ Bt as generateCSPHeader,
3967
4014
  Kt as generateCSRFToken,
3968
4015
  tr as generateDataExport,
3969
- le as generateDeviceFingerprint,
4016
+ de as generateDeviceFingerprint,
3970
4017
  It as generateLivenessChallenge,
3971
4018
  Wt as generateNonce,
3972
4019
  yr as generatePreCommitHook,
@@ -3976,34 +4023,34 @@ export {
3976
4023
  gr as generateSecurityAdvisory,
3977
4024
  mr as generateSecurityMd,
3978
4025
  Me as getCSRFTokenFromCookie,
3979
- fe as getCameraStream,
4026
+ pe as getCameraStream,
3980
4027
  kt as getConsentPreferences,
3981
- Bt as getRecommendedCSP,
4028
+ _t as getRecommendedCSP,
3982
4029
  lr as getSOC2Checklist,
3983
4030
  or as hasAccessibleName,
3984
4031
  Vt as hasConsent,
3985
- Oe as irisToTemplate,
3986
- Ze as isPasskeyAvailable,
3987
- Ie as isWebAuthnAvailable,
4032
+ Ke as irisToTemplate,
4033
+ Xe as isPasskeyAvailable,
4034
+ Ce as isWebAuthnAvailable,
3988
4035
  nr as logPHIAccess,
3989
- ke as matchFaces,
3990
- _e as matchFingerprints,
3991
- He as matchIris,
3992
- Ye as registerWebAuthn,
4036
+ Te as matchFaces,
4037
+ We as matchFingerprints,
4038
+ qe as matchIris,
4039
+ Qe as registerWebAuthn,
3993
4040
  rr as requestDataDeletion,
3994
- de as resolveConfig,
4041
+ fe as resolveConfig,
3995
4042
  Ut as sanitizeInput,
3996
4043
  Ot as sanitizeSvg,
3997
4044
  Ht as sanitizeUrl,
3998
4045
  Qt as saveConsentPreferences,
3999
4046
  Xt as scanFileForViruses,
4000
- Je as templateToFace,
4001
- We as templateToFingerprint,
4002
- qe as templateToIris,
4047
+ Ye as templateToFace,
4048
+ He as templateToFingerprint,
4049
+ Ge as templateToIris,
4003
4050
  Jt as useCSRFToken,
4004
- ee as useNiceTranslation,
4051
+ te as useNiceTranslation,
4005
4052
  Zt as useRateLimiter,
4006
4053
  St as validateFile,
4007
4054
  Yt as validateFiles,
4008
- ye as verifyWithBackend
4055
+ ge as verifyWithBackend
4009
4056
  };