@edgespark/web 0.0.1-beta.4 → 0.0.1-beta.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/auth/types.d.ts +9 -5
- package/dist/client.d.ts +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.es.js +444 -382
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,210 +1,272 @@
|
|
|
1
|
-
import { createAuthClient as
|
|
2
|
-
class
|
|
3
|
-
constructor(e,
|
|
4
|
-
super(
|
|
1
|
+
import { createAuthClient as be } from "better-auth/client";
|
|
2
|
+
class j extends Error {
|
|
3
|
+
constructor(e, s) {
|
|
4
|
+
super(s), this.name = "EdgeSparkError", this.code = e;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class u extends j {
|
|
8
8
|
constructor(e) {
|
|
9
9
|
super("CONFIG_ERROR", e), this.name = "EdgeSparkConfigError";
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class de extends j {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
super("RUNTIME_ERROR", e), this.name = "EdgeSparkRuntimeError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
class
|
|
18
|
-
constructor(e,
|
|
19
|
-
super((
|
|
17
|
+
class w extends j {
|
|
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;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ce() {
|
|
23
23
|
if (typeof window > "u" || typeof document > "u")
|
|
24
|
-
throw new
|
|
24
|
+
throw new de(
|
|
25
25
|
"@edgespark/web is browser-only. Create the client from a real browser runtime."
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function W() {
|
|
29
|
+
return ce(), window.location.origin;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function ge(t) {
|
|
32
|
+
return t instanceof URL ? t : typeof t == "string" ? new URL(t, window.location.href) : new URL(t.url, window.location.href);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (
|
|
36
|
-
throw new
|
|
37
|
-
`Cross-origin requests are not supported by this SDK. Received ${
|
|
34
|
+
function ve(t) {
|
|
35
|
+
if (t.origin !== W())
|
|
36
|
+
throw new u(
|
|
37
|
+
`Cross-origin requests are not supported by this SDK. Received ${t.origin}, expected ${W()}.`
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function ye() {
|
|
41
41
|
return {
|
|
42
|
-
async fetch(
|
|
43
|
-
const
|
|
44
|
-
return
|
|
42
|
+
async fetch(t, e) {
|
|
43
|
+
const s = ge(t);
|
|
44
|
+
return ve(s), fetch(t, {
|
|
45
45
|
...e,
|
|
46
46
|
credentials: "include"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
function
|
|
53
|
-
return
|
|
54
|
-
baseURL:
|
|
55
|
-
basePath:
|
|
56
|
-
...
|
|
51
|
+
const ue = "/api/_es/auth", Pe = "edgespark-auth-session", K = "__edgespark_auth_sync__", he = Symbol("edgespark.notifyAuthTabs");
|
|
52
|
+
function me(t) {
|
|
53
|
+
return be({
|
|
54
|
+
baseURL: W(),
|
|
55
|
+
basePath: ue,
|
|
56
|
+
...t != null && t.disableDefaultRedirectPlugin ? { disableDefaultFetchPlugins: !0 } : {},
|
|
57
57
|
fetchOptions: {
|
|
58
58
|
credentials: "include"
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
var e,
|
|
64
|
-
return (
|
|
62
|
+
function _(t) {
|
|
63
|
+
var e, s;
|
|
64
|
+
return (s = (e = t.$store) == null ? void 0 : e.atoms) == null ? void 0 : s.session;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
function Le(t) {
|
|
67
|
+
return JSON.stringify({
|
|
68
|
+
source: t,
|
|
69
|
+
timestamp: Date.now()
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function Ee(t) {
|
|
73
|
+
if (typeof t != "string")
|
|
74
|
+
return null;
|
|
75
|
+
try {
|
|
76
|
+
const e = JSON.parse(t);
|
|
77
|
+
return e && typeof e == "object" ? e : null;
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function Se(t) {
|
|
83
|
+
if (!(t && typeof t == "object") || "error" in t && t.error)
|
|
84
|
+
return !1;
|
|
85
|
+
const e = "data" in t ? t.data : t;
|
|
86
|
+
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;
|
|
87
|
+
}
|
|
88
|
+
function M(t) {
|
|
89
|
+
if (t instanceof w)
|
|
90
|
+
return t;
|
|
91
|
+
const e = t;
|
|
92
|
+
return new w(
|
|
71
93
|
(e == null ? void 0 : e.message) || "Failed to load the current session.",
|
|
72
94
|
{
|
|
73
95
|
code: (e == null ? void 0 : e.code) ?? "SESSION_LOOKUP_FAILED",
|
|
74
|
-
cause:
|
|
96
|
+
cause: t,
|
|
75
97
|
status: e == null ? void 0 : e.status
|
|
76
98
|
}
|
|
77
99
|
);
|
|
78
100
|
}
|
|
79
|
-
async function
|
|
80
|
-
var e;
|
|
81
|
-
await ((e =
|
|
101
|
+
async function _e(t) {
|
|
102
|
+
var e, s;
|
|
103
|
+
await ((e = _(t)) == null ? void 0 : e.get().refetch()), (s = t[he]) == null || s.call(t);
|
|
82
104
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
var
|
|
90
|
-
let
|
|
105
|
+
function Te() {
|
|
106
|
+
const t = me(), e = `${Date.now()}-${Math.random().toString(36).slice(2)}`, s = typeof BroadcastChannel < "u" ? new BroadcastChannel(Pe) : null, i = 2, r = 500;
|
|
107
|
+
let a = null, c = !1;
|
|
108
|
+
const p = () => {
|
|
109
|
+
var l;
|
|
110
|
+
return c ? Promise.resolve(((l = _(t)) == null ? void 0 : l.get().data) ?? null) : (a || (a = (async () => {
|
|
111
|
+
var m, f, g, v;
|
|
112
|
+
let o = !1, d = null;
|
|
91
113
|
try {
|
|
92
|
-
for (let
|
|
93
|
-
const
|
|
94
|
-
if ((
|
|
95
|
-
return
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
98
|
-
if (
|
|
99
|
-
await new Promise((
|
|
114
|
+
for (let L = 0; L <= i; L++) {
|
|
115
|
+
const E = await t.getSession(), y = ((m = _(t)) == null ? void 0 : m.get().data) ?? null;
|
|
116
|
+
if ((f = E.data) != null && f.session && ((g = E.data) != null && g.user))
|
|
117
|
+
return c = !0, E.data;
|
|
118
|
+
if (y != null && y.session && (y != null && y.user))
|
|
119
|
+
return c = !0, y;
|
|
120
|
+
if (E.error ? d = E.error : o = !0, !E.error && L < i) {
|
|
121
|
+
await new Promise((k) => setTimeout(k, r));
|
|
100
122
|
continue;
|
|
101
123
|
}
|
|
102
|
-
|
|
124
|
+
L < i && await new Promise((k) => setTimeout(k, r));
|
|
103
125
|
}
|
|
104
|
-
if (!
|
|
105
|
-
throw
|
|
126
|
+
if (!o)
|
|
127
|
+
throw a = null, new w("Failed to load the current session.", {
|
|
106
128
|
code: "SESSION_LOOKUP_FAILED",
|
|
107
|
-
cause:
|
|
129
|
+
cause: d
|
|
108
130
|
});
|
|
109
|
-
const h = ((
|
|
110
|
-
return
|
|
131
|
+
const h = ((v = _(t)) == null ? void 0 : v.get().data) ?? null;
|
|
132
|
+
return c = !0, h;
|
|
111
133
|
} catch (h) {
|
|
112
|
-
throw
|
|
134
|
+
throw a = null, M(h);
|
|
113
135
|
}
|
|
114
|
-
})()),
|
|
136
|
+
})()), a);
|
|
115
137
|
};
|
|
116
|
-
|
|
138
|
+
p().catch(() => {
|
|
117
139
|
});
|
|
118
|
-
const
|
|
119
|
-
var
|
|
140
|
+
const T = async () => {
|
|
141
|
+
var l, o;
|
|
120
142
|
try {
|
|
121
|
-
const
|
|
122
|
-
if ((
|
|
123
|
-
return
|
|
124
|
-
throw
|
|
143
|
+
const d = await t.getSession();
|
|
144
|
+
if ((l = d.data) != null && l.session && ((o = d.data) != null && o.user))
|
|
145
|
+
return d.data;
|
|
146
|
+
throw d.error ? M(d.error) : new w("No authenticated session is available.", {
|
|
125
147
|
code: "UNAUTHENTICATED"
|
|
126
148
|
});
|
|
127
|
-
} catch (
|
|
128
|
-
throw
|
|
149
|
+
} catch (d) {
|
|
150
|
+
throw M(d);
|
|
151
|
+
}
|
|
152
|
+
}, P = async () => {
|
|
153
|
+
var l;
|
|
154
|
+
try {
|
|
155
|
+
await ((l = _(t)) == null ? void 0 : l.get().refetch());
|
|
156
|
+
} catch {
|
|
129
157
|
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
}, b = () => {
|
|
159
|
+
const l = Le(e);
|
|
160
|
+
try {
|
|
161
|
+
s == null || s.postMessage(l);
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
window.localStorage.setItem(K, l);
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
}, G = (l) => {
|
|
169
|
+
const o = Ee(l);
|
|
170
|
+
!o || o.source === e || P();
|
|
171
|
+
};
|
|
172
|
+
s == null || s.addEventListener("message", (l) => {
|
|
173
|
+
G(l.data);
|
|
174
|
+
}), typeof window < "u" && window.addEventListener("storage", (l) => {
|
|
175
|
+
l.key !== K || l.newValue === null || G(l.newValue);
|
|
176
|
+
});
|
|
177
|
+
const Y = async () => {
|
|
178
|
+
await P(), b();
|
|
179
|
+
}, we = (l) => {
|
|
180
|
+
let o = !1, d = !1, m;
|
|
181
|
+
const f = (h) => {
|
|
182
|
+
h !== m && (m = h, l(h));
|
|
134
183
|
};
|
|
135
|
-
|
|
136
|
-
|
|
184
|
+
p().then((h) => {
|
|
185
|
+
o || (d = !0, f(h));
|
|
137
186
|
}).catch(() => {
|
|
138
|
-
|
|
187
|
+
o || (d = !0);
|
|
139
188
|
});
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
189
|
+
const g = _(t);
|
|
190
|
+
if (!g)
|
|
142
191
|
return () => {
|
|
143
|
-
|
|
192
|
+
o = !0;
|
|
144
193
|
};
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
194
|
+
const v = g.subscribe((h) => {
|
|
195
|
+
if (o || !d || h.error && !h.data)
|
|
147
196
|
return;
|
|
148
|
-
const
|
|
149
|
-
L
|
|
197
|
+
const L = h.data ?? null;
|
|
198
|
+
f(L);
|
|
150
199
|
});
|
|
151
200
|
return () => {
|
|
152
|
-
|
|
201
|
+
o = !0, v();
|
|
153
202
|
};
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
203
|
+
}, fe = async (...l) => {
|
|
204
|
+
const o = await t.signOut(...l);
|
|
205
|
+
return o && typeof o == "object" && "error" in o && o.error || await Y(), o;
|
|
206
|
+
}, pe = (l) => new Proxy(l, {
|
|
207
|
+
get(o, d, m) {
|
|
208
|
+
const f = Reflect.get(o, d, m);
|
|
209
|
+
return typeof f != "function" ? f : async (...g) => {
|
|
210
|
+
const v = await f.apply(o, g);
|
|
211
|
+
return Se(v) && await Y(), v;
|
|
212
|
+
};
|
|
162
213
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
214
|
+
});
|
|
215
|
+
return new Proxy(t, {
|
|
216
|
+
get(l, o, d) {
|
|
217
|
+
if (o === "requireSession")
|
|
218
|
+
return T;
|
|
219
|
+
if (o === "onSessionChange")
|
|
220
|
+
return we;
|
|
221
|
+
if (o === "signOut")
|
|
222
|
+
return fe;
|
|
223
|
+
if (o === he)
|
|
224
|
+
return b;
|
|
225
|
+
if (o === "signIn" || o === "signUp") {
|
|
226
|
+
const m = Reflect.get(l, o, d);
|
|
227
|
+
return m && typeof m == "object" ? pe(m) : m;
|
|
228
|
+
}
|
|
229
|
+
return Reflect.get(l, o, d);
|
|
168
230
|
}
|
|
169
231
|
});
|
|
170
232
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
233
|
+
function Ce() {
|
|
234
|
+
return me({ disableDefaultRedirectPlugin: !0 });
|
|
173
235
|
}
|
|
174
|
-
function
|
|
236
|
+
function O(t) {
|
|
175
237
|
const e = (() => {
|
|
176
|
-
if (
|
|
177
|
-
return
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
throw new
|
|
238
|
+
if (t instanceof URL)
|
|
239
|
+
return t;
|
|
240
|
+
const s = t.trim();
|
|
241
|
+
if (!s)
|
|
242
|
+
throw new u("redirectTo must not be an empty string.");
|
|
181
243
|
try {
|
|
182
|
-
return new URL(
|
|
244
|
+
return new URL(s, window.location.href);
|
|
183
245
|
} catch {
|
|
184
|
-
throw new
|
|
185
|
-
`redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(
|
|
246
|
+
throw new u(
|
|
247
|
+
`redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(t)}`
|
|
186
248
|
);
|
|
187
249
|
}
|
|
188
250
|
})();
|
|
189
251
|
if (e.protocol !== "http:" && e.protocol !== "https:")
|
|
190
|
-
throw new
|
|
252
|
+
throw new u(
|
|
191
253
|
`redirectTo must resolve to an http(s) URL. Received protocol: ${e.protocol}`
|
|
192
254
|
);
|
|
193
255
|
return e;
|
|
194
256
|
}
|
|
195
|
-
function
|
|
257
|
+
function Ie(t, e) {
|
|
196
258
|
return e ? {
|
|
197
|
-
common: { ...
|
|
198
|
-
signIn: { ...
|
|
199
|
-
signUp: { ...
|
|
200
|
-
verifyEmail: { ...
|
|
201
|
-
forgotPassword: { ...
|
|
202
|
-
resetPassword: { ...
|
|
203
|
-
oauth: { ...
|
|
204
|
-
errors: { ...
|
|
205
|
-
} :
|
|
259
|
+
common: { ...t.common, ...e.common },
|
|
260
|
+
signIn: { ...t.signIn, ...e.signIn },
|
|
261
|
+
signUp: { ...t.signUp, ...e.signUp },
|
|
262
|
+
verifyEmail: { ...t.verifyEmail, ...e.verifyEmail },
|
|
263
|
+
forgotPassword: { ...t.forgotPassword, ...e.forgotPassword },
|
|
264
|
+
resetPassword: { ...t.resetPassword, ...e.resetPassword },
|
|
265
|
+
oauth: { ...t.oauth, ...e.oauth },
|
|
266
|
+
errors: { ...t.errors, ...e.errors }
|
|
267
|
+
} : t;
|
|
206
268
|
}
|
|
207
|
-
const
|
|
269
|
+
const B = {
|
|
208
270
|
common: {
|
|
209
271
|
loading: "Loading sign-in…",
|
|
210
272
|
redirecting: "Redirecting…",
|
|
@@ -267,7 +329,7 @@ const U = {
|
|
|
267
329
|
invalidCode: "Enter the 6-digit verification code.",
|
|
268
330
|
generic: "Something went wrong. Please try again."
|
|
269
331
|
}
|
|
270
|
-
},
|
|
332
|
+
}, V = {
|
|
271
333
|
common: {
|
|
272
334
|
loading: "加载中…",
|
|
273
335
|
redirecting: "跳转中…",
|
|
@@ -330,7 +392,7 @@ const U = {
|
|
|
330
392
|
invalidCode: "请输入 6 位验证码",
|
|
331
393
|
generic: "出现错误,请稍后重试"
|
|
332
394
|
}
|
|
333
|
-
},
|
|
395
|
+
}, J = {
|
|
334
396
|
common: {
|
|
335
397
|
loading: "サインインを読み込み中…",
|
|
336
398
|
redirecting: "リダイレクト中…",
|
|
@@ -393,7 +455,7 @@ const U = {
|
|
|
393
455
|
invalidCode: "6桁の認証コードを入力してください",
|
|
394
456
|
generic: "エラーが発生しました。もう一度お試しください"
|
|
395
457
|
}
|
|
396
|
-
},
|
|
458
|
+
}, Z = {
|
|
397
459
|
common: {
|
|
398
460
|
loading: "로그인 로딩 중…",
|
|
399
461
|
redirecting: "리디렉션 중…",
|
|
@@ -456,7 +518,7 @@ const U = {
|
|
|
456
518
|
invalidCode: "6자리 인증 코드를 입력해 주세요",
|
|
457
519
|
generic: "문제가 발생했습니다. 다시 시도해 주세요"
|
|
458
520
|
}
|
|
459
|
-
},
|
|
521
|
+
}, F = {
|
|
460
522
|
common: {
|
|
461
523
|
loading: "Cargando inicio de sesión…",
|
|
462
524
|
redirecting: "Redirigiendo…",
|
|
@@ -519,7 +581,7 @@ const U = {
|
|
|
519
581
|
invalidCode: "Ingresa el código de verificación de 6 dígitos.",
|
|
520
582
|
generic: "Algo salió mal. Por favor, inténtalo de nuevo."
|
|
521
583
|
}
|
|
522
|
-
},
|
|
584
|
+
}, Q = {
|
|
523
585
|
common: {
|
|
524
586
|
loading: "Carregando login…",
|
|
525
587
|
redirecting: "Redirecionando…",
|
|
@@ -582,7 +644,7 @@ const U = {
|
|
|
582
644
|
invalidCode: "Insira o código de verificação de 6 dígitos.",
|
|
583
645
|
generic: "Algo deu errado. Por favor, tente novamente."
|
|
584
646
|
}
|
|
585
|
-
},
|
|
647
|
+
}, X = {
|
|
586
648
|
common: {
|
|
587
649
|
loading: "Chargement de la connexion…",
|
|
588
650
|
redirecting: "Redirection…",
|
|
@@ -645,7 +707,7 @@ const U = {
|
|
|
645
707
|
invalidCode: "Saisissez le code de vérification à 6 chiffres.",
|
|
646
708
|
generic: "Une erreur est survenue. Veuillez réessayer."
|
|
647
709
|
}
|
|
648
|
-
},
|
|
710
|
+
}, ee = {
|
|
649
711
|
common: {
|
|
650
712
|
loading: "Anmeldung wird geladen…",
|
|
651
713
|
redirecting: "Weiterleitung…",
|
|
@@ -708,7 +770,7 @@ const U = {
|
|
|
708
770
|
invalidCode: "Geben Sie den 6-stelligen Bestätigungscode ein.",
|
|
709
771
|
generic: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."
|
|
710
772
|
}
|
|
711
|
-
},
|
|
773
|
+
}, te = {
|
|
712
774
|
common: {
|
|
713
775
|
loading: "Caricamento accesso…",
|
|
714
776
|
redirecting: "Reindirizzamento…",
|
|
@@ -771,7 +833,7 @@ const U = {
|
|
|
771
833
|
invalidCode: "Inserisci il codice di verifica a 6 cifre.",
|
|
772
834
|
generic: "Qualcosa è andato storto. Riprova."
|
|
773
835
|
}
|
|
774
|
-
},
|
|
836
|
+
}, se = {
|
|
775
837
|
common: {
|
|
776
838
|
loading: "Загрузка входа…",
|
|
777
839
|
redirecting: "Перенаправление…",
|
|
@@ -834,7 +896,7 @@ const U = {
|
|
|
834
896
|
invalidCode: "Введите 6-значный код подтверждения.",
|
|
835
897
|
generic: "Произошла ошибка. Пожалуйста, попробуйте снова."
|
|
836
898
|
}
|
|
837
|
-
},
|
|
899
|
+
}, ie = {
|
|
838
900
|
common: {
|
|
839
901
|
loading: "جارٍ تحميل تسجيل الدخول…",
|
|
840
902
|
redirecting: "جارٍ إعادة التوجيه…",
|
|
@@ -897,7 +959,7 @@ const U = {
|
|
|
897
959
|
invalidCode: "يرجى إدخال رمز التحقّق المكوّن من 6 أرقام.",
|
|
898
960
|
generic: "حدث خطأ. يرجى المحاولة مرة أخرى."
|
|
899
961
|
}
|
|
900
|
-
},
|
|
962
|
+
}, ne = {
|
|
901
963
|
common: {
|
|
902
964
|
loading: "सधाइन की जुलातीअ लोड हो रही है…",
|
|
903
965
|
redirecting: "रीडायरेक्ट हो रहا है…",
|
|
@@ -960,62 +1022,62 @@ const U = {
|
|
|
960
1022
|
invalidCode: "कृपया 6 अंकों का सत्यापन कोड दर्ज करें।",
|
|
961
1023
|
generic: "कुछ गलत हो गई। कृपया फिर से प्रयास करें।"
|
|
962
1024
|
}
|
|
963
|
-
},
|
|
964
|
-
en:
|
|
965
|
-
"en-US":
|
|
966
|
-
zh:
|
|
967
|
-
"zh-CN":
|
|
968
|
-
"zh-TW":
|
|
969
|
-
ja:
|
|
970
|
-
"ja-JP":
|
|
971
|
-
ko:
|
|
972
|
-
"ko-KR":
|
|
973
|
-
es:
|
|
974
|
-
"es-ES":
|
|
975
|
-
"es-MX":
|
|
976
|
-
pt:
|
|
977
|
-
"pt-BR":
|
|
978
|
-
fr:
|
|
979
|
-
"fr-FR":
|
|
980
|
-
de:
|
|
981
|
-
"de-DE":
|
|
982
|
-
it:
|
|
983
|
-
"it-IT":
|
|
984
|
-
ru:
|
|
985
|
-
"ru-RU":
|
|
986
|
-
ar:
|
|
987
|
-
"ar-SA":
|
|
988
|
-
hi:
|
|
989
|
-
"hi-IN":
|
|
1025
|
+
}, re = {
|
|
1026
|
+
en: B,
|
|
1027
|
+
"en-US": B,
|
|
1028
|
+
zh: V,
|
|
1029
|
+
"zh-CN": V,
|
|
1030
|
+
"zh-TW": V,
|
|
1031
|
+
ja: J,
|
|
1032
|
+
"ja-JP": J,
|
|
1033
|
+
ko: Z,
|
|
1034
|
+
"ko-KR": Z,
|
|
1035
|
+
es: F,
|
|
1036
|
+
"es-ES": F,
|
|
1037
|
+
"es-MX": F,
|
|
1038
|
+
pt: Q,
|
|
1039
|
+
"pt-BR": Q,
|
|
1040
|
+
fr: X,
|
|
1041
|
+
"fr-FR": X,
|
|
1042
|
+
de: ee,
|
|
1043
|
+
"de-DE": ee,
|
|
1044
|
+
it: te,
|
|
1045
|
+
"it-IT": te,
|
|
1046
|
+
ru: se,
|
|
1047
|
+
"ru-RU": se,
|
|
1048
|
+
ar: ie,
|
|
1049
|
+
"ar-SA": ie,
|
|
1050
|
+
hi: ne,
|
|
1051
|
+
"hi-IN": ne
|
|
990
1052
|
};
|
|
991
|
-
function
|
|
1053
|
+
function Re() {
|
|
992
1054
|
if (typeof navigator > "u")
|
|
993
|
-
return
|
|
994
|
-
const
|
|
995
|
-
for (const e of
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
1055
|
+
return B;
|
|
1056
|
+
const t = navigator.languages ?? [navigator.language];
|
|
1057
|
+
for (const e of t) {
|
|
1058
|
+
const s = re[e] ?? re[e.split("-")[0]];
|
|
1059
|
+
if (s) return s;
|
|
998
1060
|
}
|
|
999
|
-
return
|
|
1061
|
+
return B;
|
|
1000
1062
|
}
|
|
1001
|
-
function
|
|
1002
|
-
if (
|
|
1003
|
-
return
|
|
1004
|
-
if (typeof
|
|
1005
|
-
const
|
|
1006
|
-
return new
|
|
1007
|
-
code:
|
|
1008
|
-
status:
|
|
1009
|
-
cause:
|
|
1063
|
+
function N(t, e = "Authentication failed.") {
|
|
1064
|
+
if (t instanceof w)
|
|
1065
|
+
return t;
|
|
1066
|
+
if (typeof t == "object" && t !== null) {
|
|
1067
|
+
const s = t;
|
|
1068
|
+
return new w(s.message || e, {
|
|
1069
|
+
code: s.code,
|
|
1070
|
+
status: s.status,
|
|
1071
|
+
cause: t
|
|
1010
1072
|
});
|
|
1011
1073
|
}
|
|
1012
|
-
return typeof
|
|
1074
|
+
return typeof t == "string" ? new w(t) : new w(e, { cause: t });
|
|
1013
1075
|
}
|
|
1014
|
-
async function
|
|
1015
|
-
var
|
|
1016
|
-
const e = await
|
|
1076
|
+
async function C(t) {
|
|
1077
|
+
var s, i;
|
|
1078
|
+
const e = await t.getSession();
|
|
1017
1079
|
if (e.error)
|
|
1018
|
-
throw new
|
|
1080
|
+
throw new w(
|
|
1019
1081
|
e.error.message || "Failed to load the current session.",
|
|
1020
1082
|
{
|
|
1021
1083
|
code: e.error.code ?? "SESSION_LOOKUP_FAILED",
|
|
@@ -1023,7 +1085,7 @@ async function _(s) {
|
|
|
1023
1085
|
cause: e.error
|
|
1024
1086
|
}
|
|
1025
1087
|
);
|
|
1026
|
-
return (
|
|
1088
|
+
return (s = e.data) != null && s.user && ((i = e.data) != null && i.session) ? {
|
|
1027
1089
|
user: e.data.user,
|
|
1028
1090
|
session: e.data
|
|
1029
1091
|
} : {
|
|
@@ -1031,7 +1093,7 @@ async function _(s) {
|
|
|
1031
1093
|
session: null
|
|
1032
1094
|
};
|
|
1033
1095
|
}
|
|
1034
|
-
const
|
|
1096
|
+
const $e = "data-edgespark-auth", n = "edgespark-auth", z = "es_auth_completion", I = "es_auth_email", oe = "oauth", R = "verify-sign-in", S = "verify-sign-up", ae = 200, q = 2, D = {
|
|
1035
1097
|
google: "Google",
|
|
1036
1098
|
apple: "Apple",
|
|
1037
1099
|
microsoft: "Microsoft",
|
|
@@ -1039,24 +1101,24 @@ const fe = "data-edgespark-auth", n = "edgespark-auth", F = "es_auth_completion"
|
|
|
1039
1101
|
gitlab: "GitLab",
|
|
1040
1102
|
discord: "Discord"
|
|
1041
1103
|
};
|
|
1042
|
-
function
|
|
1043
|
-
return "redirectTo" in
|
|
1104
|
+
function $(t) {
|
|
1105
|
+
return "redirectTo" in t;
|
|
1044
1106
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return "onSuccess" in
|
|
1107
|
+
function H(t) {
|
|
1108
|
+
return "onSuccess" in t && !("redirectTo" in t);
|
|
1047
1109
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return !
|
|
1110
|
+
function x(t) {
|
|
1111
|
+
return !t || typeof t != "string" ? !1 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim());
|
|
1050
1112
|
}
|
|
1051
|
-
function
|
|
1052
|
-
return /^\d{6}$/.test(
|
|
1113
|
+
function Ue(t) {
|
|
1114
|
+
return /^\d{6}$/.test(t.trim());
|
|
1053
1115
|
}
|
|
1054
|
-
function
|
|
1055
|
-
return
|
|
1116
|
+
function Ae(t) {
|
|
1117
|
+
return t === "email" || t === "name" || t === "password" || t === "confirmPassword" || t === "code" || t === "newPassword";
|
|
1056
1118
|
}
|
|
1057
|
-
class
|
|
1058
|
-
constructor(e,
|
|
1059
|
-
if (this.container = e, this.auth =
|
|
1119
|
+
class Be {
|
|
1120
|
+
constructor(e, s, i, r, a) {
|
|
1121
|
+
if (this.container = e, this.auth = s, this.options = i, this.loadConfig = r, this.runtimeOptions = a, this.state = {
|
|
1060
1122
|
view: "loading",
|
|
1061
1123
|
busy: !0,
|
|
1062
1124
|
busyLabel: void 0,
|
|
@@ -1069,27 +1131,27 @@ class Pe {
|
|
|
1069
1131
|
code: "",
|
|
1070
1132
|
newPassword: ""
|
|
1071
1133
|
}, this.destroyed = !1, this.terminalActionInProgress = !1, this.config = null, this.countdownUntil = null, this.countdownTimer = null, this.pendingFocusSnapshot = null, this.focusRestoreTimer = null, this.verificationCompletionAction = null, !(e instanceof HTMLElement))
|
|
1072
|
-
throw new
|
|
1073
|
-
this.labels =
|
|
1134
|
+
throw new u("authUI.mount(container, options) requires a real HTMLElement container.");
|
|
1135
|
+
this.labels = Ie(Re(), i.labels), this.root = document.createElement("div"), this.root.setAttribute($e, ""), e.innerHTML = "", e.appendChild(this.root), this.render(), this.initialize();
|
|
1074
1136
|
}
|
|
1075
1137
|
destroy() {
|
|
1076
1138
|
this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.container.innerHTML = "");
|
|
1077
1139
|
}
|
|
1078
1140
|
async initialize() {
|
|
1079
1141
|
try {
|
|
1080
|
-
const e = this.consumeManagedReturnContext(), [
|
|
1142
|
+
const e = this.consumeManagedReturnContext(), [s, i] = await Promise.all([
|
|
1081
1143
|
this.loadConfig(),
|
|
1082
1144
|
this.readMountSession(e)
|
|
1083
1145
|
]);
|
|
1084
1146
|
if (this.destroyed)
|
|
1085
1147
|
return;
|
|
1086
|
-
if (this.config =
|
|
1148
|
+
if (this.config = s, i.user && i.session) {
|
|
1087
1149
|
switch (e.marker) {
|
|
1088
|
-
case
|
|
1089
|
-
case
|
|
1150
|
+
case oe:
|
|
1151
|
+
case R:
|
|
1090
1152
|
await this.completeAuth("sign-in", i);
|
|
1091
1153
|
return;
|
|
1092
|
-
case
|
|
1154
|
+
case S:
|
|
1093
1155
|
await this.completeAuth("sign-up", i);
|
|
1094
1156
|
return;
|
|
1095
1157
|
default:
|
|
@@ -1107,20 +1169,20 @@ class Pe {
|
|
|
1107
1169
|
}
|
|
1108
1170
|
async readMountSession(e) {
|
|
1109
1171
|
if (!e.marker)
|
|
1110
|
-
return
|
|
1111
|
-
let
|
|
1112
|
-
for (let i = 0; i <=
|
|
1172
|
+
return C(this.auth);
|
|
1173
|
+
let s = null;
|
|
1174
|
+
for (let i = 0; i <= q; i++) {
|
|
1113
1175
|
try {
|
|
1114
|
-
const r = await
|
|
1176
|
+
const r = await C(this.auth);
|
|
1115
1177
|
if (r.user && r.session)
|
|
1116
1178
|
return r;
|
|
1117
1179
|
} catch (r) {
|
|
1118
|
-
|
|
1180
|
+
s = r;
|
|
1119
1181
|
}
|
|
1120
|
-
i <
|
|
1182
|
+
i < q && await new Promise((r) => setTimeout(r, ae));
|
|
1121
1183
|
}
|
|
1122
|
-
if (
|
|
1123
|
-
throw
|
|
1184
|
+
if (s)
|
|
1185
|
+
throw s;
|
|
1124
1186
|
return {
|
|
1125
1187
|
user: null,
|
|
1126
1188
|
session: null
|
|
@@ -1182,7 +1244,7 @@ class Pe {
|
|
|
1182
1244
|
}
|
|
1183
1245
|
renderSignInView() {
|
|
1184
1246
|
var i, r;
|
|
1185
|
-
const e = this.renderOAuthProviders(),
|
|
1247
|
+
const e = this.renderOAuthProviders(), s = ((i = this.config) == null ? void 0 : i.emailPasswordEnabled) ?? !0;
|
|
1186
1248
|
return `
|
|
1187
1249
|
<section class="${n}__section">
|
|
1188
1250
|
<header class="${n}__header">
|
|
@@ -1190,8 +1252,8 @@ class Pe {
|
|
|
1190
1252
|
<p class="${n}__copy">${this.escape(this.labels.signIn.subtitle)}</p>
|
|
1191
1253
|
</header>
|
|
1192
1254
|
${e}
|
|
1193
|
-
${e &&
|
|
1194
|
-
${
|
|
1255
|
+
${e && s ? `<div class="${n}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
|
|
1256
|
+
${s ? `
|
|
1195
1257
|
<form class="${n}__form" data-view="sign-in" novalidate>
|
|
1196
1258
|
${this.renderInput("email", this.labels.signIn.emailLabel, "email", this.state.email, "email")}
|
|
1197
1259
|
${this.renderInput("password", this.labels.signIn.passwordLabel, "password", this.state.password, "current-password")}
|
|
@@ -1320,28 +1382,28 @@ class Pe {
|
|
|
1320
1382
|
`;
|
|
1321
1383
|
}
|
|
1322
1384
|
renderOAuthProviders() {
|
|
1323
|
-
var
|
|
1324
|
-
const e = ((
|
|
1385
|
+
var s;
|
|
1386
|
+
const e = ((s = this.config) == null ? void 0 : s.oauthProviders) ?? [];
|
|
1325
1387
|
return e.length === 0 ? "" : `
|
|
1326
1388
|
<div class="${n}__stack">
|
|
1327
1389
|
${e.map((i) => `
|
|
1328
1390
|
<button class="${n}__button ${n}__button--secondary" type="button" data-action="oauth" data-provider="${i}" ${this.state.busy ? "disabled" : ""}>
|
|
1329
|
-
${this.escape(`${this.labels.oauth.continueWith} ${
|
|
1391
|
+
${this.escape(`${this.labels.oauth.continueWith} ${D[i]}`)}
|
|
1330
1392
|
</button>
|
|
1331
1393
|
`).join("")}
|
|
1332
1394
|
</div>
|
|
1333
1395
|
`;
|
|
1334
1396
|
}
|
|
1335
|
-
renderInput(e,
|
|
1397
|
+
renderInput(e, s, i, r, a) {
|
|
1336
1398
|
return `
|
|
1337
1399
|
<label class="${n}__field">
|
|
1338
|
-
<span class="${n}__label">${this.escape(
|
|
1400
|
+
<span class="${n}__label">${this.escape(s)}</span>
|
|
1339
1401
|
<input
|
|
1340
1402
|
class="${n}__input"
|
|
1341
1403
|
name="${this.escape(e)}"
|
|
1342
1404
|
type="${this.escape(i)}"
|
|
1343
1405
|
value="${this.escape(r)}"
|
|
1344
|
-
autocomplete="${this.escape(
|
|
1406
|
+
autocomplete="${this.escape(a)}"
|
|
1345
1407
|
${this.state.busy ? "disabled" : ""}
|
|
1346
1408
|
/>
|
|
1347
1409
|
</label>
|
|
@@ -1349,19 +1411,19 @@ class Pe {
|
|
|
1349
1411
|
}
|
|
1350
1412
|
bindDOM() {
|
|
1351
1413
|
this.root.querySelectorAll("form[data-view]").forEach((r) => {
|
|
1352
|
-
r.addEventListener("submit", (
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1414
|
+
r.addEventListener("submit", (a) => {
|
|
1415
|
+
a.preventDefault();
|
|
1416
|
+
const c = r.dataset.view;
|
|
1417
|
+
c === "sign-in" && this.handleSignIn(), c === "sign-up" && this.handleSignUp(), c === "forgot-password" && this.handleForgotPassword(), c === "reset-password" && this.handleResetPassword();
|
|
1356
1418
|
});
|
|
1357
1419
|
}), this.root.querySelectorAll("input[name]").forEach((r) => {
|
|
1358
1420
|
r.addEventListener("input", () => {
|
|
1359
|
-
|
|
1421
|
+
Ae(r.name) && (this.state[r.name] = r.value);
|
|
1360
1422
|
});
|
|
1361
1423
|
}), this.root.querySelectorAll("[data-action]").forEach((r) => {
|
|
1362
1424
|
r.addEventListener("click", () => {
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1425
|
+
const a = r.dataset.action;
|
|
1426
|
+
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(r.dataset.provider);
|
|
1365
1427
|
});
|
|
1366
1428
|
});
|
|
1367
1429
|
}
|
|
@@ -1369,7 +1431,7 @@ class Pe {
|
|
|
1369
1431
|
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();
|
|
1370
1432
|
}
|
|
1371
1433
|
async handleSignIn() {
|
|
1372
|
-
if (!
|
|
1434
|
+
if (!x(this.state.email)) {
|
|
1373
1435
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1374
1436
|
return;
|
|
1375
1437
|
}
|
|
@@ -1381,7 +1443,7 @@ class Pe {
|
|
|
1381
1443
|
const e = await this.auth.signIn.email({
|
|
1382
1444
|
email: this.state.email.trim(),
|
|
1383
1445
|
password: this.state.password,
|
|
1384
|
-
callbackURL: this.getManagedReturnURL(
|
|
1446
|
+
callbackURL: this.getManagedReturnURL(R, this.state.email.trim())
|
|
1385
1447
|
});
|
|
1386
1448
|
if (e.error)
|
|
1387
1449
|
throw e.error;
|
|
@@ -1389,12 +1451,12 @@ class Pe {
|
|
|
1389
1451
|
});
|
|
1390
1452
|
}
|
|
1391
1453
|
async handleSignUp() {
|
|
1392
|
-
var e,
|
|
1454
|
+
var e, s;
|
|
1393
1455
|
if (!this.state.name.trim()) {
|
|
1394
1456
|
this.failValidation(this.labels.errors.requiredField);
|
|
1395
1457
|
return;
|
|
1396
1458
|
}
|
|
1397
|
-
if (!
|
|
1459
|
+
if (!x(this.state.email)) {
|
|
1398
1460
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1399
1461
|
return;
|
|
1400
1462
|
}
|
|
@@ -1404,7 +1466,7 @@ class Pe {
|
|
|
1404
1466
|
}
|
|
1405
1467
|
if (this.state.password.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
|
|
1406
1468
|
this.failValidation(
|
|
1407
|
-
this.labels.errors.passwordTooShort.replace("{min}", String(((
|
|
1469
|
+
this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
|
|
1408
1470
|
);
|
|
1409
1471
|
return;
|
|
1410
1472
|
}
|
|
@@ -1418,7 +1480,7 @@ class Pe {
|
|
|
1418
1480
|
name: this.state.name.trim(),
|
|
1419
1481
|
email: this.state.email.trim(),
|
|
1420
1482
|
password: this.state.password,
|
|
1421
|
-
callbackURL: this.getManagedReturnURL(
|
|
1483
|
+
callbackURL: this.getManagedReturnURL(S, this.state.email.trim())
|
|
1422
1484
|
});
|
|
1423
1485
|
if (i.error)
|
|
1424
1486
|
throw i.error;
|
|
@@ -1430,28 +1492,28 @@ class Pe {
|
|
|
1430
1492
|
});
|
|
1431
1493
|
}
|
|
1432
1494
|
async handleOAuthSignIn(e) {
|
|
1433
|
-
await this.runAction(`Redirecting to ${
|
|
1434
|
-
const
|
|
1495
|
+
await this.runAction(`Redirecting to ${D[e]}…`, async () => {
|
|
1496
|
+
const s = await this.auth.signIn.social({
|
|
1435
1497
|
provider: e,
|
|
1436
1498
|
callbackURL: this.getManagedReturnURL("oauth"),
|
|
1437
1499
|
errorCallbackURL: this.getManagedReturnURL("oauth")
|
|
1438
1500
|
});
|
|
1439
|
-
if (
|
|
1440
|
-
throw
|
|
1441
|
-
const i = this.extractRedirectURL(
|
|
1501
|
+
if (s.error)
|
|
1502
|
+
throw s.error;
|
|
1503
|
+
const i = this.extractRedirectURL(s.data);
|
|
1442
1504
|
if (!i)
|
|
1443
|
-
throw new
|
|
1444
|
-
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${
|
|
1505
|
+
throw new u(`OAuth sign-in did not return a redirect URL for provider "${e}".`);
|
|
1506
|
+
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${D[e]}…`, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(i);
|
|
1445
1507
|
});
|
|
1446
1508
|
}
|
|
1447
1509
|
async handleForgotPassword() {
|
|
1448
1510
|
if (!this.canUsePasswordResetEmailOtp()) {
|
|
1449
1511
|
this.handleError(
|
|
1450
|
-
new
|
|
1512
|
+
new u("Password reset via email OTP is not enabled for this project.")
|
|
1451
1513
|
);
|
|
1452
1514
|
return;
|
|
1453
1515
|
}
|
|
1454
|
-
if (!
|
|
1516
|
+
if (!x(this.state.email)) {
|
|
1455
1517
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1456
1518
|
return;
|
|
1457
1519
|
}
|
|
@@ -1468,14 +1530,14 @@ class Pe {
|
|
|
1468
1530
|
this.isCountdownActive() || await this.handleForgotPassword();
|
|
1469
1531
|
}
|
|
1470
1532
|
async handleResetPassword() {
|
|
1471
|
-
var e,
|
|
1533
|
+
var e, s;
|
|
1472
1534
|
if (!this.canUsePasswordResetEmailOtp()) {
|
|
1473
1535
|
this.handleError(
|
|
1474
|
-
new
|
|
1536
|
+
new u("Password reset via email OTP is not enabled for this project.")
|
|
1475
1537
|
);
|
|
1476
1538
|
return;
|
|
1477
1539
|
}
|
|
1478
|
-
if (!
|
|
1540
|
+
if (!Ue(this.state.code)) {
|
|
1479
1541
|
this.failValidation(this.labels.errors.invalidCode);
|
|
1480
1542
|
return;
|
|
1481
1543
|
}
|
|
@@ -1485,7 +1547,7 @@ class Pe {
|
|
|
1485
1547
|
}
|
|
1486
1548
|
if (this.state.newPassword.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
|
|
1487
1549
|
this.failValidation(
|
|
1488
|
-
this.labels.errors.passwordTooShort.replace("{min}", String(((
|
|
1550
|
+
this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
|
|
1489
1551
|
);
|
|
1490
1552
|
return;
|
|
1491
1553
|
}
|
|
@@ -1509,29 +1571,29 @@ class Pe {
|
|
|
1509
1571
|
}
|
|
1510
1572
|
async sendVerificationEmail(e) {
|
|
1511
1573
|
!e && this.isCountdownActive() || await this.runAction("Sending verification email…", async () => {
|
|
1512
|
-
const
|
|
1574
|
+
const s = await this.auth.sendVerificationEmail({
|
|
1513
1575
|
email: this.state.email.trim(),
|
|
1514
1576
|
callbackURL: this.getManagedReturnURL(
|
|
1515
|
-
this.verificationCompletionAction === "sign-up" ?
|
|
1577
|
+
this.verificationCompletionAction === "sign-up" ? S : R,
|
|
1516
1578
|
this.state.email.trim()
|
|
1517
1579
|
)
|
|
1518
1580
|
});
|
|
1519
|
-
if (
|
|
1520
|
-
throw
|
|
1581
|
+
if (s.error)
|
|
1582
|
+
throw s.error;
|
|
1521
1583
|
this.handleVerificationEmailSent(this.state.email.trim(), !0);
|
|
1522
1584
|
});
|
|
1523
1585
|
}
|
|
1524
|
-
async completeAuth(e,
|
|
1586
|
+
async completeAuth(e, s) {
|
|
1525
1587
|
const i = await this.retryAuthCompletionDataIfNeeded(
|
|
1526
|
-
|
|
1588
|
+
s ?? await this.resolveAuthCompletionData()
|
|
1527
1589
|
);
|
|
1528
1590
|
if (!i.user || !i.session) {
|
|
1529
|
-
if (i.lookupError &&
|
|
1530
|
-
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(
|
|
1591
|
+
if (i.lookupError && $(this.options)) {
|
|
1592
|
+
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(O(this.options.redirectTo).toString());
|
|
1531
1593
|
return;
|
|
1532
1594
|
}
|
|
1533
1595
|
if (e === "sign-in")
|
|
1534
|
-
throw i.lookupError ?? new
|
|
1596
|
+
throw i.lookupError ?? new de(
|
|
1535
1597
|
"Managed sign-in completed without an authenticated session."
|
|
1536
1598
|
);
|
|
1537
1599
|
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();
|
|
@@ -1542,11 +1604,11 @@ class Pe {
|
|
|
1542
1604
|
user: i.user,
|
|
1543
1605
|
session: i.session
|
|
1544
1606
|
};
|
|
1545
|
-
if (await this.syncPublicSessionBestEffort(),
|
|
1546
|
-
this.terminalActionInProgress = !0, this.invokeRedirectModeSuccessHook(r), this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(
|
|
1607
|
+
if (await this.syncPublicSessionBestEffort(), $(this.options)) {
|
|
1608
|
+
this.terminalActionInProgress = !0, this.invokeRedirectModeSuccessHook(r), this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(O(this.options.redirectTo).toString());
|
|
1547
1609
|
return;
|
|
1548
1610
|
}
|
|
1549
|
-
if (
|
|
1611
|
+
if (H(this.options)) {
|
|
1550
1612
|
this.destroy(), this.options.onSuccess(r);
|
|
1551
1613
|
return;
|
|
1552
1614
|
}
|
|
@@ -1554,44 +1616,44 @@ class Pe {
|
|
|
1554
1616
|
async retryAuthCompletionDataIfNeeded(e) {
|
|
1555
1617
|
if (e.session)
|
|
1556
1618
|
return e;
|
|
1557
|
-
let
|
|
1558
|
-
for (let i = 0; i <
|
|
1559
|
-
await new Promise((r) => setTimeout(r,
|
|
1619
|
+
let s = e.lookupError;
|
|
1620
|
+
for (let i = 0; i < q; i++) {
|
|
1621
|
+
await new Promise((r) => setTimeout(r, ae));
|
|
1560
1622
|
try {
|
|
1561
|
-
const r = await
|
|
1623
|
+
const r = await C(this.auth);
|
|
1562
1624
|
if (r.user && r.session)
|
|
1563
1625
|
return {
|
|
1564
1626
|
user: r.user,
|
|
1565
1627
|
session: r.session
|
|
1566
1628
|
};
|
|
1567
1629
|
} catch (r) {
|
|
1568
|
-
|
|
1630
|
+
s = r;
|
|
1569
1631
|
}
|
|
1570
1632
|
}
|
|
1571
1633
|
return {
|
|
1572
1634
|
...e,
|
|
1573
|
-
lookupError:
|
|
1635
|
+
lookupError: s ?? e.lookupError
|
|
1574
1636
|
};
|
|
1575
1637
|
}
|
|
1576
1638
|
async syncPublicSessionBestEffort() {
|
|
1577
|
-
var e,
|
|
1639
|
+
var e, s;
|
|
1578
1640
|
try {
|
|
1579
|
-
await ((
|
|
1641
|
+
await ((s = (e = this.runtimeOptions) == null ? void 0 : e.syncPublicSession) == null ? void 0 : s.call(e));
|
|
1580
1642
|
} catch {
|
|
1581
1643
|
}
|
|
1582
1644
|
}
|
|
1583
1645
|
async resolveAuthCompletionData(e) {
|
|
1584
1646
|
try {
|
|
1585
|
-
const
|
|
1647
|
+
const s = await C(this.auth), i = this.extractUser(e);
|
|
1586
1648
|
return {
|
|
1587
|
-
user:
|
|
1588
|
-
session:
|
|
1649
|
+
user: s.user ?? i,
|
|
1650
|
+
session: s.session
|
|
1589
1651
|
};
|
|
1590
|
-
} catch (
|
|
1652
|
+
} catch (s) {
|
|
1591
1653
|
return {
|
|
1592
1654
|
user: this.extractUser(e),
|
|
1593
1655
|
session: null,
|
|
1594
|
-
lookupError:
|
|
1656
|
+
lookupError: s
|
|
1595
1657
|
};
|
|
1596
1658
|
}
|
|
1597
1659
|
}
|
|
@@ -1601,26 +1663,26 @@ class Pe {
|
|
|
1601
1663
|
user: null,
|
|
1602
1664
|
session: null
|
|
1603
1665
|
};
|
|
1604
|
-
if (
|
|
1666
|
+
if (H(this.options)) {
|
|
1605
1667
|
this.destroy(), this.options.onSuccess(e);
|
|
1606
1668
|
return;
|
|
1607
1669
|
}
|
|
1608
1670
|
this.invokeRedirectModeSuccessHook(e), this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.newPassword = "", this.state.code = "", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = "Password updated. Sign in with your new password.", this.render();
|
|
1609
1671
|
}
|
|
1610
1672
|
handleExistingSessionOnMount(e) {
|
|
1611
|
-
if (
|
|
1612
|
-
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(
|
|
1673
|
+
if ($(this.options)) {
|
|
1674
|
+
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(O(this.options.redirectTo).toString());
|
|
1613
1675
|
return;
|
|
1614
1676
|
}
|
|
1615
|
-
if (
|
|
1616
|
-
throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new
|
|
1677
|
+
if (H(this.options))
|
|
1678
|
+
throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new u(
|
|
1617
1679
|
"authUI.mount(container, { onSuccess }) cannot run while a session already exists. Check es.auth.getSession() before mounting controlled auth UI."
|
|
1618
1680
|
);
|
|
1619
1681
|
}
|
|
1620
|
-
async runAction(e,
|
|
1682
|
+
async runAction(e, s) {
|
|
1621
1683
|
this.state.busy = !0, this.state.busyLabel = e, this.state.error = null, this.state.notice = null, this.render();
|
|
1622
1684
|
try {
|
|
1623
|
-
await
|
|
1685
|
+
await s();
|
|
1624
1686
|
} catch (i) {
|
|
1625
1687
|
if (this.maybeHandleVerificationRequired(i))
|
|
1626
1688
|
return;
|
|
@@ -1630,45 +1692,45 @@ class Pe {
|
|
|
1630
1692
|
!this.destroyed && !this.terminalActionInProgress && (this.state.busy = !1, this.state.busyLabel = void 0, this.render());
|
|
1631
1693
|
}
|
|
1632
1694
|
maybeHandleVerificationRequired(e) {
|
|
1633
|
-
return
|
|
1695
|
+
return N(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);
|
|
1634
1696
|
}
|
|
1635
|
-
handleVerificationEmailSent(e,
|
|
1636
|
-
this.state.notice =
|
|
1697
|
+
handleVerificationEmailSent(e, s) {
|
|
1698
|
+
this.state.notice = s ? `We sent another verification email to ${e}.` : `We sent a verification email to ${e}.`, this.startCountdown();
|
|
1637
1699
|
}
|
|
1638
1700
|
invokeRedirectModeSuccessHook(e) {
|
|
1639
|
-
var
|
|
1640
|
-
if (!(
|
|
1701
|
+
var s, i;
|
|
1702
|
+
if (!(!$(this.options) || !this.options.onSuccess))
|
|
1641
1703
|
try {
|
|
1642
1704
|
this.options.onSuccess(e);
|
|
1643
1705
|
} catch (r) {
|
|
1644
|
-
const
|
|
1706
|
+
const a = N(r, "Post-auth callback failed.");
|
|
1645
1707
|
try {
|
|
1646
|
-
(i = (
|
|
1708
|
+
(i = (s = this.options).onError) == null || i.call(s, a);
|
|
1647
1709
|
} catch {
|
|
1648
1710
|
}
|
|
1649
1711
|
}
|
|
1650
1712
|
}
|
|
1651
|
-
handleError(e,
|
|
1652
|
-
var r,
|
|
1653
|
-
const i =
|
|
1654
|
-
this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (
|
|
1713
|
+
handleError(e, s) {
|
|
1714
|
+
var r, a;
|
|
1715
|
+
const i = N(e, s);
|
|
1716
|
+
this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (a = (r = this.options).onError) == null || a.call(r, i);
|
|
1655
1717
|
}
|
|
1656
1718
|
failValidation(e) {
|
|
1657
1719
|
this.state.error = e, this.state.notice = null, this.render();
|
|
1658
1720
|
}
|
|
1659
|
-
getManagedReturnURL(e,
|
|
1721
|
+
getManagedReturnURL(e, s) {
|
|
1660
1722
|
if (!e)
|
|
1661
1723
|
return window.location.href;
|
|
1662
1724
|
const i = new URL(window.location.href);
|
|
1663
|
-
return i.searchParams.set(
|
|
1725
|
+
return i.searchParams.set(z, e), s ? i.searchParams.set(I, s) : i.searchParams.delete(I), i.toString();
|
|
1664
1726
|
}
|
|
1665
1727
|
consumeManagedReturnContext() {
|
|
1666
|
-
const e = new URL(window.location.href),
|
|
1667
|
-
return (
|
|
1668
|
-
marker:
|
|
1728
|
+
const e = new URL(window.location.href), s = e.searchParams.get(z), i = e.searchParams.get(I), r = s ? e.searchParams.get("error") : null, a = s ? e.searchParams.get("error_description") : null;
|
|
1729
|
+
return (s || i) && (e.searchParams.delete(z), e.searchParams.delete(I), s && (e.searchParams.delete("error"), e.searchParams.delete("error_description")), window.history.replaceState(null, "", e.toString())), {
|
|
1730
|
+
marker: s,
|
|
1669
1731
|
email: i,
|
|
1670
1732
|
error: r,
|
|
1671
|
-
errorDescription:
|
|
1733
|
+
errorDescription: a
|
|
1672
1734
|
};
|
|
1673
1735
|
}
|
|
1674
1736
|
startCountdown(e = 60) {
|
|
@@ -1696,7 +1758,7 @@ class Pe {
|
|
|
1696
1758
|
this.pendingFocusSnapshot && (this.clearFocusRestoreTimer(), this.focusRestoreTimer = window.setTimeout(() => {
|
|
1697
1759
|
if (this.focusRestoreTimer = null, this.destroyed || !this.pendingFocusSnapshot)
|
|
1698
1760
|
return;
|
|
1699
|
-
const e = this.pendingFocusSnapshot,
|
|
1761
|
+
const e = this.pendingFocusSnapshot, s = `input[name="${this.escape(e.name)}"][type="${this.escape(e.type)}"]`, i = this.root.querySelector(s);
|
|
1700
1762
|
if (!(!i || i.disabled)) {
|
|
1701
1763
|
if (i.focus(), e.selectionStart !== null && e.selectionEnd !== null)
|
|
1702
1764
|
try {
|
|
@@ -1718,24 +1780,24 @@ class Pe {
|
|
|
1718
1780
|
extractRedirectURL(e) {
|
|
1719
1781
|
if (!e || typeof e != "object")
|
|
1720
1782
|
return null;
|
|
1721
|
-
const
|
|
1722
|
-
return
|
|
1783
|
+
const s = e;
|
|
1784
|
+
return s.redirect && typeof s.url == "string" && s.url.length > 0 ? s.url : null;
|
|
1723
1785
|
}
|
|
1724
1786
|
extractUser(e) {
|
|
1725
1787
|
if (!e || typeof e != "object")
|
|
1726
1788
|
return null;
|
|
1727
|
-
const
|
|
1728
|
-
return
|
|
1789
|
+
const s = e;
|
|
1790
|
+
return s.user && typeof s.user == "object" ? s.user : null;
|
|
1729
1791
|
}
|
|
1730
1792
|
canUsePasswordResetEmailOtp() {
|
|
1731
1793
|
var e;
|
|
1732
1794
|
return !!((e = this.config) != null && e.passwordResetEmailOtpEnabled);
|
|
1733
1795
|
}
|
|
1734
1796
|
handleSessionlessManagedReturn(e) {
|
|
1735
|
-
return e.email && (this.state.email = e.email), e.marker ===
|
|
1797
|
+
return e.email && (this.state.email = e.email), e.marker === S && !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 === R || e.marker === S ? (this.verificationCompletionAction = e.marker === S ? "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 w(
|
|
1736
1798
|
e.errorDescription ?? "Verification failed. Request a new verification email and try again.",
|
|
1737
1799
|
{ code: e.error ?? "VERIFY_EMAIL_ERROR" }
|
|
1738
|
-
)) : this.render(), !0) : e.marker ===
|
|
1800
|
+
)) : this.render(), !0) : e.marker === oe && (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 w(
|
|
1739
1801
|
e.errorDescription ?? "OAuth sign-in failed.",
|
|
1740
1802
|
{ code: e.error ?? "OAUTH_ERROR" }
|
|
1741
1803
|
)), !0) : !1;
|
|
@@ -1746,136 +1808,136 @@ class Pe {
|
|
|
1746
1808
|
getCountdownSecondsRemaining() {
|
|
1747
1809
|
return this.countdownUntil ? Math.max(0, Math.ceil((this.countdownUntil - Date.now()) / 1e3)) : 0;
|
|
1748
1810
|
}
|
|
1749
|
-
countdownText(e,
|
|
1811
|
+
countdownText(e, s) {
|
|
1750
1812
|
const i = this.getCountdownSecondsRemaining();
|
|
1751
|
-
return i <= 0 ? e :
|
|
1813
|
+
return i <= 0 ? e : s.replace("{seconds}", String(i));
|
|
1752
1814
|
}
|
|
1753
1815
|
escape(e) {
|
|
1754
1816
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1755
1817
|
}
|
|
1756
1818
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return "data" in
|
|
1819
|
+
function ke(t) {
|
|
1820
|
+
return "data" in t && t.data ? t.data : t;
|
|
1759
1821
|
}
|
|
1760
|
-
const
|
|
1822
|
+
const Me = [
|
|
1761
1823
|
{ id: "google", key: "providerGoogle" },
|
|
1762
1824
|
{ id: "apple", key: "providerApple" },
|
|
1763
1825
|
{ id: "microsoft", key: "providerMicrosoft" },
|
|
1764
1826
|
{ id: "github", key: "providerGithub" },
|
|
1765
1827
|
{ id: "gitlab", key: "providerGitlab" },
|
|
1766
1828
|
{ id: "discord", key: "providerDiscord" }
|
|
1767
|
-
],
|
|
1768
|
-
async function
|
|
1769
|
-
const
|
|
1829
|
+
], le = 2, Oe = 500;
|
|
1830
|
+
async function Ve() {
|
|
1831
|
+
const t = `${window.location.origin}${ue}/config`;
|
|
1770
1832
|
let e;
|
|
1771
|
-
for (let
|
|
1833
|
+
for (let s = 0; s <= le; s++)
|
|
1772
1834
|
try {
|
|
1773
|
-
const i = await fetch(
|
|
1835
|
+
const i = await fetch(t, { method: "GET", credentials: "include" });
|
|
1774
1836
|
if (!i.ok)
|
|
1775
|
-
throw new
|
|
1837
|
+
throw new u(`Failed to load auth config: HTTP ${i.status}`);
|
|
1776
1838
|
const r = await i.json();
|
|
1777
|
-
return
|
|
1839
|
+
return Ne(ke(r));
|
|
1778
1840
|
} catch (i) {
|
|
1779
|
-
e = i,
|
|
1841
|
+
e = i, s < le && await new Promise((r) => setTimeout(r, Oe));
|
|
1780
1842
|
}
|
|
1781
1843
|
throw e;
|
|
1782
1844
|
}
|
|
1783
|
-
let
|
|
1784
|
-
async function
|
|
1785
|
-
return
|
|
1786
|
-
throw
|
|
1787
|
-
})),
|
|
1845
|
+
let U = null;
|
|
1846
|
+
async function Fe() {
|
|
1847
|
+
return U || (U = Ve().catch((t) => {
|
|
1848
|
+
throw U = null, t;
|
|
1849
|
+
})), U;
|
|
1788
1850
|
}
|
|
1789
|
-
function
|
|
1790
|
-
var
|
|
1791
|
-
const e =
|
|
1792
|
-
const
|
|
1793
|
-
return typeof
|
|
1794
|
-
}).map(({ id:
|
|
1851
|
+
function Ne(t) {
|
|
1852
|
+
var s, i, r, a, c, p, T;
|
|
1853
|
+
const e = Me.filter(({ key: P }) => {
|
|
1854
|
+
const b = t[P];
|
|
1855
|
+
return typeof b == "object" && b !== null && "enabled" in b && !!b.enabled;
|
|
1856
|
+
}).map(({ id: P }) => P);
|
|
1795
1857
|
return {
|
|
1796
|
-
disableSignUp: !!
|
|
1797
|
-
emailPasswordEnabled: !!((
|
|
1798
|
-
minPasswordLength: ((r = (i =
|
|
1799
|
-
requireEmailVerification: !!((
|
|
1800
|
-
passwordResetEmailOtpEnabled: !!((
|
|
1858
|
+
disableSignUp: !!t.disableSignUp,
|
|
1859
|
+
emailPasswordEnabled: !!((s = t.providerEmailPassword) != null && s.enabled),
|
|
1860
|
+
minPasswordLength: ((r = (i = t.providerEmailPassword) == null ? void 0 : i.config) == null ? void 0 : r.minPasswordLength) ?? 8,
|
|
1861
|
+
requireEmailVerification: !!((c = (a = t.providerEmailPassword) == null ? void 0 : a.config) != null && c.requireEmailVerification),
|
|
1862
|
+
passwordResetEmailOtpEnabled: !!((T = (p = t.providerEmailPassword) == null ? void 0 : p.config) != null && T.requirePasswordResetEmailVerification),
|
|
1801
1863
|
oauthProviders: e
|
|
1802
1864
|
};
|
|
1803
1865
|
}
|
|
1804
|
-
const
|
|
1805
|
-
function
|
|
1806
|
-
if (!
|
|
1807
|
-
throw new
|
|
1866
|
+
const A = /* @__PURE__ */ new WeakMap();
|
|
1867
|
+
function ze(t) {
|
|
1868
|
+
if (!t)
|
|
1869
|
+
throw new u(
|
|
1808
1870
|
"authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
|
|
1809
1871
|
);
|
|
1810
|
-
const e = "redirectTo" in
|
|
1811
|
-
if (!e && !
|
|
1812
|
-
throw new
|
|
1872
|
+
const e = "redirectTo" in t, s = "onSuccess" in t && typeof t.onSuccess == "function";
|
|
1873
|
+
if (!e && !s)
|
|
1874
|
+
throw new u(
|
|
1813
1875
|
"authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
|
|
1814
1876
|
);
|
|
1815
|
-
if ("redirectTo" in
|
|
1816
|
-
const i =
|
|
1877
|
+
if ("redirectTo" in t) {
|
|
1878
|
+
const i = t.redirectTo;
|
|
1817
1879
|
if (!(typeof i == "string" || i instanceof URL))
|
|
1818
|
-
throw new
|
|
1880
|
+
throw new u(
|
|
1819
1881
|
"authUI.mount(container, options) expected redirectTo to be a string or URL."
|
|
1820
1882
|
);
|
|
1821
1883
|
}
|
|
1822
|
-
if ("onSuccess" in
|
|
1823
|
-
throw new
|
|
1884
|
+
if ("onSuccess" in t && t.onSuccess !== void 0 && typeof t.onSuccess != "function")
|
|
1885
|
+
throw new u(
|
|
1824
1886
|
"authUI.mount(container, options) expected onSuccess to be a function."
|
|
1825
1887
|
);
|
|
1826
|
-
if ("onError" in
|
|
1827
|
-
throw new
|
|
1888
|
+
if ("onError" in t && t.onError !== void 0 && typeof t.onError != "function")
|
|
1889
|
+
throw new u(
|
|
1828
1890
|
"authUI.mount(container, options) expected onError to be a function."
|
|
1829
1891
|
);
|
|
1830
1892
|
}
|
|
1831
|
-
function
|
|
1832
|
-
if (!(
|
|
1833
|
-
throw new
|
|
1893
|
+
function qe(t) {
|
|
1894
|
+
if (!(t instanceof HTMLElement))
|
|
1895
|
+
throw new u("authUI.mount(container, options) requires a real HTMLElement container.");
|
|
1834
1896
|
}
|
|
1835
|
-
function
|
|
1897
|
+
function De(t, e) {
|
|
1836
1898
|
return {
|
|
1837
|
-
mount(
|
|
1838
|
-
var
|
|
1839
|
-
|
|
1840
|
-
const r = new
|
|
1899
|
+
mount(s, i) {
|
|
1900
|
+
var p;
|
|
1901
|
+
ze(i), qe(s), (p = A.get(s)) == null || p.destroy();
|
|
1902
|
+
const r = new Be(s, t, i, Fe, e), a = r.destroy.bind(r), c = {
|
|
1841
1903
|
destroy() {
|
|
1842
|
-
|
|
1904
|
+
a(), A.get(s) === c && A.delete(s);
|
|
1843
1905
|
}
|
|
1844
1906
|
};
|
|
1845
|
-
return
|
|
1907
|
+
return A.set(s, c), c;
|
|
1846
1908
|
}
|
|
1847
1909
|
};
|
|
1848
1910
|
}
|
|
1849
|
-
function
|
|
1850
|
-
|
|
1851
|
-
const
|
|
1911
|
+
function xe() {
|
|
1912
|
+
ce();
|
|
1913
|
+
const t = Te(), e = Ce(), s = ye(), i = De(e, {
|
|
1852
1914
|
syncPublicSession: async () => {
|
|
1853
|
-
await
|
|
1915
|
+
await _e(t);
|
|
1854
1916
|
}
|
|
1855
1917
|
});
|
|
1856
1918
|
return {
|
|
1857
|
-
auth:
|
|
1858
|
-
api:
|
|
1919
|
+
auth: t,
|
|
1920
|
+
api: s,
|
|
1859
1921
|
authUI: i
|
|
1860
1922
|
};
|
|
1861
1923
|
}
|
|
1862
1924
|
export {
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1925
|
+
w as EdgeSparkAuthError,
|
|
1926
|
+
u as EdgeSparkConfigError,
|
|
1927
|
+
j as EdgeSparkError,
|
|
1928
|
+
de as EdgeSparkRuntimeError,
|
|
1929
|
+
ie as ar,
|
|
1930
|
+
xe as createEdgeSpark,
|
|
1931
|
+
ee as de,
|
|
1932
|
+
Re as detectLocale,
|
|
1933
|
+
B as enUS,
|
|
1934
|
+
F as es,
|
|
1935
|
+
X as fr,
|
|
1936
|
+
ne as hi,
|
|
1937
|
+
te as it,
|
|
1938
|
+
J as ja,
|
|
1939
|
+
Z as ko,
|
|
1940
|
+
Q as ptBR,
|
|
1941
|
+
se as ru,
|
|
1942
|
+
V as zhCN
|
|
1881
1943
|
};
|