@getauthui/core 0.1.0 → 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.
Files changed (51) hide show
  1. package/README.md +15 -15
  2. package/dist/{authui-user-button-3yi-kvES.js → authui-user-button-C64OcOdr.js} +893 -474
  3. package/dist/authui.cdn.js +227 -215
  4. package/dist/authui.cdn.mjs +6724 -3340
  5. package/dist/authui.js +46 -34
  6. package/dist/components/authui-account.d.ts +102 -0
  7. package/dist/components/authui-account.d.ts.map +1 -0
  8. package/dist/components/authui-button.d.ts +21 -0
  9. package/dist/components/authui-button.d.ts.map +1 -0
  10. package/dist/components/authui-config.d.ts +40 -0
  11. package/dist/components/authui-config.d.ts.map +1 -0
  12. package/dist/components/authui-modal.d.ts +38 -0
  13. package/dist/components/authui-modal.d.ts.map +1 -0
  14. package/dist/components/authui-show.d.ts +33 -0
  15. package/dist/components/authui-show.d.ts.map +1 -0
  16. package/dist/components/authui-sign-in.d.ts +83 -0
  17. package/dist/components/authui-sign-in.d.ts.map +1 -0
  18. package/dist/components/authui-user-button.d.ts +22 -0
  19. package/dist/components/authui-user-button.d.ts.map +1 -0
  20. package/dist/components/element.d.ts +32 -0
  21. package/dist/components/element.d.ts.map +1 -0
  22. package/dist/components/sign-in.styles.d.ts +2 -0
  23. package/dist/components/sign-in.styles.d.ts.map +1 -0
  24. package/dist/errors.d.ts +48 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/i18n.d.ts +8 -0
  27. package/dist/i18n.d.ts.map +1 -0
  28. package/dist/icons.d.ts +38 -0
  29. package/dist/icons.d.ts.map +1 -0
  30. package/dist/index.d.ts +62 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/modal-controller.d.ts +7 -0
  33. package/dist/modal-controller.d.ts.map +1 -0
  34. package/dist/preview.d.ts +107 -0
  35. package/dist/preview.d.ts.map +1 -0
  36. package/dist/react/index.d.ts +53 -0
  37. package/dist/react/index.d.ts.map +1 -0
  38. package/dist/react.js +21 -25
  39. package/dist/store.d.ts +105 -0
  40. package/dist/store.d.ts.map +1 -0
  41. package/dist/styles/base.d.ts +7 -0
  42. package/dist/styles/base.d.ts.map +1 -0
  43. package/dist/styles/tokens.d.ts +7 -0
  44. package/dist/styles/tokens.d.ts.map +1 -0
  45. package/dist/theme.d.ts +21 -0
  46. package/dist/theme.d.ts.map +1 -0
  47. package/dist/types.d.ts +233 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/package.json +4 -4
  50. package/dist/authui.d.ts +0 -743
  51. package/dist/react.d.ts +0 -395
@@ -1,7 +1,7 @@
1
- import { state as d, property as g, customElement as S, query as X } from "lit/decorators.js";
2
- import { css as A, LitElement as V, nothing as n, html as s, svg as l } from "lit";
3
- import { Client as Q, Account as J, ID as z, Avatars as tt } from "appwrite";
4
- const et = {
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",
@@ -120,15 +120,16 @@ const et = {
120
120
  provider: "Provider",
121
121
  lastActive: "Last active",
122
122
  guestAccount: "Guest account",
123
- guestAccountDescription: "Add an email and password to keep your data."
123
+ guestAccountDescription: "Add an email and password to keep your data.",
124
+ preview: "Preview"
124
125
  };
125
- function it(e, t = {}) {
126
+ function ht(e, t = {}) {
126
127
  return e.replace(
127
128
  /\{(\w+)\}/g,
128
129
  (i, r) => r in t ? String(t[r]) : `{${r}}`
129
130
  );
130
131
  }
131
- const st = {
132
+ const ut = {
132
133
  amazon: "Amazon",
133
134
  apple: "Apple",
134
135
  appwrite: "Appwrite",
@@ -179,10 +180,376 @@ const st = {
179
180
  zoho: "Zoho",
180
181
  zoom: "Zoom"
181
182
  };
182
- function E(e) {
183
- return st[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
183
+ function D(e) {
184
+ return ut[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
184
185
  }
185
- const b = {
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
+ "amber",
188
+ "brave",
189
+ "calm",
190
+ "delta",
191
+ "ember",
192
+ "fable",
193
+ "glide",
194
+ "harbor",
195
+ "ivory",
196
+ "juniper",
197
+ "kite",
198
+ "lumen"
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
+ name: "Ada Lovelace",
201
+ email: "ada@example.com",
202
+ phone: "+15550100"
203
+ };
204
+ class ft {
205
+ constructor(t = pt) {
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
+ }
208
+ // ───────────────────────── helpers ─────────────────────────
209
+ makeUser(t = {}) {
210
+ const i = t.anonymous ?? !1;
211
+ return this.user = {
212
+ $id: "preview-user",
213
+ $createdAt: M(1440 * 30),
214
+ $updatedAt: P(),
215
+ name: i ? "" : t.name ?? this.seed.name,
216
+ registration: M(1440 * 30),
217
+ status: !0,
218
+ labels: [],
219
+ passwordUpdate: i ? "" : M(1440 * 7),
220
+ email: i ? "" : t.email ?? this.seed.email,
221
+ phone: i ? "" : t.phone ?? this.seed.phone,
222
+ emailVerification: !i,
223
+ phoneVerification: !1,
224
+ mfa: this.mfaEnabled,
225
+ prefs: {},
226
+ targets: [],
227
+ accessedAt: P()
228
+ }, this.seedActivity(i ? "anonymous" : "email"), this.user;
229
+ }
230
+ seedActivity(t) {
231
+ if (this.sessions.length > 0) return;
232
+ const i = {
233
+ $createdAt: P(),
234
+ $updatedAt: P(),
235
+ userId: "preview-user",
236
+ expire: new Date(Date.now() + 365 * 864e5).toISOString(),
237
+ providerUid: "",
238
+ providerAccessToken: "",
239
+ providerAccessTokenExpiry: "",
240
+ providerRefreshToken: "",
241
+ clientType: "browser",
242
+ clientCode: "CH",
243
+ clientEngine: "Blink",
244
+ clientEngineVersion: "128",
245
+ deviceName: "desktop",
246
+ deviceBrand: "",
247
+ deviceModel: "",
248
+ factors: ["password"],
249
+ secret: "",
250
+ mfaUpdatedAt: ""
251
+ };
252
+ this.sessions = [
253
+ {
254
+ ...i,
255
+ $id: "current",
256
+ provider: t,
257
+ ip: "203.0.113.24",
258
+ osCode: "MAC",
259
+ osName: "macOS",
260
+ osVersion: "15",
261
+ clientName: "Chrome",
262
+ clientVersion: "128",
263
+ countryCode: "de",
264
+ countryName: "Germany",
265
+ current: !0
266
+ },
267
+ {
268
+ ...i,
269
+ $id: F(),
270
+ $createdAt: M(300),
271
+ provider: t,
272
+ ip: "198.51.100.7",
273
+ osCode: "IOS",
274
+ osName: "iOS",
275
+ osVersion: "18",
276
+ clientName: "Safari",
277
+ clientVersion: "18",
278
+ clientType: "browser",
279
+ deviceName: "smartphone",
280
+ countryCode: "de",
281
+ countryName: "Germany",
282
+ current: !1
283
+ },
284
+ {
285
+ ...i,
286
+ $id: F(),
287
+ $createdAt: M(1440 * 3),
288
+ provider: "oauth2",
289
+ ip: "192.0.2.90",
290
+ osCode: "WIN",
291
+ osName: "Windows",
292
+ osVersion: "11",
293
+ clientName: "Firefox",
294
+ clientVersion: "130",
295
+ countryCode: "us",
296
+ countryName: "United States",
297
+ current: !1
298
+ }
299
+ ], this.identities = [
300
+ {
301
+ $id: "identity-github",
302
+ $createdAt: M(1440 * 20),
303
+ $updatedAt: M(1440 * 20),
304
+ userId: "preview-user",
305
+ provider: "github",
306
+ providerUid: "8675309",
307
+ providerEmail: this.seed.email,
308
+ providerAccessToken: "",
309
+ providerAccessTokenExpiry: "",
310
+ providerRefreshToken: ""
311
+ }
312
+ ], this.logs = [
313
+ {
314
+ event: "session.create",
315
+ time: P(),
316
+ clientName: "Chrome",
317
+ osName: "macOS",
318
+ countryName: "Germany",
319
+ ip: "203.0.113.24"
320
+ },
321
+ {
322
+ event: "user.update.name",
323
+ time: M(1440 * 2),
324
+ clientName: "Safari",
325
+ osName: "iOS",
326
+ countryName: "Germany",
327
+ ip: "198.51.100.7"
328
+ },
329
+ {
330
+ event: "session.create",
331
+ time: M(1440 * 3),
332
+ clientName: "Firefox",
333
+ osName: "Windows",
334
+ countryName: "United States",
335
+ ip: "192.0.2.90"
336
+ }
337
+ ];
338
+ }
339
+ requireUser() {
340
+ if (!this.user)
341
+ throw q("general_unauthorized_scope", "User (role: guests) missing scope (account)");
342
+ if (this.mfaPending)
343
+ throw q(
344
+ "user_more_factors_required",
345
+ "More factors are required to complete the sign in process."
346
+ );
347
+ return this.user;
348
+ }
349
+ requireRecentChallenge() {
350
+ if (Date.now() - this.lastChallenge > 30 * 6e4)
351
+ throw q(
352
+ "user_challenge_required",
353
+ "A recently successful challenge is required to complete this action."
354
+ );
355
+ }
356
+ afterPrimarySignIn() {
357
+ const t = this.totpEnrolled || this.user?.emailVerification;
358
+ this.mfaPending = !!(this.user?.mfa && t);
359
+ }
360
+ async delay(t, i = 150) {
361
+ return await new Promise((r) => setTimeout(r, i)), typeof t == "function" ? t() : t;
362
+ }
363
+ /** Sign the preview user in directly (used by the playground). */
364
+ signInDirectly() {
365
+ this.user || this.makeUser(), this.mfaPending = !1;
366
+ }
367
+ // ───────────────────────── account ─────────────────────────
368
+ async get() {
369
+ return this.delay(() => this.requireUser(), 120);
370
+ }
371
+ async create(t, i, r, a) {
372
+ return this.delay(() => this.makeUser({ email: i, name: a || i.split("@")[0] }));
373
+ }
374
+ async createEmailPasswordSession(t) {
375
+ return this.delay(() => ((!this.user || this.user.email !== t) && this.makeUser({ email: t, name: this.user?.name || this.seed.name }), this.afterPrimarySignIn(), this.sessions[0]));
376
+ }
377
+ async createAnonymousSession() {
378
+ return this.delay(() => (this.makeUser({ anonymous: !0 }), this.mfaPending = !1, this.sessions[0]));
379
+ }
380
+ async createOAuth2Token(t) {
381
+ return this.delay(() => {
382
+ this.makeUser({ email: `ada@${t}.example`, name: this.seed.name }), this.afterPrimarySignIn();
383
+ }, 800);
384
+ }
385
+ async createMagicURLToken(t, i) {
386
+ return this.tokens.set(t, { email: i }), this.delay({
387
+ $id: F(),
388
+ $createdAt: P(),
389
+ userId: t,
390
+ secret: "",
391
+ expire: "",
392
+ phrase: Z()
393
+ });
394
+ }
395
+ async createEmailToken(t, i) {
396
+ return this.tokens.set(t, { email: i }), this.delay({
397
+ $id: F(),
398
+ $createdAt: P(),
399
+ userId: t,
400
+ secret: "",
401
+ expire: "",
402
+ phrase: Z()
403
+ });
404
+ }
405
+ async createPhoneToken(t, i) {
406
+ return this.tokens.set(t, { phone: i }), this.delay({ $id: F(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
407
+ }
408
+ async createSession(t) {
409
+ return this.delay(() => {
410
+ const i = this.tokens.get(t) ?? {};
411
+ return this.makeUser({ email: i.email ?? this.seed.email, phone: i.phone ?? this.seed.phone }), i.phone && (this.user.phoneVerification = !0), this.afterPrimarySignIn(), this.sessions[0];
412
+ });
413
+ }
414
+ async createRecovery() {
415
+ return this.delay({});
416
+ }
417
+ async updateRecovery() {
418
+ return this.delay({});
419
+ }
420
+ async createEmailVerification() {
421
+ return this.delay({});
422
+ }
423
+ async updateEmailVerification() {
424
+ return this.delay(() => (this.user && (this.user.emailVerification = !0), {}));
425
+ }
426
+ async createPhoneVerification() {
427
+ return this.delay({});
428
+ }
429
+ async updatePhoneVerification() {
430
+ return this.delay(() => (this.user && (this.user.phoneVerification = !0), {}));
431
+ }
432
+ async getPrefs() {
433
+ return this.delay(() => ({ ...this.requireUser().prefs }));
434
+ }
435
+ async updatePrefs(t) {
436
+ return this.delay(() => {
437
+ const i = this.requireUser();
438
+ return i.prefs = { ...t }, i;
439
+ });
440
+ }
441
+ async updateName(t) {
442
+ return this.delay(() => (this.requireUser().name = t, this.user));
443
+ }
444
+ async updateEmail(t) {
445
+ return this.delay(() => {
446
+ const i = this.requireUser();
447
+ return i.email = t, i.emailVerification = !1, i.passwordUpdate = P(), i;
448
+ });
449
+ }
450
+ async updatePhone(t) {
451
+ return this.delay(() => {
452
+ const i = this.requireUser();
453
+ return i.phone = t, i.phoneVerification = !1, i;
454
+ });
455
+ }
456
+ async updatePassword() {
457
+ return this.delay(() => {
458
+ const t = this.requireUser();
459
+ return t.passwordUpdate = P(), t;
460
+ });
461
+ }
462
+ async updateStatus() {
463
+ return this.delay(() => (this.requireUser(), this.reset(), this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], {}));
464
+ }
465
+ // ───────────────────────── sessions ─────────────────────────
466
+ async listSessions() {
467
+ return this.delay(() => (this.requireUser(), { total: this.sessions.length, sessions: this.sessions }));
468
+ }
469
+ async deleteSession(t = "current") {
470
+ return this.delay(() => (t === "current" ? this.reset() : this.sessions = this.sessions.filter((i) => i.$id !== t), {}));
471
+ }
472
+ async deleteSessions() {
473
+ return this.delay(() => (this.reset(), {}));
474
+ }
475
+ async listIdentities() {
476
+ return this.delay(() => (this.requireUser(), { total: this.identities.length, identities: this.identities }));
477
+ }
478
+ async deleteIdentity(t) {
479
+ return this.delay(() => (this.identities = this.identities.filter((i) => i.$id !== t), {}));
480
+ }
481
+ async listLogs() {
482
+ return this.delay(() => (this.requireUser(), { total: this.logs.length, logs: this.logs }));
483
+ }
484
+ // ───────────────────────── MFA ─────────────────────────
485
+ async listMFAFactors() {
486
+ return this.delay({
487
+ totp: this.totpEnrolled,
488
+ email: !!this.user?.emailVerification,
489
+ phone: !!this.user?.phoneVerification,
490
+ recoveryCode: this.recoveryCodes.length > 0,
491
+ custom: !1
492
+ });
493
+ }
494
+ async createMFAChallenge() {
495
+ return this.delay({ $id: F(), $createdAt: P(), userId: "preview-user", expire: "" });
496
+ }
497
+ async updateMFAChallenge() {
498
+ return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
499
+ }
500
+ async updateMFA(t) {
501
+ return this.delay(() => {
502
+ const i = this.requireUser();
503
+ return this.mfaEnabled = t, i.mfa = t, i;
504
+ });
505
+ }
506
+ async createMFAAuthenticator() {
507
+ return this.delay(() => {
508
+ const t = "JBSWY3DPEHPK3PXP";
509
+ return this.pendingAuthenticator = {
510
+ secret: t,
511
+ uri: `otpauth://totp/Preview:${encodeURIComponent(this.user?.email ?? "user")}?secret=${t}&issuer=Preview`
512
+ }, this.pendingAuthenticator;
513
+ });
514
+ }
515
+ async updateMFAAuthenticator() {
516
+ return this.delay(() => (this.totpEnrolled = !0, this.pendingAuthenticator = null, this.lastChallenge = Date.now(), this.requireUser()));
517
+ }
518
+ async deleteMFAAuthenticator() {
519
+ return this.delay(() => (this.requireRecentChallenge(), this.totpEnrolled = !1, {}));
520
+ }
521
+ async createMFARecoveryCodes() {
522
+ return this.delay(() => {
523
+ if (this.recoveryCodes.length > 0)
524
+ throw q("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
525
+ return this.recoveryCodes = Array.from({ length: 6 }, J), { recoveryCodes: this.recoveryCodes };
526
+ });
527
+ }
528
+ async getMFARecoveryCodes() {
529
+ return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
530
+ }
531
+ async updateMFARecoveryCodes() {
532
+ return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, J), { recoveryCodes: this.recoveryCodes }));
533
+ }
534
+ /** Forget everything, as a sign out would. */
535
+ reset() {
536
+ this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
537
+ }
538
+ }
539
+ function mt(e) {
540
+ let t = 2166136261;
541
+ const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
542
+ for (const x of e) t = (t ^ x.charCodeAt(0)) * 16777619;
543
+ const r = 25;
544
+ let a = "";
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
+ 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
+ return `data:image/svg+xml;utf8,${encodeURIComponent(u)}`;
551
+ }
552
+ const v = {
186
553
  moreFactorsRequired: "user_more_factors_required",
187
554
  invalidCredentials: "user_invalid_credentials",
188
555
  userAlreadyExists: "user_already_exists",
@@ -214,7 +581,7 @@ const b = {
214
581
  countMaxExceeded: "user_count_exceeded",
215
582
  targetAlreadyExists: "user_target_already_exists"
216
583
  };
217
- function _(e) {
584
+ function N(e) {
218
585
  if (e && typeof e == "object") {
219
586
  const t = e;
220
587
  return {
@@ -225,44 +592,44 @@ function _(e) {
225
592
  }
226
593
  return { message: String(e), type: "", code: 0 };
227
594
  }
228
- function F(e, t) {
229
- return _(e).type === t;
595
+ function B(e, t) {
596
+ return N(e).type === t;
230
597
  }
231
- function Z(e, t, i = "link") {
232
- const r = _(e);
598
+ function at(e, t, i = "link") {
599
+ const r = N(e);
233
600
  switch (r.type) {
234
- case b.invalidCredentials:
601
+ case v.invalidCredentials:
235
602
  return t.errorInvalidCredentials;
236
- case b.userAlreadyExists:
237
- case b.emailAlreadyExists:
238
- case b.phoneAlreadyExists:
603
+ case v.userAlreadyExists:
604
+ case v.emailAlreadyExists:
605
+ case v.phoneAlreadyExists:
239
606
  return t.errorUserExists;
240
- case b.userBlocked:
607
+ case v.userBlocked:
241
608
  return t.errorUserBlocked;
242
- case b.rateLimit:
609
+ case v.rateLimit:
243
610
  return t.errorRateLimit;
244
- case b.invalidToken:
611
+ case v.invalidToken:
245
612
  return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
246
- case b.invalidCode:
613
+ case v.invalidCode:
247
614
  return t.errorInvalidCode;
248
- case b.passwordMismatch:
615
+ case v.passwordMismatch:
249
616
  return t.errorPasswordMismatch;
250
- case b.passwordRecentlyUsed:
617
+ case v.passwordRecentlyUsed:
251
618
  return t.errorPasswordRecentlyUsed;
252
- case b.passwordPersonalData:
619
+ case v.passwordPersonalData:
253
620
  return t.errorPasswordPersonalData;
254
- case b.passwordWeak:
621
+ case v.passwordWeak:
255
622
  return t.errorPasswordWeak;
256
- case b.passwordPwned:
623
+ case v.passwordPwned:
257
624
  return t.errorPasswordPwned;
258
- case b.challengeRequired:
625
+ case v.challengeRequired:
259
626
  return t.errorChallengeRequired;
260
- case b.sessionAlreadyExists:
627
+ case v.sessionAlreadyExists:
261
628
  return t.errorSessionExists;
262
- case b.oauthUnauthorized:
263
- case b.oauthBadRequest:
629
+ case v.oauthUnauthorized:
630
+ case v.oauthBadRequest:
264
631
  return t.errorOAuth;
265
- case b.authMethodUnsupported:
632
+ case v.authMethodUnsupported:
266
633
  return t.errorMethodDisabled;
267
634
  }
268
635
  return r.code === 0 && /fetch|network/i.test(r.message) ? t.errorNetwork : r.message || t.errorGeneric;
@@ -277,25 +644,33 @@ function k(e, t, i) {
277
644
  new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
278
645
  );
279
646
  }
280
- const D = "authui", N = ["userId", "secret", "expire", "project", "error", D], j = () => ({
647
+ const G = "authui", tt = ["userId", "secret", "expire", "project", "error", G], et = () => ({
281
648
  status: "loading",
282
649
  user: null,
283
650
  mfaFactors: null,
284
651
  pending: null,
285
652
  configured: !1
286
653
  });
287
- class rt {
654
+ class gt {
288
655
  constructor() {
289
- this.client = null, this.account = null, this.config = null, this.state = j(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null;
656
+ this.client = null, this.account = null, this.config = null, this.state = et(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null;
290
657
  }
291
658
  // ───────────────────────────── configuration ─────────────────────────────
292
659
  /** Configure the Appwrite client. Safe to call more than once; the last call wins. */
293
660
  configure(t) {
294
- this.config = t, this.client = new Q().setEndpoint(t.endpoint).setProject(t.project), this.account = new J(this.client), this.setState({ configured: !0, status: "loading" }), 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());
295
662
  }
296
663
  get isConfigured() {
297
664
  return this.config !== null;
298
665
  }
666
+ /** True when running against the in-memory preview account. */
667
+ get isPreview() {
668
+ return this.preview !== null;
669
+ }
670
+ /** Preview only: sign the sample user in without any form. */
671
+ async previewSignIn() {
672
+ this.preview && (this.preview.signInDirectly(), await this.refresh());
673
+ }
299
674
  getConfig() {
300
675
  return this.config;
301
676
  }
@@ -303,8 +678,15 @@ class rt {
303
678
  getClient() {
304
679
  return this.client;
305
680
  }
681
+ /**
682
+ * The Account service Auth UI talks to. Reuse it for prefs, JWTs or anything else
683
+ * on the signed-in account. In preview mode this is the in-memory stand-in.
684
+ */
685
+ getAccount() {
686
+ return this.account;
687
+ }
306
688
  getStrings() {
307
- return { ...et, ...this.config?.strings ?? {} };
689
+ return { ...dt, ...this.config?.strings ?? {} };
308
690
  }
309
691
  getState() {
310
692
  return { ...this.state };
@@ -330,7 +712,7 @@ class rt {
330
712
  this.state = { ...this.state, ...t }, this.emit("change", this.getState());
331
713
  }
332
714
  fail(t) {
333
- const i = _(t);
715
+ const i = N(t);
334
716
  throw this.emit("error", i), t;
335
717
  }
336
718
  acct() {
@@ -350,7 +732,7 @@ class rt {
350
732
  const i = await this.account.get();
351
733
  this.setState({ status: "signed-in", user: i, mfaFactors: null }), t || this.emit("signed-in", i);
352
734
  } catch (i) {
353
- if (F(i, b.moreFactorsRequired)) {
735
+ if (B(i, v.moreFactorsRequired)) {
354
736
  let r = null;
355
737
  try {
356
738
  r = await k(
@@ -384,7 +766,7 @@ class rt {
384
766
  }
385
767
  async signUp(t, i, r) {
386
768
  try {
387
- await this.acct().create(z.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);
388
770
  } catch (a) {
389
771
  this.fail(a);
390
772
  }
@@ -398,24 +780,36 @@ class rt {
398
780
  }
399
781
  await this.afterSignIn();
400
782
  }
401
- /** Redirects the browser to the provider. Never resolves in a browser. */
402
- signInWithOAuth(t) {
783
+ /**
784
+ * Redirects the browser to the provider; the returned promise only resolves in
785
+ * preview mode, where the sign in completes in place.
786
+ */
787
+ async signInWithOAuth(t) {
403
788
  const i = this.config?.oauthScopes?.[t];
789
+ let r;
404
790
  try {
405
- this.acct().createOAuth2Token(
791
+ r = this.acct().createOAuth2Token(
406
792
  t,
407
793
  this.redirectUrl("oauth"),
408
794
  this.redirectUrl("oauth-failed"),
409
795
  i
410
796
  );
411
- } catch (r) {
412
- this.fail(r);
797
+ } catch (a) {
798
+ this.fail(a);
799
+ }
800
+ if (r && typeof r.then == "function") {
801
+ try {
802
+ await r;
803
+ } catch (a) {
804
+ this.fail(a);
805
+ }
806
+ await this.afterSignIn();
413
807
  }
414
808
  }
415
809
  async sendMagicUrl(t) {
416
810
  try {
417
811
  return await this.acct().createMagicURLToken(
418
- z.unique(),
812
+ V.unique(),
419
813
  t.trim(),
420
814
  this.redirectUrl("magic-url"),
421
815
  this.config?.securityPhrase ?? !0
@@ -427,7 +821,7 @@ class rt {
427
821
  async sendEmailOtp(t) {
428
822
  try {
429
823
  return await this.acct().createEmailToken(
430
- z.unique(),
824
+ V.unique(),
431
825
  t.trim(),
432
826
  this.config?.securityPhrase ?? !0
433
827
  );
@@ -437,7 +831,7 @@ class rt {
437
831
  }
438
832
  async sendPhoneOtp(t) {
439
833
  try {
440
- return await this.acct().createPhoneToken(z.unique(), t.replace(/[\s()-]/g, ""));
834
+ return await this.acct().createPhoneToken(V.unique(), t.replace(/[\s()-]/g, ""));
441
835
  } catch (i) {
442
836
  return this.fail(i);
443
837
  }
@@ -703,8 +1097,8 @@ class rt {
703
1097
  /** Build the URL Appwrite should send the user back to for a given flow. */
704
1098
  redirectUrl(t) {
705
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);
706
- for (const a of N) r.searchParams.delete(a);
707
- return r.searchParams.set(D, t), r.toString();
1100
+ for (const a of tt) r.searchParams.delete(a);
1101
+ return r.searchParams.set(G, t), r.toString();
708
1102
  }
709
1103
  setPending(t) {
710
1104
  this.setState({ pending: t });
@@ -715,7 +1109,7 @@ class rt {
715
1109
  */
716
1110
  async handleRedirect() {
717
1111
  if (typeof window > "u") return !1;
718
- const t = new URLSearchParams(window.location.search), i = t.get(D);
1112
+ const t = new URLSearchParams(window.location.search), i = t.get(G);
719
1113
  if (!i) return !1;
720
1114
  const r = t.get("userId") ?? "", a = t.get("secret") ?? "";
721
1115
  this.cleanUrl();
@@ -745,24 +1139,24 @@ class rt {
745
1139
  }));
746
1140
  break;
747
1141
  }
748
- } catch (u) {
749
- const h = _(u);
750
- this.emit("error", h), this.setState({ pending: { type: "notice", message: h.message, tone: "error" } });
1142
+ } catch (h) {
1143
+ const u = N(h);
1144
+ this.emit("error", u), this.setState({ pending: { type: "notice", message: u.message, tone: "error" } });
751
1145
  }
752
1146
  return !0;
753
1147
  }
754
1148
  cleanUrl() {
755
1149
  const t = new URL(window.location.href);
756
- for (const i of N) t.searchParams.delete(i);
1150
+ for (const i of tt) t.searchParams.delete(i);
757
1151
  window.history.replaceState(window.history.state, "", t.toString());
758
1152
  }
759
1153
  /** Test helper. */
760
1154
  reset() {
761
- this.client = null, this.account = null, this.config = null, this.state = j(), this.listeners.clear();
1155
+ this.client = null, this.account = null, this.preview = null, this.config = null, this.state = et(), this.listeners.clear();
762
1156
  }
763
1157
  }
764
- const o = new rt();
765
- class at {
1158
+ const n = new gt();
1159
+ class vt {
766
1160
  constructor() {
767
1161
  this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
768
1162
  const t = this.isDark("auto");
@@ -790,14 +1184,14 @@ class at {
790
1184
  this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
791
1185
  }
792
1186
  }
793
- const W = new at(), G = {
1187
+ const it = new vt(), st = {
794
1188
  none: "0px",
795
1189
  sm: "0.25rem",
796
1190
  md: "0.625rem",
797
1191
  lg: "0.875rem",
798
1192
  xl: "1.125rem",
799
1193
  full: "1.5rem"
800
- }, ot = A`
1194
+ }, bt = I`
801
1195
  :host {
802
1196
  /* Light theme (matches :root in the console) */
803
1197
  --authui-background: oklch(1 0 0);
@@ -875,7 +1269,7 @@ const W = new at(), G = {
875
1269
  --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
876
1270
  color-scheme: dark;
877
1271
  }
878
- `, nt = A`
1272
+ `, yt = I`
879
1273
  *,
880
1274
  *::before,
881
1275
  *::after {
@@ -1378,6 +1772,12 @@ const W = new at(), G = {
1378
1772
  gap: 8px;
1379
1773
  flex-wrap: wrap;
1380
1774
  }
1775
+ .row-title svg {
1776
+ width: 16px;
1777
+ height: 16px;
1778
+ color: var(--authui-muted-foreground);
1779
+ flex-shrink: 0;
1780
+ }
1381
1781
  .row-sub {
1382
1782
  font-size: 12px;
1383
1783
  color: var(--authui-muted-foreground);
@@ -1612,62 +2012,65 @@ const W = new at(), G = {
1612
2012
  }
1613
2013
  }
1614
2014
  `;
1615
- var ct = Object.defineProperty, lt = (e, t, i, r) => {
1616
- for (var a = void 0, u = e.length - 1, h; u >= 0; u--)
1617
- (h = e[u]) && (a = h(t, i, a) || a);
1618
- return a && ct(t, i, a), a;
1619
- };
1620
- const H = class H extends V {
2015
+ var wt = Object.defineProperty, $t = (e, t, i, r) => {
2016
+ for (var a = void 0, h = e.length - 1, u; h >= 0; h--)
2017
+ (u = e[h]) && (a = u(t, i, a) || a);
2018
+ return a && wt(t, i, a), a;
2019
+ }, U;
2020
+ const nt = (U = class extends X {
1621
2021
  constructor() {
1622
- super(...arguments), this.auth = o.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();
1623
2023
  }
1624
2024
  connectedCallback() {
1625
- super.connectedCallback(), this.auth = o.getState(), this.unsubscribeStore = o.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) => {
1626
2028
  this.auth = t, this.applyBranding();
1627
- }), this.unsubscribeTheme = W.subscribe(() => this.applyBranding()), this.applyBranding();
2029
+ }), this.unsubscribeTheme = it.subscribe(() => this.applyBranding()), this.applyBranding();
1628
2030
  }
1629
2031
  disconnectedCallback() {
1630
- 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;
1631
2035
  }
1632
2036
  get strings() {
1633
- return o.getStrings();
2037
+ return n.getStrings();
1634
2038
  }
1635
2039
  /** Translate a string key with optional `{placeholders}`. */
1636
2040
  t(t, i) {
1637
- return it(this.strings[t], i);
2041
+ return ht(this.strings[t], i);
1638
2042
  }
1639
2043
  get config() {
1640
- return o.getConfig();
2044
+ return n.getConfig();
1641
2045
  }
1642
2046
  get productName() {
1643
2047
  return this.config?.branding?.name ?? "";
1644
2048
  }
1645
2049
  /** Push theme and branding from config onto the host element. */
1646
2050
  applyBranding() {
1647
- const t = this.config?.branding, i = W.isDark(t?.theme ?? "auto");
2051
+ const t = this.config?.branding, i = it.isDark(t?.theme ?? "auto");
1648
2052
  this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
1649
2053
  "--authui-primary-foreground",
1650
2054
  t.primaryForeground ?? "#ffffff"
1651
- )), t?.radius && G[t.radius] && this.style.setProperty("--authui-radius", G[t.radius]);
2055
+ )), t?.radius && st[t.radius] && this.style.setProperty("--authui-radius", st[t.radius]);
1652
2056
  }
1653
2057
  /** Emit a composed custom event from this element. */
1654
2058
  fire(t, i) {
1655
2059
  this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
1656
2060
  }
1657
- };
1658
- H.styles = [ot, nt];
1659
- let x = H;
1660
- lt([
2061
+ }, U.styles = [bt, yt], U.KEY_EVENTS = ["keydown", "keyup", "keypress"], U);
2062
+ $t([
1661
2063
  d()
1662
- ], x.prototype, "auth");
1663
- var dt = Object.defineProperty, ut = Object.getOwnPropertyDescriptor, w = (e, t, i, r) => {
1664
- for (var a = r > 1 ? void 0 : r ? ut(t, i) : t, u = e.length - 1, h; u >= 0; u--)
1665
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
1666
- return r && a && dt(t, i, a), a;
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--)
2068
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2069
+ return r && a && xt(t, i, a), a;
1667
2070
  };
1668
- let v = class extends V {
2071
+ let b = class extends X {
1669
2072
  constructor() {
1670
- 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 = "";
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 = "";
1671
2074
  }
1672
2075
  connectedCallback() {
1673
2076
  super.connectedCallback(), this.configure();
@@ -1677,8 +2080,8 @@ let v = class extends V {
1677
2080
  }
1678
2081
  configure() {
1679
2082
  if (!this.endpoint || !this.project) return;
1680
- const e = this.toConfig(), t = o.getConfig();
1681
- t && JSON.stringify(t) === JSON.stringify(e) || o.configure(e);
2083
+ const e = this.toConfig(), t = n.getConfig();
2084
+ t && JSON.stringify(t) === JSON.stringify(e) || n.configure(e);
1682
2085
  }
1683
2086
  toConfig() {
1684
2087
  const e = { oauth: [] };
@@ -1705,115 +2108,121 @@ let v = class extends V {
1705
2108
  legal: {
1706
2109
  termsUrl: this.termsUrl || void 0,
1707
2110
  privacyUrl: this.privacyUrl || void 0
1708
- }
2111
+ },
2112
+ preview: this.preview === "" || this.preview === "false" ? void 0 : !0
1709
2113
  };
1710
2114
  }
1711
2115
  };
1712
- v.styles = A`
2116
+ b.styles = I`
1713
2117
  :host {
1714
2118
  display: none;
1715
2119
  }
1716
2120
  `;
1717
- w([
1718
- g({ type: String })
1719
- ], v.prototype, "endpoint", 2);
1720
- w([
1721
- g({ type: String })
1722
- ], v.prototype, "project", 2);
1723
- w([
1724
- g({ type: String, attribute: "redirect-url" })
1725
- ], v.prototype, "redirectUrl", 2);
1726
- w([
1727
- g({ type: String, attribute: "success-url" })
1728
- ], v.prototype, "successUrl", 2);
1729
- w([
1730
- g({ type: String })
1731
- ], v.prototype, "methods", 2);
1732
- w([
1733
- g({ type: String, attribute: "sign-up" })
1734
- ], v.prototype, "signUp", 2);
1735
- w([
1736
- g({ type: String, attribute: "require-name" })
1737
- ], v.prototype, "requireName", 2);
1738
- w([
1739
- g({ type: String })
1740
- ], v.prototype, "mfa", 2);
1741
- w([
1742
- g({ type: String, attribute: "security-phrase" })
1743
- ], v.prototype, "securityPhrase", 2);
1744
- w([
1745
- g({ type: String })
1746
- ], v.prototype, "name", 2);
1747
- w([
1748
- g({ type: String })
1749
- ], v.prototype, "logo", 2);
1750
- w([
1751
- g({ type: String })
1752
- ], v.prototype, "theme", 2);
1753
- w([
1754
- g({ type: String })
1755
- ], v.prototype, "radius", 2);
1756
- w([
1757
- g({ type: String })
1758
- ], v.prototype, "primary", 2);
1759
- w([
1760
- g({ type: String, attribute: "primary-foreground" })
1761
- ], v.prototype, "primaryForeground", 2);
1762
- w([
1763
- g({ type: String, attribute: "terms-url" })
1764
- ], v.prototype, "termsUrl", 2);
1765
- w([
1766
- g({ type: String, attribute: "privacy-url" })
1767
- ], v.prototype, "privacyUrl", 2);
1768
- v = w([
1769
- S("authui-config")
1770
- ], v);
1771
- var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, B = (e, t, i, r) => {
1772
- for (var a = r > 1 ? void 0 : r ? pt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
1773
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
1774
- return r && a && ht(t, i, a), a;
2121
+ y([
2122
+ f({ type: String })
2123
+ ], b.prototype, "endpoint", 2);
2124
+ y([
2125
+ f({ type: String })
2126
+ ], b.prototype, "project", 2);
2127
+ y([
2128
+ f({ type: String, attribute: "redirect-url" })
2129
+ ], b.prototype, "redirectUrl", 2);
2130
+ y([
2131
+ f({ type: String, attribute: "success-url" })
2132
+ ], b.prototype, "successUrl", 2);
2133
+ y([
2134
+ f({ type: String })
2135
+ ], b.prototype, "methods", 2);
2136
+ y([
2137
+ f({ type: String, attribute: "sign-up" })
2138
+ ], b.prototype, "signUp", 2);
2139
+ y([
2140
+ f({ type: String, attribute: "require-name" })
2141
+ ], b.prototype, "requireName", 2);
2142
+ y([
2143
+ f({ type: String })
2144
+ ], b.prototype, "mfa", 2);
2145
+ y([
2146
+ f({ type: String, attribute: "security-phrase" })
2147
+ ], b.prototype, "securityPhrase", 2);
2148
+ y([
2149
+ f({ type: String })
2150
+ ], b.prototype, "name", 2);
2151
+ y([
2152
+ f({ type: String })
2153
+ ], b.prototype, "logo", 2);
2154
+ y([
2155
+ f({ type: String })
2156
+ ], b.prototype, "theme", 2);
2157
+ y([
2158
+ f({ type: String })
2159
+ ], b.prototype, "radius", 2);
2160
+ y([
2161
+ f({ type: String })
2162
+ ], b.prototype, "primary", 2);
2163
+ y([
2164
+ f({ type: String, attribute: "primary-foreground" })
2165
+ ], b.prototype, "primaryForeground", 2);
2166
+ y([
2167
+ f({ type: String, attribute: "terms-url" })
2168
+ ], b.prototype, "termsUrl", 2);
2169
+ y([
2170
+ f({ type: String, attribute: "privacy-url" })
2171
+ ], b.prototype, "privacyUrl", 2);
2172
+ y([
2173
+ f({ type: String })
2174
+ ], b.prototype, "preview", 2);
2175
+ b = y([
2176
+ _("authui-config")
2177
+ ], b);
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--)
2180
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2181
+ return r && a && Ct(t, i, a), a;
1775
2182
  };
1776
2183
  if (typeof document < "u" && !document.getElementById("authui-fouc")) {
1777
2184
  const e = document.createElement("style");
1778
- e.id = "authui-fouc", e.textContent = "authui-signed-in:not([ready]),authui-signed-out:not([ready]){display:none}", document.head.appendChild(e);
2185
+ e.id = "authui-fouc", e.textContent = "authui-show:not([ready]){display:none}", document.head.appendChild(e);
2186
+ }
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)) : [];
1779
2190
  }
1780
- class T extends V {
2191
+ let L = class extends X {
1781
2192
  constructor() {
1782
- super(...arguments), this.show = !1, this.unsubscribe = null;
2193
+ super(...arguments), this.when = "", this.unless = "", this.status = n.getState().status, this.unsubscribe = null;
1783
2194
  }
1784
2195
  connectedCallback() {
1785
- super.connectedCallback(), this.evaluate(o.getState().status), this.unsubscribe = o.on("change", (t) => this.evaluate(t.status));
2196
+ super.connectedCallback(), this.status = n.getState().status, this.unsubscribe = n.on("change", (e) => this.status = e.status);
1786
2197
  }
1787
2198
  disconnectedCallback() {
1788
- super.disconnectedCallback(), this.unsubscribe?.();
2199
+ super.disconnectedCallback(), this.unsubscribe?.(), this.unsubscribe = null;
1789
2200
  }
1790
- evaluate(t) {
1791
- t !== "loading" && (this.show = this.shouldShow(t), this.setAttribute("ready", ""), this.style.display = "contents");
2201
+ /** Whether the current status satisfies `when` and `unless`. */
2202
+ get visible() {
2203
+ const e = W(this.when), t = W(this.unless);
2204
+ return !(this.status === "loading" && !e.includes("loading") || e.length > 0 && !e.includes(this.status) || t.includes(this.status));
1792
2205
  }
1793
- render() {
1794
- return this.show ? s`<slot></slot>` : n;
1795
- }
1796
- }
1797
- B([
1798
- d()
1799
- ], T.prototype, "show", 2);
1800
- let Y = class extends T {
1801
- shouldShow(e) {
1802
- return e === "signed-in";
2206
+ updated() {
2207
+ (this.status !== "loading" || W(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
1803
2208
  }
1804
- };
1805
- Y = B([
1806
- S("authui-signed-in")
1807
- ], Y);
1808
- let K = class extends T {
1809
- shouldShow(e) {
1810
- return e !== "signed-in";
2209
+ render() {
2210
+ return this.visible ? s`<slot></slot>` : o;
1811
2211
  }
1812
2212
  };
1813
- K = B([
1814
- S("authui-signed-out")
1815
- ], K);
1816
- const ft = A`
2213
+ H([
2214
+ f({ type: String })
2215
+ ], L.prototype, "when", 2);
2216
+ H([
2217
+ f({ type: String })
2218
+ ], L.prototype, "unless", 2);
2219
+ H([
2220
+ d()
2221
+ ], L.prototype, "status", 2);
2222
+ L = H([
2223
+ _("authui-show")
2224
+ ], L);
2225
+ const At = I`
1817
2226
  :host {
1818
2227
  display: block;
1819
2228
  width: 100%;
@@ -1845,6 +2254,10 @@ const ft = A`
1845
2254
  .header:empty {
1846
2255
  display: none;
1847
2256
  }
2257
+ .header .preview {
2258
+ align-self: center;
2259
+ margin-bottom: 4px;
2260
+ }
1848
2261
  .alert .dismiss {
1849
2262
  position: absolute;
1850
2263
  top: 4px;
@@ -1857,7 +2270,7 @@ const ft = A`
1857
2270
  height: 14px;
1858
2271
  margin: 0;
1859
2272
  }
1860
- `, f = (e) => s`<svg
2273
+ `, m = (e) => s`<svg
1861
2274
  xmlns="http://www.w3.org/2000/svg"
1862
2275
  viewBox="0 0 24 24"
1863
2276
  fill="none"
@@ -1869,169 +2282,173 @@ const ft = A`
1869
2282
  >
1870
2283
  ${e}
1871
2284
  </svg>`, c = {
1872
- mail: f(
2285
+ mail: m(
1873
2286
  l`<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"/>`
1874
2287
  ),
1875
- phone: f(
2288
+ phone: m(
1876
2289
  l`<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"/>`
1877
2290
  ),
1878
- user: f(
2291
+ user: m(
1879
2292
  l`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
1880
2293
  ),
1881
- userX: f(
2294
+ userX: m(
1882
2295
  l`<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"/>`
1883
2296
  ),
1884
- lock: f(
2297
+ lock: m(
1885
2298
  l`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
1886
2299
  ),
1887
- key: f(
2300
+ key: m(
1888
2301
  l`<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"/>`
1889
2302
  ),
1890
- shield: f(
2303
+ shield: m(
1891
2304
  l`<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"/>`
1892
2305
  ),
1893
- shieldCheck: f(
2306
+ shieldCheck: m(
1894
2307
  l`<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"/>`
1895
2308
  ),
1896
- smartphone: f(
2309
+ smartphone: m(
1897
2310
  l`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
1898
2311
  ),
1899
- monitor: f(
2312
+ monitor: m(
1900
2313
  l`<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"/>`
1901
2314
  ),
1902
- globe: f(
2315
+ globe: m(
1903
2316
  l`<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"/>`
1904
2317
  ),
1905
- logOut: f(
2318
+ logOut: m(
1906
2319
  l`<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"/>`
1907
2320
  ),
1908
- settings: f(
2321
+ settings: m(
1909
2322
  l`<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"/>`
1910
2323
  ),
1911
- x: f(l`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
1912
- check: f(l`<path d="M20 6 9 17l-5-5"/>`),
1913
- copy: f(
2324
+ x: m(l`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
2325
+ check: m(l`<path d="M20 6 9 17l-5-5"/>`),
2326
+ copy: m(
1914
2327
  l`<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"/>`
1915
2328
  ),
1916
- eye: f(
2329
+ eye: m(
1917
2330
  l`<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"/>`
1918
2331
  ),
1919
- eyeOff: f(
2332
+ eyeOff: m(
1920
2333
  l`<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"/>`
1921
2334
  ),
1922
- arrowLeft: f(l`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
1923
- alert: f(
2335
+ arrowLeft: m(l`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
2336
+ alert: m(
1924
2337
  l`<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"/>`
1925
2338
  ),
1926
- info: f(l`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
1927
- checkCircle: f(l`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
1928
- link: f(
2339
+ info: m(l`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
2340
+ checkCircle: m(l`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
2341
+ link: m(
1929
2342
  l`<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"/>`
1930
2343
  ),
1931
- activity: f(
2344
+ activity: m(
1932
2345
  l`<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"/>`
1933
2346
  ),
1934
- trash: f(
2347
+ trash: m(
1935
2348
  l`<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"/>`
1936
2349
  ),
1937
- sparkles: f(
2350
+ sparkles: m(
1938
2351
  l`<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"/>`
1939
2352
  ),
1940
- refresh: f(
2353
+ refresh: m(
1941
2354
  l`<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"/>`
1942
2355
  ),
1943
- chevronDown: f(l`<path d="m6 9 6 6 6-6"/>`),
1944
- ghost: f(
2356
+ chevronDown: m(l`<path d="m6 9 6 6 6-6"/>`),
2357
+ ghost: m(
1945
2358
  l`<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"/>`
1946
2359
  ),
1947
- qr: f(
2360
+ qr: m(
1948
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"/>`
1949
2362
  )
1950
- }, y = (e, t = "0 0 24 24") => s`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, mt = {
1951
- google: y(
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 = {
2364
+ google: w(
1952
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"/>`
1953
2366
  ),
1954
- github: y(
2367
+ github: w(
1955
2368
  l`<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"/>`
1956
2369
  ),
1957
- apple: y(
2370
+ apple: w(
1958
2371
  l`<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"/>`
1959
2372
  ),
1960
- facebook: y(
2373
+ facebook: w(
1961
2374
  l`<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"/>`
1962
2375
  ),
1963
- x: y(
2376
+ x: w(
1964
2377
  l`<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"/>`
1965
2378
  ),
1966
- microsoft: y(
2379
+ microsoft: w(
1967
2380
  l`<path fill="#F25022" d="M1 1h10v10H1z"/><path fill="#7FBA00" d="M13 1h10v10H13z"/><path fill="#00A4EF" d="M1 13h10v10H1z"/><path fill="#FFB900" d="M13 13h10v10H13z"/>`
1968
2381
  ),
1969
- discord: y(
2382
+ discord: w(
1970
2383
  l`<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"/>`
1971
2384
  ),
1972
- gitlab: y(
2385
+ gitlab: w(
1973
2386
  l`<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"/>`
1974
2387
  ),
1975
- linkedin: y(
2388
+ linkedin: w(
1976
2389
  l`<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"/>`
1977
2390
  ),
1978
- slack: y(
2391
+ slack: w(
1979
2392
  l`<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"/>`
1980
2393
  ),
1981
- twitch: y(
2394
+ twitch: w(
1982
2395
  l`<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"/>`
1983
2396
  ),
1984
- spotify: y(
2397
+ spotify: w(
1985
2398
  l`<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"/>`
1986
2399
  ),
1987
- notion: y(
2400
+ notion: w(
1988
2401
  l`<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"/>`
1989
2402
  ),
1990
- dropbox: y(
2403
+ dropbox: w(
1991
2404
  l`<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"/>`
1992
2405
  ),
1993
- figma: y(
2406
+ figma: w(
1994
2407
  l`<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"/>`
1995
2408
  ),
1996
- bitbucket: y(
2409
+ bitbucket: w(
1997
2410
  l`<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"/>`
1998
2411
  ),
1999
- amazon: y(
2412
+ amazon: w(
2000
2413
  l`<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"/>`
2001
2414
  ),
2002
- paypal: y(
2415
+ paypal: w(
2003
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"/>`
2004
2417
  )
2005
2418
  };
2006
- function L(e) {
2007
- return mt[e] ?? c.globe;
2419
+ function K(e) {
2420
+ return Mt[e] ?? c.globe;
2008
2421
  }
2009
- var gt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, C = (e, t, i, r) => {
2010
- for (var a = r > 1 ? void 0 : r ? bt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
2011
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
2012
- return r && a && gt(t, i, a), a;
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--)
2424
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2425
+ return r && a && Ut(t, i, a), a;
2013
2426
  };
2014
- let $ = class extends x {
2427
+ let $ = class extends A {
2015
2428
  constructor() {
2016
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) => {
2017
2430
  e.preventDefault(), this.run(async () => {
2018
- await o.signInWithEmailPassword(this.email, this.password), this.password = "", this.fire("authui-success", { method: "email-password" });
2431
+ await n.signInWithEmailPassword(this.email, this.password), this.password = "", this.fire("authui-success", { method: "email-password" });
2019
2432
  });
2020
2433
  }, this.onSignUp = (e) => {
2021
2434
  e.preventDefault(), this.run(async () => {
2022
- await o.signUp(this.email, this.password, this.name), this.password = "", this.fire("authui-success", { method: "sign-up" });
2435
+ await n.signUp(this.email, this.password, this.name), this.password = "", this.fire("authui-success", { method: "sign-up" });
2023
2436
  });
2024
2437
  }, this.onGuest = () => {
2025
2438
  this.run(async () => {
2026
- await o.signInAnonymously(), this.fire("authui-success", { method: "anonymous" });
2439
+ await n.signInAnonymously(), this.fire("authui-success", { method: "anonymous" });
2027
2440
  });
2028
2441
  }, this.onOAuth = (e) => {
2029
2442
  this.run(async () => {
2030
- o.signInWithOAuth(e), await new Promise((t) => setTimeout(t, 4e3));
2443
+ if (await n.signInWithOAuth(e), n.isPreview) {
2444
+ this.fire("authui-success", { method: "oauth" });
2445
+ return;
2446
+ }
2447
+ await new Promise((t) => setTimeout(t, 4e3));
2031
2448
  });
2032
2449
  }, this.onForgot = (e) => {
2033
2450
  e.preventDefault(), this.run(async () => {
2034
- await o.sendPasswordRecovery(this.email), this.notice = { tone: "success", message: this.t("resetLinkSent", { email: this.email }) };
2451
+ await n.sendPasswordRecovery(this.email), this.notice = { tone: "success", message: this.t("resetLinkSent", { email: this.email }) };
2035
2452
  });
2036
2453
  }, this.onReset = (e) => {
2037
2454
  if (e.preventDefault(), this.password !== this.passwordConfirm) {
@@ -2040,11 +2457,11 @@ let $ = class extends x {
2040
2457
  }
2041
2458
  const t = this.recovery;
2042
2459
  t && this.run(async () => {
2043
- await o.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.notice = { tone: "success", message: this.t("passwordUpdated") }, this.go("sign-in");
2460
+ await n.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.notice = { tone: "success", message: this.t("passwordUpdated") }, this.go("sign-in");
2044
2461
  });
2045
2462
  }, this.onMagicUrl = (e) => {
2046
2463
  e.preventDefault(), this.run(async () => {
2047
- const t = await o.sendMagicUrl(this.email);
2464
+ const t = await n.sendMagicUrl(this.email);
2048
2465
  this.token = {
2049
2466
  userId: t.userId,
2050
2467
  kind: "magic-url",
@@ -2054,7 +2471,7 @@ let $ = class extends x {
2054
2471
  });
2055
2472
  }, this.onEmailOtp = (e) => {
2056
2473
  e.preventDefault(), this.run(async () => {
2057
- const t = await o.sendEmailOtp(this.email);
2474
+ const t = await n.sendEmailOtp(this.email);
2058
2475
  this.token = {
2059
2476
  userId: t.userId,
2060
2477
  kind: "email-otp",
@@ -2064,37 +2481,37 @@ let $ = class extends x {
2064
2481
  });
2065
2482
  }, this.onPhoneOtp = (e) => {
2066
2483
  e.preventDefault(), this.run(async () => {
2067
- const t = await o.sendPhoneOtp(this.phone);
2484
+ const t = await n.sendPhoneOtp(this.phone);
2068
2485
  this.token = { userId: t.userId, kind: "phone", target: this.phone }, this.code = "";
2069
2486
  });
2070
2487
  }, this.onVerifyCode = (e) => {
2071
2488
  e.preventDefault();
2072
2489
  const t = this.token;
2073
2490
  t && this.run(async () => {
2074
- await o.signInWithToken(t.userId, this.code), this.code = "", this.fire("authui-success", { method: t.kind });
2491
+ await n.signInWithToken(t.userId, this.code), this.code = "", this.fire("authui-success", { method: t.kind });
2075
2492
  }, "code");
2076
2493
  }, this.onChooseFactor = (e) => {
2077
2494
  this.run(async () => {
2078
- const t = await o.createMfaChallenge(e);
2495
+ const t = await n.createMfaChallenge(e);
2079
2496
  this.challenge = { id: t.$id, factor: e }, this.code = "";
2080
2497
  });
2081
2498
  }, this.onVerifyFactor = (e) => {
2082
2499
  e.preventDefault();
2083
2500
  const t = this.challenge;
2084
2501
  t && this.run(async () => {
2085
- await o.completeMfaChallenge(t.id, this.code), this.code = "", this.challenge = null, this.fire("authui-success", { method: "mfa" });
2502
+ await n.completeMfaChallenge(t.id, this.code), this.code = "", this.challenge = null, this.fire("authui-success", { method: "mfa" });
2086
2503
  }, "code");
2087
2504
  }, this.onCancelMfa = () => {
2088
2505
  this.run(async () => {
2089
2506
  try {
2090
- await o.signOut();
2507
+ await n.signOut();
2091
2508
  } catch (e) {
2092
- if (!F(e, b.sessionNotFound)) throw e;
2509
+ if (!B(e, v.sessionNotFound)) throw e;
2093
2510
  }
2094
2511
  this.go("sign-in");
2095
2512
  });
2096
2513
  }, this.onSignOut = () => {
2097
- this.run(() => o.signOut());
2514
+ this.run(() => n.signOut());
2098
2515
  };
2099
2516
  }
2100
2517
  connectedCallback() {
@@ -2109,10 +2526,10 @@ let $ = class extends x {
2109
2526
  /** React to store transitions: MFA pending, redirect results, sign in. */
2110
2527
  syncFromStore() {
2111
2528
  const { status: e, pending: t } = this.auth;
2112
- e === "mfa-required" && this.step !== "mfa" && this.go("mfa"), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }, o.setPending(null)), t?.type === "notice" && (this.notice = {
2529
+ e === "mfa-required" && this.step !== "mfa" && this.go("mfa"), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }, n.setPending(null)), t?.type === "notice" && (this.notice = {
2113
2530
  tone: t.tone === "error" ? "error" : t.tone,
2114
2531
  message: t.message
2115
- }, o.setPending(null));
2532
+ }, n.setPending(null));
2116
2533
  }
2117
2534
  /** Navigate between screens and reset transient state. */
2118
2535
  go(e) {
@@ -2125,7 +2542,7 @@ let $ = class extends x {
2125
2542
  try {
2126
2543
  await e();
2127
2544
  } catch (i) {
2128
- this.error = Z(i, this.strings, t);
2545
+ this.error = at(i, this.strings, t);
2129
2546
  } finally {
2130
2547
  this.busy = !1;
2131
2548
  }
@@ -2152,7 +2569,7 @@ let $ = class extends x {
2152
2569
  >
2153
2570
  ${c.x}
2154
2571
  </button>
2155
- </div>` : n}
2572
+ </div>` : o}
2156
2573
  ${e}
2157
2574
  </div>
2158
2575
  `;
@@ -2184,9 +2601,10 @@ let $ = class extends x {
2184
2601
  }
2185
2602
  return s`
2186
2603
  <header class="header">
2187
- ${e ? s`<img class="logo" src=${e} alt=${t || "Logo"} />` : n}
2604
+ ${e ? s`<img class="logo" src=${e} alt=${t || "Logo"} />` : o}
2605
+ ${n.isPreview ? s`<span class="badge badge-info preview">${this.t("preview")}</span>` : o}
2188
2606
  <h2 class="title" id="authui-title">${i}</h2>
2189
- ${r ? s`<p class="description">${r}</p>` : n}
2607
+ ${r ? s`<p class="description">${r}</p>` : o}
2190
2608
  </header>
2191
2609
  `;
2192
2610
  }
@@ -2194,11 +2612,11 @@ let $ = class extends x {
2194
2612
  return this.error ? s`<div class="alert alert-error" role="alert">
2195
2613
  ${c.alert}
2196
2614
  <div class="alert-body">${this.error}</div>
2197
- </div>` : n;
2615
+ </div>` : o;
2198
2616
  }
2199
2617
  submitButton(e, t = "btn-primary") {
2200
2618
  return s`<button class="btn ${t} btn-block" type="submit" ?disabled=${this.busy}>
2201
- ${this.busy ? s`<span class="spinner" aria-hidden="true"></span>` : n} ${e}
2619
+ ${this.busy ? s`<span class="spinner" aria-hidden="true"></span>` : o} ${e}
2202
2620
  </button>`;
2203
2621
  }
2204
2622
  passwordField(e) {
@@ -2212,7 +2630,7 @@ let $ = class extends x {
2212
2630
  @click=${() => this.go("forgot-password")}
2213
2631
  >
2214
2632
  ${this.t("forgotPassword")}
2215
- </button>` : n}
2633
+ </button>` : o}
2216
2634
  </label>
2217
2635
  <div class="input-wrap">
2218
2636
  <input
@@ -2235,7 +2653,7 @@ let $ = class extends x {
2235
2653
  ${this.showPassword ? c.eyeOff : c.eye}
2236
2654
  </button>
2237
2655
  </div>
2238
- ${e.hint ? s`<p class="hint">${e.hint}</p>` : n}
2656
+ ${e.hint ? s`<p class="hint">${e.hint}</p>` : o}
2239
2657
  </div>
2240
2658
  `;
2241
2659
  }
@@ -2275,11 +2693,11 @@ let $ = class extends x {
2275
2693
  }
2276
2694
  legal() {
2277
2695
  const e = this.config?.legal;
2278
- return !e?.termsUrl && !e?.privacyUrl ? n : s`<p class="legal">
2696
+ return !e?.termsUrl && !e?.privacyUrl ? o : s`<p class="legal">
2279
2697
  ${this.t("agreeTo")}
2280
- ${e.termsUrl ? s`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : n}
2281
- ${e.termsUrl && e.privacyUrl ? s` ${this.t("and")} ` : n}
2282
- ${e.privacyUrl ? s`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : n}.
2698
+ ${e.termsUrl ? s`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : o}
2699
+ ${e.termsUrl && e.privacyUrl ? s` ${this.t("and")} ` : o}
2700
+ ${e.privacyUrl ? s`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : o}.
2283
2701
  </p>`;
2284
2702
  }
2285
2703
  backLink(e = "sign-in") {
@@ -2326,7 +2744,7 @@ let $ = class extends x {
2326
2744
  <span class="avatar">${t[0] ?? "?"}</span>
2327
2745
  <div class="row-main">
2328
2746
  <span class="row-title">${t}</span>
2329
- ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : n}
2747
+ ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : o}
2330
2748
  </div>
2331
2749
  </div>
2332
2750
  </div>
@@ -2334,7 +2752,7 @@ let $ = class extends x {
2334
2752
  <div class="stack-sm">
2335
2753
  ${this.config?.successUrl ? s`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
2336
2754
  >${this.t("continue")}</a
2337
- >` : n}
2755
+ >` : o}
2338
2756
  <button
2339
2757
  class="btn btn-outline btn-block"
2340
2758
  @click=${() => this.fire("authui-open", { view: "account" })}
@@ -2350,7 +2768,7 @@ let $ = class extends x {
2350
2768
  }
2351
2769
  renderProviders() {
2352
2770
  const e = this.config?.methods?.oauth ?? [];
2353
- if (e.length === 0) return n;
2771
+ if (e.length === 0) return o;
2354
2772
  const t = e.length > 2;
2355
2773
  return s`
2356
2774
  <div class="providers ${t ? "two" : ""}">
@@ -2360,11 +2778,11 @@ let $ = class extends x {
2360
2778
  class="btn btn-outline"
2361
2779
  @click=${() => this.onOAuth(i)}
2362
2780
  ?disabled=${this.busy}
2363
- aria-label=${this.t("continueWith", { provider: E(i) })}
2781
+ aria-label=${this.t("continueWith", { provider: D(i) })}
2364
2782
  >
2365
- ${L(i)}
2783
+ ${K(i)}
2366
2784
  <span
2367
- >${t ? E(i) : this.t("continueWith", { provider: E(i) })}</span
2785
+ >${t ? D(i) : this.t("continueWith", { provider: D(i) })}</span
2368
2786
  >
2369
2787
  </button>`
2370
2788
  )}
@@ -2380,7 +2798,7 @@ let $ = class extends x {
2380
2798
  return s`
2381
2799
  <div class="stack">
2382
2800
  ${this.renderProviders()}
2383
- ${i && (t || r.length > 0) ? s`<div class="separator-text">${this.t("or")}</div>` : n}
2801
+ ${i && (t || r.length > 0) ? s`<div class="separator-text">${this.t("or")}</div>` : o}
2384
2802
  ${t ? s`<form class="form" @submit=${this.onSignIn} novalidate>
2385
2803
  ${this.emailField()}
2386
2804
  ${this.passwordField({ label: this.t("password"), autocomplete: "current-password", id: "authui-password", field: "password", forgot: !0 })}
@@ -2396,7 +2814,7 @@ let $ = class extends x {
2396
2814
  ${a.icon} ${a.label}
2397
2815
  </button>`
2398
2816
  )}
2399
- </div>` : n}
2817
+ </div>` : o}
2400
2818
  ${e.anonymous ? s`<button
2401
2819
  type="button"
2402
2820
  class="btn btn-ghost btn-block"
@@ -2404,13 +2822,13 @@ let $ = class extends x {
2404
2822
  ?disabled=${this.busy}
2405
2823
  >
2406
2824
  ${c.ghost} ${this.t("continueAsGuest")}
2407
- </button>` : n}
2825
+ </button>` : o}
2408
2826
  ${t && this.config?.signUp !== !1 ? s`<div class="links">
2409
2827
  <span>${this.t("noAccount")}</span>
2410
2828
  <button type="button" class="btn btn-link" @click=${() => this.go("sign-up")}>
2411
2829
  ${this.t("signUp")}
2412
2830
  </button>
2413
- </div>` : n}
2831
+ </div>` : o}
2414
2832
  ${this.legal()}
2415
2833
  </div>
2416
2834
  `;
@@ -2419,7 +2837,7 @@ let $ = class extends x {
2419
2837
  return s`
2420
2838
  <div class="stack">
2421
2839
  ${this.renderProviders()}
2422
- ${(this.config?.methods?.oauth?.length ?? 0) > 0 ? s`<div class="separator-text">${this.t("or")}</div>` : n}
2840
+ ${(this.config?.methods?.oauth?.length ?? 0) > 0 ? s`<div class="separator-text">${this.t("or")}</div>` : o}
2423
2841
  <form class="form" @submit=${this.onSignUp} novalidate>
2424
2842
  ${this.config?.requireName !== !1 ? s`<div class="field">
2425
2843
  <label class="label" for="authui-name">${this.t("name")}</label>
@@ -2432,7 +2850,7 @@ let $ = class extends x {
2432
2850
  .value=${this.name}
2433
2851
  @input=${this.bind("name")}
2434
2852
  />
2435
- </div>` : n}
2853
+ </div>` : o}
2436
2854
  ${this.emailField()}
2437
2855
  ${this.passwordField({ label: this.t("password"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint") })}
2438
2856
  ${this.renderError()} ${this.submitButton(this.t("createAccount"))}
@@ -2482,7 +2900,7 @@ let $ = class extends x {
2482
2900
  ${this.t("securityPhrase")}: <span class="code">${e}</span>
2483
2901
  </div>
2484
2902
  <div class="alert-body">${this.t("securityPhraseHint")}</div>
2485
- </div>` : n;
2903
+ </div>` : o;
2486
2904
  }
2487
2905
  renderMagicUrl() {
2488
2906
  return this.token ? s`<div class="stack">
@@ -2637,12 +3055,12 @@ let $ = class extends x {
2637
3055
  `;
2638
3056
  }
2639
3057
  };
2640
- $.styles = [...x.styles, ft];
3058
+ $.styles = [...A.styles, At];
2641
3059
  C([
2642
- g({ type: String })
3060
+ f({ type: String })
2643
3061
  ], $.prototype, "view", 2);
2644
3062
  C([
2645
- g({ type: Boolean })
3063
+ f({ type: Boolean })
2646
3064
  ], $.prototype, "embedded", 2);
2647
3065
  C([
2648
3066
  d()
@@ -2669,25 +3087,25 @@ C([
2669
3087
  d()
2670
3088
  ], $.prototype, "recovery", 2);
2671
3089
  C([
2672
- X("form input:not([type=hidden])")
3090
+ rt("form input:not([type=hidden])")
2673
3091
  ], $.prototype, "firstInput", 2);
2674
3092
  $ = C([
2675
- S("authui-sign-in")
3093
+ _("authui-sign-in")
2676
3094
  ], $);
2677
- var vt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, m = (e, t, i, r) => {
2678
- for (var a = r > 1 ? void 0 : r ? yt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
2679
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
2680
- return r && a && vt(t, i, a), a;
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--)
3097
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
3098
+ return r && a && It(t, i, a), a;
2681
3099
  };
2682
- let p = class extends x {
3100
+ let p = class extends A {
2683
3101
  constructor() {
2684
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) => {
2685
- e.preventDefault(), this.run("name", () => o.updateName(this.nameInput), this.t("done"));
3103
+ e.preventDefault(), this.run("name", () => n.updateName(this.nameInput), this.t("done"));
2686
3104
  }, this.onUpdateEmail = (e) => {
2687
3105
  e.preventDefault(), this.run(
2688
3106
  "email",
2689
3107
  async () => {
2690
- await o.updateEmail(this.emailInput, this.emailPassword), this.emailPassword = "";
3108
+ await n.updateEmail(this.emailInput, this.emailPassword), this.emailPassword = "";
2691
3109
  },
2692
3110
  this.t("done")
2693
3111
  );
@@ -2695,7 +3113,7 @@ let p = class extends x {
2695
3113
  e.preventDefault(), this.run(
2696
3114
  "phone",
2697
3115
  async () => {
2698
- await o.updatePhone(this.phoneInput, this.phonePassword), this.phonePassword = "";
3116
+ await n.updatePhone(this.phoneInput, this.phonePassword), this.phonePassword = "";
2699
3117
  },
2700
3118
  this.t("done")
2701
3119
  );
@@ -2703,21 +3121,21 @@ let p = class extends x {
2703
3121
  e.preventDefault(), this.run(
2704
3122
  "guest",
2705
3123
  async () => {
2706
- await o.convertGuest(this.emailInput, this.emailPassword, this.guestName), this.emailPassword = "";
3124
+ await n.convertGuest(this.emailInput, this.emailPassword, this.guestName), this.emailPassword = "";
2707
3125
  },
2708
3126
  this.t("done")
2709
3127
  );
2710
3128
  }, this.onSendVerification = () => {
2711
- this.run("verify", () => o.sendEmailVerification(), this.t("verificationSent"));
3129
+ this.run("verify", () => n.sendEmailVerification(), this.t("verificationSent"));
2712
3130
  }, this.onSendPhoneVerification = () => {
2713
3131
  this.run("verify-phone", async () => {
2714
- await o.sendPhoneVerification(), this.phoneCodeSent = !0;
3132
+ await n.sendPhoneVerification(), this.phoneCodeSent = !0;
2715
3133
  });
2716
3134
  }, this.onConfirmPhoneVerification = (e) => {
2717
3135
  e.preventDefault(), this.run(
2718
3136
  "verify-phone-code",
2719
3137
  async () => {
2720
- await o.confirmPhoneVerification(this.phoneCode), this.phoneCode = "", this.phoneCodeSent = !1;
3138
+ await n.confirmPhoneVerification(this.phoneCode), this.phoneCode = "", this.phoneCodeSent = !1;
2721
3139
  },
2722
3140
  this.t("done")
2723
3141
  );
@@ -2729,44 +3147,44 @@ let p = class extends x {
2729
3147
  this.run(
2730
3148
  "password",
2731
3149
  async () => {
2732
- await o.updatePassword(this.newPassword, this.oldPassword), this.oldPassword = this.newPassword = this.newPasswordConfirm = "";
3150
+ await n.updatePassword(this.newPassword, this.oldPassword), this.oldPassword = this.newPassword = this.newPasswordConfirm = "";
2733
3151
  },
2734
3152
  this.t("passwordUpdated")
2735
3153
  );
2736
3154
  }, this.onToggleMfa = () => {
2737
3155
  const e = !this.user?.mfa;
2738
3156
  this.run("mfa", async () => {
2739
- await o.setMfaEnabled(e), await this.loadFactors();
3157
+ await n.setMfaEnabled(e), await this.loadFactors();
2740
3158
  });
2741
3159
  }, this.onAddAuthenticator = () => {
2742
3160
  this.run("authenticator", async () => {
2743
- this.authenticator = await o.addAuthenticator(), this.authenticatorCode = "";
3161
+ this.authenticator = await n.addAuthenticator(), this.authenticatorCode = "";
2744
3162
  });
2745
3163
  }, this.onVerifyAuthenticator = (e) => {
2746
3164
  e.preventDefault(), this.run(
2747
3165
  "authenticator-code",
2748
3166
  async () => {
2749
- await o.verifyAuthenticator(this.authenticatorCode), this.authenticator = null, this.authenticatorCode = "", await this.loadFactors();
3167
+ await n.verifyAuthenticator(this.authenticatorCode), this.authenticator = null, this.authenticatorCode = "", await this.loadFactors();
2750
3168
  },
2751
3169
  this.t("done")
2752
3170
  );
2753
3171
  }, this.onRemoveAuthenticator = () => {
2754
3172
  this.run("remove-authenticator", async () => {
2755
- await o.removeAuthenticator(), await this.loadFactors();
3173
+ await n.removeAuthenticator(), await this.loadFactors();
2756
3174
  });
2757
3175
  }, this.onRecoveryCodes = () => {
2758
3176
  this.run("recovery", async () => {
2759
3177
  try {
2760
- this.recoveryCodes = await o.createRecoveryCodes();
3178
+ this.recoveryCodes = await n.createRecoveryCodes();
2761
3179
  } catch (e) {
2762
- if (!F(e, b.recoveryCodesExist)) throw e;
2763
- this.recoveryCodes = await o.getRecoveryCodes();
3180
+ if (!B(e, v.recoveryCodesExist)) throw e;
3181
+ this.recoveryCodes = await n.getRecoveryCodes();
2764
3182
  }
2765
3183
  await this.loadFactors();
2766
3184
  });
2767
3185
  }, this.onRegenerateRecoveryCodes = () => {
2768
3186
  this.run("recovery", async () => {
2769
- this.recoveryCodes = await o.regenerateRecoveryCodes();
3187
+ this.recoveryCodes = await n.regenerateRecoveryCodes();
2770
3188
  });
2771
3189
  }, this.onCopyCodes = async () => {
2772
3190
  if (this.recoveryCodes)
@@ -2777,27 +3195,27 @@ let p = class extends x {
2777
3195
  }
2778
3196
  }, this.onStepUpFactor = (e) => {
2779
3197
  this.run("stepup", async () => {
2780
- const t = await o.createMfaChallenge(e);
3198
+ const t = await n.createMfaChallenge(e);
2781
3199
  this.stepUp = { ...this.stepUp, challenge: { id: t.$id, factor: e } }, this.stepUpCode = "";
2782
3200
  });
2783
3201
  }, this.onStepUpVerify = (e) => {
2784
3202
  e.preventDefault();
2785
3203
  const t = this.stepUp;
2786
3204
  t?.challenge && this.run("stepup-code", async () => {
2787
- await o.completeMfaChallenge(t.challenge.id, this.stepUpCode, { signIn: !1 }), this.stepUp = null, this.stepUpCode = "", await t.retry();
3205
+ await n.completeMfaChallenge(t.challenge.id, this.stepUpCode, { signIn: !1 }), this.stepUp = null, this.stepUpCode = "", await t.retry();
2788
3206
  });
2789
3207
  }, this.onDeleteSession = (e) => {
2790
3208
  this.run(`session-${e}`, async () => {
2791
- await o.signOut(e), this.sessions = (this.sessions ?? []).filter((t) => t.$id !== e);
3209
+ await n.signOut(e), this.sessions = (this.sessions ?? []).filter((t) => t.$id !== e);
2792
3210
  });
2793
3211
  }, this.onSignOutAll = () => {
2794
- this.run("sessions-all", () => o.signOutEverywhere());
3212
+ this.run("sessions-all", () => n.signOutEverywhere());
2795
3213
  }, this.onDeleteIdentity = (e) => {
2796
3214
  this.run(`identity-${e}`, async () => {
2797
- await o.deleteIdentity(e), this.identities = (this.identities ?? []).filter((t) => t.$id !== e);
3215
+ await n.deleteIdentity(e), this.identities = (this.identities ?? []).filter((t) => t.$id !== e);
2798
3216
  });
2799
3217
  }, this.onDeleteAccount = () => {
2800
- this.run("delete", () => o.deleteAccount());
3218
+ this.run("delete", () => n.deleteAccount());
2801
3219
  };
2802
3220
  }
2803
3221
  connectedCallback() {
@@ -2831,9 +3249,9 @@ let p = class extends x {
2831
3249
  try {
2832
3250
  await t(), i && (this.notice = { tone: "success", message: i });
2833
3251
  } catch (r) {
2834
- F(r, b.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 = {
2835
3253
  ...this.errors,
2836
- [e]: Z(r, this.strings, e.includes("code") ? "code" : "link")
3254
+ [e]: at(r, this.strings, e.includes("code") ? "code" : "link")
2837
3255
  };
2838
3256
  } finally {
2839
3257
  this.busy = "";
@@ -2843,18 +3261,18 @@ let p = class extends x {
2843
3261
  // ─────────────────────────── loaders ───────────────────────────
2844
3262
  async loadSessions() {
2845
3263
  await this.run("sessions", async () => {
2846
- this.sessions = await o.listSessions();
3264
+ this.sessions = await n.listSessions();
2847
3265
  });
2848
3266
  }
2849
3267
  async loadIdentities() {
2850
3268
  await this.run("identities", async () => {
2851
- this.identities = await o.listIdentities();
3269
+ this.identities = await n.listIdentities();
2852
3270
  });
2853
3271
  }
2854
3272
  async loadLogs() {
2855
3273
  this.busy = "logs";
2856
3274
  try {
2857
- this.logs = await o.listLogs();
3275
+ this.logs = await n.listLogs();
2858
3276
  } catch {
2859
3277
  this.logsSupported = !1, this.logs = [];
2860
3278
  } finally {
@@ -2865,7 +3283,7 @@ let p = class extends x {
2865
3283
  if (!this.factorsLoading) {
2866
3284
  this.factorsLoading = !0;
2867
3285
  try {
2868
- this.factors = await o.listMfaFactors();
3286
+ this.factors = await n.listMfaFactors();
2869
3287
  } catch {
2870
3288
  this.factors = {
2871
3289
  totp: !1,
@@ -2922,7 +3340,7 @@ let p = class extends x {
2922
3340
  ${this.notice ? s`<div class="alert alert-${this.notice.tone}" role="status">
2923
3341
  ${this.notice.tone === "success" ? c.checkCircle : c.info}
2924
3342
  <div class="alert-body">${this.notice.message}</div>
2925
- </div>` : n}
3343
+ </div>` : o}
2926
3344
  ${this.stepUp ? this.renderStepUp() : this.renderTab()}
2927
3345
  </div>
2928
3346
  `;
@@ -2936,12 +3354,13 @@ let p = class extends x {
2936
3354
  <div class="row-main">
2937
3355
  <span class="row-title">
2938
3356
  ${t}
2939
- ${e.mfa ? s`<span class="badge badge-success">${c.shieldCheck} MFA</span>` : n}
3357
+ ${e.mfa ? s`<span class="badge badge-success">${c.shieldCheck} MFA</span>` : o}
3358
+ ${n.isPreview ? s`<span class="badge badge-info">${this.t("preview")}</span>` : o}
2940
3359
  </span>
2941
- ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : n}
3360
+ ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : o}
2942
3361
  </div>
2943
3362
  </div>
2944
- <button class="btn btn-outline btn-sm" @click=${() => o.signOut()}>
3363
+ <button class="btn btn-outline btn-sm" @click=${() => n.signOut()}>
2945
3364
  ${c.logOut} ${this.t("signOut")}
2946
3365
  </button>
2947
3366
  </div>
@@ -2966,19 +3385,19 @@ let p = class extends x {
2966
3385
  return t ? s`<div class="alert alert-error" role="alert">
2967
3386
  ${c.alert}
2968
3387
  <div class="alert-body">${t}</div>
2969
- </div>` : n;
3388
+ </div>` : o;
2970
3389
  }
2971
3390
  spinner(e) {
2972
- return this.busy === e ? s`<span class="spinner" aria-hidden="true"></span>` : n;
3391
+ return this.busy === e ? s`<span class="spinner" aria-hidden="true"></span>` : o;
2973
3392
  }
2974
3393
  card(e, t, i, r, a = !1) {
2975
3394
  return s`<section class="card ${a ? "card-danger" : ""}">
2976
3395
  <div class="card-header">
2977
3396
  <h3 class="card-title">${e}</h3>
2978
- ${t ? s`<p class="card-description">${t}</p>` : n}
3397
+ ${t ? s`<p class="card-description">${t}</p>` : o}
2979
3398
  </div>
2980
3399
  <div class="card-body">${i}</div>
2981
- ${r ? s`<div class="card-footer">${r}</div>` : n}
3400
+ ${r ? s`<div class="card-footer">${r}</div>` : o}
2982
3401
  </section>`;
2983
3402
  }
2984
3403
  verifiedBadge(e) {
@@ -3073,7 +3492,7 @@ let p = class extends x {
3073
3492
  <div class="field">
3074
3493
  <label class="label" for="acc-email"
3075
3494
  >${this.t("email")}
3076
- ${e.email ? this.verifiedBadge(e.emailVerification) : n}</label
3495
+ ${e.email ? this.verifiedBadge(e.emailVerification) : o}</label
3077
3496
  >
3078
3497
  <input
3079
3498
  class="input"
@@ -3096,7 +3515,7 @@ let p = class extends x {
3096
3515
  autocomplete="current-password"
3097
3516
  required
3098
3517
  />
3099
- </div>` : n}
3518
+ </div>` : o}
3100
3519
  ${this.error("email")} ${this.error("verify")}
3101
3520
  </form>`,
3102
3521
  s`
@@ -3107,7 +3526,7 @@ let p = class extends x {
3107
3526
  ?disabled=${!!this.busy}
3108
3527
  >
3109
3528
  ${this.spinner("verify")} ${this.t("verifyEmail")}
3110
- </button>` : n}
3529
+ </button>` : o}
3111
3530
  <button
3112
3531
  class="btn btn-primary btn-sm"
3113
3532
  type="submit"
@@ -3125,7 +3544,7 @@ let p = class extends x {
3125
3544
  <div class="field">
3126
3545
  <label class="label" for="acc-phone"
3127
3546
  >${this.t("phone")}
3128
- ${e.phone ? this.verifiedBadge(e.phoneVerification) : n}</label
3547
+ ${e.phone ? this.verifiedBadge(e.phoneVerification) : o}</label
3129
3548
  >
3130
3549
  <input
3131
3550
  class="input"
@@ -3148,7 +3567,7 @@ let p = class extends x {
3148
3567
  autocomplete="current-password"
3149
3568
  required
3150
3569
  />
3151
- </div>` : n}
3570
+ </div>` : o}
3152
3571
  ${this.phoneCodeSent ? s`<div class="field">
3153
3572
  <label class="label" for="acc-phone-code">${this.t("code")}</label>
3154
3573
  <input
@@ -3159,7 +3578,7 @@ let p = class extends x {
3159
3578
  .value=${this.phoneCode}
3160
3579
  @input=${this.bind("phoneCode")}
3161
3580
  />
3162
- </div>` : n}
3581
+ </div>` : o}
3163
3582
  ${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
3164
3583
  </form>`,
3165
3584
  s`
@@ -3170,7 +3589,7 @@ let p = class extends x {
3170
3589
  ?disabled=${!!this.busy}
3171
3590
  >
3172
3591
  ${this.spinner("verify-phone")} ${this.t("sendCode")}
3173
- </button>` : n}
3592
+ </button>` : o}
3174
3593
  ${this.phoneCodeSent ? s`<button
3175
3594
  class="btn btn-outline btn-sm"
3176
3595
  type="button"
@@ -3178,7 +3597,7 @@ let p = class extends x {
3178
3597
  ?disabled=${!!this.busy}
3179
3598
  >
3180
3599
  ${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
3181
- </button>` : n}
3600
+ </button>` : o}
3182
3601
  <button
3183
3602
  class="btn btn-primary btn-sm"
3184
3603
  type="submit"
@@ -3222,7 +3641,7 @@ let p = class extends x {
3222
3641
  renderSecurity() {
3223
3642
  const e = this.user, t = this.config?.mfa !== !1;
3224
3643
  return s`<div class="section">
3225
- ${this.isGuest ? n : this.card(
3644
+ ${this.isGuest ? o : this.card(
3226
3645
  this.t("changePassword"),
3227
3646
  void 0,
3228
3647
  s`<form
@@ -3243,7 +3662,7 @@ let p = class extends x {
3243
3662
  @input=${this.bind("oldPassword")}
3244
3663
  autocomplete="current-password"
3245
3664
  />
3246
- </div>` : n}
3665
+ </div>` : o}
3247
3666
  <div class="field">
3248
3667
  <label class="label" for="acc-new-password">${this.t("newPassword")}</label>
3249
3668
  <input
@@ -3284,12 +3703,12 @@ let p = class extends x {
3284
3703
  ${this.spinner("password")} ${this.t("update")}
3285
3704
  </button>`
3286
3705
  )}
3287
- ${t ? this.renderMfaCard() : n}
3288
- ${t ? this.renderRecoveryCard() : n}
3706
+ ${t ? this.renderMfaCard() : o}
3707
+ ${t ? this.renderRecoveryCard() : o}
3289
3708
  </div>`;
3290
3709
  }
3291
3710
  renderMfaCard() {
3292
- const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? new tt(o.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() : "";
3293
3712
  return this.card(
3294
3713
  this.t("twoFactor"),
3295
3714
  this.t("twoFactorDescription"),
@@ -3314,7 +3733,7 @@ let p = class extends x {
3314
3733
  <div class="row-main">
3315
3734
  <span class="row-title"
3316
3735
  >${c.smartphone} ${this.t("authenticatorApp")}
3317
- ${t ? this.verifiedBadge(!0) : n}</span
3736
+ ${t ? this.verifiedBadge(!0) : o}</span
3318
3737
  >
3319
3738
  </div>
3320
3739
  ${t ? s`<button
@@ -3323,7 +3742,7 @@ let p = class extends x {
3323
3742
  ?disabled=${!!this.busy}
3324
3743
  >
3325
3744
  ${this.spinner("remove-authenticator")} ${this.t("remove")}
3326
- </button>` : this.authenticator ? n : s`<button
3745
+ </button>` : this.authenticator ? o : s`<button
3327
3746
  class="btn btn-outline btn-sm"
3328
3747
  @click=${this.onAddAuthenticator}
3329
3748
  ?disabled=${!!this.busy}
@@ -3364,7 +3783,7 @@ let p = class extends x {
3364
3783
  ${this.t("cancel")}
3365
3784
  </button>
3366
3785
  </div>
3367
- </form>` : n}
3786
+ </form>` : o}
3368
3787
  </div>`
3369
3788
  );
3370
3789
  }
@@ -3398,7 +3817,7 @@ let p = class extends x {
3398
3817
  ${this.spinner("recovery")} ${c.key}
3399
3818
  ${e ? this.t("recoveryCodes") : this.t("generateRecoveryCodes")}
3400
3819
  </button>
3401
- ${e ? s`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${c.refresh} ${this.t("regenerateRecoveryCodes")}</button>` : n}
3820
+ ${e ? s`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${c.refresh} ${this.t("regenerateRecoveryCodes")}</button>` : o}
3402
3821
  </div>`}
3403
3822
  ${this.error("recovery")}
3404
3823
  </div>`
@@ -3474,8 +3893,8 @@ let p = class extends x {
3474
3893
  }
3475
3894
  // ── Sessions ──
3476
3895
  deviceIcon(e) {
3477
- const t = (e.clientType || e.deviceName || "").toLowerCase();
3478
- return t.includes("smartphone") || t.includes("phone") || t.includes("tablet") ? c.smartphone : t.includes("browser") || t.includes("desktop") ? c.monitor : c.globe;
3896
+ const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
3897
+ return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ? c.smartphone : /desktop|browser/.test(t) || /mac|windows|linux|chrome os/.test(i) ? c.monitor : c.globe;
3479
3898
  }
3480
3899
  renderSessions() {
3481
3900
  const e = this.sessions;
@@ -3491,8 +3910,8 @@ let p = class extends x {
3491
3910
  <div class="row-main">
3492
3911
  <span class="row-title">
3493
3912
  ${t.clientName || t.provider}
3494
- ${t.clientVersion ? s`<span class="muted small">${t.clientVersion}</span>` : n}
3495
- ${t.current ? s`<span class="badge badge-info">${this.t("currentSession")}</span>` : n}
3913
+ ${t.clientVersion ? s`<span class="muted small">${t.clientVersion}</span>` : o}
3914
+ ${t.current ? s`<span class="badge badge-info">${this.t("currentSession")}</span>` : o}
3496
3915
  </span>
3497
3916
  <span class="row-sub"
3498
3917
  >${[t.osName, t.countryName || t.countryCode, t.ip].filter(Boolean).join(" · ")}</span
@@ -3500,7 +3919,7 @@ let p = class extends x {
3500
3919
  </div>
3501
3920
  </div>
3502
3921
  <div class="row-actions">
3503
- ${this.busy === `session-${t.$id}` ? s`<span class="spinner"></span>` : n}
3922
+ ${this.busy === `session-${t.$id}` ? s`<span class="spinner"></span>` : o}
3504
3923
  <button
3505
3924
  class="btn btn-ghost btn-sm"
3506
3925
  @click=${() => this.onDeleteSession(t.$id)}
@@ -3540,9 +3959,9 @@ let p = class extends x {
3540
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(
3541
3960
  (i) => s`<div class="row">
3542
3961
  <div class="inline">
3543
- <span class="device">${L(i.provider)}</span>
3962
+ <span class="device">${K(i.provider)}</span>
3544
3963
  <div class="row-main">
3545
- <span class="row-title">${E(i.provider)}</span>
3964
+ <span class="row-title">${D(i.provider)}</span>
3546
3965
  <span class="row-sub">${i.providerEmail || i.providerUid}</span>
3547
3966
  </div>
3548
3967
  </div>
@@ -3552,7 +3971,7 @@ let p = class extends x {
3552
3971
  @click=${() => this.onDeleteIdentity(i.$id)}
3553
3972
  ?disabled=${!!this.busy}
3554
3973
  >
3555
- ${this.busy === `identity-${i.$id}` ? s`<span class="spinner"></span>` : n}
3974
+ ${this.busy === `identity-${i.$id}` ? s`<span class="spinner"></span>` : o}
3556
3975
  ${this.t("disconnect")}
3557
3976
  </button>
3558
3977
  </div>
@@ -3561,9 +3980,9 @@ let p = class extends x {
3561
3980
  t.length > 0 ? s`${t.filter((i) => !(e ?? []).some((r) => r.provider === i)).map(
3562
3981
  (i) => s`<button
3563
3982
  class="btn btn-outline btn-sm"
3564
- @click=${() => o.signInWithOAuth(i)}
3983
+ @click=${() => n.signInWithOAuth(i)}
3565
3984
  >
3566
- ${L(i)} ${E(i)}
3985
+ ${K(i)} ${D(i)}
3567
3986
  </button>`
3568
3987
  )}` : void 0
3569
3988
  )}
@@ -3592,8 +4011,8 @@ let p = class extends x {
3592
4011
  }
3593
4012
  };
3594
4013
  p.styles = [
3595
- ...x.styles,
3596
- A`
4014
+ ...A.styles,
4015
+ I`
3597
4016
  :host {
3598
4017
  display: block;
3599
4018
  width: 100%;
@@ -3670,102 +4089,102 @@ p.styles = [
3670
4089
  }
3671
4090
  `
3672
4091
  ];
3673
- m([
3674
- g({ type: Boolean })
4092
+ g([
4093
+ f({ type: Boolean })
3675
4094
  ], p.prototype, "embedded", 2);
3676
- m([
3677
- g({ type: String })
4095
+ g([
4096
+ f({ type: String })
3678
4097
  ], p.prototype, "tab", 2);
3679
- m([
4098
+ g([
3680
4099
  d()
3681
4100
  ], p.prototype, "active", 2);
3682
- m([
4101
+ g([
3683
4102
  d()
3684
4103
  ], p.prototype, "busy", 2);
3685
- m([
4104
+ g([
3686
4105
  d()
3687
4106
  ], p.prototype, "notice", 2);
3688
- m([
4107
+ g([
3689
4108
  d()
3690
4109
  ], p.prototype, "errors", 2);
3691
- m([
4110
+ g([
3692
4111
  d()
3693
4112
  ], p.prototype, "nameInput", 2);
3694
- m([
4113
+ g([
3695
4114
  d()
3696
4115
  ], p.prototype, "emailInput", 2);
3697
- m([
4116
+ g([
3698
4117
  d()
3699
4118
  ], p.prototype, "emailPassword", 2);
3700
- m([
4119
+ g([
3701
4120
  d()
3702
4121
  ], p.prototype, "phoneInput", 2);
3703
- m([
4122
+ g([
3704
4123
  d()
3705
4124
  ], p.prototype, "phonePassword", 2);
3706
- m([
4125
+ g([
3707
4126
  d()
3708
4127
  ], p.prototype, "phoneCode", 2);
3709
- m([
4128
+ g([
3710
4129
  d()
3711
4130
  ], p.prototype, "phoneCodeSent", 2);
3712
- m([
4131
+ g([
3713
4132
  d()
3714
4133
  ], p.prototype, "guestName", 2);
3715
- m([
4134
+ g([
3716
4135
  d()
3717
4136
  ], p.prototype, "oldPassword", 2);
3718
- m([
4137
+ g([
3719
4138
  d()
3720
4139
  ], p.prototype, "newPassword", 2);
3721
- m([
4140
+ g([
3722
4141
  d()
3723
4142
  ], p.prototype, "newPasswordConfirm", 2);
3724
- m([
4143
+ g([
3725
4144
  d()
3726
4145
  ], p.prototype, "authenticator", 2);
3727
- m([
4146
+ g([
3728
4147
  d()
3729
4148
  ], p.prototype, "authenticatorCode", 2);
3730
- m([
4149
+ g([
3731
4150
  d()
3732
4151
  ], p.prototype, "factors", 2);
3733
- m([
4152
+ g([
3734
4153
  d()
3735
4154
  ], p.prototype, "recoveryCodes", 2);
3736
- m([
4155
+ g([
3737
4156
  d()
3738
4157
  ], p.prototype, "stepUp", 2);
3739
- m([
4158
+ g([
3740
4159
  d()
3741
4160
  ], p.prototype, "stepUpCode", 2);
3742
- m([
4161
+ g([
3743
4162
  d()
3744
4163
  ], p.prototype, "copied", 2);
3745
- m([
4164
+ g([
3746
4165
  d()
3747
4166
  ], p.prototype, "sessions", 2);
3748
- m([
4167
+ g([
3749
4168
  d()
3750
4169
  ], p.prototype, "identities", 2);
3751
- m([
4170
+ g([
3752
4171
  d()
3753
4172
  ], p.prototype, "logs", 2);
3754
- m([
4173
+ g([
3755
4174
  d()
3756
4175
  ], p.prototype, "logsSupported", 2);
3757
- m([
4176
+ g([
3758
4177
  d()
3759
4178
  ], p.prototype, "confirmDelete", 2);
3760
- p = m([
3761
- S("authui-account")
4179
+ p = g([
4180
+ _("authui-account")
3762
4181
  ], p);
3763
- var wt = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, U = (e, t, i, r) => {
3764
- for (var a = r > 1 ? void 0 : r ? $t(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3765
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3766
- return r && a && wt(t, i, a), a;
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--)
4184
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4185
+ return r && a && Ft(t, i, a), a;
3767
4186
  };
3768
- let P = class extends x {
4187
+ let E = class extends A {
3769
4188
  constructor() {
3770
4189
  super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.onOpenEvent = (e) => {
3771
4190
  const t = e.detail ?? {};
@@ -3822,15 +4241,15 @@ let P = class extends x {
3822
4241
  embedded
3823
4242
  .view=${this.view}
3824
4243
  @authui-success=${this.onSuccess}
3825
- ></authui-sign-in>` : n}
4244
+ ></authui-sign-in>` : o}
3826
4245
  </div>
3827
4246
  </dialog>
3828
4247
  `;
3829
4248
  }
3830
4249
  };
3831
- P.styles = [
3832
- ...x.styles,
3833
- A`
4250
+ E.styles = [
4251
+ ...A.styles,
4252
+ I`
3834
4253
  :host {
3835
4254
  display: contents;
3836
4255
  }
@@ -3890,38 +4309,38 @@ P.styles = [
3890
4309
  }
3891
4310
  `
3892
4311
  ];
3893
- U([
3894
- g({ type: Boolean, reflect: !0 })
3895
- ], P.prototype, "open", 2);
3896
- U([
3897
- g({ type: String })
3898
- ], P.prototype, "view", 2);
3899
- U([
3900
- g({ type: Boolean, attribute: "close-on-success" })
3901
- ], P.prototype, "closeOnSuccess", 2);
3902
- U([
4312
+ O([
4313
+ f({ type: Boolean, reflect: !0 })
4314
+ ], E.prototype, "open", 2);
4315
+ O([
4316
+ f({ type: String })
4317
+ ], E.prototype, "view", 2);
4318
+ O([
4319
+ f({ type: Boolean, attribute: "close-on-success" })
4320
+ ], E.prototype, "closeOnSuccess", 2);
4321
+ O([
3903
4322
  d()
3904
- ], P.prototype, "handledPending", 2);
3905
- U([
3906
- X("dialog")
3907
- ], P.prototype, "dialog", 2);
3908
- P = U([
3909
- S("authui-modal")
3910
- ], P);
3911
- function R(e) {
4323
+ ], E.prototype, "handledPending", 2);
4324
+ O([
4325
+ rt("dialog")
4326
+ ], E.prototype, "dialog", 2);
4327
+ E = O([
4328
+ _("authui-modal")
4329
+ ], E);
4330
+ function Y(e) {
3912
4331
  typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
3913
4332
  window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
3914
4333
  }));
3915
4334
  }
3916
- function Ut() {
4335
+ function Bt() {
3917
4336
  typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
3918
4337
  }
3919
- var xt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, O = (e, t, i, r) => {
3920
- for (var a = r > 1 ? void 0 : r ? kt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3921
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3922
- return r && a && xt(t, i, a), a;
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--)
4340
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4341
+ return r && a && Ot(t, i, a), a;
3923
4342
  };
3924
- let M = class extends x {
4343
+ let z = class extends A {
3925
4344
  constructor() {
3926
4345
  super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
3927
4346
  }
@@ -3929,7 +4348,7 @@ let M = class extends x {
3929
4348
  const e = this.size === "md" ? "" : `btn-${this.size}`;
3930
4349
  return s`<button
3931
4350
  class="btn btn-${this.variant} ${e}"
3932
- @click=${() => R(this.view)}
4351
+ @click=${() => Y(this.view)}
3933
4352
  part="button"
3934
4353
  >
3935
4354
  <slot
@@ -3938,9 +4357,9 @@ let M = class extends x {
3938
4357
  </button>`;
3939
4358
  }
3940
4359
  };
3941
- M.styles = [
3942
- ...x.styles,
3943
- A`
4360
+ z.styles = [
4361
+ ...A.styles,
4362
+ I`
3944
4363
  :host {
3945
4364
  display: inline-block;
3946
4365
  }
@@ -3949,24 +4368,24 @@ M.styles = [
3949
4368
  }
3950
4369
  `
3951
4370
  ];
3952
- O([
3953
- g({ type: String })
3954
- ], M.prototype, "view", 2);
3955
- O([
3956
- g({ type: String })
3957
- ], M.prototype, "variant", 2);
3958
- O([
3959
- g({ type: String })
3960
- ], M.prototype, "size", 2);
3961
- M = O([
3962
- S("authui-button")
3963
- ], M);
3964
- var Ct = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, q = (e, t, i, r) => {
3965
- for (var a = r > 1 ? void 0 : r ? Pt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3966
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3967
- return r && a && Ct(t, i, a), a;
4371
+ j([
4372
+ f({ type: String })
4373
+ ], z.prototype, "view", 2);
4374
+ j([
4375
+ f({ type: String })
4376
+ ], z.prototype, "variant", 2);
4377
+ j([
4378
+ f({ type: String })
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) => {
4384
+ for (var a = r > 1 ? void 0 : r ? Rt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4385
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4386
+ return r && a && Lt(t, i, a), a;
3968
4387
  };
3969
- let I = class extends x {
4388
+ let R = class extends A {
3970
4389
  constructor() {
3971
4390
  super(...arguments), this.src = "", this.menuOpen = !1, this.onDocumentClick = (e) => {
3972
4391
  e.composedPath().includes(this) || (this.menuOpen = !1);
@@ -3975,17 +4394,17 @@ let I = class extends x {
3975
4394
  };
3976
4395
  }
3977
4396
  connectedCallback() {
3978
- 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);
3979
4398
  }
3980
4399
  disconnectedCallback() {
3981
- 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);
3982
4401
  }
3983
4402
  render() {
3984
4403
  const { status: e, user: t } = this.auth;
3985
4404
  if (e === "loading")
3986
4405
  return s`<span class="avatar"><span class="spinner"></span></span>`;
3987
4406
  if (e !== "signed-in" || !t)
3988
- return s`<button class="btn btn-primary btn-sm" @click=${() => R("sign-in")}>
4407
+ return s`<button class="btn btn-primary btn-sm" @click=${() => Y("sign-in")}>
3989
4408
  <slot>${this.t("signIn")}</slot>
3990
4409
  </button>`;
3991
4410
  const i = t.name || t.email || t.phone || this.t("guestAccount");
@@ -4004,13 +4423,13 @@ let I = class extends x {
4004
4423
  ${this.menuOpen ? s`<div class="menu" role="menu">
4005
4424
  <div class="menu-header">
4006
4425
  <span class="row-title">${i}</span>
4007
- ${t.email && t.name ? s`<span class="row-sub">${t.email}</span>` : n}
4426
+ ${t.email && t.name ? s`<span class="row-sub">${t.email}</span>` : o}
4008
4427
  </div>
4009
4428
  <button
4010
4429
  class="menu-item"
4011
4430
  role="menuitem"
4012
4431
  @click=${() => {
4013
- this.menuOpen = !1, R("account");
4432
+ this.menuOpen = !1, Y("account");
4014
4433
  }}
4015
4434
  >
4016
4435
  ${c.settings} ${this.t("manageAccount")}
@@ -4019,18 +4438,18 @@ let I = class extends x {
4019
4438
  class="menu-item"
4020
4439
  role="menuitem"
4021
4440
  @click=${() => {
4022
- this.menuOpen = !1, o.signOut();
4441
+ this.menuOpen = !1, n.signOut();
4023
4442
  }}
4024
4443
  >
4025
4444
  ${c.logOut} ${this.t("signOut")}
4026
4445
  </button>
4027
- </div>` : n}
4446
+ </div>` : o}
4028
4447
  `;
4029
4448
  }
4030
4449
  };
4031
- I.styles = [
4032
- ...x.styles,
4033
- A`
4450
+ R.styles = [
4451
+ ...A.styles,
4452
+ I`
4034
4453
  :host {
4035
4454
  display: inline-block;
4036
4455
  position: relative;
@@ -4108,32 +4527,32 @@ I.styles = [
4108
4527
  }
4109
4528
  `
4110
4529
  ];
4111
- q([
4112
- g({ type: String })
4113
- ], I.prototype, "src", 2);
4114
- q([
4530
+ Q([
4531
+ f({ type: String })
4532
+ ], R.prototype, "src", 2);
4533
+ Q([
4115
4534
  d()
4116
- ], I.prototype, "menuOpen", 2);
4117
- I = q([
4118
- S("authui-user-button")
4119
- ], I);
4535
+ ], R.prototype, "menuOpen", 2);
4536
+ R = Q([
4537
+ _("authui-user-button")
4538
+ ], R);
4120
4539
  export {
4121
- rt as A,
4122
- b as E,
4123
- o as a,
4540
+ gt as A,
4541
+ v as E,
4542
+ ft as P,
4543
+ n as a,
4124
4544
  p as b,
4125
- Ut as c,
4126
- M as d,
4127
- v as e,
4128
- x as f,
4129
- P as g,
4130
- $ as h,
4131
- Y as i,
4132
- K as j,
4133
- I as k,
4134
- et as l,
4135
- Z as m,
4136
- R as o,
4137
- E as p,
4138
- _ as t
4545
+ Bt as c,
4546
+ z as d,
4547
+ b as e,
4548
+ A as f,
4549
+ E as g,
4550
+ L as h,
4551
+ $ as i,
4552
+ R as j,
4553
+ dt as k,
4554
+ at as l,
4555
+ Y as o,
4556
+ D as p,
4557
+ N as t
4139
4558
  };