@getauthui/core 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -5
- package/dist/active-team.d.ts +4 -0
- package/dist/active-team.d.ts.map +1 -0
- package/dist/{authui-user-button-PQdLnij_.js → authui-user-button-CZBp3mFt.js} +966 -605
- package/dist/authui.cdn.js +391 -250
- package/dist/authui.cdn.mjs +1747 -1386
- package/dist/authui.js +57 -48
- package/dist/components/authui-account.d.ts.map +1 -1
- package/dist/components/authui-config.d.ts +1 -1
- package/dist/components/authui-config.d.ts.map +1 -1
- package/dist/components/authui-show.d.ts +10 -0
- package/dist/components/authui-show.d.ts.map +1 -1
- package/dist/components/authui-sign-in.d.ts.map +1 -1
- package/dist/components/authui-user-button.d.ts +8 -0
- package/dist/components/authui-user-button.d.ts.map +1 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/icons.d.ts +1 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/last-method.d.ts +7 -0
- package/dist/last-method.d.ts.map +1 -0
- package/dist/password-strength.d.ts +21 -0
- package/dist/password-strength.d.ts.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/dist/store.d.ts +18 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/styles/base.d.ts.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { css as
|
|
3
|
-
import { Client as
|
|
4
|
-
const
|
|
1
|
+
import { state as h, property as g, customElement as O, query as gt } from "lit/decorators.js";
|
|
2
|
+
import { css as F, LitElement as it, nothing as o, html as r, svg as d } from "lit";
|
|
3
|
+
import { Client as at, Account as nt, Teams as bt, ID as j, Avatars as yt } from "appwrite";
|
|
4
|
+
const wt = {
|
|
5
5
|
signIn: "Sign in",
|
|
6
6
|
dialogSignIn: "Sign in",
|
|
7
7
|
signUp: "Sign up",
|
|
@@ -145,7 +145,20 @@ const ht = {
|
|
|
145
145
|
errorNetwork: "Could not reach the server. Check your connection.",
|
|
146
146
|
errorMethodDisabled: "This sign-in method is disabled for this project.",
|
|
147
147
|
errorNotConfigured: "Auth UI is not configured. Call AuthUI.init() or add <authui-config>.",
|
|
148
|
+
errorConfigIncomplete: "Auth UI is missing endpoint or project. Set them on <authui-config> or pass them to AuthUI.init().",
|
|
149
|
+
errorConfig: "Auth UI cannot reach this Appwrite project. Check that endpoint ends with /v1, the project ID is correct, and this hostname is registered as a Web platform.",
|
|
150
|
+
errorConfigEndpoint: "Check that endpoint ends with /v1. Appwrite API URLs look like https://cloud.appwrite.io/v1.",
|
|
148
151
|
passwordHint: "At least 8 characters.",
|
|
152
|
+
passwordStrengthLabel: "Password strength",
|
|
153
|
+
passwordStrengthTooWeak: "Too weak",
|
|
154
|
+
passwordStrengthWeak: "Weak",
|
|
155
|
+
passwordStrengthFair: "Fair",
|
|
156
|
+
passwordStrengthStrong: "Strong",
|
|
157
|
+
passwordStrengthVeryStrong: "Very strong",
|
|
158
|
+
lastUsed: "Last used",
|
|
159
|
+
teamsLabel: "Teams",
|
|
160
|
+
noTeams: "You are not on any teams yet.",
|
|
161
|
+
activeTeam: "Active",
|
|
149
162
|
signedInAs: "Signed in as",
|
|
150
163
|
manageAccount: "Manage account",
|
|
151
164
|
dialogAccount: "Account",
|
|
@@ -156,13 +169,13 @@ const ht = {
|
|
|
156
169
|
guestAccountDescription: "Add an email and password to keep your data.",
|
|
157
170
|
preview: "Preview"
|
|
158
171
|
};
|
|
159
|
-
function
|
|
172
|
+
function $t(e, t = {}) {
|
|
160
173
|
return e.replace(
|
|
161
174
|
/\{(\w+)\}/g,
|
|
162
175
|
(i, s) => s in t ? String(t[s]) : `{${s}}`
|
|
163
176
|
);
|
|
164
177
|
}
|
|
165
|
-
const
|
|
178
|
+
const xt = {
|
|
166
179
|
amazon: "Amazon",
|
|
167
180
|
apple: "Apple",
|
|
168
181
|
appwrite: "Appwrite",
|
|
@@ -213,10 +226,10 @@ const pt = {
|
|
|
213
226
|
zoho: "Zoho",
|
|
214
227
|
zoom: "Zoom"
|
|
215
228
|
};
|
|
216
|
-
function
|
|
217
|
-
return
|
|
229
|
+
function q(e) {
|
|
230
|
+
return xt[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
218
231
|
}
|
|
219
|
-
const
|
|
232
|
+
const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), U = (e) => new Date(Date.now() - e * 6e4).toISOString(), W = [
|
|
220
233
|
"amber",
|
|
221
234
|
"brave",
|
|
222
235
|
"calm",
|
|
@@ -229,13 +242,13 @@ const T = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
229
242
|
"juniper",
|
|
230
243
|
"kite",
|
|
231
244
|
"lumen"
|
|
232
|
-
],
|
|
245
|
+
], ot = () => `${W[Math.floor(Math.random() * W.length)]}-${W[Math.floor(Math.random() * W.length)]}`, T = () => Math.random().toString(36).slice(2, 12), ct = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), kt = {
|
|
233
246
|
name: "Ada Lovelace",
|
|
234
247
|
email: "ada@example.com",
|
|
235
248
|
phone: "+15550100"
|
|
236
249
|
};
|
|
237
|
-
class
|
|
238
|
-
constructor(t =
|
|
250
|
+
class Ct {
|
|
251
|
+
constructor(t = kt) {
|
|
239
252
|
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;
|
|
240
253
|
}
|
|
241
254
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -299,7 +312,7 @@ class mt {
|
|
|
299
312
|
},
|
|
300
313
|
{
|
|
301
314
|
...i,
|
|
302
|
-
$id:
|
|
315
|
+
$id: T(),
|
|
303
316
|
$createdAt: U(300),
|
|
304
317
|
provider: t,
|
|
305
318
|
ip: "198.51.100.7",
|
|
@@ -316,7 +329,7 @@ class mt {
|
|
|
316
329
|
},
|
|
317
330
|
{
|
|
318
331
|
...i,
|
|
319
|
-
$id:
|
|
332
|
+
$id: T(),
|
|
320
333
|
$createdAt: U(1440 * 3),
|
|
321
334
|
provider: "oauth2",
|
|
322
335
|
ip: "192.0.2.90",
|
|
@@ -371,9 +384,9 @@ class mt {
|
|
|
371
384
|
}
|
|
372
385
|
requireUser() {
|
|
373
386
|
if (!this.user)
|
|
374
|
-
throw
|
|
387
|
+
throw H("general_unauthorized_scope", "User (role: guests) missing scope (account)");
|
|
375
388
|
if (this.mfaPending)
|
|
376
|
-
throw
|
|
389
|
+
throw H(
|
|
377
390
|
"user_more_factors_required",
|
|
378
391
|
"More factors are required to complete the sign in process."
|
|
379
392
|
);
|
|
@@ -381,7 +394,7 @@ class mt {
|
|
|
381
394
|
}
|
|
382
395
|
requireRecentChallenge() {
|
|
383
396
|
if (Date.now() - this.lastChallenge > 30 * 6e4)
|
|
384
|
-
throw
|
|
397
|
+
throw H(
|
|
385
398
|
"user_challenge_required",
|
|
386
399
|
"A recently successful challenge is required to complete this action."
|
|
387
400
|
);
|
|
@@ -417,26 +430,26 @@ class mt {
|
|
|
417
430
|
}
|
|
418
431
|
async createMagicURLToken(t, i) {
|
|
419
432
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
420
|
-
$id:
|
|
433
|
+
$id: T(),
|
|
421
434
|
$createdAt: P(),
|
|
422
435
|
userId: t,
|
|
423
436
|
secret: "",
|
|
424
437
|
expire: "",
|
|
425
|
-
phrase:
|
|
438
|
+
phrase: ot()
|
|
426
439
|
});
|
|
427
440
|
}
|
|
428
441
|
async createEmailToken(t, i) {
|
|
429
442
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
430
|
-
$id:
|
|
443
|
+
$id: T(),
|
|
431
444
|
$createdAt: P(),
|
|
432
445
|
userId: t,
|
|
433
446
|
secret: "",
|
|
434
447
|
expire: "",
|
|
435
|
-
phrase:
|
|
448
|
+
phrase: ot()
|
|
436
449
|
});
|
|
437
450
|
}
|
|
438
451
|
async createPhoneToken(t, i) {
|
|
439
|
-
return this.tokens.set(t, { phone: i }), this.delay({ $id:
|
|
452
|
+
return this.tokens.set(t, { phone: i }), this.delay({ $id: T(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
|
|
440
453
|
}
|
|
441
454
|
async createSession(t) {
|
|
442
455
|
return this.delay(() => {
|
|
@@ -528,7 +541,7 @@ class mt {
|
|
|
528
541
|
});
|
|
529
542
|
}
|
|
530
543
|
async createMFAChallenge() {
|
|
531
|
-
return this.delay({ $id:
|
|
544
|
+
return this.delay({ $id: T(), $createdAt: P(), userId: "preview-user", expire: "" });
|
|
532
545
|
}
|
|
533
546
|
async updateMFAChallenge() {
|
|
534
547
|
return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
|
|
@@ -557,35 +570,35 @@ class mt {
|
|
|
557
570
|
async createMFARecoveryCodes() {
|
|
558
571
|
return this.delay(() => {
|
|
559
572
|
if (this.recoveryCodes.length > 0)
|
|
560
|
-
throw
|
|
561
|
-
return this.recoveryCodes = Array.from({ length: 6 },
|
|
573
|
+
throw H("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
|
|
574
|
+
return this.recoveryCodes = Array.from({ length: 6 }, ct), { recoveryCodes: this.recoveryCodes };
|
|
562
575
|
});
|
|
563
576
|
}
|
|
564
577
|
async getMFARecoveryCodes() {
|
|
565
578
|
return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
|
|
566
579
|
}
|
|
567
580
|
async updateMFARecoveryCodes() {
|
|
568
|
-
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 },
|
|
581
|
+
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, ct), { recoveryCodes: this.recoveryCodes }));
|
|
569
582
|
}
|
|
570
583
|
/** Forget everything, as a sign out would. */
|
|
571
584
|
reset() {
|
|
572
585
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
573
586
|
}
|
|
574
587
|
}
|
|
575
|
-
function
|
|
588
|
+
function St(e) {
|
|
576
589
|
let t = 2166136261;
|
|
577
590
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
578
591
|
for (const x of e) t = (t ^ x.charCodeAt(0)) * 16777619;
|
|
579
592
|
const s = 25;
|
|
580
593
|
let a = "";
|
|
581
|
-
const
|
|
594
|
+
const l = (x, C) => `<rect x="${x}" y="${C}" width="7" height="7"/><rect x="${x + 1}" y="${C + 1}" width="5" height="5" fill="#fff"/><rect x="${x + 2}" y="${C + 2}" width="3" height="3"/>`;
|
|
582
595
|
for (let x = 0; x < s; x++)
|
|
583
596
|
for (let C = 0; C < s; C++)
|
|
584
597
|
!(C < 8 && x < 8 || C >= s - 8 && x < 8 || C < 8 && x >= s - 8) && i() < 0.45 && (a += `<rect x="${C}" y="${x}" width="1" height="1"/>`);
|
|
585
|
-
const
|
|
586
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
598
|
+
const u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${l(0, 0)}${l(s - 7, 0)}${l(0, s - 7)}${a}</g></svg>`;
|
|
599
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(u)}`;
|
|
587
600
|
}
|
|
588
|
-
const
|
|
601
|
+
const f = {
|
|
589
602
|
moreFactorsRequired: "user_more_factors_required",
|
|
590
603
|
invalidCredentials: "user_invalid_credentials",
|
|
591
604
|
userAlreadyExists: "user_already_exists",
|
|
@@ -605,6 +618,8 @@ const v = {
|
|
|
605
618
|
recoveryCodesNotFound: "user_recovery_codes_not_found",
|
|
606
619
|
authenticatorNotFound: "user_authenticator_not_found",
|
|
607
620
|
routeNotFound: "general_route_not_found",
|
|
621
|
+
projectNotFound: "project_not_found",
|
|
622
|
+
unknownOrigin: "general_unknown_origin",
|
|
608
623
|
emailAlreadyVerified: "user_email_already_verified",
|
|
609
624
|
sessionNotFound: "user_session_not_found",
|
|
610
625
|
wafChallenged: "waf_request_challenged",
|
|
@@ -618,7 +633,7 @@ const v = {
|
|
|
618
633
|
targetAlreadyExists: "user_target_already_exists",
|
|
619
634
|
argumentInvalid: "general_argument_invalid"
|
|
620
635
|
};
|
|
621
|
-
function
|
|
636
|
+
function R(e) {
|
|
622
637
|
if (e && typeof e == "object") {
|
|
623
638
|
const t = e;
|
|
624
639
|
let i = typeof t.message == "string" ? t.message : "Unknown error";
|
|
@@ -630,51 +645,71 @@ function B(e) {
|
|
|
630
645
|
}
|
|
631
646
|
return { message: String(e), type: "", code: 0 };
|
|
632
647
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
648
|
+
function N(e, t) {
|
|
649
|
+
return R(e).type === t;
|
|
635
650
|
}
|
|
636
|
-
function
|
|
637
|
-
const s =
|
|
651
|
+
function K(e, t, i = "link") {
|
|
652
|
+
const s = R(e);
|
|
638
653
|
switch (s.type) {
|
|
639
|
-
case
|
|
654
|
+
case f.invalidCredentials:
|
|
640
655
|
return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
|
|
641
|
-
case
|
|
642
|
-
case
|
|
643
|
-
case
|
|
656
|
+
case f.userAlreadyExists:
|
|
657
|
+
case f.emailAlreadyExists:
|
|
658
|
+
case f.phoneAlreadyExists:
|
|
644
659
|
return t.errorUserExists;
|
|
645
|
-
case
|
|
660
|
+
case f.userBlocked:
|
|
646
661
|
return t.errorUserBlocked;
|
|
647
|
-
case
|
|
662
|
+
case f.rateLimit:
|
|
648
663
|
return t.errorRateLimit;
|
|
649
|
-
case
|
|
664
|
+
case f.invalidToken:
|
|
650
665
|
return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
|
|
651
|
-
case
|
|
666
|
+
case f.invalidCode:
|
|
652
667
|
return t.errorInvalidCode;
|
|
653
|
-
case
|
|
668
|
+
case f.passwordMismatch:
|
|
654
669
|
return t.errorPasswordMismatch;
|
|
655
|
-
case
|
|
670
|
+
case f.passwordRecentlyUsed:
|
|
656
671
|
return t.errorPasswordRecentlyUsed;
|
|
657
|
-
case
|
|
672
|
+
case f.passwordPersonalData:
|
|
658
673
|
return t.errorPasswordPersonalData;
|
|
659
|
-
case
|
|
674
|
+
case f.passwordWeak:
|
|
660
675
|
return t.errorPasswordWeak;
|
|
661
|
-
case
|
|
676
|
+
case f.passwordPwned:
|
|
662
677
|
return t.errorPasswordPwned;
|
|
663
|
-
case
|
|
678
|
+
case f.challengeRequired:
|
|
664
679
|
return t.errorChallengeRequired;
|
|
665
|
-
case
|
|
680
|
+
case f.sessionAlreadyExists:
|
|
666
681
|
return t.errorSessionExists;
|
|
667
|
-
case
|
|
668
|
-
case
|
|
682
|
+
case f.oauthUnauthorized:
|
|
683
|
+
case f.oauthBadRequest:
|
|
669
684
|
return t.errorOAuth;
|
|
670
|
-
case
|
|
685
|
+
case f.authMethodUnsupported:
|
|
671
686
|
return t.errorMethodDisabled;
|
|
672
687
|
}
|
|
673
|
-
if (s.type ===
|
|
688
|
+
if (s.type === f.argumentInvalid || /Invalid `\w+` param/i.test(s.message)) {
|
|
674
689
|
const a = s.message.match(/Invalid `([^`]+)` param/i)?.[1]?.toLowerCase();
|
|
675
690
|
return a === "email" ? t.errorInvalidEmail : a === "password" ? t.errorInvalidPassword : a === "phone" ? t.errorInvalidPhone : a === "name" ? t.errorInvalidName : t.errorGeneric;
|
|
676
691
|
}
|
|
677
|
-
return s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message)
|
|
692
|
+
return s.type === f.projectNotFound || s.type === f.unknownOrigin ? t.errorConfig : s.type === f.routeNotFound ? t.errorConfigEndpoint : s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message) ? t.errorGeneric : s.message ? s.message || t.errorGeneric : s.code === 404 || s.type === f.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
|
|
693
|
+
}
|
|
694
|
+
function Pt(e) {
|
|
695
|
+
const t = R(e);
|
|
696
|
+
return !!(t.type === f.projectNotFound || t.type === f.unknownOrigin || t.type === f.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
|
|
697
|
+
}
|
|
698
|
+
const Q = (e) => `authui:active-team:${e}`;
|
|
699
|
+
function lt(e) {
|
|
700
|
+
if (typeof localStorage > "u" || !e) return null;
|
|
701
|
+
try {
|
|
702
|
+
return localStorage.getItem(Q(e));
|
|
703
|
+
} catch {
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function At(e, t) {
|
|
708
|
+
if (!(typeof localStorage > "u" || !e))
|
|
709
|
+
try {
|
|
710
|
+
t ? localStorage.setItem(Q(e), t) : localStorage.removeItem(Q(e));
|
|
711
|
+
} catch {
|
|
712
|
+
}
|
|
678
713
|
}
|
|
679
714
|
function S(e, t, i) {
|
|
680
715
|
for (const s of t) {
|
|
@@ -686,21 +721,41 @@ function S(e, t, i) {
|
|
|
686
721
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
687
722
|
);
|
|
688
723
|
}
|
|
689
|
-
const
|
|
724
|
+
const J = "authui", dt = ["userId", "secret", "expire", "project", "error", J], ht = () => ({
|
|
690
725
|
status: "loading",
|
|
691
726
|
user: null,
|
|
692
727
|
mfaFactors: null,
|
|
693
728
|
pending: null,
|
|
694
|
-
configured: !1
|
|
729
|
+
configured: !1,
|
|
730
|
+
configError: null
|
|
695
731
|
});
|
|
696
|
-
class
|
|
732
|
+
class Ut {
|
|
697
733
|
constructor() {
|
|
698
|
-
this.client = null, this.account = null, this.config = null, this.state =
|
|
734
|
+
this.client = null, this.account = null, this.config = null, this.state = ht(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
699
735
|
}
|
|
700
736
|
// ───────────────────────────── configuration ─────────────────────────────
|
|
701
737
|
/** Configure the Appwrite client. Safe to call more than once; the last call wins. */
|
|
702
738
|
configure(t) {
|
|
703
|
-
|
|
739
|
+
const i = t.endpoint.trim().replace(/\/+$/, "");
|
|
740
|
+
i && !i.endsWith("/v1") && console.warn(
|
|
741
|
+
`[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
|
|
742
|
+
), this.config = t, this.client = new at().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Ct() : null, this.account = this.preview ? this.preview : new nt(this.client), this.teams = null, this.activeTeamId = lt(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Called by <authui-config> when it is on the page but missing endpoint or project.
|
|
746
|
+
* Moves status off "loading" so the UI can show a developer-facing message.
|
|
747
|
+
*/
|
|
748
|
+
notifyConfigIncomplete() {
|
|
749
|
+
if (this.config) return;
|
|
750
|
+
const t = this.getStrings().errorConfigIncomplete;
|
|
751
|
+
console.warn(`[authui] ${t}`), this.setState({
|
|
752
|
+
status: "signed-out",
|
|
753
|
+
user: null,
|
|
754
|
+
mfaFactors: null,
|
|
755
|
+
configured: !1,
|
|
756
|
+
configError: t,
|
|
757
|
+
pending: { type: "notice", tone: "error", message: t }
|
|
758
|
+
});
|
|
704
759
|
}
|
|
705
760
|
get isConfigured() {
|
|
706
761
|
return this.config !== null;
|
|
@@ -727,8 +782,31 @@ class vt {
|
|
|
727
782
|
getAccount() {
|
|
728
783
|
return this.account;
|
|
729
784
|
}
|
|
785
|
+
/** List teams the signed-in user belongs to. Empty in preview or when signed out. */
|
|
786
|
+
async listTeams() {
|
|
787
|
+
if (this.preview || !this.client || this.state.status !== "signed-in") return [];
|
|
788
|
+
this.teams ??= new bt(this.client);
|
|
789
|
+
try {
|
|
790
|
+
return (await this.teams.list()).teams ?? [];
|
|
791
|
+
} catch (t) {
|
|
792
|
+
this.fail(t);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
getActiveTeamId() {
|
|
796
|
+
if (this.activeTeamId) return this.activeTeamId;
|
|
797
|
+
const t = this.config?.project;
|
|
798
|
+
return t ? (this.activeTeamId = lt(t), this.activeTeamId) : null;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Remember the active team locally and emit `active-team`.
|
|
802
|
+
* Does not call Appwrite; membership is already required to appear in listTeams().
|
|
803
|
+
*/
|
|
804
|
+
setActiveTeam(t) {
|
|
805
|
+
const i = this.config?.project;
|
|
806
|
+
i && At(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
|
|
807
|
+
}
|
|
730
808
|
getStrings() {
|
|
731
|
-
return { ...
|
|
809
|
+
return { ...wt, ...this.config?.strings ?? {} };
|
|
732
810
|
}
|
|
733
811
|
getState() {
|
|
734
812
|
return { ...this.state };
|
|
@@ -754,7 +832,7 @@ class vt {
|
|
|
754
832
|
this.state = { ...this.state, ...t }, this.emit("change", this.getState());
|
|
755
833
|
}
|
|
756
834
|
fail(t) {
|
|
757
|
-
const i =
|
|
835
|
+
const i = R(t);
|
|
758
836
|
throw this.emit("error", i), t;
|
|
759
837
|
}
|
|
760
838
|
acct() {
|
|
@@ -772,9 +850,9 @@ class vt {
|
|
|
772
850
|
const t = this.state.status === "signed-in";
|
|
773
851
|
try {
|
|
774
852
|
const i = await this.account.get();
|
|
775
|
-
this.setState({ status: "signed-in", user: i, mfaFactors: null }), t || this.emit("signed-in", i);
|
|
853
|
+
this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
|
|
776
854
|
} catch (i) {
|
|
777
|
-
if (
|
|
855
|
+
if (N(i, f.moreFactorsRequired)) {
|
|
778
856
|
let s = null;
|
|
779
857
|
try {
|
|
780
858
|
s = await S(
|
|
@@ -785,16 +863,32 @@ class vt {
|
|
|
785
863
|
} catch {
|
|
786
864
|
}
|
|
787
865
|
this.setState({ status: "mfa-required", user: null, mfaFactors: s });
|
|
788
|
-
} else
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
866
|
+
} else if (N(i, f.userBlocked))
|
|
867
|
+
await this.purgeLocalSession(), this.setState({
|
|
868
|
+
status: "signed-out",
|
|
869
|
+
user: null,
|
|
870
|
+
mfaFactors: null,
|
|
871
|
+
pending: {
|
|
872
|
+
type: "notice",
|
|
873
|
+
tone: "error",
|
|
874
|
+
message: this.getStrings().errorUserBlocked
|
|
875
|
+
}
|
|
876
|
+
}), t && this.emit("signed-out", void 0);
|
|
877
|
+
else if (!t && Pt(i)) {
|
|
878
|
+
const a = K(i, this.getStrings()) || this.getStrings().errorConfig;
|
|
879
|
+
console.warn(
|
|
880
|
+
`[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
|
|
881
|
+
);
|
|
882
|
+
const l = R(i);
|
|
883
|
+
this.emit("error", { message: a, type: l.type, code: l.code }), this.setState({
|
|
884
|
+
status: "signed-out",
|
|
885
|
+
user: null,
|
|
886
|
+
mfaFactors: null,
|
|
887
|
+
configError: a,
|
|
888
|
+
pending: { type: "notice", tone: "error", message: a }
|
|
889
|
+
});
|
|
890
|
+
} else
|
|
891
|
+
this.setState({ status: "signed-out", user: null, mfaFactors: null, configError: null }), t && this.emit("signed-out", void 0);
|
|
798
892
|
}
|
|
799
893
|
})().finally(() => {
|
|
800
894
|
this.refreshPromise = null;
|
|
@@ -805,7 +899,7 @@ class vt {
|
|
|
805
899
|
const i = this.state.pending;
|
|
806
900
|
if (i?.type === "notice" && i.tone === "error")
|
|
807
901
|
throw Object.assign(new Error(i.message), {
|
|
808
|
-
type:
|
|
902
|
+
type: f.userBlocked,
|
|
809
903
|
code: 401
|
|
810
904
|
});
|
|
811
905
|
}
|
|
@@ -830,7 +924,7 @@ class vt {
|
|
|
830
924
|
localStorage.removeItem("cookieFallback");
|
|
831
925
|
} catch {
|
|
832
926
|
}
|
|
833
|
-
this.config && !this.preview && (this.client = new
|
|
927
|
+
this.config && !this.preview && (this.client = new at().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new nt(this.client));
|
|
834
928
|
}
|
|
835
929
|
// ─────────────────────────────── sign in ───────────────────────────────
|
|
836
930
|
async signInWithEmailPassword(t, i) {
|
|
@@ -843,7 +937,7 @@ class vt {
|
|
|
843
937
|
}
|
|
844
938
|
async signUp(t, i, s) {
|
|
845
939
|
try {
|
|
846
|
-
await this.acct().create(
|
|
940
|
+
await this.acct().create(j.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
|
|
847
941
|
} catch (a) {
|
|
848
942
|
this.fail(a);
|
|
849
943
|
}
|
|
@@ -886,7 +980,7 @@ class vt {
|
|
|
886
980
|
async sendMagicUrl(t) {
|
|
887
981
|
try {
|
|
888
982
|
return await this.acct().createMagicURLToken(
|
|
889
|
-
|
|
983
|
+
j.unique(),
|
|
890
984
|
t.trim(),
|
|
891
985
|
this.redirectUrl("magic-url"),
|
|
892
986
|
this.config?.securityPhrase ?? !0
|
|
@@ -898,7 +992,7 @@ class vt {
|
|
|
898
992
|
async sendEmailOtp(t) {
|
|
899
993
|
try {
|
|
900
994
|
return await this.acct().createEmailToken(
|
|
901
|
-
|
|
995
|
+
j.unique(),
|
|
902
996
|
t.trim(),
|
|
903
997
|
this.config?.securityPhrase ?? !0
|
|
904
998
|
);
|
|
@@ -908,7 +1002,7 @@ class vt {
|
|
|
908
1002
|
}
|
|
909
1003
|
async sendPhoneOtp(t) {
|
|
910
1004
|
try {
|
|
911
|
-
return await this.acct().createPhoneToken(
|
|
1005
|
+
return await this.acct().createPhoneToken(j.unique(), t.replace(/[\s()-]/g, ""));
|
|
912
1006
|
} catch (i) {
|
|
913
1007
|
return this.fail(i);
|
|
914
1008
|
}
|
|
@@ -1182,8 +1276,8 @@ class vt {
|
|
|
1182
1276
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1183
1277
|
redirectUrl(t) {
|
|
1184
1278
|
const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
|
|
1185
|
-
for (const a of
|
|
1186
|
-
return s.searchParams.set(
|
|
1279
|
+
for (const a of dt) s.searchParams.delete(a);
|
|
1280
|
+
return s.searchParams.set(J, t), s.toString();
|
|
1187
1281
|
}
|
|
1188
1282
|
setPending(t) {
|
|
1189
1283
|
this.setState({ pending: t });
|
|
@@ -1194,11 +1288,11 @@ class vt {
|
|
|
1194
1288
|
*/
|
|
1195
1289
|
async handleRedirect() {
|
|
1196
1290
|
if (typeof window > "u") return !1;
|
|
1197
|
-
const t = new URLSearchParams(window.location.search), i = t.get(
|
|
1291
|
+
const t = new URLSearchParams(window.location.search), i = t.get(J);
|
|
1198
1292
|
if (!i) return !1;
|
|
1199
1293
|
const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
|
|
1200
1294
|
this.cleanUrl();
|
|
1201
|
-
const
|
|
1295
|
+
const l = () => {
|
|
1202
1296
|
this.setState({
|
|
1203
1297
|
pending: {
|
|
1204
1298
|
type: "notice",
|
|
@@ -1211,13 +1305,13 @@ class vt {
|
|
|
1211
1305
|
switch (i) {
|
|
1212
1306
|
case "oauth":
|
|
1213
1307
|
case "magic-url":
|
|
1214
|
-
s && a ? await this.acct().createSession(s, a) :
|
|
1308
|
+
s && a ? await this.acct().createSession(s, a) : l();
|
|
1215
1309
|
break;
|
|
1216
1310
|
case "oauth-failed":
|
|
1217
1311
|
this.setState({ pending: { type: "oauth-failed" } });
|
|
1218
1312
|
break;
|
|
1219
1313
|
case "recovery":
|
|
1220
|
-
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) :
|
|
1314
|
+
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : l();
|
|
1221
1315
|
break;
|
|
1222
1316
|
case "verify-email":
|
|
1223
1317
|
s && a ? (await S(
|
|
@@ -1230,27 +1324,27 @@ class vt {
|
|
|
1230
1324
|
message: this.getStrings().emailVerified,
|
|
1231
1325
|
tone: "success"
|
|
1232
1326
|
}
|
|
1233
|
-
})) :
|
|
1327
|
+
})) : l();
|
|
1234
1328
|
break;
|
|
1235
1329
|
}
|
|
1236
|
-
} catch (
|
|
1237
|
-
const x =
|
|
1330
|
+
} catch (u) {
|
|
1331
|
+
const x = R(u), C = K(u, this.getStrings(), "link");
|
|
1238
1332
|
this.emit("error", x), this.setState({ pending: { type: "notice", message: C, tone: "error" } });
|
|
1239
1333
|
}
|
|
1240
1334
|
return !0;
|
|
1241
1335
|
}
|
|
1242
1336
|
cleanUrl() {
|
|
1243
1337
|
const t = new URL(window.location.href);
|
|
1244
|
-
for (const i of
|
|
1338
|
+
for (const i of dt) t.searchParams.delete(i);
|
|
1245
1339
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1246
1340
|
}
|
|
1247
1341
|
/** Test helper. */
|
|
1248
1342
|
reset() {
|
|
1249
|
-
this.client = null, this.account = null, this.preview = null, this.config = null, this.state =
|
|
1343
|
+
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = ht(), this.listeners.clear();
|
|
1250
1344
|
}
|
|
1251
1345
|
}
|
|
1252
|
-
const n = new
|
|
1253
|
-
class
|
|
1346
|
+
const n = new Ut();
|
|
1347
|
+
class It {
|
|
1254
1348
|
constructor() {
|
|
1255
1349
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
1256
1350
|
const t = this.isDark("auto");
|
|
@@ -1278,14 +1372,14 @@ class bt {
|
|
|
1278
1372
|
this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
|
|
1279
1373
|
}
|
|
1280
1374
|
}
|
|
1281
|
-
const
|
|
1375
|
+
const ut = new It(), pt = {
|
|
1282
1376
|
none: "0px",
|
|
1283
1377
|
sm: "0.25rem",
|
|
1284
1378
|
md: "0.625rem",
|
|
1285
1379
|
lg: "0.875rem",
|
|
1286
1380
|
xl: "1.125rem",
|
|
1287
1381
|
full: "1.5rem"
|
|
1288
|
-
},
|
|
1382
|
+
}, Et = F`
|
|
1289
1383
|
:host {
|
|
1290
1384
|
/* Light theme (matches :root in the console) */
|
|
1291
1385
|
--authui-background: oklch(1 0 0);
|
|
@@ -1363,7 +1457,7 @@ const nt = new bt(), ot = {
|
|
|
1363
1457
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1364
1458
|
color-scheme: dark;
|
|
1365
1459
|
}
|
|
1366
|
-
`,
|
|
1460
|
+
`, Mt = F`
|
|
1367
1461
|
*,
|
|
1368
1462
|
*::before,
|
|
1369
1463
|
*::after {
|
|
@@ -1628,6 +1722,57 @@ const nt = new bt(), ot = {
|
|
|
1628
1722
|
color: var(--authui-muted-foreground);
|
|
1629
1723
|
margin: 0;
|
|
1630
1724
|
}
|
|
1725
|
+
.strength {
|
|
1726
|
+
display: grid;
|
|
1727
|
+
gap: 6px;
|
|
1728
|
+
margin-top: 6px;
|
|
1729
|
+
}
|
|
1730
|
+
.strength-meter {
|
|
1731
|
+
display: grid;
|
|
1732
|
+
grid-template-columns: repeat(4, 1fr);
|
|
1733
|
+
gap: 4px;
|
|
1734
|
+
height: 4px;
|
|
1735
|
+
}
|
|
1736
|
+
.strength-meter span {
|
|
1737
|
+
border-radius: 999px;
|
|
1738
|
+
background: var(--authui-muted);
|
|
1739
|
+
transition: background-color 120ms ease;
|
|
1740
|
+
}
|
|
1741
|
+
.strength-meter[data-level="1"] span:nth-child(-n + 1) {
|
|
1742
|
+
background: var(--authui-destructive);
|
|
1743
|
+
}
|
|
1744
|
+
.strength-meter[data-level="2"] span:nth-child(-n + 2) {
|
|
1745
|
+
background: var(--authui-warning-foreground);
|
|
1746
|
+
}
|
|
1747
|
+
.strength-meter[data-level="3"] span:nth-child(-n + 3) {
|
|
1748
|
+
background: var(--authui-warning-foreground);
|
|
1749
|
+
}
|
|
1750
|
+
.strength-meter[data-level="4"] span {
|
|
1751
|
+
background: var(--authui-success);
|
|
1752
|
+
}
|
|
1753
|
+
.strength-label {
|
|
1754
|
+
font-size: 12px;
|
|
1755
|
+
color: var(--authui-muted-foreground);
|
|
1756
|
+
margin: 0;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
.btn.last-used {
|
|
1760
|
+
border-color: var(--authui-brand);
|
|
1761
|
+
box-shadow: 0 0 0 1px color-mix(in oklab, var(--authui-brand) 35%, transparent);
|
|
1762
|
+
}
|
|
1763
|
+
.last-used-badge {
|
|
1764
|
+
display: inline-flex;
|
|
1765
|
+
align-items: center;
|
|
1766
|
+
margin-inline-start: auto;
|
|
1767
|
+
padding: 1px 6px;
|
|
1768
|
+
border-radius: 999px;
|
|
1769
|
+
font-size: 10px;
|
|
1770
|
+
font-weight: 600;
|
|
1771
|
+
letter-spacing: 0.02em;
|
|
1772
|
+
text-transform: uppercase;
|
|
1773
|
+
color: var(--authui-brand);
|
|
1774
|
+
background: color-mix(in oklab, var(--authui-brand) 12%, transparent);
|
|
1775
|
+
}
|
|
1631
1776
|
.form {
|
|
1632
1777
|
display: flex;
|
|
1633
1778
|
flex-direction: column;
|
|
@@ -2117,25 +2262,25 @@ const nt = new bt(), ot = {
|
|
|
2117
2262
|
}
|
|
2118
2263
|
}
|
|
2119
2264
|
`;
|
|
2120
|
-
var
|
|
2121
|
-
for (var a = void 0,
|
|
2122
|
-
(
|
|
2123
|
-
return a &&
|
|
2124
|
-
},
|
|
2125
|
-
const
|
|
2265
|
+
var Ft = Object.defineProperty, Ot = (e, t, i, s) => {
|
|
2266
|
+
for (var a = void 0, l = e.length - 1, u; l >= 0; l--)
|
|
2267
|
+
(u = e[l]) && (a = u(t, i, a) || a);
|
|
2268
|
+
return a && Ft(t, i, a), a;
|
|
2269
|
+
}, I;
|
|
2270
|
+
const vt = (I = class extends it {
|
|
2126
2271
|
constructor() {
|
|
2127
2272
|
super(...arguments), this.auth = n.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2128
2273
|
}
|
|
2129
2274
|
connectedCallback() {
|
|
2130
2275
|
super.connectedCallback();
|
|
2131
|
-
for (const t of
|
|
2276
|
+
for (const t of I.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2132
2277
|
this.auth = n.getState(), this.unsubscribeStore = n.on("change", (t) => {
|
|
2133
2278
|
this.auth = t, this.applyBranding();
|
|
2134
|
-
}), this.unsubscribeTheme =
|
|
2279
|
+
}), this.unsubscribeTheme = ut.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2135
2280
|
}
|
|
2136
2281
|
disconnectedCallback() {
|
|
2137
2282
|
super.disconnectedCallback();
|
|
2138
|
-
for (const t of
|
|
2283
|
+
for (const t of I.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
|
|
2139
2284
|
this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
|
|
2140
2285
|
}
|
|
2141
2286
|
get strings() {
|
|
@@ -2143,7 +2288,7 @@ const lt = (E = class extends X {
|
|
|
2143
2288
|
}
|
|
2144
2289
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2145
2290
|
t(t, i) {
|
|
2146
|
-
return
|
|
2291
|
+
return $t(this.strings[t], i);
|
|
2147
2292
|
}
|
|
2148
2293
|
get config() {
|
|
2149
2294
|
return n.getConfig();
|
|
@@ -2153,27 +2298,27 @@ const lt = (E = class extends X {
|
|
|
2153
2298
|
}
|
|
2154
2299
|
/** Push theme and branding from config onto the host element. */
|
|
2155
2300
|
applyBranding() {
|
|
2156
|
-
const t = this.config?.branding, i =
|
|
2301
|
+
const t = this.config?.branding, i = ut.isDark(t?.theme ?? "auto");
|
|
2157
2302
|
this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
|
|
2158
2303
|
"--authui-primary-foreground",
|
|
2159
2304
|
t.primaryForeground ?? "#ffffff"
|
|
2160
|
-
)), t?.radius &&
|
|
2305
|
+
)), t?.radius && pt[t.radius] && this.style.setProperty("--authui-radius", pt[t.radius]);
|
|
2161
2306
|
}
|
|
2162
2307
|
/** Emit a composed custom event from this element. */
|
|
2163
2308
|
fire(t, i) {
|
|
2164
2309
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2165
2310
|
}
|
|
2166
|
-
},
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
],
|
|
2170
|
-
let A =
|
|
2171
|
-
var
|
|
2172
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2173
|
-
(
|
|
2174
|
-
return s && a &&
|
|
2311
|
+
}, I.styles = [Et, Mt], I.KEY_EVENTS = ["keydown", "keyup", "keypress"], I);
|
|
2312
|
+
Ot([
|
|
2313
|
+
h()
|
|
2314
|
+
], vt.prototype, "auth");
|
|
2315
|
+
let A = vt;
|
|
2316
|
+
var _t = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, y = (e, t, i, s) => {
|
|
2317
|
+
for (var a = s > 1 ? void 0 : s ? Tt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
2318
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
2319
|
+
return s && a && _t(t, i, a), a;
|
|
2175
2320
|
};
|
|
2176
|
-
let b = class extends
|
|
2321
|
+
let b = class extends it {
|
|
2177
2322
|
constructor() {
|
|
2178
2323
|
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 = "";
|
|
2179
2324
|
}
|
|
@@ -2184,7 +2329,12 @@ let b = class extends X {
|
|
|
2184
2329
|
this.configure();
|
|
2185
2330
|
}
|
|
2186
2331
|
configure() {
|
|
2187
|
-
if (!this.endpoint || !this.project)
|
|
2332
|
+
if (!this.endpoint || !this.project) {
|
|
2333
|
+
queueMicrotask(() => {
|
|
2334
|
+
(!this.endpoint || !this.project) && n.notifyConfigIncomplete();
|
|
2335
|
+
});
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2188
2338
|
const e = this.toConfig(), t = n.getConfig();
|
|
2189
2339
|
t && JSON.stringify(t) === JSON.stringify(e) || n.configure(e);
|
|
2190
2340
|
}
|
|
@@ -2218,82 +2368,98 @@ let b = class extends X {
|
|
|
2218
2368
|
};
|
|
2219
2369
|
}
|
|
2220
2370
|
};
|
|
2221
|
-
b.styles =
|
|
2371
|
+
b.styles = F`
|
|
2222
2372
|
:host {
|
|
2223
2373
|
display: none;
|
|
2224
2374
|
}
|
|
2225
2375
|
`;
|
|
2226
2376
|
y([
|
|
2227
|
-
|
|
2377
|
+
g({ type: String })
|
|
2228
2378
|
], b.prototype, "endpoint", 2);
|
|
2229
2379
|
y([
|
|
2230
|
-
|
|
2380
|
+
g({ type: String })
|
|
2231
2381
|
], b.prototype, "project", 2);
|
|
2232
2382
|
y([
|
|
2233
|
-
|
|
2383
|
+
g({ type: String, attribute: "redirect-url" })
|
|
2234
2384
|
], b.prototype, "redirectUrl", 2);
|
|
2235
2385
|
y([
|
|
2236
|
-
|
|
2386
|
+
g({ type: String, attribute: "success-url" })
|
|
2237
2387
|
], b.prototype, "successUrl", 2);
|
|
2238
2388
|
y([
|
|
2239
|
-
|
|
2389
|
+
g({ type: String })
|
|
2240
2390
|
], b.prototype, "methods", 2);
|
|
2241
2391
|
y([
|
|
2242
|
-
|
|
2392
|
+
g({ type: String, attribute: "sign-up" })
|
|
2243
2393
|
], b.prototype, "signUp", 2);
|
|
2244
2394
|
y([
|
|
2245
|
-
|
|
2395
|
+
g({ type: String, attribute: "require-name" })
|
|
2246
2396
|
], b.prototype, "requireName", 2);
|
|
2247
2397
|
y([
|
|
2248
|
-
|
|
2398
|
+
g({ type: String })
|
|
2249
2399
|
], b.prototype, "mfa", 2);
|
|
2250
2400
|
y([
|
|
2251
|
-
|
|
2401
|
+
g({ type: String, attribute: "security-phrase" })
|
|
2252
2402
|
], b.prototype, "securityPhrase", 2);
|
|
2253
2403
|
y([
|
|
2254
|
-
|
|
2404
|
+
g({ type: String })
|
|
2255
2405
|
], b.prototype, "name", 2);
|
|
2256
2406
|
y([
|
|
2257
|
-
|
|
2407
|
+
g({ type: String })
|
|
2258
2408
|
], b.prototype, "logo", 2);
|
|
2259
2409
|
y([
|
|
2260
|
-
|
|
2410
|
+
g({ type: String })
|
|
2261
2411
|
], b.prototype, "theme", 2);
|
|
2262
2412
|
y([
|
|
2263
|
-
|
|
2413
|
+
g({ type: String })
|
|
2264
2414
|
], b.prototype, "radius", 2);
|
|
2265
2415
|
y([
|
|
2266
|
-
|
|
2416
|
+
g({ type: String })
|
|
2267
2417
|
], b.prototype, "primary", 2);
|
|
2268
2418
|
y([
|
|
2269
|
-
|
|
2419
|
+
g({ type: String, attribute: "primary-foreground" })
|
|
2270
2420
|
], b.prototype, "primaryForeground", 2);
|
|
2271
2421
|
y([
|
|
2272
|
-
|
|
2422
|
+
g({ type: String, attribute: "terms-url" })
|
|
2273
2423
|
], b.prototype, "termsUrl", 2);
|
|
2274
2424
|
y([
|
|
2275
|
-
|
|
2425
|
+
g({ type: String, attribute: "privacy-url" })
|
|
2276
2426
|
], b.prototype, "privacyUrl", 2);
|
|
2277
2427
|
y([
|
|
2278
|
-
|
|
2428
|
+
g({ type: String })
|
|
2279
2429
|
], b.prototype, "preview", 2);
|
|
2280
2430
|
b = y([
|
|
2281
2431
|
O("authui-config")
|
|
2282
2432
|
], b);
|
|
2283
|
-
var
|
|
2284
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2285
|
-
(
|
|
2286
|
-
return s && a &&
|
|
2433
|
+
var Dt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Y = (e, t, i, s) => {
|
|
2434
|
+
for (var a = s > 1 ? void 0 : s ? Rt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
2435
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
2436
|
+
return s && a && Dt(t, i, a), a;
|
|
2287
2437
|
};
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2438
|
+
const mt = "authui-show:not([ready]){display:none}", ie = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
|
|
2439
|
+
let ft = !1;
|
|
2440
|
+
function zt() {
|
|
2441
|
+
if (!(typeof document > "u" || ft)) {
|
|
2442
|
+
ft = !0;
|
|
2443
|
+
try {
|
|
2444
|
+
if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
|
|
2445
|
+
const e = new CSSStyleSheet();
|
|
2446
|
+
e.replaceSync(mt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
} catch {
|
|
2450
|
+
}
|
|
2451
|
+
if (!document.getElementById("authui-fouc")) {
|
|
2452
|
+
const e = document.createElement("style");
|
|
2453
|
+
e.id = "authui-fouc", e.textContent = mt, document.head.appendChild(e);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2291
2456
|
}
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2457
|
+
zt();
|
|
2458
|
+
const Lt = ["loading", "signed-out", "signed-in", "mfa-required"];
|
|
2459
|
+
function X(e) {
|
|
2460
|
+
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Lt.includes(t)) : [];
|
|
2295
2461
|
}
|
|
2296
|
-
let
|
|
2462
|
+
let B = class extends it {
|
|
2297
2463
|
constructor() {
|
|
2298
2464
|
super(...arguments), this.when = "", this.unless = "", this.status = n.getState().status, this.unsubscribe = null;
|
|
2299
2465
|
}
|
|
@@ -2305,29 +2471,29 @@ let V = class extends X {
|
|
|
2305
2471
|
}
|
|
2306
2472
|
/** Whether the current status satisfies `when` and `unless`. */
|
|
2307
2473
|
get visible() {
|
|
2308
|
-
const e =
|
|
2474
|
+
const e = X(this.when), t = X(this.unless);
|
|
2309
2475
|
return !(this.status === "loading" && !e.includes("loading") || e.length > 0 && !e.includes(this.status) || t.includes(this.status));
|
|
2310
2476
|
}
|
|
2311
2477
|
updated() {
|
|
2312
|
-
(this.status !== "loading" ||
|
|
2478
|
+
(this.status !== "loading" || X(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
|
|
2313
2479
|
}
|
|
2314
2480
|
render() {
|
|
2315
|
-
return this.visible ? r`<slot></slot>` :
|
|
2481
|
+
return this.visible ? r`<slot></slot>` : o;
|
|
2316
2482
|
}
|
|
2317
2483
|
};
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
],
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
],
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
],
|
|
2327
|
-
|
|
2484
|
+
Y([
|
|
2485
|
+
g({ type: String })
|
|
2486
|
+
], B.prototype, "when", 2);
|
|
2487
|
+
Y([
|
|
2488
|
+
g({ type: String })
|
|
2489
|
+
], B.prototype, "unless", 2);
|
|
2490
|
+
Y([
|
|
2491
|
+
h()
|
|
2492
|
+
], B.prototype, "status", 2);
|
|
2493
|
+
B = Y([
|
|
2328
2494
|
O("authui-show")
|
|
2329
|
-
],
|
|
2330
|
-
const
|
|
2495
|
+
], B);
|
|
2496
|
+
const Vt = F`
|
|
2331
2497
|
:host {
|
|
2332
2498
|
display: block;
|
|
2333
2499
|
width: 100%;
|
|
@@ -2381,7 +2547,7 @@ const Ut = I`
|
|
|
2381
2547
|
height: 14px;
|
|
2382
2548
|
margin: 0;
|
|
2383
2549
|
}
|
|
2384
|
-
`,
|
|
2550
|
+
`, v = (e) => r`<svg
|
|
2385
2551
|
xmlns="http://www.w3.org/2000/svg"
|
|
2386
2552
|
viewBox="0 0 24 24"
|
|
2387
2553
|
fill="none"
|
|
@@ -2392,178 +2558,224 @@ const Ut = I`
|
|
|
2392
2558
|
aria-hidden="true"
|
|
2393
2559
|
>
|
|
2394
2560
|
${e}
|
|
2395
|
-
</svg>`,
|
|
2396
|
-
mail:
|
|
2397
|
-
|
|
2561
|
+
</svg>`, c = {
|
|
2562
|
+
mail: v(
|
|
2563
|
+
d`<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"/>`
|
|
2398
2564
|
),
|
|
2399
|
-
phone:
|
|
2400
|
-
|
|
2565
|
+
phone: v(
|
|
2566
|
+
d`<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"/>`
|
|
2401
2567
|
),
|
|
2402
|
-
user:
|
|
2403
|
-
|
|
2568
|
+
user: v(
|
|
2569
|
+
d`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
|
|
2404
2570
|
),
|
|
2405
|
-
userX:
|
|
2406
|
-
|
|
2571
|
+
userX: v(
|
|
2572
|
+
d`<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"/>`
|
|
2407
2573
|
),
|
|
2408
|
-
lock:
|
|
2409
|
-
|
|
2574
|
+
lock: v(
|
|
2575
|
+
d`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
|
|
2410
2576
|
),
|
|
2411
|
-
key:
|
|
2412
|
-
|
|
2577
|
+
key: v(
|
|
2578
|
+
d`<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"/>`
|
|
2413
2579
|
),
|
|
2414
|
-
shield:
|
|
2415
|
-
|
|
2580
|
+
shield: v(
|
|
2581
|
+
d`<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"/>`
|
|
2416
2582
|
),
|
|
2417
|
-
shieldCheck:
|
|
2418
|
-
|
|
2583
|
+
shieldCheck: v(
|
|
2584
|
+
d`<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"/>`
|
|
2419
2585
|
),
|
|
2420
|
-
smartphone:
|
|
2421
|
-
|
|
2586
|
+
smartphone: v(
|
|
2587
|
+
d`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
|
|
2422
2588
|
),
|
|
2423
|
-
monitor:
|
|
2424
|
-
|
|
2589
|
+
monitor: v(
|
|
2590
|
+
d`<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"/>`
|
|
2425
2591
|
),
|
|
2426
|
-
globe:
|
|
2427
|
-
|
|
2592
|
+
globe: v(
|
|
2593
|
+
d`<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"/>`
|
|
2428
2594
|
),
|
|
2429
|
-
logOut:
|
|
2430
|
-
|
|
2595
|
+
logOut: v(
|
|
2596
|
+
d`<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"/>`
|
|
2431
2597
|
),
|
|
2432
|
-
settings:
|
|
2433
|
-
|
|
2598
|
+
settings: v(
|
|
2599
|
+
d`<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"/>`
|
|
2434
2600
|
),
|
|
2435
|
-
x:
|
|
2436
|
-
check:
|
|
2437
|
-
|
|
2438
|
-
|
|
2601
|
+
x: v(d`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
|
|
2602
|
+
check: v(d`<path d="M20 6 9 17l-5-5"/>`),
|
|
2603
|
+
users: v(
|
|
2604
|
+
d`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>`
|
|
2439
2605
|
),
|
|
2440
|
-
|
|
2441
|
-
|
|
2606
|
+
copy: v(
|
|
2607
|
+
d`<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"/>`
|
|
2442
2608
|
),
|
|
2443
|
-
|
|
2444
|
-
|
|
2609
|
+
eye: v(
|
|
2610
|
+
d`<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"/>`
|
|
2445
2611
|
),
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
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"/>`
|
|
2612
|
+
eyeOff: v(
|
|
2613
|
+
d`<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"/>`
|
|
2449
2614
|
),
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
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"/>`
|
|
2615
|
+
arrowLeft: v(d`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
|
|
2616
|
+
alert: v(
|
|
2617
|
+
d`<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"/>`
|
|
2454
2618
|
),
|
|
2455
|
-
|
|
2456
|
-
|
|
2619
|
+
info: v(d`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
|
|
2620
|
+
checkCircle: v(d`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
|
|
2621
|
+
link: v(
|
|
2622
|
+
d`<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"/>`
|
|
2457
2623
|
),
|
|
2458
|
-
|
|
2459
|
-
|
|
2624
|
+
activity: v(
|
|
2625
|
+
d`<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"/>`
|
|
2460
2626
|
),
|
|
2461
|
-
|
|
2462
|
-
|
|
2627
|
+
trash: v(
|
|
2628
|
+
d`<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"/>`
|
|
2463
2629
|
),
|
|
2464
|
-
|
|
2465
|
-
|
|
2630
|
+
sparkles: v(
|
|
2631
|
+
d`<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"/>`
|
|
2466
2632
|
),
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
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"/>`
|
|
2633
|
+
refresh: v(
|
|
2634
|
+
d`<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"/>`
|
|
2470
2635
|
),
|
|
2471
|
-
|
|
2472
|
-
|
|
2636
|
+
chevronDown: v(d`<path d="m6 9 6 6 6-6"/>`),
|
|
2637
|
+
ghost: v(
|
|
2638
|
+
d`<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"/>`
|
|
2639
|
+
),
|
|
2640
|
+
qr: v(
|
|
2641
|
+
d`<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"/>`
|
|
2473
2642
|
)
|
|
2474
|
-
}, w = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`,
|
|
2643
|
+
}, w = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, qt = {
|
|
2475
2644
|
google: w(
|
|
2476
|
-
|
|
2645
|
+
d`<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"/>`
|
|
2477
2646
|
),
|
|
2478
2647
|
github: w(
|
|
2479
|
-
|
|
2648
|
+
d`<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"/>`
|
|
2480
2649
|
),
|
|
2481
2650
|
apple: w(
|
|
2482
|
-
|
|
2651
|
+
d`<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"/>`
|
|
2483
2652
|
),
|
|
2484
2653
|
facebook: w(
|
|
2485
|
-
|
|
2654
|
+
d`<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"/>`
|
|
2486
2655
|
),
|
|
2487
2656
|
x: w(
|
|
2488
|
-
|
|
2657
|
+
d`<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"/>`
|
|
2489
2658
|
),
|
|
2490
2659
|
microsoft: w(
|
|
2491
|
-
|
|
2660
|
+
d`<path fill="#F25022" d="M1 1h10v10H1z"/><path fill="#7FBA00" d="M13 1h10v10H13z"/><path fill="#00A4EF" d="M1 13h10v10H1z"/><path fill="#FFB900" d="M13 13h10v10H13z"/>`
|
|
2492
2661
|
),
|
|
2493
2662
|
discord: w(
|
|
2494
|
-
|
|
2663
|
+
d`<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"/>`
|
|
2495
2664
|
),
|
|
2496
2665
|
gitlab: w(
|
|
2497
|
-
|
|
2666
|
+
d`<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"/>`
|
|
2498
2667
|
),
|
|
2499
2668
|
linkedin: w(
|
|
2500
|
-
|
|
2669
|
+
d`<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"/>`
|
|
2501
2670
|
),
|
|
2502
2671
|
slack: w(
|
|
2503
|
-
|
|
2672
|
+
d`<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"/>`
|
|
2504
2673
|
),
|
|
2505
2674
|
twitch: w(
|
|
2506
|
-
|
|
2675
|
+
d`<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"/>`
|
|
2507
2676
|
),
|
|
2508
2677
|
spotify: w(
|
|
2509
|
-
|
|
2678
|
+
d`<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"/>`
|
|
2510
2679
|
),
|
|
2511
2680
|
notion: w(
|
|
2512
|
-
|
|
2681
|
+
d`<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"/>`
|
|
2513
2682
|
),
|
|
2514
2683
|
dropbox: w(
|
|
2515
|
-
|
|
2684
|
+
d`<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"/>`
|
|
2516
2685
|
),
|
|
2517
2686
|
figma: w(
|
|
2518
|
-
|
|
2687
|
+
d`<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"/>`
|
|
2519
2688
|
),
|
|
2520
2689
|
bitbucket: w(
|
|
2521
|
-
|
|
2690
|
+
d`<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"/>`
|
|
2522
2691
|
),
|
|
2523
2692
|
amazon: w(
|
|
2524
|
-
|
|
2693
|
+
d`<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"/>`
|
|
2525
2694
|
),
|
|
2526
2695
|
paypal: w(
|
|
2527
|
-
|
|
2696
|
+
d`<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"/>`
|
|
2528
2697
|
)
|
|
2529
2698
|
};
|
|
2530
|
-
function
|
|
2531
|
-
return
|
|
2699
|
+
function tt(e) {
|
|
2700
|
+
return qt[e] ?? c.globe;
|
|
2532
2701
|
}
|
|
2533
|
-
function
|
|
2702
|
+
function st(e) {
|
|
2534
2703
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
2535
|
-
return /[A-Z0-9]/i.test(t) ? t :
|
|
2704
|
+
return /[A-Z0-9]/i.test(t) ? t : c.user;
|
|
2536
2705
|
}
|
|
2537
|
-
function
|
|
2706
|
+
function G(e) {
|
|
2538
2707
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
2539
2708
|
window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
|
|
2540
2709
|
}));
|
|
2541
2710
|
}
|
|
2542
|
-
function
|
|
2711
|
+
function se() {
|
|
2543
2712
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
|
|
2544
2713
|
}
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2714
|
+
function et(e) {
|
|
2715
|
+
const t = {
|
|
2716
|
+
length: e.length >= 8,
|
|
2717
|
+
long: e.length >= 12,
|
|
2718
|
+
lower: /[a-z]/.test(e),
|
|
2719
|
+
upper: /[A-Z]/.test(e),
|
|
2720
|
+
number: /\d/.test(e),
|
|
2721
|
+
symbol: /[^A-Za-z0-9]/.test(e)
|
|
2722
|
+
};
|
|
2723
|
+
if (!e)
|
|
2724
|
+
return { level: 0, percent: 0, labelKey: "passwordStrengthTooWeak", checks: t };
|
|
2725
|
+
let i = 0;
|
|
2726
|
+
t.length && (i += 1), t.long && (i += 1), t.lower && t.upper && (i += 1), t.number && (i += 1), t.symbol && (i += 1), e.length < 8 ? i = Math.min(i, 1) : e.length < 10 && (i = Math.min(i, 3));
|
|
2727
|
+
let s, a;
|
|
2728
|
+
return !t.length || i <= 1 ? (s = 1, a = "passwordStrengthTooWeak") : i === 2 ? (s = 2, a = "passwordStrengthWeak") : i === 3 ? (s = 3, a = "passwordStrengthFair") : i >= 5 && t.long && t.lower && t.upper && t.number && t.symbol ? (s = 4, a = "passwordStrengthVeryStrong") : (s = 4, a = "passwordStrengthStrong"), { level: s, percent: s * 25, labelKey: a, checks: t };
|
|
2729
|
+
}
|
|
2730
|
+
const rt = "authui:last-method";
|
|
2731
|
+
function V(e) {
|
|
2732
|
+
if (!(typeof localStorage > "u")) {
|
|
2733
|
+
if (!e || e === "mfa" || e === "sign-up")
|
|
2734
|
+
if (e === "sign-up") e = "email-password";
|
|
2735
|
+
else return;
|
|
2736
|
+
try {
|
|
2737
|
+
localStorage.setItem(rt, e);
|
|
2738
|
+
} catch {
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
function D() {
|
|
2743
|
+
if (typeof localStorage > "u") return null;
|
|
2744
|
+
try {
|
|
2745
|
+
return localStorage.getItem(rt);
|
|
2746
|
+
} catch {
|
|
2747
|
+
return null;
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
function re() {
|
|
2751
|
+
if (!(typeof localStorage > "u"))
|
|
2752
|
+
try {
|
|
2753
|
+
localStorage.removeItem(rt);
|
|
2754
|
+
} catch {
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
var Nt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
|
|
2758
|
+
for (var a = s > 1 ? void 0 : s ? Bt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
2759
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
2760
|
+
return s && a && Nt(t, i, a), a;
|
|
2549
2761
|
};
|
|
2550
2762
|
let $ = class extends A {
|
|
2551
2763
|
constructor() {
|
|
2552
2764
|
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.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.onSignIn = (e) => {
|
|
2553
2765
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
2554
|
-
await n.signInWithEmailPassword(this.email, this.password), this.password = "", this.fire("authui-success", { method: "email-password" });
|
|
2766
|
+
await n.signInWithEmailPassword(this.email, this.password), this.password = "", V("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
2555
2767
|
});
|
|
2556
2768
|
}, this.onSignUp = (e) => {
|
|
2557
2769
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
2558
|
-
await n.signUp(this.email, this.password, this.name), this.password = "", this.fire("authui-success", { method: "sign-up" });
|
|
2770
|
+
await n.signUp(this.email, this.password, this.name), this.password = "", V("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
2559
2771
|
});
|
|
2560
2772
|
}, this.onGuest = () => {
|
|
2561
2773
|
this.run(async () => {
|
|
2562
|
-
await n.signInAnonymously(), this.fire("authui-success", { method: "anonymous" });
|
|
2774
|
+
await n.signInAnonymously(), V("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
2563
2775
|
});
|
|
2564
2776
|
}, this.onOAuth = (e) => {
|
|
2565
2777
|
this.run(async () => {
|
|
2566
|
-
if (await n.signInWithOAuth(e), n.isPreview) {
|
|
2778
|
+
if (V(`oauth:${e}`), await n.signInWithOAuth(e), n.isPreview) {
|
|
2567
2779
|
this.fire("authui-success", { method: "oauth" });
|
|
2568
2780
|
return;
|
|
2569
2781
|
}
|
|
@@ -2612,7 +2824,7 @@ let $ = class extends A {
|
|
|
2612
2824
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
2613
2825
|
const t = this.token;
|
|
2614
2826
|
t && this.run(async () => {
|
|
2615
|
-
await n.signInWithToken(t.userId, this.code), this.code = "", this.token = null, this.fire("authui-success", { method: t.kind });
|
|
2827
|
+
await n.signInWithToken(t.userId, this.code), this.code = "", this.token = null, V(t.kind), this.fire("authui-success", { method: t.kind });
|
|
2616
2828
|
}, "code");
|
|
2617
2829
|
}, this.onChooseFactor = (e) => {
|
|
2618
2830
|
this.run(async () => {
|
|
@@ -2630,7 +2842,7 @@ let $ = class extends A {
|
|
|
2630
2842
|
try {
|
|
2631
2843
|
await n.signOut();
|
|
2632
2844
|
} catch (e) {
|
|
2633
|
-
if (!
|
|
2845
|
+
if (!N(e, f.sessionNotFound)) throw e;
|
|
2634
2846
|
}
|
|
2635
2847
|
this.go("sign-in");
|
|
2636
2848
|
});
|
|
@@ -2671,7 +2883,7 @@ let $ = class extends A {
|
|
|
2671
2883
|
try {
|
|
2672
2884
|
await e();
|
|
2673
2885
|
} catch (i) {
|
|
2674
|
-
this.error =
|
|
2886
|
+
this.error = K(i, this.strings, t);
|
|
2675
2887
|
} finally {
|
|
2676
2888
|
this.busy = !1;
|
|
2677
2889
|
}
|
|
@@ -2694,16 +2906,16 @@ let $ = class extends A {
|
|
|
2694
2906
|
<div class="panel ${this.embedded ? "embedded" : ""}" part="panel">
|
|
2695
2907
|
${this.renderHeader()}
|
|
2696
2908
|
${this.notice ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
2697
|
-
${this.notice.tone === "success" ?
|
|
2909
|
+
${this.notice.tone === "success" ? c.checkCircle : this.notice.tone === "error" ? c.alert : c.info}
|
|
2698
2910
|
<div class="alert-body">${this.notice.message}</div>
|
|
2699
2911
|
<button
|
|
2700
2912
|
class="btn btn-ghost btn-icon dismiss"
|
|
2701
2913
|
@click=${() => this.dismissNotice()}
|
|
2702
2914
|
aria-label=${this.t("close")}
|
|
2703
2915
|
>
|
|
2704
|
-
${
|
|
2916
|
+
${c.x}
|
|
2705
2917
|
</button>
|
|
2706
|
-
</div>` :
|
|
2918
|
+
</div>` : o}
|
|
2707
2919
|
${e}
|
|
2708
2920
|
</div>
|
|
2709
2921
|
`;
|
|
@@ -2745,25 +2957,26 @@ let $ = class extends A {
|
|
|
2745
2957
|
@error=${(a) => {
|
|
2746
2958
|
a.target.hidden = !0;
|
|
2747
2959
|
}}
|
|
2748
|
-
/>` :
|
|
2749
|
-
${n.isPreview ? r`<span class="badge badge-info preview">${this.t("preview")}</span>` :
|
|
2960
|
+
/>` : o}
|
|
2961
|
+
${n.isPreview ? r`<span class="badge badge-info preview">${this.t("preview")}</span>` : o}
|
|
2750
2962
|
<h2 class="title" id="authui-title">${i}</h2>
|
|
2751
|
-
${s ? r`<p class="description">${s}</p>` :
|
|
2963
|
+
${s ? r`<p class="description">${s}</p>` : o}
|
|
2752
2964
|
</div>
|
|
2753
2965
|
`;
|
|
2754
2966
|
}
|
|
2755
2967
|
renderError() {
|
|
2756
2968
|
return this.error ? r`<div class="alert alert-error" role="alert">
|
|
2757
|
-
${
|
|
2969
|
+
${c.alert}
|
|
2758
2970
|
<div class="alert-body">${this.error}</div>
|
|
2759
|
-
</div>` :
|
|
2971
|
+
</div>` : o;
|
|
2760
2972
|
}
|
|
2761
2973
|
submitButton(e, t = "btn-primary") {
|
|
2762
2974
|
return r`<button class="btn ${t} btn-block" type="submit" ?disabled=${this.busy}>
|
|
2763
|
-
${this.busy ? r`<span class="spinner" aria-hidden="true"></span>` :
|
|
2975
|
+
${this.busy ? r`<span class="spinner" aria-hidden="true"></span>` : o} ${e}
|
|
2764
2976
|
</button>`;
|
|
2765
2977
|
}
|
|
2766
2978
|
passwordField(e) {
|
|
2979
|
+
const t = this[e.field], i = e.meter ? et(t) : null;
|
|
2767
2980
|
return r`
|
|
2768
2981
|
<div class="field">
|
|
2769
2982
|
<label class="label" for=${e.id}>
|
|
@@ -2774,7 +2987,7 @@ let $ = class extends A {
|
|
|
2774
2987
|
@click=${() => this.go("forgot-password")}
|
|
2775
2988
|
>
|
|
2776
2989
|
${this.t("forgotPassword")}
|
|
2777
|
-
</button>` :
|
|
2990
|
+
</button>` : o}
|
|
2778
2991
|
</label>
|
|
2779
2992
|
<div class="input-wrap">
|
|
2780
2993
|
<input
|
|
@@ -2784,7 +2997,7 @@ let $ = class extends A {
|
|
|
2784
2997
|
autocomplete=${e.autocomplete}
|
|
2785
2998
|
required
|
|
2786
2999
|
minlength="8"
|
|
2787
|
-
.value=${
|
|
3000
|
+
.value=${t}
|
|
2788
3001
|
@input=${this.bind(e.field)}
|
|
2789
3002
|
/>
|
|
2790
3003
|
<button
|
|
@@ -2794,10 +3007,24 @@ let $ = class extends A {
|
|
|
2794
3007
|
aria-label=${this.showPassword ? this.t("hidePassword") : this.t("showPassword")}
|
|
2795
3008
|
tabindex="-1"
|
|
2796
3009
|
>
|
|
2797
|
-
${this.showPassword ?
|
|
3010
|
+
${this.showPassword ? c.eyeOff : c.eye}
|
|
2798
3011
|
</button>
|
|
2799
3012
|
</div>
|
|
2800
|
-
${
|
|
3013
|
+
${i && t ? r`<div class="strength" aria-live="polite">
|
|
3014
|
+
<div
|
|
3015
|
+
class="strength-meter"
|
|
3016
|
+
data-level=${String(i.level)}
|
|
3017
|
+
role="meter"
|
|
3018
|
+
aria-label=${this.t("passwordStrengthLabel")}
|
|
3019
|
+
aria-valuemin="0"
|
|
3020
|
+
aria-valuemax="4"
|
|
3021
|
+
aria-valuenow=${String(i.level)}
|
|
3022
|
+
aria-valuetext=${this.t(i.labelKey)}
|
|
3023
|
+
>
|
|
3024
|
+
<span></span><span></span><span></span><span></span>
|
|
3025
|
+
</div>
|
|
3026
|
+
<p class="strength-label">${this.t(i.labelKey)}</p>
|
|
3027
|
+
</div>` : e.hint ? r`<p class="hint">${e.hint}</p>` : o}
|
|
2801
3028
|
</div>
|
|
2802
3029
|
`;
|
|
2803
3030
|
}
|
|
@@ -2839,24 +3066,29 @@ let $ = class extends A {
|
|
|
2839
3066
|
}
|
|
2840
3067
|
legal() {
|
|
2841
3068
|
const e = this.config?.legal;
|
|
2842
|
-
return !e?.termsUrl && !e?.privacyUrl ?
|
|
3069
|
+
return !e?.termsUrl && !e?.privacyUrl ? o : r`<p class="legal">
|
|
2843
3070
|
${this.t("agreeTo")}
|
|
2844
|
-
${e.termsUrl ? r`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` :
|
|
2845
|
-
${e.termsUrl && e.privacyUrl ? r` ${this.t("and")} ` :
|
|
2846
|
-
${e.privacyUrl ? r`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` :
|
|
3071
|
+
${e.termsUrl ? r`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : o}
|
|
3072
|
+
${e.termsUrl && e.privacyUrl ? r` ${this.t("and")} ` : o}
|
|
3073
|
+
${e.privacyUrl ? r`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : o}.
|
|
2847
3074
|
</p>`;
|
|
2848
3075
|
}
|
|
2849
3076
|
backLink(e = "sign-in") {
|
|
2850
3077
|
return r`<div class="links">
|
|
2851
3078
|
<button type="button" class="btn btn-link" @click=${() => this.go(e)}>
|
|
2852
|
-
${
|
|
3079
|
+
${c.arrowLeft} ${this.t("back")}
|
|
2853
3080
|
</button>
|
|
2854
3081
|
</div>`;
|
|
2855
3082
|
}
|
|
2856
3083
|
renderStep() {
|
|
3084
|
+
if (this.auth.configError)
|
|
3085
|
+
return r`<div class="alert alert-error" role="alert">
|
|
3086
|
+
${c.alert}
|
|
3087
|
+
<div class="alert-body">${this.auth.configError}</div>
|
|
3088
|
+
</div>`;
|
|
2857
3089
|
if (!this.auth.configured)
|
|
2858
3090
|
return r`<div class="alert alert-error" role="alert">
|
|
2859
|
-
${
|
|
3091
|
+
${c.alert}
|
|
2860
3092
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
2861
3093
|
</div>`;
|
|
2862
3094
|
if (this.auth.status === "loading")
|
|
@@ -2887,10 +3119,10 @@ let $ = class extends A {
|
|
|
2887
3119
|
<div class="stack">
|
|
2888
3120
|
<div class="row">
|
|
2889
3121
|
<div class="inline">
|
|
2890
|
-
<span class="avatar">${
|
|
3122
|
+
<span class="avatar">${st(t)}</span>
|
|
2891
3123
|
<div class="row-main">
|
|
2892
3124
|
<span class="row-title" title=${t}>${t}</span>
|
|
2893
|
-
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` :
|
|
3125
|
+
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : o}
|
|
2894
3126
|
</div>
|
|
2895
3127
|
</div>
|
|
2896
3128
|
</div>
|
|
@@ -2898,85 +3130,102 @@ let $ = class extends A {
|
|
|
2898
3130
|
<div class="stack-sm">
|
|
2899
3131
|
${this.config?.successUrl ? r`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
|
|
2900
3132
|
>${this.t("continue")}</a
|
|
2901
|
-
>` :
|
|
3133
|
+
>` : o}
|
|
2902
3134
|
<button
|
|
2903
3135
|
class="btn btn-outline btn-block"
|
|
2904
3136
|
@click=${() => {
|
|
2905
|
-
this.embedded ? this.fire("authui-open", { view: "account" }) :
|
|
3137
|
+
this.embedded ? this.fire("authui-open", { view: "account" }) : G("account");
|
|
2906
3138
|
}}
|
|
2907
3139
|
>
|
|
2908
|
-
${
|
|
3140
|
+
${c.settings} ${this.t("manageAccount")}
|
|
2909
3141
|
</button>
|
|
2910
3142
|
<button class="btn btn-ghost btn-block" @click=${this.onSignOut} ?disabled=${this.busy}>
|
|
2911
|
-
${
|
|
3143
|
+
${c.logOut} ${this.t("signOut")}
|
|
2912
3144
|
</button>
|
|
2913
3145
|
</div>
|
|
2914
3146
|
</div>
|
|
2915
3147
|
`;
|
|
2916
3148
|
}
|
|
2917
3149
|
renderProviders() {
|
|
2918
|
-
const e = this.config?.methods?.oauth ?? [];
|
|
2919
|
-
if (e.length === 0) return
|
|
2920
|
-
const t =
|
|
3150
|
+
const e = [...this.config?.methods?.oauth ?? []];
|
|
3151
|
+
if (e.length === 0) return o;
|
|
3152
|
+
const t = D();
|
|
3153
|
+
e.sort((s, a) => {
|
|
3154
|
+
const l = t === `oauth:${s}` ? 0 : 1, u = t === `oauth:${a}` ? 0 : 1;
|
|
3155
|
+
return l - u;
|
|
3156
|
+
});
|
|
3157
|
+
const i = e.length > 2;
|
|
2921
3158
|
return r`
|
|
2922
|
-
<div class="providers ${
|
|
2923
|
-
${e.map(
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3159
|
+
<div class="providers ${i ? "two" : ""}">
|
|
3160
|
+
${e.map((s) => {
|
|
3161
|
+
const a = t === `oauth:${s}`;
|
|
3162
|
+
return r`<button
|
|
3163
|
+
type="button"
|
|
3164
|
+
class="btn btn-outline ${a ? "last-used" : ""}"
|
|
3165
|
+
@click=${() => this.onOAuth(s)}
|
|
3166
|
+
?disabled=${this.busy}
|
|
3167
|
+
aria-label=${this.t("continueWith", { provider: q(s) })}
|
|
3168
|
+
>
|
|
3169
|
+
${tt(s)}
|
|
3170
|
+
<span
|
|
3171
|
+
>${i ? q(s) : this.t("continueWith", { provider: q(s) })}</span
|
|
2930
3172
|
>
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
>
|
|
2935
|
-
</button>`
|
|
2936
|
-
)}
|
|
3173
|
+
${a ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : o}
|
|
3174
|
+
</button>`;
|
|
3175
|
+
})}
|
|
2937
3176
|
</div>
|
|
2938
3177
|
`;
|
|
2939
3178
|
}
|
|
2940
3179
|
renderSignIn() {
|
|
2941
3180
|
const e = this.config?.methods ?? {}, t = e.emailPassword !== !1, i = (e.oauth?.length ?? 0) > 0, s = [
|
|
2942
|
-
e.magicUrl ? { step: "magic-url", icon:
|
|
2943
|
-
e.emailOtp ? { step: "email-otp", icon:
|
|
2944
|
-
e.phone ? { step: "phone", icon:
|
|
3181
|
+
e.magicUrl ? { step: "magic-url", icon: c.link, label: this.t("sendMagicLink") } : null,
|
|
3182
|
+
e.emailOtp ? { step: "email-otp", icon: c.mail, label: this.t("continueWithEmail") } : null,
|
|
3183
|
+
e.phone ? { step: "phone", icon: c.smartphone, label: this.t("continueWithPhone") } : null
|
|
2945
3184
|
].filter(Boolean);
|
|
2946
3185
|
return r`
|
|
2947
3186
|
<div class="stack">
|
|
2948
3187
|
${this.renderProviders()}
|
|
2949
|
-
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` :
|
|
2950
|
-
${t ? r`<form
|
|
3188
|
+
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : o}
|
|
3189
|
+
${t ? r`<form
|
|
3190
|
+
class="form ${D() === "email-password" ? "last-used-form" : ""}"
|
|
3191
|
+
@submit=${this.onSignIn}
|
|
3192
|
+
novalidate
|
|
3193
|
+
>
|
|
3194
|
+
${D() === "email-password" ? r`<p class="hint">
|
|
3195
|
+
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
3196
|
+
</p>` : o}
|
|
2951
3197
|
${this.emailField()}
|
|
2952
3198
|
${this.passwordField({ label: this.t("password"), autocomplete: "current-password", id: "authui-password", field: "password", forgot: !0 })}
|
|
2953
3199
|
${this.renderError()} ${this.submitButton(this.t("signIn"))}
|
|
2954
3200
|
</form>` : this.renderError()}
|
|
2955
3201
|
${s.length > 0 ? r`<div class="stack-sm">
|
|
2956
|
-
${s.map(
|
|
2957
|
-
(
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
3202
|
+
${s.map((a) => {
|
|
3203
|
+
const l = D() === a.step;
|
|
3204
|
+
return r`<button
|
|
3205
|
+
type="button"
|
|
3206
|
+
class="btn btn-secondary btn-block ${l ? "last-used" : ""}"
|
|
3207
|
+
@click=${() => this.go(a.step)}
|
|
3208
|
+
>
|
|
3209
|
+
${a.icon} ${a.label}
|
|
3210
|
+
${l ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : o}
|
|
3211
|
+
</button>`;
|
|
3212
|
+
})}
|
|
3213
|
+
</div>` : o}
|
|
2966
3214
|
${e.anonymous ? r`<button
|
|
2967
3215
|
type="button"
|
|
2968
|
-
class="btn btn-ghost btn-block"
|
|
3216
|
+
class="btn btn-ghost btn-block ${D() === "anonymous" ? "last-used" : ""}"
|
|
2969
3217
|
@click=${this.onGuest}
|
|
2970
3218
|
?disabled=${this.busy}
|
|
2971
3219
|
>
|
|
2972
|
-
${
|
|
2973
|
-
|
|
3220
|
+
${c.ghost} ${this.t("continueAsGuest")}
|
|
3221
|
+
${D() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : o}
|
|
3222
|
+
</button>` : o}
|
|
2974
3223
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
2975
3224
|
<span>${this.t("noAccount")}</span>
|
|
2976
3225
|
<button type="button" class="btn btn-link" @click=${() => this.go("sign-up")}>
|
|
2977
3226
|
${this.t("signUp")}
|
|
2978
3227
|
</button>
|
|
2979
|
-
</div>` :
|
|
3228
|
+
</div>` : o}
|
|
2980
3229
|
${this.legal()}
|
|
2981
3230
|
</div>
|
|
2982
3231
|
`;
|
|
@@ -2985,7 +3234,7 @@ let $ = class extends A {
|
|
|
2985
3234
|
return r`
|
|
2986
3235
|
<div class="stack">
|
|
2987
3236
|
${this.renderProviders()}
|
|
2988
|
-
${(this.config?.methods?.oauth?.length ?? 0) > 0 ? r`<div class="separator-text">${this.t("or")}</div>` :
|
|
3237
|
+
${(this.config?.methods?.oauth?.length ?? 0) > 0 ? r`<div class="separator-text">${this.t("or")}</div>` : o}
|
|
2989
3238
|
<form class="form" @submit=${this.onSignUp} novalidate>
|
|
2990
3239
|
${this.config?.requireName !== !1 ? r`<div class="field">
|
|
2991
3240
|
<label class="label" for="authui-name">${this.t("name")}</label>
|
|
@@ -2998,9 +3247,9 @@ let $ = class extends A {
|
|
|
2998
3247
|
.value=${this.name}
|
|
2999
3248
|
@input=${this.bind("name")}
|
|
3000
3249
|
/>
|
|
3001
|
-
</div>` :
|
|
3250
|
+
</div>` : o}
|
|
3002
3251
|
${this.emailField()}
|
|
3003
|
-
${this.passwordField({ label: this.t("password"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint") })}
|
|
3252
|
+
${this.passwordField({ label: this.t("password"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint"), meter: !0 })}
|
|
3004
3253
|
${this.renderError()} ${this.submitButton(this.t("createAccount"))}
|
|
3005
3254
|
</form>
|
|
3006
3255
|
<div class="links">
|
|
@@ -3027,7 +3276,7 @@ let $ = class extends A {
|
|
|
3027
3276
|
return this.recovery ? r`
|
|
3028
3277
|
<div class="stack">
|
|
3029
3278
|
<form class="form" @submit=${this.onReset} novalidate>
|
|
3030
|
-
${this.passwordField({ label: this.t("newPassword"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint") })}
|
|
3279
|
+
${this.passwordField({ label: this.t("newPassword"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint"), meter: !0 })}
|
|
3031
3280
|
${this.passwordField({ label: this.t("confirmPassword"), autocomplete: "new-password", id: "authui-password-confirm", field: "passwordConfirm" })}
|
|
3032
3281
|
${this.renderError()} ${this.submitButton(this.t("resetPassword"))}
|
|
3033
3282
|
</form>
|
|
@@ -3039,13 +3288,13 @@ let $ = class extends A {
|
|
|
3039
3288
|
this.step = "sign-in", this.error = "", this.notice = null, this.focusOnStep = !0, this.fire("authui-view", { view: "sign-in" });
|
|
3040
3289
|
}}
|
|
3041
3290
|
>
|
|
3042
|
-
${
|
|
3291
|
+
${c.arrowLeft} ${this.t("back")}
|
|
3043
3292
|
</button>
|
|
3044
3293
|
</div>
|
|
3045
3294
|
</div>
|
|
3046
3295
|
` : r`<div class="stack">
|
|
3047
3296
|
<div class="alert alert-error" role="alert">
|
|
3048
|
-
${
|
|
3297
|
+
${c.alert}
|
|
3049
3298
|
<div class="alert-body">${this.t("errorInvalidToken")}</div>
|
|
3050
3299
|
</div>
|
|
3051
3300
|
<div class="links">
|
|
@@ -3063,17 +3312,17 @@ let $ = class extends A {
|
|
|
3063
3312
|
}
|
|
3064
3313
|
phraseBox(e) {
|
|
3065
3314
|
return e ? r`<div class="alert alert-info">
|
|
3066
|
-
${
|
|
3315
|
+
${c.shield}
|
|
3067
3316
|
<div class="alert-title">
|
|
3068
3317
|
${this.t("securityPhrase")}: <span class="code">${e}</span>
|
|
3069
3318
|
</div>
|
|
3070
3319
|
<div class="alert-body">${this.t("securityPhraseHint")}</div>
|
|
3071
|
-
</div>` :
|
|
3320
|
+
</div>` : o;
|
|
3072
3321
|
}
|
|
3073
3322
|
renderMagicUrl() {
|
|
3074
3323
|
return this.token ? r`<div class="stack">
|
|
3075
3324
|
<div class="alert alert-success" role="status">
|
|
3076
|
-
${
|
|
3325
|
+
${c.mail}
|
|
3077
3326
|
<div class="alert-body">${this.t("magicLinkSent", { email: this.token.target })}</div>
|
|
3078
3327
|
</div>
|
|
3079
3328
|
${this.phraseBox(this.token.phrase)} ${this.backLink()}
|
|
@@ -3108,7 +3357,7 @@ let $ = class extends A {
|
|
|
3108
3357
|
const e = this.token?.kind === "phone", t = Date.now() < this.resendCooldownUntil;
|
|
3109
3358
|
return r`
|
|
3110
3359
|
<div class="alert alert-info" role="status">
|
|
3111
|
-
${e ?
|
|
3360
|
+
${e ? c.smartphone : c.mail}
|
|
3112
3361
|
<div class="alert-body">${this.t("codeSent", { target: this.token.target })}</div>
|
|
3113
3362
|
</div>
|
|
3114
3363
|
${this.phraseBox(this.token.phrase)}
|
|
@@ -3178,25 +3427,25 @@ let $ = class extends A {
|
|
|
3178
3427
|
const i = [
|
|
3179
3428
|
{
|
|
3180
3429
|
factor: "totp",
|
|
3181
|
-
icon:
|
|
3430
|
+
icon: c.smartphone,
|
|
3182
3431
|
label: this.t("mfaUseAuthenticator"),
|
|
3183
3432
|
available: e?.totp ?? !0
|
|
3184
3433
|
},
|
|
3185
3434
|
{
|
|
3186
3435
|
factor: "email",
|
|
3187
|
-
icon:
|
|
3436
|
+
icon: c.mail,
|
|
3188
3437
|
label: this.t("mfaUseEmail"),
|
|
3189
3438
|
available: e?.email ?? !0
|
|
3190
3439
|
},
|
|
3191
3440
|
{
|
|
3192
3441
|
factor: "phone",
|
|
3193
|
-
icon:
|
|
3442
|
+
icon: c.phone,
|
|
3194
3443
|
label: this.t("mfaUsePhone"),
|
|
3195
3444
|
available: e?.phone ?? !0
|
|
3196
3445
|
},
|
|
3197
3446
|
{
|
|
3198
3447
|
factor: "recoverycode",
|
|
3199
|
-
icon:
|
|
3448
|
+
icon: c.key,
|
|
3200
3449
|
label: this.t("mfaUseRecoveryCode"),
|
|
3201
3450
|
available: e?.recoveryCode ?? !0
|
|
3202
3451
|
}
|
|
@@ -3244,7 +3493,7 @@ let $ = class extends A {
|
|
|
3244
3493
|
</form>
|
|
3245
3494
|
<div class="links">
|
|
3246
3495
|
<button type="button" class="btn btn-link" @click=${() => this.challenge = null}>
|
|
3247
|
-
${
|
|
3496
|
+
${c.arrowLeft} ${this.t("back")}
|
|
3248
3497
|
</button>
|
|
3249
3498
|
<span aria-hidden="true">·</span>
|
|
3250
3499
|
<button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
|
|
@@ -3255,57 +3504,57 @@ let $ = class extends A {
|
|
|
3255
3504
|
`;
|
|
3256
3505
|
}
|
|
3257
3506
|
};
|
|
3258
|
-
$.styles = [...A.styles,
|
|
3507
|
+
$.styles = [...A.styles, Vt];
|
|
3259
3508
|
k([
|
|
3260
|
-
|
|
3509
|
+
g({ type: String })
|
|
3261
3510
|
], $.prototype, "view", 2);
|
|
3262
3511
|
k([
|
|
3263
|
-
|
|
3512
|
+
g({ type: Boolean })
|
|
3264
3513
|
], $.prototype, "embedded", 2);
|
|
3265
3514
|
k([
|
|
3266
|
-
|
|
3515
|
+
h()
|
|
3267
3516
|
], $.prototype, "step", 2);
|
|
3268
3517
|
k([
|
|
3269
|
-
|
|
3518
|
+
h()
|
|
3270
3519
|
], $.prototype, "busy", 2);
|
|
3271
3520
|
k([
|
|
3272
|
-
|
|
3521
|
+
h()
|
|
3273
3522
|
], $.prototype, "error", 2);
|
|
3274
3523
|
k([
|
|
3275
|
-
|
|
3524
|
+
h()
|
|
3276
3525
|
], $.prototype, "notice", 2);
|
|
3277
3526
|
k([
|
|
3278
|
-
|
|
3527
|
+
h()
|
|
3279
3528
|
], $.prototype, "showPassword", 2);
|
|
3280
3529
|
k([
|
|
3281
|
-
|
|
3530
|
+
h()
|
|
3282
3531
|
], $.prototype, "token", 2);
|
|
3283
3532
|
k([
|
|
3284
|
-
|
|
3533
|
+
h()
|
|
3285
3534
|
], $.prototype, "resendCooldownUntil", 2);
|
|
3286
3535
|
k([
|
|
3287
|
-
|
|
3536
|
+
h()
|
|
3288
3537
|
], $.prototype, "challenge", 2);
|
|
3289
3538
|
k([
|
|
3290
|
-
|
|
3539
|
+
h()
|
|
3291
3540
|
], $.prototype, "recovery", 2);
|
|
3292
3541
|
k([
|
|
3293
|
-
|
|
3542
|
+
gt("form input:not([type=hidden])")
|
|
3294
3543
|
], $.prototype, "firstInput", 2);
|
|
3295
3544
|
$ = k([
|
|
3296
3545
|
O("authui-sign-in")
|
|
3297
3546
|
], $);
|
|
3298
|
-
var
|
|
3299
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3300
|
-
(
|
|
3301
|
-
return s && a &&
|
|
3547
|
+
var jt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, m = (e, t, i, s) => {
|
|
3548
|
+
for (var a = s > 1 ? void 0 : s ? Ht(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
3549
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
3550
|
+
return s && a && jt(t, i, a), a;
|
|
3302
3551
|
};
|
|
3303
|
-
let
|
|
3552
|
+
let p = class extends A {
|
|
3304
3553
|
constructor() {
|
|
3305
3554
|
super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.onTabsKeydown = (e) => {
|
|
3306
3555
|
const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
|
|
3307
3556
|
if (!t.length) return;
|
|
3308
|
-
const i = t.findIndex((
|
|
3557
|
+
const i = t.findIndex((l) => l.getAttribute("aria-selected") === "true");
|
|
3309
3558
|
let s = i;
|
|
3310
3559
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") s = (i + 1) % t.length;
|
|
3311
3560
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
@@ -3406,7 +3655,7 @@ let u = class extends A {
|
|
|
3406
3655
|
try {
|
|
3407
3656
|
this.recoveryCodes = await n.createRecoveryCodes();
|
|
3408
3657
|
} catch (e) {
|
|
3409
|
-
if (!
|
|
3658
|
+
if (!N(e, f.recoveryCodesExist)) throw e;
|
|
3410
3659
|
this.recoveryCodes = await n.getRecoveryCodes();
|
|
3411
3660
|
}
|
|
3412
3661
|
await this.loadFactors();
|
|
@@ -3519,9 +3768,9 @@ let u = class extends A {
|
|
|
3519
3768
|
try {
|
|
3520
3769
|
await t(), i && this.setNotice("success", i);
|
|
3521
3770
|
} catch (s) {
|
|
3522
|
-
|
|
3771
|
+
N(s, f.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
|
|
3523
3772
|
...this.errors,
|
|
3524
|
-
[e]:
|
|
3773
|
+
[e]: K(
|
|
3525
3774
|
s,
|
|
3526
3775
|
this.strings,
|
|
3527
3776
|
e.includes("code") ? "code" : e === "password" ? "password" : "link"
|
|
@@ -3595,7 +3844,7 @@ let u = class extends A {
|
|
|
3595
3844
|
render() {
|
|
3596
3845
|
if (!this.auth.configured)
|
|
3597
3846
|
return r`<div class="alert alert-error" role="alert">
|
|
3598
|
-
${
|
|
3847
|
+
${c.alert}
|
|
3599
3848
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
3600
3849
|
</div>`;
|
|
3601
3850
|
if (this.auth.status === "loading")
|
|
@@ -3632,7 +3881,7 @@ let u = class extends A {
|
|
|
3632
3881
|
)}
|
|
3633
3882
|
</div>
|
|
3634
3883
|
${this.notice ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
3635
|
-
${this.notice.tone === "success" ?
|
|
3884
|
+
${this.notice.tone === "success" ? c.checkCircle : c.info}
|
|
3636
3885
|
<div class="alert-body">${this.notice.message}</div>
|
|
3637
3886
|
<button
|
|
3638
3887
|
class="btn btn-ghost btn-icon dismiss"
|
|
@@ -3641,9 +3890,9 @@ let u = class extends A {
|
|
|
3641
3890
|
}}
|
|
3642
3891
|
aria-label=${this.t("close")}
|
|
3643
3892
|
>
|
|
3644
|
-
${
|
|
3893
|
+
${c.x}
|
|
3645
3894
|
</button>
|
|
3646
|
-
</div>` :
|
|
3895
|
+
</div>` : o}
|
|
3647
3896
|
${this.stepUp ? this.renderStepUp() : r`<div
|
|
3648
3897
|
class="tabpanel"
|
|
3649
3898
|
role="tabpanel"
|
|
@@ -3660,18 +3909,18 @@ let u = class extends A {
|
|
|
3660
3909
|
return r`
|
|
3661
3910
|
<div class="between">
|
|
3662
3911
|
<div class="identity">
|
|
3663
|
-
<span class="avatar">${
|
|
3912
|
+
<span class="avatar">${st(t)}</span>
|
|
3664
3913
|
<div class="row-main">
|
|
3665
3914
|
<span class="row-title" title=${t}>
|
|
3666
3915
|
${t}
|
|
3667
|
-
${e.mfa ? r`<span class="badge badge-success">${
|
|
3668
|
-
${n.isPreview ? r`<span class="badge badge-info">${this.t("preview")}</span>` :
|
|
3916
|
+
${e.mfa ? r`<span class="badge badge-success">${c.shieldCheck} ${this.t("mfaBadge")}</span>` : o}
|
|
3917
|
+
${n.isPreview ? r`<span class="badge badge-info">${this.t("preview")}</span>` : o}
|
|
3669
3918
|
</span>
|
|
3670
|
-
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` :
|
|
3919
|
+
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : o}
|
|
3671
3920
|
</div>
|
|
3672
3921
|
</div>
|
|
3673
3922
|
<button class="btn btn-outline btn-sm" @click=${() => n.signOut()}>
|
|
3674
|
-
${
|
|
3923
|
+
${c.logOut} ${this.t("signOut")}
|
|
3675
3924
|
</button>
|
|
3676
3925
|
</div>
|
|
3677
3926
|
`;
|
|
@@ -3693,25 +3942,25 @@ let u = class extends A {
|
|
|
3693
3942
|
error(e) {
|
|
3694
3943
|
const t = this.errors[e];
|
|
3695
3944
|
return t ? r`<div class="alert alert-error" role="alert">
|
|
3696
|
-
${
|
|
3945
|
+
${c.alert}
|
|
3697
3946
|
<div class="alert-body">${t}</div>
|
|
3698
|
-
</div>` :
|
|
3947
|
+
</div>` : o;
|
|
3699
3948
|
}
|
|
3700
3949
|
spinner(e) {
|
|
3701
|
-
return this.busy === e ? r`<span class="spinner" aria-hidden="true"></span>` :
|
|
3950
|
+
return this.busy === e ? r`<span class="spinner" aria-hidden="true"></span>` : o;
|
|
3702
3951
|
}
|
|
3703
3952
|
card(e, t, i, s, a = !1) {
|
|
3704
3953
|
return r`<section class="card ${a ? "card-danger" : ""}">
|
|
3705
3954
|
<div class="card-header">
|
|
3706
3955
|
<h3 class="card-title">${e}</h3>
|
|
3707
|
-
${t ? r`<p class="card-description">${t}</p>` :
|
|
3956
|
+
${t ? r`<p class="card-description">${t}</p>` : o}
|
|
3708
3957
|
</div>
|
|
3709
3958
|
<div class="card-body">${i}</div>
|
|
3710
|
-
${s ? r`<div class="card-footer">${s}</div>` :
|
|
3959
|
+
${s ? r`<div class="card-footer">${s}</div>` : o}
|
|
3711
3960
|
</section>`;
|
|
3712
3961
|
}
|
|
3713
3962
|
verifiedBadge(e) {
|
|
3714
|
-
return e ? r`<span class="badge badge-success">${
|
|
3963
|
+
return e ? r`<span class="badge badge-success">${c.check} ${this.t("verified")}</span>` : r`<span class="badge badge-warning">${this.t("unverified")}</span>`;
|
|
3715
3964
|
}
|
|
3716
3965
|
// ── Profile ──
|
|
3717
3966
|
renderProfile() {
|
|
@@ -3755,7 +4004,24 @@ let u = class extends A {
|
|
|
3755
4004
|
@input=${this.bind("emailPassword")}
|
|
3756
4005
|
autocomplete="new-password"
|
|
3757
4006
|
/>
|
|
3758
|
-
|
|
4007
|
+
${this.emailPassword ? (() => {
|
|
4008
|
+
const t = et(this.emailPassword);
|
|
4009
|
+
return r`<div class="strength" aria-live="polite">
|
|
4010
|
+
<div
|
|
4011
|
+
class="strength-meter"
|
|
4012
|
+
data-level=${String(t.level)}
|
|
4013
|
+
role="meter"
|
|
4014
|
+
aria-label=${this.t("passwordStrengthLabel")}
|
|
4015
|
+
aria-valuemin="0"
|
|
4016
|
+
aria-valuemax="4"
|
|
4017
|
+
aria-valuenow=${String(t.level)}
|
|
4018
|
+
aria-valuetext=${this.t(t.labelKey)}
|
|
4019
|
+
>
|
|
4020
|
+
<span></span><span></span><span></span><span></span>
|
|
4021
|
+
</div>
|
|
4022
|
+
<p class="strength-label">${this.t(t.labelKey)}</p>
|
|
4023
|
+
</div>`;
|
|
4024
|
+
})() : r`<p class="hint">${this.t("passwordHint")}</p>`}
|
|
3759
4025
|
</div>
|
|
3760
4026
|
${this.error("guest")}
|
|
3761
4027
|
</form>`,
|
|
@@ -3802,7 +4068,7 @@ let u = class extends A {
|
|
|
3802
4068
|
<div class="field">
|
|
3803
4069
|
<label class="label" for="acc-email"
|
|
3804
4070
|
>${this.t("email")}
|
|
3805
|
-
${e.email ? this.verifiedBadge(e.emailVerification) :
|
|
4071
|
+
${e.email ? this.verifiedBadge(e.emailVerification) : o}</label
|
|
3806
4072
|
>
|
|
3807
4073
|
<input
|
|
3808
4074
|
class="input"
|
|
@@ -3827,8 +4093,8 @@ let u = class extends A {
|
|
|
3827
4093
|
autocomplete=${e.passwordUpdate ? "current-password" : "new-password"}
|
|
3828
4094
|
required
|
|
3829
4095
|
/>
|
|
3830
|
-
${e.passwordUpdate ?
|
|
3831
|
-
</div>` :
|
|
4096
|
+
${e.passwordUpdate ? o : r`<p class="hint">${this.t("createPasswordHint")}</p>`}
|
|
4097
|
+
</div>` : o}
|
|
3832
4098
|
${this.error("email")} ${this.error("verify")}
|
|
3833
4099
|
</form>`,
|
|
3834
4100
|
r`
|
|
@@ -3845,7 +4111,7 @@ let u = class extends A {
|
|
|
3845
4111
|
Math.ceil((this.verifyEmailCooldownUntil - Date.now()) / 1e3)
|
|
3846
4112
|
)
|
|
3847
4113
|
}) : this.t("verifyEmail")}
|
|
3848
|
-
</button>` :
|
|
4114
|
+
</button>` : o}
|
|
3849
4115
|
<button
|
|
3850
4116
|
class="btn btn-primary btn-sm"
|
|
3851
4117
|
type="submit"
|
|
@@ -3863,7 +4129,7 @@ let u = class extends A {
|
|
|
3863
4129
|
<div class="field">
|
|
3864
4130
|
<label class="label" for="acc-phone"
|
|
3865
4131
|
>${this.t("phone")}
|
|
3866
|
-
${e.phone ? this.verifiedBadge(e.phoneVerification) :
|
|
4132
|
+
${e.phone ? this.verifiedBadge(e.phoneVerification) : o}</label
|
|
3867
4133
|
>
|
|
3868
4134
|
<input
|
|
3869
4135
|
class="input"
|
|
@@ -3888,8 +4154,8 @@ let u = class extends A {
|
|
|
3888
4154
|
autocomplete=${e.passwordUpdate ? "current-password" : "new-password"}
|
|
3889
4155
|
required
|
|
3890
4156
|
/>
|
|
3891
|
-
${e.passwordUpdate ?
|
|
3892
|
-
</div>` :
|
|
4157
|
+
${e.passwordUpdate ? o : r`<p class="hint">${this.t("createPasswordHint")}</p>`}
|
|
4158
|
+
</div>` : o}
|
|
3893
4159
|
${this.phoneCodeSent ? r`<div class="field">
|
|
3894
4160
|
<label class="label" for="acc-phone-code">${this.t("code")}</label>
|
|
3895
4161
|
<input
|
|
@@ -3906,7 +4172,7 @@ let u = class extends A {
|
|
|
3906
4172
|
t.key === "Enter" && (t.preventDefault(), this.onConfirmPhoneVerification(t));
|
|
3907
4173
|
}}
|
|
3908
4174
|
/>
|
|
3909
|
-
</div>` :
|
|
4175
|
+
</div>` : o}
|
|
3910
4176
|
${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
|
|
3911
4177
|
</form>`,
|
|
3912
4178
|
r`
|
|
@@ -3917,7 +4183,7 @@ let u = class extends A {
|
|
|
3917
4183
|
?disabled=${!!this.busy}
|
|
3918
4184
|
>
|
|
3919
4185
|
${this.spinner("verify-phone")} ${this.t("sendCode")}
|
|
3920
|
-
</button>` :
|
|
4186
|
+
</button>` : o}
|
|
3921
4187
|
${this.phoneCodeSent ? r`<button
|
|
3922
4188
|
class="btn btn-outline btn-sm"
|
|
3923
4189
|
type="button"
|
|
@@ -3925,7 +4191,7 @@ let u = class extends A {
|
|
|
3925
4191
|
?disabled=${!!this.busy}
|
|
3926
4192
|
>
|
|
3927
4193
|
${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
|
|
3928
|
-
</button>` :
|
|
4194
|
+
</button>` : o}
|
|
3929
4195
|
<button
|
|
3930
4196
|
class="btn btn-primary btn-sm"
|
|
3931
4197
|
type="submit"
|
|
@@ -3959,7 +4225,7 @@ let u = class extends A {
|
|
|
3959
4225
|
class="btn btn-outline btn-sm warn"
|
|
3960
4226
|
@click=${() => this.confirmDelete = !0}
|
|
3961
4227
|
>
|
|
3962
|
-
${
|
|
4228
|
+
${c.userX} ${this.t("deleteAccount")}
|
|
3963
4229
|
</button>`}`,
|
|
3964
4230
|
void 0,
|
|
3965
4231
|
!0
|
|
@@ -3969,7 +4235,7 @@ let u = class extends A {
|
|
|
3969
4235
|
renderSecurity() {
|
|
3970
4236
|
const e = this.user, t = this.config?.mfa !== !1;
|
|
3971
4237
|
return r`<div class="section">
|
|
3972
|
-
${this.isGuest ?
|
|
4238
|
+
${this.isGuest ? o : this.card(
|
|
3973
4239
|
this.t("changePassword"),
|
|
3974
4240
|
void 0,
|
|
3975
4241
|
r`<form
|
|
@@ -3991,7 +4257,7 @@ let u = class extends A {
|
|
|
3991
4257
|
autocomplete="current-password"
|
|
3992
4258
|
required
|
|
3993
4259
|
/>
|
|
3994
|
-
</div>` :
|
|
4260
|
+
</div>` : o}
|
|
3995
4261
|
<div class="field">
|
|
3996
4262
|
<label class="label" for="acc-new-password">${this.t("newPassword")}</label>
|
|
3997
4263
|
<input
|
|
@@ -4004,7 +4270,24 @@ let u = class extends A {
|
|
|
4004
4270
|
@input=${this.bind("newPassword")}
|
|
4005
4271
|
autocomplete="new-password"
|
|
4006
4272
|
/>
|
|
4007
|
-
|
|
4273
|
+
${this.newPassword ? (() => {
|
|
4274
|
+
const i = et(this.newPassword);
|
|
4275
|
+
return r`<div class="strength" aria-live="polite">
|
|
4276
|
+
<div
|
|
4277
|
+
class="strength-meter"
|
|
4278
|
+
data-level=${String(i.level)}
|
|
4279
|
+
role="meter"
|
|
4280
|
+
aria-label=${this.t("passwordStrengthLabel")}
|
|
4281
|
+
aria-valuemin="0"
|
|
4282
|
+
aria-valuemax="4"
|
|
4283
|
+
aria-valuenow=${String(i.level)}
|
|
4284
|
+
aria-valuetext=${this.t(i.labelKey)}
|
|
4285
|
+
>
|
|
4286
|
+
<span></span><span></span><span></span><span></span>
|
|
4287
|
+
</div>
|
|
4288
|
+
<p class="strength-label">${this.t(i.labelKey)}</p>
|
|
4289
|
+
</div>`;
|
|
4290
|
+
})() : r`<p class="hint">${this.t("passwordHint")}</p>`}
|
|
4008
4291
|
</div>
|
|
4009
4292
|
<div class="field">
|
|
4010
4293
|
<label class="label" for="acc-new-password-confirm"
|
|
@@ -4032,12 +4315,12 @@ let u = class extends A {
|
|
|
4032
4315
|
${this.spinner("password")} ${this.t("update")}
|
|
4033
4316
|
</button>`
|
|
4034
4317
|
)}
|
|
4035
|
-
${t ? this.renderMfaCard() :
|
|
4036
|
-
${t ? this.renderRecoveryCard() :
|
|
4318
|
+
${t ? this.renderMfaCard() : o}
|
|
4319
|
+
${t ? this.renderRecoveryCard() : o}
|
|
4037
4320
|
</div>`;
|
|
4038
4321
|
}
|
|
4039
4322
|
renderMfaCard() {
|
|
4040
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ?
|
|
4323
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? St(this.authenticator.uri) : new yt(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4041
4324
|
return this.card(
|
|
4042
4325
|
this.t("twoFactor"),
|
|
4043
4326
|
this.t("twoFactorDescription"),
|
|
@@ -4057,10 +4340,10 @@ let u = class extends A {
|
|
|
4057
4340
|
></button>
|
|
4058
4341
|
</div>
|
|
4059
4342
|
${e.mfa && !(this.factors?.totp || e.emailVerification || e.phoneVerification) ? r`<div class="alert alert-warning" role="status">
|
|
4060
|
-
${
|
|
4343
|
+
${c.alert}
|
|
4061
4344
|
<div class="alert-body">
|
|
4062
4345
|
${this.t("mfaNoFactorWarning")}
|
|
4063
|
-
${this.factors?.totp ?
|
|
4346
|
+
${this.factors?.totp ? o : r`<div class="links">
|
|
4064
4347
|
<button
|
|
4065
4348
|
type="button"
|
|
4066
4349
|
class="btn btn-link"
|
|
@@ -4071,14 +4354,14 @@ let u = class extends A {
|
|
|
4071
4354
|
</button>
|
|
4072
4355
|
</div>`}
|
|
4073
4356
|
</div>
|
|
4074
|
-
</div>` :
|
|
4357
|
+
</div>` : o}
|
|
4075
4358
|
${this.error("mfa")}
|
|
4076
4359
|
<div class="separator"></div>
|
|
4077
4360
|
<div class="toggle-row">
|
|
4078
4361
|
<div class="row-main">
|
|
4079
4362
|
<span class="row-title"
|
|
4080
|
-
>${
|
|
4081
|
-
${t ? this.verifiedBadge(!0) :
|
|
4363
|
+
>${c.smartphone} ${this.t("authenticatorApp")}
|
|
4364
|
+
${t ? this.verifiedBadge(!0) : o}</span
|
|
4082
4365
|
>
|
|
4083
4366
|
</div>
|
|
4084
4367
|
${t ? this.confirmRemoveAuthenticator ? r`<div class="inline">
|
|
@@ -4101,7 +4384,7 @@ let u = class extends A {
|
|
|
4101
4384
|
?disabled=${!!this.busy}
|
|
4102
4385
|
>
|
|
4103
4386
|
${this.spinner("remove-authenticator")} ${this.t("remove")}
|
|
4104
|
-
</button>` : this.authenticator ?
|
|
4387
|
+
</button>` : this.authenticator ? o : r`<button
|
|
4105
4388
|
class="btn btn-outline btn-sm"
|
|
4106
4389
|
@click=${this.onAddAuthenticator}
|
|
4107
4390
|
?disabled=${!!this.busy}
|
|
@@ -4125,7 +4408,7 @@ let u = class extends A {
|
|
|
4125
4408
|
this.onCopySecret();
|
|
4126
4409
|
}}
|
|
4127
4410
|
>
|
|
4128
|
-
${this.copied ?
|
|
4411
|
+
${this.copied ? c.check : c.copy}
|
|
4129
4412
|
${this.copied ? this.t("copied") : this.t("authenticatorCopyKey")}
|
|
4130
4413
|
</button>
|
|
4131
4414
|
</div>
|
|
@@ -4156,7 +4439,7 @@ let u = class extends A {
|
|
|
4156
4439
|
${this.t("cancel")}
|
|
4157
4440
|
</button>
|
|
4158
4441
|
</div>
|
|
4159
|
-
</form>` :
|
|
4442
|
+
</form>` : o}
|
|
4160
4443
|
</div>`
|
|
4161
4444
|
);
|
|
4162
4445
|
}
|
|
@@ -4167,7 +4450,7 @@ let u = class extends A {
|
|
|
4167
4450
|
this.t("recoveryCodesDescription") + " " + this.t("recoveryCodesOnceHint"),
|
|
4168
4451
|
r`<div class="kv">
|
|
4169
4452
|
${this.recoveryCodes ? r`<div class="alert alert-warning">
|
|
4170
|
-
${
|
|
4453
|
+
${c.alert}
|
|
4171
4454
|
<div class="alert-body">${this.t("recoveryCodesWarning")}</div>
|
|
4172
4455
|
</div>
|
|
4173
4456
|
<div class="codes">
|
|
@@ -4175,7 +4458,7 @@ let u = class extends A {
|
|
|
4175
4458
|
</div>
|
|
4176
4459
|
<div class="inline">
|
|
4177
4460
|
<button class="btn btn-outline btn-sm" @click=${this.onCopyCodes}>
|
|
4178
|
-
${this.copied ?
|
|
4461
|
+
${this.copied ? c.check : c.copy}
|
|
4179
4462
|
${this.copied ? this.t("copied") : this.t("copy")}
|
|
4180
4463
|
</button>
|
|
4181
4464
|
<button class="btn btn-ghost btn-sm" @click=${() => this.recoveryCodes = null}>
|
|
@@ -4187,7 +4470,7 @@ let u = class extends A {
|
|
|
4187
4470
|
@click=${this.onRecoveryCodes}
|
|
4188
4471
|
?disabled=${!!this.busy}
|
|
4189
4472
|
>
|
|
4190
|
-
${this.spinner("recovery")} ${
|
|
4473
|
+
${this.spinner("recovery")} ${c.key}
|
|
4191
4474
|
${e ? this.t("viewRecoveryCodes") : this.t("generateRecoveryCodes")}
|
|
4192
4475
|
</button>
|
|
4193
4476
|
${e ? this.confirmRegenerate ? r`<div class="inline">
|
|
@@ -4196,7 +4479,7 @@ let u = class extends A {
|
|
|
4196
4479
|
@click=${this.onRegenerateRecoveryCodes}
|
|
4197
4480
|
?disabled=${!!this.busy}
|
|
4198
4481
|
>
|
|
4199
|
-
${
|
|
4482
|
+
${c.refresh} ${this.t("regenerateRecoveryCodes")}
|
|
4200
4483
|
</button>
|
|
4201
4484
|
<button
|
|
4202
4485
|
class="btn btn-ghost btn-sm"
|
|
@@ -4209,8 +4492,8 @@ let u = class extends A {
|
|
|
4209
4492
|
@click=${this.onRegenerateRecoveryCodes}
|
|
4210
4493
|
?disabled=${!!this.busy}
|
|
4211
4494
|
>
|
|
4212
|
-
${
|
|
4213
|
-
</button>` :
|
|
4495
|
+
${c.refresh} ${this.t("regenerateRecoveryCodes")}
|
|
4496
|
+
</button>` : o}
|
|
4214
4497
|
</div>`}
|
|
4215
4498
|
${this.error("recovery")}
|
|
4216
4499
|
</div>`
|
|
@@ -4221,25 +4504,25 @@ let u = class extends A {
|
|
|
4221
4504
|
const e = this.stepUp, t = this.factors, i = [
|
|
4222
4505
|
{
|
|
4223
4506
|
factor: "totp",
|
|
4224
|
-
icon:
|
|
4507
|
+
icon: c.smartphone,
|
|
4225
4508
|
label: this.t("mfaUseAuthenticator"),
|
|
4226
4509
|
available: t?.totp ?? !0
|
|
4227
4510
|
},
|
|
4228
4511
|
{
|
|
4229
4512
|
factor: "email",
|
|
4230
|
-
icon:
|
|
4513
|
+
icon: c.mail,
|
|
4231
4514
|
label: this.t("mfaUseEmail"),
|
|
4232
4515
|
available: t?.email ?? !0
|
|
4233
4516
|
},
|
|
4234
4517
|
{
|
|
4235
4518
|
factor: "phone",
|
|
4236
|
-
icon:
|
|
4519
|
+
icon: c.phone,
|
|
4237
4520
|
label: this.t("mfaUsePhone"),
|
|
4238
4521
|
available: t?.phone ?? !0
|
|
4239
4522
|
},
|
|
4240
4523
|
{
|
|
4241
4524
|
factor: "recoverycode",
|
|
4242
|
-
icon:
|
|
4525
|
+
icon: c.key,
|
|
4243
4526
|
label: this.t("mfaUseRecoveryCode"),
|
|
4244
4527
|
available: t?.recoveryCode ?? !0
|
|
4245
4528
|
}
|
|
@@ -4290,7 +4573,7 @@ let u = class extends A {
|
|
|
4290
4573
|
// ── Sessions ──
|
|
4291
4574
|
deviceIcon(e) {
|
|
4292
4575
|
const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
|
|
4293
|
-
return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ?
|
|
4576
|
+
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;
|
|
4294
4577
|
}
|
|
4295
4578
|
renderSessions() {
|
|
4296
4579
|
const e = this.sessions;
|
|
@@ -4306,8 +4589,8 @@ let u = class extends A {
|
|
|
4306
4589
|
<div class="row-main">
|
|
4307
4590
|
<span class="row-title">
|
|
4308
4591
|
${t.clientName || t.provider}
|
|
4309
|
-
${t.clientVersion ? r`<span class="muted small">${t.clientVersion}</span>` :
|
|
4310
|
-
${t.current ? r`<span class="badge badge-info">${this.t("currentSession")}</span>` :
|
|
4592
|
+
${t.clientVersion ? r`<span class="muted small">${t.clientVersion}</span>` : o}
|
|
4593
|
+
${t.current ? r`<span class="badge badge-info">${this.t("currentSession")}</span>` : o}
|
|
4311
4594
|
</span>
|
|
4312
4595
|
<span class="row-sub"
|
|
4313
4596
|
>${[t.osName, t.countryName || t.countryCode, t.ip].filter(Boolean).join(" · ")}</span
|
|
@@ -4315,14 +4598,14 @@ let u = class extends A {
|
|
|
4315
4598
|
</div>
|
|
4316
4599
|
</div>
|
|
4317
4600
|
<div class="row-actions">
|
|
4318
|
-
${this.busy === `session-${t.$id}` ? r`<span class="spinner"></span>` :
|
|
4601
|
+
${this.busy === `session-${t.$id}` ? r`<span class="spinner"></span>` : o}
|
|
4319
4602
|
<button
|
|
4320
4603
|
class="btn btn-ghost btn-sm"
|
|
4321
4604
|
@click=${() => this.onDeleteSession(t.$id)}
|
|
4322
4605
|
?disabled=${!!this.busy}
|
|
4323
4606
|
aria-label=${this.t("signOutSession")}
|
|
4324
4607
|
>
|
|
4325
|
-
${
|
|
4608
|
+
${c.logOut}
|
|
4326
4609
|
</button>
|
|
4327
4610
|
</div>
|
|
4328
4611
|
</div>`
|
|
@@ -4338,7 +4621,7 @@ let u = class extends A {
|
|
|
4338
4621
|
@click=${this.onSignOutAll}
|
|
4339
4622
|
?disabled=${!!this.busy}
|
|
4340
4623
|
>
|
|
4341
|
-
${this.spinner("sessions-all")} ${
|
|
4624
|
+
${this.spinner("sessions-all")} ${c.logOut} ${this.t("signOutAllSessions")}
|
|
4342
4625
|
</button>
|
|
4343
4626
|
<button
|
|
4344
4627
|
class="btn btn-ghost btn-sm"
|
|
@@ -4351,7 +4634,7 @@ let u = class extends A {
|
|
|
4351
4634
|
@click=${this.onSignOutAll}
|
|
4352
4635
|
?disabled=${!!this.busy}
|
|
4353
4636
|
>
|
|
4354
|
-
${this.spinner("sessions-all")} ${
|
|
4637
|
+
${this.spinner("sessions-all")} ${c.logOut} ${this.t("signOutAllSessions")}
|
|
4355
4638
|
</button>`}`,
|
|
4356
4639
|
void 0,
|
|
4357
4640
|
!0
|
|
@@ -4369,9 +4652,9 @@ let u = class extends A {
|
|
|
4369
4652
|
${e === null ? r`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? r`<div class="empty">${this.t("noConnections")}</div>` : e.map(
|
|
4370
4653
|
(i) => r`<div class="row">
|
|
4371
4654
|
<div class="inline">
|
|
4372
|
-
<span class="device">${
|
|
4655
|
+
<span class="device">${tt(i.provider)}</span>
|
|
4373
4656
|
<div class="row-main">
|
|
4374
|
-
<span class="row-title">${
|
|
4657
|
+
<span class="row-title">${q(i.provider)}</span>
|
|
4375
4658
|
<span class="row-sub">${i.providerEmail || i.providerUid}</span>
|
|
4376
4659
|
</div>
|
|
4377
4660
|
</div>
|
|
@@ -4382,7 +4665,7 @@ let u = class extends A {
|
|
|
4382
4665
|
@click=${() => this.onDeleteIdentity(i.$id)}
|
|
4383
4666
|
?disabled=${!!this.busy}
|
|
4384
4667
|
>
|
|
4385
|
-
${this.busy === `identity-${i.$id}` ? r`<span class="spinner"></span>` :
|
|
4668
|
+
${this.busy === `identity-${i.$id}` ? r`<span class="spinner"></span>` : o}
|
|
4386
4669
|
${this.t("disconnect")}
|
|
4387
4670
|
</button>
|
|
4388
4671
|
<button
|
|
@@ -4396,7 +4679,7 @@ let u = class extends A {
|
|
|
4396
4679
|
@click=${() => this.onDeleteIdentity(i.$id)}
|
|
4397
4680
|
?disabled=${!!this.busy}
|
|
4398
4681
|
>
|
|
4399
|
-
${this.busy === `identity-${i.$id}` ? r`<span class="spinner"></span>` :
|
|
4682
|
+
${this.busy === `identity-${i.$id}` ? r`<span class="spinner"></span>` : o}
|
|
4400
4683
|
${this.t("disconnect")}
|
|
4401
4684
|
</button>`}
|
|
4402
4685
|
</div>
|
|
@@ -4410,8 +4693,8 @@ let u = class extends A {
|
|
|
4410
4693
|
}}
|
|
4411
4694
|
?disabled=${!!this.busy}
|
|
4412
4695
|
>
|
|
4413
|
-
${this.spinner(`connect-${i}`)} ${
|
|
4414
|
-
${this.t("connectProvider", { provider:
|
|
4696
|
+
${this.spinner(`connect-${i}`)} ${tt(i)}
|
|
4697
|
+
${this.t("connectProvider", { provider: q(i) })}
|
|
4415
4698
|
</button>`
|
|
4416
4699
|
)}` : void 0
|
|
4417
4700
|
)}
|
|
@@ -4439,9 +4722,9 @@ let u = class extends A {
|
|
|
4439
4722
|
</div>`;
|
|
4440
4723
|
}
|
|
4441
4724
|
};
|
|
4442
|
-
|
|
4725
|
+
p.styles = [
|
|
4443
4726
|
...A.styles,
|
|
4444
|
-
|
|
4727
|
+
F`
|
|
4445
4728
|
:host {
|
|
4446
4729
|
display: block;
|
|
4447
4730
|
width: 100%;
|
|
@@ -4537,115 +4820,115 @@ u.styles = [
|
|
|
4537
4820
|
}
|
|
4538
4821
|
`
|
|
4539
4822
|
];
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
],
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
],
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
],
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
],
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
],
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
],
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
],
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
],
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
],
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
],
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
],
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
],
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
],
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
],
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
],
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
],
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
],
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
],
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
],
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
],
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
],
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
],
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
],
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
],
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
],
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
],
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
],
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
],
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
],
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
],
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
],
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
],
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
],
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
],
|
|
4642
|
-
|
|
4823
|
+
m([
|
|
4824
|
+
g({ type: Boolean })
|
|
4825
|
+
], p.prototype, "embedded", 2);
|
|
4826
|
+
m([
|
|
4827
|
+
g({ type: String })
|
|
4828
|
+
], p.prototype, "tab", 2);
|
|
4829
|
+
m([
|
|
4830
|
+
h()
|
|
4831
|
+
], p.prototype, "active", 2);
|
|
4832
|
+
m([
|
|
4833
|
+
h()
|
|
4834
|
+
], p.prototype, "busy", 2);
|
|
4835
|
+
m([
|
|
4836
|
+
h()
|
|
4837
|
+
], p.prototype, "notice", 2);
|
|
4838
|
+
m([
|
|
4839
|
+
h()
|
|
4840
|
+
], p.prototype, "errors", 2);
|
|
4841
|
+
m([
|
|
4842
|
+
h()
|
|
4843
|
+
], p.prototype, "nameInput", 2);
|
|
4844
|
+
m([
|
|
4845
|
+
h()
|
|
4846
|
+
], p.prototype, "emailInput", 2);
|
|
4847
|
+
m([
|
|
4848
|
+
h()
|
|
4849
|
+
], p.prototype, "emailPassword", 2);
|
|
4850
|
+
m([
|
|
4851
|
+
h()
|
|
4852
|
+
], p.prototype, "phoneInput", 2);
|
|
4853
|
+
m([
|
|
4854
|
+
h()
|
|
4855
|
+
], p.prototype, "phonePassword", 2);
|
|
4856
|
+
m([
|
|
4857
|
+
h()
|
|
4858
|
+
], p.prototype, "phoneCode", 2);
|
|
4859
|
+
m([
|
|
4860
|
+
h()
|
|
4861
|
+
], p.prototype, "phoneCodeSent", 2);
|
|
4862
|
+
m([
|
|
4863
|
+
h()
|
|
4864
|
+
], p.prototype, "guestName", 2);
|
|
4865
|
+
m([
|
|
4866
|
+
h()
|
|
4867
|
+
], p.prototype, "oldPassword", 2);
|
|
4868
|
+
m([
|
|
4869
|
+
h()
|
|
4870
|
+
], p.prototype, "newPassword", 2);
|
|
4871
|
+
m([
|
|
4872
|
+
h()
|
|
4873
|
+
], p.prototype, "newPasswordConfirm", 2);
|
|
4874
|
+
m([
|
|
4875
|
+
h()
|
|
4876
|
+
], p.prototype, "authenticator", 2);
|
|
4877
|
+
m([
|
|
4878
|
+
h()
|
|
4879
|
+
], p.prototype, "authenticatorCode", 2);
|
|
4880
|
+
m([
|
|
4881
|
+
h()
|
|
4882
|
+
], p.prototype, "factors", 2);
|
|
4883
|
+
m([
|
|
4884
|
+
h()
|
|
4885
|
+
], p.prototype, "recoveryCodes", 2);
|
|
4886
|
+
m([
|
|
4887
|
+
h()
|
|
4888
|
+
], p.prototype, "stepUp", 2);
|
|
4889
|
+
m([
|
|
4890
|
+
h()
|
|
4891
|
+
], p.prototype, "stepUpCode", 2);
|
|
4892
|
+
m([
|
|
4893
|
+
h()
|
|
4894
|
+
], p.prototype, "copied", 2);
|
|
4895
|
+
m([
|
|
4896
|
+
h()
|
|
4897
|
+
], p.prototype, "sessions", 2);
|
|
4898
|
+
m([
|
|
4899
|
+
h()
|
|
4900
|
+
], p.prototype, "identities", 2);
|
|
4901
|
+
m([
|
|
4902
|
+
h()
|
|
4903
|
+
], p.prototype, "logs", 2);
|
|
4904
|
+
m([
|
|
4905
|
+
h()
|
|
4906
|
+
], p.prototype, "logsSupported", 2);
|
|
4907
|
+
m([
|
|
4908
|
+
h()
|
|
4909
|
+
], p.prototype, "confirmDelete", 2);
|
|
4910
|
+
m([
|
|
4911
|
+
h()
|
|
4912
|
+
], p.prototype, "confirmRegenerate", 2);
|
|
4913
|
+
m([
|
|
4914
|
+
h()
|
|
4915
|
+
], p.prototype, "confirmRemoveAuthenticator", 2);
|
|
4916
|
+
m([
|
|
4917
|
+
h()
|
|
4918
|
+
], p.prototype, "confirmSignOutAll", 2);
|
|
4919
|
+
m([
|
|
4920
|
+
h()
|
|
4921
|
+
], p.prototype, "confirmDisconnectId", 2);
|
|
4922
|
+
m([
|
|
4923
|
+
h()
|
|
4924
|
+
], p.prototype, "verifyEmailCooldownUntil", 2);
|
|
4925
|
+
p = m([
|
|
4643
4926
|
O("authui-account")
|
|
4644
|
-
],
|
|
4645
|
-
var
|
|
4646
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
4647
|
-
(
|
|
4648
|
-
return s && a &&
|
|
4927
|
+
], p);
|
|
4928
|
+
var Wt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
|
|
4929
|
+
for (var a = s > 1 ? void 0 : s ? Kt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
4930
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
4931
|
+
return s && a && Wt(t, i, a), a;
|
|
4649
4932
|
};
|
|
4650
4933
|
let M = class extends A {
|
|
4651
4934
|
constructor() {
|
|
@@ -4707,12 +4990,12 @@ let M = class extends A {
|
|
|
4707
4990
|
@click=${this.hide}
|
|
4708
4991
|
aria-label=${this.t("close")}
|
|
4709
4992
|
>
|
|
4710
|
-
${
|
|
4993
|
+
${c.x}
|
|
4711
4994
|
</button>
|
|
4712
4995
|
${this.open ? t ? r`<authui-account embedded></authui-account>` : r`<authui-sign-in
|
|
4713
4996
|
embedded
|
|
4714
4997
|
.view=${this.view === "account" ? "sign-in" : this.view}
|
|
4715
|
-
></authui-sign-in>` :
|
|
4998
|
+
></authui-sign-in>` : o}
|
|
4716
4999
|
</div>
|
|
4717
5000
|
</dialog>
|
|
4718
5001
|
`;
|
|
@@ -4720,7 +5003,7 @@ let M = class extends A {
|
|
|
4720
5003
|
};
|
|
4721
5004
|
M.styles = [
|
|
4722
5005
|
...A.styles,
|
|
4723
|
-
|
|
5006
|
+
F`
|
|
4724
5007
|
:host {
|
|
4725
5008
|
display: contents;
|
|
4726
5009
|
}
|
|
@@ -4780,30 +5063,30 @@ M.styles = [
|
|
|
4780
5063
|
}
|
|
4781
5064
|
`
|
|
4782
5065
|
];
|
|
4783
|
-
|
|
4784
|
-
|
|
5066
|
+
L([
|
|
5067
|
+
g({ type: Boolean, reflect: !0 })
|
|
4785
5068
|
], M.prototype, "open", 2);
|
|
4786
|
-
|
|
4787
|
-
|
|
5069
|
+
L([
|
|
5070
|
+
g({ type: String })
|
|
4788
5071
|
], M.prototype, "view", 2);
|
|
4789
|
-
|
|
4790
|
-
|
|
5072
|
+
L([
|
|
5073
|
+
g({ type: Boolean, attribute: "close-on-success" })
|
|
4791
5074
|
], M.prototype, "closeOnSuccess", 2);
|
|
4792
|
-
|
|
4793
|
-
|
|
5075
|
+
L([
|
|
5076
|
+
h()
|
|
4794
5077
|
], M.prototype, "handledPending", 2);
|
|
4795
|
-
|
|
4796
|
-
|
|
5078
|
+
L([
|
|
5079
|
+
gt("dialog")
|
|
4797
5080
|
], M.prototype, "dialog", 2);
|
|
4798
|
-
M =
|
|
5081
|
+
M = L([
|
|
4799
5082
|
O("authui-modal")
|
|
4800
5083
|
], M);
|
|
4801
|
-
var
|
|
4802
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
4803
|
-
(
|
|
4804
|
-
return s && a &&
|
|
5084
|
+
var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Z = (e, t, i, s) => {
|
|
5085
|
+
for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
5086
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
5087
|
+
return s && a && Gt(t, i, a), a;
|
|
4805
5088
|
};
|
|
4806
|
-
let
|
|
5089
|
+
let z = class extends A {
|
|
4807
5090
|
constructor() {
|
|
4808
5091
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
4809
5092
|
}
|
|
@@ -4811,7 +5094,7 @@ let D = class extends A {
|
|
|
4811
5094
|
const e = this.size === "md" ? "" : `btn-${this.size}`;
|
|
4812
5095
|
return r`<button
|
|
4813
5096
|
class="btn btn-${this.variant} ${e}"
|
|
4814
|
-
@click=${() =>
|
|
5097
|
+
@click=${() => G(this.view)}
|
|
4815
5098
|
part="button"
|
|
4816
5099
|
>
|
|
4817
5100
|
<slot
|
|
@@ -4820,9 +5103,9 @@ let D = class extends A {
|
|
|
4820
5103
|
</button>`;
|
|
4821
5104
|
}
|
|
4822
5105
|
};
|
|
4823
|
-
|
|
5106
|
+
z.styles = [
|
|
4824
5107
|
...A.styles,
|
|
4825
|
-
|
|
5108
|
+
F`
|
|
4826
5109
|
:host {
|
|
4827
5110
|
display: inline-block;
|
|
4828
5111
|
}
|
|
@@ -4831,26 +5114,26 @@ D.styles = [
|
|
|
4831
5114
|
}
|
|
4832
5115
|
`
|
|
4833
5116
|
];
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
],
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
],
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
],
|
|
4843
|
-
|
|
5117
|
+
Z([
|
|
5118
|
+
g({ type: String })
|
|
5119
|
+
], z.prototype, "view", 2);
|
|
5120
|
+
Z([
|
|
5121
|
+
g({ type: String })
|
|
5122
|
+
], z.prototype, "variant", 2);
|
|
5123
|
+
Z([
|
|
5124
|
+
g({ type: String })
|
|
5125
|
+
], z.prototype, "size", 2);
|
|
5126
|
+
z = Z([
|
|
4844
5127
|
O("authui-button")
|
|
4845
|
-
],
|
|
4846
|
-
var
|
|
4847
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
4848
|
-
(
|
|
4849
|
-
return s && a &&
|
|
5128
|
+
], z);
|
|
5129
|
+
var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, _ = (e, t, i, s) => {
|
|
5130
|
+
for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
|
|
5131
|
+
(u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
|
|
5132
|
+
return s && a && Zt(t, i, a), a;
|
|
4850
5133
|
};
|
|
4851
|
-
let
|
|
5134
|
+
let E = class extends A {
|
|
4852
5135
|
constructor() {
|
|
4853
|
-
super(...arguments), this.src = "", this.menuOpen = !1, this.onDocumentClick = (e) => {
|
|
5136
|
+
super(...arguments), this.showTeams = !1, this.src = "", this.menuOpen = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onDocumentClick = (e) => {
|
|
4854
5137
|
e.composedPath().includes(this) || (this.menuOpen = !1);
|
|
4855
5138
|
}, this.onKeydown = (e) => {
|
|
4856
5139
|
if (!this.menuOpen) {
|
|
@@ -4867,6 +5150,16 @@ let q = class extends A {
|
|
|
4867
5150
|
e.key === "ArrowDown" ? (e.preventDefault(), this.focusMenuItem(i < 0 ? 0 : (i + 1) % t.length)) : e.key === "ArrowUp" ? (e.preventDefault(), this.focusMenuItem(
|
|
4868
5151
|
i < 0 ? t.length - 1 : (i - 1 + t.length) % t.length
|
|
4869
5152
|
)) : e.key === "Home" ? (e.preventDefault(), this.focusMenuItem(0)) : e.key === "End" && (e.preventDefault(), this.focusMenuItem(t.length - 1));
|
|
5153
|
+
}, this.toggleMenu = () => {
|
|
5154
|
+
this.menuOpen = !this.menuOpen, this.menuOpen && this.showTeams && this.loadTeams();
|
|
5155
|
+
}, this.selectTeam = (e) => {
|
|
5156
|
+
n.setActiveTeam({ $id: e.$id, name: e.name }), this.activeTeamId = e.$id, this.dispatchEvent(
|
|
5157
|
+
new CustomEvent("authui-active-team", {
|
|
5158
|
+
detail: { teamId: e.$id, team: e },
|
|
5159
|
+
bubbles: !0,
|
|
5160
|
+
composed: !0
|
|
5161
|
+
})
|
|
5162
|
+
);
|
|
4870
5163
|
};
|
|
4871
5164
|
}
|
|
4872
5165
|
connectedCallback() {
|
|
@@ -4881,42 +5174,69 @@ let q = class extends A {
|
|
|
4881
5174
|
][e]?.focus();
|
|
4882
5175
|
}
|
|
4883
5176
|
updated(e) {
|
|
4884
|
-
e.has("menuOpen") && this.menuOpen && requestAnimationFrame(() => this.focusMenuItem(0));
|
|
5177
|
+
e.has("menuOpen") && this.menuOpen && (this.showTeams && this.loadTeams(), requestAnimationFrame(() => this.focusMenuItem(0)));
|
|
5178
|
+
}
|
|
5179
|
+
async loadTeams() {
|
|
5180
|
+
this.teamsLoading = !0, this.activeTeamId = n.getActiveTeamId();
|
|
5181
|
+
try {
|
|
5182
|
+
this.teams = await n.listTeams(), this.activeTeamId && !this.teams.some((e) => e.$id === this.activeTeamId) && (this.activeTeamId = null, n.setActiveTeam(null));
|
|
5183
|
+
} catch {
|
|
5184
|
+
this.teams = [];
|
|
5185
|
+
} finally {
|
|
5186
|
+
this.teamsLoading = !1;
|
|
5187
|
+
}
|
|
4885
5188
|
}
|
|
4886
5189
|
render() {
|
|
4887
|
-
const { status: e, user: t } = this.auth;
|
|
4888
|
-
if (e === "loading")
|
|
5190
|
+
const { status: e, user: t, configured: i } = this.auth;
|
|
5191
|
+
if (e === "loading" && i)
|
|
4889
5192
|
return r`<span class="avatar"><span class="spinner"></span></span>`;
|
|
4890
5193
|
if (e !== "signed-in" || !t)
|
|
4891
|
-
return r`<button class="btn btn-primary btn-sm" @click=${() =>
|
|
5194
|
+
return r`<button class="btn btn-primary btn-sm" @click=${() => G("sign-in")}>
|
|
4892
5195
|
<slot>${this.t("signIn")}</slot>
|
|
4893
5196
|
</button>`;
|
|
4894
|
-
const
|
|
5197
|
+
const s = t.name || t.email || t.phone || this.t("guestAccount");
|
|
4895
5198
|
return r`
|
|
4896
5199
|
<button
|
|
4897
5200
|
class="trigger"
|
|
4898
5201
|
aria-haspopup="menu"
|
|
4899
5202
|
aria-expanded=${this.menuOpen ? "true" : "false"}
|
|
4900
|
-
@click=${
|
|
4901
|
-
aria-label=${
|
|
5203
|
+
@click=${this.toggleMenu}
|
|
5204
|
+
aria-label=${s}
|
|
4902
5205
|
>
|
|
4903
5206
|
<span class="avatar"
|
|
4904
|
-
>${this.src ? r`<img src=${this.src} alt="" />` :
|
|
5207
|
+
>${this.src ? r`<img src=${this.src} alt="" />` : st(s)}</span
|
|
4905
5208
|
>
|
|
4906
5209
|
</button>
|
|
4907
5210
|
${this.menuOpen ? r`<div class="menu" role="menu">
|
|
4908
5211
|
<div class="menu-header">
|
|
4909
|
-
<span class="row-title" title=${
|
|
4910
|
-
${t.email && t.name ? r`<span class="row-sub" title=${t.email}>${t.email}</span>` :
|
|
5212
|
+
<span class="row-title" title=${s}>${s}</span>
|
|
5213
|
+
${t.email && t.name ? r`<span class="row-sub" title=${t.email}>${t.email}</span>` : o}
|
|
4911
5214
|
</div>
|
|
5215
|
+
${this.showTeams ? r`<div class="menu-section">
|
|
5216
|
+
<div class="menu-section-label">${this.t("teamsLabel")}</div>
|
|
5217
|
+
${this.teamsLoading ? r`<div class="menu-item" aria-busy="true">
|
|
5218
|
+
<span class="spinner"></span>
|
|
5219
|
+
</div>` : this.teams.length === 0 ? r`<div class="menu-item" role="note">${this.t("noTeams")}</div>` : this.teams.map(
|
|
5220
|
+
(a) => r`<button
|
|
5221
|
+
class="menu-item ${a.$id === this.activeTeamId ? "active" : ""}"
|
|
5222
|
+
role="menuitemradio"
|
|
5223
|
+
aria-checked=${a.$id === this.activeTeamId ? "true" : "false"}
|
|
5224
|
+
@click=${() => this.selectTeam(a)}
|
|
5225
|
+
>
|
|
5226
|
+
${c.users}
|
|
5227
|
+
<span title=${a.name}>${a.name}</span>
|
|
5228
|
+
${a.$id === this.activeTeamId ? r`<span class="check">${c.check}</span>` : o}
|
|
5229
|
+
</button>`
|
|
5230
|
+
)}
|
|
5231
|
+
</div>` : o}
|
|
4912
5232
|
<button
|
|
4913
5233
|
class="menu-item"
|
|
4914
5234
|
role="menuitem"
|
|
4915
5235
|
@click=${() => {
|
|
4916
|
-
this.menuOpen = !1,
|
|
5236
|
+
this.menuOpen = !1, G("account");
|
|
4917
5237
|
}}
|
|
4918
5238
|
>
|
|
4919
|
-
${
|
|
5239
|
+
${c.settings} ${this.t("manageAccount")}
|
|
4920
5240
|
</button>
|
|
4921
5241
|
<button
|
|
4922
5242
|
class="menu-item"
|
|
@@ -4925,15 +5245,15 @@ let q = class extends A {
|
|
|
4925
5245
|
this.menuOpen = !1, n.signOut();
|
|
4926
5246
|
}}
|
|
4927
5247
|
>
|
|
4928
|
-
${
|
|
5248
|
+
${c.logOut} ${this.t("signOut")}
|
|
4929
5249
|
</button>
|
|
4930
|
-
</div>` :
|
|
5250
|
+
</div>` : o}
|
|
4931
5251
|
`;
|
|
4932
5252
|
}
|
|
4933
5253
|
};
|
|
4934
|
-
|
|
5254
|
+
E.styles = [
|
|
4935
5255
|
...A.styles,
|
|
4936
|
-
|
|
5256
|
+
F`
|
|
4937
5257
|
:host {
|
|
4938
5258
|
display: inline-block;
|
|
4939
5259
|
position: relative;
|
|
@@ -5015,6 +5335,26 @@ q.styles = [
|
|
|
5015
5335
|
height: 16px;
|
|
5016
5336
|
color: var(--authui-muted-foreground);
|
|
5017
5337
|
}
|
|
5338
|
+
.menu-section {
|
|
5339
|
+
border-top: 1px solid var(--authui-border);
|
|
5340
|
+
margin-top: 4px;
|
|
5341
|
+
padding-top: 4px;
|
|
5342
|
+
}
|
|
5343
|
+
.menu-section-label {
|
|
5344
|
+
padding: 6px 10px 2px;
|
|
5345
|
+
font-size: 11px;
|
|
5346
|
+
font-weight: 600;
|
|
5347
|
+
letter-spacing: 0.04em;
|
|
5348
|
+
text-transform: uppercase;
|
|
5349
|
+
color: var(--authui-muted-foreground);
|
|
5350
|
+
}
|
|
5351
|
+
.menu-item.active {
|
|
5352
|
+
background: var(--authui-accent);
|
|
5353
|
+
}
|
|
5354
|
+
.menu-item .check {
|
|
5355
|
+
margin-inline-start: auto;
|
|
5356
|
+
color: var(--authui-brand);
|
|
5357
|
+
}
|
|
5018
5358
|
.avatar {
|
|
5019
5359
|
width: 32px;
|
|
5020
5360
|
height: 32px;
|
|
@@ -5022,32 +5362,53 @@ q.styles = [
|
|
|
5022
5362
|
}
|
|
5023
5363
|
`
|
|
5024
5364
|
];
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
],
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
],
|
|
5031
|
-
|
|
5365
|
+
_([
|
|
5366
|
+
g({ type: Boolean, attribute: "show-teams" })
|
|
5367
|
+
], E.prototype, "showTeams", 2);
|
|
5368
|
+
_([
|
|
5369
|
+
g({ type: String })
|
|
5370
|
+
], E.prototype, "src", 2);
|
|
5371
|
+
_([
|
|
5372
|
+
h()
|
|
5373
|
+
], E.prototype, "menuOpen", 2);
|
|
5374
|
+
_([
|
|
5375
|
+
h()
|
|
5376
|
+
], E.prototype, "teams", 2);
|
|
5377
|
+
_([
|
|
5378
|
+
h()
|
|
5379
|
+
], E.prototype, "teamsLoading", 2);
|
|
5380
|
+
_([
|
|
5381
|
+
h()
|
|
5382
|
+
], E.prototype, "activeTeamId", 2);
|
|
5383
|
+
E = _([
|
|
5032
5384
|
O("authui-user-button")
|
|
5033
|
-
],
|
|
5385
|
+
], E);
|
|
5034
5386
|
export {
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5387
|
+
Ut as A,
|
|
5388
|
+
ie as C,
|
|
5389
|
+
f as E,
|
|
5390
|
+
mt as F,
|
|
5391
|
+
Ct as P,
|
|
5038
5392
|
n as a,
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5393
|
+
p as b,
|
|
5394
|
+
se as c,
|
|
5395
|
+
z as d,
|
|
5042
5396
|
b as e,
|
|
5043
5397
|
A as f,
|
|
5044
5398
|
M as g,
|
|
5045
|
-
|
|
5399
|
+
B as h,
|
|
5046
5400
|
$ as i,
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5401
|
+
E as j,
|
|
5402
|
+
re as k,
|
|
5403
|
+
wt as l,
|
|
5404
|
+
K as m,
|
|
5405
|
+
D as n,
|
|
5406
|
+
G as o,
|
|
5407
|
+
lt as p,
|
|
5408
|
+
Pt as q,
|
|
5409
|
+
q as r,
|
|
5410
|
+
V as s,
|
|
5411
|
+
et as t,
|
|
5412
|
+
At as u,
|
|
5413
|
+
R as v
|
|
5053
5414
|
};
|