@getauthui/core 0.1.1 → 0.1.2

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 f, customElement as I, query as rt } from "lit/decorators.js";
2
- import { css as E, LitElement as K, nothing as o, html as s, svg as l } from "lit";
3
- import { Client as nt, Account as ot, ID as L, Avatars as ct } from "appwrite";
4
- const lt = {
1
+ import { state as d, property as f, customElement as _, query as rt } from "lit/decorators.js";
2
+ import { css as I, LitElement as X, nothing as o, html as s, svg as l } from "lit";
3
+ import { Client as ot, Account as ct, ID as V, Avatars as lt } from "appwrite";
4
+ const dt = {
5
5
  signIn: "Sign in",
6
6
  signUp: "Sign up",
7
7
  signOut: "Sign out",
@@ -123,13 +123,13 @@ const lt = {
123
123
  guestAccountDescription: "Add an email and password to keep your data.",
124
124
  preview: "Preview"
125
125
  };
126
- function dt(e, t = {}) {
126
+ function ht(e, t = {}) {
127
127
  return e.replace(
128
128
  /\{(\w+)\}/g,
129
129
  (i, r) => r in t ? String(t[r]) : `{${r}}`
130
130
  );
131
131
  }
132
- const ht = {
132
+ const ut = {
133
133
  amazon: "Amazon",
134
134
  apple: "Apple",
135
135
  appwrite: "Appwrite",
@@ -180,10 +180,10 @@ const ht = {
180
180
  zoho: "Zoho",
181
181
  zoom: "Zoom"
182
182
  };
183
- function O(e) {
184
- return ht[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
183
+ function D(e) {
184
+ return ut[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
185
185
  }
186
- const V = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), S = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(), q = [
186
+ const q = (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(), T = [
187
187
  "amber",
188
188
  "brave",
189
189
  "calm",
@@ -196,13 +196,13 @@ const V = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
196
196
  "juniper",
197
197
  "kite",
198
198
  "lumen"
199
- ], Z = () => `${q[Math.floor(Math.random() * q.length)]}-${q[Math.floor(Math.random() * q.length)]}`, _ = () => Math.random().toString(36).slice(2, 12), J = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), ut = {
199
+ ], Z = () => `${T[Math.floor(Math.random() * T.length)]}-${T[Math.floor(Math.random() * T.length)]}`, F = () => Math.random().toString(36).slice(2, 12), J = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), pt = {
200
200
  name: "Ada Lovelace",
201
201
  email: "ada@example.com",
202
202
  phone: "+15550100"
203
203
  };
204
- class pt {
205
- constructor(t = ut) {
204
+ class ft {
205
+ constructor(t = pt) {
206
206
  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;
207
207
  }
208
208
  // ───────────────────────── helpers ─────────────────────────
@@ -211,7 +211,7 @@ class pt {
211
211
  return this.user = {
212
212
  $id: "preview-user",
213
213
  $createdAt: M(1440 * 30),
214
- $updatedAt: S(),
214
+ $updatedAt: P(),
215
215
  name: i ? "" : t.name ?? this.seed.name,
216
216
  registration: M(1440 * 30),
217
217
  status: !0,
@@ -224,14 +224,14 @@ class pt {
224
224
  mfa: this.mfaEnabled,
225
225
  prefs: {},
226
226
  targets: [],
227
- accessedAt: S()
227
+ accessedAt: P()
228
228
  }, this.seedActivity(i ? "anonymous" : "email"), this.user;
229
229
  }
230
230
  seedActivity(t) {
231
231
  if (this.sessions.length > 0) return;
232
232
  const i = {
233
- $createdAt: S(),
234
- $updatedAt: S(),
233
+ $createdAt: P(),
234
+ $updatedAt: P(),
235
235
  userId: "preview-user",
236
236
  expire: new Date(Date.now() + 365 * 864e5).toISOString(),
237
237
  providerUid: "",
@@ -266,7 +266,7 @@ class pt {
266
266
  },
267
267
  {
268
268
  ...i,
269
- $id: _(),
269
+ $id: F(),
270
270
  $createdAt: M(300),
271
271
  provider: t,
272
272
  ip: "198.51.100.7",
@@ -283,7 +283,7 @@ class pt {
283
283
  },
284
284
  {
285
285
  ...i,
286
- $id: _(),
286
+ $id: F(),
287
287
  $createdAt: M(1440 * 3),
288
288
  provider: "oauth2",
289
289
  ip: "192.0.2.90",
@@ -312,7 +312,7 @@ class pt {
312
312
  ], this.logs = [
313
313
  {
314
314
  event: "session.create",
315
- time: S(),
315
+ time: P(),
316
316
  clientName: "Chrome",
317
317
  osName: "macOS",
318
318
  countryName: "Germany",
@@ -338,9 +338,9 @@ class pt {
338
338
  }
339
339
  requireUser() {
340
340
  if (!this.user)
341
- throw V("general_unauthorized_scope", "User (role: guests) missing scope (account)");
341
+ throw q("general_unauthorized_scope", "User (role: guests) missing scope (account)");
342
342
  if (this.mfaPending)
343
- throw V(
343
+ throw q(
344
344
  "user_more_factors_required",
345
345
  "More factors are required to complete the sign in process."
346
346
  );
@@ -348,7 +348,7 @@ class pt {
348
348
  }
349
349
  requireRecentChallenge() {
350
350
  if (Date.now() - this.lastChallenge > 30 * 6e4)
351
- throw V(
351
+ throw q(
352
352
  "user_challenge_required",
353
353
  "A recently successful challenge is required to complete this action."
354
354
  );
@@ -384,8 +384,8 @@ class pt {
384
384
  }
385
385
  async createMagicURLToken(t, i) {
386
386
  return this.tokens.set(t, { email: i }), this.delay({
387
- $id: _(),
388
- $createdAt: S(),
387
+ $id: F(),
388
+ $createdAt: P(),
389
389
  userId: t,
390
390
  secret: "",
391
391
  expire: "",
@@ -394,8 +394,8 @@ class pt {
394
394
  }
395
395
  async createEmailToken(t, i) {
396
396
  return this.tokens.set(t, { email: i }), this.delay({
397
- $id: _(),
398
- $createdAt: S(),
397
+ $id: F(),
398
+ $createdAt: P(),
399
399
  userId: t,
400
400
  secret: "",
401
401
  expire: "",
@@ -403,7 +403,7 @@ class pt {
403
403
  });
404
404
  }
405
405
  async createPhoneToken(t, i) {
406
- return this.tokens.set(t, { phone: i }), this.delay({ $id: _(), $createdAt: S(), userId: t, secret: "", expire: "", phrase: "" });
406
+ return this.tokens.set(t, { phone: i }), this.delay({ $id: F(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
407
407
  }
408
408
  async createSession(t) {
409
409
  return this.delay(() => {
@@ -444,7 +444,7 @@ class pt {
444
444
  async updateEmail(t) {
445
445
  return this.delay(() => {
446
446
  const i = this.requireUser();
447
- return i.email = t, i.emailVerification = !1, i.passwordUpdate = S(), i;
447
+ return i.email = t, i.emailVerification = !1, i.passwordUpdate = P(), i;
448
448
  });
449
449
  }
450
450
  async updatePhone(t) {
@@ -456,7 +456,7 @@ class pt {
456
456
  async updatePassword() {
457
457
  return this.delay(() => {
458
458
  const t = this.requireUser();
459
- return t.passwordUpdate = S(), t;
459
+ return t.passwordUpdate = P(), t;
460
460
  });
461
461
  }
462
462
  async updateStatus() {
@@ -492,7 +492,7 @@ class pt {
492
492
  });
493
493
  }
494
494
  async createMFAChallenge() {
495
- return this.delay({ $id: _(), $createdAt: S(), userId: "preview-user", expire: "" });
495
+ return this.delay({ $id: F(), $createdAt: P(), userId: "preview-user", expire: "" });
496
496
  }
497
497
  async updateMFAChallenge() {
498
498
  return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
@@ -521,7 +521,7 @@ class pt {
521
521
  async createMFARecoveryCodes() {
522
522
  return this.delay(() => {
523
523
  if (this.recoveryCodes.length > 0)
524
- throw V("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
524
+ throw q("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
525
525
  return this.recoveryCodes = Array.from({ length: 6 }, J), { recoveryCodes: this.recoveryCodes };
526
526
  });
527
527
  }
@@ -536,16 +536,16 @@ class pt {
536
536
  this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
537
537
  }
538
538
  }
539
- function ft(e) {
539
+ function mt(e) {
540
540
  let t = 2166136261;
541
541
  const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
542
- for (const k of e) t = (t ^ k.charCodeAt(0)) * 16777619;
542
+ for (const x of e) t = (t ^ x.charCodeAt(0)) * 16777619;
543
543
  const r = 25;
544
544
  let a = "";
545
- const h = (k, A) => `<rect x="${k}" y="${A}" width="7" height="7"/><rect x="${k + 1}" y="${A + 1}" width="5" height="5" fill="#fff"/><rect x="${k + 2}" y="${A + 2}" width="3" height="3"/>`;
546
- for (let k = 0; k < r; k++)
547
- for (let A = 0; A < r; A++)
548
- !(A < 8 && k < 8 || A >= r - 8 && k < 8 || A < 8 && k >= r - 8) && i() < 0.45 && (a += `<rect x="${A}" y="${k}" width="1" height="1"/>`);
545
+ const h = (x, S) => `<rect x="${x}" y="${S}" width="7" height="7"/><rect x="${x + 1}" y="${S + 1}" width="5" height="5" fill="#fff"/><rect x="${x + 2}" y="${S + 2}" width="3" height="3"/>`;
546
+ for (let x = 0; x < r; x++)
547
+ for (let S = 0; S < r; S++)
548
+ !(S < 8 && x < 8 || S >= r - 8 && x < 8 || S < 8 && x >= r - 8) && i() < 0.45 && (a += `<rect x="${S}" y="${x}" width="1" height="1"/>`);
549
549
  const u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r} ${r}" shape-rendering="crispEdges"><rect width="${r}" height="${r}" fill="#fff"/><g fill="#000">${h(0, 0)}${h(r - 7, 0)}${h(0, r - 7)}${a}</g></svg>`;
550
550
  return `data:image/svg+xml;utf8,${encodeURIComponent(u)}`;
551
551
  }
@@ -581,7 +581,7 @@ const v = {
581
581
  countMaxExceeded: "user_count_exceeded",
582
582
  targetAlreadyExists: "user_target_already_exists"
583
583
  };
584
- function T(e) {
584
+ function N(e) {
585
585
  if (e && typeof e == "object") {
586
586
  const t = e;
587
587
  return {
@@ -592,11 +592,11 @@ function T(e) {
592
592
  }
593
593
  return { message: String(e), type: "", code: 0 };
594
594
  }
595
- function N(e, t) {
596
- return T(e).type === t;
595
+ function B(e, t) {
596
+ return N(e).type === t;
597
597
  }
598
598
  function at(e, t, i = "link") {
599
- const r = T(e);
599
+ const r = N(e);
600
600
  switch (r.type) {
601
601
  case v.invalidCredentials:
602
602
  return t.errorInvalidCredentials;
@@ -634,7 +634,7 @@ function at(e, t, i = "link") {
634
634
  }
635
635
  return r.code === 0 && /fetch|network/i.test(r.message) ? t.errorNetwork : r.message || t.errorGeneric;
636
636
  }
637
- function C(e, t, i) {
637
+ function k(e, t, i) {
638
638
  for (const r of t) {
639
639
  const a = e[r];
640
640
  if (typeof a == "function")
@@ -644,21 +644,21 @@ function C(e, t, i) {
644
644
  new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
645
645
  );
646
646
  }
647
- const W = "authui", tt = ["userId", "secret", "expire", "project", "error", W], et = () => ({
647
+ const G = "authui", tt = ["userId", "secret", "expire", "project", "error", G], et = () => ({
648
648
  status: "loading",
649
649
  user: null,
650
650
  mfaFactors: null,
651
651
  pending: null,
652
652
  configured: !1
653
653
  });
654
- class mt {
654
+ class gt {
655
655
  constructor() {
656
656
  this.client = null, this.account = null, this.config = null, this.state = et(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null;
657
657
  }
658
658
  // ───────────────────────────── configuration ─────────────────────────────
659
659
  /** Configure the Appwrite client. Safe to call more than once; the last call wins. */
660
660
  configure(t) {
661
- this.config = t, this.client = new nt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new pt() : null, this.account = this.preview ? this.preview : new ot(this.client), this.setState({ configured: !0, status: "loading" }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
661
+ this.config = t, this.client = new ot().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new ft() : null, this.account = this.preview ? this.preview : new ct(this.client), this.setState({ configured: !0, status: "loading" }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
662
662
  }
663
663
  get isConfigured() {
664
664
  return this.config !== null;
@@ -686,7 +686,7 @@ class mt {
686
686
  return this.account;
687
687
  }
688
688
  getStrings() {
689
- return { ...lt, ...this.config?.strings ?? {} };
689
+ return { ...dt, ...this.config?.strings ?? {} };
690
690
  }
691
691
  getState() {
692
692
  return { ...this.state };
@@ -712,7 +712,7 @@ class mt {
712
712
  this.state = { ...this.state, ...t }, this.emit("change", this.getState());
713
713
  }
714
714
  fail(t) {
715
- const i = T(t);
715
+ const i = N(t);
716
716
  throw this.emit("error", i), t;
717
717
  }
718
718
  acct() {
@@ -732,10 +732,10 @@ class mt {
732
732
  const i = await this.account.get();
733
733
  this.setState({ status: "signed-in", user: i, mfaFactors: null }), t || this.emit("signed-in", i);
734
734
  } catch (i) {
735
- if (N(i, v.moreFactorsRequired)) {
735
+ if (B(i, v.moreFactorsRequired)) {
736
736
  let r = null;
737
737
  try {
738
- r = await C(
738
+ r = await k(
739
739
  this.account,
740
740
  ["listMFAFactors", "listMfaFactors"],
741
741
  []
@@ -766,7 +766,7 @@ class mt {
766
766
  }
767
767
  async signUp(t, i, r) {
768
768
  try {
769
- await this.acct().create(L.unique(), t.trim(), i, r?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
769
+ await this.acct().create(V.unique(), t.trim(), i, r?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
770
770
  } catch (a) {
771
771
  this.fail(a);
772
772
  }
@@ -809,7 +809,7 @@ class mt {
809
809
  async sendMagicUrl(t) {
810
810
  try {
811
811
  return await this.acct().createMagicURLToken(
812
- L.unique(),
812
+ V.unique(),
813
813
  t.trim(),
814
814
  this.redirectUrl("magic-url"),
815
815
  this.config?.securityPhrase ?? !0
@@ -821,7 +821,7 @@ class mt {
821
821
  async sendEmailOtp(t) {
822
822
  try {
823
823
  return await this.acct().createEmailToken(
824
- L.unique(),
824
+ V.unique(),
825
825
  t.trim(),
826
826
  this.config?.securityPhrase ?? !0
827
827
  );
@@ -831,7 +831,7 @@ class mt {
831
831
  }
832
832
  async sendPhoneOtp(t) {
833
833
  try {
834
- return await this.acct().createPhoneToken(L.unique(), t.replace(/[\s()-]/g, ""));
834
+ return await this.acct().createPhoneToken(V.unique(), t.replace(/[\s()-]/g, ""));
835
835
  } catch (i) {
836
836
  return this.fail(i);
837
837
  }
@@ -848,7 +848,7 @@ class mt {
848
848
  // ─────────────────────────────── MFA ───────────────────────────────
849
849
  async createMfaChallenge(t) {
850
850
  try {
851
- return await C(
851
+ return await k(
852
852
  this.acct(),
853
853
  ["createMFAChallenge", "createMfaChallenge"],
854
854
  [t]
@@ -860,7 +860,7 @@ class mt {
860
860
  /** Verify a challenge. Completes a pending sign in, or acts as a step-up for protected actions. */
861
861
  async completeMfaChallenge(t, i, r = {}) {
862
862
  try {
863
- await C(
863
+ await k(
864
864
  this.acct(),
865
865
  ["updateMFAChallenge", "updateMfaChallenge"],
866
866
  [t, i.trim()]
@@ -872,7 +872,7 @@ class mt {
872
872
  }
873
873
  async listMfaFactors() {
874
874
  try {
875
- return await C(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
875
+ return await k(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
876
876
  } catch (t) {
877
877
  return this.fail(t);
878
878
  }
@@ -887,7 +887,7 @@ class mt {
887
887
  }
888
888
  async addAuthenticator() {
889
889
  try {
890
- return await C(
890
+ return await k(
891
891
  this.acct(),
892
892
  ["createMFAAuthenticator", "createMfaAuthenticator"],
893
893
  ["totp"]
@@ -898,7 +898,7 @@ class mt {
898
898
  }
899
899
  async verifyAuthenticator(t) {
900
900
  try {
901
- await C(
901
+ await k(
902
902
  this.acct(),
903
903
  ["updateMFAAuthenticator", "updateMfaAuthenticator"],
904
904
  ["totp", t.trim()]
@@ -911,7 +911,7 @@ class mt {
911
911
  /** Requires a recent MFA challenge (server rejects with user_challenge_required otherwise). */
912
912
  async removeAuthenticator() {
913
913
  try {
914
- await C(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
914
+ await k(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
915
915
  } catch (t) {
916
916
  this.fail(t);
917
917
  }
@@ -919,7 +919,7 @@ class mt {
919
919
  }
920
920
  async createRecoveryCodes() {
921
921
  try {
922
- return (await C(
922
+ return (await k(
923
923
  this.acct(),
924
924
  ["createMFARecoveryCodes", "createMfaRecoveryCodes"],
925
925
  []
@@ -931,7 +931,7 @@ class mt {
931
931
  /** Requires a recent MFA challenge. */
932
932
  async regenerateRecoveryCodes() {
933
933
  try {
934
- return (await C(
934
+ return (await k(
935
935
  this.acct(),
936
936
  ["updateMFARecoveryCodes", "updateMfaRecoveryCodes"],
937
937
  []
@@ -943,7 +943,7 @@ class mt {
943
943
  /** Requires a recent MFA challenge. */
944
944
  async getRecoveryCodes() {
945
945
  try {
946
- return (await C(
946
+ return (await k(
947
947
  this.acct(),
948
948
  ["getMFARecoveryCodes", "getMfaRecoveryCodes"],
949
949
  []
@@ -1057,7 +1057,7 @@ class mt {
1057
1057
  }
1058
1058
  async sendEmailVerification() {
1059
1059
  try {
1060
- await C(
1060
+ await k(
1061
1061
  this.acct(),
1062
1062
  ["createEmailVerification", "createVerification"],
1063
1063
  [this.redirectUrl("verify-email")]
@@ -1098,7 +1098,7 @@ class mt {
1098
1098
  redirectUrl(t) {
1099
1099
  const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), r = new URL(i, typeof window < "u" ? window.location.href : void 0);
1100
1100
  for (const a of tt) r.searchParams.delete(a);
1101
- return r.searchParams.set(W, t), r.toString();
1101
+ return r.searchParams.set(G, t), r.toString();
1102
1102
  }
1103
1103
  setPending(t) {
1104
1104
  this.setState({ pending: t });
@@ -1109,7 +1109,7 @@ class mt {
1109
1109
  */
1110
1110
  async handleRedirect() {
1111
1111
  if (typeof window > "u") return !1;
1112
- const t = new URLSearchParams(window.location.search), i = t.get(W);
1112
+ const t = new URLSearchParams(window.location.search), i = t.get(G);
1113
1113
  if (!i) return !1;
1114
1114
  const r = t.get("userId") ?? "", a = t.get("secret") ?? "";
1115
1115
  this.cleanUrl();
@@ -1126,7 +1126,7 @@ class mt {
1126
1126
  r && a && this.setState({ pending: { type: "reset-password", userId: r, secret: a } });
1127
1127
  break;
1128
1128
  case "verify-email":
1129
- r && a && (await C(
1129
+ r && a && (await k(
1130
1130
  this.acct(),
1131
1131
  ["updateEmailVerification", "updateVerification"],
1132
1132
  [r, a]
@@ -1140,7 +1140,7 @@ class mt {
1140
1140
  break;
1141
1141
  }
1142
1142
  } catch (h) {
1143
- const u = T(h);
1143
+ const u = N(h);
1144
1144
  this.emit("error", u), this.setState({ pending: { type: "notice", message: u.message, tone: "error" } });
1145
1145
  }
1146
1146
  return !0;
@@ -1155,8 +1155,8 @@ class mt {
1155
1155
  this.client = null, this.account = null, this.preview = null, this.config = null, this.state = et(), this.listeners.clear();
1156
1156
  }
1157
1157
  }
1158
- const n = new mt();
1159
- class gt {
1158
+ const n = new gt();
1159
+ class vt {
1160
1160
  constructor() {
1161
1161
  this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
1162
1162
  const t = this.isDark("auto");
@@ -1184,14 +1184,14 @@ class gt {
1184
1184
  this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
1185
1185
  }
1186
1186
  }
1187
- const it = new gt(), st = {
1187
+ const it = new vt(), st = {
1188
1188
  none: "0px",
1189
1189
  sm: "0.25rem",
1190
1190
  md: "0.625rem",
1191
1191
  lg: "0.875rem",
1192
1192
  xl: "1.125rem",
1193
1193
  full: "1.5rem"
1194
- }, vt = E`
1194
+ }, bt = I`
1195
1195
  :host {
1196
1196
  /* Light theme (matches :root in the console) */
1197
1197
  --authui-background: oklch(1 0 0);
@@ -1269,7 +1269,7 @@ const it = new gt(), st = {
1269
1269
  --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
1270
1270
  color-scheme: dark;
1271
1271
  }
1272
- `, bt = E`
1272
+ `, yt = I`
1273
1273
  *,
1274
1274
  *::before,
1275
1275
  *::after {
@@ -2012,29 +2012,33 @@ const it = new gt(), st = {
2012
2012
  }
2013
2013
  }
2014
2014
  `;
2015
- var yt = Object.defineProperty, wt = (e, t, i, r) => {
2015
+ var wt = Object.defineProperty, $t = (e, t, i, r) => {
2016
2016
  for (var a = void 0, h = e.length - 1, u; h >= 0; h--)
2017
2017
  (u = e[h]) && (a = u(t, i, a) || a);
2018
- return a && yt(t, i, a), a;
2019
- };
2020
- const Q = class Q extends K {
2018
+ return a && wt(t, i, a), a;
2019
+ }, U;
2020
+ const nt = (U = class extends X {
2021
2021
  constructor() {
2022
- super(...arguments), this.auth = n.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2022
+ super(...arguments), this.auth = n.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
2023
2023
  }
2024
2024
  connectedCallback() {
2025
- super.connectedCallback(), this.auth = n.getState(), this.unsubscribeStore = n.on("change", (t) => {
2025
+ super.connectedCallback();
2026
+ for (const t of U.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
2027
+ this.auth = n.getState(), this.unsubscribeStore = n.on("change", (t) => {
2026
2028
  this.auth = t, this.applyBranding();
2027
2029
  }), this.unsubscribeTheme = it.subscribe(() => this.applyBranding()), this.applyBranding();
2028
2030
  }
2029
2031
  disconnectedCallback() {
2030
- super.disconnectedCallback(), this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2032
+ super.disconnectedCallback();
2033
+ for (const t of U.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
2034
+ this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2031
2035
  }
2032
2036
  get strings() {
2033
2037
  return n.getStrings();
2034
2038
  }
2035
2039
  /** Translate a string key with optional `{placeholders}`. */
2036
2040
  t(t, i) {
2037
- return dt(this.strings[t], i);
2041
+ return ht(this.strings[t], i);
2038
2042
  }
2039
2043
  get config() {
2040
2044
  return n.getConfig();
@@ -2054,18 +2058,17 @@ const Q = class Q extends K {
2054
2058
  fire(t, i) {
2055
2059
  this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
2056
2060
  }
2057
- };
2058
- Q.styles = [vt, bt];
2059
- let x = Q;
2060
- wt([
2061
+ }, U.styles = [bt, yt], U.KEY_EVENTS = ["keydown", "keyup", "keypress"], U);
2062
+ $t([
2061
2063
  d()
2062
- ], x.prototype, "auth");
2063
- var $t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, y = (e, t, i, r) => {
2064
- for (var a = r > 1 ? void 0 : r ? xt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2064
+ ], nt.prototype, "auth");
2065
+ let A = nt;
2066
+ var xt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, y = (e, t, i, r) => {
2067
+ for (var a = r > 1 ? void 0 : r ? kt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2065
2068
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2066
- return r && a && $t(t, i, a), a;
2069
+ return r && a && xt(t, i, a), a;
2067
2070
  };
2068
- let b = class extends K {
2071
+ let b = class extends X {
2069
2072
  constructor() {
2070
2073
  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 = "";
2071
2074
  }
@@ -2110,7 +2113,7 @@ let b = class extends K {
2110
2113
  };
2111
2114
  }
2112
2115
  };
2113
- b.styles = E`
2116
+ b.styles = I`
2114
2117
  :host {
2115
2118
  display: none;
2116
2119
  }
@@ -2170,22 +2173,22 @@ y([
2170
2173
  f({ type: String })
2171
2174
  ], b.prototype, "preview", 2);
2172
2175
  b = y([
2173
- I("authui-config")
2176
+ _("authui-config")
2174
2177
  ], b);
2175
- var kt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, B = (e, t, i, r) => {
2176
- for (var a = r > 1 ? void 0 : r ? Ct(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2178
+ var Ct = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, H = (e, t, i, r) => {
2179
+ for (var a = r > 1 ? void 0 : r ? Pt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2177
2180
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2178
- return r && a && kt(t, i, a), a;
2181
+ return r && a && Ct(t, i, a), a;
2179
2182
  };
2180
2183
  if (typeof document < "u" && !document.getElementById("authui-fouc")) {
2181
2184
  const e = document.createElement("style");
2182
2185
  e.id = "authui-fouc", e.textContent = "authui-show:not([ready]){display:none}", document.head.appendChild(e);
2183
2186
  }
2184
- const Pt = ["loading", "signed-out", "signed-in", "mfa-required"];
2185
- function j(e) {
2186
- return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Pt.includes(t)) : [];
2187
+ const St = ["loading", "signed-out", "signed-in", "mfa-required"];
2188
+ function W(e) {
2189
+ return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => St.includes(t)) : [];
2187
2190
  }
2188
- let D = class extends K {
2191
+ let L = class extends X {
2189
2192
  constructor() {
2190
2193
  super(...arguments), this.when = "", this.unless = "", this.status = n.getState().status, this.unsubscribe = null;
2191
2194
  }
@@ -2197,29 +2200,29 @@ let D = class extends K {
2197
2200
  }
2198
2201
  /** Whether the current status satisfies `when` and `unless`. */
2199
2202
  get visible() {
2200
- const e = j(this.when), t = j(this.unless);
2203
+ const e = W(this.when), t = W(this.unless);
2201
2204
  return !(this.status === "loading" && !e.includes("loading") || e.length > 0 && !e.includes(this.status) || t.includes(this.status));
2202
2205
  }
2203
2206
  updated() {
2204
- (this.status !== "loading" || j(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2207
+ (this.status !== "loading" || W(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2205
2208
  }
2206
2209
  render() {
2207
2210
  return this.visible ? s`<slot></slot>` : o;
2208
2211
  }
2209
2212
  };
2210
- B([
2213
+ H([
2211
2214
  f({ type: String })
2212
- ], D.prototype, "when", 2);
2213
- B([
2215
+ ], L.prototype, "when", 2);
2216
+ H([
2214
2217
  f({ type: String })
2215
- ], D.prototype, "unless", 2);
2216
- B([
2218
+ ], L.prototype, "unless", 2);
2219
+ H([
2217
2220
  d()
2218
- ], D.prototype, "status", 2);
2219
- D = B([
2220
- I("authui-show")
2221
- ], D);
2222
- const St = E`
2221
+ ], L.prototype, "status", 2);
2222
+ L = H([
2223
+ _("authui-show")
2224
+ ], L);
2225
+ const At = I`
2223
2226
  :host {
2224
2227
  display: block;
2225
2228
  width: 100%;
@@ -2357,7 +2360,7 @@ const St = E`
2357
2360
  qr: m(
2358
2361
  l`<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"/>`
2359
2362
  )
2360
- }, w = (e, t = "0 0 24 24") => s`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, At = {
2363
+ }, w = (e, t = "0 0 24 24") => s`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Mt = {
2361
2364
  google: w(
2362
2365
  l`<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"/>`
2363
2366
  ),
@@ -2413,15 +2416,15 @@ const St = E`
2413
2416
  l`<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"/>`
2414
2417
  )
2415
2418
  };
2416
- function G(e) {
2417
- return At[e] ?? c.globe;
2419
+ function K(e) {
2420
+ return Mt[e] ?? c.globe;
2418
2421
  }
2419
- var Mt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, P = (e, t, i, r) => {
2420
- for (var a = r > 1 ? void 0 : r ? Ut(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2422
+ var Ut = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, C = (e, t, i, r) => {
2423
+ for (var a = r > 1 ? void 0 : r ? Et(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2421
2424
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2422
- return r && a && Mt(t, i, a), a;
2425
+ return r && a && Ut(t, i, a), a;
2423
2426
  };
2424
- let $ = class extends x {
2427
+ let $ = class extends A {
2425
2428
  constructor() {
2426
2429
  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.token = null, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.onSignIn = (e) => {
2427
2430
  e.preventDefault(), this.run(async () => {
@@ -2503,7 +2506,7 @@ let $ = class extends x {
2503
2506
  try {
2504
2507
  await n.signOut();
2505
2508
  } catch (e) {
2506
- if (!N(e, v.sessionNotFound)) throw e;
2509
+ if (!B(e, v.sessionNotFound)) throw e;
2507
2510
  }
2508
2511
  this.go("sign-in");
2509
2512
  });
@@ -2775,11 +2778,11 @@ let $ = class extends x {
2775
2778
  class="btn btn-outline"
2776
2779
  @click=${() => this.onOAuth(i)}
2777
2780
  ?disabled=${this.busy}
2778
- aria-label=${this.t("continueWith", { provider: O(i) })}
2781
+ aria-label=${this.t("continueWith", { provider: D(i) })}
2779
2782
  >
2780
- ${G(i)}
2783
+ ${K(i)}
2781
2784
  <span
2782
- >${t ? O(i) : this.t("continueWith", { provider: O(i) })}</span
2785
+ >${t ? D(i) : this.t("continueWith", { provider: D(i) })}</span
2783
2786
  >
2784
2787
  </button>`
2785
2788
  )}
@@ -3052,49 +3055,49 @@ let $ = class extends x {
3052
3055
  `;
3053
3056
  }
3054
3057
  };
3055
- $.styles = [...x.styles, St];
3056
- P([
3058
+ $.styles = [...A.styles, At];
3059
+ C([
3057
3060
  f({ type: String })
3058
3061
  ], $.prototype, "view", 2);
3059
- P([
3062
+ C([
3060
3063
  f({ type: Boolean })
3061
3064
  ], $.prototype, "embedded", 2);
3062
- P([
3065
+ C([
3063
3066
  d()
3064
3067
  ], $.prototype, "step", 2);
3065
- P([
3068
+ C([
3066
3069
  d()
3067
3070
  ], $.prototype, "busy", 2);
3068
- P([
3071
+ C([
3069
3072
  d()
3070
3073
  ], $.prototype, "error", 2);
3071
- P([
3074
+ C([
3072
3075
  d()
3073
3076
  ], $.prototype, "notice", 2);
3074
- P([
3077
+ C([
3075
3078
  d()
3076
3079
  ], $.prototype, "showPassword", 2);
3077
- P([
3080
+ C([
3078
3081
  d()
3079
3082
  ], $.prototype, "token", 2);
3080
- P([
3083
+ C([
3081
3084
  d()
3082
3085
  ], $.prototype, "challenge", 2);
3083
- P([
3086
+ C([
3084
3087
  d()
3085
3088
  ], $.prototype, "recovery", 2);
3086
- P([
3089
+ C([
3087
3090
  rt("form input:not([type=hidden])")
3088
3091
  ], $.prototype, "firstInput", 2);
3089
- $ = P([
3090
- I("authui-sign-in")
3092
+ $ = C([
3093
+ _("authui-sign-in")
3091
3094
  ], $);
3092
- var Et = Object.defineProperty, It = Object.getOwnPropertyDescriptor, g = (e, t, i, r) => {
3093
- for (var a = r > 1 ? void 0 : r ? It(t, i) : t, h = e.length - 1, u; h >= 0; h--)
3095
+ var It = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, g = (e, t, i, r) => {
3096
+ for (var a = r > 1 ? void 0 : r ? _t(t, i) : t, h = e.length - 1, u; h >= 0; h--)
3094
3097
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
3095
- return r && a && Et(t, i, a), a;
3098
+ return r && a && It(t, i, a), a;
3096
3099
  };
3097
- let p = class extends x {
3100
+ let p = class extends A {
3098
3101
  constructor() {
3099
3102
  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 = !0, this.confirmDelete = !1, this.factorsLoading = !1, this.onUpdateName = (e) => {
3100
3103
  e.preventDefault(), this.run("name", () => n.updateName(this.nameInput), this.t("done"));
@@ -3174,7 +3177,7 @@ let p = class extends x {
3174
3177
  try {
3175
3178
  this.recoveryCodes = await n.createRecoveryCodes();
3176
3179
  } catch (e) {
3177
- if (!N(e, v.recoveryCodesExist)) throw e;
3180
+ if (!B(e, v.recoveryCodesExist)) throw e;
3178
3181
  this.recoveryCodes = await n.getRecoveryCodes();
3179
3182
  }
3180
3183
  await this.loadFactors();
@@ -3246,7 +3249,7 @@ let p = class extends x {
3246
3249
  try {
3247
3250
  await t(), i && (this.notice = { tone: "success", message: i });
3248
3251
  } catch (r) {
3249
- N(r, v.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
3252
+ B(r, v.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
3250
3253
  ...this.errors,
3251
3254
  [e]: at(r, this.strings, e.includes("code") ? "code" : "link")
3252
3255
  };
@@ -3705,7 +3708,7 @@ let p = class extends x {
3705
3708
  </div>`;
3706
3709
  }
3707
3710
  renderMfaCard() {
3708
- const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? ft(this.authenticator.uri) : new ct(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
3711
+ const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? mt(this.authenticator.uri) : new lt(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
3709
3712
  return this.card(
3710
3713
  this.t("twoFactor"),
3711
3714
  this.t("twoFactorDescription"),
@@ -3956,9 +3959,9 @@ let p = class extends x {
3956
3959
  ${e === null ? s`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? s`<div class="empty">${this.t("noConnections")}</div>` : e.map(
3957
3960
  (i) => s`<div class="row">
3958
3961
  <div class="inline">
3959
- <span class="device">${G(i.provider)}</span>
3962
+ <span class="device">${K(i.provider)}</span>
3960
3963
  <div class="row-main">
3961
- <span class="row-title">${O(i.provider)}</span>
3964
+ <span class="row-title">${D(i.provider)}</span>
3962
3965
  <span class="row-sub">${i.providerEmail || i.providerUid}</span>
3963
3966
  </div>
3964
3967
  </div>
@@ -3979,7 +3982,7 @@ let p = class extends x {
3979
3982
  class="btn btn-outline btn-sm"
3980
3983
  @click=${() => n.signInWithOAuth(i)}
3981
3984
  >
3982
- ${G(i)} ${O(i)}
3985
+ ${K(i)} ${D(i)}
3983
3986
  </button>`
3984
3987
  )}` : void 0
3985
3988
  )}
@@ -4008,8 +4011,8 @@ let p = class extends x {
4008
4011
  }
4009
4012
  };
4010
4013
  p.styles = [
4011
- ...x.styles,
4012
- E`
4014
+ ...A.styles,
4015
+ I`
4013
4016
  :host {
4014
4017
  display: block;
4015
4018
  width: 100%;
@@ -4174,14 +4177,14 @@ g([
4174
4177
  d()
4175
4178
  ], p.prototype, "confirmDelete", 2);
4176
4179
  p = g([
4177
- I("authui-account")
4180
+ _("authui-account")
4178
4181
  ], p);
4179
- var _t = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, z = (e, t, i, r) => {
4180
- for (var a = r > 1 ? void 0 : r ? Ft(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4182
+ var Ft = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, O = (e, t, i, r) => {
4183
+ for (var a = r > 1 ? void 0 : r ? zt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4181
4184
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4182
- return r && a && _t(t, i, a), a;
4185
+ return r && a && Ft(t, i, a), a;
4183
4186
  };
4184
- let U = class extends x {
4187
+ let E = class extends A {
4185
4188
  constructor() {
4186
4189
  super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.onOpenEvent = (e) => {
4187
4190
  const t = e.detail ?? {};
@@ -4244,9 +4247,9 @@ let U = class extends x {
4244
4247
  `;
4245
4248
  }
4246
4249
  };
4247
- U.styles = [
4248
- ...x.styles,
4249
- E`
4250
+ E.styles = [
4251
+ ...A.styles,
4252
+ I`
4250
4253
  :host {
4251
4254
  display: contents;
4252
4255
  }
@@ -4306,38 +4309,38 @@ U.styles = [
4306
4309
  }
4307
4310
  `
4308
4311
  ];
4309
- z([
4312
+ O([
4310
4313
  f({ type: Boolean, reflect: !0 })
4311
- ], U.prototype, "open", 2);
4312
- z([
4314
+ ], E.prototype, "open", 2);
4315
+ O([
4313
4316
  f({ type: String })
4314
- ], U.prototype, "view", 2);
4315
- z([
4317
+ ], E.prototype, "view", 2);
4318
+ O([
4316
4319
  f({ type: Boolean, attribute: "close-on-success" })
4317
- ], U.prototype, "closeOnSuccess", 2);
4318
- z([
4320
+ ], E.prototype, "closeOnSuccess", 2);
4321
+ O([
4319
4322
  d()
4320
- ], U.prototype, "handledPending", 2);
4321
- z([
4323
+ ], E.prototype, "handledPending", 2);
4324
+ O([
4322
4325
  rt("dialog")
4323
- ], U.prototype, "dialog", 2);
4324
- U = z([
4325
- I("authui-modal")
4326
- ], U);
4326
+ ], E.prototype, "dialog", 2);
4327
+ E = O([
4328
+ _("authui-modal")
4329
+ ], E);
4327
4330
  function Y(e) {
4328
4331
  typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
4329
4332
  window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
4330
4333
  }));
4331
4334
  }
4332
- function Nt() {
4335
+ function Bt() {
4333
4336
  typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
4334
4337
  }
4335
- var zt = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, H = (e, t, i, r) => {
4336
- for (var a = r > 1 ? void 0 : r ? Ot(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4338
+ var Ot = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, j = (e, t, i, r) => {
4339
+ for (var a = r > 1 ? void 0 : r ? Dt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4337
4340
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4338
- return r && a && zt(t, i, a), a;
4341
+ return r && a && Ot(t, i, a), a;
4339
4342
  };
4340
- let F = class extends x {
4343
+ let z = class extends A {
4341
4344
  constructor() {
4342
4345
  super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
4343
4346
  }
@@ -4354,9 +4357,9 @@ let F = class extends x {
4354
4357
  </button>`;
4355
4358
  }
4356
4359
  };
4357
- F.styles = [
4358
- ...x.styles,
4359
- E`
4360
+ z.styles = [
4361
+ ...A.styles,
4362
+ I`
4360
4363
  :host {
4361
4364
  display: inline-block;
4362
4365
  }
@@ -4365,24 +4368,24 @@ F.styles = [
4365
4368
  }
4366
4369
  `
4367
4370
  ];
4368
- H([
4371
+ j([
4369
4372
  f({ type: String })
4370
- ], F.prototype, "view", 2);
4371
- H([
4373
+ ], z.prototype, "view", 2);
4374
+ j([
4372
4375
  f({ type: String })
4373
- ], F.prototype, "variant", 2);
4374
- H([
4376
+ ], z.prototype, "variant", 2);
4377
+ j([
4375
4378
  f({ type: String })
4376
- ], F.prototype, "size", 2);
4377
- F = H([
4378
- I("authui-button")
4379
- ], F);
4380
- var Dt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, X = (e, t, i, r) => {
4379
+ ], z.prototype, "size", 2);
4380
+ z = j([
4381
+ _("authui-button")
4382
+ ], z);
4383
+ var Lt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Q = (e, t, i, r) => {
4381
4384
  for (var a = r > 1 ? void 0 : r ? Rt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4382
4385
  (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4383
- return r && a && Dt(t, i, a), a;
4386
+ return r && a && Lt(t, i, a), a;
4384
4387
  };
4385
- let R = class extends x {
4388
+ let R = class extends A {
4386
4389
  constructor() {
4387
4390
  super(...arguments), this.src = "", this.menuOpen = !1, this.onDocumentClick = (e) => {
4388
4391
  e.composedPath().includes(this) || (this.menuOpen = !1);
@@ -4391,10 +4394,10 @@ let R = class extends x {
4391
4394
  };
4392
4395
  }
4393
4396
  connectedCallback() {
4394
- super.connectedCallback(), document.addEventListener("click", this.onDocumentClick, !0), document.addEventListener("keydown", this.onKeydown);
4397
+ super.connectedCallback(), document.addEventListener("click", this.onDocumentClick, !0), document.addEventListener("keydown", this.onKeydown), this.addEventListener("keydown", this.onKeydown);
4395
4398
  }
4396
4399
  disconnectedCallback() {
4397
- super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick, !0), document.removeEventListener("keydown", this.onKeydown);
4400
+ super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick, !0), document.removeEventListener("keydown", this.onKeydown), this.removeEventListener("keydown", this.onKeydown);
4398
4401
  }
4399
4402
  render() {
4400
4403
  const { status: e, user: t } = this.auth;
@@ -4445,8 +4448,8 @@ let R = class extends x {
4445
4448
  }
4446
4449
  };
4447
4450
  R.styles = [
4448
- ...x.styles,
4449
- E`
4451
+ ...A.styles,
4452
+ I`
4450
4453
  :host {
4451
4454
  display: inline-block;
4452
4455
  position: relative;
@@ -4524,32 +4527,32 @@ R.styles = [
4524
4527
  }
4525
4528
  `
4526
4529
  ];
4527
- X([
4530
+ Q([
4528
4531
  f({ type: String })
4529
4532
  ], R.prototype, "src", 2);
4530
- X([
4533
+ Q([
4531
4534
  d()
4532
4535
  ], R.prototype, "menuOpen", 2);
4533
- R = X([
4534
- I("authui-user-button")
4536
+ R = Q([
4537
+ _("authui-user-button")
4535
4538
  ], R);
4536
4539
  export {
4537
- mt as A,
4540
+ gt as A,
4538
4541
  v as E,
4539
- pt as P,
4542
+ ft as P,
4540
4543
  n as a,
4541
4544
  p as b,
4542
- Nt as c,
4543
- F as d,
4545
+ Bt as c,
4546
+ z as d,
4544
4547
  b as e,
4545
- x as f,
4546
- U as g,
4547
- D as h,
4548
+ A as f,
4549
+ E as g,
4550
+ L as h,
4548
4551
  $ as i,
4549
4552
  R as j,
4550
- lt as k,
4553
+ dt as k,
4551
4554
  at as l,
4552
4555
  Y as o,
4553
- O as p,
4554
- T as t
4556
+ D as p,
4557
+ N as t
4555
4558
  };