astrogators-shared-ui 0.15.0 → 0.16.1
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/README.md +21 -3
- package/dist/index.css +1 -1
- package/dist/index.js +830 -470
- package/dist/src/components/forms/AllyCodeDropdown.d.ts +10 -0
- package/dist/src/components/layout/AccountCluster.d.ts +13 -0
- package/dist/src/components/layout/MobileNavPanel.d.ts +24 -0
- package/dist/src/components/layout/NavBar.d.ts +33 -40
- package/dist/src/components/layout/NavBurger.d.ts +11 -0
- package/dist/src/components/layout/NavMenu.d.ts +17 -0
- package/dist/src/components/layout/index.d.ts +1 -1
- package/dist/src/hooks/useDismissableMenu.d.ts +18 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/navigation/suiteNav.d.ts +28 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import e, { createContext as t,
|
|
2
|
-
import { Fragment as
|
|
3
|
-
|
|
1
|
+
import e, { createContext as t, forwardRef as n, useCallback as r, useContext as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal as d } from "react-dom";
|
|
4
|
+
var f = {
|
|
4
5
|
container: "_container_u3o0e_1",
|
|
5
6
|
padding: "_padding_u3o0e_7",
|
|
6
7
|
"maxWidth-sm": "_maxWidth-sm_u3o0e_12",
|
|
@@ -8,203 +9,73 @@ var l = {
|
|
|
8
9
|
"maxWidth-lg": "_maxWidth-lg_u3o0e_20",
|
|
9
10
|
"maxWidth-xl": "_maxWidth-xl_u3o0e_24",
|
|
10
11
|
"maxWidth-full": "_maxWidth-full_u3o0e_28"
|
|
11
|
-
},
|
|
12
|
-
className: `${
|
|
12
|
+
}, p = ({ children: e, maxWidth: t = "xl", padding: n = !0, className: r = "", style: i }) => /* @__PURE__ */ l("div", {
|
|
13
|
+
className: `${f.container} ${f[`maxWidth-${t}`]} ${n ? f.padding : ""} ${r}`,
|
|
13
14
|
style: i,
|
|
14
15
|
children: e
|
|
15
|
-
}),
|
|
16
|
-
topBar: "
|
|
17
|
-
content: "
|
|
18
|
-
left: "
|
|
19
|
-
right: "
|
|
20
|
-
logo: "
|
|
21
|
-
},
|
|
22
|
-
className: `${
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
-
className:
|
|
25
|
-
children: [/* @__PURE__ */
|
|
26
|
-
className:
|
|
27
|
-
children: [e && /* @__PURE__ */
|
|
28
|
-
className:
|
|
16
|
+
}), m = {
|
|
17
|
+
topBar: "_topBar_r058i_1",
|
|
18
|
+
content: "_content_r058i_17",
|
|
19
|
+
left: "_left_r058i_25",
|
|
20
|
+
right: "_right_r058i_32",
|
|
21
|
+
logo: "_logo_r058i_38"
|
|
22
|
+
}, h = ({ logo: e, leftContent: t, rightContent: n, className: r = "" }) => /* @__PURE__ */ l("header", {
|
|
23
|
+
className: `${m.topBar} ${r}`,
|
|
24
|
+
children: /* @__PURE__ */ u("div", {
|
|
25
|
+
className: m.content,
|
|
26
|
+
children: [/* @__PURE__ */ u("div", {
|
|
27
|
+
className: m.left,
|
|
28
|
+
children: [e && /* @__PURE__ */ l("div", {
|
|
29
|
+
className: m.logo,
|
|
29
30
|
children: e
|
|
30
31
|
}), t]
|
|
31
|
-
}), /* @__PURE__ */
|
|
32
|
-
className:
|
|
32
|
+
}), /* @__PURE__ */ l("div", {
|
|
33
|
+
className: m.right,
|
|
33
34
|
children: n
|
|
34
35
|
})]
|
|
35
36
|
})
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
secondary: "_secondary_159ms_55",
|
|
43
|
-
outline: "_outline_159ms_69",
|
|
44
|
-
ghost: "_ghost_159ms_80",
|
|
45
|
-
danger: "_danger_159ms_89",
|
|
46
|
-
fullWidth: "_fullWidth_159ms_100",
|
|
47
|
-
loading: "_loading_159ms_105",
|
|
48
|
-
loadingSpinner: "_loadingSpinner_159ms_110",
|
|
49
|
-
spinner: "_spinner_159ms_116",
|
|
50
|
-
spin: "_spin_159ms_116",
|
|
51
|
-
loadingText: "_loadingText_159ms_131"
|
|
52
|
-
}, m = ({ children: e, variant: t = "primary", size: n = "md", fullWidth: r = !1, loading: i = !1, disabled: a = !1, className: o = "", ...l }) => /* @__PURE__ */ s("button", {
|
|
53
|
-
className: `${p.button} ${p[t]} ${p[n]} ${r ? p.fullWidth : ""} ${i ? p.loading : ""} ${o}`,
|
|
54
|
-
disabled: a || i,
|
|
55
|
-
...l,
|
|
56
|
-
children: i ? /* @__PURE__ */ c("span", {
|
|
57
|
-
className: p.loadingSpinner,
|
|
58
|
-
children: [/* @__PURE__ */ s("span", { className: p.spinner }), /* @__PURE__ */ s("span", {
|
|
59
|
-
className: p.loadingText,
|
|
60
|
-
children: e
|
|
61
|
-
})]
|
|
62
|
-
}) : e
|
|
63
|
-
}), h = {
|
|
64
|
-
selectWrapper: "_selectWrapper_ir4bq_1",
|
|
65
|
-
fullWidth: "_fullWidth_ir4bq_7",
|
|
66
|
-
label: "_label_ir4bq_11",
|
|
67
|
-
required: "_required_ir4bq_20",
|
|
68
|
-
selectContainer: "_selectContainer_ir4bq_24",
|
|
69
|
-
select: "_select_ir4bq_1",
|
|
70
|
-
error: "_error_ir4bq_63",
|
|
71
|
-
arrow: "_arrow_ir4bq_71",
|
|
72
|
-
errorText: "_errorText_ir4bq_81",
|
|
73
|
-
helperText: "_helperText_ir4bq_86"
|
|
74
|
-
}, g = e.forwardRef(({ label: e, error: t, helperText: n, options: r, placeholder: i, fullWidth: a = !1, className: o = "", id: l, ...u }, d) => {
|
|
75
|
-
let f = l || `select-${Math.random().toString(36).substr(2, 9)}`, p = !!t;
|
|
76
|
-
return /* @__PURE__ */ c("div", {
|
|
77
|
-
className: `${h.selectWrapper} ${a ? h.fullWidth : ""} ${o}`,
|
|
78
|
-
children: [
|
|
79
|
-
e && /* @__PURE__ */ c("label", {
|
|
80
|
-
htmlFor: f,
|
|
81
|
-
className: h.label,
|
|
82
|
-
children: [e, u.required && /* @__PURE__ */ s("span", {
|
|
83
|
-
className: h.required,
|
|
84
|
-
children: "*"
|
|
85
|
-
})]
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ c("div", {
|
|
88
|
-
className: h.selectContainer,
|
|
89
|
-
children: [/* @__PURE__ */ c("select", {
|
|
90
|
-
ref: d,
|
|
91
|
-
id: f,
|
|
92
|
-
className: `${h.select} ${p ? h.error : ""}`,
|
|
93
|
-
...u,
|
|
94
|
-
children: [
|
|
95
|
-
i && /* @__PURE__ */ s("option", {
|
|
96
|
-
value: "",
|
|
97
|
-
disabled: !0,
|
|
98
|
-
children: i
|
|
99
|
-
}),
|
|
100
|
-
r && r.map((e) => /* @__PURE__ */ s("option", {
|
|
101
|
-
value: e.value,
|
|
102
|
-
disabled: e.disabled,
|
|
103
|
-
children: e.label
|
|
104
|
-
}, e.value)),
|
|
105
|
-
!r && u.children
|
|
106
|
-
]
|
|
107
|
-
}), /* @__PURE__ */ s("span", {
|
|
108
|
-
className: h.arrow,
|
|
109
|
-
children: "▼"
|
|
110
|
-
})]
|
|
111
|
-
}),
|
|
112
|
-
t && /* @__PURE__ */ s("span", {
|
|
113
|
-
className: h.errorText,
|
|
114
|
-
children: t
|
|
115
|
-
}),
|
|
116
|
-
n && !t && /* @__PURE__ */ s("span", {
|
|
117
|
-
className: h.helperText,
|
|
118
|
-
children: n
|
|
119
|
-
})
|
|
120
|
-
]
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
g.displayName = "Select";
|
|
124
|
-
var _ = {
|
|
125
|
-
inputWrapper: "_inputWrapper_15t4g_1",
|
|
126
|
-
fullWidth: "_fullWidth_15t4g_7",
|
|
127
|
-
label: "_label_15t4g_11",
|
|
128
|
-
required: "_required_15t4g_20",
|
|
129
|
-
input: "_input_15t4g_1",
|
|
130
|
-
error: "_error_15t4g_55",
|
|
131
|
-
errorText: "_errorText_15t4g_63",
|
|
132
|
-
helperText: "_helperText_15t4g_68"
|
|
133
|
-
}, v = e.forwardRef(({ label: e, error: t, helperText: n, fullWidth: r = !1, className: i = "", id: a, ...o }, l) => {
|
|
134
|
-
let u = a || `input-${Math.random().toString(36).substr(2, 9)}`, d = !!t;
|
|
135
|
-
return /* @__PURE__ */ c("div", {
|
|
136
|
-
className: `${_.inputWrapper} ${r ? _.fullWidth : ""} ${i}`,
|
|
137
|
-
children: [
|
|
138
|
-
e && /* @__PURE__ */ c("label", {
|
|
139
|
-
htmlFor: u,
|
|
140
|
-
className: _.label,
|
|
141
|
-
children: [e, o.required && /* @__PURE__ */ s("span", {
|
|
142
|
-
className: _.required,
|
|
143
|
-
children: "*"
|
|
144
|
-
})]
|
|
145
|
-
}),
|
|
146
|
-
/* @__PURE__ */ s("input", {
|
|
147
|
-
ref: l,
|
|
148
|
-
id: u,
|
|
149
|
-
className: `${_.input} ${d ? _.error : ""}`,
|
|
150
|
-
...o
|
|
151
|
-
}),
|
|
152
|
-
t && /* @__PURE__ */ s("span", {
|
|
153
|
-
className: _.errorText,
|
|
154
|
-
children: t
|
|
155
|
-
}),
|
|
156
|
-
n && !t && /* @__PURE__ */ s("span", {
|
|
157
|
-
className: _.helperText,
|
|
158
|
-
children: n
|
|
159
|
-
})
|
|
160
|
-
]
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
v.displayName = "Input";
|
|
164
|
-
//#endregion
|
|
165
|
-
//#region src/services/auth.ts
|
|
166
|
-
var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => localStorage.getItem(y), S = (e) => {
|
|
167
|
-
localStorage.setItem(y, e);
|
|
37
|
+
}), g = "astrogators_access_token", _ = "astrogators_refresh_token", v = () => localStorage.getItem(g), y = (e) => {
|
|
38
|
+
localStorage.setItem(g, e);
|
|
39
|
+
}, b = () => {
|
|
40
|
+
localStorage.removeItem(g);
|
|
41
|
+
}, x = () => localStorage.getItem(_), S = (e) => {
|
|
42
|
+
localStorage.setItem(_, e);
|
|
168
43
|
}, C = () => {
|
|
169
|
-
localStorage.removeItem(
|
|
170
|
-
}, w = (
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
}, D = (e
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
}, ee = () => !!x(), te = "", k, A = null, j = (e) => {
|
|
179
|
-
te = e.baseURL, k = e.onUnauthorized;
|
|
180
|
-
}, M = () => A || (A = (async () => {
|
|
181
|
-
let e = w();
|
|
44
|
+
localStorage.removeItem(_);
|
|
45
|
+
}, w = (e, t) => {
|
|
46
|
+
y(e), S(t);
|
|
47
|
+
}, T = () => {
|
|
48
|
+
b(), C();
|
|
49
|
+
}, E = () => !!v(), D = "", O, k = null, A = (e) => {
|
|
50
|
+
D = e.baseURL, O = e.onUnauthorized;
|
|
51
|
+
}, j = () => k || (k = (async () => {
|
|
52
|
+
let e = x();
|
|
182
53
|
if (!e) throw Error("No refresh token available");
|
|
183
|
-
let t = await fetch(`${
|
|
54
|
+
let t = await fetch(`${D}/api/v1/auth/refresh`, {
|
|
184
55
|
method: "POST",
|
|
185
56
|
headers: { "Content-Type": "application/json" },
|
|
186
57
|
body: JSON.stringify({ refresh_token: e })
|
|
187
58
|
});
|
|
188
|
-
if (!t.ok) throw
|
|
59
|
+
if (!t.ok) throw T(), O?.(), Error("Token refresh failed");
|
|
189
60
|
let n = await t.json();
|
|
190
|
-
return
|
|
61
|
+
return w(n.access_token, n.refresh_token), n.access_token;
|
|
191
62
|
})().finally(() => {
|
|
192
|
-
|
|
193
|
-
}),
|
|
63
|
+
k = null;
|
|
64
|
+
}), k), ee = 30, M = [700, 1500], N = new Set([
|
|
194
65
|
502,
|
|
195
66
|
503,
|
|
196
67
|
504
|
|
197
|
-
]),
|
|
68
|
+
]), P = (e) => {
|
|
198
69
|
let t = (e ?? "GET").toUpperCase();
|
|
199
70
|
return t === "GET" || t === "HEAD" || t === "OPTIONS";
|
|
200
|
-
},
|
|
201
|
-
let n =
|
|
202
|
-
for (let a = 0; a <=
|
|
203
|
-
a > 0 && await
|
|
204
|
-
let o = a <
|
|
71
|
+
}, F = (e) => e == null || typeof e == "string", te = (e) => new Promise((t) => setTimeout(t, e)), I = async (e, t) => {
|
|
72
|
+
let n = P(t.method) && F(t.body), r = F(t.body), i;
|
|
73
|
+
for (let a = 0; a <= M.length; a++) {
|
|
74
|
+
a > 0 && await te(M[a - 1]);
|
|
75
|
+
let o = a < M.length;
|
|
205
76
|
try {
|
|
206
77
|
let r = await fetch(e, t);
|
|
207
|
-
if (o && n &&
|
|
78
|
+
if (o && n && N.has(r.status)) continue;
|
|
208
79
|
return r;
|
|
209
80
|
} catch (e) {
|
|
210
81
|
if (i = e, o && r) continue;
|
|
@@ -212,39 +83,39 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
212
83
|
}
|
|
213
84
|
}
|
|
214
85
|
throw i ?? /* @__PURE__ */ Error("fetchWithRetry: retries exhausted");
|
|
215
|
-
},
|
|
86
|
+
}, ne = (e) => {
|
|
216
87
|
try {
|
|
217
88
|
let t = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), { exp: n } = JSON.parse(atob(t));
|
|
218
|
-
return typeof n == "number" && Date.now() / 1e3 >= n -
|
|
89
|
+
return typeof n == "number" && Date.now() / 1e3 >= n - ee;
|
|
219
90
|
} catch {
|
|
220
91
|
return !1;
|
|
221
92
|
}
|
|
222
|
-
},
|
|
223
|
-
let n =
|
|
224
|
-
if (n &&
|
|
225
|
-
n = await
|
|
93
|
+
}, re = async (e, t = {}) => {
|
|
94
|
+
let n = v();
|
|
95
|
+
if (n && ne(n)) try {
|
|
96
|
+
n = await j();
|
|
226
97
|
} catch {
|
|
227
|
-
n =
|
|
98
|
+
n = v();
|
|
228
99
|
}
|
|
229
100
|
let r = { ...t.headers };
|
|
230
101
|
n && (r.Authorization = `Bearer ${n}`);
|
|
231
|
-
let i = await
|
|
102
|
+
let i = await I(e, {
|
|
232
103
|
...t,
|
|
233
104
|
headers: r
|
|
234
105
|
});
|
|
235
106
|
if (i.status !== 401 || !n) return i;
|
|
236
107
|
try {
|
|
237
|
-
return r.Authorization = `Bearer ${await
|
|
108
|
+
return r.Authorization = `Bearer ${await j()}`, await I(e, {
|
|
238
109
|
...t,
|
|
239
110
|
headers: r
|
|
240
111
|
});
|
|
241
112
|
} catch {
|
|
242
113
|
return i;
|
|
243
114
|
}
|
|
244
|
-
},
|
|
115
|
+
}, ie = class {
|
|
245
116
|
baseURL;
|
|
246
117
|
constructor(e) {
|
|
247
|
-
this.baseURL = e.baseURL,
|
|
118
|
+
this.baseURL = e.baseURL, A({
|
|
248
119
|
baseURL: e.baseURL,
|
|
249
120
|
onUnauthorized: e.onUnauthorized
|
|
250
121
|
});
|
|
@@ -253,7 +124,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
253
124
|
let n = {
|
|
254
125
|
"Content-Type": "application/json",
|
|
255
126
|
...t.headers
|
|
256
|
-
}, r = await
|
|
127
|
+
}, r = await re(`${this.baseURL}${e}`, {
|
|
257
128
|
...t,
|
|
258
129
|
headers: n
|
|
259
130
|
});
|
|
@@ -303,33 +174,33 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
303
174
|
method: "DELETE"
|
|
304
175
|
});
|
|
305
176
|
}
|
|
306
|
-
}, L,
|
|
307
|
-
L = new
|
|
308
|
-
}, R = "astrogators_ally_codes",
|
|
177
|
+
}, L, ae = (e) => {
|
|
178
|
+
L = new ie(e);
|
|
179
|
+
}, R = "astrogators_ally_codes", oe = "astrogators_selected_ally_code", z = () => {
|
|
309
180
|
try {
|
|
310
181
|
let e = localStorage.getItem(R);
|
|
311
182
|
return e ? JSON.parse(e) : [];
|
|
312
183
|
} catch (e) {
|
|
313
184
|
return console.error("Failed to read ally codes from localStorage:", e), [];
|
|
314
185
|
}
|
|
315
|
-
},
|
|
186
|
+
}, se = (e) => {
|
|
316
187
|
try {
|
|
317
|
-
let t =
|
|
188
|
+
let t = z();
|
|
318
189
|
if (t.some((t) => t.ally_code === e.ally_code)) return;
|
|
319
190
|
t.push(e), localStorage.setItem(R, JSON.stringify(t));
|
|
320
191
|
} catch (e) {
|
|
321
192
|
console.error("Failed to save ally code to localStorage:", e);
|
|
322
193
|
}
|
|
323
|
-
},
|
|
194
|
+
}, ce = (e) => {
|
|
324
195
|
try {
|
|
325
|
-
let t =
|
|
196
|
+
let t = z().filter((t) => t.ally_code !== e);
|
|
326
197
|
localStorage.setItem(R, JSON.stringify(t));
|
|
327
198
|
} catch (e) {
|
|
328
199
|
console.error("Failed to remove ally code from localStorage:", e);
|
|
329
200
|
}
|
|
330
|
-
},
|
|
201
|
+
}, le = (e) => {
|
|
331
202
|
try {
|
|
332
|
-
let t =
|
|
203
|
+
let t = z().map((t) => t.ally_code === e ? {
|
|
333
204
|
...t,
|
|
334
205
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
335
206
|
} : t);
|
|
@@ -337,16 +208,16 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
337
208
|
} catch (e) {
|
|
338
209
|
console.error("Failed to update ally code last used:", e);
|
|
339
210
|
}
|
|
340
|
-
},
|
|
341
|
-
e ? localStorage.setItem(
|
|
342
|
-
},
|
|
343
|
-
localStorage.removeItem(R), localStorage.removeItem(
|
|
344
|
-
},
|
|
345
|
-
let [
|
|
211
|
+
}, ue = () => localStorage.getItem(oe), B = (e) => {
|
|
212
|
+
e ? localStorage.setItem(oe, e) : localStorage.removeItem(oe);
|
|
213
|
+
}, de = () => {
|
|
214
|
+
localStorage.removeItem(R), localStorage.removeItem(oe);
|
|
215
|
+
}, fe = t(void 0), pe = ({ children: e, apiBaseUrl: t }) => {
|
|
216
|
+
let [n, i] = s(null), [o, c] = s(!0), [u, d] = s(!0), [f, p] = s(!0), [m, h] = s([]), [g, _] = s(null), [v, y] = s(!1), [b, x] = s({
|
|
346
217
|
show: !1,
|
|
347
218
|
localStorageCodes: []
|
|
348
219
|
});
|
|
349
|
-
|
|
220
|
+
ae({ baseURL: t }), a(() => {
|
|
350
221
|
(async () => {
|
|
351
222
|
try {
|
|
352
223
|
d((await L.get("/api/v1/config/features")).auth_enabled);
|
|
@@ -357,381 +228,870 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
357
228
|
}
|
|
358
229
|
})();
|
|
359
230
|
}, [t]);
|
|
360
|
-
let S =
|
|
361
|
-
if (!
|
|
362
|
-
|
|
231
|
+
let S = r(async () => {
|
|
232
|
+
if (!E()) {
|
|
233
|
+
i(null), c(!1);
|
|
363
234
|
return;
|
|
364
235
|
}
|
|
365
236
|
try {
|
|
366
|
-
|
|
237
|
+
i(await L.get("/api/v1/users/me"));
|
|
367
238
|
} catch (e) {
|
|
368
|
-
console.error("Failed to fetch user:", e),
|
|
239
|
+
console.error("Failed to fetch user:", e), i(null), T();
|
|
369
240
|
} finally {
|
|
370
|
-
|
|
241
|
+
c(!1);
|
|
371
242
|
}
|
|
372
243
|
}, []);
|
|
373
|
-
|
|
244
|
+
a(() => {
|
|
374
245
|
S();
|
|
375
246
|
}, [S]);
|
|
376
247
|
let C = async (e) => {
|
|
377
248
|
try {
|
|
378
249
|
let t = await L.post("/api/v1/auth/login", e);
|
|
379
|
-
|
|
250
|
+
w(t.access_token, t.refresh_token), i(await L.get("/api/v1/users/me"));
|
|
380
251
|
} catch (e) {
|
|
381
252
|
throw console.error("Login failed:", e), e;
|
|
382
253
|
}
|
|
383
|
-
},
|
|
254
|
+
}, D = async (e) => {
|
|
384
255
|
try {
|
|
385
256
|
await L.post("/api/v1/auth/register", e);
|
|
386
257
|
} catch (e) {
|
|
387
258
|
throw console.error("Registration failed:", e), e;
|
|
388
259
|
}
|
|
389
|
-
},
|
|
390
|
-
|
|
260
|
+
}, O = () => {
|
|
261
|
+
T(), i(null), h([]), _(null), B(null), x({
|
|
391
262
|
show: !1,
|
|
392
263
|
localStorageCodes: []
|
|
393
264
|
});
|
|
394
|
-
},
|
|
265
|
+
}, k = async () => {
|
|
395
266
|
await S();
|
|
396
|
-
},
|
|
267
|
+
}, A = async (e) => {
|
|
397
268
|
try {
|
|
398
269
|
return (await L.post("/api/v1/auth/forgot-password", e)).message;
|
|
399
270
|
} catch (e) {
|
|
400
271
|
throw console.error("Forgot password failed:", e), e;
|
|
401
272
|
}
|
|
402
|
-
},
|
|
273
|
+
}, j = async (e) => {
|
|
403
274
|
try {
|
|
404
275
|
return (await L.post("/api/v1/auth/reset-password", e)).message;
|
|
405
276
|
} catch (e) {
|
|
406
277
|
throw console.error("Reset password failed:", e), e;
|
|
407
278
|
}
|
|
408
|
-
},
|
|
279
|
+
}, ee = async (e) => {
|
|
409
280
|
try {
|
|
410
281
|
return (await L.post("/api/v1/auth/resend-verification", e)).message;
|
|
411
282
|
} catch (e) {
|
|
412
283
|
throw console.error("Resend verification failed:", e), e;
|
|
413
284
|
}
|
|
414
|
-
},
|
|
285
|
+
}, M = r(async () => {
|
|
415
286
|
y(!0);
|
|
416
287
|
try {
|
|
417
288
|
let e = [];
|
|
418
|
-
if (
|
|
289
|
+
if (n) {
|
|
419
290
|
let t = await L.get("/api/v1/users/me/ally-codes");
|
|
420
291
|
h(t.ally_codes), e = t.ally_codes.map((e) => e.ally_code);
|
|
421
|
-
let n =
|
|
292
|
+
let n = z();
|
|
422
293
|
n.length > 0 && x({
|
|
423
294
|
show: !0,
|
|
424
295
|
localStorageCodes: n.map((e) => e.ally_code)
|
|
425
296
|
});
|
|
426
297
|
} else {
|
|
427
|
-
let t =
|
|
298
|
+
let t = z();
|
|
428
299
|
h(t), e = t.map((e) => e.ally_code);
|
|
429
300
|
}
|
|
430
|
-
let t =
|
|
431
|
-
_(
|
|
301
|
+
let t = ue(), r = t && e.includes(t) ? t : null;
|
|
302
|
+
_(r), r !== t && B(r);
|
|
432
303
|
} catch (e) {
|
|
433
304
|
console.error("Failed to fetch ally codes:", e), h([]);
|
|
434
305
|
} finally {
|
|
435
306
|
y(!1);
|
|
436
307
|
}
|
|
437
|
-
}, [
|
|
438
|
-
|
|
439
|
-
}, [
|
|
440
|
-
if (_(e),
|
|
308
|
+
}, [n]), N = r(async (e) => {
|
|
309
|
+
n && typeof e == "number" ? (await L.put(`/api/v1/users/me/ally-codes/${e}/use`, {}), await M()) : !n && typeof e == "string" && (le(e), h(z()));
|
|
310
|
+
}, [n, M]), P = r((e) => {
|
|
311
|
+
if (_(e), B(e), e && n) {
|
|
441
312
|
let t = m.find((t) => "ally_code" in t && t.ally_code === e);
|
|
442
|
-
t && "id" in t &&
|
|
443
|
-
} else e && !
|
|
313
|
+
t && "id" in t && N(t.id);
|
|
314
|
+
} else e && !n && le(e);
|
|
444
315
|
}, [
|
|
445
|
-
|
|
316
|
+
n,
|
|
446
317
|
m,
|
|
447
|
-
|
|
448
|
-
]),
|
|
318
|
+
N
|
|
319
|
+
]), F = r(async (e) => {
|
|
449
320
|
if (!/^\d{9}$/.test(e)) throw Error("Ally code must be exactly 9 digits");
|
|
450
|
-
if (
|
|
321
|
+
if (n) {
|
|
451
322
|
let t = await L.post("/api/v1/users/me/ally-codes", { ally_code: e });
|
|
452
|
-
h((e) => [t, ...e]), m.length === 0 &&
|
|
323
|
+
h((e) => [t, ...e]), m.length === 0 && P(e);
|
|
453
324
|
} else {
|
|
454
325
|
let t = await L.get(`/api/v1/player-data/player/${e}`);
|
|
455
326
|
if (!t) throw Error("Invalid ally code - player not found");
|
|
456
|
-
|
|
327
|
+
se({
|
|
457
328
|
ally_code: e,
|
|
458
329
|
player_name: t.data?.name ?? null,
|
|
459
330
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
460
|
-
}), h(
|
|
331
|
+
}), h(z()), m.length === 0 && P(e);
|
|
461
332
|
}
|
|
462
333
|
}, [
|
|
463
|
-
|
|
334
|
+
n,
|
|
464
335
|
m.length,
|
|
465
|
-
|
|
466
|
-
]),
|
|
467
|
-
|
|
336
|
+
P
|
|
337
|
+
]), te = r(async (e) => {
|
|
338
|
+
n && typeof e == "number" ? (await L.delete(`/api/v1/users/me/ally-codes/${e}`), h((t) => t.filter((t) => "id" in t && t.id !== e))) : !n && typeof e == "string" && (ce(e), h(z()), g === e && P(null));
|
|
468
339
|
}, [
|
|
469
|
-
|
|
340
|
+
n,
|
|
470
341
|
g,
|
|
471
|
-
|
|
472
|
-
]),
|
|
342
|
+
P
|
|
343
|
+
]), I = r(() => {
|
|
473
344
|
x({
|
|
474
345
|
show: !1,
|
|
475
346
|
localStorageCodes: []
|
|
476
347
|
});
|
|
477
|
-
}, []),
|
|
478
|
-
if (!
|
|
479
|
-
let e =
|
|
348
|
+
}, []), ne = r(async () => {
|
|
349
|
+
if (!n) return;
|
|
350
|
+
let e = z();
|
|
480
351
|
for (let t of e) try {
|
|
481
|
-
await
|
|
352
|
+
await F(t.ally_code);
|
|
482
353
|
} catch (e) {
|
|
483
354
|
console.error(`Failed to migrate ally code ${t.ally_code}:`, e);
|
|
484
355
|
}
|
|
485
|
-
|
|
356
|
+
de(), I();
|
|
486
357
|
}, [
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
358
|
+
n,
|
|
359
|
+
F,
|
|
360
|
+
I
|
|
490
361
|
]);
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}, [
|
|
362
|
+
a(() => {
|
|
363
|
+
M();
|
|
364
|
+
}, [M]);
|
|
494
365
|
let re = {
|
|
495
|
-
user:
|
|
496
|
-
isAuthenticated: !!
|
|
497
|
-
isLoading:
|
|
366
|
+
user: n,
|
|
367
|
+
isAuthenticated: !!n,
|
|
368
|
+
isLoading: o,
|
|
498
369
|
login: C,
|
|
499
|
-
register:
|
|
500
|
-
logout:
|
|
501
|
-
refreshUser:
|
|
502
|
-
forgotPassword:
|
|
503
|
-
resetPassword:
|
|
504
|
-
resendVerification:
|
|
370
|
+
register: D,
|
|
371
|
+
logout: O,
|
|
372
|
+
refreshUser: k,
|
|
373
|
+
forgotPassword: A,
|
|
374
|
+
resetPassword: j,
|
|
375
|
+
resendVerification: ee,
|
|
505
376
|
authEnabled: u,
|
|
506
377
|
isLoadingFeatures: f,
|
|
507
378
|
allyCodes: m,
|
|
508
379
|
selectedAllyCode: g,
|
|
509
380
|
isLoadingAllyCodes: v,
|
|
510
|
-
fetchAllyCodes:
|
|
511
|
-
addAllyCode:
|
|
512
|
-
removeAllyCode:
|
|
513
|
-
selectAllyCode:
|
|
514
|
-
updateAllyCodeLastUsed:
|
|
381
|
+
fetchAllyCodes: M,
|
|
382
|
+
addAllyCode: F,
|
|
383
|
+
removeAllyCode: te,
|
|
384
|
+
selectAllyCode: P,
|
|
385
|
+
updateAllyCodeLastUsed: N,
|
|
515
386
|
migrationPrompt: b,
|
|
516
|
-
dismissMigrationPrompt:
|
|
517
|
-
migrateLocalStorageCodes:
|
|
387
|
+
dismissMigrationPrompt: I,
|
|
388
|
+
migrateLocalStorageCodes: ne
|
|
518
389
|
};
|
|
519
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ l(fe.Provider, {
|
|
520
391
|
value: re,
|
|
521
392
|
children: e
|
|
522
393
|
});
|
|
523
|
-
},
|
|
524
|
-
let e =
|
|
394
|
+
}, V = () => {
|
|
395
|
+
let e = i(fe);
|
|
525
396
|
if (e === void 0) throw Error("useAuth must be used within an AuthProvider");
|
|
526
397
|
return e;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
398
|
+
};
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/hooks/useDismissableMenu.ts
|
|
401
|
+
function me({ isOpen: e, onClose: t, triggerRef: n, panelRef: r }) {
|
|
402
|
+
a(() => {
|
|
403
|
+
if (!e) return;
|
|
404
|
+
let i = (e) => {
|
|
405
|
+
let i = e.target;
|
|
406
|
+
n.current?.contains(i) || r.current?.contains(i) || t();
|
|
407
|
+
}, a = (e) => {
|
|
408
|
+
e.key === "Escape" && (t(), n.current?.focus());
|
|
409
|
+
};
|
|
410
|
+
return document.addEventListener("mousedown", i), document.addEventListener("keydown", a), () => {
|
|
411
|
+
document.removeEventListener("mousedown", i), document.removeEventListener("keydown", a);
|
|
412
|
+
};
|
|
413
|
+
}, [
|
|
414
|
+
e,
|
|
415
|
+
t,
|
|
416
|
+
n,
|
|
417
|
+
r
|
|
418
|
+
]);
|
|
419
|
+
}
|
|
420
|
+
var H = {
|
|
421
|
+
navMenu: "_navMenu_b9xlf_1",
|
|
422
|
+
trigger: "_trigger_b9xlf_8",
|
|
423
|
+
tabActive: "_tabActive_b9xlf_29",
|
|
424
|
+
chevron: "_chevron_b9xlf_34",
|
|
425
|
+
panel: "_panel_b9xlf_43",
|
|
426
|
+
sectionLink: "_sectionLink_b9xlf_57",
|
|
427
|
+
sectionActive: "_sectionActive_b9xlf_71",
|
|
428
|
+
comingSoon: "_comingSoon_b9xlf_76"
|
|
429
|
+
}, he = ({ app: e, isCurrentApp: t, activeSectionId: n, isOpen: r, onOpenChange: i, onSectionClick: a }) => {
|
|
430
|
+
let { isAuthenticated: s, user: c } = V(), d = o(null), f = o(null), p = `navmenu-panel-${e.id}`;
|
|
431
|
+
me({
|
|
432
|
+
isOpen: r,
|
|
433
|
+
onClose: () => i(!1),
|
|
434
|
+
triggerRef: d,
|
|
435
|
+
panelRef: f
|
|
436
|
+
});
|
|
437
|
+
let m = e.sections.filter((e) => !(e.requiresAuth && !s || e.roles && (!c || !e.roles.includes(c.role)))), h = (e) => (n) => {
|
|
438
|
+
t && a?.(e, n), i(!1);
|
|
439
|
+
};
|
|
440
|
+
return /* @__PURE__ */ u("div", {
|
|
441
|
+
className: H.navMenu,
|
|
442
|
+
children: [/* @__PURE__ */ u("button", {
|
|
443
|
+
type: "button",
|
|
444
|
+
ref: d,
|
|
445
|
+
className: `${H.trigger} ${t ? H.tabActive : ""}`,
|
|
446
|
+
"aria-expanded": r,
|
|
447
|
+
"aria-controls": p,
|
|
448
|
+
"aria-haspopup": "true",
|
|
449
|
+
onClick: () => i(!r),
|
|
450
|
+
children: [e.label, /* @__PURE__ */ l("svg", {
|
|
451
|
+
className: H.chevron,
|
|
452
|
+
width: "10",
|
|
453
|
+
height: "6",
|
|
454
|
+
viewBox: "0 0 10 6",
|
|
455
|
+
"aria-hidden": "true",
|
|
456
|
+
children: /* @__PURE__ */ l("path", {
|
|
457
|
+
d: "M1 1l4 4 4-4",
|
|
458
|
+
stroke: "currentColor",
|
|
459
|
+
strokeWidth: "1.5",
|
|
460
|
+
fill: "none",
|
|
461
|
+
strokeLinecap: "round",
|
|
462
|
+
strokeLinejoin: "round"
|
|
463
|
+
})
|
|
464
|
+
})]
|
|
465
|
+
}), r && /* @__PURE__ */ l("div", {
|
|
466
|
+
id: p,
|
|
467
|
+
ref: f,
|
|
468
|
+
className: H.panel,
|
|
469
|
+
children: e.status === "coming-soon" ? /* @__PURE__ */ l("div", {
|
|
470
|
+
className: H.comingSoon,
|
|
471
|
+
children: "Coming soon"
|
|
472
|
+
}) : /* @__PURE__ */ l("nav", {
|
|
473
|
+
"aria-label": `${e.label} sections`,
|
|
474
|
+
onKeyDown: (e) => {
|
|
475
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
476
|
+
let t = Array.from(e.currentTarget.querySelectorAll("a")), n = t.indexOf(document.activeElement);
|
|
477
|
+
n !== -1 && (e.preventDefault(), t[e.key === "ArrowDown" ? (n + 1) % t.length : (n - 1 + t.length) % t.length]?.focus());
|
|
478
|
+
},
|
|
479
|
+
children: m.map((e) => {
|
|
480
|
+
let r = t && n === e.id;
|
|
481
|
+
return /* @__PURE__ */ l("a", {
|
|
482
|
+
href: e.href,
|
|
483
|
+
className: `${H.sectionLink} ${r ? H.sectionActive : ""}`,
|
|
484
|
+
"aria-current": r ? "page" : void 0,
|
|
485
|
+
onClick: h(e),
|
|
486
|
+
children: e.label
|
|
487
|
+
}, e.id);
|
|
488
|
+
})
|
|
489
|
+
})
|
|
490
|
+
})]
|
|
491
|
+
});
|
|
492
|
+
}, ge = { burger: "_burger_javjr_1" }, _e = n(({ isOpen: e, onClick: t, controlsId: n }, r) => /* @__PURE__ */ l("button", {
|
|
493
|
+
ref: r,
|
|
494
|
+
type: "button",
|
|
495
|
+
className: ge.burger,
|
|
496
|
+
onClick: t,
|
|
497
|
+
"aria-expanded": e,
|
|
498
|
+
"aria-controls": n,
|
|
499
|
+
"aria-label": e ? "Close navigation menu" : "Open navigation menu",
|
|
500
|
+
children: e ? /* @__PURE__ */ l("svg", {
|
|
501
|
+
width: "20",
|
|
502
|
+
height: "20",
|
|
503
|
+
viewBox: "0 0 20 20",
|
|
504
|
+
"aria-hidden": "true",
|
|
505
|
+
children: /* @__PURE__ */ l("path", {
|
|
506
|
+
d: "M4 4l12 12M16 4L4 16",
|
|
507
|
+
stroke: "currentColor",
|
|
508
|
+
strokeWidth: "2",
|
|
509
|
+
strokeLinecap: "round"
|
|
510
|
+
})
|
|
511
|
+
}) : /* @__PURE__ */ l("svg", {
|
|
512
|
+
width: "20",
|
|
513
|
+
height: "20",
|
|
514
|
+
viewBox: "0 0 20 20",
|
|
515
|
+
"aria-hidden": "true",
|
|
516
|
+
children: /* @__PURE__ */ l("path", {
|
|
517
|
+
d: "M2 5h16M2 10h16M2 15h16",
|
|
518
|
+
stroke: "currentColor",
|
|
519
|
+
strokeWidth: "2",
|
|
520
|
+
strokeLinecap: "round"
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
}));
|
|
524
|
+
_e.displayName = "NavBurger";
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/navigation/suiteNav.ts
|
|
527
|
+
var ve = [
|
|
528
|
+
{
|
|
529
|
+
id: "mod-ledger",
|
|
530
|
+
label: "Mod Ledger",
|
|
531
|
+
href: "/mod-ledger/",
|
|
532
|
+
status: "available",
|
|
533
|
+
sections: [
|
|
534
|
+
{
|
|
535
|
+
id: "grid",
|
|
536
|
+
label: "Inventory",
|
|
537
|
+
href: "/mod-ledger/"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
id: "my-evaluations",
|
|
541
|
+
label: "My Evaluations",
|
|
542
|
+
href: "/mod-ledger/evaluations"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
id: "official",
|
|
546
|
+
label: "Official",
|
|
547
|
+
href: "/mod-ledger/evaluations#official"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
id: "moderation",
|
|
551
|
+
label: "Moderation",
|
|
552
|
+
href: "/mod-ledger/moderation",
|
|
553
|
+
roles: ["admin", "mod"]
|
|
554
|
+
}
|
|
555
|
+
]
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
id: "navicharts",
|
|
559
|
+
label: "Navicharts",
|
|
560
|
+
href: "/navicharts/",
|
|
561
|
+
status: "available",
|
|
562
|
+
sections: [
|
|
563
|
+
{
|
|
564
|
+
id: "mine",
|
|
565
|
+
label: "Mine",
|
|
566
|
+
href: "/navicharts/"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
id: "official",
|
|
570
|
+
label: "Official",
|
|
571
|
+
href: "/navicharts/#official"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
id: "guild",
|
|
575
|
+
label: "Guild",
|
|
576
|
+
href: "/navicharts/#guild"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: "bookmarked",
|
|
580
|
+
label: "Bookmarked",
|
|
581
|
+
href: "/navicharts/#bookmarked"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
id: "moderation",
|
|
585
|
+
label: "All Shared",
|
|
586
|
+
href: "/navicharts/#moderation",
|
|
587
|
+
roles: ["admin", "mod"]
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: "nightwatcher",
|
|
593
|
+
label: "Nightwatcher",
|
|
594
|
+
href: "/nightwatcher/",
|
|
595
|
+
status: "available",
|
|
596
|
+
sections: [{
|
|
597
|
+
id: "overview",
|
|
598
|
+
label: "Overview",
|
|
599
|
+
href: "/nightwatcher/"
|
|
600
|
+
}]
|
|
601
|
+
}
|
|
602
|
+
], U = {
|
|
603
|
+
selectWrapper: "_selectWrapper_ir4bq_1",
|
|
604
|
+
fullWidth: "_fullWidth_ir4bq_7",
|
|
605
|
+
label: "_label_ir4bq_11",
|
|
606
|
+
required: "_required_ir4bq_20",
|
|
607
|
+
selectContainer: "_selectContainer_ir4bq_24",
|
|
608
|
+
select: "_select_ir4bq_1",
|
|
609
|
+
error: "_error_ir4bq_63",
|
|
610
|
+
arrow: "_arrow_ir4bq_71",
|
|
611
|
+
errorText: "_errorText_ir4bq_81",
|
|
612
|
+
helperText: "_helperText_ir4bq_86"
|
|
613
|
+
}, ye = e.forwardRef(({ label: e, error: t, helperText: n, options: r, placeholder: i, fullWidth: a = !1, className: o = "", id: s, ...c }, d) => {
|
|
614
|
+
let f = s || `select-${Math.random().toString(36).substr(2, 9)}`, p = !!t;
|
|
615
|
+
return /* @__PURE__ */ u("div", {
|
|
616
|
+
className: `${U.selectWrapper} ${a ? U.fullWidth : ""} ${o}`,
|
|
617
|
+
children: [
|
|
618
|
+
e && /* @__PURE__ */ u("label", {
|
|
619
|
+
htmlFor: f,
|
|
620
|
+
className: U.label,
|
|
621
|
+
children: [e, c.required && /* @__PURE__ */ l("span", {
|
|
622
|
+
className: U.required,
|
|
623
|
+
children: "*"
|
|
624
|
+
})]
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ u("div", {
|
|
627
|
+
className: U.selectContainer,
|
|
628
|
+
children: [/* @__PURE__ */ u("select", {
|
|
629
|
+
ref: d,
|
|
630
|
+
id: f,
|
|
631
|
+
className: `${U.select} ${p ? U.error : ""}`,
|
|
632
|
+
...c,
|
|
633
|
+
children: [
|
|
634
|
+
i && /* @__PURE__ */ l("option", {
|
|
635
|
+
value: "",
|
|
636
|
+
disabled: !0,
|
|
637
|
+
children: i
|
|
638
|
+
}),
|
|
639
|
+
r && r.map((e) => /* @__PURE__ */ l("option", {
|
|
640
|
+
value: e.value,
|
|
641
|
+
disabled: e.disabled,
|
|
642
|
+
children: e.label
|
|
643
|
+
}, e.value)),
|
|
644
|
+
!r && c.children
|
|
645
|
+
]
|
|
646
|
+
}), /* @__PURE__ */ l("span", {
|
|
647
|
+
className: U.arrow,
|
|
648
|
+
children: "▼"
|
|
649
|
+
})]
|
|
650
|
+
}),
|
|
651
|
+
t && /* @__PURE__ */ l("span", {
|
|
652
|
+
className: U.errorText,
|
|
653
|
+
children: t
|
|
654
|
+
}),
|
|
655
|
+
n && !t && /* @__PURE__ */ l("span", {
|
|
656
|
+
className: U.helperText,
|
|
657
|
+
children: n
|
|
658
|
+
})
|
|
659
|
+
]
|
|
660
|
+
});
|
|
661
|
+
});
|
|
662
|
+
ye.displayName = "Select";
|
|
663
|
+
var W = {
|
|
664
|
+
button: "_button_159ms_1",
|
|
665
|
+
sm: "_sm_159ms_22",
|
|
666
|
+
md: "_md_159ms_28",
|
|
667
|
+
lg: "_lg_159ms_34",
|
|
668
|
+
primary: "_primary_159ms_41",
|
|
669
|
+
secondary: "_secondary_159ms_55",
|
|
670
|
+
outline: "_outline_159ms_69",
|
|
671
|
+
ghost: "_ghost_159ms_80",
|
|
672
|
+
danger: "_danger_159ms_89",
|
|
673
|
+
fullWidth: "_fullWidth_159ms_100",
|
|
674
|
+
loading: "_loading_159ms_105",
|
|
675
|
+
loadingSpinner: "_loadingSpinner_159ms_110",
|
|
676
|
+
spinner: "_spinner_159ms_116",
|
|
677
|
+
spin: "_spin_159ms_116",
|
|
678
|
+
loadingText: "_loadingText_159ms_131"
|
|
679
|
+
}, G = ({ children: e, variant: t = "primary", size: n = "md", fullWidth: r = !1, loading: i = !1, disabled: a = !1, className: o = "", ...s }) => /* @__PURE__ */ l("button", {
|
|
680
|
+
className: `${W.button} ${W[t]} ${W[n]} ${r ? W.fullWidth : ""} ${i ? W.loading : ""} ${o}`,
|
|
681
|
+
disabled: a || i,
|
|
682
|
+
...s,
|
|
683
|
+
children: i ? /* @__PURE__ */ u("span", {
|
|
684
|
+
className: W.loadingSpinner,
|
|
685
|
+
children: [/* @__PURE__ */ l("span", { className: W.spinner }), /* @__PURE__ */ l("span", {
|
|
686
|
+
className: W.loadingText,
|
|
687
|
+
children: e
|
|
688
|
+
})]
|
|
689
|
+
}) : e
|
|
690
|
+
}), K = {
|
|
691
|
+
inputWrapper: "_inputWrapper_15t4g_1",
|
|
692
|
+
fullWidth: "_fullWidth_15t4g_7",
|
|
693
|
+
label: "_label_15t4g_11",
|
|
694
|
+
required: "_required_15t4g_20",
|
|
695
|
+
input: "_input_15t4g_1",
|
|
696
|
+
error: "_error_15t4g_55",
|
|
697
|
+
errorText: "_errorText_15t4g_63",
|
|
698
|
+
helperText: "_helperText_15t4g_68"
|
|
699
|
+
}, be = e.forwardRef(({ label: e, error: t, helperText: n, fullWidth: r = !1, className: i = "", id: a, ...o }, s) => {
|
|
700
|
+
let c = a || `input-${Math.random().toString(36).substr(2, 9)}`, d = !!t;
|
|
701
|
+
return /* @__PURE__ */ u("div", {
|
|
702
|
+
className: `${K.inputWrapper} ${r ? K.fullWidth : ""} ${i}`,
|
|
703
|
+
children: [
|
|
704
|
+
e && /* @__PURE__ */ u("label", {
|
|
705
|
+
htmlFor: c,
|
|
706
|
+
className: K.label,
|
|
707
|
+
children: [e, o.required && /* @__PURE__ */ l("span", {
|
|
708
|
+
className: K.required,
|
|
709
|
+
children: "*"
|
|
710
|
+
})]
|
|
711
|
+
}),
|
|
712
|
+
/* @__PURE__ */ l("input", {
|
|
713
|
+
ref: s,
|
|
714
|
+
id: c,
|
|
715
|
+
className: `${K.input} ${d ? K.error : ""}`,
|
|
716
|
+
...o
|
|
717
|
+
}),
|
|
718
|
+
t && /* @__PURE__ */ l("span", {
|
|
719
|
+
className: K.errorText,
|
|
720
|
+
children: t
|
|
721
|
+
}),
|
|
722
|
+
n && !t && /* @__PURE__ */ l("span", {
|
|
723
|
+
className: K.helperText,
|
|
724
|
+
children: n
|
|
725
|
+
})
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
be.displayName = "Input";
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region src/utils/formatAllyCode.ts
|
|
732
|
+
var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, xe = (e) => e.replace(/-/g, ""), J = {
|
|
733
|
+
allyCodeDropdown: "_allyCodeDropdown_1pawi_1",
|
|
734
|
+
select: "_select_1pawi_8",
|
|
735
|
+
manageButton: "_manageButton_1pawi_12",
|
|
736
|
+
managePanel: "_managePanel_1pawi_16",
|
|
737
|
+
addSection: "_addSection_1pawi_37",
|
|
738
|
+
addInputGroup: "_addInputGroup_1pawi_43",
|
|
739
|
+
error: "_error_1pawi_55",
|
|
740
|
+
success: "_success_1pawi_61",
|
|
741
|
+
codesList: "_codesList_1pawi_67",
|
|
742
|
+
codeItem: "_codeItem_1pawi_71",
|
|
743
|
+
doneButton: "_doneButton_1pawi_88",
|
|
744
|
+
inline: "_inline_1pawi_107"
|
|
745
|
+
}, Se = ({ onAllyCodeSelected: e, className: t = "", isOpen: n, onOpenChange: r, variant: i = "floating" }) => {
|
|
746
|
+
let { allyCodes: a, selectedAllyCode: c, selectAllyCode: d, removeAllyCode: f, addAllyCode: p, isLoadingAllyCodes: m } = V(), [h, g] = s(!1), _ = n ?? h, v = (e) => {
|
|
747
|
+
g(e), r?.(e);
|
|
748
|
+
}, [y, b] = s(""), [x, S] = s(""), [C, w] = s(""), [T, E] = s(!1), D = o(null), O = o(null);
|
|
749
|
+
me({
|
|
750
|
+
isOpen: _ && i === "floating",
|
|
751
|
+
onClose: () => v(!1),
|
|
752
|
+
triggerRef: D,
|
|
753
|
+
panelRef: O
|
|
754
|
+
});
|
|
755
|
+
let k = a.map((e) => ({
|
|
541
756
|
value: e.ally_code,
|
|
542
|
-
label: e.player_name ? `${e.player_name} (${
|
|
543
|
-
})),
|
|
757
|
+
label: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code)
|
|
758
|
+
})), A = (t) => {
|
|
544
759
|
let n = t.target.value || null;
|
|
545
|
-
|
|
546
|
-
},
|
|
547
|
-
let t =
|
|
548
|
-
t && await
|
|
549
|
-
},
|
|
550
|
-
if (
|
|
551
|
-
|
|
760
|
+
d(n), e?.(n);
|
|
761
|
+
}, j = async (e) => {
|
|
762
|
+
let t = a.find((t) => t.ally_code === e);
|
|
763
|
+
t && await f("id" in t ? t.id : t.ally_code);
|
|
764
|
+
}, ee = async () => {
|
|
765
|
+
if (S(""), w(""), !/^\d{9}$/.test(y)) {
|
|
766
|
+
S("Ally code must be exactly 9 digits");
|
|
552
767
|
return;
|
|
553
768
|
}
|
|
554
|
-
|
|
769
|
+
E(!0);
|
|
555
770
|
try {
|
|
556
|
-
await
|
|
771
|
+
await p(y), w("Added successfully!"), b(""), setTimeout(() => w(""), 2e3);
|
|
557
772
|
} catch (e) {
|
|
558
|
-
|
|
773
|
+
S(e.message || "Failed to add ally code");
|
|
559
774
|
} finally {
|
|
560
|
-
|
|
775
|
+
E(!1);
|
|
561
776
|
}
|
|
562
|
-
},
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
className: `${
|
|
777
|
+
}, M = a.length > 0;
|
|
778
|
+
return /* @__PURE__ */ u("div", {
|
|
779
|
+
className: `${J.allyCodeDropdown} ${i === "inline" ? J.inline : ""} ${t}`,
|
|
565
780
|
children: [
|
|
566
|
-
|
|
567
|
-
options:
|
|
568
|
-
value:
|
|
569
|
-
onChange:
|
|
781
|
+
M && /* @__PURE__ */ l(ye, {
|
|
782
|
+
options: k,
|
|
783
|
+
value: c || "",
|
|
784
|
+
onChange: A,
|
|
570
785
|
placeholder: "Select ally code",
|
|
571
|
-
disabled:
|
|
572
|
-
className:
|
|
786
|
+
disabled: m,
|
|
787
|
+
className: J.select
|
|
573
788
|
}),
|
|
574
|
-
|
|
575
|
-
className:
|
|
789
|
+
_ && /* @__PURE__ */ u("div", {
|
|
790
|
+
className: J.managePanel,
|
|
791
|
+
ref: O,
|
|
792
|
+
id: "ally-code-manage-panel",
|
|
576
793
|
children: [
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
className:
|
|
794
|
+
/* @__PURE__ */ l("h4", { children: "Manage Ally Codes" }),
|
|
795
|
+
/* @__PURE__ */ u("div", {
|
|
796
|
+
className: J.addSection,
|
|
580
797
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
className:
|
|
583
|
-
children: [/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ u("div", {
|
|
799
|
+
className: J.addInputGroup,
|
|
800
|
+
children: [/* @__PURE__ */ l(be, {
|
|
584
801
|
type: "text",
|
|
585
802
|
placeholder: "9-digit ally code",
|
|
586
|
-
value:
|
|
587
|
-
onChange: (e) =>
|
|
588
|
-
disabled:
|
|
589
|
-
}), /* @__PURE__ */
|
|
803
|
+
value: y,
|
|
804
|
+
onChange: (e) => b(e.target.value.replace(/\D/g, "").slice(0, 9)),
|
|
805
|
+
disabled: T
|
|
806
|
+
}), /* @__PURE__ */ l(G, {
|
|
590
807
|
variant: "primary",
|
|
591
808
|
size: "sm",
|
|
592
|
-
onClick:
|
|
593
|
-
loading:
|
|
594
|
-
disabled:
|
|
809
|
+
onClick: ee,
|
|
810
|
+
loading: T,
|
|
811
|
+
disabled: y.length !== 9,
|
|
595
812
|
children: "Add"
|
|
596
813
|
})]
|
|
597
814
|
}),
|
|
598
|
-
|
|
599
|
-
className:
|
|
600
|
-
children:
|
|
815
|
+
x && /* @__PURE__ */ l("div", {
|
|
816
|
+
className: J.error,
|
|
817
|
+
children: x
|
|
601
818
|
}),
|
|
602
|
-
|
|
603
|
-
className:
|
|
604
|
-
children:
|
|
819
|
+
C && /* @__PURE__ */ l("div", {
|
|
820
|
+
className: J.success,
|
|
821
|
+
children: C
|
|
605
822
|
})
|
|
606
823
|
]
|
|
607
824
|
}),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
className:
|
|
610
|
-
children:
|
|
611
|
-
className:
|
|
612
|
-
children: [/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ l("div", {
|
|
826
|
+
className: J.codesList,
|
|
827
|
+
children: a.map((e) => /* @__PURE__ */ u("div", {
|
|
828
|
+
className: J.codeItem,
|
|
829
|
+
children: [/* @__PURE__ */ l("span", { children: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code) }), /* @__PURE__ */ l(G, {
|
|
613
830
|
variant: "ghost",
|
|
614
831
|
size: "sm",
|
|
615
|
-
onClick: () =>
|
|
832
|
+
onClick: () => j(e.ally_code),
|
|
616
833
|
children: "Remove"
|
|
617
834
|
})]
|
|
618
835
|
}, e.ally_code))
|
|
619
836
|
}),
|
|
620
|
-
/* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ l(G, {
|
|
621
838
|
variant: "secondary",
|
|
622
839
|
size: "sm",
|
|
623
|
-
onClick: () =>
|
|
624
|
-
className:
|
|
840
|
+
onClick: () => v(!1),
|
|
841
|
+
className: J.doneButton,
|
|
625
842
|
children: "Done"
|
|
626
843
|
})
|
|
627
844
|
]
|
|
628
845
|
}),
|
|
629
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ l("span", {
|
|
847
|
+
ref: D,
|
|
848
|
+
children: /* @__PURE__ */ l(G, {
|
|
849
|
+
variant: "ghost",
|
|
850
|
+
size: "sm",
|
|
851
|
+
onClick: () => v(!_),
|
|
852
|
+
className: J.manageButton,
|
|
853
|
+
"aria-expanded": _,
|
|
854
|
+
"aria-controls": "ally-code-manage-panel",
|
|
855
|
+
"aria-haspopup": "true",
|
|
856
|
+
children: M ? "Manage" : "+ Add ally code"
|
|
857
|
+
})
|
|
858
|
+
})
|
|
859
|
+
]
|
|
860
|
+
});
|
|
861
|
+
}, Ce = {
|
|
862
|
+
authCluster: "_authCluster_17o10_1",
|
|
863
|
+
userLink: "_userLink_17o10_7",
|
|
864
|
+
adminLink: "_adminLink_17o10_16"
|
|
865
|
+
}, we = ({ showAuth: e = !0 }) => {
|
|
866
|
+
let { user: t, isAuthenticated: n, logout: r, authEnabled: i } = V();
|
|
867
|
+
return e ? n ? /* @__PURE__ */ u("div", {
|
|
868
|
+
className: Ce.authCluster,
|
|
869
|
+
children: [
|
|
870
|
+
t?.role === "admin" && /* @__PURE__ */ l("a", {
|
|
871
|
+
href: "/admin/users",
|
|
872
|
+
className: Ce.adminLink,
|
|
873
|
+
children: "Admin"
|
|
874
|
+
}),
|
|
875
|
+
/* @__PURE__ */ l("a", {
|
|
876
|
+
href: "/profile",
|
|
877
|
+
className: Ce.userLink,
|
|
878
|
+
children: t?.username
|
|
879
|
+
}),
|
|
880
|
+
/* @__PURE__ */ l(G, {
|
|
630
881
|
variant: "ghost",
|
|
631
882
|
size: "sm",
|
|
632
|
-
onClick: () =>
|
|
633
|
-
|
|
634
|
-
|
|
883
|
+
onClick: () => {
|
|
884
|
+
r(), window.location.href = "/";
|
|
885
|
+
},
|
|
886
|
+
children: "Logout"
|
|
635
887
|
})
|
|
636
888
|
]
|
|
637
|
-
})
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
appNav: "_appNav_84pn2_9",
|
|
641
|
-
appName: "_appName_84pn2_15",
|
|
642
|
-
tabs: "_tabs_84pn2_29",
|
|
643
|
-
tab: "_tab_84pn2_29",
|
|
644
|
-
tabActive: "_tabActive_84pn2_56",
|
|
645
|
-
extrasGroup: "_extrasGroup_84pn2_64",
|
|
646
|
-
authCluster: "_authCluster_84pn2_70",
|
|
647
|
-
userLink: "_userLink_84pn2_76"
|
|
648
|
-
}, _e = ({ hubUrl: t = "/", appName: n, appHref: r = "/", navItems: i, showAllyCode: a = !1, showAuth: l = !0, rightExtras: u, className: d }) => {
|
|
649
|
-
let { user: p, isAuthenticated: h, logout: g, authEnabled: _ } = U(), v = () => {
|
|
650
|
-
g(), window.location.href = t;
|
|
651
|
-
}, y = !!u || a, b = !!(i && i.length > 0), x = !!n || b, S = l ? h ? /* @__PURE__ */ c("div", {
|
|
652
|
-
className: K.authCluster,
|
|
653
|
-
children: [/* @__PURE__ */ s("a", {
|
|
654
|
-
href: "/profile",
|
|
655
|
-
className: K.userLink,
|
|
656
|
-
children: p?.username
|
|
657
|
-
}), /* @__PURE__ */ s(m, {
|
|
658
|
-
variant: "ghost",
|
|
659
|
-
size: "sm",
|
|
660
|
-
onClick: v,
|
|
661
|
-
children: "Logout"
|
|
662
|
-
})]
|
|
663
|
-
}) : _ ? /* @__PURE__ */ c("div", {
|
|
664
|
-
className: K.authCluster,
|
|
665
|
-
children: [/* @__PURE__ */ s("a", {
|
|
889
|
+
}) : i ? /* @__PURE__ */ u("div", {
|
|
890
|
+
className: Ce.authCluster,
|
|
891
|
+
children: [/* @__PURE__ */ l("a", {
|
|
666
892
|
href: "/login",
|
|
667
|
-
children: /* @__PURE__ */
|
|
893
|
+
children: /* @__PURE__ */ l(G, {
|
|
668
894
|
variant: "ghost",
|
|
669
895
|
size: "sm",
|
|
670
896
|
children: "Login"
|
|
671
897
|
})
|
|
672
|
-
}), /* @__PURE__ */
|
|
898
|
+
}), /* @__PURE__ */ l("a", {
|
|
673
899
|
href: "/register",
|
|
674
|
-
children: /* @__PURE__ */
|
|
900
|
+
children: /* @__PURE__ */ l(G, {
|
|
675
901
|
variant: "primary",
|
|
676
902
|
size: "sm",
|
|
677
903
|
children: "Sign Up"
|
|
678
904
|
})
|
|
679
905
|
})]
|
|
680
906
|
}) : null : null;
|
|
681
|
-
|
|
907
|
+
}, Y = {
|
|
908
|
+
backdrop: "_backdrop_1n4uh_1",
|
|
909
|
+
panel: "_panel_1n4uh_11",
|
|
910
|
+
accordion: "_accordion_1n4uh_24",
|
|
911
|
+
accordionItem: "_accordionItem_1n4uh_29",
|
|
912
|
+
accordionHeader: "_accordionHeader_1n4uh_33",
|
|
913
|
+
currentApp: "_currentApp_1n4uh_48",
|
|
914
|
+
chevron: "_chevron_1n4uh_53",
|
|
915
|
+
chevronOpen: "_chevronOpen_1n4uh_58",
|
|
916
|
+
accordionPanel: "_accordionPanel_1n4uh_62",
|
|
917
|
+
sectionLink: "_sectionLink_1n4uh_68",
|
|
918
|
+
sectionActive: "_sectionActive_1n4uh_79",
|
|
919
|
+
comingSoon: "_comingSoon_1n4uh_85",
|
|
920
|
+
allySection: "_allySection_1n4uh_91",
|
|
921
|
+
extrasSection: "_extrasSection_1n4uh_92",
|
|
922
|
+
accountSection: "_accountSection_1n4uh_93"
|
|
923
|
+
}, Te = ({ isOpen: e, onClose: t, currentApp: n, activeSectionId: r, onSectionClick: i, rightExtras: c, showAuth: f, panelId: p, returnFocusRef: m }) => {
|
|
924
|
+
let { isAuthenticated: h, user: g } = V(), [_, v] = s(n === "hub" ? null : n), y = o(null);
|
|
925
|
+
if (a(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
926
|
+
document.body.style.overflow = "unset";
|
|
927
|
+
}), [e]), a(() => {
|
|
928
|
+
if (!e) return;
|
|
929
|
+
let r = (e) => {
|
|
930
|
+
e.key === "Escape" && (t(), m.current?.focus());
|
|
931
|
+
};
|
|
932
|
+
return document.addEventListener("keydown", r), v(n === "hub" ? null : n), y.current?.focus(), () => document.removeEventListener("keydown", r);
|
|
933
|
+
}, [e]), !e) return null;
|
|
934
|
+
let b = (e, r) => (a) => {
|
|
935
|
+
e === n && i?.(r, a), t();
|
|
936
|
+
};
|
|
937
|
+
return d(/* @__PURE__ */ l("div", {
|
|
938
|
+
className: Y.backdrop,
|
|
939
|
+
onClick: t,
|
|
940
|
+
children: /* @__PURE__ */ u("div", {
|
|
941
|
+
ref: y,
|
|
942
|
+
id: p,
|
|
943
|
+
role: "dialog",
|
|
944
|
+
"aria-modal": "true",
|
|
945
|
+
"aria-label": "Navigation menu",
|
|
946
|
+
tabIndex: -1,
|
|
947
|
+
className: Y.panel,
|
|
948
|
+
onClick: (e) => e.stopPropagation(),
|
|
949
|
+
children: [
|
|
950
|
+
/* @__PURE__ */ l("div", {
|
|
951
|
+
className: Y.accordion,
|
|
952
|
+
children: ve.map((e) => {
|
|
953
|
+
let t = _ === e.id, i = n === e.id, a = e.sections.filter((e) => !(e.requiresAuth && !h || e.roles && (!g || !e.roles.includes(g.role)))), o = `mobile-accordion-${e.id}`;
|
|
954
|
+
return /* @__PURE__ */ u("div", {
|
|
955
|
+
className: Y.accordionItem,
|
|
956
|
+
children: [/* @__PURE__ */ u("button", {
|
|
957
|
+
type: "button",
|
|
958
|
+
className: `${Y.accordionHeader} ${i ? Y.currentApp : ""}`,
|
|
959
|
+
"aria-expanded": t,
|
|
960
|
+
"aria-controls": o,
|
|
961
|
+
onClick: () => v(t ? null : e.id),
|
|
962
|
+
children: [e.label, /* @__PURE__ */ l("svg", {
|
|
963
|
+
className: `${Y.chevron} ${t ? Y.chevronOpen : ""}`,
|
|
964
|
+
width: "10",
|
|
965
|
+
height: "6",
|
|
966
|
+
viewBox: "0 0 10 6",
|
|
967
|
+
"aria-hidden": "true",
|
|
968
|
+
children: /* @__PURE__ */ l("path", {
|
|
969
|
+
d: "M1 1l4 4 4-4",
|
|
970
|
+
stroke: "currentColor",
|
|
971
|
+
strokeWidth: "1.5",
|
|
972
|
+
fill: "none",
|
|
973
|
+
strokeLinecap: "round",
|
|
974
|
+
strokeLinejoin: "round"
|
|
975
|
+
})
|
|
976
|
+
})]
|
|
977
|
+
}), t && /* @__PURE__ */ l("div", {
|
|
978
|
+
id: o,
|
|
979
|
+
className: Y.accordionPanel,
|
|
980
|
+
children: e.status === "coming-soon" ? /* @__PURE__ */ l("div", {
|
|
981
|
+
className: Y.comingSoon,
|
|
982
|
+
children: "Coming soon"
|
|
983
|
+
}) : a.map((t) => {
|
|
984
|
+
let n = i && r === t.id;
|
|
985
|
+
return /* @__PURE__ */ l("a", {
|
|
986
|
+
href: t.href,
|
|
987
|
+
className: `${Y.sectionLink} ${n ? Y.sectionActive : ""}`,
|
|
988
|
+
"aria-current": n ? "page" : void 0,
|
|
989
|
+
onClick: b(e.id, t),
|
|
990
|
+
children: t.label
|
|
991
|
+
}, t.id);
|
|
992
|
+
})
|
|
993
|
+
})]
|
|
994
|
+
}, e.id);
|
|
995
|
+
})
|
|
996
|
+
}),
|
|
997
|
+
/* @__PURE__ */ l("div", {
|
|
998
|
+
className: Y.allySection,
|
|
999
|
+
children: /* @__PURE__ */ l(Se, { variant: "inline" })
|
|
1000
|
+
}),
|
|
1001
|
+
c && /* @__PURE__ */ l("div", {
|
|
1002
|
+
className: Y.extrasSection,
|
|
1003
|
+
children: c
|
|
1004
|
+
}),
|
|
1005
|
+
/* @__PURE__ */ l("div", {
|
|
1006
|
+
className: Y.accountSection,
|
|
1007
|
+
children: /* @__PURE__ */ l(we, { showAuth: f })
|
|
1008
|
+
})
|
|
1009
|
+
]
|
|
1010
|
+
})
|
|
1011
|
+
}), document.body);
|
|
1012
|
+
}, Ee = {
|
|
1013
|
+
logoLink: "_logoLink_12f5f_3",
|
|
1014
|
+
appMenus: "_appMenus_12f5f_10",
|
|
1015
|
+
desktopRight: "_desktopRight_12f5f_19",
|
|
1016
|
+
extrasGroup: "_extrasGroup_12f5f_25"
|
|
1017
|
+
}, De = ({ currentApp: e, activeSectionId: t, onNavigate: n, rightExtras: r, showAuth: i = !0, className: d }) => {
|
|
1018
|
+
let [f, p] = s(null), [m, g] = s(!1), _ = o(null), v = "suite-mobile-nav-panel";
|
|
1019
|
+
return a(() => {
|
|
1020
|
+
let e = window.matchMedia("(max-width: 768px)"), t = () => {
|
|
1021
|
+
p(null), g(!1);
|
|
1022
|
+
};
|
|
1023
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
1024
|
+
}, []), /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(h, {
|
|
682
1025
|
className: d,
|
|
683
|
-
logo: /* @__PURE__ */
|
|
684
|
-
href:
|
|
685
|
-
className:
|
|
1026
|
+
logo: /* @__PURE__ */ l("a", {
|
|
1027
|
+
href: "/",
|
|
1028
|
+
className: Ee.logoLink,
|
|
686
1029
|
children: "The Astrogator's Table"
|
|
687
1030
|
}),
|
|
688
|
-
leftContent:
|
|
689
|
-
className:
|
|
690
|
-
children:
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}),
|
|
713
|
-
|
|
714
|
-
|
|
1031
|
+
leftContent: /* @__PURE__ */ l("nav", {
|
|
1032
|
+
className: Ee.appMenus,
|
|
1033
|
+
children: ve.map((r) => /* @__PURE__ */ l(he, {
|
|
1034
|
+
app: r,
|
|
1035
|
+
isCurrentApp: e === r.id,
|
|
1036
|
+
activeSectionId: t,
|
|
1037
|
+
isOpen: f === r.id,
|
|
1038
|
+
onOpenChange: (e) => p(e ? r.id : null),
|
|
1039
|
+
onSectionClick: n
|
|
1040
|
+
}, r.id))
|
|
1041
|
+
}),
|
|
1042
|
+
rightContent: /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
|
|
1043
|
+
className: Ee.desktopRight,
|
|
1044
|
+
children: [
|
|
1045
|
+
r && /* @__PURE__ */ l("div", {
|
|
1046
|
+
className: Ee.extrasGroup,
|
|
1047
|
+
children: r
|
|
1048
|
+
}),
|
|
1049
|
+
/* @__PURE__ */ l(Se, {
|
|
1050
|
+
isOpen: f === "ally",
|
|
1051
|
+
onOpenChange: (e) => p(e ? "ally" : null)
|
|
1052
|
+
}),
|
|
1053
|
+
/* @__PURE__ */ l(we, { showAuth: i })
|
|
1054
|
+
]
|
|
1055
|
+
}), /* @__PURE__ */ l(_e, {
|
|
1056
|
+
ref: _,
|
|
1057
|
+
isOpen: m,
|
|
1058
|
+
onClick: () => {
|
|
1059
|
+
p(null), g((e) => !e);
|
|
1060
|
+
},
|
|
1061
|
+
controlsId: v
|
|
1062
|
+
})] })
|
|
1063
|
+
}), /* @__PURE__ */ l(Te, {
|
|
1064
|
+
isOpen: m,
|
|
1065
|
+
onClose: () => g(!1),
|
|
1066
|
+
currentApp: e,
|
|
1067
|
+
activeSectionId: t,
|
|
1068
|
+
onSectionClick: n,
|
|
1069
|
+
rightExtras: r,
|
|
1070
|
+
showAuth: i,
|
|
1071
|
+
panelId: v,
|
|
1072
|
+
returnFocusRef: _
|
|
1073
|
+
})] });
|
|
1074
|
+
}, X = {
|
|
715
1075
|
footer: "_footer_zjuj8_1",
|
|
716
1076
|
content: "_content_zjuj8_7",
|
|
717
1077
|
defaultContent: "_defaultContent_zjuj8_13",
|
|
718
1078
|
copyright: "_copyright_zjuj8_21",
|
|
719
1079
|
disclaimer: "_disclaimer_zjuj8_26"
|
|
720
|
-
},
|
|
721
|
-
className: `${
|
|
722
|
-
children: /* @__PURE__ */
|
|
723
|
-
className:
|
|
724
|
-
children: e || /* @__PURE__ */
|
|
725
|
-
className:
|
|
726
|
-
children: [/* @__PURE__ */
|
|
727
|
-
className:
|
|
1080
|
+
}, Oe = ({ children: e, className: t = "" }) => /* @__PURE__ */ l("footer", {
|
|
1081
|
+
className: `${X.footer} ${t}`,
|
|
1082
|
+
children: /* @__PURE__ */ l("div", {
|
|
1083
|
+
className: X.content,
|
|
1084
|
+
children: e || /* @__PURE__ */ u("div", {
|
|
1085
|
+
className: X.defaultContent,
|
|
1086
|
+
children: [/* @__PURE__ */ u("p", {
|
|
1087
|
+
className: X.copyright,
|
|
728
1088
|
children: [
|
|
729
1089
|
"© ",
|
|
730
1090
|
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
731
1091
|
" The Astrogator's Table. All rights reserved."
|
|
732
1092
|
]
|
|
733
|
-
}), /* @__PURE__ */
|
|
734
|
-
className:
|
|
1093
|
+
}), /* @__PURE__ */ l("p", {
|
|
1094
|
+
className: X.disclaimer,
|
|
735
1095
|
children: "Star Wars: Galaxy of Heroes is a trademark of Electronic Arts Inc."
|
|
736
1096
|
})]
|
|
737
1097
|
})
|
|
@@ -739,11 +1099,11 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
739
1099
|
});
|
|
740
1100
|
//#endregion
|
|
741
1101
|
//#region src/utils/formatTime.ts
|
|
742
|
-
function
|
|
1102
|
+
function ke(e) {
|
|
743
1103
|
let t = /([zZ]|[+-]\d{2}:?\d{2})$/.test(e);
|
|
744
1104
|
return new Date(t ? e : `${e}Z`);
|
|
745
1105
|
}
|
|
746
|
-
function
|
|
1106
|
+
function Ae(e, t) {
|
|
747
1107
|
let n = Math.max(0, Math.floor((t - e.getTime()) / 1e3));
|
|
748
1108
|
if (n < 60) return `${n}s ago`;
|
|
749
1109
|
let r = Math.floor(n / 60);
|
|
@@ -751,43 +1111,43 @@ function be(e, t) {
|
|
|
751
1111
|
let i = Math.floor(r / 60);
|
|
752
1112
|
return i < 24 ? `${i}h ago` : `${Math.floor(i / 24)}d ago`;
|
|
753
1113
|
}
|
|
754
|
-
function
|
|
1114
|
+
function je(e) {
|
|
755
1115
|
return `${Math.floor(e / 60)}:${(e % 60).toString().padStart(2, "0")}`;
|
|
756
1116
|
}
|
|
757
|
-
var
|
|
1117
|
+
var Me = {
|
|
758
1118
|
rosterRefresh: "_rosterRefresh_1rbul_3",
|
|
759
1119
|
updatedLabel: "_updatedLabel_1rbul_11",
|
|
760
1120
|
refreshButton: "_refreshButton_1rbul_19",
|
|
761
1121
|
spin: "_spin_1rbul_31"
|
|
762
|
-
},
|
|
763
|
-
let [
|
|
764
|
-
|
|
1122
|
+
}, Ne = ({ onRefresh: e, isRefreshing: t, cachedAt: n = null, refreshAvailableAt: r = null, labelPrefix: i = "Updated", className: o = "" }) => {
|
|
1123
|
+
let [c, d] = s(() => Date.now()), f = !!n || r != null && r > c;
|
|
1124
|
+
a(() => {
|
|
765
1125
|
if (!f) return;
|
|
766
1126
|
let e = setInterval(() => d(Date.now()), 1e3);
|
|
767
1127
|
return () => clearInterval(e);
|
|
768
1128
|
}, [f]);
|
|
769
|
-
let p = r ? Math.max(0, Math.ceil((r -
|
|
770
|
-
return /* @__PURE__ */
|
|
771
|
-
className: `${
|
|
772
|
-
children: [
|
|
773
|
-
className:
|
|
774
|
-
title:
|
|
775
|
-
children: p > 0 ? `${
|
|
776
|
-
}), /* @__PURE__ */
|
|
1129
|
+
let p = r ? Math.max(0, Math.ceil((r - c) / 1e3)) : 0, m = n ? Ae(ke(n), c) : null, h = t || p > 0, g = p > 0 ? `Fresh data available in ${je(p)}` : "Refresh roster";
|
|
1130
|
+
return /* @__PURE__ */ u("div", {
|
|
1131
|
+
className: `${Me.rosterRefresh} ${o}`,
|
|
1132
|
+
children: [m && /* @__PURE__ */ l("span", {
|
|
1133
|
+
className: Me.updatedLabel,
|
|
1134
|
+
title: g,
|
|
1135
|
+
children: p > 0 ? `${i} ${m} · fresh in ${je(p)}` : `${i} ${m}`
|
|
1136
|
+
}), /* @__PURE__ */ l(G, {
|
|
777
1137
|
variant: "outline",
|
|
778
1138
|
size: "sm",
|
|
779
1139
|
onClick: e,
|
|
780
|
-
disabled:
|
|
781
|
-
title:
|
|
1140
|
+
disabled: h,
|
|
1141
|
+
title: g,
|
|
782
1142
|
"aria-label": "Refresh roster",
|
|
783
|
-
className:
|
|
784
|
-
children: /* @__PURE__ */
|
|
785
|
-
className: t ?
|
|
1143
|
+
className: Me.refreshButton,
|
|
1144
|
+
children: /* @__PURE__ */ l("span", {
|
|
1145
|
+
className: t ? Me.spin : void 0,
|
|
786
1146
|
children: "⟳"
|
|
787
1147
|
})
|
|
788
1148
|
})]
|
|
789
1149
|
});
|
|
790
|
-
},
|
|
1150
|
+
}, Z = {
|
|
791
1151
|
card: "_card_1vw8g_1",
|
|
792
1152
|
chamfered: "_chamfered_1vw8g_15",
|
|
793
1153
|
default: "_default_1vw8g_20",
|
|
@@ -798,37 +1158,37 @@ var Y = {
|
|
|
798
1158
|
"padding-md": "_padding-md_1vw8g_43",
|
|
799
1159
|
"padding-lg": "_padding-lg_1vw8g_47",
|
|
800
1160
|
hoverable: "_hoverable_1vw8g_52"
|
|
801
|
-
},
|
|
802
|
-
let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h =
|
|
1161
|
+
}, Pe = ({ children: e, variant: t = "default", chamfered: n = !1, chamferSize: r = "md", padding: i = "md", hoverable: a = !1, showDiagonalBorders: o = !0, edgeColor: s, className: d = "", onClick: f, style: p }) => {
|
|
1162
|
+
let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h = s ?? (n ? "var(--color-border)" : void 0), g = h ? { color: h } : void 0, _ = h ? {
|
|
803
1163
|
...p,
|
|
804
1164
|
"--card-edge-color": h
|
|
805
1165
|
} : p;
|
|
806
|
-
return /* @__PURE__ */
|
|
807
|
-
className: `${
|
|
1166
|
+
return /* @__PURE__ */ u("div", {
|
|
1167
|
+
className: `${Z.card} ${n ? Z.chamfered : ""} ${Z[t]} ${Z[`padding-${i}`]} ${m} ${a ? Z.hoverable : ""} ${d}`,
|
|
808
1168
|
onClick: f,
|
|
809
1169
|
role: f ? "button" : void 0,
|
|
810
1170
|
tabIndex: f ? 0 : void 0,
|
|
811
1171
|
style: _,
|
|
812
|
-
children: [n &&
|
|
813
|
-
/* @__PURE__ */
|
|
1172
|
+
children: [n && o && /* @__PURE__ */ u(c, { children: [
|
|
1173
|
+
/* @__PURE__ */ l("div", {
|
|
814
1174
|
className: "chamfered-diagonal-border chamfered-diagonal-tl",
|
|
815
1175
|
style: g
|
|
816
1176
|
}),
|
|
817
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ l("div", {
|
|
818
1178
|
className: "chamfered-diagonal-border chamfered-diagonal-tr",
|
|
819
1179
|
style: g
|
|
820
1180
|
}),
|
|
821
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ l("div", {
|
|
822
1182
|
className: "chamfered-diagonal-border chamfered-diagonal-bl",
|
|
823
1183
|
style: g
|
|
824
1184
|
}),
|
|
825
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ l("div", {
|
|
826
1186
|
className: "chamfered-diagonal-border chamfered-diagonal-br",
|
|
827
1187
|
style: g
|
|
828
1188
|
})
|
|
829
1189
|
] }), e]
|
|
830
1190
|
});
|
|
831
|
-
},
|
|
1191
|
+
}, Fe = {
|
|
832
1192
|
badge: "_badge_rk7t5_1",
|
|
833
1193
|
sm: "_sm_rk7t5_11",
|
|
834
1194
|
md: "_md_rk7t5_16",
|
|
@@ -840,8 +1200,8 @@ var Y = {
|
|
|
840
1200
|
warning: "_warning_rk7t5_47",
|
|
841
1201
|
error: "_error_rk7t5_52",
|
|
842
1202
|
info: "_info_rk7t5_57"
|
|
843
|
-
},
|
|
844
|
-
className: `${
|
|
1203
|
+
}, Ie = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ l("span", {
|
|
1204
|
+
className: `${Fe.badge} ${Fe[t]} ${Fe[n]} ${r}`,
|
|
845
1205
|
children: e
|
|
846
1206
|
}), Q = {
|
|
847
1207
|
overlay: "_overlay_1b3yt_1",
|
|
@@ -856,34 +1216,34 @@ var Y = {
|
|
|
856
1216
|
title: "_title_1b3yt_53",
|
|
857
1217
|
closeButton: "_closeButton_1b3yt_60",
|
|
858
1218
|
content: "_content_1b3yt_78"
|
|
859
|
-
},
|
|
1219
|
+
}, Le = ({ isOpen: e, onClose: t, title: n, children: r, size: i = "md", closeOnOverlayClick: o = !0, className: s = "" }) => (a(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
860
1220
|
document.body.style.overflow = "unset";
|
|
861
|
-
}), [e]),
|
|
1221
|
+
}), [e]), a(() => {
|
|
862
1222
|
let n = (n) => {
|
|
863
1223
|
n.key === "Escape" && e && t();
|
|
864
1224
|
};
|
|
865
1225
|
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
866
|
-
}, [e, t]), e ? /* @__PURE__ */
|
|
1226
|
+
}, [e, t]), e ? /* @__PURE__ */ l("div", {
|
|
867
1227
|
className: Q.overlay,
|
|
868
1228
|
onClick: (e) => {
|
|
869
1229
|
o && e.target === e.currentTarget && t();
|
|
870
1230
|
},
|
|
871
|
-
children: /* @__PURE__ */
|
|
872
|
-
className: `${Q.modal} ${Q[
|
|
1231
|
+
children: /* @__PURE__ */ u("div", {
|
|
1232
|
+
className: `${Q.modal} ${Q[i]} ${s}`,
|
|
873
1233
|
role: "dialog",
|
|
874
1234
|
"aria-modal": "true",
|
|
875
|
-
children: [n && /* @__PURE__ */
|
|
1235
|
+
children: [n && /* @__PURE__ */ u("div", {
|
|
876
1236
|
className: Q.header,
|
|
877
|
-
children: [/* @__PURE__ */
|
|
1237
|
+
children: [/* @__PURE__ */ l("h2", {
|
|
878
1238
|
className: Q.title,
|
|
879
1239
|
children: n
|
|
880
|
-
}), /* @__PURE__ */
|
|
1240
|
+
}), /* @__PURE__ */ l("button", {
|
|
881
1241
|
className: Q.closeButton,
|
|
882
1242
|
onClick: t,
|
|
883
1243
|
"aria-label": "Close modal",
|
|
884
1244
|
children: "✕"
|
|
885
1245
|
})]
|
|
886
|
-
}), /* @__PURE__ */
|
|
1246
|
+
}), /* @__PURE__ */ l("div", {
|
|
887
1247
|
className: Q.content,
|
|
888
1248
|
children: r
|
|
889
1249
|
})]
|
|
@@ -898,24 +1258,24 @@ var Y = {
|
|
|
898
1258
|
dot: "_dot_1uhnh_34",
|
|
899
1259
|
bounce: "_bounce_1uhnh_1",
|
|
900
1260
|
visuallyHidden: "_visuallyHidden_1uhnh_91"
|
|
901
|
-
},
|
|
1261
|
+
}, Re = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ u("div", {
|
|
902
1262
|
className: `${$.dots} ${$[e]} ${n}`,
|
|
903
1263
|
children: [
|
|
904
|
-
/* @__PURE__ */
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ l("span", { className: $.dot }),
|
|
1265
|
+
/* @__PURE__ */ l("span", { className: $.dot }),
|
|
1266
|
+
/* @__PURE__ */ l("span", { className: $.dot })
|
|
907
1267
|
]
|
|
908
|
-
}) : /* @__PURE__ */
|
|
1268
|
+
}) : /* @__PURE__ */ l("div", {
|
|
909
1269
|
className: `${$.spinner} ${$[e]} ${n}`,
|
|
910
1270
|
role: "status",
|
|
911
|
-
children: /* @__PURE__ */
|
|
1271
|
+
children: /* @__PURE__ */ l("span", {
|
|
912
1272
|
className: $.visuallyHidden,
|
|
913
1273
|
children: "Loading..."
|
|
914
1274
|
})
|
|
915
|
-
}),
|
|
1275
|
+
}), ze = async (e) => {
|
|
916
1276
|
if (e.length === 0) return {};
|
|
917
1277
|
let t = [...new Set(e)], n = await L.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
|
|
918
1278
|
return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
|
|
919
1279
|
};
|
|
920
1280
|
//#endregion
|
|
921
|
-
export {
|
|
1281
|
+
export { Se as AllyCodeDropdown, ie as ApiClient, pe as AuthProvider, Ie as Badge, G as Button, Pe as Card, p as Container, Oe as Footer, be as Input, Re as Loader, Le as Modal, De as NavBar, Ne as RosterRefresh, ve as SUITE_NAV, ye as Select, h as TopBar, L as apiClient, re as authedFetch, de as clearAllyCodes, T as clearTokens, A as configureAuthRefresh, ze as fetchUsernames, q as formatAllyCode, je as formatCountdown, Ae as formatRelativeTime, v as getAccessToken, z as getAllyCodesFromStorage, x as getRefreshToken, ue as getSelectedAllyCode, ae as initializeApiClient, E as isAuthenticated, ke as parseBackendTimestamp, j as refreshAccessToken, b as removeAccessToken, ce as removeAllyCodeFromStorage, C as removeRefreshToken, se as saveAllyCodeToStorage, y as setAccessToken, S as setRefreshToken, B as setSelectedAllyCode, w as setTokens, xe as unformatAllyCode, le as updateAllyCodeLastUsed, V as useAuth };
|