@getauthui/core 0.1.15 → 0.1.17
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 +4 -4
- package/dist/{authui-user-button-CV2B_0j5.js → authui-user-button-CfkLh8tP.js} +1059 -776
- package/dist/authui.cdn.js +494 -299
- package/dist/authui.cdn.mjs +1759 -1476
- package/dist/authui.js +2 -2
- package/dist/components/authui-account.d.ts +6 -0
- package/dist/components/authui-account.d.ts.map +1 -1
- package/dist/components/authui-sign-in.d.ts +4 -0
- package/dist/components/authui-sign-in.d.ts.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/mfa.d.ts +7 -0
- package/dist/mfa.d.ts.map +1 -0
- package/dist/otp-input.d.ts +23 -0
- package/dist/otp-input.d.ts.map +1 -0
- package/dist/react.js +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/styles/base.d.ts.map +1 -1
- package/dist/types.d.ts +6 -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 b, customElement as z, query as ct } from "lit/decorators.js";
|
|
2
|
+
import { css as D, LitElement as dt, nothing as n, html as r, svg as u } from "lit";
|
|
3
|
+
import { Client as pt, Account as ft, Teams as Et, ID as Y, Avatars as rt } from "appwrite";
|
|
4
|
+
const Mt = {
|
|
5
5
|
signIn: "Sign in",
|
|
6
6
|
dialogSignIn: "Sign in",
|
|
7
7
|
signUp: "Sign up",
|
|
@@ -97,6 +97,9 @@ const At = {
|
|
|
97
97
|
regenerateRecoveryCodes: "Regenerate",
|
|
98
98
|
recoveryCodesWarning: "Store these codes somewhere safe. Each code works once.",
|
|
99
99
|
currentSession: "This device",
|
|
100
|
+
sessionExpires: "Expires {date}",
|
|
101
|
+
sessionCreated: "Created {date}",
|
|
102
|
+
sessionMfaFactors: "MFA: {factors}",
|
|
100
103
|
signOutSession: "Sign out",
|
|
101
104
|
signOutAllSessions: "Sign out everywhere",
|
|
102
105
|
signOutAllSessionsDescription: "End every session, including this one.",
|
|
@@ -175,13 +178,13 @@ const At = {
|
|
|
175
178
|
acceptLegal: "I agree to the",
|
|
176
179
|
errorLegalRequired: "Accept the terms to continue."
|
|
177
180
|
};
|
|
178
|
-
function
|
|
181
|
+
function Ot(e, t = {}) {
|
|
179
182
|
return e.replace(
|
|
180
183
|
/\{(\w+)\}/g,
|
|
181
184
|
(i, s) => s in t ? String(t[s]) : `{${s}}`
|
|
182
185
|
);
|
|
183
186
|
}
|
|
184
|
-
const
|
|
187
|
+
const Ft = {
|
|
185
188
|
amazon: "Amazon",
|
|
186
189
|
apple: "Apple",
|
|
187
190
|
appwrite: "Appwrite",
|
|
@@ -232,10 +235,10 @@ const Ut = {
|
|
|
232
235
|
zoho: "Zoho",
|
|
233
236
|
zoom: "Zoom"
|
|
234
237
|
};
|
|
235
|
-
function
|
|
236
|
-
return
|
|
238
|
+
function N(e) {
|
|
239
|
+
return Ft[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
237
240
|
}
|
|
238
|
-
const
|
|
241
|
+
const Z = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), I = () => (/* @__PURE__ */ new Date()).toISOString(), O = (e) => new Date(Date.now() - e * 6e4).toISOString(), X = [
|
|
239
242
|
"amber",
|
|
240
243
|
"brave",
|
|
241
244
|
"calm",
|
|
@@ -248,13 +251,13 @@ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
248
251
|
"juniper",
|
|
249
252
|
"kite",
|
|
250
253
|
"lumen"
|
|
251
|
-
],
|
|
254
|
+
], mt = () => `${X[Math.floor(Math.random() * X.length)]}-${X[Math.floor(Math.random() * X.length)]}`, _ = () => Math.random().toString(36).slice(2, 12), gt = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), Rt = {
|
|
252
255
|
name: "Ada Lovelace",
|
|
253
256
|
email: "ada@example.com",
|
|
254
257
|
phone: "+15550100"
|
|
255
258
|
};
|
|
256
|
-
class
|
|
257
|
-
constructor(t =
|
|
259
|
+
class Tt {
|
|
260
|
+
constructor(t = Rt) {
|
|
258
261
|
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;
|
|
259
262
|
}
|
|
260
263
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -262,13 +265,13 @@ class Et {
|
|
|
262
265
|
const i = t.anonymous ?? !1;
|
|
263
266
|
return this.user = {
|
|
264
267
|
$id: "preview-user",
|
|
265
|
-
$createdAt:
|
|
266
|
-
$updatedAt:
|
|
268
|
+
$createdAt: O(1440 * 30),
|
|
269
|
+
$updatedAt: I(),
|
|
267
270
|
name: i ? "" : t.name ?? this.seed.name,
|
|
268
|
-
registration:
|
|
271
|
+
registration: O(1440 * 30),
|
|
269
272
|
status: !0,
|
|
270
273
|
labels: [],
|
|
271
|
-
passwordUpdate: i ? "" :
|
|
274
|
+
passwordUpdate: i ? "" : O(1440 * 7),
|
|
272
275
|
email: i ? "" : t.email ?? this.seed.email,
|
|
273
276
|
phone: i ? "" : t.phone ?? this.seed.phone,
|
|
274
277
|
emailVerification: !i,
|
|
@@ -276,14 +279,14 @@ class Et {
|
|
|
276
279
|
mfa: this.mfaEnabled,
|
|
277
280
|
prefs: {},
|
|
278
281
|
targets: [],
|
|
279
|
-
accessedAt:
|
|
282
|
+
accessedAt: I()
|
|
280
283
|
}, this.seedActivity(i ? "anonymous" : "email"), this.user;
|
|
281
284
|
}
|
|
282
285
|
seedActivity(t) {
|
|
283
286
|
if (this.sessions.length > 0) return;
|
|
284
287
|
const i = {
|
|
285
|
-
$createdAt:
|
|
286
|
-
$updatedAt:
|
|
288
|
+
$createdAt: I(),
|
|
289
|
+
$updatedAt: I(),
|
|
287
290
|
userId: "preview-user",
|
|
288
291
|
expire: new Date(Date.now() + 365 * 864e5).toISOString(),
|
|
289
292
|
providerUid: "",
|
|
@@ -318,8 +321,8 @@ class Et {
|
|
|
318
321
|
},
|
|
319
322
|
{
|
|
320
323
|
...i,
|
|
321
|
-
$id:
|
|
322
|
-
$createdAt:
|
|
324
|
+
$id: _(),
|
|
325
|
+
$createdAt: O(300),
|
|
323
326
|
provider: t,
|
|
324
327
|
ip: "198.51.100.7",
|
|
325
328
|
osCode: "IOS",
|
|
@@ -335,8 +338,8 @@ class Et {
|
|
|
335
338
|
},
|
|
336
339
|
{
|
|
337
340
|
...i,
|
|
338
|
-
$id:
|
|
339
|
-
$createdAt:
|
|
341
|
+
$id: _(),
|
|
342
|
+
$createdAt: O(1440 * 3),
|
|
340
343
|
provider: "oauth2",
|
|
341
344
|
ip: "192.0.2.90",
|
|
342
345
|
osCode: "WIN",
|
|
@@ -351,8 +354,8 @@ class Et {
|
|
|
351
354
|
], this.identities = [
|
|
352
355
|
{
|
|
353
356
|
$id: "identity-github",
|
|
354
|
-
$createdAt:
|
|
355
|
-
$updatedAt:
|
|
357
|
+
$createdAt: O(1440 * 20),
|
|
358
|
+
$updatedAt: O(1440 * 20),
|
|
356
359
|
userId: "preview-user",
|
|
357
360
|
provider: "github",
|
|
358
361
|
providerUid: "8675309",
|
|
@@ -364,7 +367,7 @@ class Et {
|
|
|
364
367
|
], this.logs = [
|
|
365
368
|
{
|
|
366
369
|
event: "session.create",
|
|
367
|
-
time:
|
|
370
|
+
time: I(),
|
|
368
371
|
clientName: "Chrome",
|
|
369
372
|
osName: "macOS",
|
|
370
373
|
countryName: "Germany",
|
|
@@ -372,7 +375,7 @@ class Et {
|
|
|
372
375
|
},
|
|
373
376
|
{
|
|
374
377
|
event: "user.update.name",
|
|
375
|
-
time:
|
|
378
|
+
time: O(1440 * 2),
|
|
376
379
|
clientName: "Safari",
|
|
377
380
|
osName: "iOS",
|
|
378
381
|
countryName: "Germany",
|
|
@@ -380,7 +383,7 @@ class Et {
|
|
|
380
383
|
},
|
|
381
384
|
{
|
|
382
385
|
event: "session.create",
|
|
383
|
-
time:
|
|
386
|
+
time: O(1440 * 3),
|
|
384
387
|
clientName: "Firefox",
|
|
385
388
|
osName: "Windows",
|
|
386
389
|
countryName: "United States",
|
|
@@ -390,9 +393,9 @@ class Et {
|
|
|
390
393
|
}
|
|
391
394
|
requireUser() {
|
|
392
395
|
if (!this.user)
|
|
393
|
-
throw
|
|
396
|
+
throw Z("general_unauthorized_scope", "User (role: guests) missing scope (account)");
|
|
394
397
|
if (this.mfaPending)
|
|
395
|
-
throw
|
|
398
|
+
throw Z(
|
|
396
399
|
"user_more_factors_required",
|
|
397
400
|
"More factors are required to complete the sign in process."
|
|
398
401
|
);
|
|
@@ -400,7 +403,7 @@ class Et {
|
|
|
400
403
|
}
|
|
401
404
|
requireRecentChallenge() {
|
|
402
405
|
if (Date.now() - this.lastChallenge > 30 * 6e4)
|
|
403
|
-
throw
|
|
406
|
+
throw Z(
|
|
404
407
|
"user_challenge_required",
|
|
405
408
|
"A recently successful challenge is required to complete this action."
|
|
406
409
|
);
|
|
@@ -436,26 +439,26 @@ class Et {
|
|
|
436
439
|
}
|
|
437
440
|
async createMagicURLToken(t, i) {
|
|
438
441
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
439
|
-
$id:
|
|
440
|
-
$createdAt:
|
|
442
|
+
$id: _(),
|
|
443
|
+
$createdAt: I(),
|
|
441
444
|
userId: t,
|
|
442
445
|
secret: "",
|
|
443
446
|
expire: "",
|
|
444
|
-
phrase:
|
|
447
|
+
phrase: mt()
|
|
445
448
|
});
|
|
446
449
|
}
|
|
447
450
|
async createEmailToken(t, i) {
|
|
448
451
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
449
|
-
$id:
|
|
450
|
-
$createdAt:
|
|
452
|
+
$id: _(),
|
|
453
|
+
$createdAt: I(),
|
|
451
454
|
userId: t,
|
|
452
455
|
secret: "",
|
|
453
456
|
expire: "",
|
|
454
|
-
phrase:
|
|
457
|
+
phrase: mt()
|
|
455
458
|
});
|
|
456
459
|
}
|
|
457
460
|
async createPhoneToken(t, i) {
|
|
458
|
-
return this.tokens.set(t, { phone: i }), this.delay({ $id:
|
|
461
|
+
return this.tokens.set(t, { phone: i }), this.delay({ $id: _(), $createdAt: I(), userId: t, secret: "", expire: "", phrase: "" });
|
|
459
462
|
}
|
|
460
463
|
async createSession(t) {
|
|
461
464
|
return this.delay(() => {
|
|
@@ -496,7 +499,7 @@ class Et {
|
|
|
496
499
|
async updateEmail(t) {
|
|
497
500
|
return this.delay(() => {
|
|
498
501
|
const i = this.requireUser();
|
|
499
|
-
return i.email = t, i.emailVerification = !1, i.passwordUpdate =
|
|
502
|
+
return i.email = t, i.emailVerification = !1, i.passwordUpdate = I(), i;
|
|
500
503
|
});
|
|
501
504
|
}
|
|
502
505
|
async updatePhone(t) {
|
|
@@ -508,7 +511,7 @@ class Et {
|
|
|
508
511
|
async updatePassword() {
|
|
509
512
|
return this.delay(() => {
|
|
510
513
|
const t = this.requireUser();
|
|
511
|
-
return t.passwordUpdate =
|
|
514
|
+
return t.passwordUpdate = I(), t;
|
|
512
515
|
});
|
|
513
516
|
}
|
|
514
517
|
async updateStatus() {
|
|
@@ -547,7 +550,7 @@ class Et {
|
|
|
547
550
|
});
|
|
548
551
|
}
|
|
549
552
|
async createMFAChallenge() {
|
|
550
|
-
return this.delay({ $id:
|
|
553
|
+
return this.delay({ $id: _(), $createdAt: I(), userId: "preview-user", expire: "" });
|
|
551
554
|
}
|
|
552
555
|
async updateMFAChallenge() {
|
|
553
556
|
return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
|
|
@@ -576,35 +579,35 @@ class Et {
|
|
|
576
579
|
async createMFARecoveryCodes() {
|
|
577
580
|
return this.delay(() => {
|
|
578
581
|
if (this.recoveryCodes.length > 0)
|
|
579
|
-
throw
|
|
580
|
-
return this.recoveryCodes = Array.from({ length: 6 },
|
|
582
|
+
throw Z("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
|
|
583
|
+
return this.recoveryCodes = Array.from({ length: 6 }, gt), { recoveryCodes: this.recoveryCodes };
|
|
581
584
|
});
|
|
582
585
|
}
|
|
583
586
|
async getMFARecoveryCodes() {
|
|
584
587
|
return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
|
|
585
588
|
}
|
|
586
589
|
async updateMFARecoveryCodes() {
|
|
587
|
-
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 },
|
|
590
|
+
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, gt), { recoveryCodes: this.recoveryCodes }));
|
|
588
591
|
}
|
|
589
592
|
/** Forget everything, as a sign out would. */
|
|
590
593
|
reset() {
|
|
591
594
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
|
-
function
|
|
597
|
+
function Dt(e) {
|
|
595
598
|
let t = 2166136261;
|
|
596
599
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
597
|
-
for (const
|
|
600
|
+
for (const m of e) t = (t ^ m.charCodeAt(0)) * 16777619;
|
|
598
601
|
const s = 25;
|
|
599
602
|
let a = "";
|
|
600
|
-
const
|
|
601
|
-
for (let
|
|
602
|
-
for (let
|
|
603
|
-
!(
|
|
604
|
-
const d = `<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">${
|
|
603
|
+
const c = (m, v) => `<rect x="${m}" y="${v}" width="7" height="7"/><rect x="${m + 1}" y="${v + 1}" width="5" height="5" fill="#fff"/><rect x="${m + 2}" y="${v + 2}" width="3" height="3"/>`;
|
|
604
|
+
for (let m = 0; m < s; m++)
|
|
605
|
+
for (let v = 0; v < s; v++)
|
|
606
|
+
!(v < 8 && m < 8 || v >= s - 8 && m < 8 || v < 8 && m >= s - 8) && i() < 0.45 && (a += `<rect x="${v}" y="${m}" width="1" height="1"/>`);
|
|
607
|
+
const d = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${c(0, 0)}${c(s - 7, 0)}${c(0, s - 7)}${a}</g></svg>`;
|
|
605
608
|
return `data:image/svg+xml;utf8,${encodeURIComponent(d)}`;
|
|
606
609
|
}
|
|
607
|
-
const
|
|
610
|
+
const y = {
|
|
608
611
|
moreFactorsRequired: "user_more_factors_required",
|
|
609
612
|
invalidCredentials: "user_invalid_credentials",
|
|
610
613
|
userAlreadyExists: "user_already_exists",
|
|
@@ -639,7 +642,7 @@ const v = {
|
|
|
639
642
|
targetAlreadyExists: "user_target_already_exists",
|
|
640
643
|
argumentInvalid: "general_argument_invalid"
|
|
641
644
|
};
|
|
642
|
-
function
|
|
645
|
+
function B(e) {
|
|
643
646
|
if (e && typeof e == "object") {
|
|
644
647
|
const t = e;
|
|
645
648
|
let i = typeof t.message == "string" ? t.message : "Unknown error";
|
|
@@ -651,119 +654,119 @@ function V(e) {
|
|
|
651
654
|
}
|
|
652
655
|
return { message: String(e), type: "", code: 0 };
|
|
653
656
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
657
|
+
function K(e, t) {
|
|
658
|
+
return B(e).type === t;
|
|
656
659
|
}
|
|
657
|
-
function
|
|
658
|
-
const s =
|
|
660
|
+
function J(e, t, i = "link") {
|
|
661
|
+
const s = B(e);
|
|
659
662
|
switch (s.type) {
|
|
660
|
-
case
|
|
663
|
+
case y.invalidCredentials:
|
|
661
664
|
return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
|
|
662
|
-
case
|
|
663
|
-
case
|
|
664
|
-
case
|
|
665
|
+
case y.userAlreadyExists:
|
|
666
|
+
case y.emailAlreadyExists:
|
|
667
|
+
case y.phoneAlreadyExists:
|
|
665
668
|
return t.errorUserExists;
|
|
666
|
-
case
|
|
669
|
+
case y.userBlocked:
|
|
667
670
|
return t.errorUserBlocked;
|
|
668
|
-
case
|
|
671
|
+
case y.rateLimit:
|
|
669
672
|
return t.errorRateLimit;
|
|
670
|
-
case
|
|
673
|
+
case y.invalidToken:
|
|
671
674
|
return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
|
|
672
|
-
case
|
|
675
|
+
case y.invalidCode:
|
|
673
676
|
return t.errorInvalidCode;
|
|
674
|
-
case
|
|
677
|
+
case y.passwordMismatch:
|
|
675
678
|
return t.errorPasswordMismatch;
|
|
676
|
-
case
|
|
679
|
+
case y.passwordRecentlyUsed:
|
|
677
680
|
return t.errorPasswordRecentlyUsed;
|
|
678
|
-
case
|
|
681
|
+
case y.passwordPersonalData:
|
|
679
682
|
return t.errorPasswordPersonalData;
|
|
680
|
-
case
|
|
683
|
+
case y.passwordWeak:
|
|
681
684
|
return t.errorPasswordWeak;
|
|
682
|
-
case
|
|
685
|
+
case y.passwordPwned:
|
|
683
686
|
return t.errorPasswordPwned;
|
|
684
|
-
case
|
|
687
|
+
case y.challengeRequired:
|
|
685
688
|
return t.errorChallengeRequired;
|
|
686
|
-
case
|
|
689
|
+
case y.sessionAlreadyExists:
|
|
687
690
|
return t.errorSessionExists;
|
|
688
|
-
case
|
|
689
|
-
case
|
|
691
|
+
case y.oauthUnauthorized:
|
|
692
|
+
case y.oauthBadRequest:
|
|
690
693
|
return t.errorOAuth;
|
|
691
|
-
case
|
|
694
|
+
case y.authMethodUnsupported:
|
|
692
695
|
return t.errorMethodDisabled;
|
|
693
696
|
}
|
|
694
|
-
if (s.type ===
|
|
697
|
+
if (s.type === y.argumentInvalid || /Invalid `\w+` param/i.test(s.message)) {
|
|
695
698
|
const a = s.message.match(/Invalid `([^`]+)` param/i)?.[1]?.toLowerCase();
|
|
696
699
|
return a === "email" ? t.errorInvalidEmail : a === "password" ? t.errorInvalidPassword : a === "phone" ? t.errorInvalidPhone : a === "name" ? t.errorInvalidName : t.errorGeneric;
|
|
697
700
|
}
|
|
698
|
-
return s.type ===
|
|
701
|
+
return s.type === y.projectNotFound || s.type === y.unknownOrigin ? t.errorConfig : s.type === y.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 === y.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
|
|
699
702
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
702
|
-
return !!(t.type ===
|
|
703
|
+
function Lt(e) {
|
|
704
|
+
const t = B(e);
|
|
705
|
+
return !!(t.type === y.projectNotFound || t.type === y.unknownOrigin || t.type === y.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
|
|
703
706
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
707
|
+
const at = (e) => `authui:active-team:${e}`;
|
|
708
|
+
function vt(e) {
|
|
706
709
|
if (typeof localStorage > "u" || !e) return null;
|
|
707
710
|
try {
|
|
708
|
-
return localStorage.getItem(
|
|
711
|
+
return localStorage.getItem(at(e));
|
|
709
712
|
} catch {
|
|
710
713
|
return null;
|
|
711
714
|
}
|
|
712
715
|
}
|
|
713
|
-
function
|
|
716
|
+
function zt(e, t) {
|
|
714
717
|
if (!(typeof localStorage > "u" || !e))
|
|
715
718
|
try {
|
|
716
|
-
t ? localStorage.setItem(
|
|
719
|
+
t ? localStorage.setItem(at(e), t) : localStorage.removeItem(at(e));
|
|
717
720
|
} catch {
|
|
718
721
|
}
|
|
719
722
|
}
|
|
720
|
-
const
|
|
721
|
-
function
|
|
723
|
+
const ht = "authui:last-method";
|
|
724
|
+
function V(e) {
|
|
722
725
|
if (!(typeof localStorage > "u")) {
|
|
723
726
|
if (!e || e === "mfa" || e === "sign-up")
|
|
724
727
|
if (e === "sign-up") e = "email-password";
|
|
725
728
|
else return;
|
|
726
729
|
try {
|
|
727
|
-
localStorage.setItem(
|
|
730
|
+
localStorage.setItem(ht, e);
|
|
728
731
|
} catch {
|
|
729
732
|
}
|
|
730
733
|
}
|
|
731
734
|
}
|
|
732
|
-
function
|
|
735
|
+
function q() {
|
|
733
736
|
if (typeof localStorage > "u") return null;
|
|
734
737
|
try {
|
|
735
|
-
return localStorage.getItem(
|
|
738
|
+
return localStorage.getItem(ht);
|
|
736
739
|
} catch {
|
|
737
740
|
return null;
|
|
738
741
|
}
|
|
739
742
|
}
|
|
740
|
-
function
|
|
743
|
+
function ge() {
|
|
741
744
|
if (!(typeof localStorage > "u"))
|
|
742
745
|
try {
|
|
743
|
-
localStorage.removeItem(
|
|
746
|
+
localStorage.removeItem(ht);
|
|
744
747
|
} catch {
|
|
745
748
|
}
|
|
746
749
|
}
|
|
747
|
-
const
|
|
748
|
-
function
|
|
750
|
+
const tt = "authui:pending-oauth";
|
|
751
|
+
function _t(e) {
|
|
749
752
|
if (!(typeof sessionStorage > "u"))
|
|
750
753
|
try {
|
|
751
|
-
sessionStorage.setItem(
|
|
754
|
+
sessionStorage.setItem(tt, e);
|
|
752
755
|
} catch {
|
|
753
756
|
}
|
|
754
757
|
}
|
|
755
|
-
function
|
|
758
|
+
function At() {
|
|
756
759
|
if (!(typeof sessionStorage > "u"))
|
|
757
760
|
try {
|
|
758
|
-
const e = sessionStorage.getItem(
|
|
759
|
-
sessionStorage.removeItem(
|
|
761
|
+
const e = sessionStorage.getItem(tt);
|
|
762
|
+
sessionStorage.removeItem(tt), e && V(`oauth:${e}`);
|
|
760
763
|
} catch {
|
|
761
764
|
}
|
|
762
765
|
}
|
|
763
|
-
function
|
|
766
|
+
function bt() {
|
|
764
767
|
if (!(typeof sessionStorage > "u"))
|
|
765
768
|
try {
|
|
766
|
-
sessionStorage.removeItem(
|
|
769
|
+
sessionStorage.removeItem(tt);
|
|
767
770
|
} catch {
|
|
768
771
|
}
|
|
769
772
|
}
|
|
@@ -777,7 +780,7 @@ function A(e, t, i) {
|
|
|
777
780
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
778
781
|
);
|
|
779
782
|
}
|
|
780
|
-
const
|
|
783
|
+
const nt = "authui", yt = ["userId", "secret", "expire", "project", "error", nt], wt = () => ({
|
|
781
784
|
status: "loading",
|
|
782
785
|
user: null,
|
|
783
786
|
mfaFactors: null,
|
|
@@ -785,9 +788,9 @@ const st = "authui", gt = ["userId", "secret", "expire", "project", "error", st]
|
|
|
785
788
|
configured: !1,
|
|
786
789
|
configError: null
|
|
787
790
|
});
|
|
788
|
-
class
|
|
791
|
+
class qt {
|
|
789
792
|
constructor() {
|
|
790
|
-
this.client = null, this.account = null, this.config = null, this.state =
|
|
793
|
+
this.client = null, this.account = null, this.config = null, this.state = wt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
791
794
|
}
|
|
792
795
|
// ───────────────────────────── configuration ─────────────────────────────
|
|
793
796
|
/** Configure the Appwrite client. Safe to call more than once; the last call wins. */
|
|
@@ -795,7 +798,7 @@ class Tt {
|
|
|
795
798
|
const i = t.endpoint.trim().replace(/\/+$/, "");
|
|
796
799
|
i && !i.endsWith("/v1") && console.warn(
|
|
797
800
|
`[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
|
|
798
|
-
), this.config = t, this.client = new
|
|
801
|
+
), this.config = t, this.client = new pt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Tt() : null, this.account = this.preview ? this.preview : new ft(this.client), this.teams = null, this.activeTeamId = vt(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
|
|
799
802
|
}
|
|
800
803
|
/**
|
|
801
804
|
* Called by <authui-config> when it is on the page but missing endpoint or project.
|
|
@@ -809,8 +812,7 @@ class Tt {
|
|
|
809
812
|
user: null,
|
|
810
813
|
mfaFactors: null,
|
|
811
814
|
configured: !1,
|
|
812
|
-
configError: t
|
|
813
|
-
pending: { type: "notice", tone: "error", message: t }
|
|
815
|
+
configError: t
|
|
814
816
|
});
|
|
815
817
|
}
|
|
816
818
|
get isConfigured() {
|
|
@@ -841,7 +843,7 @@ class Tt {
|
|
|
841
843
|
/** List teams the signed-in user belongs to. Empty in preview or when signed out. */
|
|
842
844
|
async listTeams() {
|
|
843
845
|
if (this.preview || !this.client || this.state.status !== "signed-in") return [];
|
|
844
|
-
this.teams ??= new
|
|
846
|
+
this.teams ??= new Et(this.client);
|
|
845
847
|
try {
|
|
846
848
|
return (await this.teams.list()).teams ?? [];
|
|
847
849
|
} catch (t) {
|
|
@@ -851,7 +853,7 @@ class Tt {
|
|
|
851
853
|
getActiveTeamId() {
|
|
852
854
|
if (this.activeTeamId) return this.activeTeamId;
|
|
853
855
|
const t = this.config?.project;
|
|
854
|
-
return t ? (this.activeTeamId =
|
|
856
|
+
return t ? (this.activeTeamId = vt(t), this.activeTeamId) : null;
|
|
855
857
|
}
|
|
856
858
|
/**
|
|
857
859
|
* Remember the active team locally and emit `active-team`.
|
|
@@ -859,10 +861,10 @@ class Tt {
|
|
|
859
861
|
*/
|
|
860
862
|
setActiveTeam(t) {
|
|
861
863
|
const i = this.config?.project;
|
|
862
|
-
i &&
|
|
864
|
+
i && zt(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
|
|
863
865
|
}
|
|
864
866
|
getStrings() {
|
|
865
|
-
return { ...
|
|
867
|
+
return { ...Mt, ...this.config?.strings ?? {} };
|
|
866
868
|
}
|
|
867
869
|
getState() {
|
|
868
870
|
return { ...this.state };
|
|
@@ -888,7 +890,7 @@ class Tt {
|
|
|
888
890
|
this.state = { ...this.state, ...t }, this.emit("change", this.getState());
|
|
889
891
|
}
|
|
890
892
|
fail(t) {
|
|
891
|
-
const i =
|
|
893
|
+
const i = B(t);
|
|
892
894
|
throw this.emit("error", i), t;
|
|
893
895
|
}
|
|
894
896
|
acct() {
|
|
@@ -908,7 +910,7 @@ class Tt {
|
|
|
908
910
|
const i = await this.account.get();
|
|
909
911
|
this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
|
|
910
912
|
} catch (i) {
|
|
911
|
-
if (
|
|
913
|
+
if (K(i, y.moreFactorsRequired)) {
|
|
912
914
|
let s = null;
|
|
913
915
|
try {
|
|
914
916
|
s = await A(
|
|
@@ -919,7 +921,7 @@ class Tt {
|
|
|
919
921
|
} catch {
|
|
920
922
|
}
|
|
921
923
|
this.setState({ status: "mfa-required", user: null, mfaFactors: s });
|
|
922
|
-
} else if (
|
|
924
|
+
} else if (K(i, y.userBlocked))
|
|
923
925
|
await this.purgeLocalSession(), this.setState({
|
|
924
926
|
status: "signed-out",
|
|
925
927
|
user: null,
|
|
@@ -930,18 +932,17 @@ class Tt {
|
|
|
930
932
|
message: this.getStrings().errorUserBlocked
|
|
931
933
|
}
|
|
932
934
|
}), t && this.emit("signed-out", void 0);
|
|
933
|
-
else if (!t &&
|
|
934
|
-
const a =
|
|
935
|
+
else if (!t && Lt(i)) {
|
|
936
|
+
const a = J(i, this.getStrings()) || this.getStrings().errorConfig;
|
|
935
937
|
console.warn(
|
|
936
938
|
`[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
|
|
937
939
|
);
|
|
938
|
-
const
|
|
939
|
-
this.emit("error", { message: a, type:
|
|
940
|
+
const c = B(i);
|
|
941
|
+
this.emit("error", { message: a, type: c.type, code: c.code }), this.setState({
|
|
940
942
|
status: "signed-out",
|
|
941
943
|
user: null,
|
|
942
944
|
mfaFactors: null,
|
|
943
|
-
configError: a
|
|
944
|
-
pending: { type: "notice", tone: "error", message: a }
|
|
945
|
+
configError: a
|
|
945
946
|
});
|
|
946
947
|
} else
|
|
947
948
|
this.setState({ status: "signed-out", user: null, mfaFactors: null, configError: null }), t && this.emit("signed-out", void 0);
|
|
@@ -955,7 +956,7 @@ class Tt {
|
|
|
955
956
|
const i = this.state.pending;
|
|
956
957
|
if (i?.type === "notice" && i.tone === "error")
|
|
957
958
|
throw Object.assign(new Error(i.message), {
|
|
958
|
-
type:
|
|
959
|
+
type: y.userBlocked,
|
|
959
960
|
code: 401
|
|
960
961
|
});
|
|
961
962
|
}
|
|
@@ -980,7 +981,7 @@ class Tt {
|
|
|
980
981
|
localStorage.removeItem("cookieFallback");
|
|
981
982
|
} catch {
|
|
982
983
|
}
|
|
983
|
-
this.config && !this.preview && (this.client = new
|
|
984
|
+
this.config && !this.preview && (this.client = new pt().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new ft(this.client));
|
|
984
985
|
}
|
|
985
986
|
// ─────────────────────────────── sign in ───────────────────────────────
|
|
986
987
|
async signInWithEmailPassword(t, i) {
|
|
@@ -993,7 +994,7 @@ class Tt {
|
|
|
993
994
|
}
|
|
994
995
|
async signUp(t, i, s) {
|
|
995
996
|
try {
|
|
996
|
-
await this.acct().create(
|
|
997
|
+
await this.acct().create(Y.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
|
|
997
998
|
} catch (a) {
|
|
998
999
|
this.fail(a);
|
|
999
1000
|
}
|
|
@@ -1036,7 +1037,7 @@ class Tt {
|
|
|
1036
1037
|
async sendMagicUrl(t) {
|
|
1037
1038
|
try {
|
|
1038
1039
|
return await this.acct().createMagicURLToken(
|
|
1039
|
-
|
|
1040
|
+
Y.unique(),
|
|
1040
1041
|
t.trim(),
|
|
1041
1042
|
this.redirectUrl("magic-url"),
|
|
1042
1043
|
this.config?.securityPhrase ?? !0
|
|
@@ -1048,7 +1049,7 @@ class Tt {
|
|
|
1048
1049
|
async sendEmailOtp(t) {
|
|
1049
1050
|
try {
|
|
1050
1051
|
return await this.acct().createEmailToken(
|
|
1051
|
-
|
|
1052
|
+
Y.unique(),
|
|
1052
1053
|
t.trim(),
|
|
1053
1054
|
this.config?.securityPhrase ?? !0
|
|
1054
1055
|
);
|
|
@@ -1058,7 +1059,7 @@ class Tt {
|
|
|
1058
1059
|
}
|
|
1059
1060
|
async sendPhoneOtp(t) {
|
|
1060
1061
|
try {
|
|
1061
|
-
return await this.acct().createPhoneToken(
|
|
1062
|
+
return await this.acct().createPhoneToken(Y.unique(), t.replace(/[\s()-]/g, ""));
|
|
1062
1063
|
} catch (i) {
|
|
1063
1064
|
return this.fail(i);
|
|
1064
1065
|
}
|
|
@@ -1332,8 +1333,8 @@ class Tt {
|
|
|
1332
1333
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1333
1334
|
redirectUrl(t) {
|
|
1334
1335
|
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);
|
|
1335
|
-
for (const a of
|
|
1336
|
-
return s.searchParams.set(
|
|
1336
|
+
for (const a of yt) s.searchParams.delete(a);
|
|
1337
|
+
return s.searchParams.set(nt, t), s.toString();
|
|
1337
1338
|
}
|
|
1338
1339
|
setPending(t) {
|
|
1339
1340
|
this.setState({ pending: t });
|
|
@@ -1344,11 +1345,11 @@ class Tt {
|
|
|
1344
1345
|
*/
|
|
1345
1346
|
async handleRedirect() {
|
|
1346
1347
|
if (typeof window > "u") return !1;
|
|
1347
|
-
const t = new URLSearchParams(window.location.search), i = t.get(
|
|
1348
|
+
const t = new URLSearchParams(window.location.search), i = t.get(nt);
|
|
1348
1349
|
if (!i) return !1;
|
|
1349
1350
|
const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
|
|
1350
1351
|
this.cleanUrl();
|
|
1351
|
-
const
|
|
1352
|
+
const c = () => {
|
|
1352
1353
|
this.setState({
|
|
1353
1354
|
pending: {
|
|
1354
1355
|
type: "notice",
|
|
@@ -1361,10 +1362,10 @@ class Tt {
|
|
|
1361
1362
|
switch (i) {
|
|
1362
1363
|
case "oauth":
|
|
1363
1364
|
case "magic-url":
|
|
1364
|
-
s && a ? (await this.acct().createSession(s, a), i === "oauth" ?
|
|
1365
|
+
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? At() : V("magic-url")) : (i === "oauth" && bt(), c());
|
|
1365
1366
|
break;
|
|
1366
1367
|
case "oauth-failed":
|
|
1367
|
-
|
|
1368
|
+
bt(), this.setState({
|
|
1368
1369
|
pending: {
|
|
1369
1370
|
type: "notice",
|
|
1370
1371
|
tone: "error",
|
|
@@ -1373,7 +1374,7 @@ class Tt {
|
|
|
1373
1374
|
});
|
|
1374
1375
|
break;
|
|
1375
1376
|
case "recovery":
|
|
1376
|
-
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) :
|
|
1377
|
+
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : c();
|
|
1377
1378
|
break;
|
|
1378
1379
|
case "verify-email":
|
|
1379
1380
|
s && a ? (await A(
|
|
@@ -1386,27 +1387,27 @@ class Tt {
|
|
|
1386
1387
|
message: this.getStrings().emailVerified,
|
|
1387
1388
|
tone: "success"
|
|
1388
1389
|
}
|
|
1389
|
-
})) :
|
|
1390
|
+
})) : c();
|
|
1390
1391
|
break;
|
|
1391
1392
|
}
|
|
1392
1393
|
} catch (d) {
|
|
1393
|
-
const
|
|
1394
|
-
this.emit("error",
|
|
1394
|
+
const m = B(d), v = J(d, this.getStrings(), "link");
|
|
1395
|
+
this.emit("error", m), this.setState({ pending: { type: "notice", message: v, tone: "error" } });
|
|
1395
1396
|
}
|
|
1396
1397
|
return !0;
|
|
1397
1398
|
}
|
|
1398
1399
|
cleanUrl() {
|
|
1399
1400
|
const t = new URL(window.location.href);
|
|
1400
|
-
for (const i of
|
|
1401
|
+
for (const i of yt) t.searchParams.delete(i);
|
|
1401
1402
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1402
1403
|
}
|
|
1403
1404
|
/** Test helper. */
|
|
1404
1405
|
reset() {
|
|
1405
|
-
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state =
|
|
1406
|
+
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = wt(), this.listeners.clear();
|
|
1406
1407
|
}
|
|
1407
1408
|
}
|
|
1408
|
-
const l = new
|
|
1409
|
-
class
|
|
1409
|
+
const l = new qt();
|
|
1410
|
+
class Vt {
|
|
1410
1411
|
constructor() {
|
|
1411
1412
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
1412
1413
|
const t = this.isDark("auto");
|
|
@@ -1434,14 +1435,14 @@ class Lt {
|
|
|
1434
1435
|
this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
|
|
1435
1436
|
}
|
|
1436
1437
|
}
|
|
1437
|
-
const
|
|
1438
|
+
const $t = new Vt(), xt = {
|
|
1438
1439
|
none: "0px",
|
|
1439
1440
|
sm: "0.25rem",
|
|
1440
1441
|
md: "0.625rem",
|
|
1441
1442
|
lg: "0.875rem",
|
|
1442
1443
|
xl: "1.125rem",
|
|
1443
1444
|
full: "1.5rem"
|
|
1444
|
-
},
|
|
1445
|
+
}, Nt = D`
|
|
1445
1446
|
:host {
|
|
1446
1447
|
/* Light theme (matches :root in the console) */
|
|
1447
1448
|
--authui-background: oklch(1 0 0);
|
|
@@ -1521,7 +1522,7 @@ const bt = new Lt(), yt = {
|
|
|
1521
1522
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1522
1523
|
color-scheme: dark;
|
|
1523
1524
|
}
|
|
1524
|
-
`,
|
|
1525
|
+
`, Bt = D`
|
|
1525
1526
|
*,
|
|
1526
1527
|
*::before,
|
|
1527
1528
|
*::after {
|
|
@@ -1810,6 +1811,94 @@ const bt = new Lt(), yt = {
|
|
|
1810
1811
|
font-size: 18px;
|
|
1811
1812
|
height: 44px;
|
|
1812
1813
|
}
|
|
1814
|
+
|
|
1815
|
+
/* Vibes-style segmented OTP (3 + sep + 3) */
|
|
1816
|
+
.otp {
|
|
1817
|
+
position: relative;
|
|
1818
|
+
display: flex;
|
|
1819
|
+
align-items: center;
|
|
1820
|
+
justify-content: center;
|
|
1821
|
+
gap: 8px;
|
|
1822
|
+
width: 100%;
|
|
1823
|
+
min-height: 52px;
|
|
1824
|
+
}
|
|
1825
|
+
.otp-group {
|
|
1826
|
+
display: flex;
|
|
1827
|
+
flex: 1;
|
|
1828
|
+
gap: 6px;
|
|
1829
|
+
min-width: 0;
|
|
1830
|
+
}
|
|
1831
|
+
.otp-slot {
|
|
1832
|
+
flex: 1;
|
|
1833
|
+
min-width: 0;
|
|
1834
|
+
height: 52px;
|
|
1835
|
+
display: flex;
|
|
1836
|
+
align-items: center;
|
|
1837
|
+
justify-content: center;
|
|
1838
|
+
border: 1px solid var(--authui-input);
|
|
1839
|
+
border-radius: var(--authui-radius-md);
|
|
1840
|
+
background: var(--authui-background);
|
|
1841
|
+
color: var(--authui-foreground);
|
|
1842
|
+
font-family: var(--authui-font-mono);
|
|
1843
|
+
font-size: 22px;
|
|
1844
|
+
font-weight: 600;
|
|
1845
|
+
line-height: 1;
|
|
1846
|
+
box-shadow: var(--authui-shadow-xs);
|
|
1847
|
+
transition:
|
|
1848
|
+
border-color 120ms ease,
|
|
1849
|
+
box-shadow 120ms ease,
|
|
1850
|
+
background-color 120ms ease;
|
|
1851
|
+
}
|
|
1852
|
+
.otp-slot-active {
|
|
1853
|
+
border-color: var(--authui-ring);
|
|
1854
|
+
box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 40%, transparent);
|
|
1855
|
+
}
|
|
1856
|
+
.otp-invalid .otp-slot {
|
|
1857
|
+
border-color: var(--authui-destructive);
|
|
1858
|
+
}
|
|
1859
|
+
.otp-invalid .otp-slot-active {
|
|
1860
|
+
box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-destructive) 35%, transparent);
|
|
1861
|
+
}
|
|
1862
|
+
.otp-sep {
|
|
1863
|
+
display: flex;
|
|
1864
|
+
align-items: center;
|
|
1865
|
+
justify-content: center;
|
|
1866
|
+
flex-shrink: 0;
|
|
1867
|
+
width: 12px;
|
|
1868
|
+
}
|
|
1869
|
+
.otp-sep span {
|
|
1870
|
+
display: block;
|
|
1871
|
+
width: 8px;
|
|
1872
|
+
height: 2px;
|
|
1873
|
+
border-radius: 1px;
|
|
1874
|
+
background: var(--authui-muted-foreground);
|
|
1875
|
+
opacity: 0.7;
|
|
1876
|
+
}
|
|
1877
|
+
.otp-native {
|
|
1878
|
+
position: absolute;
|
|
1879
|
+
inset: 0;
|
|
1880
|
+
width: 100%;
|
|
1881
|
+
height: 100%;
|
|
1882
|
+
opacity: 0;
|
|
1883
|
+
margin: 0;
|
|
1884
|
+
border: 0;
|
|
1885
|
+
padding: 0;
|
|
1886
|
+
caret-color: transparent;
|
|
1887
|
+
color: transparent;
|
|
1888
|
+
background: transparent;
|
|
1889
|
+
cursor: text;
|
|
1890
|
+
z-index: 1;
|
|
1891
|
+
}
|
|
1892
|
+
.otp-disabled {
|
|
1893
|
+
opacity: 0.5;
|
|
1894
|
+
pointer-events: none;
|
|
1895
|
+
}
|
|
1896
|
+
@media (max-width: 380px) {
|
|
1897
|
+
.otp-slot {
|
|
1898
|
+
height: 44px;
|
|
1899
|
+
font-size: 18px;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1813
1902
|
.hint {
|
|
1814
1903
|
font-size: 12px;
|
|
1815
1904
|
color: var(--authui-muted-foreground);
|
|
@@ -2574,25 +2663,25 @@ const bt = new Lt(), yt = {
|
|
|
2574
2663
|
}
|
|
2575
2664
|
}
|
|
2576
2665
|
`;
|
|
2577
|
-
var
|
|
2578
|
-
for (var a = void 0,
|
|
2579
|
-
(d = e[
|
|
2580
|
-
return a &&
|
|
2581
|
-
},
|
|
2582
|
-
const
|
|
2666
|
+
var jt = Object.defineProperty, Ht = (e, t, i, s) => {
|
|
2667
|
+
for (var a = void 0, c = e.length - 1, d; c >= 0; c--)
|
|
2668
|
+
(d = e[c]) && (a = d(t, i, a) || a);
|
|
2669
|
+
return a && jt(t, i, a), a;
|
|
2670
|
+
}, F;
|
|
2671
|
+
const Pt = (F = class extends dt {
|
|
2583
2672
|
constructor() {
|
|
2584
2673
|
super(...arguments), this.auth = l.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2585
2674
|
}
|
|
2586
2675
|
connectedCallback() {
|
|
2587
2676
|
super.connectedCallback();
|
|
2588
|
-
for (const t of
|
|
2677
|
+
for (const t of F.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2589
2678
|
this.auth = l.getState(), this.unsubscribeStore = l.on("change", (t) => {
|
|
2590
2679
|
this.auth = t, this.applyBranding();
|
|
2591
|
-
}), this.unsubscribeTheme =
|
|
2680
|
+
}), this.unsubscribeTheme = $t.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2592
2681
|
}
|
|
2593
2682
|
disconnectedCallback() {
|
|
2594
2683
|
super.disconnectedCallback();
|
|
2595
|
-
for (const t of
|
|
2684
|
+
for (const t of F.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
|
|
2596
2685
|
this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
|
|
2597
2686
|
}
|
|
2598
2687
|
get strings() {
|
|
@@ -2600,7 +2689,7 @@ const kt = (O = class extends ot {
|
|
|
2600
2689
|
}
|
|
2601
2690
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2602
2691
|
t(t, i) {
|
|
2603
|
-
return
|
|
2692
|
+
return Ot(this.strings[t], i);
|
|
2604
2693
|
}
|
|
2605
2694
|
get config() {
|
|
2606
2695
|
return l.getConfig();
|
|
@@ -2610,27 +2699,27 @@ const kt = (O = class extends ot {
|
|
|
2610
2699
|
}
|
|
2611
2700
|
/** Push theme and branding from config onto the host element. */
|
|
2612
2701
|
applyBranding() {
|
|
2613
|
-
const t = this.config?.branding, i =
|
|
2702
|
+
const t = this.config?.branding, i = $t.isDark(t?.theme ?? "auto");
|
|
2614
2703
|
this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
|
|
2615
2704
|
"--authui-primary-foreground",
|
|
2616
2705
|
t.primaryForeground ?? "#ffffff"
|
|
2617
|
-
)), t?.radius &&
|
|
2706
|
+
)), t?.radius && xt[t.radius] && this.style.setProperty("--authui-radius", xt[t.radius]);
|
|
2618
2707
|
}
|
|
2619
2708
|
/** Emit a composed custom event from this element. */
|
|
2620
2709
|
fire(t, i) {
|
|
2621
2710
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2622
2711
|
}
|
|
2623
|
-
},
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
],
|
|
2627
|
-
let
|
|
2628
|
-
var
|
|
2629
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2630
|
-
(d = e[
|
|
2631
|
-
return s && a &&
|
|
2712
|
+
}, F.styles = [Nt, Bt], F.KEY_EVENTS = ["keydown", "keyup", "keypress"], F);
|
|
2713
|
+
Ht([
|
|
2714
|
+
h()
|
|
2715
|
+
], Pt.prototype, "auth");
|
|
2716
|
+
let M = Pt;
|
|
2717
|
+
var Wt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
|
|
2718
|
+
for (var a = s > 1 ? void 0 : s ? Kt(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
2719
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2720
|
+
return s && a && Wt(t, i, a), a;
|
|
2632
2721
|
};
|
|
2633
|
-
let
|
|
2722
|
+
let $ = class extends dt {
|
|
2634
2723
|
constructor() {
|
|
2635
2724
|
super(...arguments), this.endpoint = "", this.project = "", this.redirectUrl = "", this.successUrl = "", this.methods = "email-password", this.signUp = "true", this.requireName = "true", this.mfa = "true", this.securityPhrase = "true", this.name = "", this.logo = "", this.theme = "auto", this.radius = "", this.primary = "", this.primaryForeground = "", this.termsUrl = "", this.privacyUrl = "", this.requireAcceptance = "", this.oauthLayout = "", this.preview = "";
|
|
2636
2725
|
}
|
|
@@ -2681,108 +2770,108 @@ let w = class extends ot {
|
|
|
2681
2770
|
};
|
|
2682
2771
|
}
|
|
2683
2772
|
};
|
|
2684
|
-
|
|
2773
|
+
$.styles = D`
|
|
2685
2774
|
:host {
|
|
2686
2775
|
display: none;
|
|
2687
2776
|
}
|
|
2688
2777
|
`;
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
],
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
],
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
],
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
],
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
],
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
],
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
],
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
],
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
],
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
],
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
],
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
],
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
],
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
],
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
],
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
],
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
],
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
],
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
],
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
],
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
],
|
|
2752
|
-
var
|
|
2753
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2754
|
-
(d = e[
|
|
2755
|
-
return s && a &&
|
|
2778
|
+
k([
|
|
2779
|
+
b({ type: String })
|
|
2780
|
+
], $.prototype, "endpoint", 2);
|
|
2781
|
+
k([
|
|
2782
|
+
b({ type: String })
|
|
2783
|
+
], $.prototype, "project", 2);
|
|
2784
|
+
k([
|
|
2785
|
+
b({ type: String, attribute: "redirect-url" })
|
|
2786
|
+
], $.prototype, "redirectUrl", 2);
|
|
2787
|
+
k([
|
|
2788
|
+
b({ type: String, attribute: "success-url" })
|
|
2789
|
+
], $.prototype, "successUrl", 2);
|
|
2790
|
+
k([
|
|
2791
|
+
b({ type: String })
|
|
2792
|
+
], $.prototype, "methods", 2);
|
|
2793
|
+
k([
|
|
2794
|
+
b({ type: String, attribute: "sign-up" })
|
|
2795
|
+
], $.prototype, "signUp", 2);
|
|
2796
|
+
k([
|
|
2797
|
+
b({ type: String, attribute: "require-name" })
|
|
2798
|
+
], $.prototype, "requireName", 2);
|
|
2799
|
+
k([
|
|
2800
|
+
b({ type: String })
|
|
2801
|
+
], $.prototype, "mfa", 2);
|
|
2802
|
+
k([
|
|
2803
|
+
b({ type: String, attribute: "security-phrase" })
|
|
2804
|
+
], $.prototype, "securityPhrase", 2);
|
|
2805
|
+
k([
|
|
2806
|
+
b({ type: String })
|
|
2807
|
+
], $.prototype, "name", 2);
|
|
2808
|
+
k([
|
|
2809
|
+
b({ type: String })
|
|
2810
|
+
], $.prototype, "logo", 2);
|
|
2811
|
+
k([
|
|
2812
|
+
b({ type: String })
|
|
2813
|
+
], $.prototype, "theme", 2);
|
|
2814
|
+
k([
|
|
2815
|
+
b({ type: String })
|
|
2816
|
+
], $.prototype, "radius", 2);
|
|
2817
|
+
k([
|
|
2818
|
+
b({ type: String })
|
|
2819
|
+
], $.prototype, "primary", 2);
|
|
2820
|
+
k([
|
|
2821
|
+
b({ type: String, attribute: "primary-foreground" })
|
|
2822
|
+
], $.prototype, "primaryForeground", 2);
|
|
2823
|
+
k([
|
|
2824
|
+
b({ type: String, attribute: "terms-url" })
|
|
2825
|
+
], $.prototype, "termsUrl", 2);
|
|
2826
|
+
k([
|
|
2827
|
+
b({ type: String, attribute: "privacy-url" })
|
|
2828
|
+
], $.prototype, "privacyUrl", 2);
|
|
2829
|
+
k([
|
|
2830
|
+
b({ type: String, attribute: "require-acceptance" })
|
|
2831
|
+
], $.prototype, "requireAcceptance", 2);
|
|
2832
|
+
k([
|
|
2833
|
+
b({ type: String, attribute: "oauth-layout" })
|
|
2834
|
+
], $.prototype, "oauthLayout", 2);
|
|
2835
|
+
k([
|
|
2836
|
+
b({ type: String })
|
|
2837
|
+
], $.prototype, "preview", 2);
|
|
2838
|
+
$ = k([
|
|
2839
|
+
z("authui-config")
|
|
2840
|
+
], $);
|
|
2841
|
+
var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, it = (e, t, i, s) => {
|
|
2842
|
+
for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
2843
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2844
|
+
return s && a && Gt(t, i, a), a;
|
|
2756
2845
|
};
|
|
2757
|
-
const
|
|
2758
|
-
let
|
|
2759
|
-
function
|
|
2760
|
-
if (!(typeof document > "u" ||
|
|
2761
|
-
|
|
2846
|
+
const kt = "authui-show:not([ready]){display:none}", ve = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
|
|
2847
|
+
let Ct = !1;
|
|
2848
|
+
function Zt() {
|
|
2849
|
+
if (!(typeof document > "u" || Ct)) {
|
|
2850
|
+
Ct = !0;
|
|
2762
2851
|
try {
|
|
2763
2852
|
if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
|
|
2764
2853
|
const e = new CSSStyleSheet();
|
|
2765
|
-
e.replaceSync(
|
|
2854
|
+
e.replaceSync(kt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
|
|
2766
2855
|
return;
|
|
2767
2856
|
}
|
|
2768
2857
|
} catch {
|
|
2769
2858
|
}
|
|
2770
2859
|
if (!document.getElementById("authui-fouc")) {
|
|
2771
2860
|
const e = document.createElement("style");
|
|
2772
|
-
e.id = "authui-fouc", e.textContent =
|
|
2861
|
+
e.id = "authui-fouc", e.textContent = kt, document.head.appendChild(e);
|
|
2773
2862
|
}
|
|
2774
2863
|
}
|
|
2775
2864
|
}
|
|
2776
|
-
|
|
2777
|
-
const
|
|
2778
|
-
function
|
|
2779
|
-
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) =>
|
|
2865
|
+
Zt();
|
|
2866
|
+
const Xt = ["loading", "signed-out", "signed-in", "mfa-required"];
|
|
2867
|
+
function ot(e) {
|
|
2868
|
+
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Xt.includes(t)) : [];
|
|
2780
2869
|
}
|
|
2781
|
-
function
|
|
2782
|
-
const s =
|
|
2870
|
+
function Qt(e, t, i) {
|
|
2871
|
+
const s = ot(t), a = ot(i);
|
|
2783
2872
|
return !(e === "loading" && !s.includes("loading") || s.length > 0 && !s.includes(e) || a.includes(e));
|
|
2784
2873
|
}
|
|
2785
|
-
let
|
|
2874
|
+
let G = class extends dt {
|
|
2786
2875
|
constructor() {
|
|
2787
2876
|
super(...arguments), this.when = "", this.unless = "", this.status = l.getState().status, this.unsubscribe = null;
|
|
2788
2877
|
}
|
|
@@ -2794,28 +2883,28 @@ let W = class extends ot {
|
|
|
2794
2883
|
}
|
|
2795
2884
|
/** Whether the current status satisfies `when` and `unless`. */
|
|
2796
2885
|
get visible() {
|
|
2797
|
-
return
|
|
2886
|
+
return Qt(this.status, this.when, this.unless);
|
|
2798
2887
|
}
|
|
2799
2888
|
updated() {
|
|
2800
|
-
(this.status !== "loading" ||
|
|
2889
|
+
(this.status !== "loading" || ot(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
|
|
2801
2890
|
}
|
|
2802
2891
|
render() {
|
|
2803
2892
|
return this.visible ? r`<slot></slot>` : n;
|
|
2804
2893
|
}
|
|
2805
2894
|
};
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
],
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
],
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
],
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
],
|
|
2818
|
-
const
|
|
2895
|
+
it([
|
|
2896
|
+
b({ type: String })
|
|
2897
|
+
], G.prototype, "when", 2);
|
|
2898
|
+
it([
|
|
2899
|
+
b({ type: String })
|
|
2900
|
+
], G.prototype, "unless", 2);
|
|
2901
|
+
it([
|
|
2902
|
+
h()
|
|
2903
|
+
], G.prototype, "status", 2);
|
|
2904
|
+
G = it([
|
|
2905
|
+
z("authui-show")
|
|
2906
|
+
], G);
|
|
2907
|
+
const Jt = D`
|
|
2819
2908
|
:host {
|
|
2820
2909
|
display: block;
|
|
2821
2910
|
width: 100%;
|
|
@@ -2869,7 +2958,7 @@ const Kt = T`
|
|
|
2869
2958
|
height: 14px;
|
|
2870
2959
|
margin: 0;
|
|
2871
2960
|
}
|
|
2872
|
-
`,
|
|
2961
|
+
`, w = (e) => r`<svg
|
|
2873
2962
|
xmlns="http://www.w3.org/2000/svg"
|
|
2874
2963
|
viewBox="0 0 24 24"
|
|
2875
2964
|
fill="none"
|
|
@@ -2881,88 +2970,88 @@ const Kt = T`
|
|
|
2881
2970
|
>
|
|
2882
2971
|
${e}
|
|
2883
2972
|
</svg>`, o = {
|
|
2884
|
-
mail:
|
|
2973
|
+
mail: w(
|
|
2885
2974
|
u`<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"/>`
|
|
2886
2975
|
),
|
|
2887
|
-
phone:
|
|
2976
|
+
phone: w(
|
|
2888
2977
|
u`<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"/>`
|
|
2889
2978
|
),
|
|
2890
|
-
user:
|
|
2979
|
+
user: w(
|
|
2891
2980
|
u`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
|
|
2892
2981
|
),
|
|
2893
|
-
userX:
|
|
2982
|
+
userX: w(
|
|
2894
2983
|
u`<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"/>`
|
|
2895
2984
|
),
|
|
2896
|
-
lock:
|
|
2985
|
+
lock: w(
|
|
2897
2986
|
u`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
|
|
2898
2987
|
),
|
|
2899
|
-
key:
|
|
2988
|
+
key: w(
|
|
2900
2989
|
u`<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"/>`
|
|
2901
2990
|
),
|
|
2902
|
-
shield:
|
|
2991
|
+
shield: w(
|
|
2903
2992
|
u`<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"/>`
|
|
2904
2993
|
),
|
|
2905
|
-
shieldCheck:
|
|
2994
|
+
shieldCheck: w(
|
|
2906
2995
|
u`<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"/>`
|
|
2907
2996
|
),
|
|
2908
|
-
smartphone:
|
|
2997
|
+
smartphone: w(
|
|
2909
2998
|
u`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
|
|
2910
2999
|
),
|
|
2911
|
-
monitor:
|
|
3000
|
+
monitor: w(
|
|
2912
3001
|
u`<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"/>`
|
|
2913
3002
|
),
|
|
2914
|
-
globe:
|
|
3003
|
+
globe: w(
|
|
2915
3004
|
u`<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"/>`
|
|
2916
3005
|
),
|
|
2917
|
-
logOut:
|
|
3006
|
+
logOut: w(
|
|
2918
3007
|
u`<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"/>`
|
|
2919
3008
|
),
|
|
2920
|
-
settings:
|
|
3009
|
+
settings: w(
|
|
2921
3010
|
u`<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"/>`
|
|
2922
3011
|
),
|
|
2923
|
-
x:
|
|
2924
|
-
check:
|
|
2925
|
-
users:
|
|
3012
|
+
x: w(u`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
|
|
3013
|
+
check: w(u`<path d="M20 6 9 17l-5-5"/>`),
|
|
3014
|
+
users: w(
|
|
2926
3015
|
u`<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"/>`
|
|
2927
3016
|
),
|
|
2928
|
-
copy:
|
|
3017
|
+
copy: w(
|
|
2929
3018
|
u`<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"/>`
|
|
2930
3019
|
),
|
|
2931
|
-
eye:
|
|
3020
|
+
eye: w(
|
|
2932
3021
|
u`<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"/>`
|
|
2933
3022
|
),
|
|
2934
|
-
eyeOff:
|
|
3023
|
+
eyeOff: w(
|
|
2935
3024
|
u`<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"/>`
|
|
2936
3025
|
),
|
|
2937
|
-
arrowLeft:
|
|
2938
|
-
alert:
|
|
3026
|
+
arrowLeft: w(u`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
|
|
3027
|
+
alert: w(
|
|
2939
3028
|
u`<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"/>`
|
|
2940
3029
|
),
|
|
2941
|
-
info:
|
|
2942
|
-
checkCircle:
|
|
2943
|
-
link:
|
|
3030
|
+
info: w(u`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
|
|
3031
|
+
checkCircle: w(u`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
|
|
3032
|
+
link: w(
|
|
2944
3033
|
u`<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"/>`
|
|
2945
3034
|
),
|
|
2946
|
-
activity:
|
|
3035
|
+
activity: w(
|
|
2947
3036
|
u`<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"/>`
|
|
2948
3037
|
),
|
|
2949
|
-
trash:
|
|
3038
|
+
trash: w(
|
|
2950
3039
|
u`<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"/>`
|
|
2951
3040
|
),
|
|
2952
|
-
sparkles:
|
|
3041
|
+
sparkles: w(
|
|
2953
3042
|
u`<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"/>`
|
|
2954
3043
|
),
|
|
2955
|
-
refresh:
|
|
3044
|
+
refresh: w(
|
|
2956
3045
|
u`<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"/>`
|
|
2957
3046
|
),
|
|
2958
|
-
chevronDown:
|
|
2959
|
-
ghost:
|
|
3047
|
+
chevronDown: w(u`<path d="m6 9 6 6 6-6"/>`),
|
|
3048
|
+
ghost: w(
|
|
2960
3049
|
u`<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"/>`
|
|
2961
3050
|
),
|
|
2962
|
-
qr:
|
|
3051
|
+
qr: w(
|
|
2963
3052
|
u`<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"/>`
|
|
2964
3053
|
)
|
|
2965
|
-
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`,
|
|
3054
|
+
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, te = {
|
|
2966
3055
|
google: S(
|
|
2967
3056
|
u`<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"/>`
|
|
2968
3057
|
),
|
|
@@ -3019,21 +3108,21 @@ const Kt = T`
|
|
|
3019
3108
|
)
|
|
3020
3109
|
};
|
|
3021
3110
|
function j(e) {
|
|
3022
|
-
return
|
|
3111
|
+
return te[e] ?? o.globe;
|
|
3023
3112
|
}
|
|
3024
|
-
function
|
|
3113
|
+
function ut(e) {
|
|
3025
3114
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
3026
3115
|
return /[A-Z0-9]/i.test(t) ? t : o.user;
|
|
3027
3116
|
}
|
|
3028
|
-
function
|
|
3117
|
+
function et(e) {
|
|
3029
3118
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
3030
3119
|
window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
|
|
3031
3120
|
}));
|
|
3032
3121
|
}
|
|
3033
|
-
function
|
|
3122
|
+
function be() {
|
|
3034
3123
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
|
|
3035
3124
|
}
|
|
3036
|
-
function
|
|
3125
|
+
function lt(e) {
|
|
3037
3126
|
const t = {
|
|
3038
3127
|
length: e.length >= 8,
|
|
3039
3128
|
long: e.length >= 12,
|
|
@@ -3049,25 +3138,87 @@ function at(e) {
|
|
|
3049
3138
|
let s, a;
|
|
3050
3139
|
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 };
|
|
3051
3140
|
}
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3141
|
+
function St(e, t) {
|
|
3142
|
+
return e.replace(/\D/g, "").slice(0, t);
|
|
3143
|
+
}
|
|
3144
|
+
function Q(e) {
|
|
3145
|
+
const t = e.length ?? 6, i = St(e.value, t), s = Math.ceil(t / 2), a = Math.min(i.length, t - 1), c = (p) => {
|
|
3146
|
+
const P = p.target, W = St(P.value, t);
|
|
3147
|
+
P.value = W, e.onChange(W);
|
|
3148
|
+
}, d = (p) => {
|
|
3149
|
+
p.ctrlKey || p.metaKey || p.altKey || p.key === "Backspace" || p.key === "Delete" || p.key === "Tab" || p.key === "Enter" || p.key === "Escape" || p.key === "ArrowLeft" || p.key === "ArrowRight" || p.key === "Home" || p.key === "End" || p.key.length === 1 && !/[0-9]/.test(p.key) && p.preventDefault();
|
|
3150
|
+
}, m = (p) => {
|
|
3151
|
+
const P = i[p] ?? "", W = !e.disabled && p === a;
|
|
3152
|
+
return r`<div
|
|
3153
|
+
class="otp-slot ${P ? "otp-slot-filled" : ""} ${W ? "otp-slot-active" : ""}"
|
|
3154
|
+
aria-hidden="true"
|
|
3155
|
+
>
|
|
3156
|
+
${P}
|
|
3157
|
+
</div>`;
|
|
3158
|
+
}, v = (p, P) => r`<div class="otp-group">
|
|
3159
|
+
${Array.from({ length: P - p }, (W, Ut) => m(p + Ut))}
|
|
3160
|
+
</div>`;
|
|
3161
|
+
return r`
|
|
3162
|
+
<div
|
|
3163
|
+
class="otp ${e.invalid ? "otp-invalid" : ""} ${e.disabled ? "otp-disabled" : ""}"
|
|
3164
|
+
data-otp
|
|
3165
|
+
>
|
|
3166
|
+
${v(0, s)}
|
|
3167
|
+
<div class="otp-sep" aria-hidden="true"><span></span></div>
|
|
3168
|
+
${v(s, t)}
|
|
3169
|
+
<input
|
|
3170
|
+
class="otp-native"
|
|
3171
|
+
id=${e.id}
|
|
3172
|
+
type="text"
|
|
3173
|
+
inputmode="numeric"
|
|
3174
|
+
autocomplete=${e.autocomplete ?? "one-time-code"}
|
|
3175
|
+
maxlength=${t}
|
|
3176
|
+
minlength=${t}
|
|
3177
|
+
pattern="[0-9]{${t}}"
|
|
3178
|
+
?required=${e.required !== !1}
|
|
3179
|
+
?disabled=${e.disabled}
|
|
3180
|
+
.value=${i}
|
|
3181
|
+
@input=${c}
|
|
3182
|
+
@keydown=${d}
|
|
3183
|
+
aria-invalid=${e.invalid ? "true" : n}
|
|
3184
|
+
aria-describedby=${e.describedBy ? e.describedBy : n}
|
|
3185
|
+
aria-label=${e.ariaLabel ? e.ariaLabel : n}
|
|
3186
|
+
/>
|
|
3187
|
+
</div>
|
|
3188
|
+
`;
|
|
3189
|
+
}
|
|
3190
|
+
const ee = ["totp", "email", "phone", "recoverycode"];
|
|
3191
|
+
function It(e) {
|
|
3192
|
+
const t = {
|
|
3193
|
+
totp: !!e.totp,
|
|
3194
|
+
email: !!e.email,
|
|
3195
|
+
phone: !!e.phone,
|
|
3196
|
+
recoverycode: !!e.recoveryCode
|
|
3197
|
+
};
|
|
3198
|
+
return ee.filter((i) => t[i]);
|
|
3199
|
+
}
|
|
3200
|
+
function ie(e) {
|
|
3201
|
+
return It(e)[0] ?? null;
|
|
3202
|
+
}
|
|
3203
|
+
var se = Object.defineProperty, re = Object.getOwnPropertyDescriptor, C = (e, t, i, s) => {
|
|
3204
|
+
for (var a = s > 1 ? void 0 : s ? re(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
3205
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3206
|
+
return s && a && se(t, i, a), a;
|
|
3056
3207
|
};
|
|
3057
|
-
const
|
|
3058
|
-
let
|
|
3208
|
+
const T = "authui-error";
|
|
3209
|
+
let x = class extends M {
|
|
3059
3210
|
constructor() {
|
|
3060
|
-
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.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3211
|
+
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.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.mfaAutoStarted = !1, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3061
3212
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3062
|
-
await l.signInWithEmailPassword(this.email, this.password), this.password = "",
|
|
3213
|
+
await l.signInWithEmailPassword(this.email, this.password), this.password = "", V("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
3063
3214
|
});
|
|
3064
3215
|
}, this.onSignUp = (e) => {
|
|
3065
3216
|
e.preventDefault(), this.requireValid(e) && (this.legalErrorFromOAuth = !1, this.ensureLegalAccepted() && this.run(async () => {
|
|
3066
|
-
await l.signUp(this.email, this.password, this.name), this.password = "",
|
|
3217
|
+
await l.signUp(this.email, this.password, this.name), this.password = "", V("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
3067
3218
|
}));
|
|
3068
3219
|
}, this.onGuest = () => {
|
|
3069
3220
|
this.run(async () => {
|
|
3070
|
-
await l.signInAnonymously(),
|
|
3221
|
+
await l.signInAnonymously(), V("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
3071
3222
|
});
|
|
3072
3223
|
}, this.onOAuth = (e) => {
|
|
3073
3224
|
if (this.step === "sign-up" && !this.ensureLegalAccepted()) {
|
|
@@ -3075,8 +3226,8 @@ let $ = class extends E {
|
|
|
3075
3226
|
return;
|
|
3076
3227
|
}
|
|
3077
3228
|
this.legalErrorFromOAuth = !1, this.run(async () => {
|
|
3078
|
-
if (
|
|
3079
|
-
|
|
3229
|
+
if (_t(e), await l.signInWithOAuth(e), l.isPreview) {
|
|
3230
|
+
At(), this.fire("authui-success", { method: "oauth" });
|
|
3080
3231
|
return;
|
|
3081
3232
|
}
|
|
3082
3233
|
await new Promise((t) => setTimeout(t, 4e3));
|
|
@@ -3124,7 +3275,7 @@ let $ = class extends E {
|
|
|
3124
3275
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3125
3276
|
const t = this.token;
|
|
3126
3277
|
t && this.run(async () => {
|
|
3127
|
-
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null,
|
|
3278
|
+
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null, V(t.kind), this.fire("authui-success", { method: t.kind });
|
|
3128
3279
|
}, "code");
|
|
3129
3280
|
}, this.onChooseFactor = (e) => {
|
|
3130
3281
|
this.run(async () => {
|
|
@@ -3142,7 +3293,7 @@ let $ = class extends E {
|
|
|
3142
3293
|
try {
|
|
3143
3294
|
await l.signOut();
|
|
3144
3295
|
} catch (e) {
|
|
3145
|
-
if (!
|
|
3296
|
+
if (!K(e, y.sessionNotFound)) throw e;
|
|
3146
3297
|
}
|
|
3147
3298
|
this.go("sign-in");
|
|
3148
3299
|
});
|
|
@@ -3157,24 +3308,34 @@ let $ = class extends E {
|
|
|
3157
3308
|
e.has("view") && e.get("view") !== void 0 && this.go(this.view), e.has("auth") && this.syncFromStore();
|
|
3158
3309
|
}
|
|
3159
3310
|
updated(e) {
|
|
3160
|
-
e.has("step") && (this.focusOnStep || this.embedded) && (this.focusOnStep = !1, requestAnimationFrame(() => this.firstInput?.focus()));
|
|
3311
|
+
e.has("step") && (this.focusOnStep || this.embedded) && (this.focusOnStep = !1, requestAnimationFrame(() => this.firstInput?.focus())), this.maybeAutoStartMfa();
|
|
3312
|
+
}
|
|
3313
|
+
/** Vibes-style: pick a default factor once and create its challenge. */
|
|
3314
|
+
maybeAutoStartMfa() {
|
|
3315
|
+
if (this.step !== "mfa" || this.challenge || this.mfaAutoStarted || this.busy) return;
|
|
3316
|
+
const e = this.auth.mfaFactors;
|
|
3317
|
+
if (!e) return;
|
|
3318
|
+
const t = ie(e);
|
|
3319
|
+
t && (this.mfaAutoStarted = !0, queueMicrotask(() => {
|
|
3320
|
+
!this.challenge && this.step === "mfa" && this.onChooseFactor(t);
|
|
3321
|
+
}));
|
|
3161
3322
|
}
|
|
3162
3323
|
/** React to store transitions: MFA pending, redirect results, sign in. */
|
|
3163
3324
|
syncFromStore() {
|
|
3164
3325
|
const { status: e, pending: t } = this.auth;
|
|
3165
3326
|
e === "mfa-required" && this.step !== "mfa" && this.go("mfa");
|
|
3166
3327
|
const i = this.step === "reset-password" || t?.type === "reset-password" || this.recovery !== null;
|
|
3167
|
-
(e === "signed-in" || e === "signed-out") && !i && (this.step === "mfa" || this.step === "phone" || this.step === "email-otp" || this.step === "magic-url" || this.step === "forgot-password" || this.token !== null || this.challenge !== null || e === "signed-out") && (this.token = null, this.challenge = null, this.code = "", this.password = "", this.notice = null, this.go(this.view === "sign-up" ? "sign-up" : "sign-in")), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }), t?.type === "notice" && !this.notice && (this.notice = {
|
|
3328
|
+
(e === "signed-in" || e === "signed-out") && !i && (this.step === "mfa" || this.step === "phone" || this.step === "email-otp" || this.step === "magic-url" || this.step === "forgot-password" || this.token !== null || this.challenge !== null || e === "signed-out") && (this.token = null, this.challenge = null, this.code = "", this.password = "", this.notice = null, this.go(this.view === "sign-up" ? "sign-up" : "sign-in")), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }), t?.type === "notice" && !this.notice && (this.auth.configError && t.message === this.auth.configError || (this.notice = {
|
|
3168
3329
|
tone: t.tone === "error" ? "error" : t.tone,
|
|
3169
3330
|
message: t.message
|
|
3170
|
-
});
|
|
3331
|
+
}));
|
|
3171
3332
|
}
|
|
3172
3333
|
/** Navigate between screens and reset transient state. */
|
|
3173
3334
|
dismissNotice() {
|
|
3174
3335
|
this.notice = null, this.auth.pending?.type === "notice" && l.setPending(null);
|
|
3175
3336
|
}
|
|
3176
3337
|
go(e) {
|
|
3177
|
-
e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.showPasswordConfirm = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
|
|
3338
|
+
e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.showPasswordConfirm = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, e !== "mfa" && (this.challenge = null, this.mfaAutoStarted = !1), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
|
|
3178
3339
|
}
|
|
3179
3340
|
// ───────────────────────────── actions ─────────────────────────────
|
|
3180
3341
|
async run(e, t = "link") {
|
|
@@ -3183,7 +3344,7 @@ let $ = class extends E {
|
|
|
3183
3344
|
try {
|
|
3184
3345
|
await e();
|
|
3185
3346
|
} catch (i) {
|
|
3186
|
-
this.error =
|
|
3347
|
+
this.error = J(i, this.strings, t);
|
|
3187
3348
|
} finally {
|
|
3188
3349
|
this.busy = !1;
|
|
3189
3350
|
}
|
|
@@ -3205,7 +3366,7 @@ let $ = class extends E {
|
|
|
3205
3366
|
return r`
|
|
3206
3367
|
<div class="panel ${this.embedded ? "embedded" : ""}" part="panel">
|
|
3207
3368
|
${this.renderHeader()}
|
|
3208
|
-
${this.notice ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
3369
|
+
${this.notice && !(this.auth.configError && this.notice.message === this.auth.configError) ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
3209
3370
|
${this.notice.tone === "success" ? o.checkCircle : this.notice.tone === "error" ? o.alert : o.info}
|
|
3210
3371
|
<div class="alert-body">${this.notice.message}</div>
|
|
3211
3372
|
<button
|
|
@@ -3265,7 +3426,7 @@ let $ = class extends E {
|
|
|
3265
3426
|
`;
|
|
3266
3427
|
}
|
|
3267
3428
|
renderError() {
|
|
3268
|
-
return this.error ? r`<div class="alert alert-error" role="alert" id=${
|
|
3429
|
+
return this.error ? r`<div class="alert alert-error" role="alert" id=${T}>
|
|
3269
3430
|
${o.alert}
|
|
3270
3431
|
<div class="alert-body">${this.error}</div>
|
|
3271
3432
|
</div>` : n;
|
|
@@ -3276,7 +3437,7 @@ let $ = class extends E {
|
|
|
3276
3437
|
</button>`;
|
|
3277
3438
|
}
|
|
3278
3439
|
passwordField(e) {
|
|
3279
|
-
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ?
|
|
3440
|
+
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ? lt(t) : null;
|
|
3280
3441
|
return r`
|
|
3281
3442
|
<div class="field${e.forgot ? " field-with-forgot" : ""}">
|
|
3282
3443
|
<label class="label" for=${e.id}>${e.label}</label>
|
|
@@ -3291,7 +3452,7 @@ let $ = class extends E {
|
|
|
3291
3452
|
.value=${t}
|
|
3292
3453
|
@input=${this.bind(e.field)}
|
|
3293
3454
|
aria-invalid=${this.error ? "true" : n}
|
|
3294
|
-
aria-describedby=${this.error ?
|
|
3455
|
+
aria-describedby=${this.error ? T : n}
|
|
3295
3456
|
/>
|
|
3296
3457
|
<button
|
|
3297
3458
|
type="button"
|
|
@@ -3343,7 +3504,7 @@ let $ = class extends E {
|
|
|
3343
3504
|
.value=${this.email}
|
|
3344
3505
|
@input=${this.bind("email")}
|
|
3345
3506
|
aria-invalid=${this.error ? "true" : n}
|
|
3346
|
-
aria-describedby=${this.error ?
|
|
3507
|
+
aria-describedby=${this.error ? T : n}
|
|
3347
3508
|
/>
|
|
3348
3509
|
</div>
|
|
3349
3510
|
`;
|
|
@@ -3352,20 +3513,16 @@ let $ = class extends E {
|
|
|
3352
3513
|
return r`
|
|
3353
3514
|
<div class="field">
|
|
3354
3515
|
<label class="label" for="authui-code">${this.t("code")}</label>
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
@input=${this.bind("code")}
|
|
3366
|
-
aria-invalid=${this.error ? "true" : n}
|
|
3367
|
-
aria-describedby=${this.error ? R : n}
|
|
3368
|
-
/>
|
|
3516
|
+
${Q({
|
|
3517
|
+
id: "authui-code",
|
|
3518
|
+
value: this.code,
|
|
3519
|
+
invalid: !!this.error,
|
|
3520
|
+
describedBy: this.error ? T : null,
|
|
3521
|
+
disabled: this.busy,
|
|
3522
|
+
onChange: (e) => {
|
|
3523
|
+
this.code = e, this.requestUpdate();
|
|
3524
|
+
}
|
|
3525
|
+
})}
|
|
3369
3526
|
</div>
|
|
3370
3527
|
`;
|
|
3371
3528
|
}
|
|
@@ -3395,7 +3552,7 @@ let $ = class extends E {
|
|
|
3395
3552
|
type="checkbox"
|
|
3396
3553
|
.checked=${this.legalAccepted}
|
|
3397
3554
|
aria-invalid=${e ? "true" : n}
|
|
3398
|
-
aria-describedby=${e ?
|
|
3555
|
+
aria-describedby=${e ? T : n}
|
|
3399
3556
|
@change=${(t) => {
|
|
3400
3557
|
this.legalAccepted = t.target.checked, this.legalAccepted && this.error === this.t("errorLegalRequired") && (this.error = "", this.legalErrorFromOAuth = !1);
|
|
3401
3558
|
}}
|
|
@@ -3449,7 +3606,7 @@ let $ = class extends E {
|
|
|
3449
3606
|
<div class="stack">
|
|
3450
3607
|
<div class="row">
|
|
3451
3608
|
<div class="inline">
|
|
3452
|
-
<span class="avatar">${
|
|
3609
|
+
<span class="avatar">${ut(t)}</span>
|
|
3453
3610
|
<div class="row-main">
|
|
3454
3611
|
<span class="row-title" title=${t}>${t}</span>
|
|
3455
3612
|
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
|
|
@@ -3464,7 +3621,7 @@ let $ = class extends E {
|
|
|
3464
3621
|
<button
|
|
3465
3622
|
class="btn btn-outline btn-block"
|
|
3466
3623
|
@click=${() => {
|
|
3467
|
-
this.embedded ? this.fire("authui-open", { view: "account" }) :
|
|
3624
|
+
this.embedded ? this.fire("authui-open", { view: "account" }) : et("account");
|
|
3468
3625
|
}}
|
|
3469
3626
|
>
|
|
3470
3627
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -3479,56 +3636,56 @@ let $ = class extends E {
|
|
|
3479
3636
|
renderProviders() {
|
|
3480
3637
|
const e = [...this.config?.methods?.oauth ?? []];
|
|
3481
3638
|
if (e.length === 0) return n;
|
|
3482
|
-
const t =
|
|
3639
|
+
const t = q(), i = e.find((d) => t === `oauth:${d}`) ?? null, s = this.config?.methods?.oauthLayout, a = s === "horizontal" || s === "icon" ? "icon" : s === "stack" || s === "accordion" ? s : e.length <= 2 ? "stack" : "accordion";
|
|
3483
3640
|
if (a === "icon") {
|
|
3484
|
-
const d = [...e].sort((
|
|
3485
|
-
const
|
|
3486
|
-
return
|
|
3641
|
+
const d = [...e].sort((m, v) => {
|
|
3642
|
+
const p = t === `oauth:${m}` ? 0 : 1, P = t === `oauth:${v}` ? 0 : 1;
|
|
3643
|
+
return p - P;
|
|
3487
3644
|
});
|
|
3488
3645
|
return r`
|
|
3489
3646
|
<div class="providers icon">
|
|
3490
|
-
${d.map((
|
|
3491
|
-
const
|
|
3647
|
+
${d.map((m) => {
|
|
3648
|
+
const v = t === `oauth:${m}`, p = this.t("continueWith", { provider: N(m) });
|
|
3492
3649
|
return r`<button
|
|
3493
3650
|
type="button"
|
|
3494
|
-
class="btn btn-outline ${
|
|
3495
|
-
@click=${() => this.onOAuth(
|
|
3651
|
+
class="btn btn-outline ${v ? "last-used" : ""}"
|
|
3652
|
+
@click=${() => this.onOAuth(m)}
|
|
3496
3653
|
?disabled=${this.busy}
|
|
3497
|
-
aria-label=${
|
|
3498
|
-
title=${
|
|
3654
|
+
aria-label=${v ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3655
|
+
title=${p}
|
|
3499
3656
|
>
|
|
3500
|
-
${j(
|
|
3501
|
-
${
|
|
3657
|
+
${j(m)}
|
|
3658
|
+
${v ? r`<span class="oauth-last-used-dot" aria-hidden="true"></span>` : n}
|
|
3502
3659
|
</button>`;
|
|
3503
3660
|
})}
|
|
3504
3661
|
</div>
|
|
3505
3662
|
`;
|
|
3506
3663
|
}
|
|
3507
3664
|
if (a === "stack") {
|
|
3508
|
-
const d = [...e].sort((
|
|
3509
|
-
const
|
|
3510
|
-
return
|
|
3665
|
+
const d = [...e].sort((m, v) => {
|
|
3666
|
+
const p = t === `oauth:${m}` ? 0 : 1, P = t === `oauth:${v}` ? 0 : 1;
|
|
3667
|
+
return p - P;
|
|
3511
3668
|
});
|
|
3512
3669
|
return r`
|
|
3513
3670
|
<div class="providers">
|
|
3514
|
-
${d.map((
|
|
3515
|
-
const
|
|
3671
|
+
${d.map((m) => {
|
|
3672
|
+
const v = t === `oauth:${m}`, p = this.t("continueWith", { provider: N(m) });
|
|
3516
3673
|
return r`<button
|
|
3517
3674
|
type="button"
|
|
3518
|
-
class="btn btn-outline ${
|
|
3519
|
-
@click=${() => this.onOAuth(
|
|
3675
|
+
class="btn btn-outline ${v ? "last-used" : ""}"
|
|
3676
|
+
@click=${() => this.onOAuth(m)}
|
|
3520
3677
|
?disabled=${this.busy}
|
|
3521
|
-
aria-label=${
|
|
3678
|
+
aria-label=${v ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3522
3679
|
>
|
|
3523
|
-
${j(
|
|
3524
|
-
<span>${
|
|
3525
|
-
${
|
|
3680
|
+
${j(m)}
|
|
3681
|
+
<span>${p}</span>
|
|
3682
|
+
${v ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3526
3683
|
</button>`;
|
|
3527
3684
|
})}
|
|
3528
3685
|
</div>
|
|
3529
3686
|
`;
|
|
3530
3687
|
}
|
|
3531
|
-
const
|
|
3688
|
+
const c = this.expandedOAuth && e.includes(this.expandedOAuth) ? this.expandedOAuth : i ?? e[0];
|
|
3532
3689
|
return r`
|
|
3533
3690
|
<div
|
|
3534
3691
|
class="providers accordion"
|
|
@@ -3537,9 +3694,9 @@ let $ = class extends E {
|
|
|
3537
3694
|
}}
|
|
3538
3695
|
>
|
|
3539
3696
|
${e.map((d) => {
|
|
3540
|
-
const
|
|
3697
|
+
const m = t === `oauth:${d}`, v = c === d, p = this.t("continueWith", { provider: N(d) });
|
|
3541
3698
|
return r`<div
|
|
3542
|
-
class="provider-slot ${
|
|
3699
|
+
class="provider-slot ${v ? "is-expanded" : ""}"
|
|
3543
3700
|
@mouseenter=${() => {
|
|
3544
3701
|
this.expandedOAuth = d;
|
|
3545
3702
|
}}
|
|
@@ -3552,13 +3709,13 @@ let $ = class extends E {
|
|
|
3552
3709
|
this.expandedOAuth = d;
|
|
3553
3710
|
}}
|
|
3554
3711
|
?disabled=${this.busy}
|
|
3555
|
-
aria-label=${
|
|
3712
|
+
aria-label=${m ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3556
3713
|
>
|
|
3557
3714
|
${j(d)}
|
|
3558
3715
|
<span class="provider-label"
|
|
3559
|
-
><span><span class="provider-label-text">${
|
|
3716
|
+
><span><span class="provider-label-text">${p}</span></span></span
|
|
3560
3717
|
>
|
|
3561
|
-
${
|
|
3718
|
+
${m ? r`<span class="oauth-last-used" data-last-used=${d} aria-hidden="true">
|
|
3562
3719
|
<span class="oauth-last-used-dot"></span>
|
|
3563
3720
|
<span class="oauth-last-used-pill">${this.t("lastUsed")}</span>
|
|
3564
3721
|
</span>` : n}
|
|
@@ -3579,11 +3736,11 @@ let $ = class extends E {
|
|
|
3579
3736
|
${this.renderProviders()}
|
|
3580
3737
|
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : n}
|
|
3581
3738
|
${t ? r`<form
|
|
3582
|
-
class="form ${
|
|
3739
|
+
class="form ${q() === "email-password" ? "last-used-form" : ""}"
|
|
3583
3740
|
@submit=${this.onSignIn}
|
|
3584
3741
|
novalidate
|
|
3585
3742
|
>
|
|
3586
|
-
${
|
|
3743
|
+
${q() === "email-password" ? r`<p class="hint">
|
|
3587
3744
|
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
3588
3745
|
</p>` : n}
|
|
3589
3746
|
${this.emailField()}
|
|
@@ -3592,26 +3749,26 @@ let $ = class extends E {
|
|
|
3592
3749
|
</form>` : this.renderError()}
|
|
3593
3750
|
${s.length > 0 ? r`<div class="stack-sm">
|
|
3594
3751
|
${s.map((a) => {
|
|
3595
|
-
const
|
|
3752
|
+
const c = q() === a.step;
|
|
3596
3753
|
return r`<button
|
|
3597
3754
|
type="button"
|
|
3598
|
-
class="btn btn-secondary btn-block ${
|
|
3755
|
+
class="btn btn-secondary btn-block ${c ? "last-used" : ""}"
|
|
3599
3756
|
@click=${() => this.go(a.step)}
|
|
3600
3757
|
?disabled=${this.busy}
|
|
3601
3758
|
>
|
|
3602
3759
|
${a.icon} ${a.label}
|
|
3603
|
-
${
|
|
3760
|
+
${c ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3604
3761
|
</button>`;
|
|
3605
3762
|
})}
|
|
3606
3763
|
</div>` : n}
|
|
3607
3764
|
${e.anonymous ? r`<button
|
|
3608
3765
|
type="button"
|
|
3609
|
-
class="btn btn-ghost btn-block ${
|
|
3766
|
+
class="btn btn-ghost btn-block ${q() === "anonymous" ? "last-used" : ""}"
|
|
3610
3767
|
@click=${this.onGuest}
|
|
3611
3768
|
?disabled=${this.busy}
|
|
3612
3769
|
>
|
|
3613
3770
|
${o.ghost} ${this.t("continueAsGuest")}
|
|
3614
|
-
${
|
|
3771
|
+
${q() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3615
3772
|
</button>` : n}
|
|
3616
3773
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
3617
3774
|
<span>${this.t("noAccount")}</span>
|
|
@@ -3641,7 +3798,7 @@ let $ = class extends E {
|
|
|
3641
3798
|
.value=${this.name}
|
|
3642
3799
|
@input=${this.bind("name")}
|
|
3643
3800
|
aria-invalid=${this.error ? "true" : n}
|
|
3644
|
-
aria-describedby=${this.error ?
|
|
3801
|
+
aria-describedby=${this.error ? T : n}
|
|
3645
3802
|
/>
|
|
3646
3803
|
</div>` : n}
|
|
3647
3804
|
${this.emailField()}
|
|
@@ -3811,7 +3968,7 @@ let $ = class extends E {
|
|
|
3811
3968
|
.value=${this.phone}
|
|
3812
3969
|
@input=${this.bind("phone")}
|
|
3813
3970
|
aria-invalid=${this.error ? "true" : n}
|
|
3814
|
-
aria-describedby=${this.error ?
|
|
3971
|
+
aria-describedby=${this.error ? T : n}
|
|
3815
3972
|
/>
|
|
3816
3973
|
</div>
|
|
3817
3974
|
${this.renderError()} ${this.submitButton(this.t("sendCode"))}
|
|
@@ -3822,45 +3979,39 @@ let $ = class extends E {
|
|
|
3822
3979
|
}
|
|
3823
3980
|
renderMfa() {
|
|
3824
3981
|
const e = this.auth.mfaFactors;
|
|
3982
|
+
if (!e)
|
|
3983
|
+
return r`
|
|
3984
|
+
<div class="stack">
|
|
3985
|
+
<div class="empty"><span class="spinner" aria-label=${this.t("loading")}></span></div>
|
|
3986
|
+
${this.renderError()}
|
|
3987
|
+
<div class="links">
|
|
3988
|
+
<button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
|
|
3989
|
+
${this.t("cancel")}
|
|
3990
|
+
</button>
|
|
3991
|
+
</div>
|
|
3992
|
+
</div>
|
|
3993
|
+
`;
|
|
3825
3994
|
if (!this.challenge) {
|
|
3826
3995
|
const i = [
|
|
3827
|
-
{
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
},
|
|
3833
|
-
{
|
|
3834
|
-
factor: "email",
|
|
3835
|
-
icon: o.mail,
|
|
3836
|
-
label: this.t("mfaUseEmail"),
|
|
3837
|
-
available: e?.email ?? !0
|
|
3838
|
-
},
|
|
3839
|
-
{
|
|
3840
|
-
factor: "phone",
|
|
3841
|
-
icon: o.phone,
|
|
3842
|
-
label: this.t("mfaUsePhone"),
|
|
3843
|
-
available: e?.phone ?? !0
|
|
3844
|
-
},
|
|
3845
|
-
{
|
|
3846
|
-
factor: "recoverycode",
|
|
3847
|
-
icon: o.key,
|
|
3848
|
-
label: this.t("mfaUseRecoveryCode"),
|
|
3849
|
-
available: e?.recoveryCode ?? !0
|
|
3850
|
-
}
|
|
3851
|
-
];
|
|
3996
|
+
{ factor: "totp", icon: o.smartphone, label: this.t("mfaUseAuthenticator") },
|
|
3997
|
+
{ factor: "email", icon: o.mail, label: this.t("mfaUseEmail") },
|
|
3998
|
+
{ factor: "phone", icon: o.phone, label: this.t("mfaUsePhone") },
|
|
3999
|
+
{ factor: "recoverycode", icon: o.key, label: this.t("mfaUseRecoveryCode") }
|
|
4000
|
+
], s = new Set(It(e)), a = i.filter((c) => s.has(c.factor));
|
|
3852
4001
|
return r`
|
|
3853
4002
|
<div class="stack">
|
|
3854
4003
|
<div class="stack-sm">
|
|
3855
|
-
${
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
4004
|
+
${a.length === 0 ? r`<div class="empty">
|
|
4005
|
+
<span class="spinner" aria-label=${this.t("loading")}></span>
|
|
4006
|
+
</div>` : a.map(
|
|
4007
|
+
(c) => r`<button
|
|
4008
|
+
type="button"
|
|
4009
|
+
class="choice"
|
|
4010
|
+
@click=${() => this.onChooseFactor(c.factor)}
|
|
4011
|
+
?disabled=${this.busy}
|
|
4012
|
+
>
|
|
4013
|
+
${c.icon}<span class="choice-title">${c.label}</span>
|
|
4014
|
+
</button>`
|
|
3864
4015
|
)}
|
|
3865
4016
|
</div>
|
|
3866
4017
|
${this.renderError()}
|
|
@@ -3887,7 +4038,7 @@ let $ = class extends E {
|
|
|
3887
4038
|
.value=${this.code}
|
|
3888
4039
|
@input=${this.bind("code")}
|
|
3889
4040
|
aria-invalid=${this.error ? "true" : n}
|
|
3890
|
-
aria-describedby=${this.error ?
|
|
4041
|
+
aria-describedby=${this.error ? T : n}
|
|
3891
4042
|
/>
|
|
3892
4043
|
</div>` : this.codeField()}
|
|
3893
4044
|
${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
|
|
@@ -3905,75 +4056,75 @@ let $ = class extends E {
|
|
|
3905
4056
|
`;
|
|
3906
4057
|
}
|
|
3907
4058
|
};
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
],
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
],
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
],
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
],
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
],
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
],
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
],
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
],
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
],
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
],
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
],
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
],
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
],
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
],
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
],
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
],
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
],
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
],
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
],
|
|
3966
|
-
var
|
|
3967
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3968
|
-
(d = e[
|
|
3969
|
-
return s && a &&
|
|
4059
|
+
x.styles = [...M.styles, Jt];
|
|
4060
|
+
C([
|
|
4061
|
+
b({ type: String })
|
|
4062
|
+
], x.prototype, "view", 2);
|
|
4063
|
+
C([
|
|
4064
|
+
b({ type: Boolean })
|
|
4065
|
+
], x.prototype, "embedded", 2);
|
|
4066
|
+
C([
|
|
4067
|
+
h()
|
|
4068
|
+
], x.prototype, "step", 2);
|
|
4069
|
+
C([
|
|
4070
|
+
h()
|
|
4071
|
+
], x.prototype, "busy", 2);
|
|
4072
|
+
C([
|
|
4073
|
+
h()
|
|
4074
|
+
], x.prototype, "error", 2);
|
|
4075
|
+
C([
|
|
4076
|
+
h()
|
|
4077
|
+
], x.prototype, "notice", 2);
|
|
4078
|
+
C([
|
|
4079
|
+
h()
|
|
4080
|
+
], x.prototype, "showPassword", 2);
|
|
4081
|
+
C([
|
|
4082
|
+
h()
|
|
4083
|
+
], x.prototype, "showPasswordConfirm", 2);
|
|
4084
|
+
C([
|
|
4085
|
+
h()
|
|
4086
|
+
], x.prototype, "expandedOAuth", 2);
|
|
4087
|
+
C([
|
|
4088
|
+
h()
|
|
4089
|
+
], x.prototype, "token", 2);
|
|
4090
|
+
C([
|
|
4091
|
+
h()
|
|
4092
|
+
], x.prototype, "resendCooldownUntil", 2);
|
|
4093
|
+
C([
|
|
4094
|
+
h()
|
|
4095
|
+
], x.prototype, "challenge", 2);
|
|
4096
|
+
C([
|
|
4097
|
+
h()
|
|
4098
|
+
], x.prototype, "recovery", 2);
|
|
4099
|
+
C([
|
|
4100
|
+
ct("form input:not([type=hidden])")
|
|
4101
|
+
], x.prototype, "firstInput", 2);
|
|
4102
|
+
C([
|
|
4103
|
+
h()
|
|
4104
|
+
], x.prototype, "password", 2);
|
|
4105
|
+
C([
|
|
4106
|
+
h()
|
|
4107
|
+
], x.prototype, "passwordConfirm", 2);
|
|
4108
|
+
C([
|
|
4109
|
+
h()
|
|
4110
|
+
], x.prototype, "legalAccepted", 2);
|
|
4111
|
+
C([
|
|
4112
|
+
h()
|
|
4113
|
+
], x.prototype, "legalErrorFromOAuth", 2);
|
|
4114
|
+
x = C([
|
|
4115
|
+
z("authui-sign-in")
|
|
4116
|
+
], x);
|
|
4117
|
+
var ae = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, g = (e, t, i, s) => {
|
|
4118
|
+
for (var a = s > 1 ? void 0 : s ? ne(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
4119
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
4120
|
+
return s && a && ae(t, i, a), a;
|
|
3970
4121
|
};
|
|
3971
|
-
let
|
|
4122
|
+
let f = class extends M {
|
|
3972
4123
|
constructor() {
|
|
3973
|
-
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.showOldPassword = !1, this.showNewPassword = !1, this.showNewPasswordConfirm = !1, this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.verifyPhoneCooldownUntil = 0, this.verifyPhoneCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
4124
|
+
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.showOldPassword = !1, this.showNewPassword = !1, this.showNewPasswordConfirm = !1, this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.browserIconFailed = {}, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.verifyPhoneCooldownUntil = 0, this.verifyPhoneCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
3974
4125
|
const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
|
|
3975
4126
|
if (!t.length) return;
|
|
3976
|
-
const i = t.findIndex((
|
|
4127
|
+
const i = t.findIndex((c) => c.getAttribute("aria-selected") === "true");
|
|
3977
4128
|
let s = i;
|
|
3978
4129
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") s = (i + 1) % t.length;
|
|
3979
4130
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
@@ -4074,7 +4225,7 @@ let p = class extends E {
|
|
|
4074
4225
|
try {
|
|
4075
4226
|
this.recoveryCodes = await l.createRecoveryCodes();
|
|
4076
4227
|
} catch (e) {
|
|
4077
|
-
if (!
|
|
4228
|
+
if (!K(e, y.recoveryCodesExist)) throw e;
|
|
4078
4229
|
this.recoveryCodes = await l.getRecoveryCodes();
|
|
4079
4230
|
}
|
|
4080
4231
|
await this.loadFactors();
|
|
@@ -4197,9 +4348,9 @@ let p = class extends E {
|
|
|
4197
4348
|
try {
|
|
4198
4349
|
await t(), i && this.setNotice("success", i);
|
|
4199
4350
|
} catch (s) {
|
|
4200
|
-
|
|
4351
|
+
K(s, y.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
|
|
4201
4352
|
...this.errors,
|
|
4202
|
-
[e]:
|
|
4353
|
+
[e]: J(
|
|
4203
4354
|
s,
|
|
4204
4355
|
this.strings,
|
|
4205
4356
|
e.includes("code") ? "code" : e === "password" ? "password" : "link"
|
|
@@ -4354,7 +4505,7 @@ let p = class extends E {
|
|
|
4354
4505
|
return r`
|
|
4355
4506
|
<div class="between">
|
|
4356
4507
|
<div class="identity">
|
|
4357
|
-
<span class="avatar">${
|
|
4508
|
+
<span class="avatar">${ut(t)}</span>
|
|
4358
4509
|
<div class="row-main">
|
|
4359
4510
|
<span class="row-title" title=${t}>
|
|
4360
4511
|
${t}
|
|
@@ -4479,7 +4630,7 @@ let p = class extends E {
|
|
|
4479
4630
|
autocomplete="new-password"
|
|
4480
4631
|
/>
|
|
4481
4632
|
${this.emailPassword ? (() => {
|
|
4482
|
-
const t =
|
|
4633
|
+
const t = lt(this.emailPassword);
|
|
4483
4634
|
return r`<div class="strength" aria-live="polite">
|
|
4484
4635
|
<div
|
|
4485
4636
|
class="strength-meter"
|
|
@@ -4632,20 +4783,15 @@ let p = class extends E {
|
|
|
4632
4783
|
</div>` : n}
|
|
4633
4784
|
${this.phoneCodeSent ? r`<div class="field">
|
|
4634
4785
|
<label class="label" for="acc-phone-code">${this.t("code")}</label>
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
@input=${this.bind("phoneCode")}
|
|
4645
|
-
@keydown=${(t) => {
|
|
4646
|
-
t.key === "Enter" && (t.preventDefault(), this.onConfirmPhoneVerification(t));
|
|
4647
|
-
}}
|
|
4648
|
-
/>
|
|
4786
|
+
|
|
4787
|
+
${Q({
|
|
4788
|
+
id: "acc-phone-code",
|
|
4789
|
+
value: this.phoneCode,
|
|
4790
|
+
disabled: !!this.busy,
|
|
4791
|
+
onChange: (t) => {
|
|
4792
|
+
this.phoneCode = t;
|
|
4793
|
+
}
|
|
4794
|
+
})}
|
|
4649
4795
|
</div>` : n}
|
|
4650
4796
|
${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
|
|
4651
4797
|
</form>`,
|
|
@@ -4774,7 +4920,7 @@ let p = class extends E {
|
|
|
4774
4920
|
</button>
|
|
4775
4921
|
</div>
|
|
4776
4922
|
${this.newPassword ? (() => {
|
|
4777
|
-
const i =
|
|
4923
|
+
const i = lt(this.newPassword);
|
|
4778
4924
|
return r`<div class="strength" aria-live="polite">
|
|
4779
4925
|
<div
|
|
4780
4926
|
class="strength-meter"
|
|
@@ -4833,7 +4979,7 @@ let p = class extends E {
|
|
|
4833
4979
|
</div>`;
|
|
4834
4980
|
}
|
|
4835
4981
|
renderMfaCard() {
|
|
4836
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ?
|
|
4982
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ? Dt(this.authenticator.uri) : new rt(l.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4837
4983
|
return this.card(
|
|
4838
4984
|
this.t("twoFactor"),
|
|
4839
4985
|
this.t("twoFactorDescription"),
|
|
@@ -4931,17 +5077,15 @@ let p = class extends E {
|
|
|
4931
5077
|
</div>
|
|
4932
5078
|
<div class="field">
|
|
4933
5079
|
<label class="label" for="acc-totp">${this.t("code")}</label>
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
@input=${this.bind("authenticatorCode")}
|
|
4944
|
-
/>
|
|
5080
|
+
|
|
5081
|
+
${Q({
|
|
5082
|
+
id: "acc-totp",
|
|
5083
|
+
value: this.authenticatorCode,
|
|
5084
|
+
disabled: !!this.busy,
|
|
5085
|
+
onChange: (s) => {
|
|
5086
|
+
this.authenticatorCode = s;
|
|
5087
|
+
}
|
|
5088
|
+
})}
|
|
4945
5089
|
</div>
|
|
4946
5090
|
${this.error("authenticator-code")}
|
|
4947
5091
|
<div class="inline">
|
|
@@ -5058,17 +5202,23 @@ let p = class extends E {
|
|
|
5058
5202
|
<label class="label" for="acc-stepup"
|
|
5059
5203
|
>${e.challenge.factor === "recoverycode" ? this.t("recoveryCode") : this.t("code")}</label
|
|
5060
5204
|
>
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5205
|
+
${e.challenge.factor === "recoverycode" ? r`<input
|
|
5206
|
+
class="input mono"
|
|
5207
|
+
id="acc-stepup"
|
|
5208
|
+
inputmode="text"
|
|
5209
|
+
maxlength="64"
|
|
5210
|
+
autocomplete="one-time-code"
|
|
5211
|
+
required
|
|
5212
|
+
.value=${this.stepUpCode}
|
|
5213
|
+
@input=${this.bind("stepUpCode")}
|
|
5214
|
+
/>` : Q({
|
|
5215
|
+
id: "acc-stepup",
|
|
5216
|
+
value: this.stepUpCode,
|
|
5217
|
+
disabled: !!this.busy,
|
|
5218
|
+
onChange: (s) => {
|
|
5219
|
+
this.stepUpCode = s;
|
|
5220
|
+
}
|
|
5221
|
+
})}
|
|
5072
5222
|
</div>
|
|
5073
5223
|
<button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
|
|
5074
5224
|
${this.spinner("stepup-code")} ${this.t("verifyCode")}
|
|
@@ -5093,10 +5243,53 @@ let p = class extends E {
|
|
|
5093
5243
|
);
|
|
5094
5244
|
}
|
|
5095
5245
|
// ── Sessions ──
|
|
5096
|
-
|
|
5246
|
+
formatSessionDate(e) {
|
|
5247
|
+
if (!e) return "";
|
|
5248
|
+
const t = new Date(e);
|
|
5249
|
+
return Number.isNaN(t.getTime()) ? e : t.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
5250
|
+
}
|
|
5251
|
+
browserIconUrl(e) {
|
|
5252
|
+
const t = (e.clientCode || "").trim();
|
|
5253
|
+
if (!t || t === "-") return null;
|
|
5254
|
+
const i = l.getClient();
|
|
5255
|
+
if (!i) return null;
|
|
5256
|
+
try {
|
|
5257
|
+
const s = new rt(i).getBrowser(t, 64, 64);
|
|
5258
|
+
return typeof s == "string" ? s : String(s);
|
|
5259
|
+
} catch {
|
|
5260
|
+
return null;
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
flagUrl(e) {
|
|
5264
|
+
const t = (e.countryCode || "").trim().toLowerCase();
|
|
5265
|
+
if (!t || t === "--") return null;
|
|
5266
|
+
const i = l.getClient();
|
|
5267
|
+
if (!i) return null;
|
|
5268
|
+
try {
|
|
5269
|
+
const s = new rt(i).getFlag(t, 32, 32);
|
|
5270
|
+
return typeof s == "string" ? s : String(s);
|
|
5271
|
+
} catch {
|
|
5272
|
+
return null;
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
deviceKindIcon(e) {
|
|
5097
5276
|
const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
|
|
5098
5277
|
return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ? o.smartphone : /desktop|browser/.test(t) || /mac|windows|linux|chrome os/.test(i) ? o.monitor : o.globe;
|
|
5099
5278
|
}
|
|
5279
|
+
deviceIcon(e) {
|
|
5280
|
+
const t = this.browserIconUrl(e), i = !!this.browserIconFailed[e.$id], s = this.deviceKindIcon(e);
|
|
5281
|
+
return !t || i ? r`<span class="device">${s}</span>` : r`<span class="device">
|
|
5282
|
+
<img
|
|
5283
|
+
class="device-img"
|
|
5284
|
+
src=${t}
|
|
5285
|
+
alt=""
|
|
5286
|
+
@error=${() => {
|
|
5287
|
+
this.browserIconFailed = { ...this.browserIconFailed, [e.$id]: !0 };
|
|
5288
|
+
}}
|
|
5289
|
+
/>
|
|
5290
|
+
<span class="device-badge" aria-hidden="true">${s}</span>
|
|
5291
|
+
</span>`;
|
|
5292
|
+
}
|
|
5100
5293
|
renderSessions() {
|
|
5101
5294
|
const e = this.sessions;
|
|
5102
5295
|
return r`<div class="section">
|
|
@@ -5108,34 +5301,52 @@ let p = class extends E {
|
|
|
5108
5301
|
o.monitor,
|
|
5109
5302
|
this.t("noSessions"),
|
|
5110
5303
|
this.t("noSessionsDescription")
|
|
5111
|
-
) : e.map(
|
|
5112
|
-
(t)
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5304
|
+
) : e.map((t) => {
|
|
5305
|
+
const i = this.flagUrl(t), s = Array.isArray(t.factors) && t.factors.length > 0, a = (t.provider || "").trim(), c = !!a && a !== "email" && a !== "anonymous", d = this.formatSessionDate(t.$createdAt), m = this.formatSessionDate(t.expire), v = t.countryName || t.countryCode || "";
|
|
5306
|
+
return r`<div class="row">
|
|
5307
|
+
<div class="inline">
|
|
5308
|
+
${this.deviceIcon(t)}
|
|
5309
|
+
<div class="row-main">
|
|
5310
|
+
<span class="row-title">
|
|
5311
|
+
${t.clientName || a || this.t("sessions")}
|
|
5312
|
+
${t.clientVersion ? r`<span class="muted small">${t.clientVersion}</span>` : n}
|
|
5313
|
+
<span class="session-badges">
|
|
5119
5314
|
${t.current ? r`<span class="badge badge-info">${this.t("currentSession")}</span>` : n}
|
|
5315
|
+
${s ? r`<span
|
|
5316
|
+
class="badge badge-info"
|
|
5317
|
+
title=${this.t("sessionMfaFactors", { factors: t.factors.join(", ") })}
|
|
5318
|
+
>${o.shield} ${this.t("mfaBadge")}</span
|
|
5319
|
+
>` : n}
|
|
5320
|
+
${c ? r`<span class="badge badge-outline"
|
|
5321
|
+
>${j(a)} ${N(a)}</span
|
|
5322
|
+
>` : n}
|
|
5120
5323
|
</span>
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5324
|
+
</span>
|
|
5325
|
+
<span class="row-sub row-sub-meta">
|
|
5326
|
+
${t.osName ? r`<span>${t.osName}</span>` : n}
|
|
5327
|
+
${v ? r`<span
|
|
5328
|
+
>${i ? r`<img class="flag" src=${i} alt="" />` : n}${v}</span
|
|
5329
|
+
>` : n}
|
|
5330
|
+
${t.ip ? r`<span>${t.ip}</span>` : n}
|
|
5331
|
+
</span>
|
|
5332
|
+
${d || m ? r`<span class="session-dates"
|
|
5333
|
+
>${d ? this.t("sessionCreated", { date: d }) : n}${d && m ? " · " : ""}${m ? this.t("sessionExpires", { date: m }) : n}</span
|
|
5334
|
+
>` : n}
|
|
5125
5335
|
</div>
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
</
|
|
5137
|
-
</div
|
|
5138
|
-
|
|
5336
|
+
</div>
|
|
5337
|
+
<div class="row-actions">
|
|
5338
|
+
${this.busy === `session-${t.$id}` ? r`<span class="spinner"></span>` : n}
|
|
5339
|
+
<button
|
|
5340
|
+
class="btn btn-ghost btn-sm"
|
|
5341
|
+
@click=${() => this.onDeleteSession(t.$id)}
|
|
5342
|
+
?disabled=${!!this.busy}
|
|
5343
|
+
aria-label=${this.t("signOutSession")}
|
|
5344
|
+
>
|
|
5345
|
+
${o.logOut}
|
|
5346
|
+
</button>
|
|
5347
|
+
</div>
|
|
5348
|
+
</div>`;
|
|
5349
|
+
})}`
|
|
5139
5350
|
)}
|
|
5140
5351
|
${this.card(
|
|
5141
5352
|
this.t("signOutAllSessions"),
|
|
@@ -5179,7 +5390,7 @@ let p = class extends E {
|
|
|
5179
5390
|
<div class="inline">
|
|
5180
5391
|
<span class="device">${j(i.provider)}</span>
|
|
5181
5392
|
<div class="row-main">
|
|
5182
|
-
<span class="row-title">${
|
|
5393
|
+
<span class="row-title">${N(i.provider)}</span>
|
|
5183
5394
|
<span class="row-sub">${i.providerEmail || i.providerUid}</span>
|
|
5184
5395
|
</div>
|
|
5185
5396
|
</div>
|
|
@@ -5223,7 +5434,7 @@ let p = class extends E {
|
|
|
5223
5434
|
?disabled=${!!this.busy}
|
|
5224
5435
|
>
|
|
5225
5436
|
${this.spinner(`connect-${i}`)} ${j(i)}
|
|
5226
|
-
${this.t("connectProvider", { provider:
|
|
5437
|
+
${this.t("connectProvider", { provider: N(i) })}
|
|
5227
5438
|
</button>`
|
|
5228
5439
|
)}` : void 0
|
|
5229
5440
|
)}
|
|
@@ -5255,9 +5466,9 @@ let p = class extends E {
|
|
|
5255
5466
|
</div>`;
|
|
5256
5467
|
}
|
|
5257
5468
|
};
|
|
5258
|
-
|
|
5259
|
-
...
|
|
5260
|
-
|
|
5469
|
+
f.styles = [
|
|
5470
|
+
...M.styles,
|
|
5471
|
+
D`
|
|
5261
5472
|
:host {
|
|
5262
5473
|
display: block;
|
|
5263
5474
|
width: 100%;
|
|
@@ -5329,6 +5540,7 @@ p.styles = [
|
|
|
5329
5540
|
gap: 16px;
|
|
5330
5541
|
}
|
|
5331
5542
|
.device {
|
|
5543
|
+
position: relative;
|
|
5332
5544
|
width: 36px;
|
|
5333
5545
|
height: 36px;
|
|
5334
5546
|
border-radius: var(--authui-radius-md);
|
|
@@ -5338,11 +5550,79 @@ p.styles = [
|
|
|
5338
5550
|
align-items: center;
|
|
5339
5551
|
justify-content: center;
|
|
5340
5552
|
flex-shrink: 0;
|
|
5553
|
+
overflow: visible;
|
|
5554
|
+
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--authui-border) 70%, transparent);
|
|
5341
5555
|
}
|
|
5342
5556
|
.device svg {
|
|
5343
5557
|
width: 18px;
|
|
5344
5558
|
height: 18px;
|
|
5345
5559
|
}
|
|
5560
|
+
.device-img {
|
|
5561
|
+
width: 36px;
|
|
5562
|
+
height: 36px;
|
|
5563
|
+
object-fit: contain;
|
|
5564
|
+
padding: 4px;
|
|
5565
|
+
border-radius: var(--authui-radius-md);
|
|
5566
|
+
display: block;
|
|
5567
|
+
}
|
|
5568
|
+
.device-badge {
|
|
5569
|
+
position: absolute;
|
|
5570
|
+
inset-inline-end: -3px;
|
|
5571
|
+
bottom: -3px;
|
|
5572
|
+
width: 16px;
|
|
5573
|
+
height: 16px;
|
|
5574
|
+
border-radius: 999px;
|
|
5575
|
+
background: var(--authui-card);
|
|
5576
|
+
color: var(--authui-muted-foreground);
|
|
5577
|
+
box-shadow: 0 0 0 2px var(--authui-card);
|
|
5578
|
+
display: inline-flex;
|
|
5579
|
+
align-items: center;
|
|
5580
|
+
justify-content: center;
|
|
5581
|
+
}
|
|
5582
|
+
.device-badge svg {
|
|
5583
|
+
width: 10px;
|
|
5584
|
+
height: 10px;
|
|
5585
|
+
}
|
|
5586
|
+
.flag {
|
|
5587
|
+
width: 14px;
|
|
5588
|
+
height: 14px;
|
|
5589
|
+
border-radius: 2px;
|
|
5590
|
+
object-fit: cover;
|
|
5591
|
+
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--authui-border) 50%, transparent);
|
|
5592
|
+
flex-shrink: 0;
|
|
5593
|
+
vertical-align: middle;
|
|
5594
|
+
}
|
|
5595
|
+
.row-sub-meta {
|
|
5596
|
+
display: flex;
|
|
5597
|
+
flex-wrap: wrap;
|
|
5598
|
+
align-items: center;
|
|
5599
|
+
gap: 6px;
|
|
5600
|
+
}
|
|
5601
|
+
.row-sub-meta .flag {
|
|
5602
|
+
margin-inline-end: 2px;
|
|
5603
|
+
}
|
|
5604
|
+
.session-badges {
|
|
5605
|
+
display: inline-flex;
|
|
5606
|
+
flex-wrap: wrap;
|
|
5607
|
+
gap: 4px;
|
|
5608
|
+
align-items: center;
|
|
5609
|
+
}
|
|
5610
|
+
.session-badges .badge {
|
|
5611
|
+
font-size: 10px;
|
|
5612
|
+
padding: 0 6px;
|
|
5613
|
+
height: 18px;
|
|
5614
|
+
gap: 3px;
|
|
5615
|
+
}
|
|
5616
|
+
.session-badges .badge svg {
|
|
5617
|
+
width: 10px;
|
|
5618
|
+
height: 10px;
|
|
5619
|
+
}
|
|
5620
|
+
.session-dates {
|
|
5621
|
+
display: block;
|
|
5622
|
+
font-size: 11px;
|
|
5623
|
+
color: var(--authui-muted-foreground);
|
|
5624
|
+
margin-top: 2px;
|
|
5625
|
+
}
|
|
5346
5626
|
.log-time {
|
|
5347
5627
|
font-size: 12px;
|
|
5348
5628
|
color: var(--authui-muted-foreground);
|
|
@@ -5353,129 +5633,132 @@ p.styles = [
|
|
|
5353
5633
|
}
|
|
5354
5634
|
`
|
|
5355
5635
|
];
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
],
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
],
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
],
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
],
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
],
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
],
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
],
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
],
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
],
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
],
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
],
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
],
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
],
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
],
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
],
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
],
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
],
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
],
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
],
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
],
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
],
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
],
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
],
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
],
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
],
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
],
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
],
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
],
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
],
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
],
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
],
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
],
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
],
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
],
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
],
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
],
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
],
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
],
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
],
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5636
|
+
g([
|
|
5637
|
+
b({ type: Boolean })
|
|
5638
|
+
], f.prototype, "embedded", 2);
|
|
5639
|
+
g([
|
|
5640
|
+
b({ type: String })
|
|
5641
|
+
], f.prototype, "tab", 2);
|
|
5642
|
+
g([
|
|
5643
|
+
h()
|
|
5644
|
+
], f.prototype, "active", 2);
|
|
5645
|
+
g([
|
|
5646
|
+
h()
|
|
5647
|
+
], f.prototype, "busy", 2);
|
|
5648
|
+
g([
|
|
5649
|
+
h()
|
|
5650
|
+
], f.prototype, "notice", 2);
|
|
5651
|
+
g([
|
|
5652
|
+
h()
|
|
5653
|
+
], f.prototype, "errors", 2);
|
|
5654
|
+
g([
|
|
5655
|
+
h()
|
|
5656
|
+
], f.prototype, "nameInput", 2);
|
|
5657
|
+
g([
|
|
5658
|
+
h()
|
|
5659
|
+
], f.prototype, "emailInput", 2);
|
|
5660
|
+
g([
|
|
5661
|
+
h()
|
|
5662
|
+
], f.prototype, "emailPassword", 2);
|
|
5663
|
+
g([
|
|
5664
|
+
h()
|
|
5665
|
+
], f.prototype, "phoneInput", 2);
|
|
5666
|
+
g([
|
|
5667
|
+
h()
|
|
5668
|
+
], f.prototype, "phonePassword", 2);
|
|
5669
|
+
g([
|
|
5670
|
+
h()
|
|
5671
|
+
], f.prototype, "phoneCode", 2);
|
|
5672
|
+
g([
|
|
5673
|
+
h()
|
|
5674
|
+
], f.prototype, "phoneCodeSent", 2);
|
|
5675
|
+
g([
|
|
5676
|
+
h()
|
|
5677
|
+
], f.prototype, "guestName", 2);
|
|
5678
|
+
g([
|
|
5679
|
+
h()
|
|
5680
|
+
], f.prototype, "oldPassword", 2);
|
|
5681
|
+
g([
|
|
5682
|
+
h()
|
|
5683
|
+
], f.prototype, "newPassword", 2);
|
|
5684
|
+
g([
|
|
5685
|
+
h()
|
|
5686
|
+
], f.prototype, "newPasswordConfirm", 2);
|
|
5687
|
+
g([
|
|
5688
|
+
h()
|
|
5689
|
+
], f.prototype, "showOldPassword", 2);
|
|
5690
|
+
g([
|
|
5691
|
+
h()
|
|
5692
|
+
], f.prototype, "showNewPassword", 2);
|
|
5693
|
+
g([
|
|
5694
|
+
h()
|
|
5695
|
+
], f.prototype, "showNewPasswordConfirm", 2);
|
|
5696
|
+
g([
|
|
5697
|
+
h()
|
|
5698
|
+
], f.prototype, "authenticator", 2);
|
|
5699
|
+
g([
|
|
5700
|
+
h()
|
|
5701
|
+
], f.prototype, "authenticatorCode", 2);
|
|
5702
|
+
g([
|
|
5703
|
+
h()
|
|
5704
|
+
], f.prototype, "factors", 2);
|
|
5705
|
+
g([
|
|
5706
|
+
h()
|
|
5707
|
+
], f.prototype, "recoveryCodes", 2);
|
|
5708
|
+
g([
|
|
5709
|
+
h()
|
|
5710
|
+
], f.prototype, "stepUp", 2);
|
|
5711
|
+
g([
|
|
5712
|
+
h()
|
|
5713
|
+
], f.prototype, "stepUpCode", 2);
|
|
5714
|
+
g([
|
|
5715
|
+
h()
|
|
5716
|
+
], f.prototype, "copied", 2);
|
|
5717
|
+
g([
|
|
5718
|
+
h()
|
|
5719
|
+
], f.prototype, "sessions", 2);
|
|
5720
|
+
g([
|
|
5721
|
+
h()
|
|
5722
|
+
], f.prototype, "browserIconFailed", 2);
|
|
5723
|
+
g([
|
|
5724
|
+
h()
|
|
5725
|
+
], f.prototype, "identities", 2);
|
|
5726
|
+
g([
|
|
5727
|
+
h()
|
|
5728
|
+
], f.prototype, "logs", 2);
|
|
5729
|
+
g([
|
|
5730
|
+
h()
|
|
5731
|
+
], f.prototype, "logsSupported", 2);
|
|
5732
|
+
g([
|
|
5733
|
+
h()
|
|
5734
|
+
], f.prototype, "confirmDelete", 2);
|
|
5735
|
+
g([
|
|
5736
|
+
h()
|
|
5737
|
+
], f.prototype, "confirmRegenerate", 2);
|
|
5738
|
+
g([
|
|
5739
|
+
h()
|
|
5740
|
+
], f.prototype, "confirmRemoveAuthenticator", 2);
|
|
5741
|
+
g([
|
|
5742
|
+
h()
|
|
5743
|
+
], f.prototype, "confirmSignOutAll", 2);
|
|
5744
|
+
g([
|
|
5745
|
+
h()
|
|
5746
|
+
], f.prototype, "confirmDisconnectId", 2);
|
|
5747
|
+
g([
|
|
5748
|
+
h()
|
|
5749
|
+
], f.prototype, "verifyEmailCooldownUntil", 2);
|
|
5750
|
+
g([
|
|
5751
|
+
h()
|
|
5752
|
+
], f.prototype, "verifyPhoneCooldownUntil", 2);
|
|
5753
|
+
f = g([
|
|
5754
|
+
z("authui-account")
|
|
5755
|
+
], f);
|
|
5756
|
+
var oe = Object.defineProperty, le = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
|
|
5757
|
+
for (var a = s > 1 ? void 0 : s ? le(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
5758
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5759
|
+
return s && a && oe(t, i, a), a;
|
|
5477
5760
|
};
|
|
5478
|
-
let
|
|
5761
|
+
let E = class extends M {
|
|
5479
5762
|
constructor() {
|
|
5480
5763
|
super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.scrollCue = !1, this.bodyResizeObserver = null, this.onOpenEvent = (e) => {
|
|
5481
5764
|
const t = e.detail ?? {};
|
|
@@ -5571,9 +5854,9 @@ let I = class extends E {
|
|
|
5571
5854
|
`;
|
|
5572
5855
|
}
|
|
5573
5856
|
};
|
|
5574
|
-
|
|
5575
|
-
...
|
|
5576
|
-
|
|
5857
|
+
E.styles = [
|
|
5858
|
+
...M.styles,
|
|
5859
|
+
D`
|
|
5577
5860
|
:host {
|
|
5578
5861
|
display: contents;
|
|
5579
5862
|
}
|
|
@@ -5668,13 +5951,13 @@ I.styles = [
|
|
|
5668
5951
|
`
|
|
5669
5952
|
];
|
|
5670
5953
|
L([
|
|
5671
|
-
|
|
5672
|
-
],
|
|
5954
|
+
b({ type: Boolean, reflect: !0 })
|
|
5955
|
+
], E.prototype, "open", 2);
|
|
5673
5956
|
L([
|
|
5674
|
-
|
|
5675
|
-
],
|
|
5957
|
+
b({ type: String })
|
|
5958
|
+
], E.prototype, "view", 2);
|
|
5676
5959
|
L([
|
|
5677
|
-
|
|
5960
|
+
b({
|
|
5678
5961
|
attribute: "close-on-success",
|
|
5679
5962
|
reflect: !0,
|
|
5680
5963
|
converter: {
|
|
@@ -5688,28 +5971,28 @@ L([
|
|
|
5688
5971
|
}
|
|
5689
5972
|
}
|
|
5690
5973
|
})
|
|
5691
|
-
],
|
|
5974
|
+
], E.prototype, "closeOnSuccess", 2);
|
|
5692
5975
|
L([
|
|
5693
|
-
|
|
5694
|
-
],
|
|
5976
|
+
h()
|
|
5977
|
+
], E.prototype, "handledPending", 2);
|
|
5695
5978
|
L([
|
|
5696
|
-
|
|
5697
|
-
],
|
|
5979
|
+
h()
|
|
5980
|
+
], E.prototype, "scrollCue", 2);
|
|
5698
5981
|
L([
|
|
5699
|
-
|
|
5700
|
-
],
|
|
5982
|
+
ct("dialog")
|
|
5983
|
+
], E.prototype, "dialog", 2);
|
|
5701
5984
|
L([
|
|
5702
|
-
|
|
5703
|
-
],
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
],
|
|
5707
|
-
var
|
|
5708
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5709
|
-
(d = e[
|
|
5710
|
-
return s && a &&
|
|
5985
|
+
ct(".body")
|
|
5986
|
+
], E.prototype, "bodyEl", 2);
|
|
5987
|
+
E = L([
|
|
5988
|
+
z("authui-modal")
|
|
5989
|
+
], E);
|
|
5990
|
+
var ce = Object.defineProperty, de = Object.getOwnPropertyDescriptor, st = (e, t, i, s) => {
|
|
5991
|
+
for (var a = s > 1 ? void 0 : s ? de(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
5992
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5993
|
+
return s && a && ce(t, i, a), a;
|
|
5711
5994
|
};
|
|
5712
|
-
let
|
|
5995
|
+
let H = class extends M {
|
|
5713
5996
|
constructor() {
|
|
5714
5997
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
5715
5998
|
}
|
|
@@ -5717,7 +6000,7 @@ let N = class extends E {
|
|
|
5717
6000
|
const e = this.size === "md" ? "" : `btn-${this.size}`;
|
|
5718
6001
|
return r`<button
|
|
5719
6002
|
class="btn btn-${this.variant} ${e}"
|
|
5720
|
-
@click=${() =>
|
|
6003
|
+
@click=${() => et(this.view)}
|
|
5721
6004
|
part="button"
|
|
5722
6005
|
>
|
|
5723
6006
|
<slot
|
|
@@ -5726,9 +6009,9 @@ let N = class extends E {
|
|
|
5726
6009
|
</button>`;
|
|
5727
6010
|
}
|
|
5728
6011
|
};
|
|
5729
|
-
|
|
5730
|
-
...
|
|
5731
|
-
|
|
6012
|
+
H.styles = [
|
|
6013
|
+
...M.styles,
|
|
6014
|
+
D`
|
|
5732
6015
|
:host {
|
|
5733
6016
|
display: inline-block;
|
|
5734
6017
|
}
|
|
@@ -5737,24 +6020,24 @@ N.styles = [
|
|
|
5737
6020
|
}
|
|
5738
6021
|
`
|
|
5739
6022
|
];
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
],
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
],
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
],
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
],
|
|
5752
|
-
var
|
|
5753
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5754
|
-
(d = e[
|
|
5755
|
-
return s && a &&
|
|
6023
|
+
st([
|
|
6024
|
+
b({ type: String })
|
|
6025
|
+
], H.prototype, "view", 2);
|
|
6026
|
+
st([
|
|
6027
|
+
b({ type: String })
|
|
6028
|
+
], H.prototype, "variant", 2);
|
|
6029
|
+
st([
|
|
6030
|
+
b({ type: String })
|
|
6031
|
+
], H.prototype, "size", 2);
|
|
6032
|
+
H = st([
|
|
6033
|
+
z("authui-button")
|
|
6034
|
+
], H);
|
|
6035
|
+
var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, R = (e, t, i, s) => {
|
|
6036
|
+
for (var a = s > 1 ? void 0 : s ? ue(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
6037
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
6038
|
+
return s && a && he(t, i, a), a;
|
|
5756
6039
|
};
|
|
5757
|
-
let U = class extends
|
|
6040
|
+
let U = class extends M {
|
|
5758
6041
|
constructor() {
|
|
5759
6042
|
super(...arguments), this.showTeams = !1, this.menuItems = [], this.src = "", this.menuOpen = !1, this.menuAbove = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onReposition = () => {
|
|
5760
6043
|
this.menuOpen && this.placeMenu();
|
|
@@ -5799,10 +6082,10 @@ let U = class extends E {
|
|
|
5799
6082
|
if (!e || !t) return;
|
|
5800
6083
|
const i = e.getBoundingClientRect(), s = 6, a = 8;
|
|
5801
6084
|
t.style.maxHeight = "";
|
|
5802
|
-
const
|
|
5803
|
-
|
|
5804
|
-
const
|
|
5805
|
-
t.style.maxHeight = `${
|
|
6085
|
+
const c = t.offsetHeight + s, d = window.innerHeight - i.bottom, m = i.top, v = d < c && m > d;
|
|
6086
|
+
v !== this.menuAbove && (this.menuAbove = v);
|
|
6087
|
+
const p = Math.max(80, (v ? m : d) - s - a);
|
|
6088
|
+
t.style.maxHeight = `${p}px`;
|
|
5806
6089
|
}
|
|
5807
6090
|
focusMenuItem(e) {
|
|
5808
6091
|
[
|
|
@@ -5829,7 +6112,7 @@ let U = class extends E {
|
|
|
5829
6112
|
if (e === "loading" && i)
|
|
5830
6113
|
return r`<span class="avatar"><span class="spinner"></span></span>`;
|
|
5831
6114
|
if (e !== "signed-in" || !t)
|
|
5832
|
-
return r`<button class="btn btn-primary btn-sm" @click=${() =>
|
|
6115
|
+
return r`<button class="btn btn-primary btn-sm" @click=${() => et("sign-in")}>
|
|
5833
6116
|
<slot>${this.t("signIn")}</slot>
|
|
5834
6117
|
</button>`;
|
|
5835
6118
|
const s = t.name || t.email || t.phone || this.t("guestAccount");
|
|
@@ -5842,7 +6125,7 @@ let U = class extends E {
|
|
|
5842
6125
|
aria-label=${s}
|
|
5843
6126
|
>
|
|
5844
6127
|
<span class="avatar"
|
|
5845
|
-
>${this.src ? r`<img src=${this.src} alt="" />` :
|
|
6128
|
+
>${this.src ? r`<img src=${this.src} alt="" />` : ut(s)}</span
|
|
5846
6129
|
>
|
|
5847
6130
|
</button>
|
|
5848
6131
|
${this.menuOpen ? r`<div class="menu ${this.menuAbove ? "above" : ""}" role="menu">
|
|
@@ -5873,7 +6156,7 @@ let U = class extends E {
|
|
|
5873
6156
|
class="menu-item"
|
|
5874
6157
|
role="menuitem"
|
|
5875
6158
|
@click=${() => {
|
|
5876
|
-
this.menuOpen = !1,
|
|
6159
|
+
this.menuOpen = !1, et("account");
|
|
5877
6160
|
}}
|
|
5878
6161
|
>
|
|
5879
6162
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -5928,8 +6211,8 @@ let U = class extends E {
|
|
|
5928
6211
|
}
|
|
5929
6212
|
};
|
|
5930
6213
|
U.styles = [
|
|
5931
|
-
...
|
|
5932
|
-
|
|
6214
|
+
...M.styles,
|
|
6215
|
+
D`
|
|
5933
6216
|
:host {
|
|
5934
6217
|
display: inline-block;
|
|
5935
6218
|
position: relative;
|
|
@@ -6049,63 +6332,63 @@ U.styles = [
|
|
|
6049
6332
|
}
|
|
6050
6333
|
`
|
|
6051
6334
|
];
|
|
6052
|
-
|
|
6053
|
-
|
|
6335
|
+
R([
|
|
6336
|
+
b({ type: Boolean, attribute: "show-teams" })
|
|
6054
6337
|
], U.prototype, "showTeams", 2);
|
|
6055
|
-
|
|
6056
|
-
|
|
6338
|
+
R([
|
|
6339
|
+
b({ attribute: !1 })
|
|
6057
6340
|
], U.prototype, "menuItems", 2);
|
|
6058
|
-
|
|
6059
|
-
|
|
6341
|
+
R([
|
|
6342
|
+
b({ type: String })
|
|
6060
6343
|
], U.prototype, "src", 2);
|
|
6061
|
-
|
|
6062
|
-
|
|
6344
|
+
R([
|
|
6345
|
+
h()
|
|
6063
6346
|
], U.prototype, "menuOpen", 2);
|
|
6064
|
-
|
|
6065
|
-
|
|
6347
|
+
R([
|
|
6348
|
+
h()
|
|
6066
6349
|
], U.prototype, "menuAbove", 2);
|
|
6067
|
-
|
|
6068
|
-
|
|
6350
|
+
R([
|
|
6351
|
+
h()
|
|
6069
6352
|
], U.prototype, "teams", 2);
|
|
6070
|
-
|
|
6071
|
-
|
|
6353
|
+
R([
|
|
6354
|
+
h()
|
|
6072
6355
|
], U.prototype, "teamsLoading", 2);
|
|
6073
|
-
|
|
6074
|
-
|
|
6356
|
+
R([
|
|
6357
|
+
h()
|
|
6075
6358
|
], U.prototype, "activeTeamId", 2);
|
|
6076
|
-
U =
|
|
6077
|
-
|
|
6359
|
+
U = R([
|
|
6360
|
+
z("authui-user-button")
|
|
6078
6361
|
], U);
|
|
6079
6362
|
export {
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6363
|
+
qt as A,
|
|
6364
|
+
ve as C,
|
|
6365
|
+
y as E,
|
|
6366
|
+
kt as F,
|
|
6367
|
+
Tt as P,
|
|
6085
6368
|
l as a,
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6369
|
+
f as b,
|
|
6370
|
+
be as c,
|
|
6371
|
+
H as d,
|
|
6372
|
+
$ as e,
|
|
6373
|
+
M as f,
|
|
6374
|
+
E as g,
|
|
6375
|
+
G as h,
|
|
6376
|
+
x as i,
|
|
6094
6377
|
U as j,
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6378
|
+
ge as k,
|
|
6379
|
+
bt as l,
|
|
6380
|
+
Mt as m,
|
|
6381
|
+
J as n,
|
|
6382
|
+
et as o,
|
|
6383
|
+
q as p,
|
|
6384
|
+
vt as q,
|
|
6385
|
+
Lt as r,
|
|
6386
|
+
N as s,
|
|
6387
|
+
V as t,
|
|
6388
|
+
At as u,
|
|
6389
|
+
lt as v,
|
|
6390
|
+
zt as w,
|
|
6391
|
+
_t as x,
|
|
6392
|
+
B as y,
|
|
6393
|
+
Qt as z
|
|
6111
6394
|
};
|