@edgespark/web 0.0.3 → 0.0.5

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 {
1
+ import { createAuthClient as He } from "better-auth/client";
2
+ class le extends Error {
3
3
  constructor(e, s) {
4
4
  super(s), this.name = "EdgeSparkError", this.code = e;
5
5
  }
6
6
  }
7
- class f extends te {
7
+ class b 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 Ue extends le {
13
13
  constructor(e) {
14
14
  super("RUNTIME_ERROR", e), this.name = "EdgeSparkRuntimeError";
15
15
  }
16
16
  }
17
- class E extends te {
17
+ class L extends le {
18
18
  constructor(e, s) {
19
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;
20
20
  }
21
21
  }
22
- function Se(t, e = "Authentication failed.", s) {
23
- if (t instanceof E)
22
+ function de(t, e = "Authentication failed.", s) {
23
+ if (t instanceof L)
24
24
  return t;
25
25
  if (typeof t == "object" && t !== null) {
26
26
  const i = t;
27
- return new E(i.message || e, {
27
+ return new L(i.message || e, {
28
28
  code: i.code ?? s,
29
29
  status: i.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: s }) : new L(e, { code: s, cause: t });
34
34
  }
35
- function Pe() {
35
+ function $e() {
36
36
  if (typeof window > "u" || typeof document > "u")
37
- throw new Ee(
37
+ throw new Ue(
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 $e(), window.location.origin;
43
43
  }
44
- function Ne(t) {
44
+ function ze(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 xe(t) {
48
+ if (t.origin !== oe())
49
+ throw new b(
50
+ `Cross-origin requests are not supported by this SDK. Received ${t.origin}, expected ${oe()}.`
51
51
  );
52
52
  }
53
- function Fe() {
53
+ function je() {
54
54
  return {
55
55
  async fetch(t, e) {
56
- const s = Ne(t);
57
- return Ve(s), fetch(t, {
56
+ const s = ze(t);
57
+ return xe(s), 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 ke = "/api/_es/auth", qe = "edgespark-auth-session", Oe = "__edgespark_auth_sync__", q = "__edgespark_auth_pending_sign_in__", Be = Symbol("edgespark.notifyAuthTabs"), We = 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
+ ]), Ye = /* @__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 Je {
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 ue = globalThis.WeakRef, he = globalThis.FinalizationRegistry;
92
+ let W, me = !1;
93
+ const M = /* @__PURE__ */ new Map(), K = he ? new he((t) => {
94
+ M.delete(t);
95
95
  }) : null;
96
- function Re(t) {
97
- return De({
98
- baseURL: Q(),
99
- basePath: Le,
96
+ function Me(t) {
97
+ return He({
98
+ baseURL: oe(),
99
+ basePath: ke,
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) {
106
+ function B(t) {
107
107
  var e, s;
108
108
  return (s = (e = t.$store) == null ? void 0 : e.atoms) == null ? void 0 : s.session;
109
109
  }
110
- function Ge(t) {
110
+ function Xe(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 Ze(t) {
117
117
  if (typeof t != "string")
118
118
  return null;
119
119
  try {
@@ -123,53 +123,53 @@ function Ke(t) {
123
123
  return null;
124
124
  }
125
125
  }
126
- function We(t) {
126
+ function Qe(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 et(t) {
130
+ const e = Qe(t), s = Ye.get(e);
131
+ return s ? new L(s, {
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 = B(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 De() {
144
+ return W === void 0 && (W = typeof BroadcastChannel < "u" ? new BroadcastChannel(qe) : null), W;
145
145
  }
146
- function ae(t) {
147
- const e = Ke(t);
146
+ function fe(t) {
147
+ const e = Ze(t);
148
148
  if (e)
149
- for (const [s, i] of C) {
149
+ for (const [s, i] of M) {
150
150
  if (s === e.source)
151
151
  continue;
152
152
  const n = i.deref();
153
153
  if (!n) {
154
- C.delete(s);
154
+ M.delete(s);
155
155
  continue;
156
156
  }
157
- ee(n);
157
+ ae(n);
158
158
  }
159
159
  }
160
- function Je() {
160
+ function tt() {
161
161
  var t;
162
- oe || (oe = !0, (t = Te()) == null || t.addEventListener("message", (e) => {
163
- ae(e.data);
162
+ me || (me = !0, (t = De()) == null || t.addEventListener("message", (e) => {
163
+ fe(e.data);
164
164
  }), typeof window < "u" && window.addEventListener("storage", (e) => {
165
- e.key !== _e || e.newValue === null || ae(e.newValue);
165
+ e.key !== Oe || e.newValue === null || fe(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 st(t, e) {
169
+ ue ? M.set(t, new ue(e)) : (M.clear(), M.set(t, new Je(e))), K == null || K.register(e, t), tt();
170
170
  }
171
- function R(t) {
172
- const e = Ge(t), s = Te();
171
+ function k(t) {
172
+ const e = Xe(t), s = De();
173
173
  let i = !1;
174
174
  if (s)
175
175
  try {
@@ -178,15 +178,15 @@ function R(t) {
178
178
  }
179
179
  if (!i)
180
180
  try {
181
- window.localStorage.setItem(_e, e);
181
+ window.localStorage.setItem(Oe, e);
182
182
  } catch {
183
183
  }
184
184
  }
185
- function z(t) {
185
+ function Y(t) {
186
186
  if (!(typeof window > "u"))
187
187
  try {
188
188
  window.sessionStorage.setItem(
189
- V,
189
+ q,
190
190
  JSON.stringify({
191
191
  path: t,
192
192
  createdAt: Date.now()
@@ -195,286 +195,286 @@ function z(t) {
195
195
  } catch {
196
196
  }
197
197
  }
198
- function T() {
198
+ function O() {
199
199
  if (!(typeof window > "u"))
200
200
  try {
201
- window.sessionStorage.removeItem(V);
201
+ window.sessionStorage.removeItem(q);
202
202
  } catch {
203
203
  }
204
204
  }
205
- function Ze(t) {
205
+ function it(t) {
206
206
  return !!(t != null && t.session && (t != null && t.user));
207
207
  }
208
- function m(t) {
208
+ function v(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 nt(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: v(t.session.createdAt),
215
+ expiresAt: v(t.session.expiresAt),
216
+ id: v(t.session.id),
217
+ impersonatedBy: v(t.session.impersonatedBy),
218
+ ipAddress: v(t.session.ipAddress),
219
+ token: v(t.session.token),
220
+ updatedAt: v(t.session.updatedAt),
221
+ userAgent: v(t.session.userAgent),
222
+ userId: v(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: v(t.user.banExpires),
226
+ banReason: v(t.user.banReason),
227
+ banned: v(t.user.banned),
228
+ createdAt: v(t.user.createdAt),
229
+ email: v(t.user.email),
230
+ emailVerified: v(t.user.emailVerified),
231
+ id: v(t.user.id),
232
+ image: v(t.user.image),
233
+ lastLoginAt: v(t.user.lastLoginAt),
234
+ name: v(t.user.name),
235
+ role: v(t.user.role),
236
+ updatedAt: v(t.user.updatedAt)
237
237
  }
238
238
  }) : "__null__";
239
239
  }
240
- function Ie() {
240
+ function Ne() {
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(q);
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 > We ? null : { createdAt: e.createdAt };
249
249
  } catch {
250
250
  return null;
251
251
  }
252
252
  }
253
- function le() {
254
- if (!Ie())
253
+ function ge() {
254
+ if (!Ne())
255
255
  return !1;
256
256
  try {
257
- window.sessionStorage.removeItem(V);
257
+ window.sessionStorage.removeItem(q);
258
258
  } catch {
259
259
  }
260
260
  return !0;
261
261
  }
262
- function et() {
263
- return Ie() !== null;
262
+ function rt() {
263
+ return Ne() !== null;
264
264
  }
265
- function tt(t) {
265
+ function ot(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 at(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 lt(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 dt(t, e) {
284
284
  if (t.length !== 1 || t[0] !== "changePassword")
285
285
  return !1;
286
286
  const [s] = e;
287
287
  return !!(s && typeof s == "object" && "revokeOtherSessions" in s && s.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 ct(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 ut(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 J(t) {
302
+ return de(t, "Failed to load the current session.", "SESSION_LOOKUP_FAILED");
303
303
  }
304
- async function at(t) {
304
+ async function ht(t) {
305
305
  var s, i;
306
306
  let e = null;
307
307
  try {
308
- await ((s = I(t)) == null ? void 0 : s.get().refetch());
308
+ await ((s = B(t)) == null ? void 0 : s.get().refetch());
309
309
  } catch (n) {
310
310
  e = n;
311
311
  } finally {
312
- (i = t[Ae]) == null || i.call(t);
312
+ (i = t[Be]) == null || i.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);
317
+ function mt() {
318
+ const t = Me(), e = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
319
+ st(e, t);
320
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;
321
+ let n = null, o = !1, c;
322
+ const h = (a) => (c = a, a), p = () => {
323
+ var m;
324
+ const a = (m = B(t)) == null ? void 0 : m.get();
325
+ return a != null && a.error && !a.data && c !== void 0 ? c : (a == null ? void 0 : a.data) ?? c ?? null;
326
+ }, P = () => o ? Promise.resolve(p()) : (n || (n = (async () => {
327
+ var d, f, T;
328
+ let a = !1, m = null;
329
329
  try {
330
- for (let b = 0; b <= s; b++) {
331
- let d = null;
330
+ for (let I = 0; I <= s; I++) {
331
+ let u = null;
332
332
  try {
333
- d = await t.getSession();
334
- } catch (P) {
335
- c = P;
333
+ u = await t.getSession();
334
+ } catch (C) {
335
+ m = C;
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 = ((d = B(t)) == null ? void 0 : d.get().data) ?? null;
338
+ if ((f = u == null ? void 0 : u.data) != null && f.session && ((T = u.data) != null && T.user))
339
+ return o = !0, ge() && k(e), h(u.data);
340
+ if (E != null && E.session && (E != null && E.user))
341
+ return o = !0, ge() && k(e), h(E);
342
+ if (u != null && u.error ? m = u.error : u && (a = !0), u && !u.error && rt() && I < s) {
343
343
  await new Promise(
344
- (P) => setTimeout(P, i)
344
+ (C) => setTimeout(C, i)
345
345
  );
346
346
  continue;
347
347
  }
348
- if (d && !d.error) {
349
- const P = S();
350
- return a = !0, g(P);
348
+ if (u && !u.error) {
349
+ const C = p();
350
+ return o = !0, h(C);
351
351
  }
352
- b < s && await new Promise(
353
- (P) => setTimeout(P, i)
352
+ I < s && await new Promise(
353
+ (C) => setTimeout(C, i)
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: m
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, h(y);
363
+ } catch (y) {
364
+ throw n = null, J(y);
365
365
  }
366
366
  })()), n);
367
- U().catch(() => {
367
+ P().catch(() => {
368
368
  });
369
- const $ = async () => {
370
- var o, c;
369
+ const w = async () => {
370
+ var a, m;
371
371
  try {
372
- const l = await t.getSession();
373
- if ((o = l.data) != null && o.session && ((c = l.data) != null && c.user))
374
- return l.data;
375
- throw l.error ? j(l.error) : new E("No authenticated session is available.", {
372
+ const d = await t.getSession();
373
+ if ((a = d.data) != null && a.session && ((m = d.data) != null && m.user))
374
+ return d.data;
375
+ throw d.error ? J(d.error) : new L("No authenticated session is available.", {
376
376
  code: "UNAUTHENTICATED"
377
377
  });
378
- } catch (l) {
379
- throw j(l);
378
+ } catch (d) {
379
+ throw J(d);
380
380
  }
381
- }, v = async () => {
382
- await ee(t), R(e);
383
- }, Be = async () => {
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));
381
+ }, g = async () => {
382
+ await ae(t), k(e);
383
+ }, S = async () => {
384
+ var d;
385
+ const a = await ae(t), m = ((d = B(t)) == null ? void 0 : d.get().data) ?? null;
386
+ it(m) ? (O(), k(e)) : a || k(e);
387
+ }, l = (a) => {
388
+ let m = !1, d = !1, f;
389
+ const T = (u) => {
390
+ const E = nt(u);
391
+ E !== f && (f = E, a(u));
392
392
  };
393
- U().then((d) => {
394
- c || (l = !0, y(g(d)));
393
+ P().then((u) => {
394
+ m || (d = !0, T(h(u)));
395
395
  }).catch(() => {
396
- c || (l = !0);
396
+ m || (d = !0);
397
397
  });
398
- const w = I(t);
399
- if (!w)
398
+ const y = B(t);
399
+ if (!y)
400
400
  return () => {
401
- c = !0;
401
+ m = !0;
402
402
  };
403
- const b = w.subscribe((d) => {
404
- if (c || !l || d.error && !d.data)
403
+ const I = y.subscribe((u) => {
404
+ if (m || !d || u.error && !u.data)
405
405
  return;
406
- const p = d.data ?? null;
407
- y(g(p));
406
+ const E = u.data ?? null;
407
+ T(h(E));
408
408
  });
409
409
  return () => {
410
- c = !0, b();
410
+ m = !0, I();
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);
419
- if (l)
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)
412
+ }, _ = async (a, m, d) => {
413
+ const f = a[0], T = a.length >= 2 && f === "emailOtp" && a[1] === "verifyEmail", y = a.length >= 2 && f === "emailOtp" && a[1] === "resetPassword", I = a.length >= 2 && f === "resetPassword" && a[1] === "emailOtp", u = a.length >= 2 && f === "oneTap" && a[1] === "callback";
414
+ return a.length === 1 && (f === "deleteUser" || f === "deleteUserCallback") ? (O(), ct(d) && await g(), d) : a.length === 1 && f && Ke.has(f) ? (O(), $(d) || await g(), d) : dt(a, m) && !$(d) ? (O(), await g(), d) : (y || I) && !$(d) ? (O(), await g(), d) : a.length === 1 && f === "changeEmail" && !$(d) ? (await g(), d) : ((f === "signIn" || f === "signUp" || T || u) && ot(d) ? (O(), await g()) : (f === "signIn" || f === "signUp") && at(d) || f === "signUp" && lt(d) ? Y(a) : f === "verifyEmail" && !$(d) && (Y(a), await S()), d);
415
+ }, A = /* @__PURE__ */ new WeakMap(), D = (a, m) => {
416
+ if (!a || typeof a != "object" && typeof a != "function")
417
+ return a;
418
+ const d = A.get(a);
419
+ if (d)
420
+ return d;
421
+ const f = new Proxy(a, {
422
+ get(T, y, I) {
423
+ if (m.length === 0) {
424
+ if (y === "requireSession")
425
+ return w;
426
+ if (y === "onSessionChange")
427
+ return l;
428
+ if (y === Be)
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 u = Reflect.get(T, y, I);
434
+ return typeof y != "string" ? u : D(u, [...m, 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, I) {
437
+ const u = et(m);
438
+ if (u)
439
+ throw u;
440
+ const E = Reflect.apply(
441
+ T,
441
442
  y,
442
- w,
443
- b
443
+ I
444
444
  );
445
- return ot(p) ? Promise.resolve(p).then(
446
- (P) => Oe(c, b, P)
447
- ) : p;
445
+ return ut(E) ? Promise.resolve(E).then(
446
+ (C) => _(m, I, C)
447
+ ) : E;
448
448
  }
449
449
  });
450
- return se.set(o, h), h;
450
+ return A.set(a, f), f;
451
451
  };
452
- return ie(t, []);
452
+ return D(t, []);
453
453
  }
454
- function dt() {
455
- return Re({ disableDefaultRedirectPlugin: !0 });
454
+ function ft() {
455
+ return Me({ disableDefaultRedirectPlugin: !0 });
456
456
  }
457
- const Ce = "/api/_es/dev";
458
- function ct() {
457
+ const ce = "/api/_es/dev";
458
+ function gt() {
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 pt(t) {
464
464
  const e = typeof window < "u" ? window.location.origin : "";
465
465
  if (!e) return !1;
466
466
  const s = await fetch(
467
- `${e}${Ce}/auto-verify?email=${encodeURIComponent(t)}`,
467
+ `${e}${ce}/auto-verify?email=${encodeURIComponent(t)}`,
468
468
  { credentials: "include" }
469
469
  );
470
470
  return s.ok ? (await s.json()).verified === !0 : !1;
471
471
  }
472
- async function ht(t) {
472
+ async function wt(t) {
473
473
  const e = typeof window < "u" ? window.location.origin : "";
474
474
  if (!e) return null;
475
475
  try {
476
476
  const s = await fetch(
477
- `${e}${Ce}/pending-otp?email=${encodeURIComponent(t)}`,
477
+ `${e}${ce}/pending-otp?email=${encodeURIComponent(t)}`,
478
478
  { credentials: "include" }
479
479
  );
480
480
  return s.ok ? (await s.json()).otp ?? null : null;
@@ -482,28 +482,41 @@ async function ht(t) {
482
482
  return null;
483
483
  }
484
484
  }
485
- function mt(t) {
485
+ async function bt(t) {
486
+ const e = typeof window < "u" ? window.location.origin : "";
487
+ if (!e) return null;
488
+ try {
489
+ const s = await fetch(
490
+ `${e}${ce}/pending-sign-in-otp?email=${encodeURIComponent(t)}`,
491
+ { credentials: "include" }
492
+ );
493
+ return s.ok ? (await s.json()).otp ?? null : null;
494
+ } catch {
495
+ return null;
496
+ }
497
+ }
498
+ function vt(t) {
486
499
  const e = (() => {
487
500
  if (t instanceof URL)
488
501
  return t;
489
502
  const s = t.trim();
490
503
  if (!s)
491
- throw new f("redirectTo must not be an empty string.");
504
+ throw new b("redirectTo must not be an empty string.");
492
505
  try {
493
506
  return new URL(s, window.location.href);
494
507
  } catch {
495
- throw new f(
508
+ throw new b(
496
509
  `redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(t)}`
497
510
  );
498
511
  }
499
512
  })();
500
513
  if (e.protocol !== "http:" && e.protocol !== "https:")
501
- throw new f(
514
+ throw new b(
502
515
  `redirectTo must resolve to an http(s) URL. Received protocol: ${e.protocol}`
503
516
  );
504
517
  return e;
505
518
  }
506
- function ft(t, e) {
519
+ function yt(t, e) {
507
520
  return e ? {
508
521
  common: { ...t.common, ...e.common },
509
522
  signIn: { ...t.signIn, ...e.signIn },
@@ -515,7 +528,7 @@ function ft(t, e) {
515
528
  errors: { ...t.errors, ...e.errors }
516
529
  } : t;
517
530
  }
518
- const N = {
531
+ const j = {
519
532
  common: {
520
533
  loading: "Loading sign-in…",
521
534
  redirecting: "Redirecting…",
@@ -527,6 +540,8 @@ const N = {
527
540
  emailLabel: "Email",
528
541
  passwordLabel: "Password",
529
542
  submitButton: "Sign in",
543
+ resendCodeButton: "Resend code",
544
+ resendCountdown: "Resend in {seconds}s",
530
545
  forgotPassword: "Forgot password?",
531
546
  switchToSignUp: "Create an account",
532
547
  signUpPrompt: "Don’t have an account?"
@@ -578,7 +593,7 @@ const N = {
578
593
  invalidCode: "Enter the 6-digit verification code.",
579
594
  generic: "Something went wrong. Please try again."
580
595
  }
581
- }, q = {
596
+ }, X = {
582
597
  common: {
583
598
  loading: "加载中…",
584
599
  redirecting: "跳转中…",
@@ -641,7 +656,7 @@ const N = {
641
656
  invalidCode: "请输入 6 位验证码",
642
657
  generic: "出现错误,请稍后重试"
643
658
  }
644
- }, de = {
659
+ }, pe = {
645
660
  common: {
646
661
  loading: "サインインを読み込み中…",
647
662
  redirecting: "リダイレクト中…",
@@ -704,7 +719,7 @@ const N = {
704
719
  invalidCode: "6桁の認証コードを入力してください",
705
720
  generic: "エラーが発生しました。もう一度お試しください"
706
721
  }
707
- }, ce = {
722
+ }, we = {
708
723
  common: {
709
724
  loading: "로그인 로딩 중…",
710
725
  redirecting: "리디렉션 중…",
@@ -767,7 +782,7 @@ const N = {
767
782
  invalidCode: "6자리 인증 코드를 입력해 주세요",
768
783
  generic: "문제가 발생했습니다. 다시 시도해 주세요"
769
784
  }
770
- }, x = {
785
+ }, Z = {
771
786
  common: {
772
787
  loading: "Cargando inicio de sesión…",
773
788
  redirecting: "Redirigiendo…",
@@ -830,7 +845,7 @@ const N = {
830
845
  invalidCode: "Ingresa el código de verificación de 6 dígitos.",
831
846
  generic: "Algo salió mal. Por favor, inténtalo de nuevo."
832
847
  }
833
- }, ue = {
848
+ }, be = {
834
849
  common: {
835
850
  loading: "Carregando login…",
836
851
  redirecting: "Redirecionando…",
@@ -893,7 +908,7 @@ const N = {
893
908
  invalidCode: "Insira o código de verificação de 6 dígitos.",
894
909
  generic: "Algo deu errado. Por favor, tente novamente."
895
910
  }
896
- }, he = {
911
+ }, ve = {
897
912
  common: {
898
913
  loading: "Chargement de la connexion…",
899
914
  redirecting: "Redirection…",
@@ -956,7 +971,7 @@ const N = {
956
971
  invalidCode: "Saisissez le code de vérification à 6 chiffres.",
957
972
  generic: "Une erreur est survenue. Veuillez réessayer."
958
973
  }
959
- }, me = {
974
+ }, ye = {
960
975
  common: {
961
976
  loading: "Anmeldung wird geladen…",
962
977
  redirecting: "Weiterleitung…",
@@ -1019,7 +1034,7 @@ const N = {
1019
1034
  invalidCode: "Geben Sie den 6-stelligen Bestätigungscode ein.",
1020
1035
  generic: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."
1021
1036
  }
1022
- }, fe = {
1037
+ }, Se = {
1023
1038
  common: {
1024
1039
  loading: "Caricamento accesso…",
1025
1040
  redirecting: "Reindirizzamento…",
@@ -1082,7 +1097,7 @@ const N = {
1082
1097
  invalidCode: "Inserisci il codice di verifica a 6 cifre.",
1083
1098
  generic: "Qualcosa è andato storto. Riprova."
1084
1099
  }
1085
- }, we = {
1100
+ }, Ee = {
1086
1101
  common: {
1087
1102
  loading: "Загрузка входа…",
1088
1103
  redirecting: "Перенаправление…",
@@ -1145,7 +1160,7 @@ const N = {
1145
1160
  invalidCode: "Введите 6-значный код подтверждения.",
1146
1161
  generic: "Произошла ошибка. Пожалуйста, попробуйте снова."
1147
1162
  }
1148
- }, pe = {
1163
+ }, Pe = {
1149
1164
  common: {
1150
1165
  loading: "جارٍ تحميل تسجيل الدخول…",
1151
1166
  redirecting: "جارٍ إعادة التوجيه…",
@@ -1208,7 +1223,7 @@ const N = {
1208
1223
  invalidCode: "يرجى إدخال رمز التحقّق المكوّن من 6 أرقام.",
1209
1224
  generic: "حدث خطأ. يرجى المحاولة مرة أخرى."
1210
1225
  }
1211
- }, ge = {
1226
+ }, _e = {
1212
1227
  common: {
1213
1228
  loading: "सधाइन की जुलातीअ लोड हो रही है…",
1214
1229
  redirecting: "रीडायरेक्ट हो रहا है…",
@@ -1271,48 +1286,48 @@ const N = {
1271
1286
  invalidCode: "कृपया 6 अंकों का सत्यापन कोड दर्ज करें।",
1272
1287
  generic: "कुछ गलत हो गई। कृपया फिर से प्रयास करें।"
1273
1288
  }
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
1289
+ }, Ie = {
1290
+ en: j,
1291
+ "en-US": j,
1292
+ zh: X,
1293
+ "zh-CN": X,
1294
+ "zh-TW": X,
1295
+ ja: pe,
1296
+ "ja-JP": pe,
1297
+ ko: we,
1298
+ "ko-KR": we,
1299
+ es: Z,
1300
+ "es-ES": Z,
1301
+ "es-MX": Z,
1302
+ pt: be,
1303
+ "pt-BR": be,
1304
+ fr: ve,
1305
+ "fr-FR": ve,
1306
+ de: ye,
1307
+ "de-DE": ye,
1308
+ it: Se,
1309
+ "it-IT": Se,
1310
+ ru: Ee,
1311
+ "ru-RU": Ee,
1312
+ ar: Pe,
1313
+ "ar-SA": Pe,
1314
+ hi: _e,
1315
+ "hi-IN": _e
1301
1316
  };
1302
- function wt() {
1317
+ function St() {
1303
1318
  if (typeof navigator > "u")
1304
- return N;
1319
+ return j;
1305
1320
  const t = navigator.languages ?? [navigator.language];
1306
1321
  for (const e of t) {
1307
- const s = be[e] ?? be[e.split("-")[0]];
1322
+ const s = Ie[e] ?? Ie[e.split("-")[0]];
1308
1323
  if (s) return s;
1309
1324
  }
1310
- return N;
1325
+ return j;
1311
1326
  }
1312
- const Ue = {
1327
+ const Ve = {
1313
1328
  LIGHT: "light",
1314
1329
  DARK: "dark"
1315
- }, $e = Ue.LIGHT, pt = Ue.DARK, ke = [$e, pt], gt = $e, bt = {
1330
+ }, Fe = Ve.LIGHT, Et = Ve.DARK, Ge = [Fe, Et], Pt = Fe, _t = {
1316
1331
  BACKGROUND: "--edgespark-auth-bg",
1317
1332
  BACKGROUND_MUTED: "--edgespark-auth-bg-muted",
1318
1333
  CARD_BACKGROUND: "--edgespark-auth-card-bg",
@@ -1332,31 +1347,31 @@ const Ue = {
1332
1347
  MODAL_BACKDROP: "--edgespark-auth-modal-backdrop",
1333
1348
  MODAL_CARD_BACKGROUND: "--edgespark-auth-modal-card-bg",
1334
1349
  MODAL_SHADOW: "--edgespark-auth-modal-shadow"
1335
- }, vt = Object.values(
1336
- bt
1350
+ }, It = Object.values(
1351
+ _t
1337
1352
  );
1338
- function yt(t) {
1339
- return typeof t == "string" && ke.includes(t);
1353
+ function Lt(t) {
1354
+ return typeof t == "string" && Ge.includes(t);
1340
1355
  }
1341
- function Et(t) {
1342
- return vt.includes(t);
1356
+ function At(t) {
1357
+ return It.includes(t);
1343
1358
  }
1344
- function St(t) {
1359
+ function Tt(t) {
1345
1360
  var e;
1346
1361
  return {
1347
- theme: (t == null ? void 0 : t.theme) ?? gt,
1362
+ theme: (t == null ? void 0 : t.theme) ?? Pt,
1348
1363
  className: ((e = t == null ? void 0 : t.className) == null ? void 0 : e.trim()) ?? "",
1349
1364
  variables: { ...(t == null ? void 0 : t.variables) ?? {} }
1350
1365
  };
1351
1366
  }
1352
- function G(t, e = "Authentication failed.") {
1353
- return Se(t, e);
1367
+ function Q(t, e = "Authentication failed.") {
1368
+ return de(t, e);
1354
1369
  }
1355
- async function B(t) {
1370
+ async function V(t) {
1356
1371
  var s, i;
1357
1372
  const e = await t.getSession();
1358
1373
  if (e.error)
1359
- throw new E(
1374
+ throw new L(
1360
1375
  e.error.message || "Failed to load the current session.",
1361
1376
  {
1362
1377
  code: e.error.code ?? "SESSION_LOOKUP_FAILED",
@@ -1372,13 +1387,13 @@ async function B(t) {
1372
1387
  session: null
1373
1388
  };
1374
1389
  }
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 = {
1390
+ const Ct = "data-edgespark-auth", Rt = "data-edgespark-auth-theme", r = "edgespark-auth", ee = "es_auth_completion", F = "es_auth_email", te = "oauth", N = "verify-sign-in", R = "verify-sign-up", Le = 200, se = 2, Ut = {
1376
1391
  "&": "&amp;",
1377
1392
  "<": "&lt;",
1378
1393
  ">": "&gt;",
1379
1394
  '"': "&quot;",
1380
1395
  "'": "&#39;"
1381
- }, J = {
1396
+ }, ie = {
1382
1397
  google: "Google",
1383
1398
  apple: "Apple",
1384
1399
  microsoft: "Microsoft",
@@ -1386,27 +1401,27 @@ const Pt = "data-edgespark-auth", Lt = "data-edgespark-auth-theme", r = "edgespa
1386
1401
  gitlab: "GitLab",
1387
1402
  discord: "Discord"
1388
1403
  };
1389
- function _(t) {
1404
+ function U(t) {
1390
1405
  return "redirectTo" in t;
1391
1406
  }
1392
- function X(t) {
1407
+ function ne(t) {
1393
1408
  return "onSuccess" in t && !("redirectTo" in t);
1394
1409
  }
1395
- function Z(t) {
1410
+ function G(t) {
1396
1411
  return !t || typeof t != "string" ? !1 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim());
1397
1412
  }
1398
- function At(t) {
1413
+ function Ae(t) {
1399
1414
  return /^\d{6}$/.test(t.trim());
1400
1415
  }
1401
- function Rt(t) {
1416
+ function $t(t) {
1402
1417
  return t === "email" || t === "name" || t === "password" || t === "confirmPassword" || t === "code" || t === "newPassword";
1403
1418
  }
1404
- function Tt(t) {
1419
+ function kt(t) {
1405
1420
  return !!(t.error || t.errorDescription);
1406
1421
  }
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 = {
1422
+ class Ot {
1423
+ constructor(e, s, i, n, o) {
1424
+ this.container = e, this.auth = s, this.options = i, this.loadConfig = n, this.runtimeOptions = o, this.state = {
1410
1425
  view: "loading",
1411
1426
  busy: !0,
1412
1427
  busyLabel: void 0,
@@ -1417,16 +1432,18 @@ class It {
1417
1432
  password: "",
1418
1433
  confirmPassword: "",
1419
1434
  code: "",
1420
- newPassword: ""
1435
+ newPassword: "",
1436
+ signInMethod: "password",
1437
+ signInOtpSent: !1
1421
1438
  }, 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();
1439
+ const c = Tt(i.appearance);
1440
+ this.labels = yt(St(), i.labels), this.root = document.createElement("div"), this.root.className = c.className ? `${r} ${c.className}` : r, this.root.setAttribute(Ct, ""), this.root.setAttribute(Rt, c.theme);
1441
+ for (const [h, p] of Object.entries(c.variables))
1442
+ p !== void 0 && this.root.style.setProperty(h, p);
1443
+ e.appendChild(this.root), this.render(), this.initialize();
1427
1444
  }
1428
1445
  destroy() {
1429
- this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.container.innerHTML = "");
1446
+ this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.root.remove());
1430
1447
  }
1431
1448
  async initialize() {
1432
1449
  const e = this.consumeManagedReturnContext();
@@ -1438,20 +1455,20 @@ class It {
1438
1455
  if (this.destroyed)
1439
1456
  return;
1440
1457
  if (i.status === "rejected") {
1441
- if (e.marker && !Tt(e) && _(this.options)) {
1458
+ if (e.marker && !kt(e) && U(this.options)) {
1442
1459
  this.redirectAfterManagedReturnLookupFailure();
1443
1460
  return;
1444
1461
  }
1445
1462
  } else {
1446
- const a = i.value;
1447
- if (a.user && a.session) {
1463
+ const o = i.value;
1464
+ if (o.user && o.session) {
1448
1465
  switch (e.marker) {
1449
- case W:
1450
- case k:
1451
- await this.completeAuth("sign-in", a);
1466
+ case te:
1467
+ case N:
1468
+ await this.completeAuth("sign-in", o);
1452
1469
  return;
1453
- case L:
1454
- await this.completeAuth("sign-up", a);
1470
+ case R:
1471
+ await this.completeAuth("sign-up", o);
1455
1472
  return;
1456
1473
  default:
1457
1474
  break;
@@ -1462,7 +1479,7 @@ class It {
1462
1479
  }
1463
1480
  if (s.status === "rejected")
1464
1481
  throw i.status === "rejected" ? i.reason : s.reason;
1465
- if (this.config = s.value, this.handleSessionlessManagedReturn(e))
1482
+ if (this.config = s.value, this.state.signInMethod = this.resolveInitialSignInMethod(), this.handleSessionlessManagedReturn(e))
1466
1483
  return;
1467
1484
  if (i.status === "rejected")
1468
1485
  throw i.reason;
@@ -1473,24 +1490,24 @@ class It {
1473
1490
  }
1474
1491
  }
1475
1492
  redirectAfterManagedReturnLookupFailure() {
1476
- _(this.options) && this.navigateToRedirect();
1493
+ U(this.options) && this.navigateToRedirect();
1477
1494
  }
1478
1495
  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()));
1496
+ 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(vt(this.options.redirectTo).toString()));
1480
1497
  }
1481
1498
  async readMountSession(e) {
1482
1499
  if (!e.marker)
1483
- return B(this.auth);
1500
+ return V(this.auth);
1484
1501
  let s = null;
1485
- for (let i = 0; i <= Y; i++) {
1502
+ for (let i = 0; i <= se; i++) {
1486
1503
  try {
1487
- const n = await B(this.auth);
1504
+ const n = await V(this.auth);
1488
1505
  if (n.user && n.session)
1489
1506
  return n;
1490
1507
  } catch (n) {
1491
1508
  s = n;
1492
1509
  }
1493
- i < Y && await new Promise((n) => setTimeout(n, ve));
1510
+ i < se && await new Promise((n) => setTimeout(n, Le));
1494
1511
  }
1495
1512
  if (s)
1496
1513
  throw s;
@@ -1559,8 +1576,11 @@ class It {
1559
1576
  }
1560
1577
  }
1561
1578
  renderSignInView() {
1562
- var i, n;
1563
- const e = this.renderOAuthProviders(), s = ((i = this.config) == null ? void 0 : i.emailPasswordEnabled) ?? !0;
1579
+ var w, g, S, l;
1580
+ const e = this.renderOAuthProviders(), s = !!((w = this.config) != null && w.emailPasswordEnabled), i = !!((g = this.config) != null && g.emailOtpSignInEnabled), n = s || i, o = s && i, c = i && !s ? "otp" : this.state.signInMethod, h = c === "otp", p = h ? this.state.signInOtpSent ? this.labels.signIn.verifyCodeButton ?? "Verify code" : this.labels.signIn.sendCodeButton ?? "Send code" : this.labels.signIn.submitButton, P = this.countdownText(
1581
+ this.labels.signIn.resendCodeButton ?? "Resend code",
1582
+ this.labels.signIn.resendCountdown ?? "Resend in {seconds}s"
1583
+ );
1564
1584
  return `
1565
1585
  <section class="${r}__section">
1566
1586
  <header class="${r}__header">
@@ -1568,29 +1588,44 @@ class It {
1568
1588
  <p class="${r}__copy">${this.escape(this.labels.signIn.subtitle)}</p>
1569
1589
  </header>
1570
1590
  ${e}
1571
- ${e && s ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
1572
- ${s ? `
1591
+ ${e && n ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
1592
+ ${n ? `
1593
+ ${o ? `
1594
+ <div class="${r}__tabs" role="tablist" aria-label="Sign-in method">
1595
+ <button class="${r}__tab ${c === "password" ? `${r}__tab--active` : ""}" type="button" data-action="sign-in-method" data-method="password" ${this.state.busy ? "disabled" : ""}>
1596
+ ${this.escape(this.labels.signIn.passwordTab ?? "Password")}
1597
+ </button>
1598
+ <button class="${r}__tab ${c === "otp" ? `${r}__tab--active` : ""}" type="button" data-action="sign-in-method" data-method="otp" ${this.state.busy ? "disabled" : ""}>
1599
+ ${this.escape(this.labels.signIn.codeTab ?? "Code")}
1600
+ </button>
1601
+ </div>
1602
+ ` : ""}
1573
1603
  <form class="${r}__form" data-view="sign-in" novalidate>
1574
1604
  ${this.renderInput("email", this.labels.signIn.emailLabel, "email", this.state.email, "email")}
1575
- ${this.renderInput("password", this.labels.signIn.passwordLabel, "password", this.state.password, "current-password")}
1605
+ ${h ? this.state.signInOtpSent ? this.renderInput("code", this.labels.signIn.codeLabel ?? "Code", "text", this.state.code, "one-time-code") : "" : this.renderInput("password", this.labels.signIn.passwordLabel, "password", this.state.password, "current-password")}
1576
1606
  <button class="${r}__button ${r}__button--primary" type="submit" ${this.state.busy ? "disabled" : ""}>
1577
- ${this.escape(this.labels.signIn.submitButton)}
1607
+ ${this.escape(p)}
1578
1608
  </button>
1579
1609
  </form>
1610
+ ${h && this.state.signInOtpSent ? `
1611
+ <button class="${r}__text-action" type="button" data-action="resend-sign-in-code" ${this.state.busy || this.isCountdownActive() ? "disabled" : ""}>
1612
+ ${this.escape(P)}
1613
+ </button>
1614
+ ` : ""}
1580
1615
  <div class="${r}__actions">
1581
- ${this.canUsePasswordResetEmailOtp() ? `
1616
+ ${!h && this.canUsePasswordResetEmailOtp() ? `
1582
1617
  <button class="${r}__link" type="button" data-action="forgot-password" ${this.state.busy ? "disabled" : ""}>
1583
1618
  ${this.escape(this.labels.signIn.forgotPassword)}
1584
1619
  </button>
1585
1620
  ` : ""}
1586
- ${(n = this.config) != null && n.disableSignUp ? "" : `
1621
+ ${!((S = this.config) != null && S.disableSignUp) && ((l = this.config) != null && l.emailPasswordEnabled) ? `
1587
1622
  <p class="${r}__meta">
1588
1623
  ${this.escape(this.labels.signIn.signUpPrompt)}
1589
1624
  <button class="${r}__link" type="button" data-action="switch-sign-up" ${this.state.busy ? "disabled" : ""}>
1590
1625
  ${this.escape(this.labels.signIn.switchToSignUp)}
1591
1626
  </button>
1592
1627
  </p>
1593
- `}
1628
+ ` : ""}
1594
1629
  </div>
1595
1630
  ` : ""}
1596
1631
  </section>
@@ -1704,13 +1739,13 @@ class It {
1704
1739
  <div class="${r}__stack">
1705
1740
  ${e.map((i) => `
1706
1741
  <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]}`)}
1742
+ ${this.escape(`${this.labels.oauth.continueWith} ${ie[i]}`)}
1708
1743
  </button>
1709
1744
  `).join("")}
1710
1745
  </div>
1711
1746
  `;
1712
1747
  }
1713
- renderInput(e, s, i, n, a) {
1748
+ renderInput(e, s, i, n, o) {
1714
1749
  return `
1715
1750
  <label class="${r}__field">
1716
1751
  <span class="${r}__label">${this.escape(s)}</span>
@@ -1719,7 +1754,7 @@ class It {
1719
1754
  name="${this.escape(e)}"
1720
1755
  type="${this.escape(i)}"
1721
1756
  value="${this.escape(n)}"
1722
- autocomplete="${this.escape(a)}"
1757
+ autocomplete="${this.escape(o)}"
1723
1758
  ${this.state.busy ? "disabled" : ""}
1724
1759
  />
1725
1760
  </label>
@@ -1727,19 +1762,19 @@ class It {
1727
1762
  }
1728
1763
  bindDOM() {
1729
1764
  this.root.querySelectorAll("form[data-view]").forEach((n) => {
1730
- n.addEventListener("submit", (a) => {
1731
- a.preventDefault();
1732
- const u = n.dataset.view;
1733
- u === "sign-in" && this.handleSignIn(), u === "sign-up" && this.handleSignUp(), u === "forgot-password" && this.handleForgotPassword(), u === "reset-password" && this.handleResetPassword();
1765
+ n.addEventListener("submit", (o) => {
1766
+ o.preventDefault();
1767
+ const c = n.dataset.view;
1768
+ c === "sign-in" && this.handleSignIn(), c === "sign-up" && this.handleSignUp(), c === "forgot-password" && this.handleForgotPassword(), c === "reset-password" && this.handleResetPassword();
1734
1769
  });
1735
1770
  }), this.root.querySelectorAll("input[name]").forEach((n) => {
1736
1771
  n.addEventListener("input", () => {
1737
- Rt(n.name) && (this.state[n.name] = n.value);
1772
+ $t(n.name) && (this.state[n.name] = n.value, n.name === "email" && this.state.signInOtpSent && (this.state.signInOtpSent = !1, this.state.code = "", this.clearCountdown()));
1738
1773
  });
1739
1774
  }), this.root.querySelectorAll("[data-action]").forEach((n) => {
1740
1775
  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);
1776
+ const o = n.dataset.action;
1777
+ 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 === "sign-in-method" && this.setSignInMethod(n.dataset.method === "otp" ? "otp" : "password"), o === "resend-sign-in-code" && this.resendSignInCode(), o === "resend-reset-code" && this.resendResetCode(), o === "oauth" && this.handleOAuthSignIn(n.dataset.provider);
1743
1778
  });
1744
1779
  });
1745
1780
  }
@@ -1747,7 +1782,12 @@ class It {
1747
1782
  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
1783
  }
1749
1784
  async handleSignIn() {
1750
- if (!Z(this.state.email)) {
1785
+ var s, i;
1786
+ if (((s = this.config) != null && s.emailOtpSignInEnabled && !((i = this.config) != null && i.emailPasswordEnabled) ? "otp" : this.state.signInMethod) === "otp") {
1787
+ await this.handleEmailOtpSignIn();
1788
+ return;
1789
+ }
1790
+ if (!G(this.state.email)) {
1751
1791
  this.failValidation(this.labels.errors.invalidEmail);
1752
1792
  return;
1753
1793
  }
@@ -1756,23 +1796,73 @@ class It {
1756
1796
  return;
1757
1797
  }
1758
1798
  await this.runAction("Signing in…", async () => {
1759
- const e = await this.auth.signIn.email({
1799
+ const n = await this.auth.signIn.email({
1760
1800
  email: this.state.email.trim(),
1761
1801
  password: this.state.password,
1762
- callbackURL: this.getManagedReturnURL(k, this.state.email.trim())
1802
+ callbackURL: this.getManagedReturnURL(N, this.state.email.trim())
1803
+ });
1804
+ if (n.error)
1805
+ throw n.error;
1806
+ await this.completeAuth("sign-in");
1807
+ });
1808
+ }
1809
+ async handleEmailOtpSignIn() {
1810
+ if (!this.canUseEmailOtpSignIn()) {
1811
+ this.handleError(
1812
+ new b("Email OTP sign-in is not enabled for this project.")
1813
+ );
1814
+ return;
1815
+ }
1816
+ if (!G(this.state.email)) {
1817
+ this.failValidation(this.labels.errors.invalidEmail);
1818
+ return;
1819
+ }
1820
+ if (!this.state.signInOtpSent) {
1821
+ await this.sendSignInOtp();
1822
+ return;
1823
+ }
1824
+ if (!Ae(this.state.code)) {
1825
+ this.failValidation(this.labels.errors.invalidCode);
1826
+ return;
1827
+ }
1828
+ await this.runAction("Signing in...", async () => {
1829
+ const e = await this.emailOtpSignInEndpoints().signIn.emailOtp({
1830
+ email: this.state.email.trim(),
1831
+ otp: this.state.code.trim()
1763
1832
  });
1764
1833
  if (e.error)
1765
1834
  throw e.error;
1766
- await this.completeAuth("sign-in");
1835
+ await this.completeAuth("sign-in", await this.resolveAuthCompletionData(e.data));
1767
1836
  });
1768
1837
  }
1838
+ async sendSignInOtp(e = !1) {
1839
+ await this.runAction("Sending sign-in code...", async () => {
1840
+ var i;
1841
+ const s = await this.emailOtpSignInEndpoints().emailOtp.sendVerificationOtp({
1842
+ email: this.state.email.trim(),
1843
+ type: "sign-in"
1844
+ });
1845
+ if (s.error)
1846
+ throw s.error;
1847
+ if (this.state.signInOtpSent = !0, this.state.code = "", (i = this.config) != null && i.isLocalDev) {
1848
+ this.state.busyLabel = "Dev mode: fetching sign-in code...", this.render();
1849
+ const n = await bt(this.state.email.trim());
1850
+ n ? (this.state.code = n, this.state.notice = `Dev mode: sign-in code auto-filled (${n})`) : this.state.notice = "Dev mode: could not retrieve sign-in code — check server logs";
1851
+ } else
1852
+ this.state.notice = e ? `We sent another sign-in code to ${this.state.email.trim()}.` : `We sent a sign-in code to ${this.state.email.trim()}.`;
1853
+ this.startCountdown();
1854
+ });
1855
+ }
1856
+ async resendSignInCode() {
1857
+ this.isCountdownActive() || await this.sendSignInOtp(!0);
1858
+ }
1769
1859
  async handleSignUp() {
1770
1860
  var e, s;
1771
1861
  if (!this.state.name.trim()) {
1772
1862
  this.failValidation(this.labels.errors.requiredField);
1773
1863
  return;
1774
1864
  }
1775
- if (!Z(this.state.email)) {
1865
+ if (!G(this.state.email)) {
1776
1866
  this.failValidation(this.labels.errors.invalidEmail);
1777
1867
  return;
1778
1868
  }
@@ -1796,7 +1886,7 @@ class It {
1796
1886
  name: this.state.name.trim(),
1797
1887
  email: this.state.email.trim(),
1798
1888
  password: this.state.password,
1799
- callbackURL: this.getManagedReturnURL(L, this.state.email.trim())
1889
+ callbackURL: this.getManagedReturnURL(R, this.state.email.trim())
1800
1890
  });
1801
1891
  if (i.error)
1802
1892
  throw i.error;
@@ -1810,7 +1900,7 @@ class It {
1810
1900
  });
1811
1901
  }
1812
1902
  async handleOAuthSignIn(e) {
1813
- await this.runAction(`Redirecting to ${J[e]}…`, async () => {
1903
+ await this.runAction(`Redirecting to ${ie[e]}…`, async () => {
1814
1904
  const s = await this.auth.signIn.social({
1815
1905
  provider: e,
1816
1906
  callbackURL: this.getManagedReturnURL("oauth"),
@@ -1820,18 +1910,18 @@ class It {
1820
1910
  throw s.error;
1821
1911
  const i = this.extractRedirectURL(s.data);
1822
1912
  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);
1913
+ throw new b(`OAuth sign-in did not return a redirect URL for provider "${e}".`);
1914
+ this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${ie[e]}…`, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(i);
1825
1915
  });
1826
1916
  }
1827
1917
  async handleForgotPassword() {
1828
1918
  if (!this.canUsePasswordResetEmailOtp()) {
1829
1919
  this.handleError(
1830
- new f("Password reset via email OTP is not enabled for this project.")
1920
+ new b("Password reset via email OTP is not enabled for this project.")
1831
1921
  );
1832
1922
  return;
1833
1923
  }
1834
- if (!Z(this.state.email)) {
1924
+ if (!G(this.state.email)) {
1835
1925
  this.failValidation(this.labels.errors.invalidEmail);
1836
1926
  return;
1837
1927
  }
@@ -1844,7 +1934,7 @@ class It {
1844
1934
  throw e.error;
1845
1935
  if (this.state.view = "reset-password", (s = this.config) != null && s.isLocalDev) {
1846
1936
  this.state.busyLabel = "Dev mode: fetching reset code…", this.render();
1847
- const i = await ht(this.state.email.trim());
1937
+ const i = await wt(this.state.email.trim());
1848
1938
  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";
1849
1939
  } else
1850
1940
  this.state.notice = `We sent a reset code to ${this.state.email.trim()}.`;
@@ -1858,11 +1948,11 @@ class It {
1858
1948
  var e, s;
1859
1949
  if (!this.canUsePasswordResetEmailOtp()) {
1860
1950
  this.handleError(
1861
- new f("Password reset via email OTP is not enabled for this project.")
1951
+ new b("Password reset via email OTP is not enabled for this project.")
1862
1952
  );
1863
1953
  return;
1864
1954
  }
1865
- if (!At(this.state.code)) {
1955
+ if (!Ae(this.state.code)) {
1866
1956
  this.failValidation(this.labels.errors.invalidCode);
1867
1957
  return;
1868
1958
  }
@@ -1914,7 +2004,7 @@ class It {
1914
2004
  async tryDevAutoVerify(e, s) {
1915
2005
  const i = this.state.email.trim();
1916
2006
  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);
2007
+ return this.state.busyLabel = "Dev mode: auto-verifying email…", this.render(), await pt(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);
1918
2008
  } catch (n) {
1919
2009
  return console.warn("[edgespark] Dev auto-verify failed:", n), !1;
1920
2010
  }
@@ -1924,7 +2014,7 @@ class It {
1924
2014
  const s = await this.auth.sendVerificationEmail({
1925
2015
  email: this.state.email.trim(),
1926
2016
  callbackURL: this.getManagedReturnURL(
1927
- this.verificationCompletionAction === "sign-up" ? L : k,
2017
+ this.verificationCompletionAction === "sign-up" ? R : N,
1928
2018
  this.state.email.trim()
1929
2019
  )
1930
2020
  });
@@ -1942,12 +2032,12 @@ class It {
1942
2032
  if (!i.user || !i.session) {
1943
2033
  if (this.destroyed)
1944
2034
  return;
1945
- if (i.lookupError && _(this.options)) {
2035
+ if (i.lookupError && U(this.options)) {
1946
2036
  this.navigateToRedirect();
1947
2037
  return;
1948
2038
  }
1949
2039
  if (e === "sign-in")
1950
- throw i.lookupError ?? new Ee(
2040
+ throw i.lookupError ?? new Ue(
1951
2041
  "Managed sign-in completed without an authenticated session."
1952
2042
  );
1953
2043
  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();
@@ -1959,11 +2049,11 @@ class It {
1959
2049
  session: i.session
1960
2050
  };
1961
2051
  if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
1962
- if (_(this.options)) {
2052
+ if (U(this.options)) {
1963
2053
  this.invokeRedirectModeSuccessHook(n), this.navigateToRedirect();
1964
2054
  return;
1965
2055
  }
1966
- if (X(this.options)) {
2056
+ if (ne(this.options)) {
1967
2057
  this.options.onSuccess(n), this.terminalActionInProgress = !0;
1968
2058
  return;
1969
2059
  }
@@ -1973,10 +2063,10 @@ class It {
1973
2063
  if (e.session)
1974
2064
  return e;
1975
2065
  let s = e.lookupError;
1976
- for (let i = 0; i < Y; i++) {
1977
- await new Promise((n) => setTimeout(n, ve));
2066
+ for (let i = 0; i < se; i++) {
2067
+ await new Promise((n) => setTimeout(n, Le));
1978
2068
  try {
1979
- const n = await B(this.auth);
2069
+ const n = await V(this.auth);
1980
2070
  if (n.user && n.session)
1981
2071
  return {
1982
2072
  user: n.user,
@@ -2000,7 +2090,7 @@ class It {
2000
2090
  }
2001
2091
  async resolveAuthCompletionData(e) {
2002
2092
  try {
2003
- const s = await B(this.auth), i = this.extractUser(e);
2093
+ const s = await V(this.auth), i = this.extractUser(e);
2004
2094
  return {
2005
2095
  user: s.user ?? i,
2006
2096
  session: s.session
@@ -2020,7 +2110,7 @@ class It {
2020
2110
  session: null
2021
2111
  };
2022
2112
  if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
2023
- if (X(this.options)) {
2113
+ if (ne(this.options)) {
2024
2114
  this.clearCountdown(), this.options.onSuccess(e), this.terminalActionInProgress = !0;
2025
2115
  return;
2026
2116
  }
@@ -2028,12 +2118,12 @@ class It {
2028
2118
  }
2029
2119
  }
2030
2120
  handleExistingSessionOnMount() {
2031
- if (_(this.options)) {
2121
+ if (U(this.options)) {
2032
2122
  this.navigateToRedirect();
2033
2123
  return;
2034
2124
  }
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(
2125
+ if (ne(this.options))
2126
+ throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new b(
2037
2127
  "authUI.mount(container, { onSuccess }) cannot run while a session already exists. Check es.auth.getSession() before mounting controlled auth UI."
2038
2128
  );
2039
2129
  }
@@ -2050,28 +2140,28 @@ class It {
2050
2140
  !this.destroyed && !this.terminalActionInProgress && (this.state.busy = !1, this.state.busyLabel = void 0, this.render());
2051
2141
  }
2052
2142
  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);
2143
+ return Q(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
2144
  }
2055
2145
  handleVerificationEmailSent(e, s) {
2056
2146
  this.state.notice = s ? `We sent another verification email to ${e}.` : `We sent a verification email to ${e}.`, this.startCountdown();
2057
2147
  }
2058
2148
  invokeRedirectModeSuccessHook(e) {
2059
2149
  var s, i;
2060
- if (!(!_(this.options) || !this.options.onSuccess))
2150
+ if (!(!U(this.options) || !this.options.onSuccess))
2061
2151
  try {
2062
2152
  this.options.onSuccess(e);
2063
2153
  } catch (n) {
2064
- const a = G(n, "Post-auth callback failed.");
2154
+ const o = Q(n, "Post-auth callback failed.");
2065
2155
  try {
2066
- (i = (s = this.options).onError) == null || i.call(s, a);
2156
+ (i = (s = this.options).onError) == null || i.call(s, o);
2067
2157
  } catch {
2068
2158
  }
2069
2159
  }
2070
2160
  }
2071
2161
  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);
2162
+ var n, o;
2163
+ const i = Q(e, s);
2164
+ this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (o = (n = this.options).onError) == null || o.call(n, i);
2075
2165
  }
2076
2166
  failValidation(e) {
2077
2167
  this.state.error = e, this.state.notice = null, this.render();
@@ -2080,15 +2170,15 @@ class It {
2080
2170
  if (!e)
2081
2171
  return window.location.href;
2082
2172
  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();
2173
+ return i.searchParams.set(ee, e), s ? i.searchParams.set(F, s) : i.searchParams.delete(F), i.toString();
2084
2174
  }
2085
2175
  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())), {
2176
+ const e = new URL(window.location.href), s = e.searchParams.get(ee), i = s === te || s === N || s === R ? s : null, n = e.searchParams.get(F), o = i ? e.searchParams.get("error") : null, c = i ? e.searchParams.get("error_description") : null;
2177
+ return (i || n) && (e.searchParams.delete(ee), e.searchParams.delete(F), i && (e.searchParams.delete("error"), e.searchParams.delete("error_description")), window.history.replaceState(null, "", e.toString())), {
2088
2178
  marker: i,
2089
2179
  email: n,
2090
- error: a,
2091
- errorDescription: u
2180
+ error: o,
2181
+ errorDescription: c
2092
2182
  };
2093
2183
  }
2094
2184
  startCountdown(e = 60) {
@@ -2135,6 +2225,20 @@ class It {
2135
2225
  passwordResetEndpoints() {
2136
2226
  return this.auth;
2137
2227
  }
2228
+ emailOtpSignInEndpoints() {
2229
+ return this.auth;
2230
+ }
2231
+ resolveInitialSignInMethod() {
2232
+ var e, s;
2233
+ return (e = this.config) != null && e.emailPasswordEnabled ? "password" : (s = this.config) != null && s.emailOtpSignInEnabled ? "otp" : "password";
2234
+ }
2235
+ setSignInMethod(e) {
2236
+ this.state.signInMethod !== e && (this.state.signInMethod = e, this.state.signInOtpSent = !1, this.state.code = "", this.state.error = null, this.state.notice = null, this.render());
2237
+ }
2238
+ canUseEmailOtpSignIn() {
2239
+ var e;
2240
+ return !!((e = this.config) != null && e.emailOtpSignInEnabled);
2241
+ }
2138
2242
  extractRedirectURL(e) {
2139
2243
  if (!e || typeof e != "object")
2140
2244
  return null;
@@ -2152,10 +2256,10 @@ class It {
2152
2256
  return !!((e = this.config) != null && e.passwordResetEmailOtpEnabled);
2153
2257
  }
2154
2258
  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(
2259
+ return e.email && (this.state.email = e.email), e.marker === R && !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 === R ? (this.verificationCompletionAction = e.marker === R ? "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
2260
  e.errorDescription ?? "Verification failed. Request a new verification email and try again.",
2157
2261
  { 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(
2262
+ )) : this.render(), !0) : e.marker === te && (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
2263
  e.errorDescription ?? "OAuth sign-in failed.",
2160
2264
  { code: e.error ?? "OAUTH_ERROR" }
2161
2265
  )), !0) : !1;
@@ -2171,139 +2275,367 @@ class It {
2171
2275
  return i <= 0 ? e : s.replace("{seconds}", String(i));
2172
2276
  }
2173
2277
  escape(e) {
2174
- return e.replace(/[&<>"']/g, (s) => _t[s]);
2278
+ return e.replace(/[&<>"']/g, (s) => Ut[s]);
2175
2279
  }
2176
2280
  }
2177
- function Ct(t) {
2281
+ function Bt(t) {
2178
2282
  return "data" in t && t.data ? t.data : t;
2179
2283
  }
2180
- const Ut = [
2284
+ const Mt = [
2181
2285
  { id: "google", key: "providerGoogle" },
2182
2286
  { id: "apple", key: "providerApple" },
2183
2287
  { id: "microsoft", key: "providerMicrosoft" },
2184
2288
  { id: "github", key: "providerGithub" },
2185
2289
  { id: "gitlab", key: "providerGitlab" },
2186
2290
  { id: "discord", key: "providerDiscord" }
2187
- ], ye = 2, $t = 500;
2188
- async function kt() {
2189
- const t = `${window.location.origin}${Le}/config`;
2291
+ ], Te = 2, Dt = 500;
2292
+ async function Nt() {
2293
+ const t = `${window.location.origin}${ke}/config`;
2190
2294
  let e;
2191
- for (let s = 0; s <= ye; s++)
2295
+ for (let s = 0; s <= Te; s++)
2192
2296
  try {
2193
2297
  const i = await fetch(t, { method: "GET", credentials: "include" });
2194
2298
  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());
2299
+ throw new b(`Failed to load auth config: HTTP ${i.status}`);
2300
+ const n = await i.json(), o = Bt(n);
2301
+ return Vt(o, gt());
2198
2302
  } catch (i) {
2199
- e = i, s < ye && await new Promise((n) => setTimeout(n, $t));
2303
+ e = i, s < Te && await new Promise((n) => setTimeout(n, Dt));
2200
2304
  }
2201
2305
  throw e;
2202
2306
  }
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: $ }) => $);
2307
+ let H = null;
2308
+ async function Ce() {
2309
+ return H || (H = Nt().catch((t) => {
2310
+ throw H = null, t;
2311
+ })), H;
2312
+ }
2313
+ function Vt(t, e = !1) {
2314
+ var o, c, h, p, P, w, g, S, l;
2315
+ const s = Mt.filter(({ key: _ }) => {
2316
+ const A = t[_];
2317
+ return typeof A == "object" && A !== null && "enabled" in A && !!A.enabled;
2318
+ }).map(({ id: _ }) => _), i = t.providerGoogle, n = i != null && i.enabled && typeof ((o = i.config) == null ? void 0 : o.clientId) == "string" ? i.config.clientId : null;
2215
2319
  return {
2216
2320
  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),
2321
+ emailPasswordEnabled: !!((c = t.providerEmailPassword) != null && c.enabled),
2322
+ emailOtpSignInEnabled: !!((h = t.providerEmailOtp) != null && h.enabled),
2323
+ minPasswordLength: ((P = (p = t.providerEmailPassword) == null ? void 0 : p.config) == null ? void 0 : P.minPasswordLength) ?? 8,
2324
+ requireEmailVerification: !!((g = (w = t.providerEmailPassword) == null ? void 0 : w.config) != null && g.requireEmailVerification),
2325
+ passwordResetEmailOtpEnabled: !!((l = (S = t.providerEmailPassword) == null ? void 0 : S.config) != null && l.requirePasswordResetEmailVerification),
2221
2326
  oauthProviders: s,
2327
+ googleClientId: n,
2222
2328
  isLocalDev: e
2223
2329
  };
2224
2330
  }
2225
- const D = /* @__PURE__ */ new WeakMap();
2226
- function Ot(t) {
2331
+ const Ft = "https://accounts.google.com/gsi/client", Re = "data-edgespark-gsi";
2332
+ let z = null;
2333
+ function re() {
2334
+ var t, e;
2335
+ return (e = (t = window.google) == null ? void 0 : t.accounts) == null ? void 0 : e.id;
2336
+ }
2337
+ function Gt() {
2338
+ if (typeof window > "u")
2339
+ return Promise.reject(new Error("Google Identity Services is unavailable outside the browser."));
2340
+ const t = re();
2341
+ return t ? Promise.resolve(t) : (z || (z = new Promise((e, s) => {
2342
+ const i = document.querySelector(
2343
+ `script[${Re}]`
2344
+ );
2345
+ if (i) {
2346
+ const o = re();
2347
+ if (o) {
2348
+ e(o);
2349
+ return;
2350
+ }
2351
+ i.remove();
2352
+ }
2353
+ const n = document.createElement("script");
2354
+ n.src = Ft, n.async = !0, n.defer = !0, n.setAttribute(Re, ""), n.addEventListener(
2355
+ "load",
2356
+ () => {
2357
+ const o = re();
2358
+ o ? e(o) : (n.remove(), s(new Error("Google Identity Services loaded but did not expose google.accounts.id.")));
2359
+ },
2360
+ { once: !0 }
2361
+ ), n.addEventListener(
2362
+ "error",
2363
+ () => {
2364
+ n.remove(), s(new Error("Failed to load Google Identity Services."));
2365
+ },
2366
+ { once: !0 }
2367
+ ), document.head.appendChild(n);
2368
+ }).catch((e) => {
2369
+ throw z = null, e;
2370
+ })), z);
2371
+ }
2372
+ function Ht() {
2373
+ return { cancel: () => {
2374
+ } };
2375
+ }
2376
+ function zt(t) {
2377
+ let e = null;
2378
+ return function(i) {
2379
+ if (typeof window > "u")
2380
+ return console.error(
2381
+ "[edgespark] promptGoogleOneTap() requires a browser environment."
2382
+ ), Ht();
2383
+ if (e)
2384
+ return console.warn(
2385
+ "[edgespark] promptGoogleOneTap() is already in flight; returning the existing handle. Call cancel() on the original before re-prompting."
2386
+ ), e;
2387
+ let n = !1, o = null;
2388
+ const c = () => {
2389
+ n || (n = !0, e === h && (e = null));
2390
+ }, h = {
2391
+ cancel() {
2392
+ if (!n && (c(), o))
2393
+ try {
2394
+ o.cancel();
2395
+ } catch {
2396
+ }
2397
+ }
2398
+ }, p = () => {
2399
+ var g;
2400
+ if (!n) {
2401
+ c();
2402
+ try {
2403
+ (g = i == null ? void 0 : i.onUnavailable) == null || g.call(i);
2404
+ } catch (S) {
2405
+ console.error("[edgespark] onUnavailable threw:", S);
2406
+ }
2407
+ }
2408
+ }, P = (g, S) => {
2409
+ var _;
2410
+ if (n) return;
2411
+ c();
2412
+ const l = de(g, S);
2413
+ try {
2414
+ (_ = i == null ? void 0 : i.onError) == null || _.call(i, l);
2415
+ } catch (A) {
2416
+ console.error("[edgespark] onError threw:", A);
2417
+ }
2418
+ }, w = (g, S) => {
2419
+ var l;
2420
+ if (!n) {
2421
+ c();
2422
+ try {
2423
+ (l = i == null ? void 0 : i.onSuccess) == null || l.call(i, { action: "sign-in", user: g, session: S });
2424
+ } catch (_) {
2425
+ console.error("[edgespark] onSuccess threw:", _);
2426
+ }
2427
+ }
2428
+ };
2429
+ return e = h, (async () => {
2430
+ let g;
2431
+ try {
2432
+ g = await t.loadConfig();
2433
+ } catch (l) {
2434
+ P(l, "Failed to load auth config for Google One Tap.");
2435
+ return;
2436
+ }
2437
+ if (n) return;
2438
+ if (g.isLocalDev) {
2439
+ console.error(
2440
+ "[edgespark] promptGoogleOneTap() is disabled in local dev mode — Google Identity Services cannot run against mock OAuth."
2441
+ ), c();
2442
+ return;
2443
+ }
2444
+ const S = g.googleClientId;
2445
+ if (!S) {
2446
+ console.error(
2447
+ "[edgespark] promptGoogleOneTap() called but Google is not configured. Set `providerGoogle` in `auth-config.yaml` with resolvable credentials."
2448
+ ), c();
2449
+ return;
2450
+ }
2451
+ try {
2452
+ o = await Gt();
2453
+ } catch (l) {
2454
+ console.warn(
2455
+ "[edgespark] Google Identity Services failed to load; treating as unavailable.",
2456
+ l
2457
+ ), p();
2458
+ return;
2459
+ }
2460
+ if (!n) {
2461
+ o.initialize({
2462
+ client_id: S,
2463
+ callback: (l) => {
2464
+ n || typeof (l == null ? void 0 : l.credential) != "string" || l.credential.length === 0 || xt(l.credential, t, {
2465
+ emitSuccess: w,
2466
+ emitError: P,
2467
+ isDone: () => n
2468
+ });
2469
+ },
2470
+ cancel_on_tap_outside: !1,
2471
+ use_fedcm_for_prompt: !0,
2472
+ context: "signin"
2473
+ });
2474
+ try {
2475
+ o.prompt((l) => {
2476
+ var _, A, D, a;
2477
+ if (!n) {
2478
+ if ((_ = l.isDismissedMoment) != null && _.call(l)) {
2479
+ const m = (A = l.getDismissedReason) == null ? void 0 : A.call(l);
2480
+ if (m === "credential_returned" || m === "cancel_called") return;
2481
+ p();
2482
+ return;
2483
+ }
2484
+ ((D = l.isNotDisplayed) != null && D.call(l) || (a = l.isSkippedMoment) != null && a.call(l)) && p();
2485
+ }
2486
+ });
2487
+ } catch (l) {
2488
+ P(l, "Failed to prompt Google One Tap.");
2489
+ }
2490
+ }
2491
+ })(), h;
2492
+ };
2493
+ }
2494
+ async function xt(t, e, s) {
2495
+ var P;
2496
+ const { emitSuccess: i, emitError: n, isDone: o } = s, c = e.authClient;
2497
+ if (!((P = c.oneTap) != null && P.callback)) {
2498
+ n(
2499
+ new L(
2500
+ "Google One Tap endpoint not registered. Update the EdgeSpark sidecar.",
2501
+ { code: "ONE_TAP_UNAVAILABLE" }
2502
+ ),
2503
+ "Google One Tap endpoint not registered."
2504
+ );
2505
+ return;
2506
+ }
2507
+ try {
2508
+ const w = await c.oneTap.callback({ idToken: t });
2509
+ if (o()) return;
2510
+ if (w.error) {
2511
+ n(
2512
+ new L(
2513
+ w.error.message ?? "Google One Tap sign-in failed.",
2514
+ {
2515
+ code: w.error.code ?? "ONE_TAP_FAILED",
2516
+ status: w.error.status,
2517
+ cause: w.error
2518
+ }
2519
+ ),
2520
+ "Google One Tap sign-in failed."
2521
+ );
2522
+ return;
2523
+ }
2524
+ } catch (w) {
2525
+ if (o()) return;
2526
+ n(w, "Google One Tap sign-in failed.");
2527
+ return;
2528
+ }
2529
+ let h = null, p = null;
2530
+ try {
2531
+ const w = await V(e.authClient);
2532
+ if (o()) return;
2533
+ h = w.user, p = w.session;
2534
+ } catch (w) {
2535
+ if (o()) return;
2536
+ n(w, "Sign-in succeeded but session lookup failed.");
2537
+ return;
2538
+ }
2539
+ if (!h || !p) {
2540
+ n(
2541
+ new L(
2542
+ "Google One Tap completed without an authenticated session.",
2543
+ { code: "ONE_TAP_NO_SESSION" }
2544
+ ),
2545
+ "Google One Tap completed without an authenticated session."
2546
+ );
2547
+ return;
2548
+ }
2549
+ i(h, p);
2550
+ }
2551
+ const x = /* @__PURE__ */ new WeakMap();
2552
+ function jt(t) {
2227
2553
  if (!t)
2228
- throw new f(
2554
+ throw new b(
2229
2555
  "authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
2230
2556
  );
2231
2557
  const e = "redirectTo" in t, s = "onSuccess" in t && typeof t.onSuccess == "function";
2232
2558
  if (!e && !s)
2233
- throw new f(
2559
+ throw new b(
2234
2560
  "authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
2235
2561
  );
2236
2562
  if ("redirectTo" in t) {
2237
2563
  const i = t.redirectTo;
2238
2564
  if (!(typeof i == "string" || i instanceof URL))
2239
- throw new f(
2565
+ throw new b(
2240
2566
  "authUI.mount(container, options) expected redirectTo to be a string or URL."
2241
2567
  );
2242
2568
  }
2243
2569
  if ("onSuccess" in t && t.onSuccess !== void 0 && typeof t.onSuccess != "function")
2244
- throw new f(
2570
+ throw new b(
2245
2571
  "authUI.mount(container, options) expected onSuccess to be a function."
2246
2572
  );
2247
2573
  if ("onError" in t && t.onError !== void 0 && typeof t.onError != "function")
2248
- throw new f(
2574
+ throw new b(
2249
2575
  "authUI.mount(container, options) expected onError to be a function."
2250
2576
  );
2251
2577
  if ("appearance" in t && t.appearance !== void 0) {
2252
2578
  const i = t.appearance;
2253
2579
  if (!i || typeof i != "object" || Array.isArray(i))
2254
- throw new f(
2580
+ throw new b(
2255
2581
  "authUI.mount(container, options) expected appearance to be an object."
2256
2582
  );
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(", ")}.`
2583
+ if ("theme" in i && i.theme !== void 0 && !Lt(i.theme))
2584
+ throw new b(
2585
+ `authUI.mount(container, options) expected appearance.theme to be one of: ${Ge.join(", ")}.`
2260
2586
  );
2261
2587
  if ("className" in i && i.className !== void 0 && typeof i.className != "string")
2262
- throw new f(
2588
+ throw new b(
2263
2589
  "authUI.mount(container, options) expected appearance.className to be a string."
2264
2590
  );
2265
2591
  if ("variables" in i && i.variables !== void 0) {
2266
2592
  if (!i.variables || typeof i.variables != "object" || Array.isArray(i.variables))
2267
- throw new f(
2593
+ throw new b(
2268
2594
  "authUI.mount(container, options) expected appearance.variables to be an object."
2269
2595
  );
2270
- for (const [n, a] of Object.entries(i.variables)) {
2271
- if (!Et(n))
2272
- throw new f(
2596
+ for (const [n, o] of Object.entries(i.variables)) {
2597
+ if (!At(n))
2598
+ throw new b(
2273
2599
  `authUI.mount(container, options) received unsupported appearance.variables key "${n}".`
2274
2600
  );
2275
- if (a !== void 0 && typeof a != "string")
2276
- throw new f(
2601
+ if (o !== void 0 && typeof o != "string")
2602
+ throw new b(
2277
2603
  `authUI.mount(container, options) expected appearance.variables["${n}"] to be a string.`
2278
2604
  );
2279
2605
  }
2280
2606
  }
2281
2607
  }
2282
2608
  }
2283
- function Dt(t) {
2609
+ function qt(t) {
2284
2610
  if (!(t instanceof HTMLElement))
2285
- throw new f("authUI.mount(container, options) requires a real HTMLElement container.");
2611
+ throw new b("authUI.mount(container, options) requires a real HTMLElement container.");
2286
2612
  }
2287
- function Nt(t, e) {
2613
+ function Wt(t, e) {
2614
+ const s = zt({
2615
+ authClient: e.publicAuthClient,
2616
+ loadConfig: Ce
2617
+ });
2288
2618
  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 = {
2619
+ mount(i, n) {
2620
+ var p;
2621
+ jt(n), qt(i), (p = x.get(i)) == null || p.destroy();
2622
+ const o = new Ot(i, t, n, Ce, e), c = o.destroy.bind(o), h = {
2293
2623
  destroy() {
2294
- a(), D.get(s) === u && D.delete(s);
2624
+ c(), x.get(i) === h && x.delete(i);
2295
2625
  }
2296
2626
  };
2297
- return D.set(s, u), u;
2298
- }
2627
+ return x.set(i, h), h;
2628
+ },
2629
+ promptGoogleOneTap: s
2299
2630
  };
2300
2631
  }
2301
- function Ft() {
2302
- Pe();
2303
- const t = lt(), e = dt(), s = Fe(), i = Nt(e, {
2632
+ function Yt() {
2633
+ $e();
2634
+ const t = mt(), e = ft(), s = je(), i = Wt(e, {
2304
2635
  syncPublicSession: async () => {
2305
- await at(t);
2306
- }
2636
+ await ht(t);
2637
+ },
2638
+ publicAuthClient: t
2307
2639
  });
2308
2640
  return {
2309
2641
  auth: t,
@@ -2312,29 +2644,29 @@ function Ft() {
2312
2644
  };
2313
2645
  }
2314
2646
  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
2647
+ _t as AUTH_UI_APPEARANCE_VARIABLE,
2648
+ It as AUTH_UI_APPEARANCE_VARIABLE_NAMES,
2649
+ Pt as AUTH_UI_DEFAULT_THEME,
2650
+ Ve as AUTH_UI_THEME,
2651
+ Ge as AUTH_UI_THEMES,
2652
+ Et as AUTH_UI_THEME_DARK,
2653
+ Fe as AUTH_UI_THEME_LIGHT,
2654
+ L as EdgeSparkAuthError,
2655
+ b as EdgeSparkConfigError,
2656
+ le as EdgeSparkError,
2657
+ Ue as EdgeSparkRuntimeError,
2658
+ Pe as ar,
2659
+ Yt as createEdgeSpark,
2660
+ ye as de,
2661
+ St as detectLocale,
2662
+ j as enUS,
2663
+ Z as es,
2664
+ ve as fr,
2665
+ _e as hi,
2666
+ Se as it,
2667
+ pe as ja,
2668
+ we as ko,
2669
+ be as ptBR,
2670
+ Ee as ru,
2671
+ X as zhCN
2340
2672
  };