@getauthui/core 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { state as d, property as g, customElement as T, query as st } from "lit/decorators.js";
2
- import { css as O, LitElement as rt, nothing as n, html as r, svg as h } from "lit";
3
- import { Client as lt, Account as ct, Teams as xt, ID as B, Avatars as kt } from "appwrite";
4
- const Ct = {
1
+ import { state as d, property as m, customElement as T, query as rt } from "lit/decorators.js";
2
+ import { css as L, LitElement as at, nothing as n, html as r, svg as h } from "lit";
3
+ import { Client as lt, Account as ct, Teams as kt, ID as W, Avatars as Ct } from "appwrite";
4
+ const St = {
5
5
  signIn: "Sign in",
6
6
  dialogSignIn: "Sign in",
7
7
  signUp: "Sign up",
@@ -171,15 +171,17 @@ const Ct = {
171
171
  lastActive: "Last active",
172
172
  guestAccount: "Guest account",
173
173
  guestAccountDescription: "Add an email and password to keep your data.",
174
- preview: "Preview"
174
+ preview: "Preview",
175
+ acceptLegal: "I agree to the",
176
+ errorLegalRequired: "Accept the terms to continue."
175
177
  };
176
- function St(e, t = {}) {
178
+ function At(e, t = {}) {
177
179
  return e.replace(
178
180
  /\{(\w+)\}/g,
179
181
  (i, s) => s in t ? String(t[s]) : `{${s}}`
180
182
  );
181
183
  }
182
- const At = {
184
+ const Pt = {
183
185
  amazon: "Amazon",
184
186
  apple: "Apple",
185
187
  appwrite: "Appwrite",
@@ -230,10 +232,10 @@ const At = {
230
232
  zoho: "Zoho",
231
233
  zoom: "Zoom"
232
234
  };
233
- function W(e) {
234
- return At[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
235
+ function N(e) {
236
+ return Pt[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
235
237
  }
236
- const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), A = () => (/* @__PURE__ */ new Date()).toISOString(), U = (e) => new Date(Date.now() - e * 6e4).toISOString(), j = [
238
+ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(), G = [
237
239
  "amber",
238
240
  "brave",
239
241
  "calm",
@@ -246,13 +248,13 @@ const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
246
248
  "juniper",
247
249
  "kite",
248
250
  "lumen"
249
- ], dt = () => `${j[Math.floor(Math.random() * j.length)]}-${j[Math.floor(Math.random() * j.length)]}`, D = () => Math.random().toString(36).slice(2, 12), ht = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), Pt = {
251
+ ], dt = () => `${G[Math.floor(Math.random() * G.length)]}-${G[Math.floor(Math.random() * G.length)]}`, z = () => Math.random().toString(36).slice(2, 12), ut = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), It = {
250
252
  name: "Ada Lovelace",
251
253
  email: "ada@example.com",
252
254
  phone: "+15550100"
253
255
  };
254
- class It {
255
- constructor(t = Pt) {
256
+ class Ut {
257
+ constructor(t = It) {
256
258
  this.seed = t, this.user = null, this.mfaPending = !1, this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], this.lastChallenge = 0, this.sessions = [], this.identities = [], this.logs = [], this.tokens = /* @__PURE__ */ new Map(), this.pendingAuthenticator = null;
257
259
  }
258
260
  // ───────────────────────── helpers ─────────────────────────
@@ -260,13 +262,13 @@ class It {
260
262
  const i = t.anonymous ?? !1;
261
263
  return this.user = {
262
264
  $id: "preview-user",
263
- $createdAt: U(1440 * 30),
264
- $updatedAt: A(),
265
+ $createdAt: M(1440 * 30),
266
+ $updatedAt: P(),
265
267
  name: i ? "" : t.name ?? this.seed.name,
266
- registration: U(1440 * 30),
268
+ registration: M(1440 * 30),
267
269
  status: !0,
268
270
  labels: [],
269
- passwordUpdate: i ? "" : U(1440 * 7),
271
+ passwordUpdate: i ? "" : M(1440 * 7),
270
272
  email: i ? "" : t.email ?? this.seed.email,
271
273
  phone: i ? "" : t.phone ?? this.seed.phone,
272
274
  emailVerification: !i,
@@ -274,14 +276,14 @@ class It {
274
276
  mfa: this.mfaEnabled,
275
277
  prefs: {},
276
278
  targets: [],
277
- accessedAt: A()
279
+ accessedAt: P()
278
280
  }, this.seedActivity(i ? "anonymous" : "email"), this.user;
279
281
  }
280
282
  seedActivity(t) {
281
283
  if (this.sessions.length > 0) return;
282
284
  const i = {
283
- $createdAt: A(),
284
- $updatedAt: A(),
285
+ $createdAt: P(),
286
+ $updatedAt: P(),
285
287
  userId: "preview-user",
286
288
  expire: new Date(Date.now() + 365 * 864e5).toISOString(),
287
289
  providerUid: "",
@@ -316,8 +318,8 @@ class It {
316
318
  },
317
319
  {
318
320
  ...i,
319
- $id: D(),
320
- $createdAt: U(300),
321
+ $id: z(),
322
+ $createdAt: M(300),
321
323
  provider: t,
322
324
  ip: "198.51.100.7",
323
325
  osCode: "IOS",
@@ -333,8 +335,8 @@ class It {
333
335
  },
334
336
  {
335
337
  ...i,
336
- $id: D(),
337
- $createdAt: U(1440 * 3),
338
+ $id: z(),
339
+ $createdAt: M(1440 * 3),
338
340
  provider: "oauth2",
339
341
  ip: "192.0.2.90",
340
342
  osCode: "WIN",
@@ -349,8 +351,8 @@ class It {
349
351
  ], this.identities = [
350
352
  {
351
353
  $id: "identity-github",
352
- $createdAt: U(1440 * 20),
353
- $updatedAt: U(1440 * 20),
354
+ $createdAt: M(1440 * 20),
355
+ $updatedAt: M(1440 * 20),
354
356
  userId: "preview-user",
355
357
  provider: "github",
356
358
  providerUid: "8675309",
@@ -362,7 +364,7 @@ class It {
362
364
  ], this.logs = [
363
365
  {
364
366
  event: "session.create",
365
- time: A(),
367
+ time: P(),
366
368
  clientName: "Chrome",
367
369
  osName: "macOS",
368
370
  countryName: "Germany",
@@ -370,7 +372,7 @@ class It {
370
372
  },
371
373
  {
372
374
  event: "user.update.name",
373
- time: U(1440 * 2),
375
+ time: M(1440 * 2),
374
376
  clientName: "Safari",
375
377
  osName: "iOS",
376
378
  countryName: "Germany",
@@ -378,7 +380,7 @@ class It {
378
380
  },
379
381
  {
380
382
  event: "session.create",
381
- time: U(1440 * 3),
383
+ time: M(1440 * 3),
382
384
  clientName: "Firefox",
383
385
  osName: "Windows",
384
386
  countryName: "United States",
@@ -388,9 +390,9 @@ class It {
388
390
  }
389
391
  requireUser() {
390
392
  if (!this.user)
391
- throw H("general_unauthorized_scope", "User (role: guests) missing scope (account)");
393
+ throw K("general_unauthorized_scope", "User (role: guests) missing scope (account)");
392
394
  if (this.mfaPending)
393
- throw H(
395
+ throw K(
394
396
  "user_more_factors_required",
395
397
  "More factors are required to complete the sign in process."
396
398
  );
@@ -398,7 +400,7 @@ class It {
398
400
  }
399
401
  requireRecentChallenge() {
400
402
  if (Date.now() - this.lastChallenge > 30 * 6e4)
401
- throw H(
403
+ throw K(
402
404
  "user_challenge_required",
403
405
  "A recently successful challenge is required to complete this action."
404
406
  );
@@ -434,8 +436,8 @@ class It {
434
436
  }
435
437
  async createMagicURLToken(t, i) {
436
438
  return this.tokens.set(t, { email: i }), this.delay({
437
- $id: D(),
438
- $createdAt: A(),
439
+ $id: z(),
440
+ $createdAt: P(),
439
441
  userId: t,
440
442
  secret: "",
441
443
  expire: "",
@@ -444,8 +446,8 @@ class It {
444
446
  }
445
447
  async createEmailToken(t, i) {
446
448
  return this.tokens.set(t, { email: i }), this.delay({
447
- $id: D(),
448
- $createdAt: A(),
449
+ $id: z(),
450
+ $createdAt: P(),
449
451
  userId: t,
450
452
  secret: "",
451
453
  expire: "",
@@ -453,7 +455,7 @@ class It {
453
455
  });
454
456
  }
455
457
  async createPhoneToken(t, i) {
456
- return this.tokens.set(t, { phone: i }), this.delay({ $id: D(), $createdAt: A(), userId: t, secret: "", expire: "", phrase: "" });
458
+ return this.tokens.set(t, { phone: i }), this.delay({ $id: z(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
457
459
  }
458
460
  async createSession(t) {
459
461
  return this.delay(() => {
@@ -494,7 +496,7 @@ class It {
494
496
  async updateEmail(t) {
495
497
  return this.delay(() => {
496
498
  const i = this.requireUser();
497
- return i.email = t, i.emailVerification = !1, i.passwordUpdate = A(), i;
499
+ return i.email = t, i.emailVerification = !1, i.passwordUpdate = P(), i;
498
500
  });
499
501
  }
500
502
  async updatePhone(t) {
@@ -506,7 +508,7 @@ class It {
506
508
  async updatePassword() {
507
509
  return this.delay(() => {
508
510
  const t = this.requireUser();
509
- return t.passwordUpdate = A(), t;
511
+ return t.passwordUpdate = P(), t;
510
512
  });
511
513
  }
512
514
  async updateStatus() {
@@ -545,7 +547,7 @@ class It {
545
547
  });
546
548
  }
547
549
  async createMFAChallenge() {
548
- return this.delay({ $id: D(), $createdAt: A(), userId: "preview-user", expire: "" });
550
+ return this.delay({ $id: z(), $createdAt: P(), userId: "preview-user", expire: "" });
549
551
  }
550
552
  async updateMFAChallenge() {
551
553
  return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
@@ -574,15 +576,15 @@ class It {
574
576
  async createMFARecoveryCodes() {
575
577
  return this.delay(() => {
576
578
  if (this.recoveryCodes.length > 0)
577
- throw H("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
578
- return this.recoveryCodes = Array.from({ length: 6 }, ht), { recoveryCodes: this.recoveryCodes };
579
+ throw K("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
580
+ return this.recoveryCodes = Array.from({ length: 6 }, ut), { recoveryCodes: this.recoveryCodes };
579
581
  });
580
582
  }
581
583
  async getMFARecoveryCodes() {
582
584
  return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
583
585
  }
584
586
  async updateMFARecoveryCodes() {
585
- return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, ht), { recoveryCodes: this.recoveryCodes }));
587
+ return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, ut), { recoveryCodes: this.recoveryCodes }));
586
588
  }
587
589
  /** Forget everything, as a sign out would. */
588
590
  reset() {
@@ -592,17 +594,17 @@ class It {
592
594
  function Et(e) {
593
595
  let t = 2166136261;
594
596
  const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
595
- for (const b of e) t = (t ^ b.charCodeAt(0)) * 16777619;
597
+ for (const v of e) t = (t ^ v.charCodeAt(0)) * 16777619;
596
598
  const s = 25;
597
599
  let a = "";
598
- const c = (b, $) => `<rect x="${b}" y="${$}" width="7" height="7"/><rect x="${b + 1}" y="${$ + 1}" width="5" height="5" fill="#fff"/><rect x="${b + 2}" y="${$ + 2}" width="3" height="3"/>`;
599
- for (let b = 0; b < s; b++)
600
- for (let $ = 0; $ < s; $++)
601
- !($ < 8 && b < 8 || $ >= s - 8 && b < 8 || $ < 8 && b >= s - 8) && i() < 0.45 && (a += `<rect x="${$}" y="${b}" width="1" height="1"/>`);
602
- const u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${c(0, 0)}${c(s - 7, 0)}${c(0, s - 7)}${a}</g></svg>`;
603
- return `data:image/svg+xml;utf8,${encodeURIComponent(u)}`;
600
+ const u = (v, y) => `<rect x="${v}" y="${y}" width="7" height="7"/><rect x="${v + 1}" y="${y + 1}" width="5" height="5" fill="#fff"/><rect x="${v + 2}" y="${y + 2}" width="3" height="3"/>`;
601
+ for (let v = 0; v < s; v++)
602
+ for (let y = 0; y < s; y++)
603
+ !(y < 8 && v < 8 || y >= s - 8 && v < 8 || y < 8 && v >= s - 8) && i() < 0.45 && (a += `<rect x="${y}" y="${v}" width="1" height="1"/>`);
604
+ const c = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${u(0, 0)}${u(s - 7, 0)}${u(0, s - 7)}${a}</g></svg>`;
605
+ return `data:image/svg+xml;utf8,${encodeURIComponent(c)}`;
604
606
  }
605
- const f = {
607
+ const g = {
606
608
  moreFactorsRequired: "user_more_factors_required",
607
609
  invalidCredentials: "user_invalid_credentials",
608
610
  userAlreadyExists: "user_already_exists",
@@ -649,123 +651,123 @@ function _(e) {
649
651
  }
650
652
  return { message: String(e), type: "", code: 0 };
651
653
  }
652
- function q(e, t) {
654
+ function j(e, t) {
653
655
  return _(e).type === t;
654
656
  }
655
- function K(e, t, i = "link") {
657
+ function Y(e, t, i = "link") {
656
658
  const s = _(e);
657
659
  switch (s.type) {
658
- case f.invalidCredentials:
660
+ case g.invalidCredentials:
659
661
  return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
660
- case f.userAlreadyExists:
661
- case f.emailAlreadyExists:
662
- case f.phoneAlreadyExists:
662
+ case g.userAlreadyExists:
663
+ case g.emailAlreadyExists:
664
+ case g.phoneAlreadyExists:
663
665
  return t.errorUserExists;
664
- case f.userBlocked:
666
+ case g.userBlocked:
665
667
  return t.errorUserBlocked;
666
- case f.rateLimit:
668
+ case g.rateLimit:
667
669
  return t.errorRateLimit;
668
- case f.invalidToken:
670
+ case g.invalidToken:
669
671
  return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
670
- case f.invalidCode:
672
+ case g.invalidCode:
671
673
  return t.errorInvalidCode;
672
- case f.passwordMismatch:
674
+ case g.passwordMismatch:
673
675
  return t.errorPasswordMismatch;
674
- case f.passwordRecentlyUsed:
676
+ case g.passwordRecentlyUsed:
675
677
  return t.errorPasswordRecentlyUsed;
676
- case f.passwordPersonalData:
678
+ case g.passwordPersonalData:
677
679
  return t.errorPasswordPersonalData;
678
- case f.passwordWeak:
680
+ case g.passwordWeak:
679
681
  return t.errorPasswordWeak;
680
- case f.passwordPwned:
682
+ case g.passwordPwned:
681
683
  return t.errorPasswordPwned;
682
- case f.challengeRequired:
684
+ case g.challengeRequired:
683
685
  return t.errorChallengeRequired;
684
- case f.sessionAlreadyExists:
686
+ case g.sessionAlreadyExists:
685
687
  return t.errorSessionExists;
686
- case f.oauthUnauthorized:
687
- case f.oauthBadRequest:
688
+ case g.oauthUnauthorized:
689
+ case g.oauthBadRequest:
688
690
  return t.errorOAuth;
689
- case f.authMethodUnsupported:
691
+ case g.authMethodUnsupported:
690
692
  return t.errorMethodDisabled;
691
693
  }
692
- if (s.type === f.argumentInvalid || /Invalid `\w+` param/i.test(s.message)) {
694
+ if (s.type === g.argumentInvalid || /Invalid `\w+` param/i.test(s.message)) {
693
695
  const a = s.message.match(/Invalid `([^`]+)` param/i)?.[1]?.toLowerCase();
694
696
  return a === "email" ? t.errorInvalidEmail : a === "password" ? t.errorInvalidPassword : a === "phone" ? t.errorInvalidPhone : a === "name" ? t.errorInvalidName : t.errorGeneric;
695
697
  }
696
- return s.type === f.projectNotFound || s.type === f.unknownOrigin ? t.errorConfig : s.type === f.routeNotFound ? t.errorConfigEndpoint : s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message) ? t.errorGeneric : s.message ? s.message || t.errorGeneric : s.code === 404 || s.type === f.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
698
+ return s.type === g.projectNotFound || s.type === g.unknownOrigin ? t.errorConfig : s.type === g.routeNotFound ? t.errorConfigEndpoint : s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message) ? t.errorGeneric : s.message ? s.message || t.errorGeneric : s.code === 404 || s.type === g.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
697
699
  }
698
- function Ut(e) {
700
+ function Mt(e) {
699
701
  const t = _(e);
700
- return !!(t.type === f.projectNotFound || t.type === f.unknownOrigin || t.type === f.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
702
+ return !!(t.type === g.projectNotFound || t.type === g.unknownOrigin || t.type === g.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
701
703
  }
702
- const J = (e) => `authui:active-team:${e}`;
703
- function ut(e) {
704
+ const tt = (e) => `authui:active-team:${e}`;
705
+ function ht(e) {
704
706
  if (typeof localStorage > "u" || !e) return null;
705
707
  try {
706
- return localStorage.getItem(J(e));
708
+ return localStorage.getItem(tt(e));
707
709
  } catch {
708
710
  return null;
709
711
  }
710
712
  }
711
- function Mt(e, t) {
713
+ function Ot(e, t) {
712
714
  if (!(typeof localStorage > "u" || !e))
713
715
  try {
714
- t ? localStorage.setItem(J(e), t) : localStorage.removeItem(J(e));
716
+ t ? localStorage.setItem(tt(e), t) : localStorage.removeItem(tt(e));
715
717
  } catch {
716
718
  }
717
719
  }
718
- const at = "authui:last-method";
720
+ const nt = "authui:last-method";
719
721
  function V(e) {
720
722
  if (!(typeof localStorage > "u")) {
721
723
  if (!e || e === "mfa" || e === "sign-up")
722
724
  if (e === "sign-up") e = "email-password";
723
725
  else return;
724
726
  try {
725
- localStorage.setItem(at, e);
727
+ localStorage.setItem(nt, e);
726
728
  } catch {
727
729
  }
728
730
  }
729
731
  }
730
- function z() {
732
+ function D() {
731
733
  if (typeof localStorage > "u") return null;
732
734
  try {
733
- return localStorage.getItem(at);
735
+ return localStorage.getItem(nt);
734
736
  } catch {
735
737
  return null;
736
738
  }
737
739
  }
738
- function oe() {
740
+ function le() {
739
741
  if (!(typeof localStorage > "u"))
740
742
  try {
741
- localStorage.removeItem(at);
743
+ localStorage.removeItem(nt);
742
744
  } catch {
743
745
  }
744
746
  }
745
- const G = "authui:pending-oauth";
746
- function Ot(e) {
747
+ const Z = "authui:pending-oauth";
748
+ function Ft(e) {
747
749
  if (!(typeof sessionStorage > "u"))
748
750
  try {
749
- sessionStorage.setItem(G, e);
751
+ sessionStorage.setItem(Z, e);
750
752
  } catch {
751
753
  }
752
754
  }
753
755
  function wt() {
754
756
  if (!(typeof sessionStorage > "u"))
755
757
  try {
756
- const e = sessionStorage.getItem(G);
757
- sessionStorage.removeItem(G), e && V(`oauth:${e}`);
758
+ const e = sessionStorage.getItem(Z);
759
+ sessionStorage.removeItem(Z), e && V(`oauth:${e}`);
758
760
  } catch {
759
761
  }
760
762
  }
761
763
  function pt() {
762
764
  if (!(typeof sessionStorage > "u"))
763
765
  try {
764
- sessionStorage.removeItem(G);
766
+ sessionStorage.removeItem(Z);
765
767
  } catch {
766
768
  }
767
769
  }
768
- function S(e, t, i) {
770
+ function A(e, t, i) {
769
771
  for (const s of t) {
770
772
  const a = e[s];
771
773
  if (typeof a == "function")
@@ -775,7 +777,7 @@ function S(e, t, i) {
775
777
  new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
776
778
  );
777
779
  }
778
- const tt = "authui", mt = ["userId", "secret", "expire", "project", "error", tt], ft = () => ({
780
+ const et = "authui", mt = ["userId", "secret", "expire", "project", "error", et], ft = () => ({
779
781
  status: "loading",
780
782
  user: null,
781
783
  mfaFactors: null,
@@ -783,7 +785,7 @@ const tt = "authui", mt = ["userId", "secret", "expire", "project", "error", tt]
783
785
  configured: !1,
784
786
  configError: null
785
787
  });
786
- class Ft {
788
+ class Lt {
787
789
  constructor() {
788
790
  this.client = null, this.account = null, this.config = null, this.state = ft(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
789
791
  }
@@ -793,7 +795,7 @@ class Ft {
793
795
  const i = t.endpoint.trim().replace(/\/+$/, "");
794
796
  i && !i.endsWith("/v1") && console.warn(
795
797
  `[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
796
- ), this.config = t, this.client = new lt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new It() : null, this.account = this.preview ? this.preview : new ct(this.client), this.teams = null, this.activeTeamId = ut(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
798
+ ), this.config = t, this.client = new lt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Ut() : null, this.account = this.preview ? this.preview : new ct(this.client), this.teams = null, this.activeTeamId = ht(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
797
799
  }
798
800
  /**
799
801
  * Called by <authui-config> when it is on the page but missing endpoint or project.
@@ -839,7 +841,7 @@ class Ft {
839
841
  /** List teams the signed-in user belongs to. Empty in preview or when signed out. */
840
842
  async listTeams() {
841
843
  if (this.preview || !this.client || this.state.status !== "signed-in") return [];
842
- this.teams ??= new xt(this.client);
844
+ this.teams ??= new kt(this.client);
843
845
  try {
844
846
  return (await this.teams.list()).teams ?? [];
845
847
  } catch (t) {
@@ -849,7 +851,7 @@ class Ft {
849
851
  getActiveTeamId() {
850
852
  if (this.activeTeamId) return this.activeTeamId;
851
853
  const t = this.config?.project;
852
- return t ? (this.activeTeamId = ut(t), this.activeTeamId) : null;
854
+ return t ? (this.activeTeamId = ht(t), this.activeTeamId) : null;
853
855
  }
854
856
  /**
855
857
  * Remember the active team locally and emit `active-team`.
@@ -857,10 +859,10 @@ class Ft {
857
859
  */
858
860
  setActiveTeam(t) {
859
861
  const i = this.config?.project;
860
- i && Mt(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
862
+ i && Ot(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
861
863
  }
862
864
  getStrings() {
863
- return { ...Ct, ...this.config?.strings ?? {} };
865
+ return { ...St, ...this.config?.strings ?? {} };
864
866
  }
865
867
  getState() {
866
868
  return { ...this.state };
@@ -906,10 +908,10 @@ class Ft {
906
908
  const i = await this.account.get();
907
909
  this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
908
910
  } catch (i) {
909
- if (q(i, f.moreFactorsRequired)) {
911
+ if (j(i, g.moreFactorsRequired)) {
910
912
  let s = null;
911
913
  try {
912
- s = await S(
914
+ s = await A(
913
915
  this.account,
914
916
  ["listMFAFactors", "listMfaFactors"],
915
917
  []
@@ -917,7 +919,7 @@ class Ft {
917
919
  } catch {
918
920
  }
919
921
  this.setState({ status: "mfa-required", user: null, mfaFactors: s });
920
- } else if (q(i, f.userBlocked))
922
+ } else if (j(i, g.userBlocked))
921
923
  await this.purgeLocalSession(), this.setState({
922
924
  status: "signed-out",
923
925
  user: null,
@@ -928,13 +930,13 @@ class Ft {
928
930
  message: this.getStrings().errorUserBlocked
929
931
  }
930
932
  }), t && this.emit("signed-out", void 0);
931
- else if (!t && Ut(i)) {
932
- const a = K(i, this.getStrings()) || this.getStrings().errorConfig;
933
+ else if (!t && Mt(i)) {
934
+ const a = Y(i, this.getStrings()) || this.getStrings().errorConfig;
933
935
  console.warn(
934
936
  `[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
935
937
  );
936
- const c = _(i);
937
- this.emit("error", { message: a, type: c.type, code: c.code }), this.setState({
938
+ const u = _(i);
939
+ this.emit("error", { message: a, type: u.type, code: u.code }), this.setState({
938
940
  status: "signed-out",
939
941
  user: null,
940
942
  mfaFactors: null,
@@ -953,7 +955,7 @@ class Ft {
953
955
  const i = this.state.pending;
954
956
  if (i?.type === "notice" && i.tone === "error")
955
957
  throw Object.assign(new Error(i.message), {
956
- type: f.userBlocked,
958
+ type: g.userBlocked,
957
959
  code: 401
958
960
  });
959
961
  }
@@ -991,7 +993,7 @@ class Ft {
991
993
  }
992
994
  async signUp(t, i, s) {
993
995
  try {
994
- await this.acct().create(B.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
996
+ await this.acct().create(W.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
995
997
  } catch (a) {
996
998
  this.fail(a);
997
999
  }
@@ -1034,7 +1036,7 @@ class Ft {
1034
1036
  async sendMagicUrl(t) {
1035
1037
  try {
1036
1038
  return await this.acct().createMagicURLToken(
1037
- B.unique(),
1039
+ W.unique(),
1038
1040
  t.trim(),
1039
1041
  this.redirectUrl("magic-url"),
1040
1042
  this.config?.securityPhrase ?? !0
@@ -1046,7 +1048,7 @@ class Ft {
1046
1048
  async sendEmailOtp(t) {
1047
1049
  try {
1048
1050
  return await this.acct().createEmailToken(
1049
- B.unique(),
1051
+ W.unique(),
1050
1052
  t.trim(),
1051
1053
  this.config?.securityPhrase ?? !0
1052
1054
  );
@@ -1056,7 +1058,7 @@ class Ft {
1056
1058
  }
1057
1059
  async sendPhoneOtp(t) {
1058
1060
  try {
1059
- return await this.acct().createPhoneToken(B.unique(), t.replace(/[\s()-]/g, ""));
1061
+ return await this.acct().createPhoneToken(W.unique(), t.replace(/[\s()-]/g, ""));
1060
1062
  } catch (i) {
1061
1063
  return this.fail(i);
1062
1064
  }
@@ -1073,7 +1075,7 @@ class Ft {
1073
1075
  // ─────────────────────────────── MFA ───────────────────────────────
1074
1076
  async createMfaChallenge(t) {
1075
1077
  try {
1076
- return await S(
1078
+ return await A(
1077
1079
  this.acct(),
1078
1080
  ["createMFAChallenge", "createMfaChallenge"],
1079
1081
  [t]
@@ -1085,7 +1087,7 @@ class Ft {
1085
1087
  /** Verify a challenge. Completes a pending sign in, or acts as a step-up for protected actions. */
1086
1088
  async completeMfaChallenge(t, i, s = {}) {
1087
1089
  try {
1088
- await S(
1090
+ await A(
1089
1091
  this.acct(),
1090
1092
  ["updateMFAChallenge", "updateMfaChallenge"],
1091
1093
  [t, i.trim()]
@@ -1097,7 +1099,7 @@ class Ft {
1097
1099
  }
1098
1100
  async listMfaFactors() {
1099
1101
  try {
1100
- return await S(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
1102
+ return await A(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
1101
1103
  } catch (t) {
1102
1104
  return this.fail(t);
1103
1105
  }
@@ -1112,7 +1114,7 @@ class Ft {
1112
1114
  }
1113
1115
  async addAuthenticator() {
1114
1116
  try {
1115
- return await S(
1117
+ return await A(
1116
1118
  this.acct(),
1117
1119
  ["createMFAAuthenticator", "createMfaAuthenticator"],
1118
1120
  ["totp"]
@@ -1123,7 +1125,7 @@ class Ft {
1123
1125
  }
1124
1126
  async verifyAuthenticator(t) {
1125
1127
  try {
1126
- await S(
1128
+ await A(
1127
1129
  this.acct(),
1128
1130
  ["updateMFAAuthenticator", "updateMfaAuthenticator"],
1129
1131
  ["totp", t.trim()]
@@ -1136,7 +1138,7 @@ class Ft {
1136
1138
  /** Requires a recent MFA challenge (server rejects with user_challenge_required otherwise). */
1137
1139
  async removeAuthenticator() {
1138
1140
  try {
1139
- await S(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
1141
+ await A(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
1140
1142
  } catch (t) {
1141
1143
  this.fail(t);
1142
1144
  }
@@ -1144,7 +1146,7 @@ class Ft {
1144
1146
  }
1145
1147
  async createRecoveryCodes() {
1146
1148
  try {
1147
- return (await S(
1149
+ return (await A(
1148
1150
  this.acct(),
1149
1151
  ["createMFARecoveryCodes", "createMfaRecoveryCodes"],
1150
1152
  []
@@ -1156,7 +1158,7 @@ class Ft {
1156
1158
  /** Requires a recent MFA challenge. */
1157
1159
  async regenerateRecoveryCodes() {
1158
1160
  try {
1159
- return (await S(
1161
+ return (await A(
1160
1162
  this.acct(),
1161
1163
  ["updateMFARecoveryCodes", "updateMfaRecoveryCodes"],
1162
1164
  []
@@ -1168,7 +1170,7 @@ class Ft {
1168
1170
  /** Requires a recent MFA challenge. */
1169
1171
  async getRecoveryCodes() {
1170
1172
  try {
1171
- return (await S(
1173
+ return (await A(
1172
1174
  this.acct(),
1173
1175
  ["getMFARecoveryCodes", "getMfaRecoveryCodes"],
1174
1176
  []
@@ -1290,7 +1292,7 @@ class Ft {
1290
1292
  }
1291
1293
  async sendEmailVerification() {
1292
1294
  try {
1293
- await S(
1295
+ await A(
1294
1296
  this.acct(),
1295
1297
  ["createEmailVerification", "createVerification"],
1296
1298
  [this.redirectUrl("verify-email")]
@@ -1331,7 +1333,7 @@ class Ft {
1331
1333
  redirectUrl(t) {
1332
1334
  const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
1333
1335
  for (const a of mt) s.searchParams.delete(a);
1334
- return s.searchParams.set(tt, t), s.toString();
1336
+ return s.searchParams.set(et, t), s.toString();
1335
1337
  }
1336
1338
  setPending(t) {
1337
1339
  this.setState({ pending: t });
@@ -1342,11 +1344,11 @@ class Ft {
1342
1344
  */
1343
1345
  async handleRedirect() {
1344
1346
  if (typeof window > "u") return !1;
1345
- const t = new URLSearchParams(window.location.search), i = t.get(tt);
1347
+ const t = new URLSearchParams(window.location.search), i = t.get(et);
1346
1348
  if (!i) return !1;
1347
1349
  const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
1348
1350
  this.cleanUrl();
1349
- const c = () => {
1351
+ const u = () => {
1350
1352
  this.setState({
1351
1353
  pending: {
1352
1354
  type: "notice",
@@ -1359,7 +1361,7 @@ class Ft {
1359
1361
  switch (i) {
1360
1362
  case "oauth":
1361
1363
  case "magic-url":
1362
- s && a ? (await this.acct().createSession(s, a), i === "oauth" && wt()) : (i === "oauth" && pt(), c());
1364
+ s && a ? (await this.acct().createSession(s, a), i === "oauth" && wt()) : (i === "oauth" && pt(), u());
1363
1365
  break;
1364
1366
  case "oauth-failed":
1365
1367
  pt(), this.setState({
@@ -1371,10 +1373,10 @@ class Ft {
1371
1373
  });
1372
1374
  break;
1373
1375
  case "recovery":
1374
- s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : c();
1376
+ s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : u();
1375
1377
  break;
1376
1378
  case "verify-email":
1377
- s && a ? (await S(
1379
+ s && a ? (await A(
1378
1380
  this.acct(),
1379
1381
  ["updateEmailVerification", "updateVerification"],
1380
1382
  [s, a]
@@ -1384,12 +1386,12 @@ class Ft {
1384
1386
  message: this.getStrings().emailVerified,
1385
1387
  tone: "success"
1386
1388
  }
1387
- })) : c();
1389
+ })) : u();
1388
1390
  break;
1389
1391
  }
1390
- } catch (u) {
1391
- const b = _(u), $ = K(u, this.getStrings(), "link");
1392
- this.emit("error", b), this.setState({ pending: { type: "notice", message: $, tone: "error" } });
1392
+ } catch (c) {
1393
+ const v = _(c), y = Y(c, this.getStrings(), "link");
1394
+ this.emit("error", v), this.setState({ pending: { type: "notice", message: y, tone: "error" } });
1393
1395
  }
1394
1396
  return !0;
1395
1397
  }
@@ -1403,7 +1405,7 @@ class Ft {
1403
1405
  this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = ft(), this.listeners.clear();
1404
1406
  }
1405
1407
  }
1406
- const o = new Ft();
1408
+ const o = new Lt();
1407
1409
  class Rt {
1408
1410
  constructor() {
1409
1411
  this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
@@ -1439,7 +1441,7 @@ const gt = new Rt(), vt = {
1439
1441
  lg: "0.875rem",
1440
1442
  xl: "1.125rem",
1441
1443
  full: "1.5rem"
1442
- }, Tt = O`
1444
+ }, Tt = L`
1443
1445
  :host {
1444
1446
  /* Light theme (matches :root in the console) */
1445
1447
  --authui-background: oklch(1 0 0);
@@ -1517,7 +1519,7 @@ const gt = new Rt(), vt = {
1517
1519
  --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
1518
1520
  color-scheme: dark;
1519
1521
  }
1520
- `, Dt = O`
1522
+ `, zt = L`
1521
1523
  *,
1522
1524
  *::before,
1523
1525
  *::after {
@@ -2209,6 +2211,34 @@ const gt = new Rt(), vt = {
2209
2211
  .legal a:hover {
2210
2212
  color: var(--authui-foreground);
2211
2213
  }
2214
+ .legal-accept {
2215
+ display: flex;
2216
+ align-items: flex-start;
2217
+ gap: 10px;
2218
+ font-size: 12px;
2219
+ color: var(--authui-muted-foreground);
2220
+ line-height: 1.5;
2221
+ text-align: start;
2222
+ cursor: pointer;
2223
+ user-select: none;
2224
+ }
2225
+ .legal-accept input {
2226
+ margin-top: 2px;
2227
+ width: 16px;
2228
+ height: 16px;
2229
+ flex-shrink: 0;
2230
+ accent-color: var(--authui-brand);
2231
+ cursor: pointer;
2232
+ }
2233
+ .legal-accept a {
2234
+ color: inherit;
2235
+ text-decoration: underline;
2236
+ text-decoration-style: dotted;
2237
+ text-underline-offset: 3px;
2238
+ }
2239
+ .legal-accept a:hover {
2240
+ color: var(--authui-foreground);
2241
+ }
2212
2242
  .links {
2213
2243
  display: flex;
2214
2244
  justify-content: center;
@@ -2232,6 +2262,32 @@ const gt = new Rt(), vt = {
2232
2262
  width: 18px;
2233
2263
  height: 18px;
2234
2264
  }
2265
+ /* Compact icon-only OAuth row (oauthLayout: icon / horizontal). */
2266
+ .providers.icon {
2267
+ display: flex;
2268
+ flex-wrap: wrap;
2269
+ gap: 8px;
2270
+ justify-content: center;
2271
+ }
2272
+ .providers.icon .btn {
2273
+ width: 40px;
2274
+ height: 40px;
2275
+ padding: 0;
2276
+ justify-content: center;
2277
+ position: relative;
2278
+ }
2279
+ .providers.icon .btn svg {
2280
+ width: 18px;
2281
+ height: 18px;
2282
+ }
2283
+ .providers.icon .last-used-badge,
2284
+ .providers.icon .oauth-last-used-pill {
2285
+ display: none;
2286
+ }
2287
+ .providers.icon .oauth-last-used-dot {
2288
+ top: 4px;
2289
+ inset-inline-end: 4px;
2290
+ }
2235
2291
  /* OAuth accordion: last-used (or focused) expands; others stay icon-compact. */
2236
2292
  .providers.accordion {
2237
2293
  display: flex;
@@ -2466,25 +2522,25 @@ const gt = new Rt(), vt = {
2466
2522
  }
2467
2523
  }
2468
2524
  `;
2469
- var zt = Object.defineProperty, _t = (e, t, i, s) => {
2470
- for (var a = void 0, c = e.length - 1, u; c >= 0; c--)
2471
- (u = e[c]) && (a = u(t, i, a) || a);
2472
- return a && zt(t, i, a), a;
2473
- }, M;
2474
- const $t = (M = class extends rt {
2525
+ var Dt = Object.defineProperty, _t = (e, t, i, s) => {
2526
+ for (var a = void 0, u = e.length - 1, c; u >= 0; u--)
2527
+ (c = e[u]) && (a = c(t, i, a) || a);
2528
+ return a && Dt(t, i, a), a;
2529
+ }, O;
2530
+ const $t = (O = class extends at {
2475
2531
  constructor() {
2476
2532
  super(...arguments), this.auth = o.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
2477
2533
  }
2478
2534
  connectedCallback() {
2479
2535
  super.connectedCallback();
2480
- for (const t of M.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
2536
+ for (const t of O.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
2481
2537
  this.auth = o.getState(), this.unsubscribeStore = o.on("change", (t) => {
2482
2538
  this.auth = t, this.applyBranding();
2483
2539
  }), this.unsubscribeTheme = gt.subscribe(() => this.applyBranding()), this.applyBranding();
2484
2540
  }
2485
2541
  disconnectedCallback() {
2486
2542
  super.disconnectedCallback();
2487
- for (const t of M.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
2543
+ for (const t of O.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
2488
2544
  this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2489
2545
  }
2490
2546
  get strings() {
@@ -2492,7 +2548,7 @@ const $t = (M = class extends rt {
2492
2548
  }
2493
2549
  /** Translate a string key with optional `{placeholders}`. */
2494
2550
  t(t, i) {
2495
- return St(this.strings[t], i);
2551
+ return At(this.strings[t], i);
2496
2552
  }
2497
2553
  get config() {
2498
2554
  return o.getConfig();
@@ -2512,19 +2568,19 @@ const $t = (M = class extends rt {
2512
2568
  fire(t, i) {
2513
2569
  this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
2514
2570
  }
2515
- }, M.styles = [Tt, Dt], M.KEY_EVENTS = ["keydown", "keyup", "keypress"], M);
2571
+ }, O.styles = [Tt, zt], O.KEY_EVENTS = ["keydown", "keyup", "keypress"], O);
2516
2572
  _t([
2517
2573
  d()
2518
2574
  ], $t.prototype, "auth");
2519
2575
  let E = $t;
2520
- var Lt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, w = (e, t, i, s) => {
2521
- for (var a = s > 1 ? void 0 : s ? Vt(t, i) : t, c = e.length - 1, u; c >= 0; c--)
2522
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
2523
- return s && a && Lt(t, i, a), a;
2576
+ var qt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, $ = (e, t, i, s) => {
2577
+ for (var a = s > 1 ? void 0 : s ? Vt(t, i) : t, u = e.length - 1, c; u >= 0; u--)
2578
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
2579
+ return s && a && qt(t, i, a), a;
2524
2580
  };
2525
- let y = class extends rt {
2581
+ let w = class extends at {
2526
2582
  constructor() {
2527
- super(...arguments), this.endpoint = "", this.project = "", this.redirectUrl = "", this.successUrl = "", this.methods = "email-password", this.signUp = "true", this.requireName = "true", this.mfa = "true", this.securityPhrase = "true", this.name = "", this.logo = "", this.theme = "auto", this.radius = "", this.primary = "", this.primaryForeground = "", this.termsUrl = "", this.privacyUrl = "", this.preview = "";
2583
+ super(...arguments), this.endpoint = "", this.project = "", this.redirectUrl = "", this.successUrl = "", this.methods = "email-password", this.signUp = "true", this.requireName = "true", this.mfa = "true", this.securityPhrase = "true", this.name = "", this.logo = "", this.theme = "auto", this.radius = "", this.primary = "", this.primaryForeground = "", this.termsUrl = "", this.privacyUrl = "", this.requireAcceptance = "", this.oauthLayout = "", this.preview = "";
2528
2584
  }
2529
2585
  connectedCallback() {
2530
2586
  super.connectedCallback(), this.configure();
@@ -2546,7 +2602,7 @@ let y = class extends rt {
2546
2602
  const e = { oauth: [] }, t = this.methods.split(/[\s,]+/).filter(Boolean);
2547
2603
  for (const i of t)
2548
2604
  i.startsWith("oauth:") ? e.oauth.push(i.slice(6)) : i === "email-password" ? e.emailPassword = !0 : i === "magic-url" ? e.magicUrl = !0 : i === "email-otp" ? e.emailOtp = !0 : i === "phone" ? e.phone = !0 : (i === "anonymous" || i === "guest") && (e.anonymous = !0);
2549
- return e.emailPassword = t.length > 0 ? t.includes("email-password") : !0, {
2605
+ return e.emailPassword = t.length > 0 ? t.includes("email-password") : !0, this.oauthLayout && (e.oauthLayout = this.oauthLayout), {
2550
2606
  endpoint: this.endpoint,
2551
2607
  project: this.project,
2552
2608
  redirectUrl: this.redirectUrl || void 0,
@@ -2566,82 +2622,89 @@ let y = class extends rt {
2566
2622
  },
2567
2623
  legal: {
2568
2624
  termsUrl: this.termsUrl || void 0,
2569
- privacyUrl: this.privacyUrl || void 0
2625
+ privacyUrl: this.privacyUrl || void 0,
2626
+ requireAcceptance: this.requireAcceptance !== "" && this.requireAcceptance !== "false" ? !0 : void 0
2570
2627
  },
2571
2628
  preview: this.preview === "" || this.preview === "false" ? void 0 : !0
2572
2629
  };
2573
2630
  }
2574
2631
  };
2575
- y.styles = O`
2632
+ w.styles = L`
2576
2633
  :host {
2577
2634
  display: none;
2578
2635
  }
2579
2636
  `;
2580
- w([
2581
- g({ type: String })
2582
- ], y.prototype, "endpoint", 2);
2583
- w([
2584
- g({ type: String })
2585
- ], y.prototype, "project", 2);
2586
- w([
2587
- g({ type: String, attribute: "redirect-url" })
2588
- ], y.prototype, "redirectUrl", 2);
2589
- w([
2590
- g({ type: String, attribute: "success-url" })
2591
- ], y.prototype, "successUrl", 2);
2592
- w([
2593
- g({ type: String })
2594
- ], y.prototype, "methods", 2);
2595
- w([
2596
- g({ type: String, attribute: "sign-up" })
2597
- ], y.prototype, "signUp", 2);
2598
- w([
2599
- g({ type: String, attribute: "require-name" })
2600
- ], y.prototype, "requireName", 2);
2601
- w([
2602
- g({ type: String })
2603
- ], y.prototype, "mfa", 2);
2604
- w([
2605
- g({ type: String, attribute: "security-phrase" })
2606
- ], y.prototype, "securityPhrase", 2);
2607
- w([
2608
- g({ type: String })
2609
- ], y.prototype, "name", 2);
2610
- w([
2611
- g({ type: String })
2612
- ], y.prototype, "logo", 2);
2613
- w([
2614
- g({ type: String })
2615
- ], y.prototype, "theme", 2);
2616
- w([
2617
- g({ type: String })
2618
- ], y.prototype, "radius", 2);
2619
- w([
2620
- g({ type: String })
2621
- ], y.prototype, "primary", 2);
2622
- w([
2623
- g({ type: String, attribute: "primary-foreground" })
2624
- ], y.prototype, "primaryForeground", 2);
2625
- w([
2626
- g({ type: String, attribute: "terms-url" })
2627
- ], y.prototype, "termsUrl", 2);
2628
- w([
2629
- g({ type: String, attribute: "privacy-url" })
2630
- ], y.prototype, "privacyUrl", 2);
2631
- w([
2632
- g({ type: String })
2633
- ], y.prototype, "preview", 2);
2634
- y = w([
2637
+ $([
2638
+ m({ type: String })
2639
+ ], w.prototype, "endpoint", 2);
2640
+ $([
2641
+ m({ type: String })
2642
+ ], w.prototype, "project", 2);
2643
+ $([
2644
+ m({ type: String, attribute: "redirect-url" })
2645
+ ], w.prototype, "redirectUrl", 2);
2646
+ $([
2647
+ m({ type: String, attribute: "success-url" })
2648
+ ], w.prototype, "successUrl", 2);
2649
+ $([
2650
+ m({ type: String })
2651
+ ], w.prototype, "methods", 2);
2652
+ $([
2653
+ m({ type: String, attribute: "sign-up" })
2654
+ ], w.prototype, "signUp", 2);
2655
+ $([
2656
+ m({ type: String, attribute: "require-name" })
2657
+ ], w.prototype, "requireName", 2);
2658
+ $([
2659
+ m({ type: String })
2660
+ ], w.prototype, "mfa", 2);
2661
+ $([
2662
+ m({ type: String, attribute: "security-phrase" })
2663
+ ], w.prototype, "securityPhrase", 2);
2664
+ $([
2665
+ m({ type: String })
2666
+ ], w.prototype, "name", 2);
2667
+ $([
2668
+ m({ type: String })
2669
+ ], w.prototype, "logo", 2);
2670
+ $([
2671
+ m({ type: String })
2672
+ ], w.prototype, "theme", 2);
2673
+ $([
2674
+ m({ type: String })
2675
+ ], w.prototype, "radius", 2);
2676
+ $([
2677
+ m({ type: String })
2678
+ ], w.prototype, "primary", 2);
2679
+ $([
2680
+ m({ type: String, attribute: "primary-foreground" })
2681
+ ], w.prototype, "primaryForeground", 2);
2682
+ $([
2683
+ m({ type: String, attribute: "terms-url" })
2684
+ ], w.prototype, "termsUrl", 2);
2685
+ $([
2686
+ m({ type: String, attribute: "privacy-url" })
2687
+ ], w.prototype, "privacyUrl", 2);
2688
+ $([
2689
+ m({ type: String, attribute: "require-acceptance" })
2690
+ ], w.prototype, "requireAcceptance", 2);
2691
+ $([
2692
+ m({ type: String, attribute: "oauth-layout" })
2693
+ ], w.prototype, "oauthLayout", 2);
2694
+ $([
2695
+ m({ type: String })
2696
+ ], w.prototype, "preview", 2);
2697
+ w = $([
2635
2698
  T("authui-config")
2636
- ], y);
2637
- var qt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, X = (e, t, i, s) => {
2638
- for (var a = s > 1 ? void 0 : s ? Nt(t, i) : t, c = e.length - 1, u; c >= 0; c--)
2639
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
2640
- return s && a && qt(t, i, a), a;
2699
+ ], w);
2700
+ var Nt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Q = (e, t, i, s) => {
2701
+ for (var a = s > 1 ? void 0 : s ? Bt(t, i) : t, u = e.length - 1, c; u >= 0; u--)
2702
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
2703
+ return s && a && Nt(t, i, a), a;
2641
2704
  };
2642
- const bt = "authui-show:not([ready]){display:none}", le = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
2705
+ const bt = "authui-show:not([ready]){display:none}", ce = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
2643
2706
  let yt = !1;
2644
- function Bt() {
2707
+ function jt() {
2645
2708
  if (!(typeof document > "u" || yt)) {
2646
2709
  yt = !0;
2647
2710
  try {
@@ -2658,16 +2721,16 @@ function Bt() {
2658
2721
  }
2659
2722
  }
2660
2723
  }
2661
- Bt();
2724
+ jt();
2662
2725
  const Ht = ["loading", "signed-out", "signed-in", "mfa-required"];
2663
- function et(e) {
2726
+ function it(e) {
2664
2727
  return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Ht.includes(t)) : [];
2665
2728
  }
2666
- function jt(e, t, i) {
2667
- const s = et(t), a = et(i);
2729
+ function Wt(e, t, i) {
2730
+ const s = it(t), a = it(i);
2668
2731
  return !(e === "loading" && !s.includes("loading") || s.length > 0 && !s.includes(e) || a.includes(e));
2669
2732
  }
2670
- let N = class extends rt {
2733
+ let H = class extends at {
2671
2734
  constructor() {
2672
2735
  super(...arguments), this.when = "", this.unless = "", this.status = o.getState().status, this.unsubscribe = null;
2673
2736
  }
@@ -2679,28 +2742,28 @@ let N = class extends rt {
2679
2742
  }
2680
2743
  /** Whether the current status satisfies `when` and `unless`. */
2681
2744
  get visible() {
2682
- return jt(this.status, this.when, this.unless);
2745
+ return Wt(this.status, this.when, this.unless);
2683
2746
  }
2684
2747
  updated() {
2685
- (this.status !== "loading" || et(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2748
+ (this.status !== "loading" || it(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2686
2749
  }
2687
2750
  render() {
2688
2751
  return this.visible ? r`<slot></slot>` : n;
2689
2752
  }
2690
2753
  };
2691
- X([
2692
- g({ type: String })
2693
- ], N.prototype, "when", 2);
2694
- X([
2695
- g({ type: String })
2696
- ], N.prototype, "unless", 2);
2697
- X([
2754
+ Q([
2755
+ m({ type: String })
2756
+ ], H.prototype, "when", 2);
2757
+ Q([
2758
+ m({ type: String })
2759
+ ], H.prototype, "unless", 2);
2760
+ Q([
2698
2761
  d()
2699
- ], N.prototype, "status", 2);
2700
- N = X([
2762
+ ], H.prototype, "status", 2);
2763
+ H = Q([
2701
2764
  T("authui-show")
2702
- ], N);
2703
- const Wt = O`
2765
+ ], H);
2766
+ const Kt = L`
2704
2767
  :host {
2705
2768
  display: block;
2706
2769
  width: 100%;
@@ -2754,7 +2817,7 @@ const Wt = O`
2754
2817
  height: 14px;
2755
2818
  margin: 0;
2756
2819
  }
2757
- `, v = (e) => r`<svg
2820
+ `, b = (e) => r`<svg
2758
2821
  xmlns="http://www.w3.org/2000/svg"
2759
2822
  viewBox="0 0 24 24"
2760
2823
  fill="none"
@@ -2766,159 +2829,159 @@ const Wt = O`
2766
2829
  >
2767
2830
  ${e}
2768
2831
  </svg>`, l = {
2769
- mail: v(
2832
+ mail: b(
2770
2833
  h`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`
2771
2834
  ),
2772
- phone: v(
2835
+ phone: b(
2773
2836
  h`<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>`
2774
2837
  ),
2775
- user: v(
2838
+ user: b(
2776
2839
  h`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
2777
2840
  ),
2778
- userX: v(
2841
+ userX: b(
2779
2842
  h`<path d="M2 21a8 8 0 0 1 11.873-7"/><circle cx="10" cy="8" r="5"/><path d="m17 17 5 5"/><path d="m22 17-5 5"/>`
2780
2843
  ),
2781
- lock: v(
2844
+ lock: b(
2782
2845
  h`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
2783
2846
  ),
2784
- key: v(
2847
+ key: b(
2785
2848
  h`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`
2786
2849
  ),
2787
- shield: v(
2850
+ shield: b(
2788
2851
  h`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>`
2789
2852
  ),
2790
- shieldCheck: v(
2853
+ shieldCheck: b(
2791
2854
  h`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`
2792
2855
  ),
2793
- smartphone: v(
2856
+ smartphone: b(
2794
2857
  h`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
2795
2858
  ),
2796
- monitor: v(
2859
+ monitor: b(
2797
2860
  h`<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>`
2798
2861
  ),
2799
- globe: v(
2862
+ globe: b(
2800
2863
  h`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`
2801
2864
  ),
2802
- logOut: v(
2865
+ logOut: b(
2803
2866
  h`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" x2="9" y1="12" y2="12"/>`
2804
2867
  ),
2805
- settings: v(
2868
+ settings: b(
2806
2869
  h`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`
2807
2870
  ),
2808
- x: v(h`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
2809
- check: v(h`<path d="M20 6 9 17l-5-5"/>`),
2810
- users: v(
2871
+ x: b(h`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
2872
+ check: b(h`<path d="M20 6 9 17l-5-5"/>`),
2873
+ users: b(
2811
2874
  h`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>`
2812
2875
  ),
2813
- copy: v(
2876
+ copy: b(
2814
2877
  h`<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`
2815
2878
  ),
2816
- eye: v(
2879
+ eye: b(
2817
2880
  h`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`
2818
2881
  ),
2819
- eyeOff: v(
2882
+ eyeOff: b(
2820
2883
  h`<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>`
2821
2884
  ),
2822
- arrowLeft: v(h`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
2823
- alert: v(
2885
+ arrowLeft: b(h`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
2886
+ alert: b(
2824
2887
  h`<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>`
2825
2888
  ),
2826
- info: v(h`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
2827
- checkCircle: v(h`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
2828
- link: v(
2889
+ info: b(h`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
2890
+ checkCircle: b(h`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
2891
+ link: b(
2829
2892
  h`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`
2830
2893
  ),
2831
- activity: v(
2894
+ activity: b(
2832
2895
  h`<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>`
2833
2896
  ),
2834
- trash: v(
2897
+ trash: b(
2835
2898
  h`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`
2836
2899
  ),
2837
- sparkles: v(
2900
+ sparkles: b(
2838
2901
  h`<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>`
2839
2902
  ),
2840
- refresh: v(
2903
+ refresh: b(
2841
2904
  h`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`
2842
2905
  ),
2843
- chevronDown: v(h`<path d="m6 9 6 6 6-6"/>`),
2844
- ghost: v(
2906
+ chevronDown: b(h`<path d="m6 9 6 6 6-6"/>`),
2907
+ ghost: b(
2845
2908
  h`<path d="M9 10h.01"/><path d="M15 10h.01"/><path d="M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z"/>`
2846
2909
  ),
2847
- qr: v(
2910
+ qr: b(
2848
2911
  h`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`
2849
2912
  )
2850
- }, x = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Kt = {
2851
- google: x(
2913
+ }, k = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Gt = {
2914
+ google: k(
2852
2915
  h`<path fill="#4285F4" d="M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.47a5.57 5.57 0 0 1-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.86-3c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96H1.29v3.09A11.99 11.99 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.27 14.29A7.2 7.2 0 0 1 4.89 12c0-.8.14-1.57.38-2.29V6.62H1.29A11.97 11.97 0 0 0 0 12c0 1.94.46 3.77 1.29 5.38l3.98-3.09z"/><path fill="#EA4335" d="M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0 7.31 0 3.26 2.69 1.29 6.62l3.98 3.09C6.22 6.86 8.87 4.75 12 4.75z"/>`
2853
2916
  ),
2854
- github: x(
2917
+ github: k(
2855
2918
  h`<path fill="currentColor" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/>`
2856
2919
  ),
2857
- apple: x(
2920
+ apple: k(
2858
2921
  h`<path fill="currentColor" d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/>`
2859
2922
  ),
2860
- facebook: x(
2923
+ facebook: k(
2861
2924
  h`<path fill="#1877F2" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>`
2862
2925
  ),
2863
- x: x(
2926
+ x: k(
2864
2927
  h`<path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>`
2865
2928
  ),
2866
- microsoft: x(
2929
+ microsoft: k(
2867
2930
  h`<path fill="#F25022" d="M1 1h10v10H1z"/><path fill="#7FBA00" d="M13 1h10v10H13z"/><path fill="#00A4EF" d="M1 13h10v10H1z"/><path fill="#FFB900" d="M13 13h10v10H13z"/>`
2868
2931
  ),
2869
- discord: x(
2932
+ discord: k(
2870
2933
  h`<path fill="#5865F2" d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/>`
2871
2934
  ),
2872
- gitlab: x(
2935
+ gitlab: k(
2873
2936
  h`<path fill="#FC6D26" d="m23.6 9.593-.033-.086L20.3.98a.851.851 0 0 0-.336-.405.876.876 0 0 0-1.001.054.874.874 0 0 0-.29.44l-2.205 6.748H7.535L5.33 1.069a.857.857 0 0 0-.29-.441.876.876 0 0 0-1.001-.054.86.86 0 0 0-.336.405L.436 9.502l-.032.086a6.066 6.066 0 0 0 2.012 7.01l.011.009.03.021 4.976 3.727 2.462 1.863 1.5 1.132a1.009 1.009 0 0 0 1.22 0l1.5-1.132 2.461-1.863 5.006-3.75.013-.01a6.068 6.068 0 0 0 2.006-7.002z"/>`
2874
2937
  ),
2875
- linkedin: x(
2938
+ linkedin: k(
2876
2939
  h`<path fill="#0A66C2" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>`
2877
2940
  ),
2878
- slack: x(
2941
+ slack: k(
2879
2942
  h`<path fill="#E01E5A" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"/><path fill="#36C5F0" d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"/><path fill="#2EB67D" d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.163 0a2.528 2.528 0 0 1 2.523 2.522v6.312z"/><path fill="#ECB22E" d="M15.163 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.163 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.315A2.527 2.527 0 0 1 24 15.163a2.528 2.528 0 0 1-2.522 2.523h-6.315z"/>`
2880
2943
  ),
2881
- twitch: x(
2944
+ twitch: k(
2882
2945
  h`<path fill="#9146FF" d="M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0 1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z"/>`
2883
2946
  ),
2884
- spotify: x(
2947
+ spotify: k(
2885
2948
  h`<path fill="#1DB954" d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"/>`
2886
2949
  ),
2887
- notion: x(
2950
+ notion: k(
2888
2951
  h`<path fill="currentColor" d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/>`
2889
2952
  ),
2890
- dropbox: x(
2953
+ dropbox: k(
2891
2954
  h`<path fill="#0061FF" d="M6 1.807 0 5.629l6 3.822 6.001-3.822L6 1.807zm12 0-6 3.822 6 3.822 6-3.822-6-3.822zM0 13.274l6 3.822 6.001-3.822L6 9.452l-6 3.822zm18-3.822-6 3.822 6 3.822 6-3.822-6-3.822zM6 18.371l6.001 3.822 6-3.822-6-3.822L6 18.371z"/>`
2892
2955
  ),
2893
- figma: x(
2956
+ figma: k(
2894
2957
  h`<path fill="#F24E1E" d="M8 24a4 4 0 0 0 4-4v-4H8a4 4 0 0 0 0 8z"/><path fill="#A259FF" d="M4 12a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#FF7262" d="M4 4a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#1ABCFE" d="M12 0h4a4 4 0 0 1 0 8h-4V0z"/><path fill="#0ACF83" d="M20 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0z"/>`
2895
2958
  ),
2896
- bitbucket: x(
2959
+ bitbucket: k(
2897
2960
  h`<path fill="#2684FF" d="M.778 1.213a.768.768 0 0 0-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 0 0 .77-.646l3.27-20.03a.768.768 0 0 0-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z"/>`
2898
2961
  ),
2899
- amazon: x(
2962
+ amazon: k(
2900
2963
  h`<path fill="currentColor" d="M.045 18.02c.072-.116.187-.124.348-.022 3.636 2.11 7.594 3.166 11.87 3.166 2.852 0 5.668-.533 8.447-1.595l.315-.14c.138-.06.234-.1.293-.13.226-.088.39-.046.525.13.12.174.09.336-.12.48-.256.19-.6.41-1.006.654-1.244.743-2.64 1.316-4.185 1.726a17.617 17.617 0 0 1-10.951-.577 17.88 17.88 0 0 1-5.43-3.35c-.1-.074-.151-.15-.151-.22 0-.047.021-.09.051-.13zm6.565-6.218c0-1.005.247-1.863.743-2.577.495-.71 1.17-1.25 2.04-1.615.796-.335 1.756-.575 2.912-.72.39-.046 1.033-.103 1.92-.174v-.37c0-.93-.105-1.558-.3-1.875-.302-.43-.78-.65-1.44-.65h-.182c-.48.046-.896.196-1.246.46-.35.27-.575.63-.675 1.096-.06.3-.206.465-.435.51l-2.52-.315c-.248-.06-.372-.18-.372-.39 0-.046.007-.09.022-.15.247-1.29.855-2.25 1.82-2.88.976-.616 2.1-.975 3.39-1.05h.54c1.65 0 2.957.434 3.888 1.29.135.15.27.3.405.48.12.165.224.314.283.45.075.134.15.33.195.57.06.254.105.42.135.51.03.104.062.3.076.615.01.313.02.493.02.553v5.28c0 .376.06.72.165 1.036.105.313.21.54.315.674l.51.674c.09.136.136.256.136.36 0 .12-.06.226-.18.314-1.2 1.05-1.86 1.62-1.963 1.71-.165.135-.373.15-.61.045a6.62 6.62 0 0 1-.526-.496l-.31-.347a9.858 9.858 0 0 1-.317-.42l-.3-.435c-.81.886-1.603 1.44-2.4 1.665-.494.15-1.093.227-1.83.227-1.11 0-2.04-.343-2.76-1.034-.72-.69-1.08-1.665-1.08-2.94l-.05-.076zm3.753-.438c0 .566.14 1.02.425 1.364.285.34.675.512 1.155.512.045 0 .106-.007.195-.02.09-.016.134-.023.166-.023.614-.16 1.08-.553 1.424-1.178.165-.28.285-.58.36-.91.09-.32.12-.59.135-.8.015-.195.015-.54.015-1.005v-.54c-.84 0-1.484.06-1.92.18-1.275.36-1.92 1.17-1.92 2.43l-.035-.01zm9.162 7.027c.03-.06.075-.11.132-.17.362-.243.714-.41 1.05-.5a8.094 8.094 0 0 1 1.612-.24c.14-.012.28 0 .41.03.65.06 1.05.168 1.172.33.063.09.099.228.099.39v.15c0 .51-.149 1.11-.424 1.8-.278.69-.664 1.248-1.156 1.68-.073.06-.14.09-.197.09-.03 0-.06 0-.09-.012-.09-.044-.107-.12-.064-.24.54-1.26.806-2.143.806-2.64 0-.15-.03-.27-.087-.344-.145-.166-.55-.257-1.224-.257-.243 0-.533.016-.87.045-.363.045-.7.09-1 .135-.09 0-.148-.014-.18-.044-.03-.03-.036-.06-.02-.106 0-.014.007-.03.02-.06z"/>`
2901
2964
  ),
2902
- paypal: x(
2965
+ paypal: k(
2903
2966
  h`<path fill="#003087" d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.607-.541c-.013.076-.026.175-.041.254-.93 4.778-4.005 7.201-9.138 7.201h-2.19a.563.563 0 0 0-.556.479l-1.187 7.527h-.506l-.24 1.516a.56.56 0 0 0 .554.647h3.882c.46 0 .85-.334.922-.788.06-.26.76-4.852.816-5.09a.932.932 0 0 1 .923-.788h.58c3.76 0 6.705-1.528 7.565-5.946.36-1.847.174-3.388-.777-4.471z"/>`
2904
2967
  )
2905
2968
  };
2906
- function Y(e) {
2907
- return Kt[e] ?? l.globe;
2969
+ function B(e) {
2970
+ return Gt[e] ?? l.globe;
2908
2971
  }
2909
- function nt(e) {
2972
+ function ot(e) {
2910
2973
  const t = (e.trim()[0] ?? "?").toUpperCase();
2911
2974
  return /[A-Z0-9]/i.test(t) ? t : l.user;
2912
2975
  }
2913
- function Z(e) {
2976
+ function X(e) {
2914
2977
  typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
2915
2978
  window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
2916
2979
  }));
2917
2980
  }
2918
- function ce() {
2981
+ function de() {
2919
2982
  typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
2920
2983
  }
2921
- function it(e) {
2984
+ function st(e) {
2922
2985
  const t = {
2923
2986
  length: e.length >= 8,
2924
2987
  long: e.length >= 12,
@@ -2934,19 +2997,19 @@ function it(e) {
2934
2997
  let s, a;
2935
2998
  return !t.length || i <= 1 ? (s = 1, a = "passwordStrengthTooWeak") : i === 2 ? (s = 2, a = "passwordStrengthWeak") : i === 3 ? (s = 3, a = "passwordStrengthFair") : i >= 5 && t.long && t.lower && t.upper && t.number && t.symbol ? (s = 4, a = "passwordStrengthVeryStrong") : (s = 4, a = "passwordStrengthStrong"), { level: s, percent: s * 25, labelKey: a, checks: t };
2936
2999
  }
2937
- var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, C = (e, t, i, s) => {
2938
- for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, c = e.length - 1, u; c >= 0; c--)
2939
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
2940
- return s && a && Gt(t, i, a), a;
3000
+ var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, C = (e, t, i, s) => {
3001
+ for (var a = s > 1 ? void 0 : s ? Zt(t, i) : t, u = e.length - 1, c; u >= 0; u--)
3002
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
3003
+ return s && a && Yt(t, i, a), a;
2941
3004
  };
2942
- let k = class extends E {
3005
+ let x = class extends E {
2943
3006
  constructor() {
2944
- super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.onSignIn = (e) => {
3007
+ super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.onSignIn = (e) => {
2945
3008
  e.preventDefault(), this.requireValid(e) && this.run(async () => {
2946
3009
  await o.signInWithEmailPassword(this.email, this.password), this.password = "", V("email-password"), this.fire("authui-success", { method: "email-password" });
2947
3010
  });
2948
3011
  }, this.onSignUp = (e) => {
2949
- e.preventDefault(), this.requireValid(e) && this.run(async () => {
3012
+ e.preventDefault(), this.requireValid(e) && this.ensureLegalAccepted() && this.run(async () => {
2950
3013
  await o.signUp(this.email, this.password, this.name), this.password = "", V("email-password"), this.fire("authui-success", { method: "sign-up" });
2951
3014
  });
2952
3015
  }, this.onGuest = () => {
@@ -2954,8 +3017,8 @@ let k = class extends E {
2954
3017
  await o.signInAnonymously(), V("anonymous"), this.fire("authui-success", { method: "anonymous" });
2955
3018
  });
2956
3019
  }, this.onOAuth = (e) => {
2957
- this.run(async () => {
2958
- if (Ot(e), await o.signInWithOAuth(e), o.isPreview) {
3020
+ this.step === "sign-up" && !this.ensureLegalAccepted() || this.run(async () => {
3021
+ if (Ft(e), await o.signInWithOAuth(e), o.isPreview) {
2959
3022
  wt(), this.fire("authui-success", { method: "oauth" });
2960
3023
  return;
2961
3024
  }
@@ -3022,7 +3085,7 @@ let k = class extends E {
3022
3085
  try {
3023
3086
  await o.signOut();
3024
3087
  } catch (e) {
3025
- if (!q(e, f.sessionNotFound)) throw e;
3088
+ if (!j(e, g.sessionNotFound)) throw e;
3026
3089
  }
3027
3090
  this.go("sign-in");
3028
3091
  });
@@ -3054,7 +3117,7 @@ let k = class extends E {
3054
3117
  this.notice = null, this.auth.pending?.type === "notice" && o.setPending(null);
3055
3118
  }
3056
3119
  go(e) {
3057
- e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.password = "", this.passwordConfirm = "", e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
3120
+ e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
3058
3121
  }
3059
3122
  // ───────────────────────────── actions ─────────────────────────────
3060
3123
  async run(e, t = "link") {
@@ -3063,7 +3126,7 @@ let k = class extends E {
3063
3126
  try {
3064
3127
  await e();
3065
3128
  } catch (i) {
3066
- this.error = K(i, this.strings, t);
3129
+ this.error = Y(i, this.strings, t);
3067
3130
  } finally {
3068
3131
  this.busy = !1;
3069
3132
  }
@@ -3156,7 +3219,7 @@ let k = class extends E {
3156
3219
  </button>`;
3157
3220
  }
3158
3221
  passwordField(e) {
3159
- const t = this[e.field], i = e.meter ? it(t) : null;
3222
+ const t = this[e.field], i = e.meter ? st(t) : null;
3160
3223
  return r`
3161
3224
  <div class="field">
3162
3225
  <div class="field-header">
@@ -3243,14 +3306,35 @@ let k = class extends E {
3243
3306
  </div>
3244
3307
  `;
3245
3308
  }
3309
+ /** True when sign-up must show/enforce the legal checkbox. */
3310
+ needsLegalAcceptance() {
3311
+ const e = this.config?.legal;
3312
+ return e?.requireAcceptance ? !!(e.termsUrl || e.privacyUrl) : !1;
3313
+ }
3314
+ /** Block sign-up / OAuth when the required legal checkbox is unchecked. */
3315
+ ensureLegalAccepted() {
3316
+ return !this.needsLegalAcceptance() || this.legalAccepted ? !0 : (this.error = this.t("errorLegalRequired"), !1);
3317
+ }
3318
+ legalLinks() {
3319
+ const e = this.config?.legal;
3320
+ return !e?.termsUrl && !e?.privacyUrl ? n : r`${e.termsUrl ? r`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : n}${e.termsUrl && e.privacyUrl ? r` ${this.t("and")} ` : n}${e.privacyUrl ? r`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : n}`;
3321
+ }
3246
3322
  legal() {
3247
3323
  const e = this.config?.legal;
3248
- return !e?.termsUrl && !e?.privacyUrl ? n : r`<p class="legal">
3249
- ${this.t("agreeTo")}
3250
- ${e.termsUrl ? r`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : n}
3251
- ${e.termsUrl && e.privacyUrl ? r` ${this.t("and")} ` : n}
3252
- ${e.privacyUrl ? r`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : n}.
3253
- </p>`;
3324
+ return !e?.termsUrl && !e?.privacyUrl ? n : this.step === "sign-up" && this.needsLegalAcceptance() ? n : r`<p class="legal">${this.t("agreeTo")} ${this.legalLinks()}.</p>`;
3325
+ }
3326
+ /** Required acceptance checkbox on sign-up when legal.requireAcceptance is set. */
3327
+ legalAcceptField() {
3328
+ return this.needsLegalAcceptance() ? r`<label class="legal-accept">
3329
+ <input
3330
+ type="checkbox"
3331
+ .checked=${this.legalAccepted}
3332
+ @change=${(e) => {
3333
+ this.legalAccepted = e.target.checked, this.legalAccepted && this.error === this.t("errorLegalRequired") && (this.error = "");
3334
+ }}
3335
+ />
3336
+ <span>${this.t("acceptLegal")} ${this.legalLinks()}.</span>
3337
+ </label>` : n;
3254
3338
  }
3255
3339
  backLink(e = "sign-in") {
3256
3340
  return r`<div class="links">
@@ -3298,7 +3382,7 @@ let k = class extends E {
3298
3382
  <div class="stack">
3299
3383
  <div class="row">
3300
3384
  <div class="inline">
3301
- <span class="avatar">${nt(t)}</span>
3385
+ <span class="avatar">${ot(t)}</span>
3302
3386
  <div class="row-main">
3303
3387
  <span class="row-title" title=${t}>${t}</span>
3304
3388
  ${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
@@ -3313,7 +3397,7 @@ let k = class extends E {
3313
3397
  <button
3314
3398
  class="btn btn-outline btn-block"
3315
3399
  @click=${() => {
3316
- this.embedded ? this.fire("authui-open", { view: "account" }) : Z("account");
3400
+ this.embedded ? this.fire("authui-open", { view: "account" }) : X("account");
3317
3401
  }}
3318
3402
  >
3319
3403
  ${l.settings} ${this.t("manageAccount")}
@@ -3328,32 +3412,51 @@ let k = class extends E {
3328
3412
  renderProviders() {
3329
3413
  const e = [...this.config?.methods?.oauth ?? []];
3330
3414
  if (e.length === 0) return n;
3331
- const t = z(), i = e.find((a) => t === `oauth:${a}`) ?? null;
3332
- if (e.length <= 2) {
3333
- const a = [...e].sort((c, u) => {
3334
- const b = t === `oauth:${c}` ? 0 : 1, $ = t === `oauth:${u}` ? 0 : 1;
3335
- return b - $;
3415
+ const t = D(), i = e.find((c) => t === `oauth:${c}`) ?? null, s = this.config?.methods?.oauthLayout, a = s === "horizontal" || s === "icon" ? "icon" : s === "stack" || s === "accordion" ? s : e.length <= 2 ? "stack" : "accordion";
3416
+ if (a === "icon")
3417
+ return r`
3418
+ <div class="providers icon">
3419
+ ${e.map((c) => {
3420
+ const v = t === `oauth:${c}`, y = this.t("continueWith", { provider: N(c) });
3421
+ return r`<button
3422
+ type="button"
3423
+ class="btn btn-outline ${v ? "last-used" : ""}"
3424
+ @click=${() => this.onOAuth(c)}
3425
+ ?disabled=${this.busy}
3426
+ aria-label=${v ? `${y}. ${this.t("lastUsed")}` : y}
3427
+ title=${y}
3428
+ >
3429
+ ${B(c)}
3430
+ ${v ? r`<span class="oauth-last-used-dot" aria-hidden="true"></span>` : n}
3431
+ </button>`;
3432
+ })}
3433
+ </div>
3434
+ `;
3435
+ if (a === "stack") {
3436
+ const c = [...e].sort((v, y) => {
3437
+ const S = t === `oauth:${v}` ? 0 : 1, xt = t === `oauth:${y}` ? 0 : 1;
3438
+ return S - xt;
3336
3439
  });
3337
3440
  return r`
3338
3441
  <div class="providers">
3339
- ${a.map((c) => {
3340
- const u = t === `oauth:${c}`, b = this.t("continueWith", { provider: W(c) });
3442
+ ${c.map((v) => {
3443
+ const y = t === `oauth:${v}`, S = this.t("continueWith", { provider: N(v) });
3341
3444
  return r`<button
3342
3445
  type="button"
3343
- class="btn btn-outline ${u ? "last-used" : ""}"
3344
- @click=${() => this.onOAuth(c)}
3446
+ class="btn btn-outline ${y ? "last-used" : ""}"
3447
+ @click=${() => this.onOAuth(v)}
3345
3448
  ?disabled=${this.busy}
3346
- aria-label=${u ? `${b}. ${this.t("lastUsed")}` : b}
3449
+ aria-label=${y ? `${S}. ${this.t("lastUsed")}` : S}
3347
3450
  >
3348
- ${Y(c)}
3349
- <span>${b}</span>
3350
- ${u ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3451
+ ${B(v)}
3452
+ <span>${S}</span>
3453
+ ${y ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3351
3454
  </button>`;
3352
3455
  })}
3353
3456
  </div>
3354
3457
  `;
3355
3458
  }
3356
- const s = this.expandedOAuth && e.includes(this.expandedOAuth) ? this.expandedOAuth : i ?? e[0];
3459
+ const u = this.expandedOAuth && e.includes(this.expandedOAuth) ? this.expandedOAuth : i ?? e[0];
3357
3460
  return r`
3358
3461
  <div
3359
3462
  class="providers accordion"
@@ -3361,29 +3464,29 @@ let k = class extends E {
3361
3464
  this.expandedOAuth = i ?? e[0];
3362
3465
  }}
3363
3466
  >
3364
- ${e.map((a) => {
3365
- const c = t === `oauth:${a}`, u = s === a, b = this.t("continueWith", { provider: W(a) });
3467
+ ${e.map((c) => {
3468
+ const v = t === `oauth:${c}`, y = u === c, S = this.t("continueWith", { provider: N(c) });
3366
3469
  return r`<div
3367
- class="provider-slot ${u ? "is-expanded" : ""}"
3470
+ class="provider-slot ${y ? "is-expanded" : ""}"
3368
3471
  @mouseenter=${() => {
3369
- this.expandedOAuth = a;
3472
+ this.expandedOAuth = c;
3370
3473
  }}
3371
3474
  >
3372
3475
  <button
3373
3476
  type="button"
3374
3477
  class="btn btn-outline"
3375
- @click=${() => this.onOAuth(a)}
3478
+ @click=${() => this.onOAuth(c)}
3376
3479
  @focus=${() => {
3377
- this.expandedOAuth = a;
3480
+ this.expandedOAuth = c;
3378
3481
  }}
3379
3482
  ?disabled=${this.busy}
3380
- aria-label=${c ? `${b}. ${this.t("lastUsed")}` : b}
3483
+ aria-label=${v ? `${S}. ${this.t("lastUsed")}` : S}
3381
3484
  >
3382
- ${Y(a)}
3485
+ ${B(c)}
3383
3486
  <span class="provider-label"
3384
- ><span><span class="provider-label-text">${b}</span></span></span
3487
+ ><span><span class="provider-label-text">${S}</span></span></span
3385
3488
  >
3386
- ${c ? r`<span class="oauth-last-used" data-last-used=${a} aria-hidden="true">
3489
+ ${v ? r`<span class="oauth-last-used" data-last-used=${c} aria-hidden="true">
3387
3490
  <span class="oauth-last-used-dot"></span>
3388
3491
  <span class="oauth-last-used-pill">${this.t("lastUsed")}</span>
3389
3492
  </span>` : n}
@@ -3404,11 +3507,11 @@ let k = class extends E {
3404
3507
  ${this.renderProviders()}
3405
3508
  ${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : n}
3406
3509
  ${t ? r`<form
3407
- class="form ${z() === "email-password" ? "last-used-form" : ""}"
3510
+ class="form ${D() === "email-password" ? "last-used-form" : ""}"
3408
3511
  @submit=${this.onSignIn}
3409
3512
  novalidate
3410
3513
  >
3411
- ${z() === "email-password" ? r`<p class="hint">
3514
+ ${D() === "email-password" ? r`<p class="hint">
3412
3515
  <span class="last-used-badge">${this.t("lastUsed")}</span>
3413
3516
  </p>` : n}
3414
3517
  ${this.emailField()}
@@ -3417,25 +3520,25 @@ let k = class extends E {
3417
3520
  </form>` : this.renderError()}
3418
3521
  ${s.length > 0 ? r`<div class="stack-sm">
3419
3522
  ${s.map((a) => {
3420
- const c = z() === a.step;
3523
+ const u = D() === a.step;
3421
3524
  return r`<button
3422
3525
  type="button"
3423
- class="btn btn-secondary btn-block ${c ? "last-used" : ""}"
3526
+ class="btn btn-secondary btn-block ${u ? "last-used" : ""}"
3424
3527
  @click=${() => this.go(a.step)}
3425
3528
  >
3426
3529
  ${a.icon} ${a.label}
3427
- ${c ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3530
+ ${u ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3428
3531
  </button>`;
3429
3532
  })}
3430
3533
  </div>` : n}
3431
3534
  ${e.anonymous ? r`<button
3432
3535
  type="button"
3433
- class="btn btn-ghost btn-block ${z() === "anonymous" ? "last-used" : ""}"
3536
+ class="btn btn-ghost btn-block ${D() === "anonymous" ? "last-used" : ""}"
3434
3537
  @click=${this.onGuest}
3435
3538
  ?disabled=${this.busy}
3436
3539
  >
3437
3540
  ${l.ghost} ${this.t("continueAsGuest")}
3438
- ${z() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3541
+ ${D() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
3439
3542
  </button>` : n}
3440
3543
  ${t && this.config?.signUp !== !1 ? r`<div class="links">
3441
3544
  <span>${this.t("noAccount")}</span>
@@ -3467,7 +3570,8 @@ let k = class extends E {
3467
3570
  </div>` : n}
3468
3571
  ${this.emailField()}
3469
3572
  ${this.passwordField({ label: this.t("password"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint"), meter: !0 })}
3470
- ${this.renderError()} ${this.submitButton(this.t("createAccount"))}
3573
+ ${this.legalAcceptField()} ${this.renderError()}
3574
+ ${this.submitButton(this.t("createAccount"))}
3471
3575
  </form>
3472
3576
  <div class="links">
3473
3577
  <span>${this.t("haveAccount")}</span>
@@ -3721,60 +3825,69 @@ let k = class extends E {
3721
3825
  `;
3722
3826
  }
3723
3827
  };
3724
- k.styles = [...E.styles, Wt];
3828
+ x.styles = [...E.styles, Kt];
3725
3829
  C([
3726
- g({ type: String })
3727
- ], k.prototype, "view", 2);
3830
+ m({ type: String })
3831
+ ], x.prototype, "view", 2);
3728
3832
  C([
3729
- g({ type: Boolean })
3730
- ], k.prototype, "embedded", 2);
3833
+ m({ type: Boolean })
3834
+ ], x.prototype, "embedded", 2);
3731
3835
  C([
3732
3836
  d()
3733
- ], k.prototype, "step", 2);
3837
+ ], x.prototype, "step", 2);
3734
3838
  C([
3735
3839
  d()
3736
- ], k.prototype, "busy", 2);
3840
+ ], x.prototype, "busy", 2);
3737
3841
  C([
3738
3842
  d()
3739
- ], k.prototype, "error", 2);
3843
+ ], x.prototype, "error", 2);
3740
3844
  C([
3741
3845
  d()
3742
- ], k.prototype, "notice", 2);
3846
+ ], x.prototype, "notice", 2);
3743
3847
  C([
3744
3848
  d()
3745
- ], k.prototype, "showPassword", 2);
3849
+ ], x.prototype, "showPassword", 2);
3746
3850
  C([
3747
3851
  d()
3748
- ], k.prototype, "expandedOAuth", 2);
3852
+ ], x.prototype, "expandedOAuth", 2);
3749
3853
  C([
3750
3854
  d()
3751
- ], k.prototype, "token", 2);
3855
+ ], x.prototype, "token", 2);
3752
3856
  C([
3753
3857
  d()
3754
- ], k.prototype, "resendCooldownUntil", 2);
3858
+ ], x.prototype, "resendCooldownUntil", 2);
3755
3859
  C([
3756
3860
  d()
3757
- ], k.prototype, "challenge", 2);
3861
+ ], x.prototype, "challenge", 2);
3758
3862
  C([
3759
3863
  d()
3760
- ], k.prototype, "recovery", 2);
3864
+ ], x.prototype, "recovery", 2);
3761
3865
  C([
3762
- st("form input:not([type=hidden])")
3763
- ], k.prototype, "firstInput", 2);
3764
- k = C([
3866
+ rt("form input:not([type=hidden])")
3867
+ ], x.prototype, "firstInput", 2);
3868
+ C([
3869
+ d()
3870
+ ], x.prototype, "password", 2);
3871
+ C([
3872
+ d()
3873
+ ], x.prototype, "passwordConfirm", 2);
3874
+ C([
3875
+ d()
3876
+ ], x.prototype, "legalAccepted", 2);
3877
+ x = C([
3765
3878
  T("authui-sign-in")
3766
- ], k);
3767
- var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, m = (e, t, i, s) => {
3768
- for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, c = e.length - 1, u; c >= 0; c--)
3769
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
3770
- return s && a && Zt(t, i, a), a;
3879
+ ], x);
3880
+ var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, f = (e, t, i, s) => {
3881
+ for (var a = s > 1 ? void 0 : s ? Qt(t, i) : t, u = e.length - 1, c; u >= 0; u--)
3882
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
3883
+ return s && a && Xt(t, i, a), a;
3771
3884
  };
3772
3885
  let p = class extends E {
3773
3886
  constructor() {
3774
3887
  super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.onTabsKeydown = (e) => {
3775
3888
  const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
3776
3889
  if (!t.length) return;
3777
- const i = t.findIndex((c) => c.getAttribute("aria-selected") === "true");
3890
+ const i = t.findIndex((u) => u.getAttribute("aria-selected") === "true");
3778
3891
  let s = i;
3779
3892
  if (e.key === "ArrowRight" || e.key === "ArrowDown") s = (i + 1) % t.length;
3780
3893
  else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
@@ -3875,7 +3988,7 @@ let p = class extends E {
3875
3988
  try {
3876
3989
  this.recoveryCodes = await o.createRecoveryCodes();
3877
3990
  } catch (e) {
3878
- if (!q(e, f.recoveryCodesExist)) throw e;
3991
+ if (!j(e, g.recoveryCodesExist)) throw e;
3879
3992
  this.recoveryCodes = await o.getRecoveryCodes();
3880
3993
  }
3881
3994
  await this.loadFactors();
@@ -3998,9 +4111,9 @@ let p = class extends E {
3998
4111
  try {
3999
4112
  await t(), i && this.setNotice("success", i);
4000
4113
  } catch (s) {
4001
- q(s, f.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
4114
+ j(s, g.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
4002
4115
  ...this.errors,
4003
- [e]: K(
4116
+ [e]: Y(
4004
4117
  s,
4005
4118
  this.strings,
4006
4119
  e.includes("code") ? "code" : e === "password" ? "password" : "link"
@@ -4147,7 +4260,7 @@ let p = class extends E {
4147
4260
  return r`
4148
4261
  <div class="between">
4149
4262
  <div class="identity">
4150
- <span class="avatar">${nt(t)}</span>
4263
+ <span class="avatar">${ot(t)}</span>
4151
4264
  <div class="row-main">
4152
4265
  <span class="row-title" title=${t}>
4153
4266
  ${t}
@@ -4272,7 +4385,7 @@ let p = class extends E {
4272
4385
  autocomplete="new-password"
4273
4386
  />
4274
4387
  ${this.emailPassword ? (() => {
4275
- const t = it(this.emailPassword);
4388
+ const t = st(this.emailPassword);
4276
4389
  return r`<div class="strength" aria-live="polite">
4277
4390
  <div
4278
4391
  class="strength-meter"
@@ -4533,7 +4646,7 @@ let p = class extends E {
4533
4646
  autocomplete="new-password"
4534
4647
  />
4535
4648
  ${this.newPassword ? (() => {
4536
- const i = it(this.newPassword);
4649
+ const i = st(this.newPassword);
4537
4650
  return r`<div class="strength" aria-live="polite">
4538
4651
  <div
4539
4652
  class="strength-meter"
@@ -4582,7 +4695,7 @@ let p = class extends E {
4582
4695
  </div>`;
4583
4696
  }
4584
4697
  renderMfaCard() {
4585
- const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? o.isPreview ? Et(this.authenticator.uri) : new kt(o.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
4698
+ const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? o.isPreview ? Et(this.authenticator.uri) : new Ct(o.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
4586
4699
  return this.card(
4587
4700
  this.t("twoFactor"),
4588
4701
  this.t("twoFactorDescription"),
@@ -4917,9 +5030,9 @@ let p = class extends E {
4917
5030
  ) : e.map(
4918
5031
  (i) => r`<div class="row">
4919
5032
  <div class="inline">
4920
- <span class="device">${Y(i.provider)}</span>
5033
+ <span class="device">${B(i.provider)}</span>
4921
5034
  <div class="row-main">
4922
- <span class="row-title">${W(i.provider)}</span>
5035
+ <span class="row-title">${N(i.provider)}</span>
4923
5036
  <span class="row-sub">${i.providerEmail || i.providerUid}</span>
4924
5037
  </div>
4925
5038
  </div>
@@ -4962,8 +5075,8 @@ let p = class extends E {
4962
5075
  }}
4963
5076
  ?disabled=${!!this.busy}
4964
5077
  >
4965
- ${this.spinner(`connect-${i}`)} ${Y(i)}
4966
- ${this.t("connectProvider", { provider: W(i) })}
5078
+ ${this.spinner(`connect-${i}`)} ${B(i)}
5079
+ ${this.t("connectProvider", { provider: N(i) })}
4967
5080
  </button>`
4968
5081
  )}` : void 0
4969
5082
  )}
@@ -4997,7 +5110,7 @@ let p = class extends E {
4997
5110
  };
4998
5111
  p.styles = [
4999
5112
  ...E.styles,
5000
- O`
5113
+ L`
5001
5114
  :host {
5002
5115
  display: block;
5003
5116
  width: 100%;
@@ -5093,117 +5206,117 @@ p.styles = [
5093
5206
  }
5094
5207
  `
5095
5208
  ];
5096
- m([
5097
- g({ type: Boolean })
5209
+ f([
5210
+ m({ type: Boolean })
5098
5211
  ], p.prototype, "embedded", 2);
5099
- m([
5100
- g({ type: String })
5212
+ f([
5213
+ m({ type: String })
5101
5214
  ], p.prototype, "tab", 2);
5102
- m([
5215
+ f([
5103
5216
  d()
5104
5217
  ], p.prototype, "active", 2);
5105
- m([
5218
+ f([
5106
5219
  d()
5107
5220
  ], p.prototype, "busy", 2);
5108
- m([
5221
+ f([
5109
5222
  d()
5110
5223
  ], p.prototype, "notice", 2);
5111
- m([
5224
+ f([
5112
5225
  d()
5113
5226
  ], p.prototype, "errors", 2);
5114
- m([
5227
+ f([
5115
5228
  d()
5116
5229
  ], p.prototype, "nameInput", 2);
5117
- m([
5230
+ f([
5118
5231
  d()
5119
5232
  ], p.prototype, "emailInput", 2);
5120
- m([
5233
+ f([
5121
5234
  d()
5122
5235
  ], p.prototype, "emailPassword", 2);
5123
- m([
5236
+ f([
5124
5237
  d()
5125
5238
  ], p.prototype, "phoneInput", 2);
5126
- m([
5239
+ f([
5127
5240
  d()
5128
5241
  ], p.prototype, "phonePassword", 2);
5129
- m([
5242
+ f([
5130
5243
  d()
5131
5244
  ], p.prototype, "phoneCode", 2);
5132
- m([
5245
+ f([
5133
5246
  d()
5134
5247
  ], p.prototype, "phoneCodeSent", 2);
5135
- m([
5248
+ f([
5136
5249
  d()
5137
5250
  ], p.prototype, "guestName", 2);
5138
- m([
5251
+ f([
5139
5252
  d()
5140
5253
  ], p.prototype, "oldPassword", 2);
5141
- m([
5254
+ f([
5142
5255
  d()
5143
5256
  ], p.prototype, "newPassword", 2);
5144
- m([
5257
+ f([
5145
5258
  d()
5146
5259
  ], p.prototype, "newPasswordConfirm", 2);
5147
- m([
5260
+ f([
5148
5261
  d()
5149
5262
  ], p.prototype, "authenticator", 2);
5150
- m([
5263
+ f([
5151
5264
  d()
5152
5265
  ], p.prototype, "authenticatorCode", 2);
5153
- m([
5266
+ f([
5154
5267
  d()
5155
5268
  ], p.prototype, "factors", 2);
5156
- m([
5269
+ f([
5157
5270
  d()
5158
5271
  ], p.prototype, "recoveryCodes", 2);
5159
- m([
5272
+ f([
5160
5273
  d()
5161
5274
  ], p.prototype, "stepUp", 2);
5162
- m([
5275
+ f([
5163
5276
  d()
5164
5277
  ], p.prototype, "stepUpCode", 2);
5165
- m([
5278
+ f([
5166
5279
  d()
5167
5280
  ], p.prototype, "copied", 2);
5168
- m([
5281
+ f([
5169
5282
  d()
5170
5283
  ], p.prototype, "sessions", 2);
5171
- m([
5284
+ f([
5172
5285
  d()
5173
5286
  ], p.prototype, "identities", 2);
5174
- m([
5287
+ f([
5175
5288
  d()
5176
5289
  ], p.prototype, "logs", 2);
5177
- m([
5290
+ f([
5178
5291
  d()
5179
5292
  ], p.prototype, "logsSupported", 2);
5180
- m([
5293
+ f([
5181
5294
  d()
5182
5295
  ], p.prototype, "confirmDelete", 2);
5183
- m([
5296
+ f([
5184
5297
  d()
5185
5298
  ], p.prototype, "confirmRegenerate", 2);
5186
- m([
5299
+ f([
5187
5300
  d()
5188
5301
  ], p.prototype, "confirmRemoveAuthenticator", 2);
5189
- m([
5302
+ f([
5190
5303
  d()
5191
5304
  ], p.prototype, "confirmSignOutAll", 2);
5192
- m([
5305
+ f([
5193
5306
  d()
5194
5307
  ], p.prototype, "confirmDisconnectId", 2);
5195
- m([
5308
+ f([
5196
5309
  d()
5197
5310
  ], p.prototype, "verifyEmailCooldownUntil", 2);
5198
- p = m([
5311
+ p = f([
5199
5312
  T("authui-account")
5200
5313
  ], p);
5201
- var Qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, F = (e, t, i, s) => {
5202
- for (var a = s > 1 ? void 0 : s ? Jt(t, i) : t, c = e.length - 1, u; c >= 0; c--)
5203
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
5204
- return s && a && Qt(t, i, a), a;
5314
+ var Jt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, R = (e, t, i, s) => {
5315
+ for (var a = s > 1 ? void 0 : s ? te(t, i) : t, u = e.length - 1, c; u >= 0; u--)
5316
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
5317
+ return s && a && Jt(t, i, a), a;
5205
5318
  };
5206
- let P = class extends E {
5319
+ let U = class extends E {
5207
5320
  constructor() {
5208
5321
  super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.scrollCue = !1, this.bodyResizeObserver = null, this.onOpenEvent = (e) => {
5209
5322
  const t = e.detail ?? {};
@@ -5299,9 +5412,9 @@ let P = class extends E {
5299
5412
  `;
5300
5413
  }
5301
5414
  };
5302
- P.styles = [
5415
+ U.styles = [
5303
5416
  ...E.styles,
5304
- O`
5417
+ L`
5305
5418
  :host {
5306
5419
  display: contents;
5307
5420
  }
@@ -5389,14 +5502,14 @@ P.styles = [
5389
5502
  }
5390
5503
  `
5391
5504
  ];
5392
- F([
5393
- g({ type: Boolean, reflect: !0 })
5394
- ], P.prototype, "open", 2);
5395
- F([
5396
- g({ type: String })
5397
- ], P.prototype, "view", 2);
5398
- F([
5399
- g({
5505
+ R([
5506
+ m({ type: Boolean, reflect: !0 })
5507
+ ], U.prototype, "open", 2);
5508
+ R([
5509
+ m({ type: String })
5510
+ ], U.prototype, "view", 2);
5511
+ R([
5512
+ m({
5400
5513
  attribute: "close-on-success",
5401
5514
  reflect: !0,
5402
5515
  converter: {
@@ -5410,28 +5523,28 @@ F([
5410
5523
  }
5411
5524
  }
5412
5525
  })
5413
- ], P.prototype, "closeOnSuccess", 2);
5414
- F([
5526
+ ], U.prototype, "closeOnSuccess", 2);
5527
+ R([
5415
5528
  d()
5416
- ], P.prototype, "handledPending", 2);
5417
- F([
5529
+ ], U.prototype, "handledPending", 2);
5530
+ R([
5418
5531
  d()
5419
- ], P.prototype, "scrollCue", 2);
5420
- F([
5421
- st("dialog")
5422
- ], P.prototype, "dialog", 2);
5423
- F([
5424
- st(".body")
5425
- ], P.prototype, "bodyEl", 2);
5426
- P = F([
5532
+ ], U.prototype, "scrollCue", 2);
5533
+ R([
5534
+ rt("dialog")
5535
+ ], U.prototype, "dialog", 2);
5536
+ R([
5537
+ rt(".body")
5538
+ ], U.prototype, "bodyEl", 2);
5539
+ U = R([
5427
5540
  T("authui-modal")
5428
- ], P);
5429
- var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, Q = (e, t, i, s) => {
5430
- for (var a = s > 1 ? void 0 : s ? ee(t, i) : t, c = e.length - 1, u; c >= 0; c--)
5431
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
5432
- return s && a && te(t, i, a), a;
5541
+ ], U);
5542
+ var ee = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, J = (e, t, i, s) => {
5543
+ for (var a = s > 1 ? void 0 : s ? ie(t, i) : t, u = e.length - 1, c; u >= 0; u--)
5544
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
5545
+ return s && a && ee(t, i, a), a;
5433
5546
  };
5434
- let L = class extends E {
5547
+ let q = class extends E {
5435
5548
  constructor() {
5436
5549
  super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
5437
5550
  }
@@ -5439,7 +5552,7 @@ let L = class extends E {
5439
5552
  const e = this.size === "md" ? "" : `btn-${this.size}`;
5440
5553
  return r`<button
5441
5554
  class="btn btn-${this.variant} ${e}"
5442
- @click=${() => Z(this.view)}
5555
+ @click=${() => X(this.view)}
5443
5556
  part="button"
5444
5557
  >
5445
5558
  <slot
@@ -5448,9 +5561,9 @@ let L = class extends E {
5448
5561
  </button>`;
5449
5562
  }
5450
5563
  };
5451
- L.styles = [
5564
+ q.styles = [
5452
5565
  ...E.styles,
5453
- O`
5566
+ L`
5454
5567
  :host {
5455
5568
  display: inline-block;
5456
5569
  }
@@ -5459,26 +5572,26 @@ L.styles = [
5459
5572
  }
5460
5573
  `
5461
5574
  ];
5462
- Q([
5463
- g({ type: String })
5464
- ], L.prototype, "view", 2);
5465
- Q([
5466
- g({ type: String })
5467
- ], L.prototype, "variant", 2);
5468
- Q([
5469
- g({ type: String })
5470
- ], L.prototype, "size", 2);
5471
- L = Q([
5575
+ J([
5576
+ m({ type: String })
5577
+ ], q.prototype, "view", 2);
5578
+ J([
5579
+ m({ type: String })
5580
+ ], q.prototype, "variant", 2);
5581
+ J([
5582
+ m({ type: String })
5583
+ ], q.prototype, "size", 2);
5584
+ q = J([
5472
5585
  T("authui-button")
5473
- ], L);
5474
- var ie = Object.defineProperty, se = Object.getOwnPropertyDescriptor, R = (e, t, i, s) => {
5475
- for (var a = s > 1 ? void 0 : s ? se(t, i) : t, c = e.length - 1, u; c >= 0; c--)
5476
- (u = e[c]) && (a = (s ? u(t, i, a) : u(a)) || a);
5477
- return s && a && ie(t, i, a), a;
5586
+ ], q);
5587
+ var se = Object.defineProperty, re = Object.getOwnPropertyDescriptor, F = (e, t, i, s) => {
5588
+ for (var a = s > 1 ? void 0 : s ? re(t, i) : t, u = e.length - 1, c; u >= 0; u--)
5589
+ (c = e[u]) && (a = (s ? c(t, i, a) : c(a)) || a);
5590
+ return s && a && se(t, i, a), a;
5478
5591
  };
5479
5592
  let I = class extends E {
5480
5593
  constructor() {
5481
- super(...arguments), this.showTeams = !1, this.src = "", this.menuOpen = !1, this.menuAbove = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onReposition = () => {
5594
+ super(...arguments), this.showTeams = !1, this.menuItems = [], this.src = "", this.menuOpen = !1, this.menuAbove = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onReposition = () => {
5482
5595
  this.menuOpen && this.placeMenu();
5483
5596
  }, this.onDocumentClick = (e) => {
5484
5597
  e.composedPath().includes(this) || (this.menuOpen = !1);
@@ -5521,10 +5634,10 @@ let I = class extends E {
5521
5634
  if (!e || !t) return;
5522
5635
  const i = e.getBoundingClientRect(), s = 6, a = 8;
5523
5636
  t.style.maxHeight = "";
5524
- const c = t.offsetHeight + s, u = window.innerHeight - i.bottom, b = i.top, $ = u < c && b > u;
5525
- $ !== this.menuAbove && (this.menuAbove = $);
5526
- const ot = Math.max(80, ($ ? b : u) - s - a);
5527
- t.style.maxHeight = `${ot}px`;
5637
+ const u = t.offsetHeight + s, c = window.innerHeight - i.bottom, v = i.top, y = c < u && v > c;
5638
+ y !== this.menuAbove && (this.menuAbove = y);
5639
+ const S = Math.max(80, (y ? v : c) - s - a);
5640
+ t.style.maxHeight = `${S}px`;
5528
5641
  }
5529
5642
  focusMenuItem(e) {
5530
5643
  [
@@ -5551,7 +5664,7 @@ let I = class extends E {
5551
5664
  if (e === "loading" && i)
5552
5665
  return r`<span class="avatar"><span class="spinner"></span></span>`;
5553
5666
  if (e !== "signed-in" || !t)
5554
- return r`<button class="btn btn-primary btn-sm" @click=${() => Z("sign-in")}>
5667
+ return r`<button class="btn btn-primary btn-sm" @click=${() => X("sign-in")}>
5555
5668
  <slot>${this.t("signIn")}</slot>
5556
5669
  </button>`;
5557
5670
  const s = t.name || t.email || t.phone || this.t("guestAccount");
@@ -5564,7 +5677,7 @@ let I = class extends E {
5564
5677
  aria-label=${s}
5565
5678
  >
5566
5679
  <span class="avatar"
5567
- >${this.src ? r`<img src=${this.src} alt="" />` : nt(s)}</span
5680
+ >${this.src ? r`<img src=${this.src} alt="" />` : ot(s)}</span
5568
5681
  >
5569
5682
  </button>
5570
5683
  ${this.menuOpen ? r`<div class="menu ${this.menuAbove ? "above" : ""}" role="menu">
@@ -5589,11 +5702,13 @@ let I = class extends E {
5589
5702
  </button>`
5590
5703
  )}
5591
5704
  </div>` : n}
5705
+ ${this.renderCustomMenuItems()}
5706
+ <slot name="menu-items"></slot>
5592
5707
  <button
5593
5708
  class="menu-item"
5594
5709
  role="menuitem"
5595
5710
  @click=${() => {
5596
- this.menuOpen = !1, Z("account");
5711
+ this.menuOpen = !1, X("account");
5597
5712
  }}
5598
5713
  >
5599
5714
  ${l.settings} ${this.t("manageAccount")}
@@ -5610,10 +5725,46 @@ let I = class extends E {
5610
5725
  </div>` : n}
5611
5726
  `;
5612
5727
  }
5728
+ renderCustomMenuItems() {
5729
+ return this.menuItems?.length ? this.menuItems.map((e) => {
5730
+ if (e.href) {
5731
+ const i = e.target;
5732
+ return r`<a
5733
+ class="menu-item"
5734
+ role="menuitem"
5735
+ href=${e.href}
5736
+ target=${i || n}
5737
+ rel=${i === "_blank" ? "noopener noreferrer" : n}
5738
+ @click=${() => {
5739
+ this.menuOpen = !1;
5740
+ }}
5741
+ >
5742
+ ${e.label}
5743
+ </a>`;
5744
+ }
5745
+ const t = e.actionId;
5746
+ return r`<button
5747
+ class="menu-item"
5748
+ role="menuitem"
5749
+ type="button"
5750
+ @click=${() => {
5751
+ this.menuOpen = !1, t && this.dispatchEvent(
5752
+ new CustomEvent("authui-menu-action", {
5753
+ detail: { actionId: t },
5754
+ bubbles: !0,
5755
+ composed: !0
5756
+ })
5757
+ );
5758
+ }}
5759
+ >
5760
+ ${e.label}
5761
+ </button>`;
5762
+ }) : n;
5763
+ }
5613
5764
  };
5614
5765
  I.styles = [
5615
5766
  ...E.styles,
5616
- O`
5767
+ L`
5617
5768
  :host {
5618
5769
  display: inline-block;
5619
5770
  position: relative;
@@ -5702,6 +5853,10 @@ I.styles = [
5702
5853
  height: 16px;
5703
5854
  color: var(--authui-muted-foreground);
5704
5855
  }
5856
+ a.menu-item {
5857
+ text-decoration: none;
5858
+ box-sizing: border-box;
5859
+ }
5705
5860
  .menu-section {
5706
5861
  border-top: 1px solid var(--authui-border);
5707
5862
  margin-top: 4px;
@@ -5729,60 +5884,63 @@ I.styles = [
5729
5884
  }
5730
5885
  `
5731
5886
  ];
5732
- R([
5733
- g({ type: Boolean, attribute: "show-teams" })
5887
+ F([
5888
+ m({ type: Boolean, attribute: "show-teams" })
5734
5889
  ], I.prototype, "showTeams", 2);
5735
- R([
5736
- g({ type: String })
5890
+ F([
5891
+ m({ attribute: !1 })
5892
+ ], I.prototype, "menuItems", 2);
5893
+ F([
5894
+ m({ type: String })
5737
5895
  ], I.prototype, "src", 2);
5738
- R([
5896
+ F([
5739
5897
  d()
5740
5898
  ], I.prototype, "menuOpen", 2);
5741
- R([
5899
+ F([
5742
5900
  d()
5743
5901
  ], I.prototype, "menuAbove", 2);
5744
- R([
5902
+ F([
5745
5903
  d()
5746
5904
  ], I.prototype, "teams", 2);
5747
- R([
5905
+ F([
5748
5906
  d()
5749
5907
  ], I.prototype, "teamsLoading", 2);
5750
- R([
5908
+ F([
5751
5909
  d()
5752
5910
  ], I.prototype, "activeTeamId", 2);
5753
- I = R([
5911
+ I = F([
5754
5912
  T("authui-user-button")
5755
5913
  ], I);
5756
5914
  export {
5757
- Ft as A,
5758
- le as C,
5759
- f as E,
5915
+ Lt as A,
5916
+ ce as C,
5917
+ g as E,
5760
5918
  bt as F,
5761
- It as P,
5919
+ Ut as P,
5762
5920
  o as a,
5763
5921
  p as b,
5764
- ce as c,
5765
- L as d,
5766
- y as e,
5922
+ de as c,
5923
+ q as d,
5924
+ w as e,
5767
5925
  E as f,
5768
- P as g,
5769
- N as h,
5770
- k as i,
5926
+ U as g,
5927
+ H as h,
5928
+ x as i,
5771
5929
  I as j,
5772
- oe as k,
5930
+ le as k,
5773
5931
  pt as l,
5774
- Ct as m,
5775
- K as n,
5776
- Z as o,
5777
- z as p,
5778
- ut as q,
5779
- Ut as r,
5780
- W as s,
5932
+ St as m,
5933
+ Y as n,
5934
+ X as o,
5935
+ D as p,
5936
+ ht as q,
5937
+ Mt as r,
5938
+ N as s,
5781
5939
  V as t,
5782
5940
  wt as u,
5783
- it as v,
5784
- Mt as w,
5785
- Ot as x,
5941
+ st as v,
5942
+ Ot as w,
5943
+ Ft as x,
5786
5944
  _ as y,
5787
- jt as z
5945
+ Wt as z
5788
5946
  };