@yackey-labs/yauth-ui-solidjs 0.2.6 → 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 CHANGED
@@ -1,102 +1,128 @@
1
- import { createComponent as g, delegateEvents as Y, insert as e, Show as w, effect as E, template as l, memo as ue, addEventListener as ne } from "solid-js/web";
2
- import { createContext as pe, createResource as ie, createEffect as me, useContext as be, createSignal as d, For as X } from "solid-js";
3
- import { startAuthentication as ve, startRegistration as he } from "@simplewebauthn/browser";
4
- const ge = pe(), Ct = (r) => {
5
- let v = null;
6
- const [f, {
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
- }] = ie(async () => {
19
+ }] = oe(async () => {
20
+ const f = k();
21
+ if (!f) return null;
9
22
  try {
10
- return (await r.client.getSession()).user;
23
+ return await f.getSession();
11
24
  } catch {
12
25
  return null;
13
26
  }
14
27
  });
15
- me(() => {
16
- if (!f.loading && v) {
17
- const S = v;
18
- v = null, S(f() ?? null);
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((p) => {
22
- v = p, h();
36
+ const $ = () => new Promise((f) => {
37
+ p = f, h();
23
38
  });
24
- return g(ge.Provider, {
25
- get value() {
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
- get children() {
34
- return r.children;
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 z() {
39
- const r = be(ge);
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 ye = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), xe = /* @__PURE__ */ l('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">Password changed successfully.'), we = /* @__PURE__ */ l('<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>');
45
- const Et = (r) => {
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: v
48
- } = z(), [f, h] = d(""), [$, p] = d(""), [S, _] = d(""), [u, n] = d(null), [m, i] = d(!1), [t, c] = d(!1), a = async (s) => {
49
- s.preventDefault(), n(null), i(!1);
50
- const o = s.currentTarget, k = new FormData(o), b = k.get("current_password") || f(), y = k.get("new_password") || $(), x = k.get("confirm_password") || S();
51
- if (y !== x) {
52
- n("Passwords do not match");
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 v.emailPassword.changePassword(b, y), i(!0), h(""), p(""), _(""), r.onSuccess?.();
80
+ await b.changePassword({
81
+ current_password: w,
82
+ new_password: _
83
+ }), s(!0), v(""), $(""), x(""), r.onSuccess?.();
58
84
  } catch (L) {
59
- const M = L instanceof Error ? L : new Error(String(L));
60
- n(M.message), r.onError?.(M);
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 s = we(), o = s.firstChild, k = o.firstChild, b = k.nextSibling, y = o.nextSibling, x = y.firstChild, L = x.nextSibling, M = y.nextSibling, N = M.firstChild, P = N.nextSibling, J = M.nextSibling;
67
- return s.addEventListener("submit", a), e(s, g(w, {
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 u();
95
+ return d();
70
96
  },
71
97
  get children() {
72
- var C = ye();
73
- return e(C, u), C;
98
+ var A = Ce();
99
+ return e(A, d), A;
74
100
  }
75
- }), o), e(s, g(w, {
101
+ }), o), e(u, g(y, {
76
102
  get when() {
77
103
  return m();
78
104
  },
79
105
  get children() {
80
- return xe();
106
+ return Ee();
81
107
  }
82
- }), o), b.$$input = (C) => h(C.currentTarget.value), L.$$input = (C) => p(C.currentTarget.value), P.$$input = (C) => _(C.currentTarget.value), e(J, () => t() ? "Changing password..." : "Change password"), E((C) => {
83
- var B = t(), U = t(), W = t(), H = t();
84
- return B !== C.e && (b.disabled = C.e = B), U !== C.t && (L.disabled = C.t = U), W !== C.a && (P.disabled = C.a = W), H !== C.o && (J.disabled = C.o = H), C;
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
- }), E(() => b.value = f()), E(() => L.value = $()), E(() => P.value = S()), s;
116
+ }), C(() => w.value = p()), C(() => L.value = h()), C(() => D.value = f()), u;
91
117
  })();
92
118
  };
93
- Y(["input"]);
94
- var $e = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), _e = /* @__PURE__ */ l('<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>'), Se = /* @__PURE__ */ l('<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.'), ke = /* @__PURE__ */ l('<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>');
95
- const Pt = (r) => {
96
- const [v, f] = d(!1), [h, $] = d(null), p = async (_) => {
97
- $(null), f(!0);
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 u = r.authBaseUrl ?? "/api/auth", n = await fetch(`${u}/authorize`, {
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 (n.redirected) {
117
- window.location.href = n.url;
142
+ if (d.redirected) {
143
+ window.location.href = d.url;
118
144
  return;
119
145
  }
120
- if (!n.ok) {
121
- const i = await n.json().catch(() => null);
122
- throw new Error(i?.error_description ?? i?.error ?? "Authorization failed");
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 m = n.headers.get("Location");
125
- if (m) {
126
- window.location.href = m;
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 (u) {
131
- const n = u instanceof Error ? u : new Error(String(u));
132
- $(n.message), r.onError?.(n);
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
- f(!1);
160
+ b(!1);
135
161
  }
136
- }, S = () => r.clientName ?? r.clientId;
162
+ }, $ = () => r.clientName ?? r.clientId;
137
163
  return (() => {
138
- var _ = Se(), u = _.firstChild, n = u.firstChild;
139
- n.firstChild;
140
- var m = n.nextSibling, i = m.firstChild, t = u.nextSibling, c = t.firstChild, a = c.nextSibling;
141
- return e(n, S, null), e(i, S), e(_, g(w, {
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 h();
169
+ return p();
144
170
  },
145
171
  get children() {
146
- var s = $e();
147
- return e(s, h), s;
172
+ var n = De();
173
+ return e(n, p), n;
148
174
  }
149
- }), t), e(_, g(w, {
175
+ }), s), e(f, g(y, {
150
176
  get when() {
151
- return ue(() => !!r.scopes)() && r.scopes.length > 0;
177
+ return fe(() => !!r.scopes)() && r.scopes.length > 0;
152
178
  },
153
179
  get children() {
154
- var s = _e(), o = s.firstChild, k = o.nextSibling;
155
- return e(k, g(X, {
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: (b) => (() => {
160
- var y = ke(), x = y.firstChild, L = x.nextSibling;
161
- return e(L, b), y;
185
+ children: (P) => (() => {
186
+ var w = Le(), _ = w.firstChild, S = _.nextSibling;
187
+ return e(S, P), w;
162
188
  })()
163
- })), s;
189
+ })), n;
164
190
  }
165
- }), t), c.$$click = () => p(!1), a.$$click = () => p(!0), e(a, () => v() ? "Authorizing..." : "Authorize"), E((s) => {
166
- var o = v(), k = v();
167
- return o !== s.e && (c.disabled = s.e = o), k !== s.t && (a.disabled = s.t = k), s;
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
- Y(["click"]);
175
- var Ce = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ee = /* @__PURE__ */ l('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), Pe = /* @__PURE__ */ l('<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>');
176
- const Dt = (r) => {
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: v
179
- } = z(), [f, h] = d(""), [$, p] = d(null), [S, _] = d(null), [u, n] = d(!1), m = async (i) => {
180
- i.preventDefault(), p(null), _(null), n(!0);
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 = i.currentTarget, c = new FormData(t), a = await v.emailPassword.forgotPassword(c.get("email") || f());
183
- _(a.message), r.onSuccess?.(a.message);
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
- p(c.message);
216
+ $(c.message);
187
217
  } finally {
188
- n(!1);
218
+ l(!1);
189
219
  }
190
220
  };
191
221
  return (() => {
192
- var i = Pe(), t = i.firstChild, c = t.firstChild, a = c.nextSibling, s = t.nextSibling;
193
- return i.addEventListener("submit", m), e(i, g(w, {
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 = Ce();
199
- return e(o, $), o;
228
+ var o = je();
229
+ return e(o, h), o;
200
230
  }
201
- }), t), e(i, g(w, {
231
+ }), t), e(s, g(y, {
202
232
  get when() {
203
- return S();
233
+ return f();
204
234
  },
205
235
  get children() {
206
- var o = Ee();
207
- return e(o, S), o;
236
+ var o = Fe();
237
+ return e(o, f), o;
208
238
  }
209
- }), t), a.$$input = (o) => h(o.currentTarget.value), e(s, () => u() ? "Sending..." : "Send reset link"), E((o) => {
210
- var k = u(), b = u();
211
- return k !== o.e && (a.disabled = o.e = k), b !== o.t && (s.disabled = o.t = b), o;
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
- }), E(() => a.value = f()), i;
245
+ }), C(() => n.value = p()), s;
216
246
  })();
217
247
  };
218
- Y(["input"]);
219
- var De = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Te = /* @__PURE__ */ l('<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>');
220
- const Le = (r) => {
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: v
223
- } = z(), [f, h] = d(null), [$, p] = d(!1), S = async () => {
224
- const n = await v.passkey.loginBegin(r.email || void 0), m = n.options, i = await ve({
225
- optionsJSON: m.publicKey
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 v.passkey.loginFinish(n.challenge_id, i);
228
- const t = await v.getSession();
229
- r.onSuccess?.(t.user);
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
- await v.passkey.registerFinish(m, "Passkey"), r.onSuccess?.(void 0);
235
- }, u = async () => {
236
- h(null), p(!0);
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 S() : await _();
239
- } catch (n) {
240
- const m = n instanceof Error ? n : new Error(String(n));
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 i = m.name === "NotAllowedError" ? "Passkey authentication was cancelled or not available on this device." : m.message;
243
- h(i), r.onError?.(m);
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
- p(!1);
285
+ $(!1);
246
286
  }
247
287
  };
248
288
  return (() => {
249
- var n = Te(), m = n.firstChild;
250
- return e(n, g(w, {
289
+ var l = Ue(), m = l.firstChild;
290
+ return e(l, g(y, {
251
291
  get when() {
252
- return f();
292
+ return p();
253
293
  },
254
294
  get children() {
255
- var i = De();
256
- return e(i, f), i;
295
+ var s = Re();
296
+ return e(s, p), s;
257
297
  }
258
- }), m), m.$$click = u, e(m, (() => {
259
- var i = ue(() => !!$());
260
- return () => i() ? r.mode === "login" ? "Authenticating..." : "Registering..." : r.mode === "login" ? "Sign in with passkey" : "Register passkey";
261
- })()), E(() => m.disabled = $()), n;
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
- Y(["click"]);
265
- var Ae = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), je = /* @__PURE__ */ l('<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'), Fe = /* @__PURE__ */ l('<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>');
266
- const Tt = (r) => {
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: v,
269
- refetch: f
270
- } = z(), [h, $] = d(""), [p, S] = d(""), [_, u] = d(null), [n, m] = d(!1), i = async (t) => {
271
- t.preventDefault(), u(null), m(!0);
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, a = new FormData(c), s = await v.emailPassword.login({
274
- email: a.get("email") || h(),
275
- password: a.get("password") || p()
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
- if ("mfa_required" in s && s.mfa_required)
278
- r.onMfaRequired?.(s.pending_session_id);
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 a = c instanceof Error ? c : new Error(String(c));
285
- u(a.message), r.onError?.(a);
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 = Fe(), c = t.firstChild, a = c.firstChild, s = a.nextSibling, o = c.nextSibling, k = o.firstChild, b = k.nextSibling, y = o.nextSibling;
292
- return ne(t, "submit", i), e(t, g(w, {
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 x = Ae();
298
- return e(x, _), x;
336
+ var S = Ne();
337
+ return e(S, x), S;
299
338
  }
300
- }), c), ne(s, "input", (x) => $(x.currentTarget.value)), ne(b, "input", (x) => S(x.currentTarget.value)), e(y, () => n() ? "Signing in..." : "Sign in"), e(t, g(w, {
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 [je(), g(Le, {
344
+ return [Oe(), g(qe, {
306
345
  mode: "login",
307
346
  get email() {
308
- return h();
347
+ return v();
309
348
  },
310
- onSuccess: (x) => {
311
- f(), r.onSuccess?.(x);
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), E((x) => {
319
- var L = n(), M = n(), N = n();
320
- return L !== x.e && (s.disabled = x.e = L), M !== x.t && (b.disabled = x.t = M), N !== x.a && (y.disabled = x.a = N), x;
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
- }), E(() => s.value = h()), E(() => b.value = p()), t;
364
+ }), C(() => u.value = v()), C(() => w.value = $()), t;
326
365
  })();
327
366
  };
328
- var Me = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), qe = /* @__PURE__ */ l('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), Re = /* @__PURE__ */ l('<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>'), Ne = /* @__PURE__ */ l('<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>'), Be = /* @__PURE__ */ l("<form class=space-y-4>");
329
- const Lt = (r) => {
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: v
332
- } = z(), [f, h] = d(""), [$, p] = d(null), [S, _] = d(null), [u, n] = d(!1), m = async (i) => {
333
- i.preventDefault(), p(null), _(null), n(!0);
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 = i.currentTarget, c = new FormData(t), a = await v.magicLink.send(c.get("email") || f());
336
- _(a.message), r.onSuccess?.(a.message);
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
- p(c.message);
382
+ $(c.message);
340
383
  } finally {
341
- n(!1);
384
+ l(!1);
342
385
  }
343
386
  };
344
387
  return (() => {
345
- var i = Be();
346
- return i.addEventListener("submit", m), e(i, g(w, {
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 = Me();
352
- return e(t, $), t;
394
+ var t = Ve();
395
+ return e(t, h), t;
353
396
  }
354
- }), null), e(i, g(w, {
397
+ }), null), e(s, g(y, {
355
398
  get when() {
356
- return S();
399
+ return f();
357
400
  },
358
401
  get children() {
359
- var t = qe();
360
- return e(t, S), t;
402
+ var t = ze();
403
+ return e(t, f), t;
361
404
  }
362
- }), null), e(i, g(w, {
405
+ }), null), e(s, g(y, {
363
406
  get when() {
364
- return !S();
407
+ return !f();
365
408
  },
366
409
  get children() {
367
410
  return [(() => {
368
- var t = Re(), c = t.firstChild, a = c.nextSibling;
369
- return a.$$input = (s) => h(s.currentTarget.value), E(() => a.disabled = u()), E(() => a.value = f()), t;
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 = Ne();
372
- return e(t, () => u() ? "Sending..." : "Send magic link"), E(() => t.disabled = u()), 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), i;
418
+ }), null), s;
376
419
  })();
377
420
  };
378
- Y(["input"]);
379
- var Oe = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), Ue = /* @__PURE__ */ l('<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>');
380
- const At = (r) => {
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: v
383
- } = z(), [f, h] = d(""), [$, p] = d(null), [S, _] = d(!1), u = async (n) => {
384
- n.preventDefault(), p(null), _(!0);
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 = n.currentTarget, i = new FormData(m);
387
- await v.mfa.verify(r.pendingSessionId, i.get("code") || f());
388
- const t = await v.getSession();
389
- r.onSuccess?.(t.user);
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 i = m instanceof Error ? m : new Error(String(m));
392
- p(i.message), r.onError?.(i);
439
+ const s = m instanceof Error ? m : new Error(String(m));
440
+ $(s.message), r.onError?.(s);
393
441
  } finally {
394
- _(!1);
442
+ x(!1);
395
443
  }
396
444
  };
397
445
  return (() => {
398
- var n = Ue(), m = n.firstChild, i = m.nextSibling, t = i.firstChild, c = t.nextSibling, a = i.nextSibling;
399
- return n.addEventListener("submit", u), e(n, g(w, {
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 s = Oe();
405
- return e(s, $), s;
452
+ var u = Ke();
453
+ return e(u, h), u;
406
454
  }
407
- }), m), c.$$input = (s) => h(s.currentTarget.value), e(a, () => S() ? "Verifying..." : "Verify"), E((s) => {
408
- var o = S(), k = S();
409
- return o !== s.e && (c.disabled = s.e = o), k !== s.t && (a.disabled = s.t = k), s;
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
- }), E(() => c.value = f()), n;
461
+ }), C(() => c.value = p()), l;
414
462
  })();
415
463
  };
416
- Y(["input"]);
417
- var Ve = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), ze = /* @__PURE__ */ l('<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>'), Ie = /* @__PURE__ */ l('<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>'), Ye = /* @__PURE__ */ l('<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>'), Je = /* @__PURE__ */ l("<div class=space-y-4>"), Ke = /* @__PURE__ */ l('<li class="rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider">');
418
- const jt = (r) => {
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: v
421
- } = z(), [f, h] = d("begin"), [$, p] = d(""), [S, _] = d(""), [u, n] = d(""), [m, i] = d([]), [t, c] = d(null), [a, s] = d(!1), o = async () => {
422
- c(null), s(!0);
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 b = await v.mfa.setup();
425
- p(b.otpauth_url), _(b.secret), i(b.backup_codes), h("confirm");
426
- } catch (b) {
427
- const y = b instanceof Error ? b : new Error(String(b));
428
- c(y.message);
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
- s(!1);
480
+ u(!1);
431
481
  }
432
- }, k = async (b) => {
433
- b.preventDefault(), c(null), s(!0);
482
+ }, P = async (w) => {
483
+ w.preventDefault(), c(null), u(!0);
434
484
  try {
435
- const y = b.currentTarget, x = new FormData(y);
436
- await v.mfa.confirm(x.get("code") || u()), h("done"), r.onComplete?.(m());
437
- } catch (y) {
438
- const x = y instanceof Error ? y : new Error(String(y));
439
- c(x.message);
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
- s(!1);
493
+ u(!1);
442
494
  }
443
495
  };
444
496
  return (() => {
445
- var b = Je();
446
- return e(b, g(w, {
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 y = Ve();
452
- return e(y, t), y;
503
+ var _ = He();
504
+ return e(_, t), _;
453
505
  }
454
- }), null), e(b, g(w, {
506
+ }), null), e(w, g(y, {
455
507
  get when() {
456
- return f() === "begin";
508
+ return p() === "begin";
457
509
  },
458
510
  get children() {
459
- var y = ze(), x = y.firstChild, L = x.nextSibling;
460
- return L.$$click = o, e(L, () => a() ? "Setting up..." : "Set up 2FA"), E(() => L.disabled = a()), y;
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(b, g(w, {
514
+ }), null), e(w, g(y, {
463
515
  get when() {
464
- return f() === "confirm";
516
+ return p() === "confirm";
465
517
  },
466
518
  get children() {
467
- var y = Ie(), x = y.firstChild, L = x.nextSibling, M = L.firstChild, N = M.nextSibling, P = L.nextSibling, J = P.firstChild, C = J.nextSibling, B = P.nextSibling, U = B.firstChild, W = U.firstChild, H = W.nextSibling, ee = U.nextSibling;
468
- return e(N, $), e(C, S), B.addEventListener("submit", k), H.$$input = (K) => n(K.currentTarget.value), e(ee, () => a() ? "Verifying..." : "Verify and enable"), E((K) => {
469
- var te = a(), T = a();
470
- return te !== K.e && (H.disabled = K.e = te), T !== K.t && (ee.disabled = K.t = T), K;
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
- }), E(() => H.value = u()), y;
526
+ }), C(() => H.value = d()), _;
475
527
  }
476
- }), null), e(b, g(w, {
528
+ }), null), e(w, g(y, {
477
529
  get when() {
478
- return f() === "done";
530
+ return p() === "done";
479
531
  },
480
532
  get children() {
481
- var y = Ye(), x = y.firstChild, L = x.nextSibling;
482
- return e(L, g(X, {
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: (M) => (() => {
487
- var N = Ke();
488
- return e(N, M), N;
538
+ children: (R) => (() => {
539
+ var O = et();
540
+ return e(O, R), O;
489
541
  })()
490
- })), y;
542
+ })), _;
491
543
  }
492
- }), null), b;
544
+ }), null), w;
493
545
  })();
494
546
  };
495
- Y(["click", "input"]);
496
- var Ge = /* @__PURE__ */ l("<div class=space-y-2>"), He = /* @__PURE__ */ l('<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 ');
497
- const Ft = (r) => {
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: v
500
- } = z(), f = (h) => {
501
- v.oauth.authorize(h);
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 h = Ge();
505
- return e(h, g(X, {
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 p = He();
511
- return p.firstChild, p.$$click = () => f($), e(p, () => $.charAt(0).toUpperCase() + $.slice(1), null), p;
563
+ children: (h) => (() => {
564
+ var $ = rt();
565
+ return $.firstChild, $.$$click = () => p(h), e($, () => h.charAt(0).toUpperCase() + h.slice(1), null), $;
512
566
  })()
513
- })), h;
567
+ })), v;
514
568
  })();
515
569
  };
516
- Y(["click"]);
517
- var Qe = /* @__PURE__ */ l('<div class="text-sm text-muted-foreground">Loading profile...'), We = /* @__PURE__ */ l("<div class=space-y-8>"), Xe = /* @__PURE__ */ l('<dt class="font-medium text-muted-foreground">Display name'), Ze = /* @__PURE__ */ l("<dd>"), et = /* @__PURE__ */ l('<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>'), se = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), tt = /* @__PURE__ */ l('<div class="text-sm text-muted-foreground">Loading passkeys...'), rt = /* @__PURE__ */ l('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Passkeys'), nt = /* @__PURE__ */ l('<div class="text-sm text-muted-foreground">Loading accounts...'), st = /* @__PURE__ */ l('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Connected accounts'), it = /* @__PURE__ */ l('<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>'), lt = /* @__PURE__ */ l('<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>'), ot = /* @__PURE__ */ l('<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>'), at = /* @__PURE__ */ l('<section class=space-y-4><h2 class="text-lg font-semibold tracking-tight">Two-factor authentication'), ce = /* @__PURE__ */ l("<ul class=space-y-2>"), dt = /* @__PURE__ */ l('<p class="text-sm text-muted-foreground">No passkeys registered.'), ct = /* @__PURE__ */ l('<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>'), ut = /* @__PURE__ */ l('<p class="text-sm text-muted-foreground">No connected accounts.'), mt = /* @__PURE__ */ l('<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>'), gt = /* @__PURE__ */ l('<li class="rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider">');
518
- const Mt = () => {
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: v,
522
- loading: f
523
- } = z(), [h, {
524
- refetch: $
525
- }] = ie(async () => {
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 r.passkey.list();
582
+ return await p.list();
528
583
  } catch {
529
584
  return [];
530
585
  }
531
- }), [p, S] = d(null), [_, u] = d(null), [n, {
532
- refetch: m
533
- }] = ie(async () => {
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 r.oauth.accounts();
591
+ return await v.accounts();
536
592
  } catch {
537
593
  return [];
538
594
  }
539
- }), [i, t] = d(null), [c, a] = d(null), [s, o] = d(""), [k, b] = d(""), [y, x] = d(""), [L, M] = d([]), [N, P] = d("idle"), [J, C] = d(null), [B, U] = d(!1), W = async (T) => {
540
- S(null), u(T);
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 r.passkey.delete(T), $();
543
- } catch (j) {
544
- const D = j instanceof Error ? j : new Error(String(j));
545
- S(D.message);
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
- u(null);
603
+ c(null);
548
604
  }
549
- }, H = async (T) => {
550
- t(null), a(T);
605
+ }, be = async (j) => {
606
+ P(null), _(j);
551
607
  try {
552
- await r.oauth.unlink(T), m();
553
- } catch (j) {
554
- const D = j instanceof Error ? j : new Error(String(j));
555
- t(D.message);
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
- a(null);
613
+ _(null);
558
614
  }
559
- }, ee = async () => {
560
- C(null), U(!0);
615
+ }, ve = async () => {
616
+ Q(null), W(!0);
561
617
  try {
562
- const T = await r.mfa.setup();
563
- o(T.otpauth_url), b(T.secret), M(T.backup_codes), P("confirm");
564
- } catch (T) {
565
- const j = T instanceof Error ? T : new Error(String(T));
566
- C(j.message);
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
- U(!1);
624
+ W(!1);
569
625
  }
570
- }, K = async (T) => {
571
- T.preventDefault(), C(null), U(!0);
626
+ }, he = async (j) => {
627
+ j.preventDefault(), Q(null), W(!0);
572
628
  try {
573
- const j = T.currentTarget, D = new FormData(j);
574
- await r.mfa.confirm(D.get("mfa_code") || y()), P("done");
575
- } catch (j) {
576
- const D = j instanceof Error ? j : new Error(String(j));
577
- C(D.message);
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
- U(!1);
637
+ W(!1);
580
638
  }
581
- }, te = async () => {
582
- C(null), U(!0);
639
+ }, ye = async () => {
640
+ Q(null), W(!0);
583
641
  try {
584
- await r.mfa.disable(), P("idle"), o(""), b(""), x(""), M([]);
585
- } catch (T) {
586
- const j = T instanceof Error ? T : new Error(String(T));
587
- C(j.message);
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
- U(!1);
647
+ W(!1);
590
648
  }
591
649
  };
592
650
  return (() => {
593
- var T = We();
594
- return e(T, g(w, {
651
+ var j = st();
652
+ return e(j, g(y, {
595
653
  get when() {
596
- return f();
654
+ return b();
597
655
  },
598
656
  get children() {
599
- return Qe();
657
+ return nt();
600
658
  }
601
- }), null), e(T, g(w, {
659
+ }), null), e(j, g(y, {
602
660
  get when() {
603
- return v();
661
+ return k();
604
662
  },
605
- children: (j) => [(() => {
606
- var D = et(), A = D.firstChild, R = A.nextSibling, F = R.firstChild, q = F.nextSibling, O = q.nextSibling, V = O.nextSibling, G = V.nextSibling, I = G.nextSibling;
607
- return e(q, () => j().email), e(R, g(w, {
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 j().display_name;
667
+ return F().display_name;
610
668
  },
611
669
  get children() {
612
- return [Xe(), (() => {
613
- var Z = Ze();
614
- return e(Z, () => j().display_name), Z;
670
+ return [it(), (() => {
671
+ var re = lt();
672
+ return e(re, () => F().display_name), re;
615
673
  })()];
616
674
  }
617
- }), O), e(V, () => j().email_verified ? "Yes" : "No"), e(I, () => j().role), D;
618
- })(), (() => {
619
- var D = rt();
620
- return D.firstChild, e(D, g(w, {
621
- get when() {
622
- return p();
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 A().length > 0;
682
+ return m();
642
683
  },
643
- get fallback() {
644
- return dt();
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
- var R = ce();
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
- }), null), D;
662
- })(), (() => {
663
- var D = st();
664
- return D.firstChild, e(D, g(w, {
665
- get when() {
666
- return i();
667
- },
668
- get children() {
669
- var A = se();
670
- return e(A, i), A;
671
- }
672
- }), null), e(D, g(w, {
673
- get when() {
674
- return n.loading;
675
- },
676
- get children() {
677
- return nt();
678
- }
679
- }), null), e(D, g(w, {
680
- get when() {
681
- return n();
682
- },
683
- children: (A) => g(w, {
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 A().length > 0;
744
+ return n();
686
745
  },
687
- get fallback() {
688
- return ut();
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 R = ce();
692
- return e(R, g(X, {
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: (F) => (() => {
697
- var q = mt(), O = q.firstChild, V = O.firstChild, G = V.nextSibling;
698
- G.firstChild;
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
- })), R;
824
+ })), T;
703
825
  }
704
- })
705
- }), null), D;
706
- })(), (() => {
707
- var D = at();
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
- Y(["click", "input"]);
766
- var ft = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), pt = /* @__PURE__ */ l('<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>');
767
- const qt = (r) => {
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: v
770
- } = z(), [f, h] = d(""), [$, p] = d(""), [S, _] = d(""), [u, n] = d(null), [m, i] = d(!1), t = async (c) => {
771
- c.preventDefault(), n(null), i(!0);
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 a = c.currentTarget, s = new FormData(a), o = s.get("display_name") || S(), k = await v.emailPassword.register({
774
- email: s.get("email") || f(),
775
- password: s.get("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?.(k.message);
779
- } catch (a) {
780
- const s = a instanceof Error ? a : new Error(String(a));
781
- n(s.message), r.onError?.(s);
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
- i(!1);
852
+ s(!1);
784
853
  }
785
854
  };
786
855
  return (() => {
787
- var c = pt(), a = c.firstChild, s = a.firstChild, o = s.nextSibling, k = a.nextSibling, b = k.firstChild, y = b.nextSibling, x = k.nextSibling, L = x.firstChild, M = L.nextSibling, N = x.nextSibling;
788
- return c.addEventListener("submit", t), e(c, g(w, {
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 u();
859
+ return d();
791
860
  },
792
861
  get children() {
793
- var P = ft();
794
- return e(P, u), P;
862
+ var D = wt();
863
+ return e(D, d), D;
795
864
  }
796
- }), a), o.$$input = (P) => h(P.currentTarget.value), y.$$input = (P) => p(P.currentTarget.value), M.$$input = (P) => _(P.currentTarget.value), e(N, () => m() ? "Creating account..." : "Create account"), E((P) => {
797
- var J = m(), C = m(), B = m(), U = m();
798
- return J !== P.e && (o.disabled = P.e = J), C !== P.t && (y.disabled = P.t = C), B !== P.a && (M.disabled = P.a = B), U !== P.o && (N.disabled = P.o = U), P;
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
- }), E(() => o.value = f()), E(() => y.value = $()), E(() => M.value = S()), c;
873
+ }), C(() => o.value = p()), C(() => _.value = h()), C(() => R.value = f()), c;
805
874
  })();
806
875
  };
807
- Y(["input"]);
808
- var bt = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), vt = /* @__PURE__ */ l('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), ht = /* @__PURE__ */ l('<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>');
809
- const Rt = (r) => {
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: v
812
- } = z(), [f, h] = d(""), [$, p] = d(null), [S, _] = d(null), [u, n] = d(!1), m = async (i) => {
813
- i.preventDefault(), p(null), _(null), n(!0);
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 = i.currentTarget, c = new FormData(t), a = await v.emailPassword.resetPassword(r.token, c.get("password") || f());
816
- _(a.message), r.onSuccess?.(a.message);
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
- p(c.message);
893
+ $(c.message);
820
894
  } finally {
821
- n(!1);
895
+ l(!1);
822
896
  }
823
897
  };
824
898
  return (() => {
825
- var i = ht(), t = i.firstChild, c = t.firstChild, a = c.nextSibling, s = t.nextSibling;
826
- return i.addEventListener("submit", m), e(i, g(w, {
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 = bt();
832
- return e(o, $), o;
905
+ var o = _t();
906
+ return e(o, h), o;
833
907
  }
834
- }), t), e(i, g(w, {
908
+ }), t), e(s, g(y, {
835
909
  get when() {
836
- return S();
910
+ return f();
837
911
  },
838
912
  get children() {
839
- var o = vt();
840
- return e(o, S), o;
913
+ var o = St();
914
+ return e(o, f), o;
841
915
  }
842
- }), t), a.$$input = (o) => h(o.currentTarget.value), e(s, () => u() ? "Resetting..." : "Reset password"), E((o) => {
843
- var k = u(), b = u();
844
- return k !== o.e && (a.disabled = o.e = k), b !== o.t && (s.disabled = o.t = b), o;
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
- }), E(() => a.value = f()), i;
922
+ }), C(() => n.value = p()), s;
849
923
  })();
850
924
  };
851
- Y(["input"]);
852
- var yt = /* @__PURE__ */ l('<div class="text-sm text-muted-foreground">Verifying your email address...'), xt = /* @__PURE__ */ l('<div class="rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400">'), wt = /* @__PURE__ */ l('<div class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">'), $t = /* @__PURE__ */ l("<div class=space-y-4>");
853
- const Nt = (r) => {
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: v
856
- } = z(), [f, h] = d("loading"), [$, p] = d(""), [S, _] = d("");
857
- return me(async () => {
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 u = await v.emailPassword.verify(r.token);
860
- p(u.message), h("success"), r.onSuccess?.();
861
- } catch (u) {
862
- const n = u instanceof Error ? u : new Error(String(u));
863
- _(n.message), h("error"), r.onError?.(n);
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 u = $t();
867
- return e(u, g(w, {
944
+ var d = Dt();
945
+ return e(d, g(y, {
868
946
  get when() {
869
- return f() === "loading";
947
+ return p() === "loading";
870
948
  },
871
949
  get children() {
872
- return yt();
950
+ return Ct();
873
951
  }
874
- }), null), e(u, g(w, {
952
+ }), null), e(d, g(y, {
875
953
  get when() {
876
- return f() === "success";
954
+ return p() === "success";
877
955
  },
878
956
  get children() {
879
- var n = xt();
880
- return e(n, $), n;
957
+ var l = Et();
958
+ return e(l, h), l;
881
959
  }
882
- }), null), e(u, g(w, {
960
+ }), null), e(d, g(y, {
883
961
  get when() {
884
- return f() === "error";
962
+ return p() === "error";
885
963
  },
886
964
  get children() {
887
- var n = wt();
888
- return e(n, S), n;
965
+ var l = Pt();
966
+ return e(l, f), l;
889
967
  }
890
- }), null), u;
968
+ }), null), d;
891
969
  })();
892
970
  };
893
971
  export {
894
- Et as ChangePasswordForm,
895
- Pt as ConsentScreen,
896
- Dt as ForgotPasswordForm,
897
- Tt as LoginForm,
898
- Lt as MagicLinkForm,
899
- At as MfaChallenge,
900
- jt as MfaSetup,
901
- Ft as OAuthButtons,
902
- Le as PasskeyButton,
903
- Mt as ProfileSettings,
904
- qt as RegisterForm,
905
- Rt as ResetPasswordForm,
906
- Nt as VerifyEmail,
907
- Ct as YAuthProvider,
908
- z as useYAuth
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
  };