@yackey-labs/yauth-ui-solidjs 0.1.0 → 0.3.0
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/dist/index.js +636 -558
- package/package.json +7 -3
- package/src/components/change-password-form.tsx +6 -1
- package/src/components/forgot-password-form.tsx +5 -3
- package/src/components/login-form.tsx +6 -8
- package/src/components/magic-link-form.tsx +5 -3
- package/src/components/mfa-challenge.tsx +7 -5
- package/src/components/mfa-setup.tsx +6 -2
- package/src/components/oauth-buttons.tsx +3 -1
- package/src/components/passkey-button.tsx +20 -9
- package/src/components/profile-settings.tsx +245 -230
- package/src/components/register-form.tsx +3 -1
- package/src/components/reset-password-form.tsx +6 -4
- package/src/components/verify-email.tsx +3 -1
- package/src/index.ts +1 -0
- package/src/provider.tsx +53 -15
package/dist/index.js
CHANGED
|
@@ -1,102 +1,128 @@
|
|
|
1
|
-
import { createComponent as g, delegateEvents as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { startAuthentication as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { createComponent as g, delegateEvents as K, insert as e, Show as y, effect as C, template as i, memo as fe, addEventListener as ie } from "solid-js/web";
|
|
2
|
+
import { createContext as we, createSignal as a, createResource as oe, createEffect as ae, Show as $e, useContext as _e, For as te } from "solid-js";
|
|
3
|
+
import { startAuthentication as Se, startRegistration as ke } from "@simplewebauthn/browser";
|
|
4
|
+
const pe = we(), jt = (r) => {
|
|
5
|
+
if (!r.client && !r.baseUrl)
|
|
6
|
+
throw new Error("YAuthProvider requires either a `client` or `baseUrl` prop");
|
|
7
|
+
const [k, b] = a(r.client ?? null);
|
|
8
|
+
if (!r.client && r.baseUrl) {
|
|
9
|
+
const f = r.baseUrl;
|
|
10
|
+
import("@yackey-labs/yauth-client").then((x) => {
|
|
11
|
+
b(() => x.createYAuthClient({
|
|
12
|
+
baseUrl: f
|
|
13
|
+
}));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
let p = null;
|
|
17
|
+
const [v, {
|
|
7
18
|
refetch: h
|
|
8
|
-
}] =
|
|
19
|
+
}] = oe(async () => {
|
|
20
|
+
const f = k();
|
|
21
|
+
if (!f) return null;
|
|
9
22
|
try {
|
|
10
|
-
return
|
|
23
|
+
return await f.getSession();
|
|
11
24
|
} catch {
|
|
12
25
|
return null;
|
|
13
26
|
}
|
|
14
27
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
ae(() => {
|
|
29
|
+
k() && h();
|
|
30
|
+
}), ae(() => {
|
|
31
|
+
if (!v.loading && p) {
|
|
32
|
+
const x = p;
|
|
33
|
+
p = null, x(v() ?? null);
|
|
19
34
|
}
|
|
20
35
|
});
|
|
21
|
-
const $ = () => new Promise((
|
|
22
|
-
|
|
36
|
+
const $ = () => new Promise((f) => {
|
|
37
|
+
p = f, h();
|
|
23
38
|
});
|
|
24
|
-
return g(
|
|
25
|
-
get
|
|
26
|
-
return
|
|
27
|
-
client: r.client,
|
|
28
|
-
user: () => f(),
|
|
29
|
-
loading: () => f.loading,
|
|
30
|
-
refetch: $
|
|
31
|
-
};
|
|
39
|
+
return g($e, {
|
|
40
|
+
get when() {
|
|
41
|
+
return k();
|
|
32
42
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
fallback: null,
|
|
44
|
+
children: (f) => g(pe.Provider, {
|
|
45
|
+
get value() {
|
|
46
|
+
return {
|
|
47
|
+
client: f(),
|
|
48
|
+
user: () => v(),
|
|
49
|
+
loading: () => v.loading,
|
|
50
|
+
refetch: $
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
get children() {
|
|
54
|
+
return r.children;
|
|
55
|
+
}
|
|
56
|
+
})
|
|
36
57
|
});
|
|
37
58
|
};
|
|
38
|
-
function
|
|
39
|
-
const r =
|
|
59
|
+
function Y() {
|
|
60
|
+
const r = _e(pe);
|
|
40
61
|
if (!r)
|
|
41
62
|
throw new Error("useYAuth must be used within a <YAuthProvider>");
|
|
42
63
|
return r;
|
|
43
64
|
}
|
|
44
|
-
var
|
|
45
|
-
const
|
|
65
|
+
var Ce = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ee = /* @__PURE__ */ i('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">Password changed successfully.'), Pe = /* @__PURE__ */ i('<form class=space-y-4><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-current-password>Current password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-current-password name=current_password type=password required autocomplete=current-password></div><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-new-password>New password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-new-password name=new_password type=password required autocomplete=new-password></div><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-confirm-password>Confirm new password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-confirm-password name=confirm_password type=password required autocomplete=new-password></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
66
|
+
const Ft = (r) => {
|
|
46
67
|
const {
|
|
47
|
-
client:
|
|
48
|
-
} =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
client: k
|
|
69
|
+
} = Y(), b = k?.emailPassword;
|
|
70
|
+
if (!b) return null;
|
|
71
|
+
const [p, v] = a(""), [h, $] = a(""), [f, x] = a(""), [d, l] = a(null), [m, s] = a(!1), [t, c] = a(!1), n = async (u) => {
|
|
72
|
+
u.preventDefault(), l(null), s(!1);
|
|
73
|
+
const o = u.currentTarget, P = new FormData(o), w = P.get("current_password") || p(), _ = P.get("new_password") || h(), S = P.get("confirm_password") || f();
|
|
74
|
+
if (_ !== S) {
|
|
75
|
+
l("Passwords do not match");
|
|
53
76
|
return;
|
|
54
77
|
}
|
|
55
78
|
c(!0);
|
|
56
79
|
try {
|
|
57
|
-
await
|
|
80
|
+
await b.changePassword({
|
|
81
|
+
current_password: w,
|
|
82
|
+
new_password: _
|
|
83
|
+
}), s(!0), v(""), $(""), x(""), r.onSuccess?.();
|
|
58
84
|
} catch (L) {
|
|
59
|
-
const
|
|
60
|
-
|
|
85
|
+
const R = L instanceof Error ? L : new Error(String(L));
|
|
86
|
+
l(R.message), r.onError?.(R);
|
|
61
87
|
} finally {
|
|
62
88
|
c(!1);
|
|
63
89
|
}
|
|
64
90
|
};
|
|
65
91
|
return (() => {
|
|
66
|
-
var
|
|
67
|
-
return
|
|
92
|
+
var u = Pe(), o = u.firstChild, P = o.firstChild, w = P.nextSibling, _ = o.nextSibling, S = _.firstChild, L = S.nextSibling, R = _.nextSibling, O = R.firstChild, D = O.nextSibling, G = R.nextSibling;
|
|
93
|
+
return u.addEventListener("submit", n), e(u, g(y, {
|
|
68
94
|
get when() {
|
|
69
|
-
return
|
|
95
|
+
return d();
|
|
70
96
|
},
|
|
71
97
|
get children() {
|
|
72
|
-
var
|
|
73
|
-
return e(
|
|
98
|
+
var A = Ce();
|
|
99
|
+
return e(A, d), A;
|
|
74
100
|
}
|
|
75
|
-
}), o), e(
|
|
101
|
+
}), o), e(u, g(y, {
|
|
76
102
|
get when() {
|
|
77
103
|
return m();
|
|
78
104
|
},
|
|
79
105
|
get children() {
|
|
80
|
-
return
|
|
106
|
+
return Ee();
|
|
81
107
|
}
|
|
82
|
-
}), o),
|
|
83
|
-
var
|
|
84
|
-
return
|
|
108
|
+
}), o), w.$$input = (A) => v(A.currentTarget.value), L.$$input = (A) => $(A.currentTarget.value), D.$$input = (A) => x(A.currentTarget.value), e(G, () => t() ? "Changing password..." : "Change password"), C((A) => {
|
|
109
|
+
var I = t(), z = t(), Z = t(), H = t();
|
|
110
|
+
return I !== A.e && (w.disabled = A.e = I), z !== A.t && (L.disabled = A.t = z), Z !== A.a && (D.disabled = A.a = Z), H !== A.o && (G.disabled = A.o = H), A;
|
|
85
111
|
}, {
|
|
86
112
|
e: void 0,
|
|
87
113
|
t: void 0,
|
|
88
114
|
a: void 0,
|
|
89
115
|
o: void 0
|
|
90
|
-
}),
|
|
116
|
+
}), C(() => w.value = p()), C(() => L.value = h()), C(() => D.value = f()), u;
|
|
91
117
|
})();
|
|
92
118
|
};
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
const
|
|
96
|
-
const [
|
|
97
|
-
|
|
119
|
+
K(["input"]);
|
|
120
|
+
var De = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ae = /* @__PURE__ */ i('<div class="rounded-md border p-4 space-y-3"><p class="text-sm font-medium">This application is requesting the following permissions:</p><ul class=space-y-2>'), Te = /* @__PURE__ */ i('<div class="mx-auto max-w-md space-y-6 p-6"><div class="space-y-2 text-center"><h2 class="text-2xl font-semibold tracking-tight">Authorize </h2><p class="text-sm text-muted-foreground"><strong></strong> is requesting access to your account.</p></div><div class="flex gap-3"><button class="inline-flex h-9 flex-1 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>Deny</button><button class="inline-flex h-9 flex-1 cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button></button></div><p class="text-center text-xs text-muted-foreground">By authorizing, you allow this application to access your account with the permissions listed above.'), Le = /* @__PURE__ */ i('<li class="flex items-center gap-2 text-sm"><svg class="h-4 w-4 text-primary"fill=none stroke=currentColor viewBox="0 0 24 24"aria-label=Checkmark role=img><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span>');
|
|
121
|
+
const Mt = (r) => {
|
|
122
|
+
const [k, b] = a(!1), [p, v] = a(null), h = async (f) => {
|
|
123
|
+
v(null), b(!0);
|
|
98
124
|
try {
|
|
99
|
-
const
|
|
125
|
+
const x = r.authBaseUrl ?? "/api/auth", d = await fetch(`${x}/authorize`, {
|
|
100
126
|
method: "POST",
|
|
101
127
|
headers: {
|
|
102
128
|
"Content-Type": "application/json"
|
|
@@ -110,800 +136,852 @@ const Pt = (r) => {
|
|
|
110
136
|
code_challenge_method: r.codeChallengeMethod,
|
|
111
137
|
scope: r.scopes?.join(" "),
|
|
112
138
|
state: r.state,
|
|
113
|
-
approved:
|
|
139
|
+
approved: f
|
|
114
140
|
})
|
|
115
141
|
});
|
|
116
|
-
if (
|
|
117
|
-
window.location.href =
|
|
142
|
+
if (d.redirected) {
|
|
143
|
+
window.location.href = d.url;
|
|
118
144
|
return;
|
|
119
145
|
}
|
|
120
|
-
if (!
|
|
121
|
-
const
|
|
122
|
-
throw new Error(
|
|
146
|
+
if (!d.ok) {
|
|
147
|
+
const m = await d.json().catch(() => null);
|
|
148
|
+
throw new Error(m?.error_description ?? m?.error ?? "Authorization failed");
|
|
123
149
|
}
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
window.location.href =
|
|
150
|
+
const l = d.headers.get("Location");
|
|
151
|
+
if (l) {
|
|
152
|
+
window.location.href = l;
|
|
127
153
|
return;
|
|
128
154
|
}
|
|
129
|
-
r.onSubmit?.(
|
|
130
|
-
} catch (
|
|
131
|
-
const
|
|
132
|
-
|
|
155
|
+
r.onSubmit?.(f);
|
|
156
|
+
} catch (x) {
|
|
157
|
+
const d = x instanceof Error ? x : new Error(String(x));
|
|
158
|
+
v(d.message), r.onError?.(d);
|
|
133
159
|
} finally {
|
|
134
|
-
|
|
160
|
+
b(!1);
|
|
135
161
|
}
|
|
136
|
-
},
|
|
162
|
+
}, $ = () => r.clientName ?? r.clientId;
|
|
137
163
|
return (() => {
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
var
|
|
141
|
-
return e(
|
|
164
|
+
var f = Te(), x = f.firstChild, d = x.firstChild;
|
|
165
|
+
d.firstChild;
|
|
166
|
+
var l = d.nextSibling, m = l.firstChild, s = x.nextSibling, t = s.firstChild, c = t.nextSibling;
|
|
167
|
+
return e(d, $, null), e(m, $), e(f, g(y, {
|
|
142
168
|
get when() {
|
|
143
|
-
return
|
|
169
|
+
return p();
|
|
144
170
|
},
|
|
145
171
|
get children() {
|
|
146
|
-
var
|
|
147
|
-
return e(
|
|
172
|
+
var n = De();
|
|
173
|
+
return e(n, p), n;
|
|
148
174
|
}
|
|
149
|
-
}),
|
|
175
|
+
}), s), e(f, g(y, {
|
|
150
176
|
get when() {
|
|
151
|
-
return
|
|
177
|
+
return fe(() => !!r.scopes)() && r.scopes.length > 0;
|
|
152
178
|
},
|
|
153
179
|
get children() {
|
|
154
|
-
var
|
|
155
|
-
return e(
|
|
180
|
+
var n = Ae(), u = n.firstChild, o = u.nextSibling;
|
|
181
|
+
return e(o, g(te, {
|
|
156
182
|
get each() {
|
|
157
183
|
return r.scopes;
|
|
158
184
|
},
|
|
159
|
-
children: (
|
|
160
|
-
var
|
|
161
|
-
return e(
|
|
185
|
+
children: (P) => (() => {
|
|
186
|
+
var w = Le(), _ = w.firstChild, S = _.nextSibling;
|
|
187
|
+
return e(S, P), w;
|
|
162
188
|
})()
|
|
163
|
-
})),
|
|
189
|
+
})), n;
|
|
164
190
|
}
|
|
165
|
-
}),
|
|
166
|
-
var
|
|
167
|
-
return
|
|
191
|
+
}), s), t.$$click = () => h(!1), c.$$click = () => h(!0), e(c, () => k() ? "Authorizing..." : "Authorize"), C((n) => {
|
|
192
|
+
var u = k(), o = k();
|
|
193
|
+
return u !== n.e && (t.disabled = n.e = u), o !== n.t && (c.disabled = n.t = o), n;
|
|
168
194
|
}, {
|
|
169
195
|
e: void 0,
|
|
170
196
|
t: void 0
|
|
171
|
-
}),
|
|
197
|
+
}), f;
|
|
172
198
|
})();
|
|
173
199
|
};
|
|
174
|
-
|
|
175
|
-
var
|
|
176
|
-
const
|
|
200
|
+
K(["click"]);
|
|
201
|
+
var je = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Fe = /* @__PURE__ */ i('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), Me = /* @__PURE__ */ i('<form class=space-y-4><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-forgot-password-email>Email</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-forgot-password-email name=email type=email required autocomplete=email></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
202
|
+
const Rt = (r) => {
|
|
177
203
|
const {
|
|
178
|
-
client:
|
|
179
|
-
} =
|
|
180
|
-
|
|
204
|
+
client: k
|
|
205
|
+
} = Y(), b = k?.emailPassword;
|
|
206
|
+
if (!b) return null;
|
|
207
|
+
const [p, v] = a(""), [h, $] = a(null), [f, x] = a(null), [d, l] = a(!1), m = async (s) => {
|
|
208
|
+
s.preventDefault(), $(null), x(null), l(!0);
|
|
181
209
|
try {
|
|
182
|
-
const t =
|
|
183
|
-
|
|
210
|
+
const t = s.currentTarget, c = new FormData(t), n = await b.forgotPassword({
|
|
211
|
+
email: c.get("email") || p()
|
|
212
|
+
});
|
|
213
|
+
x(n.message), r.onSuccess?.(n.message);
|
|
184
214
|
} catch (t) {
|
|
185
215
|
const c = t instanceof Error ? t : new Error(String(t));
|
|
186
|
-
|
|
216
|
+
$(c.message);
|
|
187
217
|
} finally {
|
|
188
|
-
|
|
218
|
+
l(!1);
|
|
189
219
|
}
|
|
190
220
|
};
|
|
191
221
|
return (() => {
|
|
192
|
-
var
|
|
193
|
-
return
|
|
222
|
+
var s = Me(), t = s.firstChild, c = t.firstChild, n = c.nextSibling, u = t.nextSibling;
|
|
223
|
+
return s.addEventListener("submit", m), e(s, g(y, {
|
|
194
224
|
get when() {
|
|
195
|
-
return
|
|
225
|
+
return h();
|
|
196
226
|
},
|
|
197
227
|
get children() {
|
|
198
|
-
var o =
|
|
199
|
-
return e(o,
|
|
228
|
+
var o = je();
|
|
229
|
+
return e(o, h), o;
|
|
200
230
|
}
|
|
201
|
-
}), t), e(
|
|
231
|
+
}), t), e(s, g(y, {
|
|
202
232
|
get when() {
|
|
203
|
-
return
|
|
233
|
+
return f();
|
|
204
234
|
},
|
|
205
235
|
get children() {
|
|
206
|
-
var o =
|
|
207
|
-
return e(o,
|
|
236
|
+
var o = Fe();
|
|
237
|
+
return e(o, f), o;
|
|
208
238
|
}
|
|
209
|
-
}), t),
|
|
210
|
-
var
|
|
211
|
-
return
|
|
239
|
+
}), t), n.$$input = (o) => v(o.currentTarget.value), e(u, () => d() ? "Sending..." : "Send reset link"), C((o) => {
|
|
240
|
+
var P = d(), w = d();
|
|
241
|
+
return P !== o.e && (n.disabled = o.e = P), w !== o.t && (u.disabled = o.t = w), o;
|
|
212
242
|
}, {
|
|
213
243
|
e: void 0,
|
|
214
244
|
t: void 0
|
|
215
|
-
}),
|
|
245
|
+
}), C(() => n.value = p()), s;
|
|
216
246
|
})();
|
|
217
247
|
};
|
|
218
|
-
|
|
219
|
-
var
|
|
220
|
-
const
|
|
248
|
+
K(["input"]);
|
|
249
|
+
var Re = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ue = /* @__PURE__ */ i('<div class=space-y-2><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>');
|
|
250
|
+
const qe = (r) => {
|
|
221
251
|
const {
|
|
222
|
-
client:
|
|
223
|
-
} =
|
|
224
|
-
|
|
225
|
-
|
|
252
|
+
client: k
|
|
253
|
+
} = Y(), b = k?.passkey;
|
|
254
|
+
if (!b) return null;
|
|
255
|
+
const [p, v] = a(null), [h, $] = a(!1), f = async () => {
|
|
256
|
+
const m = await b.loginBegin({
|
|
257
|
+
email: r.email ?? void 0
|
|
258
|
+
}), s = await Se({
|
|
259
|
+
optionsJSON: m.options.publicKey
|
|
226
260
|
});
|
|
227
|
-
await
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}, _ = async () => {
|
|
231
|
-
const n = await v.passkey.registerBegin(), m = await he({
|
|
232
|
-
optionsJSON: n.publicKey
|
|
261
|
+
await b.loginFinish({
|
|
262
|
+
challenge_id: m.challenge_id,
|
|
263
|
+
credential: s
|
|
233
264
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
265
|
+
const t = await k.getSession();
|
|
266
|
+
r.onSuccess?.(t);
|
|
267
|
+
}, x = async () => {
|
|
268
|
+
const l = await b.registerBegin(), m = await ke({
|
|
269
|
+
optionsJSON: l.publicKey
|
|
270
|
+
});
|
|
271
|
+
await b.registerFinish({
|
|
272
|
+
credential: m,
|
|
273
|
+
name: "Passkey"
|
|
274
|
+
}), r.onSuccess?.(void 0);
|
|
275
|
+
}, d = async () => {
|
|
276
|
+
v(null), $(!0);
|
|
237
277
|
try {
|
|
238
|
-
r.mode === "login" ? await
|
|
239
|
-
} catch (
|
|
240
|
-
const m =
|
|
278
|
+
r.mode === "login" ? await f() : await x();
|
|
279
|
+
} catch (l) {
|
|
280
|
+
const m = l instanceof Error ? l : new Error(String(l));
|
|
241
281
|
console.error("[yauth] Passkey error:", m);
|
|
242
|
-
const
|
|
243
|
-
|
|
282
|
+
const s = m.name === "NotAllowedError" ? "Passkey authentication was cancelled or not available on this device." : m.message;
|
|
283
|
+
v(s), r.onError?.(m);
|
|
244
284
|
} finally {
|
|
245
|
-
|
|
285
|
+
$(!1);
|
|
246
286
|
}
|
|
247
287
|
};
|
|
248
288
|
return (() => {
|
|
249
|
-
var
|
|
250
|
-
return e(
|
|
289
|
+
var l = Ue(), m = l.firstChild;
|
|
290
|
+
return e(l, g(y, {
|
|
251
291
|
get when() {
|
|
252
|
-
return
|
|
292
|
+
return p();
|
|
253
293
|
},
|
|
254
294
|
get children() {
|
|
255
|
-
var
|
|
256
|
-
return e(
|
|
295
|
+
var s = Re();
|
|
296
|
+
return e(s, p), s;
|
|
257
297
|
}
|
|
258
|
-
}), m), m.$$click =
|
|
259
|
-
var
|
|
260
|
-
return () =>
|
|
261
|
-
})()),
|
|
298
|
+
}), m), m.$$click = d, e(m, (() => {
|
|
299
|
+
var s = fe(() => !!h());
|
|
300
|
+
return () => s() ? r.mode === "login" ? "Authenticating..." : "Registering..." : r.mode === "login" ? "Sign in with passkey" : "Register passkey";
|
|
301
|
+
})()), C(() => m.disabled = h()), l;
|
|
262
302
|
})();
|
|
263
303
|
};
|
|
264
|
-
|
|
265
|
-
var
|
|
266
|
-
const
|
|
304
|
+
K(["click"]);
|
|
305
|
+
var Ne = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Oe = /* @__PURE__ */ i('<div class=relative><div class="absolute inset-0 flex items-center"style=pointer-events:none><span class="w-full border-t"></span></div><div class="relative flex justify-center text-xs uppercase"><span class="bg-background px-2 text-muted-foreground">or'), Be = /* @__PURE__ */ i('<form class=space-y-6><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-login-email>Email</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-login-email name=email type=email required autocomplete=email></div><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-login-password>Password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-login-password name=password type=password required autocomplete=current-password></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
306
|
+
const Ut = (r) => {
|
|
267
307
|
const {
|
|
268
|
-
client:
|
|
269
|
-
refetch:
|
|
270
|
-
} =
|
|
271
|
-
|
|
308
|
+
client: k,
|
|
309
|
+
refetch: b
|
|
310
|
+
} = Y(), p = k?.emailPassword;
|
|
311
|
+
if (!p) return null;
|
|
312
|
+
const [v, h] = a(""), [$, f] = a(""), [x, d] = a(null), [l, m] = a(!1), s = async (t) => {
|
|
313
|
+
t.preventDefault(), d(null), m(!0);
|
|
272
314
|
try {
|
|
273
|
-
const c = t.currentTarget,
|
|
274
|
-
|
|
275
|
-
|
|
315
|
+
const c = t.currentTarget, n = new FormData(c);
|
|
316
|
+
await p.login({
|
|
317
|
+
email: n.get("email") || v(),
|
|
318
|
+
password: n.get("password") || $()
|
|
276
319
|
});
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
else {
|
|
280
|
-
const o = await f();
|
|
281
|
-
r.onSuccess?.(o);
|
|
282
|
-
}
|
|
320
|
+
const u = await b();
|
|
321
|
+
r.onSuccess?.(u);
|
|
283
322
|
} catch (c) {
|
|
284
|
-
const
|
|
285
|
-
|
|
323
|
+
const n = c instanceof Error ? c : new Error(String(c));
|
|
324
|
+
d(n.message), r.onError?.(n);
|
|
286
325
|
} finally {
|
|
287
326
|
m(!1);
|
|
288
327
|
}
|
|
289
328
|
};
|
|
290
329
|
return (() => {
|
|
291
|
-
var t =
|
|
292
|
-
return
|
|
330
|
+
var t = Be(), c = t.firstChild, n = c.firstChild, u = n.nextSibling, o = c.nextSibling, P = o.firstChild, w = P.nextSibling, _ = o.nextSibling;
|
|
331
|
+
return ie(t, "submit", s), e(t, g(y, {
|
|
293
332
|
get when() {
|
|
294
|
-
return
|
|
333
|
+
return x();
|
|
295
334
|
},
|
|
296
335
|
get children() {
|
|
297
|
-
var
|
|
298
|
-
return e(
|
|
336
|
+
var S = Ne();
|
|
337
|
+
return e(S, x), S;
|
|
299
338
|
}
|
|
300
|
-
}), c),
|
|
339
|
+
}), c), ie(u, "input", (S) => h(S.currentTarget.value)), ie(w, "input", (S) => f(S.currentTarget.value)), e(_, () => l() ? "Signing in..." : "Sign in"), e(t, g(y, {
|
|
301
340
|
get when() {
|
|
302
341
|
return r.showPasskey;
|
|
303
342
|
},
|
|
304
343
|
get children() {
|
|
305
|
-
return [
|
|
344
|
+
return [Oe(), g(qe, {
|
|
306
345
|
mode: "login",
|
|
307
346
|
get email() {
|
|
308
|
-
return
|
|
347
|
+
return v();
|
|
309
348
|
},
|
|
310
|
-
onSuccess: (
|
|
311
|
-
|
|
349
|
+
onSuccess: (S) => {
|
|
350
|
+
b(), r.onSuccess?.(S);
|
|
312
351
|
},
|
|
313
352
|
get onError() {
|
|
314
353
|
return r.onError;
|
|
315
354
|
}
|
|
316
355
|
})];
|
|
317
356
|
}
|
|
318
|
-
}), null),
|
|
319
|
-
var L =
|
|
320
|
-
return L !==
|
|
357
|
+
}), null), C((S) => {
|
|
358
|
+
var L = l(), R = l(), O = l();
|
|
359
|
+
return L !== S.e && (u.disabled = S.e = L), R !== S.t && (w.disabled = S.t = R), O !== S.a && (_.disabled = S.a = O), S;
|
|
321
360
|
}, {
|
|
322
361
|
e: void 0,
|
|
323
362
|
t: void 0,
|
|
324
363
|
a: void 0
|
|
325
|
-
}),
|
|
364
|
+
}), C(() => u.value = v()), C(() => w.value = $()), t;
|
|
326
365
|
})();
|
|
327
366
|
};
|
|
328
|
-
var
|
|
329
|
-
const
|
|
367
|
+
var Ve = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), ze = /* @__PURE__ */ i('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), Ye = /* @__PURE__ */ i('<div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-magic-link-email>Email</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-magic-link-email name=email type=email required autocomplete=email placeholder=you@example.com>'), Ie = /* @__PURE__ */ i('<button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>'), Je = /* @__PURE__ */ i("<form class=space-y-4>");
|
|
368
|
+
const qt = (r) => {
|
|
330
369
|
const {
|
|
331
|
-
client:
|
|
332
|
-
} =
|
|
333
|
-
|
|
370
|
+
client: k
|
|
371
|
+
} = Y(), b = k?.magicLink;
|
|
372
|
+
if (!b) return null;
|
|
373
|
+
const [p, v] = a(""), [h, $] = a(null), [f, x] = a(null), [d, l] = a(!1), m = async (s) => {
|
|
374
|
+
s.preventDefault(), $(null), x(null), l(!0);
|
|
334
375
|
try {
|
|
335
|
-
const t =
|
|
336
|
-
|
|
376
|
+
const t = s.currentTarget, c = new FormData(t), n = await b.send({
|
|
377
|
+
email: c.get("email") || p()
|
|
378
|
+
});
|
|
379
|
+
x(n.message), r.onSuccess?.(n.message);
|
|
337
380
|
} catch (t) {
|
|
338
381
|
const c = t instanceof Error ? t : new Error(String(t));
|
|
339
|
-
|
|
382
|
+
$(c.message);
|
|
340
383
|
} finally {
|
|
341
|
-
|
|
384
|
+
l(!1);
|
|
342
385
|
}
|
|
343
386
|
};
|
|
344
387
|
return (() => {
|
|
345
|
-
var
|
|
346
|
-
return
|
|
388
|
+
var s = Je();
|
|
389
|
+
return s.addEventListener("submit", m), e(s, g(y, {
|
|
347
390
|
get when() {
|
|
348
|
-
return
|
|
391
|
+
return h();
|
|
349
392
|
},
|
|
350
393
|
get children() {
|
|
351
|
-
var t =
|
|
352
|
-
return e(t,
|
|
394
|
+
var t = Ve();
|
|
395
|
+
return e(t, h), t;
|
|
353
396
|
}
|
|
354
|
-
}), null), e(
|
|
397
|
+
}), null), e(s, g(y, {
|
|
355
398
|
get when() {
|
|
356
|
-
return
|
|
399
|
+
return f();
|
|
357
400
|
},
|
|
358
401
|
get children() {
|
|
359
|
-
var t =
|
|
360
|
-
return e(t,
|
|
402
|
+
var t = ze();
|
|
403
|
+
return e(t, f), t;
|
|
361
404
|
}
|
|
362
|
-
}), null), e(
|
|
405
|
+
}), null), e(s, g(y, {
|
|
363
406
|
get when() {
|
|
364
|
-
return !
|
|
407
|
+
return !f();
|
|
365
408
|
},
|
|
366
409
|
get children() {
|
|
367
410
|
return [(() => {
|
|
368
|
-
var t =
|
|
369
|
-
return
|
|
411
|
+
var t = Ye(), c = t.firstChild, n = c.nextSibling;
|
|
412
|
+
return n.$$input = (u) => v(u.currentTarget.value), C(() => n.disabled = d()), C(() => n.value = p()), t;
|
|
370
413
|
})(), (() => {
|
|
371
|
-
var t =
|
|
372
|
-
return e(t, () =>
|
|
414
|
+
var t = Ie();
|
|
415
|
+
return e(t, () => d() ? "Sending..." : "Send magic link"), C(() => t.disabled = d()), t;
|
|
373
416
|
})()];
|
|
374
417
|
}
|
|
375
|
-
}), null),
|
|
418
|
+
}), null), s;
|
|
376
419
|
})();
|
|
377
420
|
};
|
|
378
|
-
|
|
379
|
-
var
|
|
380
|
-
const
|
|
421
|
+
K(["input"]);
|
|
422
|
+
var Ke = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ge = /* @__PURE__ */ i('<form class=space-y-4><p class="text-sm text-muted-foreground">Enter the code from your authenticator app, or use a backup code.</p><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-mfa-challenge-code>Verification code</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-mfa-challenge-code name=code type=text inputmode=numeric autocomplete=one-time-code required></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
423
|
+
const Nt = (r) => {
|
|
381
424
|
const {
|
|
382
|
-
client:
|
|
383
|
-
} =
|
|
384
|
-
|
|
425
|
+
client: k
|
|
426
|
+
} = Y(), b = k?.mfa;
|
|
427
|
+
if (!b) return null;
|
|
428
|
+
const [p, v] = a(""), [h, $] = a(null), [f, x] = a(!1), d = async (l) => {
|
|
429
|
+
l.preventDefault(), $(null), x(!0);
|
|
385
430
|
try {
|
|
386
|
-
const m =
|
|
387
|
-
await
|
|
388
|
-
|
|
389
|
-
|
|
431
|
+
const m = l.currentTarget, s = new FormData(m);
|
|
432
|
+
await b.verify({
|
|
433
|
+
pending_session_id: r.pendingSessionId,
|
|
434
|
+
code: s.get("code") || p()
|
|
435
|
+
});
|
|
436
|
+
const t = await k.getSession();
|
|
437
|
+
r.onSuccess?.(t);
|
|
390
438
|
} catch (m) {
|
|
391
|
-
const
|
|
392
|
-
|
|
439
|
+
const s = m instanceof Error ? m : new Error(String(m));
|
|
440
|
+
$(s.message), r.onError?.(s);
|
|
393
441
|
} finally {
|
|
394
|
-
|
|
442
|
+
x(!1);
|
|
395
443
|
}
|
|
396
444
|
};
|
|
397
445
|
return (() => {
|
|
398
|
-
var
|
|
399
|
-
return
|
|
446
|
+
var l = Ge(), m = l.firstChild, s = m.nextSibling, t = s.firstChild, c = t.nextSibling, n = s.nextSibling;
|
|
447
|
+
return l.addEventListener("submit", d), e(l, g(y, {
|
|
400
448
|
get when() {
|
|
401
|
-
return
|
|
449
|
+
return h();
|
|
402
450
|
},
|
|
403
451
|
get children() {
|
|
404
|
-
var
|
|
405
|
-
return e(
|
|
452
|
+
var u = Ke();
|
|
453
|
+
return e(u, h), u;
|
|
406
454
|
}
|
|
407
|
-
}), m), c.$$input = (
|
|
408
|
-
var o =
|
|
409
|
-
return o !==
|
|
455
|
+
}), m), c.$$input = (u) => v(u.currentTarget.value), e(n, () => f() ? "Verifying..." : "Verify"), C((u) => {
|
|
456
|
+
var o = f(), P = f();
|
|
457
|
+
return o !== u.e && (c.disabled = u.e = o), P !== u.t && (n.disabled = u.t = P), u;
|
|
410
458
|
}, {
|
|
411
459
|
e: void 0,
|
|
412
460
|
t: void 0
|
|
413
|
-
}),
|
|
461
|
+
}), C(() => c.value = p()), l;
|
|
414
462
|
})();
|
|
415
463
|
};
|
|
416
|
-
|
|
417
|
-
var
|
|
418
|
-
const
|
|
464
|
+
K(["input"]);
|
|
465
|
+
var He = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Qe = /* @__PURE__ */ i('<div class=space-y-4><p class="text-sm text-muted-foreground">Set up two-factor authentication to secure your account.</p><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>'), We = /* @__PURE__ */ i('<div class=space-y-4><p class="text-sm text-muted-foreground">Add this account to your authenticator app using the URI below, then enter the verification code.</p><div class=space-y-1><span class="text-sm font-medium leading-none">OTP Auth URI</span><code class="block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs"></code></div><div class=space-y-1><span class="text-sm font-medium leading-none">Manual entry key</span><code class="block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs font-mono tracking-wider"></code></div><form class=space-y-4><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-mfa-setup-code>Verification code</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-mfa-setup-code name=code type=text inputmode=numeric autocomplete=one-time-code required></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>'), Xe = /* @__PURE__ */ i('<div class=space-y-4><div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">Two-factor authentication has been enabled. Save these backup codes in a safe place. Each code can only be used once.</div><ul class=space-y-1>'), Ze = /* @__PURE__ */ i("<div class=space-y-4>"), et = /* @__PURE__ */ i('<li class="rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider">');
|
|
466
|
+
const Ot = (r) => {
|
|
419
467
|
const {
|
|
420
|
-
client:
|
|
421
|
-
} =
|
|
422
|
-
|
|
468
|
+
client: k
|
|
469
|
+
} = Y(), b = k?.mfa;
|
|
470
|
+
if (!b) return null;
|
|
471
|
+
const [p, v] = a("begin"), [h, $] = a(""), [f, x] = a(""), [d, l] = a(""), [m, s] = a([]), [t, c] = a(null), [n, u] = a(!1), o = async () => {
|
|
472
|
+
c(null), u(!0);
|
|
423
473
|
try {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
} catch (
|
|
427
|
-
const
|
|
428
|
-
c(
|
|
474
|
+
const w = await b.setup();
|
|
475
|
+
$(w.otpauth_url), x(w.secret), s(w.backup_codes), v("confirm");
|
|
476
|
+
} catch (w) {
|
|
477
|
+
const _ = w instanceof Error ? w : new Error(String(w));
|
|
478
|
+
c(_.message);
|
|
429
479
|
} finally {
|
|
430
|
-
|
|
480
|
+
u(!1);
|
|
431
481
|
}
|
|
432
|
-
},
|
|
433
|
-
|
|
482
|
+
}, P = async (w) => {
|
|
483
|
+
w.preventDefault(), c(null), u(!0);
|
|
434
484
|
try {
|
|
435
|
-
const
|
|
436
|
-
await
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
485
|
+
const _ = w.currentTarget, S = new FormData(_);
|
|
486
|
+
await b.confirm({
|
|
487
|
+
code: S.get("code") || d()
|
|
488
|
+
}), v("done"), r.onComplete?.(m());
|
|
489
|
+
} catch (_) {
|
|
490
|
+
const S = _ instanceof Error ? _ : new Error(String(_));
|
|
491
|
+
c(S.message);
|
|
440
492
|
} finally {
|
|
441
|
-
|
|
493
|
+
u(!1);
|
|
442
494
|
}
|
|
443
495
|
};
|
|
444
496
|
return (() => {
|
|
445
|
-
var
|
|
446
|
-
return e(
|
|
497
|
+
var w = Ze();
|
|
498
|
+
return e(w, g(y, {
|
|
447
499
|
get when() {
|
|
448
500
|
return t();
|
|
449
501
|
},
|
|
450
502
|
get children() {
|
|
451
|
-
var
|
|
452
|
-
return e(
|
|
503
|
+
var _ = He();
|
|
504
|
+
return e(_, t), _;
|
|
453
505
|
}
|
|
454
|
-
}), null), e(
|
|
506
|
+
}), null), e(w, g(y, {
|
|
455
507
|
get when() {
|
|
456
|
-
return
|
|
508
|
+
return p() === "begin";
|
|
457
509
|
},
|
|
458
510
|
get children() {
|
|
459
|
-
var
|
|
460
|
-
return L.$$click = o, e(L, () =>
|
|
511
|
+
var _ = Qe(), S = _.firstChild, L = S.nextSibling;
|
|
512
|
+
return L.$$click = o, e(L, () => n() ? "Setting up..." : "Set up 2FA"), C(() => L.disabled = n()), _;
|
|
461
513
|
}
|
|
462
|
-
}), null), e(
|
|
514
|
+
}), null), e(w, g(y, {
|
|
463
515
|
get when() {
|
|
464
|
-
return
|
|
516
|
+
return p() === "confirm";
|
|
465
517
|
},
|
|
466
518
|
get children() {
|
|
467
|
-
var
|
|
468
|
-
return e(
|
|
469
|
-
var
|
|
470
|
-
return
|
|
519
|
+
var _ = We(), S = _.firstChild, L = S.nextSibling, R = L.firstChild, O = R.nextSibling, D = L.nextSibling, G = D.firstChild, A = G.nextSibling, I = D.nextSibling, z = I.firstChild, Z = z.firstChild, H = Z.nextSibling, Q = z.nextSibling;
|
|
520
|
+
return e(O, h), e(A, f), I.addEventListener("submit", P), H.$$input = (B) => l(B.currentTarget.value), e(Q, () => n() ? "Verifying..." : "Verify and enable"), C((B) => {
|
|
521
|
+
var W = n(), ne = n();
|
|
522
|
+
return W !== B.e && (H.disabled = B.e = W), ne !== B.t && (Q.disabled = B.t = ne), B;
|
|
471
523
|
}, {
|
|
472
524
|
e: void 0,
|
|
473
525
|
t: void 0
|
|
474
|
-
}),
|
|
526
|
+
}), C(() => H.value = d()), _;
|
|
475
527
|
}
|
|
476
|
-
}), null), e(
|
|
528
|
+
}), null), e(w, g(y, {
|
|
477
529
|
get when() {
|
|
478
|
-
return
|
|
530
|
+
return p() === "done";
|
|
479
531
|
},
|
|
480
532
|
get children() {
|
|
481
|
-
var
|
|
482
|
-
return e(L, g(
|
|
533
|
+
var _ = Xe(), S = _.firstChild, L = S.nextSibling;
|
|
534
|
+
return e(L, g(te, {
|
|
483
535
|
get each() {
|
|
484
536
|
return m();
|
|
485
537
|
},
|
|
486
|
-
children: (
|
|
487
|
-
var
|
|
488
|
-
return e(
|
|
538
|
+
children: (R) => (() => {
|
|
539
|
+
var O = et();
|
|
540
|
+
return e(O, R), O;
|
|
489
541
|
})()
|
|
490
|
-
})),
|
|
542
|
+
})), _;
|
|
491
543
|
}
|
|
492
|
-
}), null),
|
|
544
|
+
}), null), w;
|
|
493
545
|
})();
|
|
494
546
|
};
|
|
495
|
-
|
|
496
|
-
var
|
|
497
|
-
const
|
|
547
|
+
K(["click", "input"]);
|
|
548
|
+
var tt = /* @__PURE__ */ i("<div class=space-y-2>"), rt = /* @__PURE__ */ i('<button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>Sign in with ');
|
|
549
|
+
const Bt = (r) => {
|
|
498
550
|
const {
|
|
499
|
-
client:
|
|
500
|
-
} =
|
|
501
|
-
|
|
551
|
+
client: k
|
|
552
|
+
} = Y(), b = k?.oauth;
|
|
553
|
+
if (!b) return null;
|
|
554
|
+
const p = (v) => {
|
|
555
|
+
window.location.href = b.authorize(v);
|
|
502
556
|
};
|
|
503
557
|
return (() => {
|
|
504
|
-
var
|
|
505
|
-
return e(
|
|
558
|
+
var v = tt();
|
|
559
|
+
return e(v, g(te, {
|
|
506
560
|
get each() {
|
|
507
561
|
return r.providers;
|
|
508
562
|
},
|
|
509
|
-
children: (
|
|
510
|
-
var
|
|
511
|
-
return
|
|
563
|
+
children: (h) => (() => {
|
|
564
|
+
var $ = rt();
|
|
565
|
+
return $.firstChild, $.$$click = () => p(h), e($, () => h.charAt(0).toUpperCase() + h.slice(1), null), $;
|
|
512
566
|
})()
|
|
513
|
-
})),
|
|
567
|
+
})), v;
|
|
514
568
|
})();
|
|
515
569
|
};
|
|
516
|
-
|
|
517
|
-
var
|
|
518
|
-
const
|
|
570
|
+
K(["click"]);
|
|
571
|
+
var nt = /* @__PURE__ */ i('<div class="text-sm text-muted-foreground">Loading profile...'), st = /* @__PURE__ */ i("<div class=space-y-8>"), it = /* @__PURE__ */ i('<dt class="font-medium text-muted-foreground">Display name'), lt = /* @__PURE__ */ i("<dd>"), ot = /* @__PURE__ */ i('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Profile</h2><dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm"><dt class="font-medium text-muted-foreground">Email</dt><dd></dd><dt class="font-medium text-muted-foreground">Email verified</dt><dd></dd><dt class="font-medium text-muted-foreground">Role</dt><dd>'), le = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), at = /* @__PURE__ */ i('<div class="text-sm text-muted-foreground">Loading passkeys...'), dt = /* @__PURE__ */ i('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Passkeys'), ct = /* @__PURE__ */ i('<div class="text-sm text-muted-foreground">Loading accounts...'), ut = /* @__PURE__ */ i('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Connected accounts'), mt = /* @__PURE__ */ i('<div class="flex gap-2"><button class="inline-flex h-9 cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button></button><button class="inline-flex h-9 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>'), gt = /* @__PURE__ */ i('<div class=space-y-4><p class="text-sm text-muted-foreground">Add this account to your authenticator app, then enter the verification code.</p><div class=space-y-1><span class="text-sm font-medium leading-none">OTP Auth URI</span><code class="block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs"></code></div><div class=space-y-1><span class="text-sm font-medium leading-none">Manual entry key</span><code class="block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs font-mono tracking-wider"></code></div><form class=space-y-4><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-profile-mfa-code>Verification code</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-profile-mfa-code name=mfa_code type=text inputmode=numeric autocomplete=one-time-code required></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>'), ft = /* @__PURE__ */ i('<div class=space-y-4><div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">Two-factor authentication is enabled. Save these backup codes in a safe place.</div><ul class=space-y-1>'), pt = /* @__PURE__ */ i('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Two-factor authentication'), ge = /* @__PURE__ */ i("<ul class=space-y-2>"), bt = /* @__PURE__ */ i('<p class="text-sm text-muted-foreground">No passkeys registered.'), vt = /* @__PURE__ */ i('<li class="flex items-center justify-between rounded-md border border-input px-3 py-2"><div class=space-y-0.5><span class="text-sm font-medium"></span><span class="block text-xs text-muted-foreground">Added </span></div><button class="inline-flex h-8 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>'), ht = /* @__PURE__ */ i('<p class="text-sm text-muted-foreground">No connected accounts.'), yt = /* @__PURE__ */ i('<li class="flex items-center justify-between rounded-md border border-input px-3 py-2"><div class=space-y-0.5><span class="text-sm font-medium"></span><span class="block text-xs text-muted-foreground">Connected </span></div><button class="inline-flex h-8 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=button>'), xt = /* @__PURE__ */ i('<li class="rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider">');
|
|
572
|
+
const Vt = () => {
|
|
519
573
|
const {
|
|
520
574
|
client: r,
|
|
521
|
-
user:
|
|
522
|
-
loading:
|
|
523
|
-
} =
|
|
524
|
-
refetch:
|
|
525
|
-
}] =
|
|
575
|
+
user: k,
|
|
576
|
+
loading: b
|
|
577
|
+
} = Y(), p = r?.passkey, v = r?.oauth, h = r?.mfa, $ = !!p, f = !!v, x = !!h, [d, {
|
|
578
|
+
refetch: l
|
|
579
|
+
}] = oe(async () => {
|
|
580
|
+
if (!p) return [];
|
|
526
581
|
try {
|
|
527
|
-
return await
|
|
582
|
+
return await p.list();
|
|
528
583
|
} catch {
|
|
529
584
|
return [];
|
|
530
585
|
}
|
|
531
|
-
}), [
|
|
532
|
-
refetch:
|
|
533
|
-
}] =
|
|
586
|
+
}), [m, s] = a(null), [t, c] = a(null), [n, {
|
|
587
|
+
refetch: u
|
|
588
|
+
}] = oe(async () => {
|
|
589
|
+
if (!v) return [];
|
|
534
590
|
try {
|
|
535
|
-
return await
|
|
591
|
+
return await v.accounts();
|
|
536
592
|
} catch {
|
|
537
593
|
return [];
|
|
538
594
|
}
|
|
539
|
-
}), [
|
|
540
|
-
|
|
595
|
+
}), [o, P] = a(null), [w, _] = a(null), [S, L] = a(""), [R, O] = a(""), [D, G] = a(""), [A, I] = a([]), [z, Z] = a("idle"), [H, Q] = a(null), [B, W] = a(!1), ne = async (j) => {
|
|
596
|
+
s(null), c(j);
|
|
541
597
|
try {
|
|
542
|
-
await
|
|
543
|
-
} catch (
|
|
544
|
-
const
|
|
545
|
-
|
|
598
|
+
await p.delete(j), l();
|
|
599
|
+
} catch (F) {
|
|
600
|
+
const E = F instanceof Error ? F : new Error(String(F));
|
|
601
|
+
s(E.message);
|
|
546
602
|
} finally {
|
|
547
|
-
|
|
603
|
+
c(null);
|
|
548
604
|
}
|
|
549
|
-
},
|
|
550
|
-
|
|
605
|
+
}, be = async (j) => {
|
|
606
|
+
P(null), _(j);
|
|
551
607
|
try {
|
|
552
|
-
await
|
|
553
|
-
} catch (
|
|
554
|
-
const
|
|
555
|
-
|
|
608
|
+
await v.unlink(j), u();
|
|
609
|
+
} catch (F) {
|
|
610
|
+
const E = F instanceof Error ? F : new Error(String(F));
|
|
611
|
+
P(E.message);
|
|
556
612
|
} finally {
|
|
557
|
-
|
|
613
|
+
_(null);
|
|
558
614
|
}
|
|
559
|
-
},
|
|
560
|
-
|
|
615
|
+
}, ve = async () => {
|
|
616
|
+
Q(null), W(!0);
|
|
561
617
|
try {
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
} catch (
|
|
565
|
-
const
|
|
566
|
-
|
|
618
|
+
const j = await h.setup();
|
|
619
|
+
L(j.otpauth_url), O(j.secret), I(j.backup_codes), Z("confirm");
|
|
620
|
+
} catch (j) {
|
|
621
|
+
const F = j instanceof Error ? j : new Error(String(j));
|
|
622
|
+
Q(F.message);
|
|
567
623
|
} finally {
|
|
568
|
-
|
|
624
|
+
W(!1);
|
|
569
625
|
}
|
|
570
|
-
},
|
|
571
|
-
|
|
626
|
+
}, he = async (j) => {
|
|
627
|
+
j.preventDefault(), Q(null), W(!0);
|
|
572
628
|
try {
|
|
573
|
-
const
|
|
574
|
-
await
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
629
|
+
const F = j.currentTarget, E = new FormData(F);
|
|
630
|
+
await h.confirm({
|
|
631
|
+
code: E.get("mfa_code") || D()
|
|
632
|
+
}), Z("done");
|
|
633
|
+
} catch (F) {
|
|
634
|
+
const E = F instanceof Error ? F : new Error(String(F));
|
|
635
|
+
Q(E.message);
|
|
578
636
|
} finally {
|
|
579
|
-
|
|
637
|
+
W(!1);
|
|
580
638
|
}
|
|
581
|
-
},
|
|
582
|
-
|
|
639
|
+
}, ye = async () => {
|
|
640
|
+
Q(null), W(!0);
|
|
583
641
|
try {
|
|
584
|
-
await
|
|
585
|
-
} catch (
|
|
586
|
-
const
|
|
587
|
-
|
|
642
|
+
await h.disable(), Z("idle"), L(""), O(""), G(""), I([]);
|
|
643
|
+
} catch (j) {
|
|
644
|
+
const F = j instanceof Error ? j : new Error(String(j));
|
|
645
|
+
Q(F.message);
|
|
588
646
|
} finally {
|
|
589
|
-
|
|
647
|
+
W(!1);
|
|
590
648
|
}
|
|
591
649
|
};
|
|
592
650
|
return (() => {
|
|
593
|
-
var
|
|
594
|
-
return e(
|
|
651
|
+
var j = st();
|
|
652
|
+
return e(j, g(y, {
|
|
595
653
|
get when() {
|
|
596
|
-
return
|
|
654
|
+
return b();
|
|
597
655
|
},
|
|
598
656
|
get children() {
|
|
599
|
-
return
|
|
657
|
+
return nt();
|
|
600
658
|
}
|
|
601
|
-
}), null), e(
|
|
659
|
+
}), null), e(j, g(y, {
|
|
602
660
|
get when() {
|
|
603
|
-
return
|
|
661
|
+
return k();
|
|
604
662
|
},
|
|
605
|
-
children: (
|
|
606
|
-
var
|
|
607
|
-
return e(
|
|
663
|
+
children: (F) => [(() => {
|
|
664
|
+
var E = ot(), T = E.firstChild, q = T.nextSibling, M = q.firstChild, U = M.nextSibling, N = U.nextSibling, V = N.nextSibling, X = V.nextSibling, J = X.nextSibling;
|
|
665
|
+
return e(U, () => F().email), e(q, g(y, {
|
|
608
666
|
get when() {
|
|
609
|
-
return
|
|
667
|
+
return F().display_name;
|
|
610
668
|
},
|
|
611
669
|
get children() {
|
|
612
|
-
return [
|
|
613
|
-
var
|
|
614
|
-
return e(
|
|
670
|
+
return [it(), (() => {
|
|
671
|
+
var re = lt();
|
|
672
|
+
return e(re, () => F().display_name), re;
|
|
615
673
|
})()];
|
|
616
674
|
}
|
|
617
|
-
}),
|
|
618
|
-
})(), (
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
},
|
|
624
|
-
get children() {
|
|
625
|
-
var A = se();
|
|
626
|
-
return e(A, p), A;
|
|
627
|
-
}
|
|
628
|
-
}), null), e(D, g(w, {
|
|
629
|
-
get when() {
|
|
630
|
-
return h.loading;
|
|
631
|
-
},
|
|
632
|
-
get children() {
|
|
633
|
-
return tt();
|
|
634
|
-
}
|
|
635
|
-
}), null), e(D, g(w, {
|
|
636
|
-
get when() {
|
|
637
|
-
return h();
|
|
638
|
-
},
|
|
639
|
-
children: (A) => g(w, {
|
|
675
|
+
}), N), e(V, () => F().email_verified ? "Yes" : "No"), e(J, () => F().role), E;
|
|
676
|
+
})(), g(y, {
|
|
677
|
+
when: $,
|
|
678
|
+
get children() {
|
|
679
|
+
var E = dt();
|
|
680
|
+
return E.firstChild, e(E, g(y, {
|
|
640
681
|
get when() {
|
|
641
|
-
return
|
|
682
|
+
return m();
|
|
642
683
|
},
|
|
643
|
-
get
|
|
644
|
-
|
|
684
|
+
get children() {
|
|
685
|
+
var T = le();
|
|
686
|
+
return e(T, m), T;
|
|
687
|
+
}
|
|
688
|
+
}), null), e(E, g(y, {
|
|
689
|
+
get when() {
|
|
690
|
+
return d.loading;
|
|
645
691
|
},
|
|
646
692
|
get children() {
|
|
647
|
-
|
|
648
|
-
return e(R, g(X, {
|
|
649
|
-
get each() {
|
|
650
|
-
return A();
|
|
651
|
-
},
|
|
652
|
-
children: (F) => (() => {
|
|
653
|
-
var q = ct(), O = q.firstChild, V = O.firstChild, G = V.nextSibling;
|
|
654
|
-
G.firstChild;
|
|
655
|
-
var I = O.nextSibling;
|
|
656
|
-
return e(V, () => F.name ?? "Unnamed passkey"), e(G, () => new Date(F.created_at).toLocaleDateString(), null), I.$$click = () => W(F.id), e(I, () => _() === F.id ? "Deleting..." : "Delete"), E(() => I.disabled = _() === F.id), q;
|
|
657
|
-
})()
|
|
658
|
-
})), R;
|
|
693
|
+
return at();
|
|
659
694
|
}
|
|
660
|
-
})
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
695
|
+
}), null), e(E, g(y, {
|
|
696
|
+
get when() {
|
|
697
|
+
return d();
|
|
698
|
+
},
|
|
699
|
+
children: (T) => g(y, {
|
|
700
|
+
get when() {
|
|
701
|
+
return T().length > 0;
|
|
702
|
+
},
|
|
703
|
+
get fallback() {
|
|
704
|
+
return bt();
|
|
705
|
+
},
|
|
706
|
+
get children() {
|
|
707
|
+
var q = ge();
|
|
708
|
+
return e(q, g(te, {
|
|
709
|
+
get each() {
|
|
710
|
+
return T();
|
|
711
|
+
},
|
|
712
|
+
children: (M) => (() => {
|
|
713
|
+
var U = vt(), N = U.firstChild, V = N.firstChild, X = V.nextSibling;
|
|
714
|
+
X.firstChild;
|
|
715
|
+
var J = N.nextSibling;
|
|
716
|
+
return e(V, () => M.name ?? "Unnamed passkey"), e(X, () => new Date(M.created_at).toLocaleDateString(), null), J.$$click = () => ne(M.id), e(J, () => t() === M.id ? "Deleting..." : "Delete"), C(() => J.disabled = t() === M.id), U;
|
|
717
|
+
})()
|
|
718
|
+
})), q;
|
|
719
|
+
}
|
|
720
|
+
})
|
|
721
|
+
}), null), E;
|
|
722
|
+
}
|
|
723
|
+
}), g(y, {
|
|
724
|
+
when: f,
|
|
725
|
+
get children() {
|
|
726
|
+
var E = ut();
|
|
727
|
+
return E.firstChild, e(E, g(y, {
|
|
728
|
+
get when() {
|
|
729
|
+
return o();
|
|
730
|
+
},
|
|
731
|
+
get children() {
|
|
732
|
+
var T = le();
|
|
733
|
+
return e(T, o), T;
|
|
734
|
+
}
|
|
735
|
+
}), null), e(E, g(y, {
|
|
736
|
+
get when() {
|
|
737
|
+
return n.loading;
|
|
738
|
+
},
|
|
739
|
+
get children() {
|
|
740
|
+
return ct();
|
|
741
|
+
}
|
|
742
|
+
}), null), e(E, g(y, {
|
|
684
743
|
get when() {
|
|
685
|
-
return
|
|
744
|
+
return n();
|
|
686
745
|
},
|
|
687
|
-
|
|
688
|
-
|
|
746
|
+
children: (T) => g(y, {
|
|
747
|
+
get when() {
|
|
748
|
+
return T().length > 0;
|
|
749
|
+
},
|
|
750
|
+
get fallback() {
|
|
751
|
+
return ht();
|
|
752
|
+
},
|
|
753
|
+
get children() {
|
|
754
|
+
var q = ge();
|
|
755
|
+
return e(q, g(te, {
|
|
756
|
+
get each() {
|
|
757
|
+
return T();
|
|
758
|
+
},
|
|
759
|
+
children: (M) => (() => {
|
|
760
|
+
var U = yt(), N = U.firstChild, V = N.firstChild, X = V.nextSibling;
|
|
761
|
+
X.firstChild;
|
|
762
|
+
var J = N.nextSibling;
|
|
763
|
+
return e(V, () => M.provider.charAt(0).toUpperCase() + M.provider.slice(1)), e(X, () => new Date(M.created_at).toLocaleDateString(), null), J.$$click = () => be(M.provider), e(J, () => w() === M.provider ? "Unlinking..." : "Unlink"), C(() => J.disabled = w() === M.provider), U;
|
|
764
|
+
})()
|
|
765
|
+
})), q;
|
|
766
|
+
}
|
|
767
|
+
})
|
|
768
|
+
}), null), E;
|
|
769
|
+
}
|
|
770
|
+
}), g(y, {
|
|
771
|
+
when: x,
|
|
772
|
+
get children() {
|
|
773
|
+
var E = pt();
|
|
774
|
+
return E.firstChild, e(E, g(y, {
|
|
775
|
+
get when() {
|
|
776
|
+
return H();
|
|
777
|
+
},
|
|
778
|
+
get children() {
|
|
779
|
+
var T = le();
|
|
780
|
+
return e(T, H), T;
|
|
781
|
+
}
|
|
782
|
+
}), null), e(E, g(y, {
|
|
783
|
+
get when() {
|
|
784
|
+
return z() === "idle";
|
|
689
785
|
},
|
|
690
786
|
get children() {
|
|
691
|
-
var
|
|
692
|
-
return e(
|
|
787
|
+
var T = mt(), q = T.firstChild, M = q.nextSibling;
|
|
788
|
+
return q.$$click = ve, e(q, () => B() ? "Setting up..." : "Set up 2FA"), M.$$click = ye, e(M, () => B() ? "Disabling..." : "Disable 2FA"), C((U) => {
|
|
789
|
+
var N = B(), V = B();
|
|
790
|
+
return N !== U.e && (q.disabled = U.e = N), V !== U.t && (M.disabled = U.t = V), U;
|
|
791
|
+
}, {
|
|
792
|
+
e: void 0,
|
|
793
|
+
t: void 0
|
|
794
|
+
}), T;
|
|
795
|
+
}
|
|
796
|
+
}), null), e(E, g(y, {
|
|
797
|
+
get when() {
|
|
798
|
+
return z() === "confirm";
|
|
799
|
+
},
|
|
800
|
+
get children() {
|
|
801
|
+
var T = gt(), q = T.firstChild, M = q.nextSibling, U = M.firstChild, N = U.nextSibling, V = M.nextSibling, X = V.firstChild, J = X.nextSibling, re = V.nextSibling, de = re.firstChild, xe = de.firstChild, se = xe.nextSibling, ce = de.nextSibling;
|
|
802
|
+
return e(N, S), e(J, R), re.addEventListener("submit", he), se.$$input = (ee) => G(ee.currentTarget.value), e(ce, () => B() ? "Verifying..." : "Verify and enable"), C((ee) => {
|
|
803
|
+
var ue = B(), me = B();
|
|
804
|
+
return ue !== ee.e && (se.disabled = ee.e = ue), me !== ee.t && (ce.disabled = ee.t = me), ee;
|
|
805
|
+
}, {
|
|
806
|
+
e: void 0,
|
|
807
|
+
t: void 0
|
|
808
|
+
}), C(() => se.value = D()), T;
|
|
809
|
+
}
|
|
810
|
+
}), null), e(E, g(y, {
|
|
811
|
+
get when() {
|
|
812
|
+
return z() === "done";
|
|
813
|
+
},
|
|
814
|
+
get children() {
|
|
815
|
+
var T = ft(), q = T.firstChild, M = q.nextSibling;
|
|
816
|
+
return e(M, g(te, {
|
|
693
817
|
get each() {
|
|
694
818
|
return A();
|
|
695
819
|
},
|
|
696
|
-
children: (
|
|
697
|
-
var
|
|
698
|
-
|
|
699
|
-
var I = O.nextSibling;
|
|
700
|
-
return e(V, () => F.provider.charAt(0).toUpperCase() + F.provider.slice(1)), e(G, () => new Date(F.created_at).toLocaleDateString(), null), I.$$click = () => H(F.provider), e(I, () => c() === F.provider ? "Unlinking..." : "Unlink"), E(() => I.disabled = c() === F.provider), q;
|
|
820
|
+
children: (U) => (() => {
|
|
821
|
+
var N = xt();
|
|
822
|
+
return e(N, U), N;
|
|
701
823
|
})()
|
|
702
|
-
})),
|
|
824
|
+
})), T;
|
|
703
825
|
}
|
|
704
|
-
})
|
|
705
|
-
}
|
|
706
|
-
})
|
|
707
|
-
|
|
708
|
-
return D.firstChild, e(D, g(w, {
|
|
709
|
-
get when() {
|
|
710
|
-
return J();
|
|
711
|
-
},
|
|
712
|
-
get children() {
|
|
713
|
-
var A = se();
|
|
714
|
-
return e(A, J), A;
|
|
715
|
-
}
|
|
716
|
-
}), null), e(D, g(w, {
|
|
717
|
-
get when() {
|
|
718
|
-
return N() === "idle";
|
|
719
|
-
},
|
|
720
|
-
get children() {
|
|
721
|
-
var A = it(), R = A.firstChild, F = R.nextSibling;
|
|
722
|
-
return R.$$click = ee, e(R, () => B() ? "Setting up..." : "Set up 2FA"), F.$$click = te, e(F, () => B() ? "Disabling..." : "Disable 2FA"), E((q) => {
|
|
723
|
-
var O = B(), V = B();
|
|
724
|
-
return O !== q.e && (R.disabled = q.e = O), V !== q.t && (F.disabled = q.t = V), q;
|
|
725
|
-
}, {
|
|
726
|
-
e: void 0,
|
|
727
|
-
t: void 0
|
|
728
|
-
}), A;
|
|
729
|
-
}
|
|
730
|
-
}), null), e(D, g(w, {
|
|
731
|
-
get when() {
|
|
732
|
-
return N() === "confirm";
|
|
733
|
-
},
|
|
734
|
-
get children() {
|
|
735
|
-
var A = lt(), R = A.firstChild, F = R.nextSibling, q = F.firstChild, O = q.nextSibling, V = F.nextSibling, G = V.firstChild, I = G.nextSibling, Z = V.nextSibling, le = Z.firstChild, fe = le.firstChild, re = fe.nextSibling, oe = le.nextSibling;
|
|
736
|
-
return e(O, s), e(I, k), Z.addEventListener("submit", K), re.$$input = (Q) => x(Q.currentTarget.value), e(oe, () => B() ? "Verifying..." : "Verify and enable"), E((Q) => {
|
|
737
|
-
var ae = B(), de = B();
|
|
738
|
-
return ae !== Q.e && (re.disabled = Q.e = ae), de !== Q.t && (oe.disabled = Q.t = de), Q;
|
|
739
|
-
}, {
|
|
740
|
-
e: void 0,
|
|
741
|
-
t: void 0
|
|
742
|
-
}), E(() => re.value = y()), A;
|
|
743
|
-
}
|
|
744
|
-
}), null), e(D, g(w, {
|
|
745
|
-
get when() {
|
|
746
|
-
return N() === "done";
|
|
747
|
-
},
|
|
748
|
-
get children() {
|
|
749
|
-
var A = ot(), R = A.firstChild, F = R.nextSibling;
|
|
750
|
-
return e(F, g(X, {
|
|
751
|
-
get each() {
|
|
752
|
-
return L();
|
|
753
|
-
},
|
|
754
|
-
children: (q) => (() => {
|
|
755
|
-
var O = gt();
|
|
756
|
-
return e(O, q), O;
|
|
757
|
-
})()
|
|
758
|
-
})), A;
|
|
759
|
-
}
|
|
760
|
-
}), null), D;
|
|
761
|
-
})()]
|
|
762
|
-
}), null), T;
|
|
826
|
+
}), null), E;
|
|
827
|
+
}
|
|
828
|
+
})]
|
|
829
|
+
}), null), j;
|
|
763
830
|
})();
|
|
764
831
|
};
|
|
765
|
-
|
|
766
|
-
var
|
|
767
|
-
const
|
|
832
|
+
K(["click", "input"]);
|
|
833
|
+
var wt = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), $t = /* @__PURE__ */ i('<form class=space-y-6><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-register-email>Email</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-register-email name=email type=email required autocomplete=email></div><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-register-password>Password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-register-password name=password type=password required autocomplete=new-password></div><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-register-display-name>Display name (optional)</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-register-display-name name=display_name type=text autocomplete=name></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
834
|
+
const zt = (r) => {
|
|
768
835
|
const {
|
|
769
|
-
client:
|
|
770
|
-
} =
|
|
771
|
-
|
|
836
|
+
client: k
|
|
837
|
+
} = Y(), b = k?.emailPassword;
|
|
838
|
+
if (!b) return null;
|
|
839
|
+
const [p, v] = a(""), [h, $] = a(""), [f, x] = a(""), [d, l] = a(null), [m, s] = a(!1), t = async (c) => {
|
|
840
|
+
c.preventDefault(), l(null), s(!0);
|
|
772
841
|
try {
|
|
773
|
-
const
|
|
774
|
-
email:
|
|
775
|
-
password:
|
|
842
|
+
const n = c.currentTarget, u = new FormData(n), o = u.get("display_name") || f(), P = await b.register({
|
|
843
|
+
email: u.get("email") || p(),
|
|
844
|
+
password: u.get("password") || h(),
|
|
776
845
|
display_name: o || void 0
|
|
777
846
|
});
|
|
778
|
-
r.onSuccess?.(
|
|
779
|
-
} catch (
|
|
780
|
-
const
|
|
781
|
-
|
|
847
|
+
r.onSuccess?.(P.message);
|
|
848
|
+
} catch (n) {
|
|
849
|
+
const u = n instanceof Error ? n : new Error(String(n));
|
|
850
|
+
l(u.message), r.onError?.(u);
|
|
782
851
|
} finally {
|
|
783
|
-
|
|
852
|
+
s(!1);
|
|
784
853
|
}
|
|
785
854
|
};
|
|
786
855
|
return (() => {
|
|
787
|
-
var c =
|
|
788
|
-
return c.addEventListener("submit", t), e(c, g(
|
|
856
|
+
var c = $t(), n = c.firstChild, u = n.firstChild, o = u.nextSibling, P = n.nextSibling, w = P.firstChild, _ = w.nextSibling, S = P.nextSibling, L = S.firstChild, R = L.nextSibling, O = S.nextSibling;
|
|
857
|
+
return c.addEventListener("submit", t), e(c, g(y, {
|
|
789
858
|
get when() {
|
|
790
|
-
return
|
|
859
|
+
return d();
|
|
791
860
|
},
|
|
792
861
|
get children() {
|
|
793
|
-
var
|
|
794
|
-
return e(
|
|
862
|
+
var D = wt();
|
|
863
|
+
return e(D, d), D;
|
|
795
864
|
}
|
|
796
|
-
}),
|
|
797
|
-
var
|
|
798
|
-
return
|
|
865
|
+
}), n), o.$$input = (D) => v(D.currentTarget.value), _.$$input = (D) => $(D.currentTarget.value), R.$$input = (D) => x(D.currentTarget.value), e(O, () => m() ? "Creating account..." : "Create account"), C((D) => {
|
|
866
|
+
var G = m(), A = m(), I = m(), z = m();
|
|
867
|
+
return G !== D.e && (o.disabled = D.e = G), A !== D.t && (_.disabled = D.t = A), I !== D.a && (R.disabled = D.a = I), z !== D.o && (O.disabled = D.o = z), D;
|
|
799
868
|
}, {
|
|
800
869
|
e: void 0,
|
|
801
870
|
t: void 0,
|
|
802
871
|
a: void 0,
|
|
803
872
|
o: void 0
|
|
804
|
-
}),
|
|
873
|
+
}), C(() => o.value = p()), C(() => _.value = h()), C(() => R.value = f()), c;
|
|
805
874
|
})();
|
|
806
875
|
};
|
|
807
|
-
|
|
808
|
-
var
|
|
809
|
-
const
|
|
876
|
+
K(["input"]);
|
|
877
|
+
var _t = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), St = /* @__PURE__ */ i('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), kt = /* @__PURE__ */ i('<form class=space-y-4><div class=space-y-2><label class="text-sm font-medium leading-none"for=yauth-reset-password-input>New password</label><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"id=yauth-reset-password-input name=password type=password required autocomplete=new-password></div><button class="inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"type=submit>');
|
|
878
|
+
const Yt = (r) => {
|
|
810
879
|
const {
|
|
811
|
-
client:
|
|
812
|
-
} =
|
|
813
|
-
|
|
880
|
+
client: k
|
|
881
|
+
} = Y(), b = k?.emailPassword;
|
|
882
|
+
if (!b) return null;
|
|
883
|
+
const [p, v] = a(""), [h, $] = a(null), [f, x] = a(null), [d, l] = a(!1), m = async (s) => {
|
|
884
|
+
s.preventDefault(), $(null), x(null), l(!0);
|
|
814
885
|
try {
|
|
815
|
-
const t =
|
|
816
|
-
|
|
886
|
+
const t = s.currentTarget, c = new FormData(t), n = await b.resetPassword({
|
|
887
|
+
token: r.token,
|
|
888
|
+
password: c.get("password") || p()
|
|
889
|
+
});
|
|
890
|
+
x(n.message), r.onSuccess?.(n.message);
|
|
817
891
|
} catch (t) {
|
|
818
892
|
const c = t instanceof Error ? t : new Error(String(t));
|
|
819
|
-
|
|
893
|
+
$(c.message);
|
|
820
894
|
} finally {
|
|
821
|
-
|
|
895
|
+
l(!1);
|
|
822
896
|
}
|
|
823
897
|
};
|
|
824
898
|
return (() => {
|
|
825
|
-
var
|
|
826
|
-
return
|
|
899
|
+
var s = kt(), t = s.firstChild, c = t.firstChild, n = c.nextSibling, u = t.nextSibling;
|
|
900
|
+
return s.addEventListener("submit", m), e(s, g(y, {
|
|
827
901
|
get when() {
|
|
828
|
-
return
|
|
902
|
+
return h();
|
|
829
903
|
},
|
|
830
904
|
get children() {
|
|
831
|
-
var o =
|
|
832
|
-
return e(o,
|
|
905
|
+
var o = _t();
|
|
906
|
+
return e(o, h), o;
|
|
833
907
|
}
|
|
834
|
-
}), t), e(
|
|
908
|
+
}), t), e(s, g(y, {
|
|
835
909
|
get when() {
|
|
836
|
-
return
|
|
910
|
+
return f();
|
|
837
911
|
},
|
|
838
912
|
get children() {
|
|
839
|
-
var o =
|
|
840
|
-
return e(o,
|
|
913
|
+
var o = St();
|
|
914
|
+
return e(o, f), o;
|
|
841
915
|
}
|
|
842
|
-
}), t),
|
|
843
|
-
var
|
|
844
|
-
return
|
|
916
|
+
}), t), n.$$input = (o) => v(o.currentTarget.value), e(u, () => d() ? "Resetting..." : "Reset password"), C((o) => {
|
|
917
|
+
var P = d(), w = d();
|
|
918
|
+
return P !== o.e && (n.disabled = o.e = P), w !== o.t && (u.disabled = o.t = w), o;
|
|
845
919
|
}, {
|
|
846
920
|
e: void 0,
|
|
847
921
|
t: void 0
|
|
848
|
-
}),
|
|
922
|
+
}), C(() => n.value = p()), s;
|
|
849
923
|
})();
|
|
850
924
|
};
|
|
851
|
-
|
|
852
|
-
var
|
|
853
|
-
const
|
|
925
|
+
K(["input"]);
|
|
926
|
+
var Ct = /* @__PURE__ */ i('<div class="text-sm text-muted-foreground">Verifying your email address...'), Et = /* @__PURE__ */ i('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), Pt = /* @__PURE__ */ i('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Dt = /* @__PURE__ */ i("<div class=space-y-4>");
|
|
927
|
+
const It = (r) => {
|
|
854
928
|
const {
|
|
855
|
-
client:
|
|
856
|
-
} =
|
|
857
|
-
|
|
929
|
+
client: k
|
|
930
|
+
} = Y(), b = k?.emailPassword;
|
|
931
|
+
if (!b) return null;
|
|
932
|
+
const [p, v] = a("loading"), [h, $] = a(""), [f, x] = a("");
|
|
933
|
+
return ae(async () => {
|
|
858
934
|
try {
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
935
|
+
const d = await b.verify({
|
|
936
|
+
token: r.token
|
|
937
|
+
});
|
|
938
|
+
$(d.message), v("success"), r.onSuccess?.();
|
|
939
|
+
} catch (d) {
|
|
940
|
+
const l = d instanceof Error ? d : new Error(String(d));
|
|
941
|
+
x(l.message), v("error"), r.onError?.(l);
|
|
864
942
|
}
|
|
865
943
|
}), (() => {
|
|
866
|
-
var
|
|
867
|
-
return e(
|
|
944
|
+
var d = Dt();
|
|
945
|
+
return e(d, g(y, {
|
|
868
946
|
get when() {
|
|
869
|
-
return
|
|
947
|
+
return p() === "loading";
|
|
870
948
|
},
|
|
871
949
|
get children() {
|
|
872
|
-
return
|
|
950
|
+
return Ct();
|
|
873
951
|
}
|
|
874
|
-
}), null), e(
|
|
952
|
+
}), null), e(d, g(y, {
|
|
875
953
|
get when() {
|
|
876
|
-
return
|
|
954
|
+
return p() === "success";
|
|
877
955
|
},
|
|
878
956
|
get children() {
|
|
879
|
-
var
|
|
880
|
-
return e(
|
|
957
|
+
var l = Et();
|
|
958
|
+
return e(l, h), l;
|
|
881
959
|
}
|
|
882
|
-
}), null), e(
|
|
960
|
+
}), null), e(d, g(y, {
|
|
883
961
|
get when() {
|
|
884
|
-
return
|
|
962
|
+
return p() === "error";
|
|
885
963
|
},
|
|
886
964
|
get children() {
|
|
887
|
-
var
|
|
888
|
-
return e(
|
|
965
|
+
var l = Pt();
|
|
966
|
+
return e(l, f), l;
|
|
889
967
|
}
|
|
890
|
-
}), null),
|
|
968
|
+
}), null), d;
|
|
891
969
|
})();
|
|
892
970
|
};
|
|
893
971
|
export {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
972
|
+
Ft as ChangePasswordForm,
|
|
973
|
+
Mt as ConsentScreen,
|
|
974
|
+
Rt as ForgotPasswordForm,
|
|
975
|
+
Ut as LoginForm,
|
|
976
|
+
qt as MagicLinkForm,
|
|
977
|
+
Nt as MfaChallenge,
|
|
978
|
+
Ot as MfaSetup,
|
|
979
|
+
Bt as OAuthButtons,
|
|
980
|
+
qe as PasskeyButton,
|
|
981
|
+
Vt as ProfileSettings,
|
|
982
|
+
zt as RegisterForm,
|
|
983
|
+
Yt as ResetPasswordForm,
|
|
984
|
+
It as VerifyEmail,
|
|
985
|
+
jt as YAuthProvider,
|
|
986
|
+
Y as useYAuth
|
|
909
987
|
};
|