@edgespark/web 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,72 +1,72 @@
1
- import { createAuthClient as De } from "better-auth/client";
2
- class te extends Error {
3
- constructor(e, s) {
4
- super(s), this.name = "EdgeSparkError", this.code = e;
1
+ import { createAuthClient as Ge } from "better-auth/client";
2
+ class le extends Error {
3
+ constructor(e, i) {
4
+ super(i), this.name = "EdgeSparkError", this.code = e;
5
5
  }
6
6
  }
7
- class f extends te {
7
+ class g extends le {
8
8
  constructor(e) {
9
9
  super("CONFIG_ERROR", e), this.name = "EdgeSparkConfigError";
10
10
  }
11
11
  }
12
- class Ee extends te {
12
+ class Re extends le {
13
13
  constructor(e) {
14
14
  super("RUNTIME_ERROR", e), this.name = "EdgeSparkRuntimeError";
15
15
  }
16
16
  }
17
- class E extends te {
18
- constructor(e, s) {
19
- super((s == null ? void 0 : s.code) ?? "AUTH_ERROR", e), this.name = "EdgeSparkAuthError", this.cause = s == null ? void 0 : s.cause, this.status = s == null ? void 0 : s.status;
17
+ class L extends le {
18
+ constructor(e, i) {
19
+ super((i == null ? void 0 : i.code) ?? "AUTH_ERROR", e), this.name = "EdgeSparkAuthError", this.cause = i == null ? void 0 : i.cause, this.status = i == null ? void 0 : i.status;
20
20
  }
21
21
  }
22
- function Se(t, e = "Authentication failed.", s) {
23
- if (t instanceof E)
22
+ function de(t, e = "Authentication failed.", i) {
23
+ if (t instanceof L)
24
24
  return t;
25
25
  if (typeof t == "object" && t !== null) {
26
- const i = t;
27
- return new E(i.message || e, {
28
- code: i.code ?? s,
29
- status: i.status,
26
+ const s = t;
27
+ return new L(s.message || e, {
28
+ code: s.code ?? i,
29
+ status: s.status,
30
30
  cause: t
31
31
  });
32
32
  }
33
- return typeof t == "string" ? new E(t, { code: s }) : new E(e, { code: s, cause: t });
33
+ return typeof t == "string" ? new L(t, { code: i }) : new L(e, { code: i, cause: t });
34
34
  }
35
- function Pe() {
35
+ function Ce() {
36
36
  if (typeof window > "u" || typeof document > "u")
37
- throw new Ee(
37
+ throw new Re(
38
38
  "@edgespark/web is browser-only. Create the client from a real browser runtime."
39
39
  );
40
40
  }
41
- function Q() {
42
- return Pe(), window.location.origin;
41
+ function oe() {
42
+ return Ce(), window.location.origin;
43
43
  }
44
- function Ne(t) {
44
+ function He(t) {
45
45
  return t instanceof URL ? t : typeof t == "string" ? new URL(t, window.location.href) : new URL(t.url, window.location.href);
46
46
  }
47
- function Ve(t) {
48
- if (t.origin !== Q())
49
- throw new f(
50
- `Cross-origin requests are not supported by this SDK. Received ${t.origin}, expected ${Q()}.`
47
+ function ze(t) {
48
+ if (t.origin !== oe())
49
+ throw new g(
50
+ `Cross-origin requests are not supported by this SDK. Received ${t.origin}, expected ${oe()}.`
51
51
  );
52
52
  }
53
- function Fe() {
53
+ function xe() {
54
54
  return {
55
55
  async fetch(t, e) {
56
- const s = Ne(t);
57
- return Ve(s), fetch(t, {
56
+ const i = He(t);
57
+ return ze(i), fetch(t, {
58
58
  ...e,
59
59
  credentials: "include"
60
60
  });
61
61
  }
62
62
  };
63
63
  }
64
- const Le = "/api/_es/auth", He = "edgespark-auth-session", _e = "__edgespark_auth_sync__", V = "__edgespark_auth_pending_sign_in__", Ae = Symbol("edgespark.notifyAuthTabs"), ze = 10 * 60 * 1e3, je = /* @__PURE__ */ new Set([
64
+ const Ue = "/api/_es/auth", je = "edgespark-auth-session", $e = "__edgespark_auth_sync__", j = "__edgespark_auth_pending_sign_in__", ke = Symbol("edgespark.notifyAuthTabs"), qe = 10 * 60 * 1e3, Ke = /* @__PURE__ */ new Set([
65
65
  "signOut",
66
66
  "revokeSession",
67
67
  "revokeSessions",
68
68
  "revokeOtherSessions"
69
- ]), qe = /* @__PURE__ */ new Map([
69
+ ]), We = /* @__PURE__ */ new Map([
70
70
  [
71
71
  "changeEmail",
72
72
  "changeEmail() is not currently supported by EdgeSpark platform auth. Use authUI.mount() or other supported client.auth flows instead of wiring raw /api/_es/auth/* routes manually."
@@ -80,7 +80,7 @@ const Le = "/api/_es/auth", He = "edgespark-auth-session", _e = "__edgespark_aut
80
80
  "deleteUserCallback() is not currently supported by EdgeSpark platform auth. Handle account removal through your own app flow until the platform enables this capability."
81
81
  ]
82
82
  ]);
83
- class xe {
83
+ class Ye {
84
84
  constructor(e) {
85
85
  this.value = e;
86
86
  }
@@ -88,32 +88,32 @@ class xe {
88
88
  return this.value;
89
89
  }
90
90
  }
91
- const ne = globalThis.WeakRef, re = globalThis.FinalizationRegistry;
92
- let F, oe = !1;
93
- const C = /* @__PURE__ */ new Map(), H = re ? new re((t) => {
94
- C.delete(t);
91
+ const ce = globalThis.WeakRef, ue = globalThis.FinalizationRegistry;
92
+ let q, he = !1;
93
+ const M = /* @__PURE__ */ new Map(), K = ue ? new ue((t) => {
94
+ M.delete(t);
95
95
  }) : null;
96
- function Re(t) {
97
- return De({
98
- baseURL: Q(),
99
- basePath: Le,
96
+ function Be(t) {
97
+ return Ge({
98
+ baseURL: oe(),
99
+ basePath: Ue,
100
100
  ...t != null && t.disableDefaultRedirectPlugin ? { disableDefaultFetchPlugins: !0 } : {},
101
101
  fetchOptions: {
102
102
  credentials: "include"
103
103
  }
104
104
  });
105
105
  }
106
- function I(t) {
107
- var e, s;
108
- return (s = (e = t.$store) == null ? void 0 : e.atoms) == null ? void 0 : s.session;
106
+ function O(t) {
107
+ var e, i;
108
+ return (i = (e = t.$store) == null ? void 0 : e.atoms) == null ? void 0 : i.session;
109
109
  }
110
- function Ge(t) {
110
+ function Je(t) {
111
111
  return JSON.stringify({
112
112
  source: t,
113
113
  timestamp: Date.now()
114
114
  });
115
115
  }
116
- function Ke(t) {
116
+ function Xe(t) {
117
117
  if (typeof t != "string")
118
118
  return null;
119
119
  try {
@@ -123,70 +123,70 @@ function Ke(t) {
123
123
  return null;
124
124
  }
125
125
  }
126
- function We(t) {
126
+ function Ze(t) {
127
127
  return t.join(".");
128
128
  }
129
- function Ye(t) {
130
- const e = We(t), s = qe.get(e);
131
- return s ? new E(s, {
129
+ function Qe(t) {
130
+ const e = Ze(t), i = We.get(e);
131
+ return i ? new L(i, {
132
132
  code: "UNSUPPORTED_AUTH_METHOD"
133
133
  }) : null;
134
134
  }
135
- async function ee(t) {
135
+ async function ae(t) {
136
136
  var e;
137
137
  try {
138
- return await ((e = I(t)) == null ? void 0 : e.get().refetch()), !0;
138
+ return await ((e = O(t)) == null ? void 0 : e.get().refetch()), !0;
139
139
  } catch {
140
140
  return !1;
141
141
  }
142
142
  }
143
- function Te() {
144
- return F === void 0 && (F = typeof BroadcastChannel < "u" ? new BroadcastChannel(He) : null), F;
143
+ function Oe() {
144
+ return q === void 0 && (q = typeof BroadcastChannel < "u" ? new BroadcastChannel(je) : null), q;
145
145
  }
146
- function ae(t) {
147
- const e = Ke(t);
146
+ function me(t) {
147
+ const e = Xe(t);
148
148
  if (e)
149
- for (const [s, i] of C) {
150
- if (s === e.source)
149
+ for (const [i, s] of M) {
150
+ if (i === e.source)
151
151
  continue;
152
- const n = i.deref();
152
+ const n = s.deref();
153
153
  if (!n) {
154
- C.delete(s);
154
+ M.delete(i);
155
155
  continue;
156
156
  }
157
- ee(n);
157
+ ae(n);
158
158
  }
159
159
  }
160
- function Je() {
160
+ function et() {
161
161
  var t;
162
- oe || (oe = !0, (t = Te()) == null || t.addEventListener("message", (e) => {
163
- ae(e.data);
162
+ he || (he = !0, (t = Oe()) == null || t.addEventListener("message", (e) => {
163
+ me(e.data);
164
164
  }), typeof window < "u" && window.addEventListener("storage", (e) => {
165
- e.key !== _e || e.newValue === null || ae(e.newValue);
165
+ e.key !== $e || e.newValue === null || me(e.newValue);
166
166
  }));
167
167
  }
168
- function Xe(t, e) {
169
- ne ? C.set(t, new ne(e)) : (C.clear(), C.set(t, new xe(e))), H == null || H.register(e, t), Je();
168
+ function tt(t, e) {
169
+ ce ? M.set(t, new ce(e)) : (M.clear(), M.set(t, new Ye(e))), K == null || K.register(e, t), et();
170
170
  }
171
- function R(t) {
172
- const e = Ge(t), s = Te();
173
- let i = !1;
174
- if (s)
171
+ function k(t) {
172
+ const e = Je(t), i = Oe();
173
+ let s = !1;
174
+ if (i)
175
175
  try {
176
- s.postMessage(e), i = !0;
176
+ i.postMessage(e), s = !0;
177
177
  } catch {
178
178
  }
179
- if (!i)
179
+ if (!s)
180
180
  try {
181
- window.localStorage.setItem(_e, e);
181
+ window.localStorage.setItem($e, e);
182
182
  } catch {
183
183
  }
184
184
  }
185
- function z(t) {
185
+ function W(t) {
186
186
  if (!(typeof window > "u"))
187
187
  try {
188
188
  window.sessionStorage.setItem(
189
- V,
189
+ j,
190
190
  JSON.stringify({
191
191
  path: t,
192
192
  createdAt: Date.now()
@@ -195,315 +195,315 @@ function z(t) {
195
195
  } catch {
196
196
  }
197
197
  }
198
- function T() {
198
+ function B() {
199
199
  if (!(typeof window > "u"))
200
200
  try {
201
- window.sessionStorage.removeItem(V);
201
+ window.sessionStorage.removeItem(j);
202
202
  } catch {
203
203
  }
204
204
  }
205
- function Ze(t) {
205
+ function st(t) {
206
206
  return !!(t != null && t.session && (t != null && t.user));
207
207
  }
208
- function m(t) {
208
+ function w(t) {
209
209
  return t instanceof Date ? t.toISOString() : t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? t : t == null ? null : String(t);
210
210
  }
211
- function Qe(t) {
211
+ function it(t) {
212
212
  return t ? JSON.stringify({
213
213
  session: {
214
- createdAt: m(t.session.createdAt),
215
- expiresAt: m(t.session.expiresAt),
216
- id: m(t.session.id),
217
- impersonatedBy: m(t.session.impersonatedBy),
218
- ipAddress: m(t.session.ipAddress),
219
- token: m(t.session.token),
220
- updatedAt: m(t.session.updatedAt),
221
- userAgent: m(t.session.userAgent),
222
- userId: m(t.session.userId)
214
+ createdAt: w(t.session.createdAt),
215
+ expiresAt: w(t.session.expiresAt),
216
+ id: w(t.session.id),
217
+ impersonatedBy: w(t.session.impersonatedBy),
218
+ ipAddress: w(t.session.ipAddress),
219
+ token: w(t.session.token),
220
+ updatedAt: w(t.session.updatedAt),
221
+ userAgent: w(t.session.userAgent),
222
+ userId: w(t.session.userId)
223
223
  },
224
224
  user: {
225
- banExpires: m(t.user.banExpires),
226
- banReason: m(t.user.banReason),
227
- banned: m(t.user.banned),
228
- createdAt: m(t.user.createdAt),
229
- email: m(t.user.email),
230
- emailVerified: m(t.user.emailVerified),
231
- id: m(t.user.id),
232
- image: m(t.user.image),
233
- lastLoginAt: m(t.user.lastLoginAt),
234
- name: m(t.user.name),
235
- role: m(t.user.role),
236
- updatedAt: m(t.user.updatedAt)
225
+ banExpires: w(t.user.banExpires),
226
+ banReason: w(t.user.banReason),
227
+ banned: w(t.user.banned),
228
+ createdAt: w(t.user.createdAt),
229
+ email: w(t.user.email),
230
+ emailVerified: w(t.user.emailVerified),
231
+ id: w(t.user.id),
232
+ image: w(t.user.image),
233
+ lastLoginAt: w(t.user.lastLoginAt),
234
+ name: w(t.user.name),
235
+ role: w(t.user.role),
236
+ updatedAt: w(t.user.updatedAt)
237
237
  }
238
238
  }) : "__null__";
239
239
  }
240
- function Ie() {
240
+ function Me() {
241
241
  if (typeof window > "u")
242
242
  return null;
243
243
  try {
244
- const t = window.sessionStorage.getItem(V);
244
+ const t = window.sessionStorage.getItem(j);
245
245
  if (!t)
246
246
  return null;
247
247
  const e = JSON.parse(t);
248
- return !e || typeof e != "object" || typeof e.createdAt != "number" || Date.now() - e.createdAt > ze ? null : { createdAt: e.createdAt };
248
+ return !e || typeof e != "object" || typeof e.createdAt != "number" || Date.now() - e.createdAt > qe ? null : { createdAt: e.createdAt };
249
249
  } catch {
250
250
  return null;
251
251
  }
252
252
  }
253
- function le() {
254
- if (!Ie())
253
+ function fe() {
254
+ if (!Me())
255
255
  return !1;
256
256
  try {
257
- window.sessionStorage.removeItem(V);
257
+ window.sessionStorage.removeItem(j);
258
258
  } catch {
259
259
  }
260
260
  return !0;
261
261
  }
262
- function et() {
263
- return Ie() !== null;
262
+ function nt() {
263
+ return Me() !== null;
264
264
  }
265
- function tt(t) {
265
+ function rt(t) {
266
266
  if (!(t && typeof t == "object") || "error" in t && t.error)
267
267
  return !1;
268
268
  const e = "data" in t ? t.data : t;
269
269
  return e && typeof e == "object" ? "token" in e && typeof e.token == "string" && e.token.length > 0 ? !0 : "session" in e && "user" in e && !!e.session && !!e.user : !1;
270
270
  }
271
- function st(t) {
271
+ function ot(t) {
272
272
  if (!(t && typeof t == "object") || "error" in t && t.error)
273
273
  return !1;
274
274
  const e = "data" in t ? t.data : t;
275
275
  return e && typeof e == "object" ? "url" in e && typeof e.url == "string" : !1;
276
276
  }
277
- function it(t) {
278
- if (A(t) || !(t && typeof t == "object"))
277
+ function at(t) {
278
+ if ($(t) || !(t && typeof t == "object"))
279
279
  return !1;
280
280
  const e = "data" in t ? t.data : t;
281
281
  return e && typeof e == "object" ? "user" in e && !!e.user && "token" in e && e.token === null && !("url" in e) : !1;
282
282
  }
283
- function nt(t, e) {
283
+ function lt(t, e) {
284
284
  if (t.length !== 1 || t[0] !== "changePassword")
285
285
  return !1;
286
- const [s] = e;
287
- return !!(s && typeof s == "object" && "revokeOtherSessions" in s && s.revokeOtherSessions === !0);
286
+ const [i] = e;
287
+ return !!(i && typeof i == "object" && "revokeOtherSessions" in i && i.revokeOtherSessions === !0);
288
288
  }
289
- function A(t) {
289
+ function $(t) {
290
290
  return !!(t && typeof t == "object" && "error" in t && t.error);
291
291
  }
292
- function rt(t) {
293
- if (A(t) || !(t && typeof t == "object"))
292
+ function dt(t) {
293
+ if ($(t) || !(t && typeof t == "object"))
294
294
  return !1;
295
295
  const e = "data" in t ? t.data : t;
296
296
  return e && typeof e == "object" ? "message" in e && e.message === "User deleted" : !1;
297
297
  }
298
- function ot(t) {
298
+ function ct(t) {
299
299
  return !!(t && (typeof t == "object" || typeof t == "function") && "then" in t && typeof t.then == "function");
300
300
  }
301
- function j(t) {
302
- return Se(t, "Failed to load the current session.", "SESSION_LOOKUP_FAILED");
301
+ function Y(t) {
302
+ return de(t, "Failed to load the current session.", "SESSION_LOOKUP_FAILED");
303
303
  }
304
- async function at(t) {
305
- var s, i;
304
+ async function ut(t) {
305
+ var i, s;
306
306
  let e = null;
307
307
  try {
308
- await ((s = I(t)) == null ? void 0 : s.get().refetch());
308
+ await ((i = O(t)) == null ? void 0 : i.get().refetch());
309
309
  } catch (n) {
310
310
  e = n;
311
311
  } finally {
312
- (i = t[Ae]) == null || i.call(t);
312
+ (s = t[ke]) == null || s.call(t);
313
313
  }
314
314
  if (e)
315
315
  throw e;
316
316
  }
317
- function lt() {
318
- const t = Re(), e = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
319
- Xe(e, t);
320
- const s = 2, i = 500;
321
- let n = null, a = !1, u;
322
- const g = (o) => (u = o, o), S = () => {
323
- var c;
324
- const o = (c = I(t)) == null ? void 0 : c.get();
325
- return o != null && o.error && !o.data && u !== void 0 ? u : (o == null ? void 0 : o.data) ?? u ?? null;
326
- }, U = () => a ? Promise.resolve(S()) : (n || (n = (async () => {
327
- var l, h, y;
328
- let o = !1, c = null;
317
+ function ht() {
318
+ const t = Be(), e = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
319
+ tt(e, t);
320
+ const i = 2, s = 500;
321
+ let n = null, o = !1, u;
322
+ const f = (a) => (u = a, a), p = () => {
323
+ var h;
324
+ const a = (h = O(t)) == null ? void 0 : h.get();
325
+ return a != null && a.error && !a.data && u !== void 0 ? u : (a == null ? void 0 : a.data) ?? u ?? null;
326
+ }, A = () => o ? Promise.resolve(p()) : (n || (n = (async () => {
327
+ var l, m, T;
328
+ let a = !1, h = null;
329
329
  try {
330
- for (let b = 0; b <= s; b++) {
331
- let d = null;
330
+ for (let _ = 0; _ <= i; _++) {
331
+ let c = null;
332
332
  try {
333
- d = await t.getSession();
334
- } catch (P) {
335
- c = P;
333
+ c = await t.getSession();
334
+ } catch (I) {
335
+ h = I;
336
336
  }
337
- const p = ((l = I(t)) == null ? void 0 : l.get().data) ?? null;
338
- if ((h = d == null ? void 0 : d.data) != null && h.session && ((y = d.data) != null && y.user))
339
- return a = !0, le() && R(e), g(d.data);
340
- if (p != null && p.session && (p != null && p.user))
341
- return a = !0, le() && R(e), g(p);
342
- if (d != null && d.error ? c = d.error : d && (o = !0), d && !d.error && et() && b < s) {
337
+ const E = ((l = O(t)) == null ? void 0 : l.get().data) ?? null;
338
+ if ((m = c == null ? void 0 : c.data) != null && m.session && ((T = c.data) != null && T.user))
339
+ return o = !0, fe() && k(e), f(c.data);
340
+ if (E != null && E.session && (E != null && E.user))
341
+ return o = !0, fe() && k(e), f(E);
342
+ if (c != null && c.error ? h = c.error : c && (a = !0), c && !c.error && nt() && _ < i) {
343
343
  await new Promise(
344
- (P) => setTimeout(P, i)
344
+ (I) => setTimeout(I, s)
345
345
  );
346
346
  continue;
347
347
  }
348
- if (d && !d.error) {
349
- const P = S();
350
- return a = !0, g(P);
348
+ if (c && !c.error) {
349
+ const I = p();
350
+ return o = !0, f(I);
351
351
  }
352
- b < s && await new Promise(
353
- (P) => setTimeout(P, i)
352
+ _ < i && await new Promise(
353
+ (I) => setTimeout(I, s)
354
354
  );
355
355
  }
356
- if (!o)
357
- throw n = null, new E("Failed to load the current session.", {
356
+ if (!a)
357
+ throw n = null, new L("Failed to load the current session.", {
358
358
  code: "SESSION_LOOKUP_FAILED",
359
- cause: c
359
+ cause: h
360
360
  });
361
- const w = S();
362
- return a = !0, g(w);
363
- } catch (w) {
364
- throw n = null, j(w);
361
+ const y = p();
362
+ return o = !0, f(y);
363
+ } catch (y) {
364
+ throw n = null, Y(y);
365
365
  }
366
366
  })()), n);
367
- U().catch(() => {
367
+ A().catch(() => {
368
368
  });
369
- const $ = async () => {
370
- var o, c;
369
+ const v = async () => {
370
+ var a, h;
371
371
  try {
372
372
  const l = await t.getSession();
373
- if ((o = l.data) != null && o.session && ((c = l.data) != null && c.user))
373
+ if ((a = l.data) != null && a.session && ((h = l.data) != null && h.user))
374
374
  return l.data;
375
- throw l.error ? j(l.error) : new E("No authenticated session is available.", {
375
+ throw l.error ? Y(l.error) : new L("No authenticated session is available.", {
376
376
  code: "UNAUTHENTICATED"
377
377
  });
378
378
  } catch (l) {
379
- throw j(l);
379
+ throw Y(l);
380
380
  }
381
- }, v = async () => {
382
- await ee(t), R(e);
383
- }, Be = async () => {
381
+ }, b = async () => {
382
+ await ae(t), k(e);
383
+ }, P = async () => {
384
384
  var l;
385
- const o = await ee(t), c = ((l = I(t)) == null ? void 0 : l.get().data) ?? null;
386
- Ze(c) ? (T(), R(e)) : o || R(e);
387
- }, Me = (o) => {
388
- let c = !1, l = !1, h;
389
- const y = (d) => {
390
- const p = Qe(d);
391
- p !== h && (h = p, o(d));
385
+ const a = await ae(t), h = ((l = O(t)) == null ? void 0 : l.get().data) ?? null;
386
+ st(h) ? (B(), k(e)) : a || k(e);
387
+ }, d = (a) => {
388
+ let h = !1, l = !1, m;
389
+ const T = (c) => {
390
+ const E = it(c);
391
+ E !== m && (m = E, a(c));
392
392
  };
393
- U().then((d) => {
394
- c || (l = !0, y(g(d)));
393
+ A().then((c) => {
394
+ h || (l = !0, T(f(c)));
395
395
  }).catch(() => {
396
- c || (l = !0);
396
+ h || (l = !0);
397
397
  });
398
- const w = I(t);
399
- if (!w)
398
+ const y = O(t);
399
+ if (!y)
400
400
  return () => {
401
- c = !0;
401
+ h = !0;
402
402
  };
403
- const b = w.subscribe((d) => {
404
- if (c || !l || d.error && !d.data)
403
+ const _ = y.subscribe((c) => {
404
+ if (h || !l || c.error && !c.data)
405
405
  return;
406
- const p = d.data ?? null;
407
- y(g(p));
406
+ const E = c.data ?? null;
407
+ T(f(E));
408
408
  });
409
409
  return () => {
410
- c = !0, b();
410
+ h = !0, _();
411
411
  };
412
- }, Oe = async (o, c, l) => {
413
- const h = o[0], y = o.length >= 2 && h === "emailOtp" && o[1] === "verifyEmail", w = o.length >= 2 && h === "emailOtp" && o[1] === "resetPassword", b = o.length >= 2 && h === "resetPassword" && o[1] === "emailOtp";
414
- return o.length === 1 && (h === "deleteUser" || h === "deleteUserCallback") ? (T(), rt(l) && await v(), l) : o.length === 1 && h && je.has(h) ? (T(), A(l) || await v(), l) : nt(o, c) && !A(l) ? (T(), await v(), l) : (w || b) && !A(l) ? (T(), await v(), l) : o.length === 1 && h === "changeEmail" && !A(l) ? (await v(), l) : ((h === "signIn" || h === "signUp" || y) && tt(l) ? (T(), await v()) : (h === "signIn" || h === "signUp") && st(l) || h === "signUp" && it(l) ? z(o) : h === "verifyEmail" && !A(l) && (z(o), await Be()), l);
415
- }, se = /* @__PURE__ */ new WeakMap(), ie = (o, c) => {
416
- if (!o || typeof o != "object" && typeof o != "function")
417
- return o;
418
- const l = se.get(o);
412
+ }, S = async (a, h, l) => {
413
+ const m = a[0], T = a.length >= 2 && m === "emailOtp" && a[1] === "verifyEmail", y = a.length >= 2 && m === "emailOtp" && a[1] === "resetPassword", _ = a.length >= 2 && m === "resetPassword" && a[1] === "emailOtp", c = a.length >= 2 && m === "oneTap" && a[1] === "callback";
414
+ return a.length === 1 && (m === "deleteUser" || m === "deleteUserCallback") ? (B(), dt(l) && await b(), l) : a.length === 1 && m && Ke.has(m) ? (B(), $(l) || await b(), l) : lt(a, h) && !$(l) ? (B(), await b(), l) : (y || _) && !$(l) ? (B(), await b(), l) : a.length === 1 && m === "changeEmail" && !$(l) ? (await b(), l) : ((m === "signIn" || m === "signUp" || T || c) && rt(l) ? (B(), await b()) : (m === "signIn" || m === "signUp") && ot(l) || m === "signUp" && at(l) ? W(a) : m === "verifyEmail" && !$(l) && (W(a), await P()), l);
415
+ }, R = /* @__PURE__ */ new WeakMap(), D = (a, h) => {
416
+ if (!a || typeof a != "object" && typeof a != "function")
417
+ return a;
418
+ const l = R.get(a);
419
419
  if (l)
420
420
  return l;
421
- const h = new Proxy(o, {
422
- get(y, w, b) {
423
- if (c.length === 0) {
424
- if (w === "requireSession")
425
- return $;
426
- if (w === "onSessionChange")
427
- return Me;
428
- if (w === Ae)
421
+ const m = new Proxy(a, {
422
+ get(T, y, _) {
423
+ if (h.length === 0) {
424
+ if (y === "requireSession")
425
+ return v;
426
+ if (y === "onSessionChange")
427
+ return d;
428
+ if (y === ke)
429
429
  return () => {
430
- R(e);
430
+ k(e);
431
431
  };
432
432
  }
433
- const d = Reflect.get(y, w, b);
434
- return typeof w != "string" ? d : ie(d, [...c, w]);
433
+ const c = Reflect.get(T, y, _);
434
+ return typeof y != "string" ? c : D(c, [...h, y]);
435
435
  },
436
- apply(y, w, b) {
437
- const d = Ye(c);
438
- if (d)
439
- throw d;
440
- const p = Reflect.apply(
436
+ apply(T, y, _) {
437
+ const c = Qe(h);
438
+ if (c)
439
+ throw c;
440
+ const E = Reflect.apply(
441
+ T,
441
442
  y,
442
- w,
443
- b
443
+ _
444
444
  );
445
- return ot(p) ? Promise.resolve(p).then(
446
- (P) => Oe(c, b, P)
447
- ) : p;
445
+ return ct(E) ? Promise.resolve(E).then(
446
+ (I) => S(h, _, I)
447
+ ) : E;
448
448
  }
449
449
  });
450
- return se.set(o, h), h;
450
+ return R.set(a, m), m;
451
451
  };
452
- return ie(t, []);
452
+ return D(t, []);
453
453
  }
454
- function dt() {
455
- return Re({ disableDefaultRedirectPlugin: !0 });
454
+ function mt() {
455
+ return Be({ disableDefaultRedirectPlugin: !0 });
456
456
  }
457
- const Ce = "/api/_es/dev";
458
- function ct() {
457
+ const De = "/api/_es/dev";
458
+ function ft() {
459
459
  if (typeof document > "u") return !1;
460
460
  const t = document.querySelector('meta[name="edgespark-local-dev"]');
461
461
  return (t == null ? void 0 : t.getAttribute("content")) === "true";
462
462
  }
463
- async function ut(t) {
463
+ async function wt(t) {
464
464
  const e = typeof window < "u" ? window.location.origin : "";
465
465
  if (!e) return !1;
466
- const s = await fetch(
467
- `${e}${Ce}/auto-verify?email=${encodeURIComponent(t)}`,
466
+ const i = await fetch(
467
+ `${e}${De}/auto-verify?email=${encodeURIComponent(t)}`,
468
468
  { credentials: "include" }
469
469
  );
470
- return s.ok ? (await s.json()).verified === !0 : !1;
470
+ return i.ok ? (await i.json()).verified === !0 : !1;
471
471
  }
472
- async function ht(t) {
472
+ async function gt(t) {
473
473
  const e = typeof window < "u" ? window.location.origin : "";
474
474
  if (!e) return null;
475
475
  try {
476
- const s = await fetch(
477
- `${e}${Ce}/pending-otp?email=${encodeURIComponent(t)}`,
476
+ const i = await fetch(
477
+ `${e}${De}/pending-otp?email=${encodeURIComponent(t)}`,
478
478
  { credentials: "include" }
479
479
  );
480
- return s.ok ? (await s.json()).otp ?? null : null;
480
+ return i.ok ? (await i.json()).otp ?? null : null;
481
481
  } catch {
482
482
  return null;
483
483
  }
484
484
  }
485
- function mt(t) {
485
+ function pt(t) {
486
486
  const e = (() => {
487
487
  if (t instanceof URL)
488
488
  return t;
489
- const s = t.trim();
490
- if (!s)
491
- throw new f("redirectTo must not be an empty string.");
489
+ const i = t.trim();
490
+ if (!i)
491
+ throw new g("redirectTo must not be an empty string.");
492
492
  try {
493
- return new URL(s, window.location.href);
493
+ return new URL(i, window.location.href);
494
494
  } catch {
495
- throw new f(
495
+ throw new g(
496
496
  `redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(t)}`
497
497
  );
498
498
  }
499
499
  })();
500
500
  if (e.protocol !== "http:" && e.protocol !== "https:")
501
- throw new f(
501
+ throw new g(
502
502
  `redirectTo must resolve to an http(s) URL. Received protocol: ${e.protocol}`
503
503
  );
504
504
  return e;
505
505
  }
506
- function ft(t, e) {
506
+ function bt(t, e) {
507
507
  return e ? {
508
508
  common: { ...t.common, ...e.common },
509
509
  signIn: { ...t.signIn, ...e.signIn },
@@ -515,7 +515,7 @@ function ft(t, e) {
515
515
  errors: { ...t.errors, ...e.errors }
516
516
  } : t;
517
517
  }
518
- const N = {
518
+ const x = {
519
519
  common: {
520
520
  loading: "Loading sign-in…",
521
521
  redirecting: "Redirecting…",
@@ -578,7 +578,7 @@ const N = {
578
578
  invalidCode: "Enter the 6-digit verification code.",
579
579
  generic: "Something went wrong. Please try again."
580
580
  }
581
- }, q = {
581
+ }, J = {
582
582
  common: {
583
583
  loading: "加载中…",
584
584
  redirecting: "跳转中…",
@@ -641,7 +641,7 @@ const N = {
641
641
  invalidCode: "请输入 6 位验证码",
642
642
  generic: "出现错误,请稍后重试"
643
643
  }
644
- }, de = {
644
+ }, we = {
645
645
  common: {
646
646
  loading: "サインインを読み込み中…",
647
647
  redirecting: "リダイレクト中…",
@@ -704,7 +704,7 @@ const N = {
704
704
  invalidCode: "6桁の認証コードを入力してください",
705
705
  generic: "エラーが発生しました。もう一度お試しください"
706
706
  }
707
- }, ce = {
707
+ }, ge = {
708
708
  common: {
709
709
  loading: "로그인 로딩 중…",
710
710
  redirecting: "리디렉션 중…",
@@ -767,7 +767,7 @@ const N = {
767
767
  invalidCode: "6자리 인증 코드를 입력해 주세요",
768
768
  generic: "문제가 발생했습니다. 다시 시도해 주세요"
769
769
  }
770
- }, x = {
770
+ }, X = {
771
771
  common: {
772
772
  loading: "Cargando inicio de sesión…",
773
773
  redirecting: "Redirigiendo…",
@@ -830,7 +830,7 @@ const N = {
830
830
  invalidCode: "Ingresa el código de verificación de 6 dígitos.",
831
831
  generic: "Algo salió mal. Por favor, inténtalo de nuevo."
832
832
  }
833
- }, ue = {
833
+ }, pe = {
834
834
  common: {
835
835
  loading: "Carregando login…",
836
836
  redirecting: "Redirecionando…",
@@ -893,7 +893,7 @@ const N = {
893
893
  invalidCode: "Insira o código de verificação de 6 dígitos.",
894
894
  generic: "Algo deu errado. Por favor, tente novamente."
895
895
  }
896
- }, he = {
896
+ }, be = {
897
897
  common: {
898
898
  loading: "Chargement de la connexion…",
899
899
  redirecting: "Redirection…",
@@ -956,7 +956,7 @@ const N = {
956
956
  invalidCode: "Saisissez le code de vérification à 6 chiffres.",
957
957
  generic: "Une erreur est survenue. Veuillez réessayer."
958
958
  }
959
- }, me = {
959
+ }, ve = {
960
960
  common: {
961
961
  loading: "Anmeldung wird geladen…",
962
962
  redirecting: "Weiterleitung…",
@@ -1019,7 +1019,7 @@ const N = {
1019
1019
  invalidCode: "Geben Sie den 6-stelligen Bestätigungscode ein.",
1020
1020
  generic: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."
1021
1021
  }
1022
- }, fe = {
1022
+ }, ye = {
1023
1023
  common: {
1024
1024
  loading: "Caricamento accesso…",
1025
1025
  redirecting: "Reindirizzamento…",
@@ -1082,7 +1082,7 @@ const N = {
1082
1082
  invalidCode: "Inserisci il codice di verifica a 6 cifre.",
1083
1083
  generic: "Qualcosa è andato storto. Riprova."
1084
1084
  }
1085
- }, we = {
1085
+ }, Ee = {
1086
1086
  common: {
1087
1087
  loading: "Загрузка входа…",
1088
1088
  redirecting: "Перенаправление…",
@@ -1145,7 +1145,7 @@ const N = {
1145
1145
  invalidCode: "Введите 6-значный код подтверждения.",
1146
1146
  generic: "Произошла ошибка. Пожалуйста, попробуйте снова."
1147
1147
  }
1148
- }, pe = {
1148
+ }, Se = {
1149
1149
  common: {
1150
1150
  loading: "جارٍ تحميل تسجيل الدخول…",
1151
1151
  redirecting: "جارٍ إعادة التوجيه…",
@@ -1208,7 +1208,7 @@ const N = {
1208
1208
  invalidCode: "يرجى إدخال رمز التحقّق المكوّن من 6 أرقام.",
1209
1209
  generic: "حدث خطأ. يرجى المحاولة مرة أخرى."
1210
1210
  }
1211
- }, ge = {
1211
+ }, Pe = {
1212
1212
  common: {
1213
1213
  loading: "सधाइन की जुलातीअ लोड हो रही है…",
1214
1214
  redirecting: "रीडायरेक्ट हो रहا है…",
@@ -1271,48 +1271,48 @@ const N = {
1271
1271
  invalidCode: "कृपया 6 अंकों का सत्यापन कोड दर्ज करें।",
1272
1272
  generic: "कुछ गलत हो गई। कृपया फिर से प्रयास करें।"
1273
1273
  }
1274
- }, be = {
1275
- en: N,
1276
- "en-US": N,
1277
- zh: q,
1278
- "zh-CN": q,
1279
- "zh-TW": q,
1280
- ja: de,
1281
- "ja-JP": de,
1282
- ko: ce,
1283
- "ko-KR": ce,
1284
- es: x,
1285
- "es-ES": x,
1286
- "es-MX": x,
1287
- pt: ue,
1288
- "pt-BR": ue,
1289
- fr: he,
1290
- "fr-FR": he,
1291
- de: me,
1292
- "de-DE": me,
1293
- it: fe,
1294
- "it-IT": fe,
1295
- ru: we,
1296
- "ru-RU": we,
1297
- ar: pe,
1298
- "ar-SA": pe,
1299
- hi: ge,
1300
- "hi-IN": ge
1274
+ }, _e = {
1275
+ en: x,
1276
+ "en-US": x,
1277
+ zh: J,
1278
+ "zh-CN": J,
1279
+ "zh-TW": J,
1280
+ ja: we,
1281
+ "ja-JP": we,
1282
+ ko: ge,
1283
+ "ko-KR": ge,
1284
+ es: X,
1285
+ "es-ES": X,
1286
+ "es-MX": X,
1287
+ pt: pe,
1288
+ "pt-BR": pe,
1289
+ fr: be,
1290
+ "fr-FR": be,
1291
+ de: ve,
1292
+ "de-DE": ve,
1293
+ it: ye,
1294
+ "it-IT": ye,
1295
+ ru: Ee,
1296
+ "ru-RU": Ee,
1297
+ ar: Se,
1298
+ "ar-SA": Se,
1299
+ hi: Pe,
1300
+ "hi-IN": Pe
1301
1301
  };
1302
- function wt() {
1302
+ function vt() {
1303
1303
  if (typeof navigator > "u")
1304
- return N;
1304
+ return x;
1305
1305
  const t = navigator.languages ?? [navigator.language];
1306
1306
  for (const e of t) {
1307
- const s = be[e] ?? be[e.split("-")[0]];
1308
- if (s) return s;
1307
+ const i = _e[e] ?? _e[e.split("-")[0]];
1308
+ if (i) return i;
1309
1309
  }
1310
- return N;
1310
+ return x;
1311
1311
  }
1312
- const Ue = {
1312
+ const Ne = {
1313
1313
  LIGHT: "light",
1314
1314
  DARK: "dark"
1315
- }, $e = Ue.LIGHT, pt = Ue.DARK, ke = [$e, pt], gt = $e, bt = {
1315
+ }, Ve = Ne.LIGHT, yt = Ne.DARK, Fe = [Ve, yt], Et = Ve, St = {
1316
1316
  BACKGROUND: "--edgespark-auth-bg",
1317
1317
  BACKGROUND_MUTED: "--edgespark-auth-bg-muted",
1318
1318
  CARD_BACKGROUND: "--edgespark-auth-card-bg",
@@ -1332,31 +1332,31 @@ const Ue = {
1332
1332
  MODAL_BACKDROP: "--edgespark-auth-modal-backdrop",
1333
1333
  MODAL_CARD_BACKGROUND: "--edgespark-auth-modal-card-bg",
1334
1334
  MODAL_SHADOW: "--edgespark-auth-modal-shadow"
1335
- }, vt = Object.values(
1336
- bt
1335
+ }, Pt = Object.values(
1336
+ St
1337
1337
  );
1338
- function yt(t) {
1339
- return typeof t == "string" && ke.includes(t);
1338
+ function _t(t) {
1339
+ return typeof t == "string" && Fe.includes(t);
1340
1340
  }
1341
- function Et(t) {
1342
- return vt.includes(t);
1341
+ function Lt(t) {
1342
+ return Pt.includes(t);
1343
1343
  }
1344
- function St(t) {
1344
+ function At(t) {
1345
1345
  var e;
1346
1346
  return {
1347
- theme: (t == null ? void 0 : t.theme) ?? gt,
1347
+ theme: (t == null ? void 0 : t.theme) ?? Et,
1348
1348
  className: ((e = t == null ? void 0 : t.className) == null ? void 0 : e.trim()) ?? "",
1349
1349
  variables: { ...(t == null ? void 0 : t.variables) ?? {} }
1350
1350
  };
1351
1351
  }
1352
- function G(t, e = "Authentication failed.") {
1353
- return Se(t, e);
1352
+ function Z(t, e = "Authentication failed.") {
1353
+ return de(t, e);
1354
1354
  }
1355
- async function B(t) {
1356
- var s, i;
1355
+ async function V(t) {
1356
+ var i, s;
1357
1357
  const e = await t.getSession();
1358
1358
  if (e.error)
1359
- throw new E(
1359
+ throw new L(
1360
1360
  e.error.message || "Failed to load the current session.",
1361
1361
  {
1362
1362
  code: e.error.code ?? "SESSION_LOOKUP_FAILED",
@@ -1364,7 +1364,7 @@ async function B(t) {
1364
1364
  cause: e.error
1365
1365
  }
1366
1366
  );
1367
- return (s = e.data) != null && s.user && ((i = e.data) != null && i.session) ? {
1367
+ return (i = e.data) != null && i.user && ((s = e.data) != null && s.session) ? {
1368
1368
  user: e.data.user,
1369
1369
  session: e.data
1370
1370
  } : {
@@ -1372,13 +1372,13 @@ async function B(t) {
1372
1372
  session: null
1373
1373
  };
1374
1374
  }
1375
- const Pt = "data-edgespark-auth", Lt = "data-edgespark-auth-theme", r = "edgespark-auth", K = "es_auth_completion", M = "es_auth_email", W = "oauth", k = "verify-sign-in", L = "verify-sign-up", ve = 200, Y = 2, _t = {
1375
+ const Tt = "data-edgespark-auth", It = "data-edgespark-auth-theme", r = "edgespark-auth", Q = "es_auth_completion", F = "es_auth_email", ee = "oauth", N = "verify-sign-in", C = "verify-sign-up", Le = 200, te = 2, Rt = {
1376
1376
  "&": "&amp;",
1377
1377
  "<": "&lt;",
1378
1378
  ">": "&gt;",
1379
1379
  '"': "&quot;",
1380
1380
  "'": "&#39;"
1381
- }, J = {
1381
+ }, se = {
1382
1382
  google: "Google",
1383
1383
  apple: "Apple",
1384
1384
  microsoft: "Microsoft",
@@ -1386,27 +1386,27 @@ const Pt = "data-edgespark-auth", Lt = "data-edgespark-auth-theme", r = "edgespa
1386
1386
  gitlab: "GitLab",
1387
1387
  discord: "Discord"
1388
1388
  };
1389
- function _(t) {
1389
+ function U(t) {
1390
1390
  return "redirectTo" in t;
1391
1391
  }
1392
- function X(t) {
1392
+ function ie(t) {
1393
1393
  return "onSuccess" in t && !("redirectTo" in t);
1394
1394
  }
1395
- function Z(t) {
1395
+ function ne(t) {
1396
1396
  return !t || typeof t != "string" ? !1 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim());
1397
1397
  }
1398
- function At(t) {
1398
+ function Ct(t) {
1399
1399
  return /^\d{6}$/.test(t.trim());
1400
1400
  }
1401
- function Rt(t) {
1401
+ function Ut(t) {
1402
1402
  return t === "email" || t === "name" || t === "password" || t === "confirmPassword" || t === "code" || t === "newPassword";
1403
1403
  }
1404
- function Tt(t) {
1404
+ function $t(t) {
1405
1405
  return !!(t.error || t.errorDescription);
1406
1406
  }
1407
- class It {
1408
- constructor(e, s, i, n, a) {
1409
- this.container = e, this.auth = s, this.options = i, this.loadConfig = n, this.runtimeOptions = a, this.state = {
1407
+ class kt {
1408
+ constructor(e, i, s, n, o) {
1409
+ this.container = e, this.auth = i, this.options = s, this.loadConfig = n, this.runtimeOptions = o, this.state = {
1410
1410
  view: "loading",
1411
1411
  busy: !0,
1412
1412
  busyLabel: void 0,
@@ -1419,39 +1419,39 @@ class It {
1419
1419
  code: "",
1420
1420
  newPassword: ""
1421
1421
  }, this.destroyed = !1, this.terminalActionInProgress = !1, this.config = null, this.countdownUntil = null, this.countdownTimer = null, this.pendingFocusSnapshot = null, this.focusRestoreTimer = null, this.verificationCompletionAction = null;
1422
- const u = St(i.appearance);
1423
- this.labels = ft(wt(), i.labels), this.root = document.createElement("div"), this.root.className = u.className ? `${r} ${u.className}` : r, this.root.setAttribute(Pt, ""), this.root.setAttribute(Lt, u.theme);
1424
- for (const [g, S] of Object.entries(u.variables))
1425
- S !== void 0 && this.root.style.setProperty(g, S);
1426
- e.innerHTML = "", e.appendChild(this.root), this.render(), this.initialize();
1422
+ const u = At(s.appearance);
1423
+ this.labels = bt(vt(), s.labels), this.root = document.createElement("div"), this.root.className = u.className ? `${r} ${u.className}` : r, this.root.setAttribute(Tt, ""), this.root.setAttribute(It, u.theme);
1424
+ for (const [f, p] of Object.entries(u.variables))
1425
+ p !== void 0 && this.root.style.setProperty(f, p);
1426
+ e.appendChild(this.root), this.render(), this.initialize();
1427
1427
  }
1428
1428
  destroy() {
1429
- this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.container.innerHTML = "");
1429
+ this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.root.remove());
1430
1430
  }
1431
1431
  async initialize() {
1432
1432
  const e = this.consumeManagedReturnContext();
1433
1433
  try {
1434
- const [s, i] = await Promise.allSettled([
1434
+ const [i, s] = await Promise.allSettled([
1435
1435
  this.loadConfig(),
1436
1436
  this.readMountSession(e)
1437
1437
  ]);
1438
1438
  if (this.destroyed)
1439
1439
  return;
1440
- if (i.status === "rejected") {
1441
- if (e.marker && !Tt(e) && _(this.options)) {
1440
+ if (s.status === "rejected") {
1441
+ if (e.marker && !$t(e) && U(this.options)) {
1442
1442
  this.redirectAfterManagedReturnLookupFailure();
1443
1443
  return;
1444
1444
  }
1445
1445
  } else {
1446
- const a = i.value;
1447
- if (a.user && a.session) {
1446
+ const o = s.value;
1447
+ if (o.user && o.session) {
1448
1448
  switch (e.marker) {
1449
- case W:
1450
- case k:
1451
- await this.completeAuth("sign-in", a);
1449
+ case ee:
1450
+ case N:
1451
+ await this.completeAuth("sign-in", o);
1452
1452
  return;
1453
- case L:
1454
- await this.completeAuth("sign-up", a);
1453
+ case C:
1454
+ await this.completeAuth("sign-up", o);
1455
1455
  return;
1456
1456
  default:
1457
1457
  break;
@@ -1460,40 +1460,40 @@ class It {
1460
1460
  return;
1461
1461
  }
1462
1462
  }
1463
- if (s.status === "rejected")
1464
- throw i.status === "rejected" ? i.reason : s.reason;
1465
- if (this.config = s.value, this.handleSessionlessManagedReturn(e))
1466
- return;
1467
1463
  if (i.status === "rejected")
1468
- throw i.reason;
1469
- const n = i.value;
1464
+ throw s.status === "rejected" ? s.reason : i.reason;
1465
+ if (this.config = i.value, this.handleSessionlessManagedReturn(e))
1466
+ return;
1467
+ if (s.status === "rejected")
1468
+ throw s.reason;
1469
+ const n = s.value;
1470
1470
  this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.render();
1471
- } catch (s) {
1472
- this.handleError(s, "Failed to load the authentication UI.");
1471
+ } catch (i) {
1472
+ this.handleError(i, "Failed to load the authentication UI.");
1473
1473
  }
1474
1474
  }
1475
1475
  redirectAfterManagedReturnLookupFailure() {
1476
- _(this.options) && this.navigateToRedirect();
1476
+ U(this.options) && this.navigateToRedirect();
1477
1477
  }
1478
1478
  navigateToRedirect() {
1479
- _(this.options) && (this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(mt(this.options.redirectTo).toString()));
1479
+ U(this.options) && (this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(pt(this.options.redirectTo).toString()));
1480
1480
  }
1481
1481
  async readMountSession(e) {
1482
1482
  if (!e.marker)
1483
- return B(this.auth);
1484
- let s = null;
1485
- for (let i = 0; i <= Y; i++) {
1483
+ return V(this.auth);
1484
+ let i = null;
1485
+ for (let s = 0; s <= te; s++) {
1486
1486
  try {
1487
- const n = await B(this.auth);
1487
+ const n = await V(this.auth);
1488
1488
  if (n.user && n.session)
1489
1489
  return n;
1490
1490
  } catch (n) {
1491
- s = n;
1491
+ i = n;
1492
1492
  }
1493
- i < Y && await new Promise((n) => setTimeout(n, ve));
1493
+ s < te && await new Promise((n) => setTimeout(n, Le));
1494
1494
  }
1495
- if (s)
1496
- throw s;
1495
+ if (i)
1496
+ throw i;
1497
1497
  return {
1498
1498
  user: null,
1499
1499
  session: null
@@ -1559,8 +1559,8 @@ class It {
1559
1559
  }
1560
1560
  }
1561
1561
  renderSignInView() {
1562
- var i, n;
1563
- const e = this.renderOAuthProviders(), s = ((i = this.config) == null ? void 0 : i.emailPasswordEnabled) ?? !0;
1562
+ var s, n;
1563
+ const e = this.renderOAuthProviders(), i = ((s = this.config) == null ? void 0 : s.emailPasswordEnabled) ?? !0;
1564
1564
  return `
1565
1565
  <section class="${r}__section">
1566
1566
  <header class="${r}__header">
@@ -1568,8 +1568,8 @@ class It {
1568
1568
  <p class="${r}__copy">${this.escape(this.labels.signIn.subtitle)}</p>
1569
1569
  </header>
1570
1570
  ${e}
1571
- ${e && s ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
1572
- ${s ? `
1571
+ ${e && i ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
1572
+ ${i ? `
1573
1573
  <form class="${r}__form" data-view="sign-in" novalidate>
1574
1574
  ${this.renderInput("email", this.labels.signIn.emailLabel, "email", this.state.email, "email")}
1575
1575
  ${this.renderInput("password", this.labels.signIn.passwordLabel, "password", this.state.password, "current-password")}
@@ -1698,28 +1698,28 @@ class It {
1698
1698
  `;
1699
1699
  }
1700
1700
  renderOAuthProviders() {
1701
- var s;
1702
- const e = ((s = this.config) == null ? void 0 : s.oauthProviders) ?? [];
1701
+ var i;
1702
+ const e = ((i = this.config) == null ? void 0 : i.oauthProviders) ?? [];
1703
1703
  return e.length === 0 ? "" : `
1704
1704
  <div class="${r}__stack">
1705
- ${e.map((i) => `
1706
- <button class="${r}__button ${r}__button--secondary" type="button" data-action="oauth" data-provider="${i}" ${this.state.busy ? "disabled" : ""}>
1707
- ${this.escape(`${this.labels.oauth.continueWith} ${J[i]}`)}
1705
+ ${e.map((s) => `
1706
+ <button class="${r}__button ${r}__button--secondary" type="button" data-action="oauth" data-provider="${s}" ${this.state.busy ? "disabled" : ""}>
1707
+ ${this.escape(`${this.labels.oauth.continueWith} ${se[s]}`)}
1708
1708
  </button>
1709
1709
  `).join("")}
1710
1710
  </div>
1711
1711
  `;
1712
1712
  }
1713
- renderInput(e, s, i, n, a) {
1713
+ renderInput(e, i, s, n, o) {
1714
1714
  return `
1715
1715
  <label class="${r}__field">
1716
- <span class="${r}__label">${this.escape(s)}</span>
1716
+ <span class="${r}__label">${this.escape(i)}</span>
1717
1717
  <input
1718
1718
  class="${r}__input"
1719
1719
  name="${this.escape(e)}"
1720
- type="${this.escape(i)}"
1720
+ type="${this.escape(s)}"
1721
1721
  value="${this.escape(n)}"
1722
- autocomplete="${this.escape(a)}"
1722
+ autocomplete="${this.escape(o)}"
1723
1723
  ${this.state.busy ? "disabled" : ""}
1724
1724
  />
1725
1725
  </label>
@@ -1727,19 +1727,19 @@ class It {
1727
1727
  }
1728
1728
  bindDOM() {
1729
1729
  this.root.querySelectorAll("form[data-view]").forEach((n) => {
1730
- n.addEventListener("submit", (a) => {
1731
- a.preventDefault();
1730
+ n.addEventListener("submit", (o) => {
1731
+ o.preventDefault();
1732
1732
  const u = n.dataset.view;
1733
1733
  u === "sign-in" && this.handleSignIn(), u === "sign-up" && this.handleSignUp(), u === "forgot-password" && this.handleForgotPassword(), u === "reset-password" && this.handleResetPassword();
1734
1734
  });
1735
1735
  }), this.root.querySelectorAll("input[name]").forEach((n) => {
1736
1736
  n.addEventListener("input", () => {
1737
- Rt(n.name) && (this.state[n.name] = n.value);
1737
+ Ut(n.name) && (this.state[n.name] = n.value);
1738
1738
  });
1739
1739
  }), this.root.querySelectorAll("[data-action]").forEach((n) => {
1740
1740
  n.addEventListener("click", () => {
1741
- const a = n.dataset.action;
1742
- a === "switch-sign-up" && this.switchView("sign-up"), a === "switch-sign-in" && this.switchView("sign-in"), a === "forgot-password" && this.switchView("forgot-password"), a === "resend-verification" && this.resendVerificationEmail(), a === "use-different-email" && this.switchView(this.verificationCompletionAction === "sign-in" ? "sign-in" : "sign-up"), a === "resend-reset-code" && this.resendResetCode(), a === "oauth" && this.handleOAuthSignIn(n.dataset.provider);
1741
+ const o = n.dataset.action;
1742
+ o === "switch-sign-up" && this.switchView("sign-up"), o === "switch-sign-in" && this.switchView("sign-in"), o === "forgot-password" && this.switchView("forgot-password"), o === "resend-verification" && this.resendVerificationEmail(), o === "use-different-email" && this.switchView(this.verificationCompletionAction === "sign-in" ? "sign-in" : "sign-up"), o === "resend-reset-code" && this.resendResetCode(), o === "oauth" && this.handleOAuthSignIn(n.dataset.provider);
1743
1743
  });
1744
1744
  });
1745
1745
  }
@@ -1747,7 +1747,7 @@ class It {
1747
1747
  this.clearCountdown(), e !== "verify-email" && (this.verificationCompletionAction = null), this.state.view = e, this.state.error = null, this.state.notice = null, this.state.busy = !1, this.state.busyLabel = void 0, this.terminalActionInProgress = !1, this.render();
1748
1748
  }
1749
1749
  async handleSignIn() {
1750
- if (!Z(this.state.email)) {
1750
+ if (!ne(this.state.email)) {
1751
1751
  this.failValidation(this.labels.errors.invalidEmail);
1752
1752
  return;
1753
1753
  }
@@ -1759,7 +1759,7 @@ class It {
1759
1759
  const e = await this.auth.signIn.email({
1760
1760
  email: this.state.email.trim(),
1761
1761
  password: this.state.password,
1762
- callbackURL: this.getManagedReturnURL(k, this.state.email.trim())
1762
+ callbackURL: this.getManagedReturnURL(N, this.state.email.trim())
1763
1763
  });
1764
1764
  if (e.error)
1765
1765
  throw e.error;
@@ -1767,12 +1767,12 @@ class It {
1767
1767
  });
1768
1768
  }
1769
1769
  async handleSignUp() {
1770
- var e, s;
1770
+ var e, i;
1771
1771
  if (!this.state.name.trim()) {
1772
1772
  this.failValidation(this.labels.errors.requiredField);
1773
1773
  return;
1774
1774
  }
1775
- if (!Z(this.state.email)) {
1775
+ if (!ne(this.state.email)) {
1776
1776
  this.failValidation(this.labels.errors.invalidEmail);
1777
1777
  return;
1778
1778
  }
@@ -1782,7 +1782,7 @@ class It {
1782
1782
  }
1783
1783
  if (this.state.password.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
1784
1784
  this.failValidation(
1785
- this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
1785
+ this.labels.errors.passwordTooShort.replace("{min}", String(((i = this.config) == null ? void 0 : i.minPasswordLength) ?? 8))
1786
1786
  );
1787
1787
  return;
1788
1788
  }
@@ -1792,60 +1792,60 @@ class It {
1792
1792
  }
1793
1793
  await this.runAction("Creating account…", async () => {
1794
1794
  var n;
1795
- const i = await this.auth.signUp.email({
1795
+ const s = await this.auth.signUp.email({
1796
1796
  name: this.state.name.trim(),
1797
1797
  email: this.state.email.trim(),
1798
1798
  password: this.state.password,
1799
- callbackURL: this.getManagedReturnURL(L, this.state.email.trim())
1799
+ callbackURL: this.getManagedReturnURL(C, this.state.email.trim())
1800
1800
  });
1801
- if (i.error)
1802
- throw i.error;
1801
+ if (s.error)
1802
+ throw s.error;
1803
1803
  if ((n = this.config) != null && n.requireEmailVerification) {
1804
- if (this.config.isLocalDev && await this.tryDevAutoVerify("sign-up", i.data))
1804
+ if (this.config.isLocalDev && await this.tryDevAutoVerify("sign-up", s.data))
1805
1805
  return;
1806
1806
  this.verificationCompletionAction = "sign-up", this.state.view = "verify-email", this.state.notice = this.config.isLocalDev ? "Dev mode: auto-verify didn’t complete. Click resend to retry." : "Check your inbox to verify your email address.", this.startCountdown();
1807
1807
  return;
1808
1808
  }
1809
- await this.completeAuth("sign-up", await this.resolveAuthCompletionData(i.data));
1809
+ await this.completeAuth("sign-up", await this.resolveAuthCompletionData(s.data));
1810
1810
  });
1811
1811
  }
1812
1812
  async handleOAuthSignIn(e) {
1813
- await this.runAction(`Redirecting to ${J[e]}…`, async () => {
1814
- const s = await this.auth.signIn.social({
1813
+ await this.runAction(`Redirecting to ${se[e]}…`, async () => {
1814
+ const i = await this.auth.signIn.social({
1815
1815
  provider: e,
1816
1816
  callbackURL: this.getManagedReturnURL("oauth"),
1817
1817
  errorCallbackURL: this.getManagedReturnURL("oauth")
1818
1818
  });
1819
- if (s.error)
1820
- throw s.error;
1821
- const i = this.extractRedirectURL(s.data);
1822
- if (!i)
1823
- throw new f(`OAuth sign-in did not return a redirect URL for provider "${e}".`);
1824
- this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${J[e]}…`, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(i);
1819
+ if (i.error)
1820
+ throw i.error;
1821
+ const s = this.extractRedirectURL(i.data);
1822
+ if (!s)
1823
+ throw new g(`OAuth sign-in did not return a redirect URL for provider "${e}".`);
1824
+ this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${se[e]}…`, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(s);
1825
1825
  });
1826
1826
  }
1827
1827
  async handleForgotPassword() {
1828
1828
  if (!this.canUsePasswordResetEmailOtp()) {
1829
1829
  this.handleError(
1830
- new f("Password reset via email OTP is not enabled for this project.")
1830
+ new g("Password reset via email OTP is not enabled for this project.")
1831
1831
  );
1832
1832
  return;
1833
1833
  }
1834
- if (!Z(this.state.email)) {
1834
+ if (!ne(this.state.email)) {
1835
1835
  this.failValidation(this.labels.errors.invalidEmail);
1836
1836
  return;
1837
1837
  }
1838
1838
  await this.runAction("Sending reset code…", async () => {
1839
- var s;
1839
+ var i;
1840
1840
  const e = await this.passwordResetEndpoints().forgetPassword.emailOtp({
1841
1841
  email: this.state.email.trim()
1842
1842
  });
1843
1843
  if (e.error)
1844
1844
  throw e.error;
1845
- if (this.state.view = "reset-password", (s = this.config) != null && s.isLocalDev) {
1845
+ if (this.state.view = "reset-password", (i = this.config) != null && i.isLocalDev) {
1846
1846
  this.state.busyLabel = "Dev mode: fetching reset code…", this.render();
1847
- const i = await ht(this.state.email.trim());
1848
- i ? (this.state.code = i, this.state.notice = `Dev mode: reset code auto-filled (${i})`) : this.state.notice = "Dev mode: could not retrieve reset code — check server logs";
1847
+ const s = await gt(this.state.email.trim());
1848
+ s ? (this.state.code = s, this.state.notice = `Dev mode: reset code auto-filled (${s})`) : this.state.notice = "Dev mode: could not retrieve reset code — check server logs";
1849
1849
  } else
1850
1850
  this.state.notice = `We sent a reset code to ${this.state.email.trim()}.`;
1851
1851
  this.startCountdown();
@@ -1855,14 +1855,14 @@ class It {
1855
1855
  this.isCountdownActive() || await this.handleForgotPassword();
1856
1856
  }
1857
1857
  async handleResetPassword() {
1858
- var e, s;
1858
+ var e, i;
1859
1859
  if (!this.canUsePasswordResetEmailOtp()) {
1860
1860
  this.handleError(
1861
- new f("Password reset via email OTP is not enabled for this project.")
1861
+ new g("Password reset via email OTP is not enabled for this project.")
1862
1862
  );
1863
1863
  return;
1864
1864
  }
1865
- if (!At(this.state.code)) {
1865
+ if (!Ct(this.state.code)) {
1866
1866
  this.failValidation(this.labels.errors.invalidCode);
1867
1867
  return;
1868
1868
  }
@@ -1872,7 +1872,7 @@ class It {
1872
1872
  }
1873
1873
  if (this.state.newPassword.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
1874
1874
  this.failValidation(
1875
- this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
1875
+ this.labels.errors.passwordTooShort.replace("{min}", String(((i = this.config) == null ? void 0 : i.minPasswordLength) ?? 8))
1876
1876
  );
1877
1877
  return;
1878
1878
  }
@@ -1881,13 +1881,13 @@ class It {
1881
1881
  return;
1882
1882
  }
1883
1883
  await this.runAction("Updating password…", async () => {
1884
- const i = await this.passwordResetEndpoints().emailOtp.resetPassword({
1884
+ const s = await this.passwordResetEndpoints().emailOtp.resetPassword({
1885
1885
  email: this.state.email.trim(),
1886
1886
  otp: this.state.code.trim(),
1887
1887
  password: this.state.newPassword
1888
1888
  });
1889
- if (i.error)
1890
- throw i.error;
1889
+ if (s.error)
1890
+ throw s.error;
1891
1891
  await this.completePasswordReset();
1892
1892
  });
1893
1893
  }
@@ -1896,8 +1896,8 @@ class It {
1896
1896
  if ((e = this.config) != null && e.isLocalDev) {
1897
1897
  if (this.isCountdownActive()) return;
1898
1898
  await this.runAction("Dev mode: retrying auto-verify…", async () => {
1899
- const s = this.verificationCompletionAction ?? "sign-in";
1900
- if (!await this.tryDevAutoVerify(s))
1899
+ const i = this.verificationCompletionAction ?? "sign-in";
1900
+ if (!await this.tryDevAutoVerify(i))
1901
1901
  throw new Error(
1902
1902
  "Dev auto-verify did not complete. Check the edgespark dev logs and try again."
1903
1903
  );
@@ -1911,43 +1911,43 @@ class It {
1911
1911
  * auth flow. Returns whether auto-verify completed — callers decide what
1912
1912
  * to do on `false` (sign-up falls through to a retry UI; resend throws).
1913
1913
  */
1914
- async tryDevAutoVerify(e, s) {
1915
- const i = this.state.email.trim();
1914
+ async tryDevAutoVerify(e, i) {
1915
+ const s = this.state.email.trim();
1916
1916
  try {
1917
- return this.state.busyLabel = "Dev mode: auto-verifying email…", this.render(), await ut(i) ? (this.state.notice = "Dev mode: email verification auto-completed", await this.completeAuth(e, await this.resolveAuthCompletionData(s)), !0) : (console.warn("[edgespark] Dev auto-verify returned false — falling through"), !1);
1917
+ return this.state.busyLabel = "Dev mode: auto-verifying email…", this.render(), await wt(s) ? (this.state.notice = "Dev mode: email verification auto-completed", await this.completeAuth(e, await this.resolveAuthCompletionData(i)), !0) : (console.warn("[edgespark] Dev auto-verify returned false — falling through"), !1);
1918
1918
  } catch (n) {
1919
1919
  return console.warn("[edgespark] Dev auto-verify failed:", n), !1;
1920
1920
  }
1921
1921
  }
1922
1922
  async sendVerificationEmail(e) {
1923
1923
  !e && this.isCountdownActive() || await this.runAction("Sending verification email…", async () => {
1924
- const s = await this.auth.sendVerificationEmail({
1924
+ const i = await this.auth.sendVerificationEmail({
1925
1925
  email: this.state.email.trim(),
1926
1926
  callbackURL: this.getManagedReturnURL(
1927
- this.verificationCompletionAction === "sign-up" ? L : k,
1927
+ this.verificationCompletionAction === "sign-up" ? C : N,
1928
1928
  this.state.email.trim()
1929
1929
  )
1930
1930
  });
1931
- if (s.error)
1932
- throw s.error;
1931
+ if (i.error)
1932
+ throw i.error;
1933
1933
  this.handleVerificationEmailSent(this.state.email.trim(), !0);
1934
1934
  });
1935
1935
  }
1936
- async completeAuth(e, s) {
1937
- const i = await this.retryAuthCompletionDataIfNeeded(
1938
- s ?? await this.resolveAuthCompletionData()
1936
+ async completeAuth(e, i) {
1937
+ const s = await this.retryAuthCompletionDataIfNeeded(
1938
+ i ?? await this.resolveAuthCompletionData()
1939
1939
  );
1940
1940
  if (this.destroyed)
1941
1941
  return;
1942
- if (!i.user || !i.session) {
1942
+ if (!s.user || !s.session) {
1943
1943
  if (this.destroyed)
1944
1944
  return;
1945
- if (i.lookupError && _(this.options)) {
1945
+ if (s.lookupError && U(this.options)) {
1946
1946
  this.navigateToRedirect();
1947
1947
  return;
1948
1948
  }
1949
1949
  if (e === "sign-in")
1950
- throw i.lookupError ?? new Ee(
1950
+ throw s.lookupError ?? new Re(
1951
1951
  "Managed sign-in completed without an authenticated session."
1952
1952
  );
1953
1953
  this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.error = null, this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = "Account created. Sign in to continue.", this.render();
@@ -1955,15 +1955,15 @@ class It {
1955
1955
  }
1956
1956
  const n = {
1957
1957
  action: e,
1958
- user: i.user,
1959
- session: i.session
1958
+ user: s.user,
1959
+ session: s.session
1960
1960
  };
1961
1961
  if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
1962
- if (_(this.options)) {
1962
+ if (U(this.options)) {
1963
1963
  this.invokeRedirectModeSuccessHook(n), this.navigateToRedirect();
1964
1964
  return;
1965
1965
  }
1966
- if (X(this.options)) {
1966
+ if (ie(this.options)) {
1967
1967
  this.options.onSuccess(n), this.terminalActionInProgress = !0;
1968
1968
  return;
1969
1969
  }
@@ -1972,44 +1972,44 @@ class It {
1972
1972
  async retryAuthCompletionDataIfNeeded(e) {
1973
1973
  if (e.session)
1974
1974
  return e;
1975
- let s = e.lookupError;
1976
- for (let i = 0; i < Y; i++) {
1977
- await new Promise((n) => setTimeout(n, ve));
1975
+ let i = e.lookupError;
1976
+ for (let s = 0; s < te; s++) {
1977
+ await new Promise((n) => setTimeout(n, Le));
1978
1978
  try {
1979
- const n = await B(this.auth);
1979
+ const n = await V(this.auth);
1980
1980
  if (n.user && n.session)
1981
1981
  return {
1982
1982
  user: n.user,
1983
1983
  session: n.session
1984
1984
  };
1985
1985
  } catch (n) {
1986
- s = n;
1986
+ i = n;
1987
1987
  }
1988
1988
  }
1989
1989
  return {
1990
1990
  ...e,
1991
- lookupError: s ?? e.lookupError
1991
+ lookupError: i ?? e.lookupError
1992
1992
  };
1993
1993
  }
1994
1994
  async syncPublicSessionBestEffort() {
1995
- var e, s;
1995
+ var e, i;
1996
1996
  try {
1997
- await ((s = (e = this.runtimeOptions) == null ? void 0 : e.syncPublicSession) == null ? void 0 : s.call(e));
1997
+ await ((i = (e = this.runtimeOptions) == null ? void 0 : e.syncPublicSession) == null ? void 0 : i.call(e));
1998
1998
  } catch {
1999
1999
  }
2000
2000
  }
2001
2001
  async resolveAuthCompletionData(e) {
2002
2002
  try {
2003
- const s = await B(this.auth), i = this.extractUser(e);
2003
+ const i = await V(this.auth), s = this.extractUser(e);
2004
2004
  return {
2005
- user: s.user ?? i,
2006
- session: s.session
2005
+ user: i.user ?? s,
2006
+ session: i.session
2007
2007
  };
2008
- } catch (s) {
2008
+ } catch (i) {
2009
2009
  return {
2010
2010
  user: this.extractUser(e),
2011
2011
  session: null,
2012
- lookupError: s
2012
+ lookupError: i
2013
2013
  };
2014
2014
  }
2015
2015
  }
@@ -2020,7 +2020,7 @@ class It {
2020
2020
  session: null
2021
2021
  };
2022
2022
  if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
2023
- if (X(this.options)) {
2023
+ if (ie(this.options)) {
2024
2024
  this.clearCountdown(), this.options.onSuccess(e), this.terminalActionInProgress = !0;
2025
2025
  return;
2026
2026
  }
@@ -2028,66 +2028,66 @@ class It {
2028
2028
  }
2029
2029
  }
2030
2030
  handleExistingSessionOnMount() {
2031
- if (_(this.options)) {
2031
+ if (U(this.options)) {
2032
2032
  this.navigateToRedirect();
2033
2033
  return;
2034
2034
  }
2035
- if (X(this.options))
2036
- throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new f(
2035
+ if (ie(this.options))
2036
+ throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new g(
2037
2037
  "authUI.mount(container, { onSuccess }) cannot run while a session already exists. Check es.auth.getSession() before mounting controlled auth UI."
2038
2038
  );
2039
2039
  }
2040
- async runAction(e, s) {
2040
+ async runAction(e, i) {
2041
2041
  this.state.busy = !0, this.state.busyLabel = e, this.state.error = null, this.state.notice = null, this.render();
2042
2042
  try {
2043
- await s();
2044
- } catch (i) {
2045
- if (this.maybeHandleVerificationRequired(i))
2043
+ await i();
2044
+ } catch (s) {
2045
+ if (this.maybeHandleVerificationRequired(s))
2046
2046
  return;
2047
- this.handleError(i);
2047
+ this.handleError(s);
2048
2048
  return;
2049
2049
  }
2050
2050
  !this.destroyed && !this.terminalActionInProgress && (this.state.busy = !1, this.state.busyLabel = void 0, this.render());
2051
2051
  }
2052
2052
  maybeHandleVerificationRequired(e) {
2053
- return G(e).code !== "EMAIL_NOT_VERIFIED" ? !1 : (this.verificationCompletionAction = "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = `Verify your email to finish signing in as ${this.state.email.trim()}.`, this.render(), this.sendVerificationEmail(!0), !0);
2053
+ return Z(e).code !== "EMAIL_NOT_VERIFIED" ? !1 : (this.verificationCompletionAction = "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = `Verify your email to finish signing in as ${this.state.email.trim()}.`, this.render(), this.sendVerificationEmail(!0), !0);
2054
2054
  }
2055
- handleVerificationEmailSent(e, s) {
2056
- this.state.notice = s ? `We sent another verification email to ${e}.` : `We sent a verification email to ${e}.`, this.startCountdown();
2055
+ handleVerificationEmailSent(e, i) {
2056
+ this.state.notice = i ? `We sent another verification email to ${e}.` : `We sent a verification email to ${e}.`, this.startCountdown();
2057
2057
  }
2058
2058
  invokeRedirectModeSuccessHook(e) {
2059
- var s, i;
2060
- if (!(!_(this.options) || !this.options.onSuccess))
2059
+ var i, s;
2060
+ if (!(!U(this.options) || !this.options.onSuccess))
2061
2061
  try {
2062
2062
  this.options.onSuccess(e);
2063
2063
  } catch (n) {
2064
- const a = G(n, "Post-auth callback failed.");
2064
+ const o = Z(n, "Post-auth callback failed.");
2065
2065
  try {
2066
- (i = (s = this.options).onError) == null || i.call(s, a);
2066
+ (s = (i = this.options).onError) == null || s.call(i, o);
2067
2067
  } catch {
2068
2068
  }
2069
2069
  }
2070
2070
  }
2071
- handleError(e, s) {
2072
- var n, a;
2073
- const i = G(e, s);
2074
- this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (a = (n = this.options).onError) == null || a.call(n, i);
2071
+ handleError(e, i) {
2072
+ var n, o;
2073
+ const s = Z(e, i);
2074
+ this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = s.message, this.render(), (o = (n = this.options).onError) == null || o.call(n, s);
2075
2075
  }
2076
2076
  failValidation(e) {
2077
2077
  this.state.error = e, this.state.notice = null, this.render();
2078
2078
  }
2079
- getManagedReturnURL(e, s) {
2079
+ getManagedReturnURL(e, i) {
2080
2080
  if (!e)
2081
2081
  return window.location.href;
2082
- const i = new URL(window.location.href);
2083
- return i.searchParams.set(K, e), s ? i.searchParams.set(M, s) : i.searchParams.delete(M), i.toString();
2082
+ const s = new URL(window.location.href);
2083
+ return s.searchParams.set(Q, e), i ? s.searchParams.set(F, i) : s.searchParams.delete(F), s.toString();
2084
2084
  }
2085
2085
  consumeManagedReturnContext() {
2086
- const e = new URL(window.location.href), s = e.searchParams.get(K), i = s === W || s === k || s === L ? s : null, n = e.searchParams.get(M), a = i ? e.searchParams.get("error") : null, u = i ? e.searchParams.get("error_description") : null;
2087
- return (i || n) && (e.searchParams.delete(K), e.searchParams.delete(M), i && (e.searchParams.delete("error"), e.searchParams.delete("error_description")), window.history.replaceState(null, "", e.toString())), {
2088
- marker: i,
2086
+ const e = new URL(window.location.href), i = e.searchParams.get(Q), s = i === ee || i === N || i === C ? i : null, n = e.searchParams.get(F), o = s ? e.searchParams.get("error") : null, u = s ? e.searchParams.get("error_description") : null;
2087
+ return (s || n) && (e.searchParams.delete(Q), e.searchParams.delete(F), s && (e.searchParams.delete("error"), e.searchParams.delete("error_description")), window.history.replaceState(null, "", e.toString())), {
2088
+ marker: s,
2089
2089
  email: n,
2090
- error: a,
2090
+ error: o,
2091
2091
  errorDescription: u
2092
2092
  };
2093
2093
  }
@@ -2116,14 +2116,14 @@ class It {
2116
2116
  this.pendingFocusSnapshot && (this.clearFocusRestoreTimer(), this.focusRestoreTimer = window.setTimeout(() => {
2117
2117
  if (this.focusRestoreTimer = null, this.destroyed || !this.pendingFocusSnapshot)
2118
2118
  return;
2119
- const e = this.pendingFocusSnapshot, s = `input[name="${this.escape(e.name)}"][type="${this.escape(e.type)}"]`, i = this.root.querySelector(s);
2120
- if (!(!i || i.disabled)) {
2121
- if (i.focus(), e.selectionStart !== null && e.selectionEnd !== null)
2119
+ const e = this.pendingFocusSnapshot, i = `input[name="${this.escape(e.name)}"][type="${this.escape(e.type)}"]`, s = this.root.querySelector(i);
2120
+ if (!(!s || s.disabled)) {
2121
+ if (s.focus(), e.selectionStart !== null && e.selectionEnd !== null)
2122
2122
  try {
2123
- i.setSelectionRange(e.selectionStart, e.selectionEnd);
2123
+ s.setSelectionRange(e.selectionStart, e.selectionEnd);
2124
2124
  } catch {
2125
- const n = i.value.length;
2126
- i.setSelectionRange(n, n);
2125
+ const n = s.value.length;
2126
+ s.setSelectionRange(n, n);
2127
2127
  }
2128
2128
  this.pendingFocusSnapshot = null;
2129
2129
  }
@@ -2138,24 +2138,24 @@ class It {
2138
2138
  extractRedirectURL(e) {
2139
2139
  if (!e || typeof e != "object")
2140
2140
  return null;
2141
- const s = e;
2142
- return s.redirect && typeof s.url == "string" && s.url.length > 0 ? s.url : null;
2141
+ const i = e;
2142
+ return i.redirect && typeof i.url == "string" && i.url.length > 0 ? i.url : null;
2143
2143
  }
2144
2144
  extractUser(e) {
2145
2145
  if (!e || typeof e != "object")
2146
2146
  return null;
2147
- const s = e;
2148
- return s.user && typeof s.user == "object" ? s.user : null;
2147
+ const i = e;
2148
+ return i.user && typeof i.user == "object" ? i.user : null;
2149
2149
  }
2150
2150
  canUsePasswordResetEmailOtp() {
2151
2151
  var e;
2152
2152
  return !!((e = this.config) != null && e.passwordResetEmailOtpEnabled);
2153
2153
  }
2154
2154
  handleSessionlessManagedReturn(e) {
2155
- return e.email && (this.state.email = e.email), e.marker === L && !e.error ? (this.verificationCompletionAction = null, this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.error = null, this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = "Account created. Sign in to continue.", this.render(), !0) : e.marker === k || e.marker === L ? (this.verificationCompletionAction = e.marker === L ? "sign-up" : "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, e.error || e.errorDescription ? this.handleError(new E(
2155
+ return e.email && (this.state.email = e.email), e.marker === C && !e.error ? (this.verificationCompletionAction = null, this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.error = null, this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = "Account created. Sign in to continue.", this.render(), !0) : e.marker === N || e.marker === C ? (this.verificationCompletionAction = e.marker === C ? "sign-up" : "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, e.error || e.errorDescription ? this.handleError(new L(
2156
2156
  e.errorDescription ?? "Verification failed. Request a new verification email and try again.",
2157
2157
  { code: e.error ?? "VERIFY_EMAIL_ERROR" }
2158
- )) : this.render(), !0) : e.marker === W && (e.error || e.errorDescription) ? (this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, this.handleError(new E(
2158
+ )) : this.render(), !0) : e.marker === ee && (e.error || e.errorDescription) ? (this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, this.handleError(new L(
2159
2159
  e.errorDescription ?? "OAuth sign-in failed.",
2160
2160
  { code: e.error ?? "OAUTH_ERROR" }
2161
2161
  )), !0) : !1;
@@ -2166,175 +2166,402 @@ class It {
2166
2166
  getCountdownSecondsRemaining() {
2167
2167
  return this.countdownUntil ? Math.max(0, Math.ceil((this.countdownUntil - Date.now()) / 1e3)) : 0;
2168
2168
  }
2169
- countdownText(e, s) {
2170
- const i = this.getCountdownSecondsRemaining();
2171
- return i <= 0 ? e : s.replace("{seconds}", String(i));
2169
+ countdownText(e, i) {
2170
+ const s = this.getCountdownSecondsRemaining();
2171
+ return s <= 0 ? e : i.replace("{seconds}", String(s));
2172
2172
  }
2173
2173
  escape(e) {
2174
- return e.replace(/[&<>"']/g, (s) => _t[s]);
2174
+ return e.replace(/[&<>"']/g, (i) => Rt[i]);
2175
2175
  }
2176
2176
  }
2177
- function Ct(t) {
2177
+ function Bt(t) {
2178
2178
  return "data" in t && t.data ? t.data : t;
2179
2179
  }
2180
- const Ut = [
2180
+ const Ot = [
2181
2181
  { id: "google", key: "providerGoogle" },
2182
2182
  { id: "apple", key: "providerApple" },
2183
2183
  { id: "microsoft", key: "providerMicrosoft" },
2184
2184
  { id: "github", key: "providerGithub" },
2185
2185
  { id: "gitlab", key: "providerGitlab" },
2186
2186
  { id: "discord", key: "providerDiscord" }
2187
- ], ye = 2, $t = 500;
2188
- async function kt() {
2189
- const t = `${window.location.origin}${Le}/config`;
2187
+ ], Ae = 2, Mt = 500;
2188
+ async function Dt() {
2189
+ const t = `${window.location.origin}${Ue}/config`;
2190
2190
  let e;
2191
- for (let s = 0; s <= ye; s++)
2191
+ for (let i = 0; i <= Ae; i++)
2192
2192
  try {
2193
- const i = await fetch(t, { method: "GET", credentials: "include" });
2194
- if (!i.ok)
2195
- throw new f(`Failed to load auth config: HTTP ${i.status}`);
2196
- const n = await i.json(), a = Ct(n);
2197
- return Mt(a, ct());
2198
- } catch (i) {
2199
- e = i, s < ye && await new Promise((n) => setTimeout(n, $t));
2193
+ const s = await fetch(t, { method: "GET", credentials: "include" });
2194
+ if (!s.ok)
2195
+ throw new g(`Failed to load auth config: HTTP ${s.status}`);
2196
+ const n = await s.json(), o = Bt(n);
2197
+ return Nt(o, ft());
2198
+ } catch (s) {
2199
+ e = s, i < Ae && await new Promise((n) => setTimeout(n, Mt));
2200
2200
  }
2201
2201
  throw e;
2202
2202
  }
2203
- let O = null;
2204
- async function Bt() {
2205
- return O || (O = kt().catch((t) => {
2206
- throw O = null, t;
2207
- })), O;
2208
- }
2209
- function Mt(t, e = !1) {
2210
- var i, n, a, u, g, S, U;
2211
- const s = Ut.filter(({ key: $ }) => {
2212
- const v = t[$];
2213
- return typeof v == "object" && v !== null && "enabled" in v && !!v.enabled;
2214
- }).map(({ id: $ }) => $);
2203
+ let G = null;
2204
+ async function Te() {
2205
+ return G || (G = Dt().catch((t) => {
2206
+ throw G = null, t;
2207
+ })), G;
2208
+ }
2209
+ function Nt(t, e = !1) {
2210
+ var o, u, f, p, A, v, b, P;
2211
+ const i = Ot.filter(({ key: d }) => {
2212
+ const S = t[d];
2213
+ return typeof S == "object" && S !== null && "enabled" in S && !!S.enabled;
2214
+ }).map(({ id: d }) => d), s = t.providerGoogle, n = s != null && s.enabled && typeof ((o = s.config) == null ? void 0 : o.clientId) == "string" ? s.config.clientId : null;
2215
2215
  return {
2216
2216
  disableSignUp: !!t.disableSignUp,
2217
- emailPasswordEnabled: !!((i = t.providerEmailPassword) != null && i.enabled),
2218
- minPasswordLength: ((a = (n = t.providerEmailPassword) == null ? void 0 : n.config) == null ? void 0 : a.minPasswordLength) ?? 8,
2219
- requireEmailVerification: !!((g = (u = t.providerEmailPassword) == null ? void 0 : u.config) != null && g.requireEmailVerification),
2220
- passwordResetEmailOtpEnabled: !!((U = (S = t.providerEmailPassword) == null ? void 0 : S.config) != null && U.requirePasswordResetEmailVerification),
2221
- oauthProviders: s,
2217
+ emailPasswordEnabled: !!((u = t.providerEmailPassword) != null && u.enabled),
2218
+ minPasswordLength: ((p = (f = t.providerEmailPassword) == null ? void 0 : f.config) == null ? void 0 : p.minPasswordLength) ?? 8,
2219
+ requireEmailVerification: !!((v = (A = t.providerEmailPassword) == null ? void 0 : A.config) != null && v.requireEmailVerification),
2220
+ passwordResetEmailOtpEnabled: !!((P = (b = t.providerEmailPassword) == null ? void 0 : b.config) != null && P.requirePasswordResetEmailVerification),
2221
+ oauthProviders: i,
2222
+ googleClientId: n,
2222
2223
  isLocalDev: e
2223
2224
  };
2224
2225
  }
2225
- const D = /* @__PURE__ */ new WeakMap();
2226
- function Ot(t) {
2226
+ const Vt = "https://accounts.google.com/gsi/client", Ie = "data-edgespark-gsi";
2227
+ let H = null;
2228
+ function re() {
2229
+ var t, e;
2230
+ return (e = (t = window.google) == null ? void 0 : t.accounts) == null ? void 0 : e.id;
2231
+ }
2232
+ function Ft() {
2233
+ if (typeof window > "u")
2234
+ return Promise.reject(new Error("Google Identity Services is unavailable outside the browser."));
2235
+ const t = re();
2236
+ return t ? Promise.resolve(t) : (H || (H = new Promise((e, i) => {
2237
+ const s = document.querySelector(
2238
+ `script[${Ie}]`
2239
+ );
2240
+ if (s) {
2241
+ const o = re();
2242
+ if (o) {
2243
+ e(o);
2244
+ return;
2245
+ }
2246
+ s.remove();
2247
+ }
2248
+ const n = document.createElement("script");
2249
+ n.src = Vt, n.async = !0, n.defer = !0, n.setAttribute(Ie, ""), n.addEventListener(
2250
+ "load",
2251
+ () => {
2252
+ const o = re();
2253
+ o ? e(o) : (n.remove(), i(new Error("Google Identity Services loaded but did not expose google.accounts.id.")));
2254
+ },
2255
+ { once: !0 }
2256
+ ), n.addEventListener(
2257
+ "error",
2258
+ () => {
2259
+ n.remove(), i(new Error("Failed to load Google Identity Services."));
2260
+ },
2261
+ { once: !0 }
2262
+ ), document.head.appendChild(n);
2263
+ }).catch((e) => {
2264
+ throw H = null, e;
2265
+ })), H);
2266
+ }
2267
+ function Gt() {
2268
+ return { cancel: () => {
2269
+ } };
2270
+ }
2271
+ function Ht(t) {
2272
+ let e = null;
2273
+ return function(s) {
2274
+ if (typeof window > "u")
2275
+ return console.error(
2276
+ "[edgespark] promptGoogleOneTap() requires a browser environment."
2277
+ ), Gt();
2278
+ if (e)
2279
+ return console.warn(
2280
+ "[edgespark] promptGoogleOneTap() is already in flight; returning the existing handle. Call cancel() on the original before re-prompting."
2281
+ ), e;
2282
+ let n = !1, o = null;
2283
+ const u = () => {
2284
+ n || (n = !0, e === f && (e = null));
2285
+ }, f = {
2286
+ cancel() {
2287
+ if (!n && (u(), o))
2288
+ try {
2289
+ o.cancel();
2290
+ } catch {
2291
+ }
2292
+ }
2293
+ }, p = () => {
2294
+ var b;
2295
+ if (!n) {
2296
+ u();
2297
+ try {
2298
+ (b = s == null ? void 0 : s.onUnavailable) == null || b.call(s);
2299
+ } catch (P) {
2300
+ console.error("[edgespark] onUnavailable threw:", P);
2301
+ }
2302
+ }
2303
+ }, A = (b, P) => {
2304
+ var S;
2305
+ if (n) return;
2306
+ u();
2307
+ const d = de(b, P);
2308
+ try {
2309
+ (S = s == null ? void 0 : s.onError) == null || S.call(s, d);
2310
+ } catch (R) {
2311
+ console.error("[edgespark] onError threw:", R);
2312
+ }
2313
+ }, v = (b, P) => {
2314
+ var d;
2315
+ if (!n) {
2316
+ u();
2317
+ try {
2318
+ (d = s == null ? void 0 : s.onSuccess) == null || d.call(s, { action: "sign-in", user: b, session: P });
2319
+ } catch (S) {
2320
+ console.error("[edgespark] onSuccess threw:", S);
2321
+ }
2322
+ }
2323
+ };
2324
+ return e = f, (async () => {
2325
+ let b;
2326
+ try {
2327
+ b = await t.loadConfig();
2328
+ } catch (d) {
2329
+ A(d, "Failed to load auth config for Google One Tap.");
2330
+ return;
2331
+ }
2332
+ if (n) return;
2333
+ if (b.isLocalDev) {
2334
+ console.error(
2335
+ "[edgespark] promptGoogleOneTap() is disabled in local dev mode — Google Identity Services cannot run against mock OAuth."
2336
+ ), u();
2337
+ return;
2338
+ }
2339
+ const P = b.googleClientId;
2340
+ if (!P) {
2341
+ console.error(
2342
+ "[edgespark] promptGoogleOneTap() called but Google is not configured. Set `providerGoogle` in `auth-config.yaml` with resolvable credentials."
2343
+ ), u();
2344
+ return;
2345
+ }
2346
+ try {
2347
+ o = await Ft();
2348
+ } catch (d) {
2349
+ console.warn(
2350
+ "[edgespark] Google Identity Services failed to load; treating as unavailable.",
2351
+ d
2352
+ ), p();
2353
+ return;
2354
+ }
2355
+ if (!n) {
2356
+ o.initialize({
2357
+ client_id: P,
2358
+ callback: (d) => {
2359
+ n || typeof (d == null ? void 0 : d.credential) != "string" || d.credential.length === 0 || zt(d.credential, t, {
2360
+ emitSuccess: v,
2361
+ emitError: A,
2362
+ isDone: () => n
2363
+ });
2364
+ },
2365
+ cancel_on_tap_outside: !1,
2366
+ use_fedcm_for_prompt: !0,
2367
+ context: "signin"
2368
+ });
2369
+ try {
2370
+ o.prompt((d) => {
2371
+ var S, R, D, a;
2372
+ if (!n) {
2373
+ if ((S = d.isDismissedMoment) != null && S.call(d)) {
2374
+ const h = (R = d.getDismissedReason) == null ? void 0 : R.call(d);
2375
+ if (h === "credential_returned" || h === "cancel_called") return;
2376
+ p();
2377
+ return;
2378
+ }
2379
+ ((D = d.isNotDisplayed) != null && D.call(d) || (a = d.isSkippedMoment) != null && a.call(d)) && p();
2380
+ }
2381
+ });
2382
+ } catch (d) {
2383
+ A(d, "Failed to prompt Google One Tap.");
2384
+ }
2385
+ }
2386
+ })(), f;
2387
+ };
2388
+ }
2389
+ async function zt(t, e, i) {
2390
+ var A;
2391
+ const { emitSuccess: s, emitError: n, isDone: o } = i, u = e.authClient;
2392
+ if (!((A = u.oneTap) != null && A.callback)) {
2393
+ n(
2394
+ new L(
2395
+ "Google One Tap endpoint not registered. Update the EdgeSpark sidecar.",
2396
+ { code: "ONE_TAP_UNAVAILABLE" }
2397
+ ),
2398
+ "Google One Tap endpoint not registered."
2399
+ );
2400
+ return;
2401
+ }
2402
+ try {
2403
+ const v = await u.oneTap.callback({ idToken: t });
2404
+ if (o()) return;
2405
+ if (v.error) {
2406
+ n(
2407
+ new L(
2408
+ v.error.message ?? "Google One Tap sign-in failed.",
2409
+ {
2410
+ code: v.error.code ?? "ONE_TAP_FAILED",
2411
+ status: v.error.status,
2412
+ cause: v.error
2413
+ }
2414
+ ),
2415
+ "Google One Tap sign-in failed."
2416
+ );
2417
+ return;
2418
+ }
2419
+ } catch (v) {
2420
+ if (o()) return;
2421
+ n(v, "Google One Tap sign-in failed.");
2422
+ return;
2423
+ }
2424
+ let f = null, p = null;
2425
+ try {
2426
+ const v = await V(e.authClient);
2427
+ if (o()) return;
2428
+ f = v.user, p = v.session;
2429
+ } catch (v) {
2430
+ if (o()) return;
2431
+ n(v, "Sign-in succeeded but session lookup failed.");
2432
+ return;
2433
+ }
2434
+ if (!f || !p) {
2435
+ n(
2436
+ new L(
2437
+ "Google One Tap completed without an authenticated session.",
2438
+ { code: "ONE_TAP_NO_SESSION" }
2439
+ ),
2440
+ "Google One Tap completed without an authenticated session."
2441
+ );
2442
+ return;
2443
+ }
2444
+ s(f, p);
2445
+ }
2446
+ const z = /* @__PURE__ */ new WeakMap();
2447
+ function xt(t) {
2227
2448
  if (!t)
2228
- throw new f(
2449
+ throw new g(
2229
2450
  "authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
2230
2451
  );
2231
- const e = "redirectTo" in t, s = "onSuccess" in t && typeof t.onSuccess == "function";
2232
- if (!e && !s)
2233
- throw new f(
2452
+ const e = "redirectTo" in t, i = "onSuccess" in t && typeof t.onSuccess == "function";
2453
+ if (!e && !i)
2454
+ throw new g(
2234
2455
  "authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
2235
2456
  );
2236
2457
  if ("redirectTo" in t) {
2237
- const i = t.redirectTo;
2238
- if (!(typeof i == "string" || i instanceof URL))
2239
- throw new f(
2458
+ const s = t.redirectTo;
2459
+ if (!(typeof s == "string" || s instanceof URL))
2460
+ throw new g(
2240
2461
  "authUI.mount(container, options) expected redirectTo to be a string or URL."
2241
2462
  );
2242
2463
  }
2243
2464
  if ("onSuccess" in t && t.onSuccess !== void 0 && typeof t.onSuccess != "function")
2244
- throw new f(
2465
+ throw new g(
2245
2466
  "authUI.mount(container, options) expected onSuccess to be a function."
2246
2467
  );
2247
2468
  if ("onError" in t && t.onError !== void 0 && typeof t.onError != "function")
2248
- throw new f(
2469
+ throw new g(
2249
2470
  "authUI.mount(container, options) expected onError to be a function."
2250
2471
  );
2251
2472
  if ("appearance" in t && t.appearance !== void 0) {
2252
- const i = t.appearance;
2253
- if (!i || typeof i != "object" || Array.isArray(i))
2254
- throw new f(
2473
+ const s = t.appearance;
2474
+ if (!s || typeof s != "object" || Array.isArray(s))
2475
+ throw new g(
2255
2476
  "authUI.mount(container, options) expected appearance to be an object."
2256
2477
  );
2257
- if ("theme" in i && i.theme !== void 0 && !yt(i.theme))
2258
- throw new f(
2259
- `authUI.mount(container, options) expected appearance.theme to be one of: ${ke.join(", ")}.`
2478
+ if ("theme" in s && s.theme !== void 0 && !_t(s.theme))
2479
+ throw new g(
2480
+ `authUI.mount(container, options) expected appearance.theme to be one of: ${Fe.join(", ")}.`
2260
2481
  );
2261
- if ("className" in i && i.className !== void 0 && typeof i.className != "string")
2262
- throw new f(
2482
+ if ("className" in s && s.className !== void 0 && typeof s.className != "string")
2483
+ throw new g(
2263
2484
  "authUI.mount(container, options) expected appearance.className to be a string."
2264
2485
  );
2265
- if ("variables" in i && i.variables !== void 0) {
2266
- if (!i.variables || typeof i.variables != "object" || Array.isArray(i.variables))
2267
- throw new f(
2486
+ if ("variables" in s && s.variables !== void 0) {
2487
+ if (!s.variables || typeof s.variables != "object" || Array.isArray(s.variables))
2488
+ throw new g(
2268
2489
  "authUI.mount(container, options) expected appearance.variables to be an object."
2269
2490
  );
2270
- for (const [n, a] of Object.entries(i.variables)) {
2271
- if (!Et(n))
2272
- throw new f(
2491
+ for (const [n, o] of Object.entries(s.variables)) {
2492
+ if (!Lt(n))
2493
+ throw new g(
2273
2494
  `authUI.mount(container, options) received unsupported appearance.variables key "${n}".`
2274
2495
  );
2275
- if (a !== void 0 && typeof a != "string")
2276
- throw new f(
2496
+ if (o !== void 0 && typeof o != "string")
2497
+ throw new g(
2277
2498
  `authUI.mount(container, options) expected appearance.variables["${n}"] to be a string.`
2278
2499
  );
2279
2500
  }
2280
2501
  }
2281
2502
  }
2282
2503
  }
2283
- function Dt(t) {
2504
+ function jt(t) {
2284
2505
  if (!(t instanceof HTMLElement))
2285
- throw new f("authUI.mount(container, options) requires a real HTMLElement container.");
2506
+ throw new g("authUI.mount(container, options) requires a real HTMLElement container.");
2286
2507
  }
2287
- function Nt(t, e) {
2508
+ function qt(t, e) {
2509
+ const i = Ht({
2510
+ authClient: e.publicAuthClient,
2511
+ loadConfig: Te
2512
+ });
2288
2513
  return {
2289
- mount(s, i) {
2290
- var g;
2291
- Ot(i), Dt(s), (g = D.get(s)) == null || g.destroy();
2292
- const n = new It(s, t, i, Bt, e), a = n.destroy.bind(n), u = {
2514
+ mount(s, n) {
2515
+ var p;
2516
+ xt(n), jt(s), (p = z.get(s)) == null || p.destroy();
2517
+ const o = new kt(s, t, n, Te, e), u = o.destroy.bind(o), f = {
2293
2518
  destroy() {
2294
- a(), D.get(s) === u && D.delete(s);
2519
+ u(), z.get(s) === f && z.delete(s);
2295
2520
  }
2296
2521
  };
2297
- return D.set(s, u), u;
2298
- }
2522
+ return z.set(s, f), f;
2523
+ },
2524
+ promptGoogleOneTap: i
2299
2525
  };
2300
2526
  }
2301
- function Ft() {
2302
- Pe();
2303
- const t = lt(), e = dt(), s = Fe(), i = Nt(e, {
2527
+ function Wt() {
2528
+ Ce();
2529
+ const t = ht(), e = mt(), i = xe(), s = qt(e, {
2304
2530
  syncPublicSession: async () => {
2305
- await at(t);
2306
- }
2531
+ await ut(t);
2532
+ },
2533
+ publicAuthClient: t
2307
2534
  });
2308
2535
  return {
2309
2536
  auth: t,
2310
- api: s,
2311
- authUI: i
2537
+ api: i,
2538
+ authUI: s
2312
2539
  };
2313
2540
  }
2314
2541
  export {
2315
- bt as AUTH_UI_APPEARANCE_VARIABLE,
2316
- vt as AUTH_UI_APPEARANCE_VARIABLE_NAMES,
2317
- gt as AUTH_UI_DEFAULT_THEME,
2318
- Ue as AUTH_UI_THEME,
2319
- ke as AUTH_UI_THEMES,
2320
- pt as AUTH_UI_THEME_DARK,
2321
- $e as AUTH_UI_THEME_LIGHT,
2322
- E as EdgeSparkAuthError,
2323
- f as EdgeSparkConfigError,
2324
- te as EdgeSparkError,
2325
- Ee as EdgeSparkRuntimeError,
2326
- pe as ar,
2327
- Ft as createEdgeSpark,
2328
- me as de,
2329
- wt as detectLocale,
2330
- N as enUS,
2331
- x as es,
2332
- he as fr,
2333
- ge as hi,
2334
- fe as it,
2335
- de as ja,
2336
- ce as ko,
2337
- ue as ptBR,
2338
- we as ru,
2339
- q as zhCN
2542
+ St as AUTH_UI_APPEARANCE_VARIABLE,
2543
+ Pt as AUTH_UI_APPEARANCE_VARIABLE_NAMES,
2544
+ Et as AUTH_UI_DEFAULT_THEME,
2545
+ Ne as AUTH_UI_THEME,
2546
+ Fe as AUTH_UI_THEMES,
2547
+ yt as AUTH_UI_THEME_DARK,
2548
+ Ve as AUTH_UI_THEME_LIGHT,
2549
+ L as EdgeSparkAuthError,
2550
+ g as EdgeSparkConfigError,
2551
+ le as EdgeSparkError,
2552
+ Re as EdgeSparkRuntimeError,
2553
+ Se as ar,
2554
+ Wt as createEdgeSpark,
2555
+ ve as de,
2556
+ vt as detectLocale,
2557
+ x as enUS,
2558
+ X as es,
2559
+ be as fr,
2560
+ Pe as hi,
2561
+ ye as it,
2562
+ we as ja,
2563
+ ge as ko,
2564
+ pe as ptBR,
2565
+ Ee as ru,
2566
+ J as zhCN
2340
2567
  };