@camstack/addon-auth 1.2.147 → 1.2.149

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.
@@ -1,12 +1,12 @@
1
1
  import { n as e, r as t, t as n } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare__react__loadShare__.js-BIIa6vDX.mjs";
2
2
  import { n as r, t as i } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CQ-aEQ9b.mjs";
3
- import { t as a } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-C_j9tv24.mjs";
4
- import { n as o, r as s, t as c } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-BL2etuqg.mjs";
3
+ import { n as a, t as o } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BpOR-FRf.mjs";
4
+ import { n as s, r as c, t as l } from "./_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-BL2etuqg.mjs";
5
5
  //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
6
- var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), u = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), d = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), f = (e) => {
7
- let t = d(e);
6
+ var u = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), d = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), f = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), p = (e) => {
7
+ let t = f(e);
8
8
  return t.charAt(0).toUpperCase() + t.slice(1);
9
- }, p = {
9
+ }, m = {
10
10
  xmlns: "http://www.w3.org/2000/svg",
11
11
  width: 24,
12
12
  height: 24,
@@ -16,28 +16,28 @@ var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
16
16
  strokeWidth: 2,
17
17
  strokeLinecap: "round",
18
18
  strokeLinejoin: "round"
19
- }, m = (e) => {
19
+ }, h = (e) => {
20
20
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
21
21
  return !1;
22
- }, h = e(({ color: e = "currentColor", size: t = 24, strokeWidth: r = 2, absoluteStrokeWidth: i, className: a = "", children: o, iconNode: s, ...c }, u) => n("svg", {
23
- ref: u,
24
- ...p,
22
+ }, g = e(({ color: e = "currentColor", size: t = 24, strokeWidth: r = 2, absoluteStrokeWidth: i, className: a = "", children: o, iconNode: s, ...c }, l) => n("svg", {
23
+ ref: l,
24
+ ...m,
25
25
  width: t,
26
26
  height: t,
27
27
  stroke: e,
28
28
  strokeWidth: i ? Number(r) * 24 / Number(t) : r,
29
- className: l("lucide", a),
30
- ...!o && !m(c) && { "aria-hidden": "true" },
29
+ className: u("lucide", a),
30
+ ...!o && !h(c) && { "aria-hidden": "true" },
31
31
  ...c
32
- }, [...s.map(([e, t]) => n(e, t)), ...Array.isArray(o) ? o : [o]])), g = (t, r) => {
33
- let i = e(({ className: e, ...i }, a) => n(h, {
32
+ }, [...s.map(([e, t]) => n(e, t)), ...Array.isArray(o) ? o : [o]])), _ = (t, r) => {
33
+ let i = e(({ className: e, ...i }, a) => n(g, {
34
34
  ref: a,
35
35
  iconNode: r,
36
- className: l(`lucide-${u(f(t))}`, `lucide-${t}`, e),
36
+ className: u(`lucide-${d(p(t))}`, `lucide-${t}`, e),
37
37
  ...i
38
38
  }));
39
- return i.displayName = f(t), i;
40
- }, _ = g("circle-alert", [
39
+ return i.displayName = p(t), i;
40
+ }, v = _("circle-alert", [
41
41
  ["circle", {
42
42
  cx: "12",
43
43
  cy: "12",
@@ -58,7 +58,7 @@ var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
58
58
  y2: "16",
59
59
  key: "4dfq90"
60
60
  }]
61
- ]), v = g("fingerprint-pattern", [
61
+ ]), y = _("fingerprint-pattern", [
62
62
  ["path", {
63
63
  d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",
64
64
  key: "1nerag"
@@ -95,7 +95,7 @@ var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
95
95
  d: "M9 6.8a6 6 0 0 1 9 5.2v2",
96
96
  key: "1fr1j5"
97
97
  }]
98
- ]), y = g("key-round", [["path", {
98
+ ]), b = _("key-round", [["path", {
99
99
  d: "M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",
100
100
  key: "1s6t7t"
101
101
  }], ["circle", {
@@ -104,10 +104,10 @@ var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
104
104
  r: ".5",
105
105
  fill: "currentColor",
106
106
  key: "w0ekpg"
107
- }]]), b = g("loader-circle", [["path", {
107
+ }]]), x = _("loader-circle", [["path", {
108
108
  d: "M21 12a9 9 0 1 1-6.219-8.56",
109
109
  key: "13zald"
110
- }]]), x = g("trash-2", [
110
+ }]]), S = _("trash-2", [
111
111
  ["path", {
112
112
  d: "M10 11v6",
113
113
  key: "nco0om"
@@ -131,105 +131,105 @@ var l = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
131
131
  ]);
132
132
  //#endregion
133
133
  //#region ../../node_modules/@simplewebauthn/browser/dist/bundle/index.js
134
- function S(e) {
134
+ function C(e) {
135
135
  let t = new Uint8Array(e), n = "";
136
136
  for (let e of t) n += String.fromCharCode(e);
137
137
  return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
138
138
  }
139
- function C(e) {
139
+ function w(e) {
140
140
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), i = atob(r), a = new ArrayBuffer(i.length), o = new Uint8Array(a);
141
141
  for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
142
142
  return a;
143
143
  }
144
- function w() {
144
+ function T() {
145
145
  return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
146
146
  }
147
- function T(e) {
147
+ function E(e) {
148
148
  let { id: t } = e;
149
149
  return {
150
150
  ...e,
151
- id: C(t),
151
+ id: w(t),
152
152
  transports: e.transports
153
153
  };
154
154
  }
155
- function E(e) {
155
+ function D(e) {
156
156
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
157
157
  }
158
- var D = class extends Error {
158
+ var O = class extends Error {
159
159
  constructor({ message: e, code: t, cause: n, name: r }) {
160
160
  super(e, { cause: n }), this.name = r ?? n.name, this.code = t;
161
161
  }
162
162
  };
163
- function O({ error: e, options: t }) {
163
+ function k({ error: e, options: t }) {
164
164
  let { publicKey: n } = t;
165
165
  if (!n) throw Error("options was missing required publicKey property");
166
166
  if (e.name === "AbortError") {
167
- if (t.signal instanceof AbortSignal) return new D({
167
+ if (t.signal instanceof AbortSignal) return new O({
168
168
  message: "Registration ceremony was sent an abort signal",
169
169
  code: "ERROR_CEREMONY_ABORTED",
170
170
  cause: e
171
171
  });
172
172
  } else if (e.name === "ConstraintError") {
173
- if (n.authenticatorSelection?.requireResidentKey === !0) return new D({
173
+ if (n.authenticatorSelection?.requireResidentKey === !0) return new O({
174
174
  message: "Discoverable credentials were required but no available authenticator supported it",
175
175
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
176
176
  cause: e
177
177
  });
178
- if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new D({
178
+ if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new O({
179
179
  message: "User verification was required during automatic registration but it could not be performed",
180
180
  code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
181
181
  cause: e
182
182
  });
183
- if (n.authenticatorSelection?.userVerification === "required") return new D({
183
+ if (n.authenticatorSelection?.userVerification === "required") return new O({
184
184
  message: "User verification was required but no available authenticator supported it",
185
185
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
186
186
  cause: e
187
187
  });
188
- } else if (e.name === "InvalidStateError") return new D({
188
+ } else if (e.name === "InvalidStateError") return new O({
189
189
  message: "The authenticator was previously registered",
190
190
  code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
191
191
  cause: e
192
192
  });
193
- else if (e.name === "NotAllowedError") return new D({
193
+ else if (e.name === "NotAllowedError") return new O({
194
194
  message: e.message,
195
195
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
196
196
  cause: e
197
197
  });
198
- else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new D({
198
+ else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new O({
199
199
  message: "No entry in pubKeyCredParams was of type \"public-key\"",
200
200
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
201
201
  cause: e
202
- }) : new D({
202
+ }) : new O({
203
203
  message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
204
204
  code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
205
205
  cause: e
206
206
  });
207
207
  else if (e.name === "SecurityError") {
208
208
  let t = window.location.hostname;
209
- if (!E(t)) return new D({
209
+ if (!D(t)) return new O({
210
210
  message: `${window.location.hostname} is an invalid domain`,
211
211
  code: "ERROR_INVALID_DOMAIN",
212
212
  cause: e
213
213
  });
214
- if (n.rp.id !== t) return new D({
214
+ if (n.rp.id !== t) return new O({
215
215
  message: `The RP ID "${n.rp.id}" is invalid for this domain`,
216
216
  code: "ERROR_INVALID_RP_ID",
217
217
  cause: e
218
218
  });
219
219
  } else if (e.name === "TypeError") {
220
- if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new D({
220
+ if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new O({
221
221
  message: "User ID was not between 1 and 64 characters",
222
222
  code: "ERROR_INVALID_USER_ID_LENGTH",
223
223
  cause: e
224
224
  });
225
- } else if (e.name === "UnknownError") return new D({
225
+ } else if (e.name === "UnknownError") return new O({
226
226
  message: "The authenticator was unable to process the specified options, or could not create a new credential",
227
227
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
228
228
  cause: e
229
229
  });
230
230
  return e;
231
231
  }
232
- var k = new class {
232
+ var A = new class {
233
233
  createNewAbortSignal() {
234
234
  if (this.controller) {
235
235
  let e = /* @__PURE__ */ Error("Cancelling existing WebAuthn API call for new one");
@@ -244,28 +244,28 @@ var k = new class {
244
244
  e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
245
245
  }
246
246
  }
247
- }(), A = ["cross-platform", "platform"];
248
- function j(e) {
249
- if (e && !(A.indexOf(e) < 0)) return e;
247
+ }(), j = ["cross-platform", "platform"];
248
+ function M(e) {
249
+ if (e && !(j.indexOf(e) < 0)) return e;
250
250
  }
251
- async function M(e) {
251
+ async function N(e) {
252
252
  let { optionsJSON: t, useAutoRegister: n = !1 } = e;
253
- if (!w()) throw Error("WebAuthn is not supported in this browser");
253
+ if (!T()) throw Error("WebAuthn is not supported in this browser");
254
254
  let r = {
255
255
  ...t,
256
- challenge: C(t.challenge),
256
+ challenge: w(t.challenge),
257
257
  user: {
258
258
  ...t.user,
259
- id: C(t.user.id)
259
+ id: w(t.user.id)
260
260
  },
261
- excludeCredentials: t.excludeCredentials?.map(T)
261
+ excludeCredentials: t.excludeCredentials?.map(E)
262
262
  }, i = {};
263
- n && (i.mediation = "conditional"), i.publicKey = r, i.signal = k.createNewAbortSignal();
263
+ n && (i.mediation = "conditional"), i.publicKey = r, i.signal = A.createNewAbortSignal();
264
264
  let a;
265
265
  try {
266
266
  a = await navigator.credentials.create(i);
267
267
  } catch (e) {
268
- throw O({
268
+ throw k({
269
269
  error: e,
270
270
  options: i
271
271
  });
@@ -277,27 +277,27 @@ async function M(e) {
277
277
  if (typeof c.getPublicKeyAlgorithm == "function") try {
278
278
  d = c.getPublicKeyAlgorithm();
279
279
  } catch (e) {
280
- N("getPublicKeyAlgorithm()", e);
280
+ P("getPublicKeyAlgorithm()", e);
281
281
  }
282
282
  let f;
283
283
  if (typeof c.getPublicKey == "function") try {
284
284
  let e = c.getPublicKey();
285
- e !== null && (f = S(e));
285
+ e !== null && (f = C(e));
286
286
  } catch (e) {
287
- N("getPublicKey()", e);
287
+ P("getPublicKey()", e);
288
288
  }
289
289
  let p;
290
290
  if (typeof c.getAuthenticatorData == "function") try {
291
- p = S(c.getAuthenticatorData());
291
+ p = C(c.getAuthenticatorData());
292
292
  } catch (e) {
293
- N("getAuthenticatorData()", e);
293
+ P("getAuthenticatorData()", e);
294
294
  }
295
295
  return {
296
296
  id: o,
297
- rawId: S(s),
297
+ rawId: C(s),
298
298
  response: {
299
- attestationObject: S(c.attestationObject),
300
- clientDataJSON: S(c.clientDataJSON),
299
+ attestationObject: C(c.attestationObject),
300
+ clientDataJSON: C(c.clientDataJSON),
301
301
  transports: u,
302
302
  publicKeyAlgorithm: d,
303
303
  publicKey: f,
@@ -305,139 +305,231 @@ async function M(e) {
305
305
  },
306
306
  type: l,
307
307
  clientExtensionResults: a.getClientExtensionResults(),
308
- authenticatorAttachment: j(a.authenticatorAttachment)
308
+ authenticatorAttachment: M(a.authenticatorAttachment)
309
309
  };
310
310
  }
311
- function N(e, t) {
311
+ function P(e, t) {
312
312
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
313
313
  }
314
- function P() {
315
- if (!w()) return new Promise((e) => e(!1));
314
+ function F() {
315
+ if (!T()) return new Promise((e) => e(!1));
316
316
  let e = window.PublicKeyCredential;
317
317
  return e.isConditionalMediationAvailable === void 0 ? new Promise((e) => e(!1)) : e.isConditionalMediationAvailable();
318
318
  }
319
- function F({ error: e, options: t }) {
319
+ function I({ error: e, options: t }) {
320
320
  let { publicKey: n } = t;
321
321
  if (!n) throw Error("options was missing required publicKey property");
322
322
  if (e.name === "AbortError") {
323
- if (t.signal instanceof AbortSignal) return new D({
323
+ if (t.signal instanceof AbortSignal) return new O({
324
324
  message: "Authentication ceremony was sent an abort signal",
325
325
  code: "ERROR_CEREMONY_ABORTED",
326
326
  cause: e
327
327
  });
328
- } else if (e.name === "NotAllowedError") return new D({
328
+ } else if (e.name === "NotAllowedError") return new O({
329
329
  message: e.message,
330
330
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
331
331
  cause: e
332
332
  });
333
333
  else if (e.name === "SecurityError") {
334
334
  let t = window.location.hostname;
335
- if (!E(t)) return new D({
335
+ if (!D(t)) return new O({
336
336
  message: `${window.location.hostname} is an invalid domain`,
337
337
  code: "ERROR_INVALID_DOMAIN",
338
338
  cause: e
339
339
  });
340
- if (n.rpId !== t) return new D({
340
+ if (n.rpId !== t) return new O({
341
341
  message: `The RP ID "${n.rpId}" is invalid for this domain`,
342
342
  code: "ERROR_INVALID_RP_ID",
343
343
  cause: e
344
344
  });
345
- } else if (e.name === "UnknownError") return new D({
345
+ } else if (e.name === "UnknownError") return new O({
346
346
  message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
347
347
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
348
348
  cause: e
349
349
  });
350
350
  return e;
351
351
  }
352
- async function I(e) {
352
+ async function L(e) {
353
353
  let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
354
- if (!w()) throw Error("WebAuthn is not supported in this browser");
354
+ if (!T()) throw Error("WebAuthn is not supported in this browser");
355
355
  let i;
356
- t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(T));
356
+ t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(E));
357
357
  let a = {
358
358
  ...t,
359
- challenge: C(t.challenge),
359
+ challenge: w(t.challenge),
360
360
  allowCredentials: i
361
361
  }, o = {};
362
362
  if (n) {
363
- if (!await P()) throw Error("Browser does not support WebAuthn autofill");
363
+ if (!await F()) throw Error("Browser does not support WebAuthn autofill");
364
364
  if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && r) throw Error("No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected");
365
365
  o.mediation = "conditional", a.allowCredentials = [];
366
366
  }
367
- o.publicKey = a, o.signal = k.createNewAbortSignal();
367
+ o.publicKey = a, o.signal = A.createNewAbortSignal();
368
368
  let s;
369
369
  try {
370
370
  s = await navigator.credentials.get(o);
371
371
  } catch (e) {
372
- throw F({
372
+ throw I({
373
373
  error: e,
374
374
  options: o
375
375
  });
376
376
  }
377
377
  if (!s) throw Error("Authentication was not completed");
378
378
  let { id: c, rawId: l, response: u, type: d } = s, f;
379
- return u.userHandle && (f = S(u.userHandle)), {
379
+ return u.userHandle && (f = C(u.userHandle)), {
380
380
  id: c,
381
- rawId: S(l),
381
+ rawId: C(l),
382
382
  response: {
383
- authenticatorData: S(u.authenticatorData),
384
- clientDataJSON: S(u.clientDataJSON),
385
- signature: S(u.signature),
383
+ authenticatorData: C(u.authenticatorData),
384
+ clientDataJSON: C(u.clientDataJSON),
385
+ signature: C(u.signature),
386
386
  userHandle: f
387
387
  },
388
388
  type: d,
389
389
  clientExtensionResults: s.getClientExtensionResults(),
390
- authenticatorAttachment: j(s.authenticatorAttachment)
390
+ authenticatorAttachment: M(s.authenticatorAttachment)
391
391
  };
392
392
  }
393
393
  //#endregion
394
394
  //#region src/webauthn/widgets/passkey-ceremony.ts
395
- function L() {
396
- return w();
395
+ function R() {
396
+ return T();
397
+ }
398
+ function z(e) {
399
+ return {
400
+ ...e,
401
+ challenge: e.challenge
402
+ };
397
403
  }
398
- async function R(e) {
399
- let t = await I({ optionsJSON: e });
404
+ function B(e) {
405
+ return {
406
+ ...e,
407
+ challenge: e.challenge
408
+ };
409
+ }
410
+ async function V(e) {
411
+ if (typeof e.challenge != "string") throw Error("passkey authentication options missing challenge");
412
+ let t = await L({ optionsJSON: z(e) });
400
413
  return Object.fromEntries(Object.entries(t));
401
414
  }
402
- async function z(e) {
403
- let t = await M({ optionsJSON: e });
415
+ async function H(e) {
416
+ if (typeof e.challenge != "string") throw Error("passkey registration options missing challenge");
417
+ let t = await N({ optionsJSON: B(e) });
404
418
  return Object.fromEntries(Object.entries(t));
405
419
  }
406
420
  //#endregion
421
+ //#region src/i18n/index.ts
422
+ var { useT: U } = a("auth-webauthn", {
423
+ en: {
424
+ directLogin: {
425
+ requiresCallback: "Passkey direct-login widget requires an onComplete callback.",
426
+ signInWithPasskey: "Sign in with a passkey",
427
+ unsupported: "This browser does not support passkeys.",
428
+ failed: "Passkey sign-in failed",
429
+ secondFactorRequired: "Additional verification is required — sign in with your password to continue."
430
+ },
431
+ login: {
432
+ requiresChallenge: "Passkey login widget requires a challengeToken + onComplete callback.",
433
+ unsupported: "This browser does not support passkeys.",
434
+ verificationFailed: "Passkey verification failed",
435
+ usePasskey: "Use a passkey"
436
+ },
437
+ enrollment: {
438
+ title: "Passkeys",
439
+ intro: "Add a passkey (Touch ID, Windows Hello, or a security key) to sign in directly — fast and phishing-resistant, no password needed.",
440
+ loading: "Loading passkeys…",
441
+ addedUsed: "Added {{added}} · last used {{used}}",
442
+ addedNever: "Added {{added}} · never used",
443
+ currentPassword: "Current password",
444
+ passwordToConfirm: "Password to confirm",
445
+ remove: "Remove",
446
+ usePasskey: "Use a passkey",
447
+ none: "No passkeys enrolled yet.",
448
+ secondFactorTitle: "Require passkey as second factor",
449
+ secondFactorHint: "Also ask for a passkey after every password sign-in. Off by default — enrolling a passkey on its own only enables direct passkey sign-in.",
450
+ passkeyName: "Passkey name",
451
+ namePlaceholder: "e.g. MacBook Touch ID",
452
+ enrolling: "Enrolling…",
453
+ addPasskey: "Add passkey",
454
+ unnamedDevice: "Unnamed device",
455
+ preferenceFailed: "Could not update the preference",
456
+ enrollFailed: "Passkey enrollment failed",
457
+ removeFailed: "Remove failed"
458
+ }
459
+ },
460
+ it: {
461
+ directLogin: {
462
+ requiresCallback: "Il widget di accesso diretto con passkey richiede una callback onComplete.",
463
+ signInWithPasskey: "Accedi con una passkey",
464
+ unsupported: "Questo browser non supporta le passkey.",
465
+ failed: "Accesso con passkey non riuscito",
466
+ secondFactorRequired: "È richiesta una verifica aggiuntiva — accedi con la password per continuare."
467
+ },
468
+ login: {
469
+ requiresChallenge: "Il widget di accesso con passkey richiede un challengeToken e una callback onComplete.",
470
+ unsupported: "Questo browser non supporta le passkey.",
471
+ verificationFailed: "Verifica della passkey non riuscita",
472
+ usePasskey: "Usa una passkey"
473
+ },
474
+ enrollment: {
475
+ title: "Passkey",
476
+ intro: "Aggiungi una passkey (Touch ID, Windows Hello o una chiave di sicurezza) per accedere direttamente: veloce, resistente al phishing e senza password.",
477
+ loading: "Caricamento passkey…",
478
+ addedUsed: "Aggiunta il {{added}} · ultimo utilizzo {{used}}",
479
+ addedNever: "Aggiunta il {{added}} · mai utilizzata",
480
+ currentPassword: "Password attuale",
481
+ passwordToConfirm: "Password per confermare",
482
+ remove: "Rimuovi",
483
+ usePasskey: "Usa una passkey",
484
+ none: "Nessuna passkey registrata.",
485
+ secondFactorTitle: "Richiedi la passkey come secondo fattore",
486
+ secondFactorHint: "Chiedi una passkey anche dopo ogni accesso con password. Disattivato per impostazione predefinita: registrare una passkey abilita soltanto l'accesso diretto con passkey.",
487
+ passkeyName: "Nome della passkey",
488
+ namePlaceholder: "es. MacBook Touch ID",
489
+ enrolling: "Registrazione…",
490
+ addPasskey: "Aggiungi passkey",
491
+ unnamedDevice: "Dispositivo senza nome",
492
+ preferenceFailed: "Impossibile aggiornare la preferenza",
493
+ enrollFailed: "Registrazione della passkey non riuscita",
494
+ removeFailed: "Rimozione non riuscita"
495
+ }
496
+ }
497
+ });
498
+ //#endregion
407
499
  //#region src/webauthn/widgets/PasskeyEnrollment.tsx
408
- function B(e) {
409
- let n = a(), l = r({
500
+ function W(e) {
501
+ let n = o(), { t: a, lang: u } = U(), d = r({
410
502
  queryKey: ["auth", "listOwnPasskeys"],
411
503
  queryFn: () => n.listOwnPasskeys()
412
- }), u = l.data ?? [], [d, f] = t(""), [p, m] = t(!1), [h, g] = t(null), S = r({
504
+ }), f = d.data ?? [], [p, m] = t(""), [h, g] = t(!1), [_, C] = t(null), w = r({
413
505
  queryKey: ["auth", "getOwnPasskeySecondFactorPreference"],
414
506
  queryFn: () => n.getOwnPasskeySecondFactorPreference(),
415
- enabled: u.length > 0
416
- }), C = S.data?.enabled ?? !1, w = i({
507
+ enabled: f.length > 0
508
+ }), T = w.data?.enabled ?? !1, E = i({
417
509
  mutationFn: (e) => n.setOwnPasskeySecondFactorPreference({ enabled: e }),
418
510
  onSuccess: () => {
419
- g(null), S.refetch();
511
+ C(null), w.refetch();
420
512
  },
421
- onError: (e) => g(e instanceof Error ? e.message : "Could not update the preference")
422
- }), T = async () => {
423
- g(null), m(!0);
513
+ onError: (e) => C(e instanceof Error ? e.message : a("enrollment.preferenceFailed"))
514
+ }), D = async () => {
515
+ C(null), g(!0);
424
516
  try {
425
- let e = await z((await n.beginOwnPasskeyRegistration()).optionsJSON);
517
+ let e = await H((await n.beginOwnPasskeyRegistration()).optionsJSON);
426
518
  await n.finishOwnPasskeyRegistration({
427
519
  response: e,
428
- label: d.trim() || "Unnamed device"
429
- }), f(""), l.refetch();
520
+ label: p.trim() || a("enrollment.unnamedDevice")
521
+ }), m(""), d.refetch();
430
522
  } catch (e) {
431
- g(e instanceof Error ? e.message : "Passkey enrollment failed");
523
+ C(e instanceof Error ? e.message : a("enrollment.enrollFailed"));
432
524
  } finally {
433
- m(!1);
525
+ g(!1);
434
526
  }
435
- }, [E, D] = t(null), [O, k] = t(""), A = i({
527
+ }, [O, k] = t(null), [A, j] = t(""), M = i({
436
528
  mutationFn: async (e) => {
437
529
  let t;
438
530
  if ("password" in e.proof) t = (await n.reauthenticate({ password: e.proof.password })).reauthToken;
439
531
  else {
440
- let { optionsJSON: e } = await n.reauthBeginPasskey(), r = await R(e);
532
+ let { optionsJSON: e } = await n.reauthBeginPasskey(), r = await V(e);
441
533
  t = (await n.reauthenticate({ passkeyResponse: r })).reauthToken;
442
534
  }
443
535
  return n.removeOwnPasskey({
@@ -446,142 +538,141 @@ function B(e) {
446
538
  });
447
539
  },
448
540
  onSuccess: () => {
449
- g(null), D(null), k(""), l.refetch();
541
+ C(null), k(null), j(""), d.refetch();
450
542
  },
451
- onError: (e) => g(e instanceof Error ? e.message : "Remove failed")
543
+ onError: (e) => C(e instanceof Error ? e.message : a("enrollment.removeFailed"))
452
544
  });
453
- return /* @__PURE__ */ s("div", {
545
+ return /* @__PURE__ */ c("div", {
454
546
  className: "rounded-lg border border-border bg-surface overflow-hidden",
455
- children: [/* @__PURE__ */ s("div", {
547
+ children: [/* @__PURE__ */ c("div", {
456
548
  className: "px-4 py-2.5 border-b border-border flex items-center gap-2",
457
- children: [/* @__PURE__ */ o(v, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ o("div", {
549
+ children: [/* @__PURE__ */ s(y, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ s("div", {
458
550
  className: "text-xs font-semibold text-foreground",
459
- children: "Passkeys"
551
+ children: a("enrollment.title")
460
552
  })]
461
- }), /* @__PURE__ */ s("div", {
553
+ }), /* @__PURE__ */ c("div", {
462
554
  className: "p-4 space-y-3",
463
555
  children: [
464
- /* @__PURE__ */ o("div", {
556
+ /* @__PURE__ */ s("div", {
465
557
  className: "text-xs text-foreground-subtle",
466
- children: "Add a passkey (Touch ID, Windows Hello, or a security key) to sign in directly — fast and phishing-resistant, no password needed."
558
+ children: a("enrollment.intro")
467
559
  }),
468
- l.isLoading ? /* @__PURE__ */ s("div", {
560
+ d.isLoading ? /* @__PURE__ */ c("div", {
469
561
  className: "flex items-center gap-2 text-xs text-foreground-subtle",
470
- children: [/* @__PURE__ */ o(b, { className: "h-3.5 w-3.5 animate-spin" }), "Loading passkeys…"]
471
- }) : u.length > 0 ? /* @__PURE__ */ o("ul", {
562
+ children: [/* @__PURE__ */ s(x, { className: "h-3.5 w-3.5 animate-spin" }), a("enrollment.loading")]
563
+ }) : f.length > 0 ? /* @__PURE__ */ s("ul", {
472
564
  className: "divide-y divide-border rounded-md border border-border",
473
- children: u.map((e) => /* @__PURE__ */ s("li", {
565
+ children: f.map((e) => /* @__PURE__ */ c("li", {
474
566
  className: "flex items-center gap-3 px-3 py-2 text-xs",
475
567
  children: [
476
- /* @__PURE__ */ o(y, { className: "h-3.5 w-3.5 text-foreground-subtle shrink-0" }),
477
- /* @__PURE__ */ s("div", {
568
+ /* @__PURE__ */ s(b, { className: "h-3.5 w-3.5 text-foreground-subtle shrink-0" }),
569
+ /* @__PURE__ */ c("div", {
478
570
  className: "flex-1 min-w-0",
479
- children: [/* @__PURE__ */ o("div", {
571
+ children: [/* @__PURE__ */ s("div", {
480
572
  className: "font-medium text-foreground truncate",
481
573
  children: e.label
482
574
  }), /* @__PURE__ */ s("div", {
483
575
  className: "text-[10px] text-foreground-subtle",
484
- children: [
485
- "Added ",
486
- new Date(e.createdAt).toLocaleDateString(),
487
- e.lastUsedAt ? ` · last used ${new Date(e.lastUsedAt).toLocaleDateString()}` : " · never used"
488
- ]
576
+ children: e.lastUsedAt ? a("enrollment.addedUsed", {
577
+ added: new Date(e.createdAt).toLocaleDateString(u),
578
+ used: new Date(e.lastUsedAt).toLocaleDateString(u)
579
+ }) : a("enrollment.addedNever", { added: new Date(e.createdAt).toLocaleDateString(u) })
489
580
  })]
490
581
  }),
491
- E === e.credentialId ? /* @__PURE__ */ s("form", {
582
+ O === e.credentialId ? /* @__PURE__ */ c("form", {
492
583
  className: "flex items-center gap-1.5",
493
584
  onSubmit: (t) => {
494
- t.preventDefault(), O.length > 0 && A.mutate({
585
+ t.preventDefault(), A.length > 0 && M.mutate({
495
586
  credentialId: e.credentialId,
496
- proof: { password: O }
587
+ proof: { password: A }
497
588
  });
498
589
  },
499
590
  children: [
500
- /* @__PURE__ */ o("input", {
591
+ /* @__PURE__ */ s("input", {
501
592
  type: "password",
502
593
  autoComplete: "current-password",
503
- "aria-label": "Current password",
504
- placeholder: "Password to confirm",
505
- value: O,
506
- onChange: (e) => k(e.target.value),
594
+ "aria-label": a("enrollment.currentPassword"),
595
+ placeholder: a("enrollment.passwordToConfirm"),
596
+ value: A,
597
+ onChange: (e) => j(e.target.value),
507
598
  className: "w-36 rounded border border-border bg-background px-2 py-1 text-[11px]"
508
599
  }),
509
- /* @__PURE__ */ o("button", {
600
+ /* @__PURE__ */ s("button", {
510
601
  type: "submit",
511
- disabled: O.length === 0 || A.isPending,
602
+ disabled: A.length === 0 || M.isPending,
512
603
  className: "rounded px-2 py-1 text-[11px] text-danger hover:bg-danger/10 disabled:opacity-50",
513
- children: "Remove"
604
+ children: a("enrollment.remove")
514
605
  }),
515
- /* @__PURE__ */ o("button", {
606
+ /* @__PURE__ */ s("button", {
516
607
  type: "button",
517
- disabled: A.isPending,
518
- onClick: () => A.mutate({
608
+ disabled: M.isPending,
609
+ onClick: () => M.mutate({
519
610
  credentialId: e.credentialId,
520
611
  proof: { passkey: !0 }
521
612
  }),
522
613
  className: "rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-50",
523
- children: "Use a passkey"
614
+ children: a("enrollment.usePasskey")
524
615
  })
525
616
  ]
526
- }) : /* @__PURE__ */ s("button", {
617
+ }) : /* @__PURE__ */ c("button", {
527
618
  onClick: () => {
528
- g(null), k(""), D(e.credentialId);
619
+ C(null), j(""), k(e.credentialId);
529
620
  },
530
- disabled: A.isPending,
621
+ disabled: M.isPending,
531
622
  className: "inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-danger hover:bg-danger/10 disabled:opacity-50",
532
- children: [/* @__PURE__ */ o(x, { className: "h-3 w-3" }), "Remove"]
623
+ children: [/* @__PURE__ */ s(S, { className: "h-3 w-3" }), a("enrollment.remove")]
533
624
  })
534
625
  ]
535
626
  }, e.credentialId))
536
- }) : /* @__PURE__ */ o("div", {
627
+ }) : /* @__PURE__ */ s("div", {
537
628
  className: "text-[11px] text-foreground-subtle",
538
- children: "No passkeys enrolled yet."
629
+ children: a("enrollment.none")
539
630
  }),
540
- u.length > 0 && /* @__PURE__ */ s("div", {
631
+ f.length > 0 && /* @__PURE__ */ c("div", {
541
632
  className: "flex items-start justify-between gap-3 rounded-md border border-border px-3 py-2.5",
542
- children: [/* @__PURE__ */ s("div", {
633
+ children: [/* @__PURE__ */ c("div", {
543
634
  className: "min-w-0",
544
- children: [/* @__PURE__ */ o("div", {
635
+ children: [/* @__PURE__ */ s("div", {
545
636
  className: "text-xs font-medium text-foreground",
546
- children: "Require passkey as second factor"
547
- }), /* @__PURE__ */ o("div", {
637
+ children: a("enrollment.secondFactorTitle")
638
+ }), /* @__PURE__ */ s("div", {
548
639
  className: "text-[10px] text-foreground-subtle mt-0.5",
549
- children: "Also ask for a passkey after every password sign-in. Off by default — enrolling a passkey on its own only enables direct passkey sign-in."
640
+ children: a("enrollment.secondFactorHint")
550
641
  })]
551
- }), /* @__PURE__ */ o("button", {
642
+ }), /* @__PURE__ */ s("button", {
552
643
  type: "button",
553
644
  role: "switch",
554
- "aria-checked": C,
555
- "aria-label": "Require passkey as second factor",
556
- onClick: () => w.mutate(!C),
557
- disabled: S.isLoading || w.isPending,
558
- className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors disabled:opacity-50 ${C ? "bg-primary" : "bg-foreground-subtle/30"}`,
559
- children: /* @__PURE__ */ o("span", { className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${C ? "translate-x-[18px]" : "translate-x-[3px]"}` })
645
+ "aria-checked": T,
646
+ "aria-label": a("enrollment.secondFactorTitle"),
647
+ onClick: () => E.mutate(!T),
648
+ disabled: w.isLoading || E.isPending,
649
+ className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors disabled:opacity-50 ${T ? "bg-primary" : "bg-foreground-subtle/30"}`,
650
+ children: /* @__PURE__ */ s("span", { className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${T ? "translate-x-[18px]" : "translate-x-[3px]"}` })
560
651
  })]
561
652
  }),
562
- h && /* @__PURE__ */ s("div", {
653
+ _ && /* @__PURE__ */ c("div", {
563
654
  className: "text-[11px] text-danger flex items-center gap-1",
564
- children: [/* @__PURE__ */ o(_, { className: "h-3 w-3" }), h]
655
+ children: [/* @__PURE__ */ s(v, { className: "h-3 w-3" }), _]
565
656
  }),
566
- /* @__PURE__ */ s("div", {
657
+ /* @__PURE__ */ c("div", {
567
658
  className: "flex items-end gap-2",
568
- children: [/* @__PURE__ */ s("div", {
659
+ children: [/* @__PURE__ */ c("div", {
569
660
  className: "flex-1 space-y-1",
570
- children: [/* @__PURE__ */ o("label", {
661
+ children: [/* @__PURE__ */ s("label", {
571
662
  className: "text-[10px] uppercase tracking-wide text-foreground-subtle",
572
- children: "Passkey name"
573
- }), /* @__PURE__ */ o("input", {
663
+ children: a("enrollment.passkeyName")
664
+ }), /* @__PURE__ */ s("input", {
574
665
  type: "text",
575
- value: d,
576
- onChange: (e) => f(e.target.value),
577
- placeholder: "e.g. MacBook Touch ID",
666
+ value: p,
667
+ onChange: (e) => m(e.target.value),
668
+ placeholder: a("enrollment.namePlaceholder"),
578
669
  className: "w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary"
579
670
  })]
580
- }), /* @__PURE__ */ o("button", {
581
- onClick: T,
582
- disabled: p,
671
+ }), /* @__PURE__ */ s("button", {
672
+ onClick: D,
673
+ disabled: h,
583
674
  className: "inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-2 text-xs font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50",
584
- children: p ? /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ o(b, { className: "h-3.5 w-3.5 animate-spin" }), "Enrolling…"] }) : /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ o(v, { className: "h-3.5 w-3.5" }), "Add passkey"] })
675
+ children: h ? /* @__PURE__ */ c(l, { children: [/* @__PURE__ */ s(x, { className: "h-3.5 w-3.5 animate-spin" }), a("enrollment.enrolling")] }) : /* @__PURE__ */ c(l, { children: [/* @__PURE__ */ s(y, { className: "h-3.5 w-3.5" }), a("enrollment.addPasskey")] })
585
676
  })]
586
677
  })
587
678
  ]
@@ -590,7 +681,7 @@ function B(e) {
590
681
  }
591
682
  //#endregion
592
683
  //#region src/webauthn/widgets/PasskeyLogin.tsx
593
- function V(e) {
684
+ function G(e) {
594
685
  if (!e) return null;
595
686
  let t = e.challengeToken, n = e.onComplete, r = e.onError;
596
687
  return typeof t != "string" || typeof n != "function" ? null : {
@@ -599,65 +690,43 @@ function V(e) {
599
690
  onError: typeof r == "function" ? r : void 0
600
691
  };
601
692
  }
602
- function H(e) {
603
- let n = a(), r = V(e.config), [i, c] = t(!1), [l, u] = t(null);
604
- return r ? L() ? /* @__PURE__ */ s("div", {
693
+ function K(e) {
694
+ let n = o(), { t: r } = U(), i = G(e.config), [a, l] = t(!1), [u, d] = t(null);
695
+ return i ? R() ? /* @__PURE__ */ c("div", {
605
696
  className: "space-y-2",
606
- children: [/* @__PURE__ */ s("button", {
697
+ children: [/* @__PURE__ */ c("button", {
607
698
  type: "button",
608
699
  "data-testid": "login-passkey",
609
700
  onClick: async () => {
610
- u(null), c(!0);
701
+ d(null), l(!0);
611
702
  try {
612
- let e = await R((await n.loginBeginPasskey(r.challengeToken)).optionsJSON), t = await n.loginVerifyPasskey(r.challengeToken, e);
613
- r.onComplete(t.token);
703
+ let e = await V((await n.loginBeginPasskey(i.challengeToken)).optionsJSON), t = await n.loginVerifyPasskey(i.challengeToken, e);
704
+ i.onComplete(t.token);
614
705
  } catch (e) {
615
- let t = e instanceof Error ? e.message : "Passkey verification failed";
616
- u(t), r.onError?.(t);
706
+ let t = e instanceof Error ? e.message : r("login.verificationFailed");
707
+ d(t), i.onError?.(t);
617
708
  } finally {
618
- c(!1);
709
+ l(!1);
619
710
  }
620
711
  },
621
- disabled: i,
712
+ disabled: a,
622
713
  className: "w-full flex items-center justify-center gap-2 rounded-lg border border-border bg-background px-4 py-2.5 text-sm font-semibold text-foreground hover:bg-surface-hover disabled:opacity-50 transition-all",
623
- children: [i ? /* @__PURE__ */ o(b, { className: "h-4 w-4 animate-spin text-primary" }) : /* @__PURE__ */ o(v, { className: "h-4 w-4 text-primary" }), "Use a passkey"]
624
- }), l && /* @__PURE__ */ o("div", {
714
+ children: [a ? /* @__PURE__ */ s(x, { className: "h-4 w-4 animate-spin text-primary" }) : /* @__PURE__ */ s(y, { className: "h-4 w-4 text-primary" }), r("login.usePasskey")]
715
+ }), u && /* @__PURE__ */ s("div", {
625
716
  className: "rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger",
626
- children: l
717
+ children: u
627
718
  })]
628
- }) : /* @__PURE__ */ o("div", {
719
+ }) : /* @__PURE__ */ s("div", {
629
720
  className: "rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground-subtle",
630
- children: "This browser does not support passkeys."
631
- }) : /* @__PURE__ */ o("div", {
721
+ children: r("login.unsupported")
722
+ }) : /* @__PURE__ */ s("div", {
632
723
  className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
633
- children: "Passkey login widget requires a challengeToken + onComplete callback."
724
+ children: r("login.requiresChallenge")
634
725
  });
635
726
  }
636
727
  //#endregion
637
- //#region src/webauthn/widgets/direct-login-i18n.ts
638
- var U = {
639
- en: {
640
- signInWithPasskey: "Sign in with a passkey",
641
- unsupported: "This browser does not support passkeys.",
642
- failed: "Passkey sign-in failed",
643
- secondFactorRequired: "Additional verification is required — sign in with your password to continue."
644
- },
645
- it: {
646
- signInWithPasskey: "Accedi con una passkey",
647
- unsupported: "Questo browser non supporta le passkey.",
648
- failed: "Accesso con passkey non riuscito",
649
- secondFactorRequired: "È richiesta una verifica aggiuntiva — accedi con la password per continuare."
650
- }
651
- };
652
- function W(e) {
653
- return (e ?? globalThis.navigator?.language ?? "en").toLowerCase().split("-")[0] === "it" ? "it" : "en";
654
- }
655
- function G(e, t) {
656
- return U[e][t];
657
- }
658
- //#endregion
659
728
  //#region src/webauthn/widgets/PasskeyDirectLogin.tsx
660
- function K(e) {
729
+ function q(e) {
661
730
  if (!e) return null;
662
731
  let t = e.onComplete, n = e.onSecondFactor, r = e.onError, i = e.locale;
663
732
  return typeof t == "function" ? {
@@ -667,57 +736,57 @@ function K(e) {
667
736
  locale: typeof i == "string" ? i : void 0
668
737
  } : null;
669
738
  }
670
- function q(e) {
671
- let n = a(), r = K(e.config), [i, c] = t(!1), [l, u] = t(null), d = W(r?.locale);
672
- return r ? L() ? /* @__PURE__ */ s("div", {
739
+ function J(e) {
740
+ let n = o(), r = q(e.config), [i, a] = t(!1), [l, u] = t(null), { t: d } = U(r?.locale);
741
+ return r ? R() ? /* @__PURE__ */ c("div", {
673
742
  className: "space-y-2",
674
- children: [/* @__PURE__ */ s("button", {
743
+ children: [/* @__PURE__ */ c("button", {
675
744
  type: "button",
676
745
  "data-testid": "login-passkey-direct",
677
746
  onClick: async () => {
678
- u(null), c(!0);
747
+ u(null), a(!0);
679
748
  try {
680
- let e = await R((await n.passkeyLoginBegin()).optionsJSON), t = await n.passkeyLoginFinish(e), i = t.secondFactors ?? (t.requiresTotp === !0 ? ["totp"] : []);
749
+ let e = await V((await n.passkeyLoginBegin()).optionsJSON), t = await n.passkeyLoginFinish(e), i = t.secondFactors ?? (t.requiresTotp === !0 ? ["totp"] : []);
681
750
  if (i.length > 0) {
682
751
  if (r.onSecondFactor) r.onSecondFactor({
683
752
  challengeToken: t.token,
684
753
  factors: i
685
754
  });
686
755
  else {
687
- let e = G(d, "secondFactorRequired");
756
+ let e = d("directLogin.secondFactorRequired");
688
757
  u(e), r.onError?.(e);
689
758
  }
690
759
  return;
691
760
  }
692
761
  r.onComplete(t.token);
693
762
  } catch (e) {
694
- let t = e instanceof Error ? e.message : G(d, "failed");
763
+ let t = e instanceof Error ? e.message : d("directLogin.failed");
695
764
  u(t), r.onError?.(t);
696
765
  } finally {
697
- c(!1);
766
+ a(!1);
698
767
  }
699
768
  },
700
769
  disabled: i,
701
770
  className: "w-full flex items-center justify-center gap-2 rounded-lg border border-border bg-surface px-4 py-2.5 text-sm font-medium text-foreground hover:bg-surface-hover disabled:opacity-50 transition-colors",
702
- children: [i ? /* @__PURE__ */ o(b, { className: "h-4 w-4 animate-spin text-primary" }) : /* @__PURE__ */ o(v, { className: "h-4 w-4 text-primary" }), G(d, "signInWithPasskey")]
703
- }), l && /* @__PURE__ */ o("div", {
771
+ children: [i ? /* @__PURE__ */ s(x, { className: "h-4 w-4 animate-spin text-primary" }) : /* @__PURE__ */ s(y, { className: "h-4 w-4 text-primary" }), d("directLogin.signInWithPasskey")]
772
+ }), l && /* @__PURE__ */ s("div", {
704
773
  className: "rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger",
705
774
  children: l
706
775
  })]
707
- }) : /* @__PURE__ */ o("div", {
776
+ }) : /* @__PURE__ */ s("div", {
708
777
  className: "rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground-subtle",
709
- children: G(d, "unsupported")
710
- }) : /* @__PURE__ */ o("div", {
778
+ children: d("directLogin.unsupported")
779
+ }) : /* @__PURE__ */ s("div", {
711
780
  className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
712
- children: "Passkey direct-login widget requires an onComplete callback."
781
+ children: d("directLogin.requiresCallback")
713
782
  });
714
783
  }
715
784
  //#endregion
716
785
  //#region src/webauthn/widgets/index.tsx
717
- var J = {
718
- "passkey-enrollment": B,
719
- "passkey-login": H,
720
- "passkey-direct-login": q
786
+ var Y = {
787
+ "passkey-enrollment": W,
788
+ "passkey-login": K,
789
+ "passkey-direct-login": J
721
790
  };
722
791
  //#endregion
723
- export { J as default };
792
+ export { Y as default };