@getauthui/core 0.1.12 → 0.1.14
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 +3 -3
- package/dist/{authui-user-button--QfXbaC8.js → authui-user-button-CV2B_0j5.js} +338 -265
- package/dist/authui.cdn.js +204 -134
- package/dist/authui.cdn.mjs +782 -709
- package/dist/authui.js +2 -2
- package/dist/components/authui-modal.d.ts.map +1 -1
- package/dist/components/authui-sign-in.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/dist/styles/base.d.ts.map +1 -1
- package/dist/styles/tokens.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { state as c, property as m, customElement as
|
|
2
|
-
import { css as T, LitElement as
|
|
3
|
-
import { Client as
|
|
4
|
-
const
|
|
1
|
+
import { state as c, property as m, customElement as D, query as nt } from "lit/decorators.js";
|
|
2
|
+
import { css as T, LitElement as ot, nothing as n, html as r, svg as u } from "lit";
|
|
3
|
+
import { Client as dt, Account as ht, Teams as Ct, ID as G, Avatars as St } from "appwrite";
|
|
4
|
+
const At = {
|
|
5
5
|
signIn: "Sign in",
|
|
6
6
|
dialogSignIn: "Sign in",
|
|
7
7
|
signUp: "Sign up",
|
|
@@ -175,13 +175,13 @@ const St = {
|
|
|
175
175
|
acceptLegal: "I agree to the",
|
|
176
176
|
errorLegalRequired: "Accept the terms to continue."
|
|
177
177
|
};
|
|
178
|
-
function
|
|
178
|
+
function Pt(e, t = {}) {
|
|
179
179
|
return e.replace(
|
|
180
180
|
/\{(\w+)\}/g,
|
|
181
181
|
(i, s) => s in t ? String(t[s]) : `{${s}}`
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Ut = {
|
|
185
185
|
amazon: "Amazon",
|
|
186
186
|
apple: "Apple",
|
|
187
187
|
appwrite: "Appwrite",
|
|
@@ -232,10 +232,10 @@ const Pt = {
|
|
|
232
232
|
zoho: "Zoho",
|
|
233
233
|
zoom: "Zoom"
|
|
234
234
|
};
|
|
235
|
-
function
|
|
236
|
-
return
|
|
235
|
+
function B(e) {
|
|
236
|
+
return Ut[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
237
237
|
}
|
|
238
|
-
const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(),
|
|
238
|
+
const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(), Y = [
|
|
239
239
|
"amber",
|
|
240
240
|
"brave",
|
|
241
241
|
"calm",
|
|
@@ -248,13 +248,13 @@ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
248
248
|
"juniper",
|
|
249
249
|
"kite",
|
|
250
250
|
"lumen"
|
|
251
|
-
],
|
|
251
|
+
], ut = () => `${Y[Math.floor(Math.random() * Y.length)]}-${Y[Math.floor(Math.random() * Y.length)]}`, z = () => Math.random().toString(36).slice(2, 12), pt = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), It = {
|
|
252
252
|
name: "Ada Lovelace",
|
|
253
253
|
email: "ada@example.com",
|
|
254
254
|
phone: "+15550100"
|
|
255
255
|
};
|
|
256
|
-
class
|
|
257
|
-
constructor(t =
|
|
256
|
+
class Et {
|
|
257
|
+
constructor(t = It) {
|
|
258
258
|
this.seed = t, this.user = null, this.mfaPending = !1, this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], this.lastChallenge = 0, this.sessions = [], this.identities = [], this.logs = [], this.tokens = /* @__PURE__ */ new Map(), this.pendingAuthenticator = null;
|
|
259
259
|
}
|
|
260
260
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -318,7 +318,7 @@ class It {
|
|
|
318
318
|
},
|
|
319
319
|
{
|
|
320
320
|
...i,
|
|
321
|
-
$id:
|
|
321
|
+
$id: z(),
|
|
322
322
|
$createdAt: M(300),
|
|
323
323
|
provider: t,
|
|
324
324
|
ip: "198.51.100.7",
|
|
@@ -335,7 +335,7 @@ class It {
|
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
...i,
|
|
338
|
-
$id:
|
|
338
|
+
$id: z(),
|
|
339
339
|
$createdAt: M(1440 * 3),
|
|
340
340
|
provider: "oauth2",
|
|
341
341
|
ip: "192.0.2.90",
|
|
@@ -436,26 +436,26 @@ class It {
|
|
|
436
436
|
}
|
|
437
437
|
async createMagicURLToken(t, i) {
|
|
438
438
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
439
|
-
$id:
|
|
439
|
+
$id: z(),
|
|
440
440
|
$createdAt: P(),
|
|
441
441
|
userId: t,
|
|
442
442
|
secret: "",
|
|
443
443
|
expire: "",
|
|
444
|
-
phrase:
|
|
444
|
+
phrase: ut()
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
447
|
async createEmailToken(t, i) {
|
|
448
448
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
449
|
-
$id:
|
|
449
|
+
$id: z(),
|
|
450
450
|
$createdAt: P(),
|
|
451
451
|
userId: t,
|
|
452
452
|
secret: "",
|
|
453
453
|
expire: "",
|
|
454
|
-
phrase:
|
|
454
|
+
phrase: ut()
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
async createPhoneToken(t, i) {
|
|
458
|
-
return this.tokens.set(t, { phone: i }), this.delay({ $id:
|
|
458
|
+
return this.tokens.set(t, { phone: i }), this.delay({ $id: z(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
|
|
459
459
|
}
|
|
460
460
|
async createSession(t) {
|
|
461
461
|
return this.delay(() => {
|
|
@@ -547,7 +547,7 @@ class It {
|
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
async createMFAChallenge() {
|
|
550
|
-
return this.delay({ $id:
|
|
550
|
+
return this.delay({ $id: z(), $createdAt: P(), userId: "preview-user", expire: "" });
|
|
551
551
|
}
|
|
552
552
|
async updateMFAChallenge() {
|
|
553
553
|
return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
|
|
@@ -577,21 +577,21 @@ class It {
|
|
|
577
577
|
return this.delay(() => {
|
|
578
578
|
if (this.recoveryCodes.length > 0)
|
|
579
579
|
throw K("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
|
|
580
|
-
return this.recoveryCodes = Array.from({ length: 6 },
|
|
580
|
+
return this.recoveryCodes = Array.from({ length: 6 }, pt), { recoveryCodes: this.recoveryCodes };
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
async getMFARecoveryCodes() {
|
|
584
584
|
return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
|
|
585
585
|
}
|
|
586
586
|
async updateMFARecoveryCodes() {
|
|
587
|
-
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 },
|
|
587
|
+
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, pt), { recoveryCodes: this.recoveryCodes }));
|
|
588
588
|
}
|
|
589
589
|
/** Forget everything, as a sign out would. */
|
|
590
590
|
reset() {
|
|
591
591
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Mt(e) {
|
|
595
595
|
let t = 2166136261;
|
|
596
596
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
597
597
|
for (const g of e) t = (t ^ g.charCodeAt(0)) * 16777619;
|
|
@@ -639,7 +639,7 @@ const v = {
|
|
|
639
639
|
targetAlreadyExists: "user_target_already_exists",
|
|
640
640
|
argumentInvalid: "general_argument_invalid"
|
|
641
641
|
};
|
|
642
|
-
function
|
|
642
|
+
function V(e) {
|
|
643
643
|
if (e && typeof e == "object") {
|
|
644
644
|
const t = e;
|
|
645
645
|
let i = typeof t.message == "string" ? t.message : "Unknown error";
|
|
@@ -651,11 +651,11 @@ function q(e) {
|
|
|
651
651
|
}
|
|
652
652
|
return { message: String(e), type: "", code: 0 };
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
654
|
+
function H(e, t) {
|
|
655
|
+
return V(e).type === t;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
const s =
|
|
657
|
+
function Z(e, t, i = "link") {
|
|
658
|
+
const s = V(e);
|
|
659
659
|
switch (s.type) {
|
|
660
660
|
case v.invalidCredentials:
|
|
661
661
|
return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
|
|
@@ -697,73 +697,73 @@ function Y(e, t, i = "link") {
|
|
|
697
697
|
}
|
|
698
698
|
return s.type === v.projectNotFound || s.type === v.unknownOrigin ? t.errorConfig : s.type === v.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 === v.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
700
|
+
function Ot(e) {
|
|
701
|
+
const t = V(e);
|
|
702
702
|
return !!(t.type === v.projectNotFound || t.type === v.unknownOrigin || t.type === v.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
|
|
703
703
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
704
|
+
const it = (e) => `authui:active-team:${e}`;
|
|
705
|
+
function ft(e) {
|
|
706
706
|
if (typeof localStorage > "u" || !e) return null;
|
|
707
707
|
try {
|
|
708
|
-
return localStorage.getItem(
|
|
708
|
+
return localStorage.getItem(it(e));
|
|
709
709
|
} catch {
|
|
710
710
|
return null;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Ft(e, t) {
|
|
714
714
|
if (!(typeof localStorage > "u" || !e))
|
|
715
715
|
try {
|
|
716
|
-
t ? localStorage.setItem(
|
|
716
|
+
t ? localStorage.setItem(it(e), t) : localStorage.removeItem(it(e));
|
|
717
717
|
} catch {
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
const
|
|
721
|
-
function
|
|
720
|
+
const lt = "authui:last-method";
|
|
721
|
+
function q(e) {
|
|
722
722
|
if (!(typeof localStorage > "u")) {
|
|
723
723
|
if (!e || e === "mfa" || e === "sign-up")
|
|
724
724
|
if (e === "sign-up") e = "email-password";
|
|
725
725
|
else return;
|
|
726
726
|
try {
|
|
727
|
-
localStorage.setItem(
|
|
727
|
+
localStorage.setItem(lt, e);
|
|
728
728
|
} catch {
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function _() {
|
|
733
733
|
if (typeof localStorage > "u") return null;
|
|
734
734
|
try {
|
|
735
|
-
return localStorage.getItem(
|
|
735
|
+
return localStorage.getItem(lt);
|
|
736
736
|
} catch {
|
|
737
737
|
return null;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function ce() {
|
|
741
741
|
if (!(typeof localStorage > "u"))
|
|
742
742
|
try {
|
|
743
|
-
localStorage.removeItem(
|
|
743
|
+
localStorage.removeItem(lt);
|
|
744
744
|
} catch {
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
const
|
|
748
|
-
function
|
|
747
|
+
const X = "authui:pending-oauth";
|
|
748
|
+
function Rt(e) {
|
|
749
749
|
if (!(typeof sessionStorage > "u"))
|
|
750
750
|
try {
|
|
751
|
-
sessionStorage.setItem(
|
|
751
|
+
sessionStorage.setItem(X, e);
|
|
752
752
|
} catch {
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function xt() {
|
|
756
756
|
if (!(typeof sessionStorage > "u"))
|
|
757
757
|
try {
|
|
758
|
-
const e = sessionStorage.getItem(
|
|
759
|
-
sessionStorage.removeItem(
|
|
758
|
+
const e = sessionStorage.getItem(X);
|
|
759
|
+
sessionStorage.removeItem(X), e && q(`oauth:${e}`);
|
|
760
760
|
} catch {
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function mt() {
|
|
764
764
|
if (!(typeof sessionStorage > "u"))
|
|
765
765
|
try {
|
|
766
|
-
sessionStorage.removeItem(
|
|
766
|
+
sessionStorage.removeItem(X);
|
|
767
767
|
} catch {
|
|
768
768
|
}
|
|
769
769
|
}
|
|
@@ -777,7 +777,7 @@ function A(e, t, i) {
|
|
|
777
777
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
778
778
|
);
|
|
779
779
|
}
|
|
780
|
-
const
|
|
780
|
+
const st = "authui", gt = ["userId", "secret", "expire", "project", "error", st], vt = () => ({
|
|
781
781
|
status: "loading",
|
|
782
782
|
user: null,
|
|
783
783
|
mfaFactors: null,
|
|
@@ -787,7 +787,7 @@ const it = "authui", mt = ["userId", "secret", "expire", "project", "error", it]
|
|
|
787
787
|
});
|
|
788
788
|
class Tt {
|
|
789
789
|
constructor() {
|
|
790
|
-
this.client = null, this.account = null, this.config = null, this.state =
|
|
790
|
+
this.client = null, this.account = null, this.config = null, this.state = vt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
791
791
|
}
|
|
792
792
|
// ───────────────────────────── configuration ─────────────────────────────
|
|
793
793
|
/** Configure the Appwrite client. Safe to call more than once; the last call wins. */
|
|
@@ -795,7 +795,7 @@ class Tt {
|
|
|
795
795
|
const i = t.endpoint.trim().replace(/\/+$/, "");
|
|
796
796
|
i && !i.endsWith("/v1") && console.warn(
|
|
797
797
|
`[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
|
|
798
|
-
), this.config = t, this.client = new
|
|
798
|
+
), this.config = t, this.client = new dt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Et() : null, this.account = this.preview ? this.preview : new ht(this.client), this.teams = null, this.activeTeamId = ft(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
|
|
799
799
|
}
|
|
800
800
|
/**
|
|
801
801
|
* Called by <authui-config> when it is on the page but missing endpoint or project.
|
|
@@ -841,7 +841,7 @@ class Tt {
|
|
|
841
841
|
/** List teams the signed-in user belongs to. Empty in preview or when signed out. */
|
|
842
842
|
async listTeams() {
|
|
843
843
|
if (this.preview || !this.client || this.state.status !== "signed-in") return [];
|
|
844
|
-
this.teams ??= new
|
|
844
|
+
this.teams ??= new Ct(this.client);
|
|
845
845
|
try {
|
|
846
846
|
return (await this.teams.list()).teams ?? [];
|
|
847
847
|
} catch (t) {
|
|
@@ -851,7 +851,7 @@ class Tt {
|
|
|
851
851
|
getActiveTeamId() {
|
|
852
852
|
if (this.activeTeamId) return this.activeTeamId;
|
|
853
853
|
const t = this.config?.project;
|
|
854
|
-
return t ? (this.activeTeamId =
|
|
854
|
+
return t ? (this.activeTeamId = ft(t), this.activeTeamId) : null;
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* Remember the active team locally and emit `active-team`.
|
|
@@ -859,10 +859,10 @@ class Tt {
|
|
|
859
859
|
*/
|
|
860
860
|
setActiveTeam(t) {
|
|
861
861
|
const i = this.config?.project;
|
|
862
|
-
i &&
|
|
862
|
+
i && Ft(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
|
|
863
863
|
}
|
|
864
864
|
getStrings() {
|
|
865
|
-
return { ...
|
|
865
|
+
return { ...At, ...this.config?.strings ?? {} };
|
|
866
866
|
}
|
|
867
867
|
getState() {
|
|
868
868
|
return { ...this.state };
|
|
@@ -888,7 +888,7 @@ class Tt {
|
|
|
888
888
|
this.state = { ...this.state, ...t }, this.emit("change", this.getState());
|
|
889
889
|
}
|
|
890
890
|
fail(t) {
|
|
891
|
-
const i =
|
|
891
|
+
const i = V(t);
|
|
892
892
|
throw this.emit("error", i), t;
|
|
893
893
|
}
|
|
894
894
|
acct() {
|
|
@@ -908,7 +908,7 @@ class Tt {
|
|
|
908
908
|
const i = await this.account.get();
|
|
909
909
|
this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
|
|
910
910
|
} catch (i) {
|
|
911
|
-
if (
|
|
911
|
+
if (H(i, v.moreFactorsRequired)) {
|
|
912
912
|
let s = null;
|
|
913
913
|
try {
|
|
914
914
|
s = await A(
|
|
@@ -919,7 +919,7 @@ class Tt {
|
|
|
919
919
|
} catch {
|
|
920
920
|
}
|
|
921
921
|
this.setState({ status: "mfa-required", user: null, mfaFactors: s });
|
|
922
|
-
} else if (
|
|
922
|
+
} else if (H(i, v.userBlocked))
|
|
923
923
|
await this.purgeLocalSession(), this.setState({
|
|
924
924
|
status: "signed-out",
|
|
925
925
|
user: null,
|
|
@@ -930,12 +930,12 @@ class Tt {
|
|
|
930
930
|
message: this.getStrings().errorUserBlocked
|
|
931
931
|
}
|
|
932
932
|
}), t && this.emit("signed-out", void 0);
|
|
933
|
-
else if (!t &&
|
|
934
|
-
const a =
|
|
933
|
+
else if (!t && Ot(i)) {
|
|
934
|
+
const a = Z(i, this.getStrings()) || this.getStrings().errorConfig;
|
|
935
935
|
console.warn(
|
|
936
936
|
`[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
|
|
937
937
|
);
|
|
938
|
-
const h =
|
|
938
|
+
const h = V(i);
|
|
939
939
|
this.emit("error", { message: a, type: h.type, code: h.code }), this.setState({
|
|
940
940
|
status: "signed-out",
|
|
941
941
|
user: null,
|
|
@@ -980,7 +980,7 @@ class Tt {
|
|
|
980
980
|
localStorage.removeItem("cookieFallback");
|
|
981
981
|
} catch {
|
|
982
982
|
}
|
|
983
|
-
this.config && !this.preview && (this.client = new
|
|
983
|
+
this.config && !this.preview && (this.client = new dt().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new ht(this.client));
|
|
984
984
|
}
|
|
985
985
|
// ─────────────────────────────── sign in ───────────────────────────────
|
|
986
986
|
async signInWithEmailPassword(t, i) {
|
|
@@ -993,7 +993,7 @@ class Tt {
|
|
|
993
993
|
}
|
|
994
994
|
async signUp(t, i, s) {
|
|
995
995
|
try {
|
|
996
|
-
await this.acct().create(
|
|
996
|
+
await this.acct().create(G.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
|
|
997
997
|
} catch (a) {
|
|
998
998
|
this.fail(a);
|
|
999
999
|
}
|
|
@@ -1036,7 +1036,7 @@ class Tt {
|
|
|
1036
1036
|
async sendMagicUrl(t) {
|
|
1037
1037
|
try {
|
|
1038
1038
|
return await this.acct().createMagicURLToken(
|
|
1039
|
-
|
|
1039
|
+
G.unique(),
|
|
1040
1040
|
t.trim(),
|
|
1041
1041
|
this.redirectUrl("magic-url"),
|
|
1042
1042
|
this.config?.securityPhrase ?? !0
|
|
@@ -1048,7 +1048,7 @@ class Tt {
|
|
|
1048
1048
|
async sendEmailOtp(t) {
|
|
1049
1049
|
try {
|
|
1050
1050
|
return await this.acct().createEmailToken(
|
|
1051
|
-
|
|
1051
|
+
G.unique(),
|
|
1052
1052
|
t.trim(),
|
|
1053
1053
|
this.config?.securityPhrase ?? !0
|
|
1054
1054
|
);
|
|
@@ -1058,7 +1058,7 @@ class Tt {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
async sendPhoneOtp(t) {
|
|
1060
1060
|
try {
|
|
1061
|
-
return await this.acct().createPhoneToken(
|
|
1061
|
+
return await this.acct().createPhoneToken(G.unique(), t.replace(/[\s()-]/g, ""));
|
|
1062
1062
|
} catch (i) {
|
|
1063
1063
|
return this.fail(i);
|
|
1064
1064
|
}
|
|
@@ -1332,8 +1332,8 @@ class Tt {
|
|
|
1332
1332
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1333
1333
|
redirectUrl(t) {
|
|
1334
1334
|
const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
|
|
1335
|
-
for (const a of
|
|
1336
|
-
return s.searchParams.set(
|
|
1335
|
+
for (const a of gt) s.searchParams.delete(a);
|
|
1336
|
+
return s.searchParams.set(st, t), s.toString();
|
|
1337
1337
|
}
|
|
1338
1338
|
setPending(t) {
|
|
1339
1339
|
this.setState({ pending: t });
|
|
@@ -1344,7 +1344,7 @@ class Tt {
|
|
|
1344
1344
|
*/
|
|
1345
1345
|
async handleRedirect() {
|
|
1346
1346
|
if (typeof window > "u") return !1;
|
|
1347
|
-
const t = new URLSearchParams(window.location.search), i = t.get(
|
|
1347
|
+
const t = new URLSearchParams(window.location.search), i = t.get(st);
|
|
1348
1348
|
if (!i) return !1;
|
|
1349
1349
|
const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
|
|
1350
1350
|
this.cleanUrl();
|
|
@@ -1361,10 +1361,10 @@ class Tt {
|
|
|
1361
1361
|
switch (i) {
|
|
1362
1362
|
case "oauth":
|
|
1363
1363
|
case "magic-url":
|
|
1364
|
-
s && a ? (await this.acct().createSession(s, a), i === "oauth" ?
|
|
1364
|
+
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? xt() : q("magic-url")) : (i === "oauth" && mt(), h());
|
|
1365
1365
|
break;
|
|
1366
1366
|
case "oauth-failed":
|
|
1367
|
-
|
|
1367
|
+
mt(), this.setState({
|
|
1368
1368
|
pending: {
|
|
1369
1369
|
type: "notice",
|
|
1370
1370
|
tone: "error",
|
|
@@ -1390,23 +1390,23 @@ class Tt {
|
|
|
1390
1390
|
break;
|
|
1391
1391
|
}
|
|
1392
1392
|
} catch (d) {
|
|
1393
|
-
const g =
|
|
1393
|
+
const g = V(d), y = Z(d, this.getStrings(), "link");
|
|
1394
1394
|
this.emit("error", g), this.setState({ pending: { type: "notice", message: y, tone: "error" } });
|
|
1395
1395
|
}
|
|
1396
1396
|
return !0;
|
|
1397
1397
|
}
|
|
1398
1398
|
cleanUrl() {
|
|
1399
1399
|
const t = new URL(window.location.href);
|
|
1400
|
-
for (const i of
|
|
1400
|
+
for (const i of gt) t.searchParams.delete(i);
|
|
1401
1401
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1402
1402
|
}
|
|
1403
1403
|
/** Test helper. */
|
|
1404
1404
|
reset() {
|
|
1405
|
-
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state =
|
|
1405
|
+
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = vt(), this.listeners.clear();
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
const l = new Tt();
|
|
1409
|
-
class
|
|
1409
|
+
class Lt {
|
|
1410
1410
|
constructor() {
|
|
1411
1411
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
1412
1412
|
const t = this.isDark("auto");
|
|
@@ -1434,14 +1434,14 @@ class Rt {
|
|
|
1434
1434
|
this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const bt = new Lt(), yt = {
|
|
1438
1438
|
none: "0px",
|
|
1439
1439
|
sm: "0.25rem",
|
|
1440
1440
|
md: "0.625rem",
|
|
1441
1441
|
lg: "0.875rem",
|
|
1442
1442
|
xl: "1.125rem",
|
|
1443
1443
|
full: "1.5rem"
|
|
1444
|
-
},
|
|
1444
|
+
}, Dt = T`
|
|
1445
1445
|
:host {
|
|
1446
1446
|
/* Light theme (matches :root in the console) */
|
|
1447
1447
|
--authui-background: oklch(1 0 0);
|
|
@@ -1462,7 +1462,8 @@ const vt = new Rt(), bt = {
|
|
|
1462
1462
|
--authui-destructive-foreground: oklch(0.577 0.245 27.325);
|
|
1463
1463
|
--authui-border: oklch(0.93 0.0035 286.32);
|
|
1464
1464
|
--authui-input: oklch(0.93 0.0035 286.32);
|
|
1465
|
-
|
|
1465
|
+
/* Raised on white for WCAG 1.4.11 / 2.4.7 (~3:1+) UI contrast; zinc-500 */
|
|
1466
|
+
--authui-ring: #71717a;
|
|
1466
1467
|
--authui-brand: #fd366e;
|
|
1467
1468
|
--authui-brand-foreground: #ffffff;
|
|
1468
1469
|
--authui-success: oklch(0.696 0.17 162.48);
|
|
@@ -1508,9 +1509,10 @@ const vt = new Rt(), bt = {
|
|
|
1508
1509
|
--authui-accent-foreground: oklch(0.985 0 0);
|
|
1509
1510
|
--authui-destructive: oklch(0.396 0.141 25.723);
|
|
1510
1511
|
--authui-destructive-foreground: oklch(0.637 0.237 25.331);
|
|
1511
|
-
|
|
1512
|
-
--authui-
|
|
1513
|
-
--authui-
|
|
1512
|
+
/* Raised vs card (#1d1d21) for WCAG 1.4.11 (~3:1) UI contrast */
|
|
1513
|
+
--authui-border: #71717a;
|
|
1514
|
+
--authui-input: #71717a;
|
|
1515
|
+
--authui-ring: #a1a1aa;
|
|
1514
1516
|
--authui-success-foreground: #34d399;
|
|
1515
1517
|
--authui-warning-foreground: #fbbf24;
|
|
1516
1518
|
--authui-error-foreground: #f87171;
|
|
@@ -1519,7 +1521,7 @@ const vt = new Rt(), bt = {
|
|
|
1519
1521
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1520
1522
|
color-scheme: dark;
|
|
1521
1523
|
}
|
|
1522
|
-
`,
|
|
1524
|
+
`, zt = T`
|
|
1523
1525
|
*,
|
|
1524
1526
|
*::before,
|
|
1525
1527
|
*::after {
|
|
@@ -1719,6 +1721,32 @@ const vt = new Rt(), bt = {
|
|
|
1719
1721
|
justify-content: space-between;
|
|
1720
1722
|
gap: 8px;
|
|
1721
1723
|
}
|
|
1724
|
+
/* Forgot after password in DOM (tab order); grid keeps it visually beside the label */
|
|
1725
|
+
.field-with-forgot {
|
|
1726
|
+
display: grid;
|
|
1727
|
+
grid-template-columns: 1fr auto;
|
|
1728
|
+
grid-template-areas:
|
|
1729
|
+
"label forgot"
|
|
1730
|
+
"input input"
|
|
1731
|
+
"meta meta";
|
|
1732
|
+
column-gap: 8px;
|
|
1733
|
+
row-gap: 6px;
|
|
1734
|
+
align-items: center;
|
|
1735
|
+
}
|
|
1736
|
+
.field-with-forgot > .label {
|
|
1737
|
+
grid-area: label;
|
|
1738
|
+
}
|
|
1739
|
+
.field-with-forgot > .field-forgot {
|
|
1740
|
+
grid-area: forgot;
|
|
1741
|
+
justify-self: end;
|
|
1742
|
+
}
|
|
1743
|
+
.field-with-forgot > .input-wrap {
|
|
1744
|
+
grid-area: input;
|
|
1745
|
+
}
|
|
1746
|
+
.field-with-forgot > .hint,
|
|
1747
|
+
.field-with-forgot > .strength {
|
|
1748
|
+
grid-area: meta;
|
|
1749
|
+
}
|
|
1722
1750
|
.label {
|
|
1723
1751
|
font-size: 14px;
|
|
1724
1752
|
line-height: 1;
|
|
@@ -1727,7 +1755,8 @@ const vt = new Rt(), bt = {
|
|
|
1727
1755
|
}
|
|
1728
1756
|
.input {
|
|
1729
1757
|
font: inherit;
|
|
1730
|
-
|
|
1758
|
+
/* 16px avoids iOS Safari auto-zoom on focus */
|
|
1759
|
+
font-size: 16px;
|
|
1731
1760
|
height: 36px;
|
|
1732
1761
|
width: 100%;
|
|
1733
1762
|
min-width: 0;
|
|
@@ -1802,8 +1831,9 @@ const vt = new Rt(), bt = {
|
|
|
1802
1831
|
background: var(--authui-muted);
|
|
1803
1832
|
transition: background-color 120ms ease;
|
|
1804
1833
|
}
|
|
1834
|
+
/* destructive-foreground matches light destructive and stays visible on dark card */
|
|
1805
1835
|
.strength-meter[data-level="1"] span:nth-child(-n + 1) {
|
|
1806
|
-
background: var(--authui-destructive);
|
|
1836
|
+
background: var(--authui-destructive-foreground);
|
|
1807
1837
|
}
|
|
1808
1838
|
.strength-meter[data-level="2"] span:nth-child(-n + 2) {
|
|
1809
1839
|
background: var(--authui-warning-foreground);
|
|
@@ -1819,6 +1849,19 @@ const vt = new Rt(), bt = {
|
|
|
1819
1849
|
color: var(--authui-muted-foreground);
|
|
1820
1850
|
margin: 0;
|
|
1821
1851
|
}
|
|
1852
|
+
:host([data-theme="dark"]) .strength-meter span {
|
|
1853
|
+
background: var(--authui-border);
|
|
1854
|
+
}
|
|
1855
|
+
:host([data-theme="dark"]) .strength-meter[data-level="1"] span:nth-child(-n + 1) {
|
|
1856
|
+
background: var(--authui-destructive-foreground);
|
|
1857
|
+
}
|
|
1858
|
+
:host([data-theme="dark"]) .strength-meter[data-level="2"] span:nth-child(-n + 2),
|
|
1859
|
+
:host([data-theme="dark"]) .strength-meter[data-level="3"] span:nth-child(-n + 3) {
|
|
1860
|
+
background: var(--authui-warning-foreground);
|
|
1861
|
+
}
|
|
1862
|
+
:host([data-theme="dark"]) .strength-meter[data-level="4"] span {
|
|
1863
|
+
background: var(--authui-success);
|
|
1864
|
+
}
|
|
1822
1865
|
|
|
1823
1866
|
.btn.last-used {
|
|
1824
1867
|
border-color: var(--authui-brand);
|
|
@@ -1969,7 +2012,7 @@ const vt = new Rt(), bt = {
|
|
|
1969
2012
|
display: inline-flex;
|
|
1970
2013
|
align-items: center;
|
|
1971
2014
|
justify-content: flex-start;
|
|
1972
|
-
height:
|
|
2015
|
+
height: 44px;
|
|
1973
2016
|
width: fit-content;
|
|
1974
2017
|
max-width: 100%;
|
|
1975
2018
|
overflow-x: auto;
|
|
@@ -1980,6 +2023,14 @@ const vt = new Rt(), bt = {
|
|
|
1980
2023
|
gap: 2px;
|
|
1981
2024
|
scrollbar-width: none;
|
|
1982
2025
|
-webkit-overflow-scrolling: touch;
|
|
2026
|
+
/* Subtle right-edge fade as overflow cue at narrow widths */
|
|
2027
|
+
-webkit-mask-image: linear-gradient(
|
|
2028
|
+
to right,
|
|
2029
|
+
#000 0%,
|
|
2030
|
+
#000 calc(100% - 28px),
|
|
2031
|
+
transparent 100%
|
|
2032
|
+
);
|
|
2033
|
+
mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 28px), transparent 100%);
|
|
1983
2034
|
}
|
|
1984
2035
|
:host([data-theme="dark"]) .tabs {
|
|
1985
2036
|
background: color-mix(in oklab, var(--authui-muted) 80%, transparent);
|
|
@@ -1990,8 +2041,9 @@ const vt = new Rt(), bt = {
|
|
|
1990
2041
|
justify-content: center;
|
|
1991
2042
|
gap: 6px;
|
|
1992
2043
|
height: 100%;
|
|
2044
|
+
min-height: 38px;
|
|
1993
2045
|
flex: 0 0 auto;
|
|
1994
|
-
padding:
|
|
2046
|
+
padding: 8px 12px;
|
|
1995
2047
|
border-radius: var(--authui-radius-md);
|
|
1996
2048
|
border: 1px solid transparent;
|
|
1997
2049
|
background: transparent;
|
|
@@ -2522,12 +2574,12 @@ const vt = new Rt(), bt = {
|
|
|
2522
2574
|
}
|
|
2523
2575
|
}
|
|
2524
2576
|
`;
|
|
2525
|
-
var
|
|
2577
|
+
var _t = Object.defineProperty, qt = (e, t, i, s) => {
|
|
2526
2578
|
for (var a = void 0, h = e.length - 1, d; h >= 0; h--)
|
|
2527
2579
|
(d = e[h]) && (a = d(t, i, a) || a);
|
|
2528
|
-
return a &&
|
|
2580
|
+
return a && _t(t, i, a), a;
|
|
2529
2581
|
}, O;
|
|
2530
|
-
const
|
|
2582
|
+
const kt = (O = class extends ot {
|
|
2531
2583
|
constructor() {
|
|
2532
2584
|
super(...arguments), this.auth = l.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2533
2585
|
}
|
|
@@ -2536,7 +2588,7 @@ const xt = (O = class extends nt {
|
|
|
2536
2588
|
for (const t of O.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2537
2589
|
this.auth = l.getState(), this.unsubscribeStore = l.on("change", (t) => {
|
|
2538
2590
|
this.auth = t, this.applyBranding();
|
|
2539
|
-
}), this.unsubscribeTheme =
|
|
2591
|
+
}), this.unsubscribeTheme = bt.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2540
2592
|
}
|
|
2541
2593
|
disconnectedCallback() {
|
|
2542
2594
|
super.disconnectedCallback();
|
|
@@ -2548,7 +2600,7 @@ const xt = (O = class extends nt {
|
|
|
2548
2600
|
}
|
|
2549
2601
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2550
2602
|
t(t, i) {
|
|
2551
|
-
return
|
|
2603
|
+
return Pt(this.strings[t], i);
|
|
2552
2604
|
}
|
|
2553
2605
|
get config() {
|
|
2554
2606
|
return l.getConfig();
|
|
@@ -2558,27 +2610,27 @@ const xt = (O = class extends nt {
|
|
|
2558
2610
|
}
|
|
2559
2611
|
/** Push theme and branding from config onto the host element. */
|
|
2560
2612
|
applyBranding() {
|
|
2561
|
-
const t = this.config?.branding, i =
|
|
2613
|
+
const t = this.config?.branding, i = bt.isDark(t?.theme ?? "auto");
|
|
2562
2614
|
this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
|
|
2563
2615
|
"--authui-primary-foreground",
|
|
2564
2616
|
t.primaryForeground ?? "#ffffff"
|
|
2565
|
-
)), t?.radius &&
|
|
2617
|
+
)), t?.radius && yt[t.radius] && this.style.setProperty("--authui-radius", yt[t.radius]);
|
|
2566
2618
|
}
|
|
2567
2619
|
/** Emit a composed custom event from this element. */
|
|
2568
2620
|
fire(t, i) {
|
|
2569
2621
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2570
2622
|
}
|
|
2571
|
-
}, O.styles = [
|
|
2572
|
-
|
|
2623
|
+
}, O.styles = [Dt, zt], O.KEY_EVENTS = ["keydown", "keyup", "keypress"], O);
|
|
2624
|
+
qt([
|
|
2573
2625
|
c()
|
|
2574
|
-
],
|
|
2575
|
-
let E =
|
|
2576
|
-
var
|
|
2577
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2626
|
+
], kt.prototype, "auth");
|
|
2627
|
+
let E = kt;
|
|
2628
|
+
var Vt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, x = (e, t, i, s) => {
|
|
2629
|
+
for (var a = s > 1 ? void 0 : s ? Nt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
2578
2630
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2579
|
-
return s && a &&
|
|
2631
|
+
return s && a && Vt(t, i, a), a;
|
|
2580
2632
|
};
|
|
2581
|
-
let w = class extends
|
|
2633
|
+
let w = class extends ot {
|
|
2582
2634
|
constructor() {
|
|
2583
2635
|
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 = "";
|
|
2584
2636
|
}
|
|
@@ -2695,42 +2747,42 @@ x([
|
|
|
2695
2747
|
m({ type: String })
|
|
2696
2748
|
], w.prototype, "preview", 2);
|
|
2697
2749
|
w = x([
|
|
2698
|
-
|
|
2750
|
+
D("authui-config")
|
|
2699
2751
|
], w);
|
|
2700
|
-
var
|
|
2701
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2752
|
+
var Bt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, J = (e, t, i, s) => {
|
|
2753
|
+
for (var a = s > 1 ? void 0 : s ? jt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
2702
2754
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2703
|
-
return s && a &&
|
|
2755
|
+
return s && a && Bt(t, i, a), a;
|
|
2704
2756
|
};
|
|
2705
|
-
const
|
|
2706
|
-
let
|
|
2707
|
-
function
|
|
2708
|
-
if (!(typeof document > "u" ||
|
|
2709
|
-
|
|
2757
|
+
const wt = "authui-show:not([ready]){display:none}", de = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
|
|
2758
|
+
let $t = !1;
|
|
2759
|
+
function Ht() {
|
|
2760
|
+
if (!(typeof document > "u" || $t)) {
|
|
2761
|
+
$t = !0;
|
|
2710
2762
|
try {
|
|
2711
2763
|
if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
|
|
2712
2764
|
const e = new CSSStyleSheet();
|
|
2713
|
-
e.replaceSync(
|
|
2765
|
+
e.replaceSync(wt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
|
|
2714
2766
|
return;
|
|
2715
2767
|
}
|
|
2716
2768
|
} catch {
|
|
2717
2769
|
}
|
|
2718
2770
|
if (!document.getElementById("authui-fouc")) {
|
|
2719
2771
|
const e = document.createElement("style");
|
|
2720
|
-
e.id = "authui-fouc", e.textContent =
|
|
2772
|
+
e.id = "authui-fouc", e.textContent = wt, document.head.appendChild(e);
|
|
2721
2773
|
}
|
|
2722
2774
|
}
|
|
2723
2775
|
}
|
|
2724
|
-
|
|
2725
|
-
const
|
|
2726
|
-
function
|
|
2727
|
-
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) =>
|
|
2776
|
+
Ht();
|
|
2777
|
+
const Wt = ["loading", "signed-out", "signed-in", "mfa-required"];
|
|
2778
|
+
function rt(e) {
|
|
2779
|
+
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Wt.includes(t)) : [];
|
|
2728
2780
|
}
|
|
2729
|
-
function
|
|
2730
|
-
const s =
|
|
2781
|
+
function Gt(e, t, i) {
|
|
2782
|
+
const s = rt(t), a = rt(i);
|
|
2731
2783
|
return !(e === "loading" && !s.includes("loading") || s.length > 0 && !s.includes(e) || a.includes(e));
|
|
2732
2784
|
}
|
|
2733
|
-
let
|
|
2785
|
+
let W = class extends ot {
|
|
2734
2786
|
constructor() {
|
|
2735
2787
|
super(...arguments), this.when = "", this.unless = "", this.status = l.getState().status, this.unsubscribe = null;
|
|
2736
2788
|
}
|
|
@@ -2742,27 +2794,27 @@ let H = class extends nt {
|
|
|
2742
2794
|
}
|
|
2743
2795
|
/** Whether the current status satisfies `when` and `unless`. */
|
|
2744
2796
|
get visible() {
|
|
2745
|
-
return
|
|
2797
|
+
return Gt(this.status, this.when, this.unless);
|
|
2746
2798
|
}
|
|
2747
2799
|
updated() {
|
|
2748
|
-
(this.status !== "loading" ||
|
|
2800
|
+
(this.status !== "loading" || rt(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
|
|
2749
2801
|
}
|
|
2750
2802
|
render() {
|
|
2751
2803
|
return this.visible ? r`<slot></slot>` : n;
|
|
2752
2804
|
}
|
|
2753
2805
|
};
|
|
2754
|
-
|
|
2806
|
+
J([
|
|
2755
2807
|
m({ type: String })
|
|
2756
|
-
],
|
|
2757
|
-
|
|
2808
|
+
], W.prototype, "when", 2);
|
|
2809
|
+
J([
|
|
2758
2810
|
m({ type: String })
|
|
2759
|
-
],
|
|
2760
|
-
|
|
2811
|
+
], W.prototype, "unless", 2);
|
|
2812
|
+
J([
|
|
2761
2813
|
c()
|
|
2762
|
-
],
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
],
|
|
2814
|
+
], W.prototype, "status", 2);
|
|
2815
|
+
W = J([
|
|
2816
|
+
D("authui-show")
|
|
2817
|
+
], W);
|
|
2766
2818
|
const Kt = T`
|
|
2767
2819
|
:host {
|
|
2768
2820
|
display: block;
|
|
@@ -2910,7 +2962,7 @@ const Kt = T`
|
|
|
2910
2962
|
qr: b(
|
|
2911
2963
|
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"/>`
|
|
2912
2964
|
)
|
|
2913
|
-
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`,
|
|
2965
|
+
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Yt = {
|
|
2914
2966
|
google: S(
|
|
2915
2967
|
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"/>`
|
|
2916
2968
|
),
|
|
@@ -2966,22 +3018,22 @@ const Kt = T`
|
|
|
2966
3018
|
u`<path fill="#003087" d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.607-.541c-.013.076-.026.175-.041.254-.93 4.778-4.005 7.201-9.138 7.201h-2.19a.563.563 0 0 0-.556.479l-1.187 7.527h-.506l-.24 1.516a.56.56 0 0 0 .554.647h3.882c.46 0 .85-.334.922-.788.06-.26.76-4.852.816-5.09a.932.932 0 0 1 .923-.788h.58c3.76 0 6.705-1.528 7.565-5.946.36-1.847.174-3.388-.777-4.471z"/>`
|
|
2967
3019
|
)
|
|
2968
3020
|
};
|
|
2969
|
-
function
|
|
2970
|
-
return
|
|
3021
|
+
function j(e) {
|
|
3022
|
+
return Yt[e] ?? o.globe;
|
|
2971
3023
|
}
|
|
2972
|
-
function
|
|
3024
|
+
function ct(e) {
|
|
2973
3025
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
2974
3026
|
return /[A-Z0-9]/i.test(t) ? t : o.user;
|
|
2975
3027
|
}
|
|
2976
|
-
function
|
|
3028
|
+
function Q(e) {
|
|
2977
3029
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
2978
3030
|
window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
|
|
2979
3031
|
}));
|
|
2980
3032
|
}
|
|
2981
|
-
function
|
|
3033
|
+
function he() {
|
|
2982
3034
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
|
|
2983
3035
|
}
|
|
2984
|
-
function
|
|
3036
|
+
function at(e) {
|
|
2985
3037
|
const t = {
|
|
2986
3038
|
length: e.length >= 8,
|
|
2987
3039
|
long: e.length >= 12,
|
|
@@ -2997,24 +3049,25 @@ function rt(e) {
|
|
|
2997
3049
|
let s, a;
|
|
2998
3050
|
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 };
|
|
2999
3051
|
}
|
|
3000
|
-
var
|
|
3001
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3052
|
+
var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
|
|
3053
|
+
for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
3002
3054
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3003
|
-
return s && a &&
|
|
3055
|
+
return s && a && Zt(t, i, a), a;
|
|
3004
3056
|
};
|
|
3057
|
+
const R = "authui-error";
|
|
3005
3058
|
let $ = class extends E {
|
|
3006
3059
|
constructor() {
|
|
3007
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) => {
|
|
3008
3061
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3009
|
-
await l.signInWithEmailPassword(this.email, this.password), this.password = "",
|
|
3062
|
+
await l.signInWithEmailPassword(this.email, this.password), this.password = "", q("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
3010
3063
|
});
|
|
3011
3064
|
}, this.onSignUp = (e) => {
|
|
3012
3065
|
e.preventDefault(), this.requireValid(e) && (this.legalErrorFromOAuth = !1, this.ensureLegalAccepted() && this.run(async () => {
|
|
3013
|
-
await l.signUp(this.email, this.password, this.name), this.password = "",
|
|
3066
|
+
await l.signUp(this.email, this.password, this.name), this.password = "", q("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
3014
3067
|
}));
|
|
3015
3068
|
}, this.onGuest = () => {
|
|
3016
3069
|
this.run(async () => {
|
|
3017
|
-
await l.signInAnonymously(),
|
|
3070
|
+
await l.signInAnonymously(), q("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
3018
3071
|
});
|
|
3019
3072
|
}, this.onOAuth = (e) => {
|
|
3020
3073
|
if (this.step === "sign-up" && !this.ensureLegalAccepted()) {
|
|
@@ -3022,8 +3075,8 @@ let $ = class extends E {
|
|
|
3022
3075
|
return;
|
|
3023
3076
|
}
|
|
3024
3077
|
this.legalErrorFromOAuth = !1, this.run(async () => {
|
|
3025
|
-
if (
|
|
3026
|
-
|
|
3078
|
+
if (Rt(e), await l.signInWithOAuth(e), l.isPreview) {
|
|
3079
|
+
xt(), this.fire("authui-success", { method: "oauth" });
|
|
3027
3080
|
return;
|
|
3028
3081
|
}
|
|
3029
3082
|
await new Promise((t) => setTimeout(t, 4e3));
|
|
@@ -3071,7 +3124,7 @@ let $ = class extends E {
|
|
|
3071
3124
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3072
3125
|
const t = this.token;
|
|
3073
3126
|
t && this.run(async () => {
|
|
3074
|
-
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null,
|
|
3127
|
+
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null, q(t.kind), this.fire("authui-success", { method: t.kind });
|
|
3075
3128
|
}, "code");
|
|
3076
3129
|
}, this.onChooseFactor = (e) => {
|
|
3077
3130
|
this.run(async () => {
|
|
@@ -3089,7 +3142,7 @@ let $ = class extends E {
|
|
|
3089
3142
|
try {
|
|
3090
3143
|
await l.signOut();
|
|
3091
3144
|
} catch (e) {
|
|
3092
|
-
if (!
|
|
3145
|
+
if (!H(e, v.sessionNotFound)) throw e;
|
|
3093
3146
|
}
|
|
3094
3147
|
this.go("sign-in");
|
|
3095
3148
|
});
|
|
@@ -3130,7 +3183,7 @@ let $ = class extends E {
|
|
|
3130
3183
|
try {
|
|
3131
3184
|
await e();
|
|
3132
3185
|
} catch (i) {
|
|
3133
|
-
this.error =
|
|
3186
|
+
this.error = Z(i, this.strings, t);
|
|
3134
3187
|
} finally {
|
|
3135
3188
|
this.busy = !1;
|
|
3136
3189
|
}
|
|
@@ -3212,7 +3265,7 @@ let $ = class extends E {
|
|
|
3212
3265
|
`;
|
|
3213
3266
|
}
|
|
3214
3267
|
renderError() {
|
|
3215
|
-
return this.error ? r`<div class="alert alert-error" role="alert">
|
|
3268
|
+
return this.error ? r`<div class="alert alert-error" role="alert" id=${R}>
|
|
3216
3269
|
${o.alert}
|
|
3217
3270
|
<div class="alert-body">${this.error}</div>
|
|
3218
3271
|
</div>` : n;
|
|
@@ -3223,19 +3276,10 @@ let $ = class extends E {
|
|
|
3223
3276
|
</button>`;
|
|
3224
3277
|
}
|
|
3225
3278
|
passwordField(e) {
|
|
3226
|
-
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ?
|
|
3279
|
+
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ? at(t) : null;
|
|
3227
3280
|
return r`
|
|
3228
|
-
<div class="field">
|
|
3229
|
-
<
|
|
3230
|
-
<label class="label" for=${e.id}>${e.label}</label>
|
|
3231
|
-
${e.forgot ? r`<button
|
|
3232
|
-
type="button"
|
|
3233
|
-
class="btn btn-link small"
|
|
3234
|
-
@click=${() => this.go("forgot-password")}
|
|
3235
|
-
>
|
|
3236
|
-
${this.t("forgotPassword")}
|
|
3237
|
-
</button>` : n}
|
|
3238
|
-
</div>
|
|
3281
|
+
<div class="field${e.forgot ? " field-with-forgot" : ""}">
|
|
3282
|
+
<label class="label" for=${e.id}>${e.label}</label>
|
|
3239
3283
|
<div class="input-wrap">
|
|
3240
3284
|
<input
|
|
3241
3285
|
class="input"
|
|
@@ -3246,6 +3290,8 @@ let $ = class extends E {
|
|
|
3246
3290
|
minlength="8"
|
|
3247
3291
|
.value=${t}
|
|
3248
3292
|
@input=${this.bind(e.field)}
|
|
3293
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3294
|
+
aria-describedby=${this.error ? R : n}
|
|
3249
3295
|
/>
|
|
3250
3296
|
<button
|
|
3251
3297
|
type="button"
|
|
@@ -3258,6 +3304,13 @@ let $ = class extends E {
|
|
|
3258
3304
|
${i ? o.eyeOff : o.eye}
|
|
3259
3305
|
</button>
|
|
3260
3306
|
</div>
|
|
3307
|
+
${e.forgot ? r`<button
|
|
3308
|
+
type="button"
|
|
3309
|
+
class="btn btn-link small field-forgot"
|
|
3310
|
+
@click=${() => this.go("forgot-password")}
|
|
3311
|
+
>
|
|
3312
|
+
${this.t("forgotPassword")}
|
|
3313
|
+
</button>` : n}
|
|
3261
3314
|
${s && t ? r`<div class="strength" aria-live="polite">
|
|
3262
3315
|
<div
|
|
3263
3316
|
class="strength-meter"
|
|
@@ -3289,6 +3342,8 @@ let $ = class extends E {
|
|
|
3289
3342
|
inputmode="email"
|
|
3290
3343
|
.value=${this.email}
|
|
3291
3344
|
@input=${this.bind("email")}
|
|
3345
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3346
|
+
aria-describedby=${this.error ? R : n}
|
|
3292
3347
|
/>
|
|
3293
3348
|
</div>
|
|
3294
3349
|
`;
|
|
@@ -3308,6 +3363,8 @@ let $ = class extends E {
|
|
|
3308
3363
|
required
|
|
3309
3364
|
.value=${this.code}
|
|
3310
3365
|
@input=${this.bind("code")}
|
|
3366
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3367
|
+
aria-describedby=${this.error ? R : n}
|
|
3311
3368
|
/>
|
|
3312
3369
|
</div>
|
|
3313
3370
|
`;
|
|
@@ -3331,16 +3388,20 @@ let $ = class extends E {
|
|
|
3331
3388
|
}
|
|
3332
3389
|
/** Required acceptance checkbox on sign-up when legal.requireAcceptance is set. */
|
|
3333
3390
|
legalAcceptField() {
|
|
3334
|
-
|
|
3391
|
+
if (!this.needsLegalAcceptance()) return n;
|
|
3392
|
+
const e = this.error === this.t("errorLegalRequired");
|
|
3393
|
+
return r`<label class="legal-accept">
|
|
3335
3394
|
<input
|
|
3336
3395
|
type="checkbox"
|
|
3337
3396
|
.checked=${this.legalAccepted}
|
|
3338
|
-
|
|
3339
|
-
|
|
3397
|
+
aria-invalid=${e ? "true" : n}
|
|
3398
|
+
aria-describedby=${e ? R : n}
|
|
3399
|
+
@change=${(t) => {
|
|
3400
|
+
this.legalAccepted = t.target.checked, this.legalAccepted && this.error === this.t("errorLegalRequired") && (this.error = "", this.legalErrorFromOAuth = !1);
|
|
3340
3401
|
}}
|
|
3341
3402
|
/>
|
|
3342
3403
|
<span>${this.t("acceptLegal")} ${this.legalLinks()}.</span>
|
|
3343
|
-
</label
|
|
3404
|
+
</label>`;
|
|
3344
3405
|
}
|
|
3345
3406
|
backLink(e = "sign-in") {
|
|
3346
3407
|
return r`<div class="links">
|
|
@@ -3388,7 +3449,7 @@ let $ = class extends E {
|
|
|
3388
3449
|
<div class="stack">
|
|
3389
3450
|
<div class="row">
|
|
3390
3451
|
<div class="inline">
|
|
3391
|
-
<span class="avatar">${
|
|
3452
|
+
<span class="avatar">${ct(t)}</span>
|
|
3392
3453
|
<div class="row-main">
|
|
3393
3454
|
<span class="row-title" title=${t}>${t}</span>
|
|
3394
3455
|
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
|
|
@@ -3403,7 +3464,7 @@ let $ = class extends E {
|
|
|
3403
3464
|
<button
|
|
3404
3465
|
class="btn btn-outline btn-block"
|
|
3405
3466
|
@click=${() => {
|
|
3406
|
-
this.embedded ? this.fire("authui-open", { view: "account" }) :
|
|
3467
|
+
this.embedded ? this.fire("authui-open", { view: "account" }) : Q("account");
|
|
3407
3468
|
}}
|
|
3408
3469
|
>
|
|
3409
3470
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -3418,16 +3479,16 @@ let $ = class extends E {
|
|
|
3418
3479
|
renderProviders() {
|
|
3419
3480
|
const e = [...this.config?.methods?.oauth ?? []];
|
|
3420
3481
|
if (e.length === 0) return n;
|
|
3421
|
-
const t =
|
|
3482
|
+
const t = _(), 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";
|
|
3422
3483
|
if (a === "icon") {
|
|
3423
3484
|
const d = [...e].sort((g, y) => {
|
|
3424
|
-
const C = t === `oauth:${g}` ? 0 : 1,
|
|
3425
|
-
return C -
|
|
3485
|
+
const C = t === `oauth:${g}` ? 0 : 1, et = t === `oauth:${y}` ? 0 : 1;
|
|
3486
|
+
return C - et;
|
|
3426
3487
|
});
|
|
3427
3488
|
return r`
|
|
3428
3489
|
<div class="providers icon">
|
|
3429
3490
|
${d.map((g) => {
|
|
3430
|
-
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider:
|
|
3491
|
+
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider: B(g) });
|
|
3431
3492
|
return r`<button
|
|
3432
3493
|
type="button"
|
|
3433
3494
|
class="btn btn-outline ${y ? "last-used" : ""}"
|
|
@@ -3436,7 +3497,7 @@ let $ = class extends E {
|
|
|
3436
3497
|
aria-label=${y ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3437
3498
|
title=${C}
|
|
3438
3499
|
>
|
|
3439
|
-
${
|
|
3500
|
+
${j(g)}
|
|
3440
3501
|
${y ? r`<span class="oauth-last-used-dot" aria-hidden="true"></span>` : n}
|
|
3441
3502
|
</button>`;
|
|
3442
3503
|
})}
|
|
@@ -3445,13 +3506,13 @@ let $ = class extends E {
|
|
|
3445
3506
|
}
|
|
3446
3507
|
if (a === "stack") {
|
|
3447
3508
|
const d = [...e].sort((g, y) => {
|
|
3448
|
-
const C = t === `oauth:${g}` ? 0 : 1,
|
|
3449
|
-
return C -
|
|
3509
|
+
const C = t === `oauth:${g}` ? 0 : 1, et = t === `oauth:${y}` ? 0 : 1;
|
|
3510
|
+
return C - et;
|
|
3450
3511
|
});
|
|
3451
3512
|
return r`
|
|
3452
3513
|
<div class="providers">
|
|
3453
3514
|
${d.map((g) => {
|
|
3454
|
-
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider:
|
|
3515
|
+
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider: B(g) });
|
|
3455
3516
|
return r`<button
|
|
3456
3517
|
type="button"
|
|
3457
3518
|
class="btn btn-outline ${y ? "last-used" : ""}"
|
|
@@ -3459,7 +3520,7 @@ let $ = class extends E {
|
|
|
3459
3520
|
?disabled=${this.busy}
|
|
3460
3521
|
aria-label=${y ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3461
3522
|
>
|
|
3462
|
-
${
|
|
3523
|
+
${j(g)}
|
|
3463
3524
|
<span>${C}</span>
|
|
3464
3525
|
${y ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3465
3526
|
</button>`;
|
|
@@ -3476,7 +3537,7 @@ let $ = class extends E {
|
|
|
3476
3537
|
}}
|
|
3477
3538
|
>
|
|
3478
3539
|
${e.map((d) => {
|
|
3479
|
-
const g = t === `oauth:${d}`, y = h === d, C = this.t("continueWith", { provider:
|
|
3540
|
+
const g = t === `oauth:${d}`, y = h === d, C = this.t("continueWith", { provider: B(d) });
|
|
3480
3541
|
return r`<div
|
|
3481
3542
|
class="provider-slot ${y ? "is-expanded" : ""}"
|
|
3482
3543
|
@mouseenter=${() => {
|
|
@@ -3493,7 +3554,7 @@ let $ = class extends E {
|
|
|
3493
3554
|
?disabled=${this.busy}
|
|
3494
3555
|
aria-label=${g ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3495
3556
|
>
|
|
3496
|
-
${
|
|
3557
|
+
${j(d)}
|
|
3497
3558
|
<span class="provider-label"
|
|
3498
3559
|
><span><span class="provider-label-text">${C}</span></span></span
|
|
3499
3560
|
>
|
|
@@ -3518,11 +3579,11 @@ let $ = class extends E {
|
|
|
3518
3579
|
${this.renderProviders()}
|
|
3519
3580
|
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : n}
|
|
3520
3581
|
${t ? r`<form
|
|
3521
|
-
class="form ${
|
|
3582
|
+
class="form ${_() === "email-password" ? "last-used-form" : ""}"
|
|
3522
3583
|
@submit=${this.onSignIn}
|
|
3523
3584
|
novalidate
|
|
3524
3585
|
>
|
|
3525
|
-
${
|
|
3586
|
+
${_() === "email-password" ? r`<p class="hint">
|
|
3526
3587
|
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
3527
3588
|
</p>` : n}
|
|
3528
3589
|
${this.emailField()}
|
|
@@ -3531,7 +3592,7 @@ let $ = class extends E {
|
|
|
3531
3592
|
</form>` : this.renderError()}
|
|
3532
3593
|
${s.length > 0 ? r`<div class="stack-sm">
|
|
3533
3594
|
${s.map((a) => {
|
|
3534
|
-
const h =
|
|
3595
|
+
const h = _() === a.step;
|
|
3535
3596
|
return r`<button
|
|
3536
3597
|
type="button"
|
|
3537
3598
|
class="btn btn-secondary btn-block ${h ? "last-used" : ""}"
|
|
@@ -3545,12 +3606,12 @@ let $ = class extends E {
|
|
|
3545
3606
|
</div>` : n}
|
|
3546
3607
|
${e.anonymous ? r`<button
|
|
3547
3608
|
type="button"
|
|
3548
|
-
class="btn btn-ghost btn-block ${
|
|
3609
|
+
class="btn btn-ghost btn-block ${_() === "anonymous" ? "last-used" : ""}"
|
|
3549
3610
|
@click=${this.onGuest}
|
|
3550
3611
|
?disabled=${this.busy}
|
|
3551
3612
|
>
|
|
3552
3613
|
${o.ghost} ${this.t("continueAsGuest")}
|
|
3553
|
-
${
|
|
3614
|
+
${_() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3554
3615
|
</button>` : n}
|
|
3555
3616
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
3556
3617
|
<span>${this.t("noAccount")}</span>
|
|
@@ -3579,6 +3640,8 @@ let $ = class extends E {
|
|
|
3579
3640
|
required
|
|
3580
3641
|
.value=${this.name}
|
|
3581
3642
|
@input=${this.bind("name")}
|
|
3643
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3644
|
+
aria-describedby=${this.error ? R : n}
|
|
3582
3645
|
/>
|
|
3583
3646
|
</div>` : n}
|
|
3584
3647
|
${this.emailField()}
|
|
@@ -3747,6 +3810,8 @@ let $ = class extends E {
|
|
|
3747
3810
|
required
|
|
3748
3811
|
.value=${this.phone}
|
|
3749
3812
|
@input=${this.bind("phone")}
|
|
3813
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3814
|
+
aria-describedby=${this.error ? R : n}
|
|
3750
3815
|
/>
|
|
3751
3816
|
</div>
|
|
3752
3817
|
${this.renderError()} ${this.submitButton(this.t("sendCode"))}
|
|
@@ -3821,6 +3886,8 @@ let $ = class extends E {
|
|
|
3821
3886
|
required
|
|
3822
3887
|
.value=${this.code}
|
|
3823
3888
|
@input=${this.bind("code")}
|
|
3889
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3890
|
+
aria-describedby=${this.error ? R : n}
|
|
3824
3891
|
/>
|
|
3825
3892
|
</div>` : this.codeField()}
|
|
3826
3893
|
${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
|
|
@@ -3879,7 +3946,7 @@ k([
|
|
|
3879
3946
|
c()
|
|
3880
3947
|
], $.prototype, "recovery", 2);
|
|
3881
3948
|
k([
|
|
3882
|
-
|
|
3949
|
+
nt("form input:not([type=hidden])")
|
|
3883
3950
|
], $.prototype, "firstInput", 2);
|
|
3884
3951
|
k([
|
|
3885
3952
|
c()
|
|
@@ -3894,12 +3961,12 @@ k([
|
|
|
3894
3961
|
c()
|
|
3895
3962
|
], $.prototype, "legalErrorFromOAuth", 2);
|
|
3896
3963
|
$ = k([
|
|
3897
|
-
|
|
3964
|
+
D("authui-sign-in")
|
|
3898
3965
|
], $);
|
|
3899
|
-
var
|
|
3900
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3966
|
+
var Qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, f = (e, t, i, s) => {
|
|
3967
|
+
for (var a = s > 1 ? void 0 : s ? Jt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
3901
3968
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3902
|
-
return s && a &&
|
|
3969
|
+
return s && a && Qt(t, i, a), a;
|
|
3903
3970
|
};
|
|
3904
3971
|
let p = class extends E {
|
|
3905
3972
|
constructor() {
|
|
@@ -4007,7 +4074,7 @@ let p = class extends E {
|
|
|
4007
4074
|
try {
|
|
4008
4075
|
this.recoveryCodes = await l.createRecoveryCodes();
|
|
4009
4076
|
} catch (e) {
|
|
4010
|
-
if (!
|
|
4077
|
+
if (!H(e, v.recoveryCodesExist)) throw e;
|
|
4011
4078
|
this.recoveryCodes = await l.getRecoveryCodes();
|
|
4012
4079
|
}
|
|
4013
4080
|
await this.loadFactors();
|
|
@@ -4130,9 +4197,9 @@ let p = class extends E {
|
|
|
4130
4197
|
try {
|
|
4131
4198
|
await t(), i && this.setNotice("success", i);
|
|
4132
4199
|
} catch (s) {
|
|
4133
|
-
|
|
4200
|
+
H(s, v.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
|
|
4134
4201
|
...this.errors,
|
|
4135
|
-
[e]:
|
|
4202
|
+
[e]: Z(
|
|
4136
4203
|
s,
|
|
4137
4204
|
this.strings,
|
|
4138
4205
|
e.includes("code") ? "code" : e === "password" ? "password" : "link"
|
|
@@ -4287,7 +4354,7 @@ let p = class extends E {
|
|
|
4287
4354
|
return r`
|
|
4288
4355
|
<div class="between">
|
|
4289
4356
|
<div class="identity">
|
|
4290
|
-
<span class="avatar">${
|
|
4357
|
+
<span class="avatar">${ct(t)}</span>
|
|
4291
4358
|
<div class="row-main">
|
|
4292
4359
|
<span class="row-title" title=${t}>
|
|
4293
4360
|
${t}
|
|
@@ -4412,7 +4479,7 @@ let p = class extends E {
|
|
|
4412
4479
|
autocomplete="new-password"
|
|
4413
4480
|
/>
|
|
4414
4481
|
${this.emailPassword ? (() => {
|
|
4415
|
-
const t =
|
|
4482
|
+
const t = at(this.emailPassword);
|
|
4416
4483
|
return r`<div class="strength" aria-live="polite">
|
|
4417
4484
|
<div
|
|
4418
4485
|
class="strength-meter"
|
|
@@ -4707,7 +4774,7 @@ let p = class extends E {
|
|
|
4707
4774
|
</button>
|
|
4708
4775
|
</div>
|
|
4709
4776
|
${this.newPassword ? (() => {
|
|
4710
|
-
const i =
|
|
4777
|
+
const i = at(this.newPassword);
|
|
4711
4778
|
return r`<div class="strength" aria-live="polite">
|
|
4712
4779
|
<div
|
|
4713
4780
|
class="strength-meter"
|
|
@@ -4766,7 +4833,7 @@ let p = class extends E {
|
|
|
4766
4833
|
</div>`;
|
|
4767
4834
|
}
|
|
4768
4835
|
renderMfaCard() {
|
|
4769
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ?
|
|
4836
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ? Mt(this.authenticator.uri) : new St(l.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4770
4837
|
return this.card(
|
|
4771
4838
|
this.t("twoFactor"),
|
|
4772
4839
|
this.t("twoFactorDescription"),
|
|
@@ -5110,9 +5177,9 @@ let p = class extends E {
|
|
|
5110
5177
|
) : e.map(
|
|
5111
5178
|
(i) => r`<div class="row">
|
|
5112
5179
|
<div class="inline">
|
|
5113
|
-
<span class="device">${
|
|
5180
|
+
<span class="device">${j(i.provider)}</span>
|
|
5114
5181
|
<div class="row-main">
|
|
5115
|
-
<span class="row-title">${
|
|
5182
|
+
<span class="row-title">${B(i.provider)}</span>
|
|
5116
5183
|
<span class="row-sub">${i.providerEmail || i.providerUid}</span>
|
|
5117
5184
|
</div>
|
|
5118
5185
|
</div>
|
|
@@ -5155,8 +5222,8 @@ let p = class extends E {
|
|
|
5155
5222
|
}}
|
|
5156
5223
|
?disabled=${!!this.busy}
|
|
5157
5224
|
>
|
|
5158
|
-
${this.spinner(`connect-${i}`)} ${
|
|
5159
|
-
${this.t("connectProvider", { provider:
|
|
5225
|
+
${this.spinner(`connect-${i}`)} ${j(i)}
|
|
5226
|
+
${this.t("connectProvider", { provider: B(i) })}
|
|
5160
5227
|
</button>`
|
|
5161
5228
|
)}` : void 0
|
|
5162
5229
|
)}
|
|
@@ -5401,12 +5468,12 @@ f([
|
|
|
5401
5468
|
c()
|
|
5402
5469
|
], p.prototype, "verifyPhoneCooldownUntil", 2);
|
|
5403
5470
|
p = f([
|
|
5404
|
-
|
|
5471
|
+
D("authui-account")
|
|
5405
5472
|
], p);
|
|
5406
|
-
var
|
|
5407
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5473
|
+
var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
|
|
5474
|
+
for (var a = s > 1 ? void 0 : s ? ee(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5408
5475
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5409
|
-
return s && a &&
|
|
5476
|
+
return s && a && te(t, i, a), a;
|
|
5410
5477
|
};
|
|
5411
5478
|
let I = class extends E {
|
|
5412
5479
|
constructor() {
|
|
@@ -5516,9 +5583,11 @@ I.styles = [
|
|
|
5516
5583
|
background: var(--authui-background);
|
|
5517
5584
|
color: var(--authui-foreground);
|
|
5518
5585
|
padding: 0;
|
|
5519
|
-
width: calc(100% - 2rem);
|
|
5586
|
+
width: calc(100% - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
|
|
5520
5587
|
max-width: 440px;
|
|
5521
|
-
max-height: calc(
|
|
5588
|
+
max-height: calc(
|
|
5589
|
+
100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
|
|
5590
|
+
);
|
|
5522
5591
|
box-shadow: var(--authui-shadow-lg);
|
|
5523
5592
|
overflow: hidden;
|
|
5524
5593
|
z-index: var(--authui-z);
|
|
@@ -5546,7 +5615,9 @@ I.styles = [
|
|
|
5546
5615
|
.frame {
|
|
5547
5616
|
display: flex;
|
|
5548
5617
|
flex-direction: column;
|
|
5549
|
-
max-height: calc(
|
|
5618
|
+
max-height: calc(
|
|
5619
|
+
100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
|
|
5620
|
+
);
|
|
5550
5621
|
min-height: 0;
|
|
5551
5622
|
position: relative;
|
|
5552
5623
|
}
|
|
@@ -5555,11 +5626,13 @@ I.styles = [
|
|
|
5555
5626
|
display: flex;
|
|
5556
5627
|
justify-content: flex-end;
|
|
5557
5628
|
align-items: center;
|
|
5558
|
-
padding: 8px 8px 0
|
|
5629
|
+
padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 0
|
|
5630
|
+
max(8px, env(safe-area-inset-left, 0px));
|
|
5559
5631
|
background: var(--authui-background);
|
|
5560
5632
|
}
|
|
5561
5633
|
.body {
|
|
5562
|
-
padding: 4px 24px
|
|
5634
|
+
padding: 4px max(24px, env(safe-area-inset-right, 0px))
|
|
5635
|
+
max(28px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
|
|
5563
5636
|
overflow-y: auto;
|
|
5564
5637
|
flex: 1 1 auto;
|
|
5565
5638
|
min-height: 0;
|
|
@@ -5594,13 +5667,13 @@ I.styles = [
|
|
|
5594
5667
|
}
|
|
5595
5668
|
`
|
|
5596
5669
|
];
|
|
5597
|
-
|
|
5670
|
+
L([
|
|
5598
5671
|
m({ type: Boolean, reflect: !0 })
|
|
5599
5672
|
], I.prototype, "open", 2);
|
|
5600
|
-
|
|
5673
|
+
L([
|
|
5601
5674
|
m({ type: String })
|
|
5602
5675
|
], I.prototype, "view", 2);
|
|
5603
|
-
|
|
5676
|
+
L([
|
|
5604
5677
|
m({
|
|
5605
5678
|
attribute: "close-on-success",
|
|
5606
5679
|
reflect: !0,
|
|
@@ -5616,27 +5689,27 @@ R([
|
|
|
5616
5689
|
}
|
|
5617
5690
|
})
|
|
5618
5691
|
], I.prototype, "closeOnSuccess", 2);
|
|
5619
|
-
|
|
5692
|
+
L([
|
|
5620
5693
|
c()
|
|
5621
5694
|
], I.prototype, "handledPending", 2);
|
|
5622
|
-
|
|
5695
|
+
L([
|
|
5623
5696
|
c()
|
|
5624
5697
|
], I.prototype, "scrollCue", 2);
|
|
5625
|
-
|
|
5626
|
-
|
|
5698
|
+
L([
|
|
5699
|
+
nt("dialog")
|
|
5627
5700
|
], I.prototype, "dialog", 2);
|
|
5628
|
-
|
|
5629
|
-
|
|
5701
|
+
L([
|
|
5702
|
+
nt(".body")
|
|
5630
5703
|
], I.prototype, "bodyEl", 2);
|
|
5631
|
-
I =
|
|
5632
|
-
|
|
5704
|
+
I = L([
|
|
5705
|
+
D("authui-modal")
|
|
5633
5706
|
], I);
|
|
5634
|
-
var
|
|
5635
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5707
|
+
var ie = Object.defineProperty, se = Object.getOwnPropertyDescriptor, tt = (e, t, i, s) => {
|
|
5708
|
+
for (var a = s > 1 ? void 0 : s ? se(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5636
5709
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5637
|
-
return s && a &&
|
|
5710
|
+
return s && a && ie(t, i, a), a;
|
|
5638
5711
|
};
|
|
5639
|
-
let
|
|
5712
|
+
let N = class extends E {
|
|
5640
5713
|
constructor() {
|
|
5641
5714
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
5642
5715
|
}
|
|
@@ -5644,7 +5717,7 @@ let V = class extends E {
|
|
|
5644
5717
|
const e = this.size === "md" ? "" : `btn-${this.size}`;
|
|
5645
5718
|
return r`<button
|
|
5646
5719
|
class="btn btn-${this.variant} ${e}"
|
|
5647
|
-
@click=${() =>
|
|
5720
|
+
@click=${() => Q(this.view)}
|
|
5648
5721
|
part="button"
|
|
5649
5722
|
>
|
|
5650
5723
|
<slot
|
|
@@ -5653,7 +5726,7 @@ let V = class extends E {
|
|
|
5653
5726
|
</button>`;
|
|
5654
5727
|
}
|
|
5655
5728
|
};
|
|
5656
|
-
|
|
5729
|
+
N.styles = [
|
|
5657
5730
|
...E.styles,
|
|
5658
5731
|
T`
|
|
5659
5732
|
:host {
|
|
@@ -5664,22 +5737,22 @@ V.styles = [
|
|
|
5664
5737
|
}
|
|
5665
5738
|
`
|
|
5666
5739
|
];
|
|
5667
|
-
|
|
5740
|
+
tt([
|
|
5668
5741
|
m({ type: String })
|
|
5669
|
-
],
|
|
5670
|
-
|
|
5742
|
+
], N.prototype, "view", 2);
|
|
5743
|
+
tt([
|
|
5671
5744
|
m({ type: String })
|
|
5672
|
-
],
|
|
5673
|
-
|
|
5745
|
+
], N.prototype, "variant", 2);
|
|
5746
|
+
tt([
|
|
5674
5747
|
m({ type: String })
|
|
5675
|
-
],
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
],
|
|
5679
|
-
var
|
|
5680
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5748
|
+
], N.prototype, "size", 2);
|
|
5749
|
+
N = tt([
|
|
5750
|
+
D("authui-button")
|
|
5751
|
+
], N);
|
|
5752
|
+
var re = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, F = (e, t, i, s) => {
|
|
5753
|
+
for (var a = s > 1 ? void 0 : s ? ae(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5681
5754
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5682
|
-
return s && a &&
|
|
5755
|
+
return s && a && re(t, i, a), a;
|
|
5683
5756
|
};
|
|
5684
5757
|
let U = class extends E {
|
|
5685
5758
|
constructor() {
|
|
@@ -5756,7 +5829,7 @@ let U = class extends E {
|
|
|
5756
5829
|
if (e === "loading" && i)
|
|
5757
5830
|
return r`<span class="avatar"><span class="spinner"></span></span>`;
|
|
5758
5831
|
if (e !== "signed-in" || !t)
|
|
5759
|
-
return r`<button class="btn btn-primary btn-sm" @click=${() =>
|
|
5832
|
+
return r`<button class="btn btn-primary btn-sm" @click=${() => Q("sign-in")}>
|
|
5760
5833
|
<slot>${this.t("signIn")}</slot>
|
|
5761
5834
|
</button>`;
|
|
5762
5835
|
const s = t.name || t.email || t.phone || this.t("guestAccount");
|
|
@@ -5769,7 +5842,7 @@ let U = class extends E {
|
|
|
5769
5842
|
aria-label=${s}
|
|
5770
5843
|
>
|
|
5771
5844
|
<span class="avatar"
|
|
5772
|
-
>${this.src ? r`<img src=${this.src} alt="" />` :
|
|
5845
|
+
>${this.src ? r`<img src=${this.src} alt="" />` : ct(s)}</span
|
|
5773
5846
|
>
|
|
5774
5847
|
</button>
|
|
5775
5848
|
${this.menuOpen ? r`<div class="menu ${this.menuAbove ? "above" : ""}" role="menu">
|
|
@@ -5800,7 +5873,7 @@ let U = class extends E {
|
|
|
5800
5873
|
class="menu-item"
|
|
5801
5874
|
role="menuitem"
|
|
5802
5875
|
@click=${() => {
|
|
5803
|
-
this.menuOpen = !1,
|
|
5876
|
+
this.menuOpen = !1, Q("account");
|
|
5804
5877
|
}}
|
|
5805
5878
|
>
|
|
5806
5879
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -6001,38 +6074,38 @@ F([
|
|
|
6001
6074
|
c()
|
|
6002
6075
|
], U.prototype, "activeTeamId", 2);
|
|
6003
6076
|
U = F([
|
|
6004
|
-
|
|
6077
|
+
D("authui-user-button")
|
|
6005
6078
|
], U);
|
|
6006
6079
|
export {
|
|
6007
6080
|
Tt as A,
|
|
6008
|
-
|
|
6081
|
+
de as C,
|
|
6009
6082
|
v as E,
|
|
6010
|
-
|
|
6011
|
-
|
|
6083
|
+
wt as F,
|
|
6084
|
+
Et as P,
|
|
6012
6085
|
l as a,
|
|
6013
6086
|
p as b,
|
|
6014
|
-
|
|
6015
|
-
|
|
6087
|
+
he as c,
|
|
6088
|
+
N as d,
|
|
6016
6089
|
w as e,
|
|
6017
6090
|
E as f,
|
|
6018
6091
|
I as g,
|
|
6019
|
-
|
|
6092
|
+
W as h,
|
|
6020
6093
|
$ as i,
|
|
6021
6094
|
U as j,
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6095
|
+
ce as k,
|
|
6096
|
+
mt as l,
|
|
6097
|
+
At as m,
|
|
6098
|
+
Z as n,
|
|
6099
|
+
Q as o,
|
|
6100
|
+
_ as p,
|
|
6101
|
+
ft as q,
|
|
6102
|
+
Ot as r,
|
|
6103
|
+
B as s,
|
|
6104
|
+
q as t,
|
|
6105
|
+
xt as u,
|
|
6106
|
+
at as v,
|
|
6107
|
+
Ft as w,
|
|
6108
|
+
Rt as x,
|
|
6109
|
+
V as y,
|
|
6110
|
+
Gt as z
|
|
6038
6111
|
};
|