astrogators-shared-ui 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useState as a } from "react";
2
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
3
- var l = {
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
- }, u = ({ children: e, maxWidth: t = "xl", padding: n = !0, className: r = "", style: i }) => /* @__PURE__ */ s("div", {
12
- className: `${l.container} ${l[`maxWidth-${t}`]} ${n ? l.padding : ""} ${r}`,
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
- }), d = {
16
- topBar: "_topBar_10g3c_1",
17
- content: "_content_10g3c_13",
18
- left: "_left_10g3c_23",
19
- right: "_right_10g3c_30",
20
- logo: "_logo_10g3c_36"
21
- }, f = ({ logo: e, leftContent: t, rightContent: n, className: r = "" }) => /* @__PURE__ */ s("header", {
22
- className: `${d.topBar} ${r}`,
23
- children: /* @__PURE__ */ c("div", {
24
- className: d.content,
25
- children: [/* @__PURE__ */ c("div", {
26
- className: d.left,
27
- children: [e && /* @__PURE__ */ s("div", {
28
- className: d.logo,
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__ */ s("div", {
32
- className: d.right,
32
+ }), /* @__PURE__ */ l("div", {
33
+ className: m.right,
33
34
  children: n
34
35
  })]
35
36
  })
36
- }), p = {
37
- button: "_button_159ms_1",
38
- sm: "_sm_159ms_22",
39
- md: "_md_159ms_28",
40
- lg: "_lg_159ms_34",
41
- primary: "_primary_159ms_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(y);
170
- }, w = () => localStorage.getItem(b), T = (e) => {
171
- localStorage.setItem(b, e);
172
- }, E = () => {
173
- localStorage.removeItem(b);
174
- }, D = (e, t) => {
175
- S(e), T(t);
176
- }, O = () => {
177
- C(), E();
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(`${te}/api/v1/auth/refresh`, {
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 O(), k?.(), Error("Token refresh failed");
59
+ if (!t.ok) throw T(), O?.(), Error("Token refresh failed");
189
60
  let n = await t.json();
190
- return D(n.access_token, n.refresh_token), n.access_token;
61
+ return w(n.access_token, n.refresh_token), n.access_token;
191
62
  })().finally(() => {
192
- A = null;
193
- }), A), N = 30, P = [700, 1500], ne = new Set([
63
+ k = null;
64
+ }), k), ee = 30, M = [700, 1500], N = new Set([
194
65
  502,
195
66
  503,
196
67
  504
197
- ]), F = (e) => {
68
+ ]), P = (e) => {
198
69
  let t = (e ?? "GET").toUpperCase();
199
70
  return t === "GET" || t === "HEAD" || t === "OPTIONS";
200
- }, I = (e) => e == null || typeof e == "string", re = (e) => new Promise((t) => setTimeout(t, e)), ie = async (e, t) => {
201
- let n = F(t.method) && I(t.body), r = I(t.body), i;
202
- for (let a = 0; a <= P.length; a++) {
203
- a > 0 && await re(P[a - 1]);
204
- let o = a < P.length;
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 && ne.has(r.status)) continue;
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
- }, ae = (e) => {
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 - N;
89
+ return typeof n == "number" && Date.now() / 1e3 >= n - ee;
219
90
  } catch {
220
91
  return !1;
221
92
  }
222
- }, oe = async (e, t = {}) => {
223
- let n = x();
224
- if (n && ae(n)) try {
225
- n = await M();
93
+ }, re = async (e, t = {}) => {
94
+ let n = v();
95
+ if (n && ne(n)) try {
96
+ n = await j();
226
97
  } catch {
227
- n = x();
98
+ n = v();
228
99
  }
229
100
  let r = { ...t.headers };
230
101
  n && (r.Authorization = `Bearer ${n}`);
231
- let i = await ie(e, {
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 M()}`, await ie(e, {
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
- }, se = class {
115
+ }, ie = class {
245
116
  baseURL;
246
117
  constructor(e) {
247
- this.baseURL = e.baseURL, j({
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 oe(`${this.baseURL}${e}`, {
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, ce = (e) => {
307
- L = new se(e);
308
- }, R = "astrogators_ally_codes", z = "astrogators_selected_ally_code", B = () => {
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
- }, le = (e) => {
186
+ }, se = (e) => {
316
187
  try {
317
- let t = B();
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
- }, ue = (e) => {
194
+ }, ce = (e) => {
324
195
  try {
325
- let t = B().filter((t) => t.ally_code !== e);
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
- }, V = (e) => {
201
+ }, le = (e) => {
331
202
  try {
332
- let t = B().map((t) => t.ally_code === e ? {
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
- }, de = () => localStorage.getItem(z), H = (e) => {
341
- e ? localStorage.setItem(z, e) : localStorage.removeItem(z);
342
- }, fe = () => {
343
- localStorage.removeItem(R), localStorage.removeItem(z);
344
- }, pe = t(void 0), me = ({ children: e, apiBaseUrl: t }) => {
345
- let [r, o] = a(null), [c, l] = a(!0), [u, d] = a(!0), [f, p] = a(!0), [m, h] = a([]), [g, _] = a(null), [v, y] = a(!1), [b, x] = a({
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
- ce({ baseURL: t }), i(() => {
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,842 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
357
228
  }
358
229
  })();
359
230
  }, [t]);
360
- let S = n(async () => {
361
- if (!ee()) {
362
- o(null), l(!1);
231
+ let S = r(async () => {
232
+ if (!E()) {
233
+ i(null), c(!1);
363
234
  return;
364
235
  }
365
236
  try {
366
- o(await L.get("/api/v1/users/me"));
237
+ i(await L.get("/api/v1/users/me"));
367
238
  } catch (e) {
368
- console.error("Failed to fetch user:", e), o(null), O();
239
+ console.error("Failed to fetch user:", e), i(null), T();
369
240
  } finally {
370
- l(!1);
241
+ c(!1);
371
242
  }
372
243
  }, []);
373
- i(() => {
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
- D(t.access_token, t.refresh_token), o(await L.get("/api/v1/users/me"));
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
- }, w = async (e) => {
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
- }, T = () => {
390
- O(), o(null), h([]), _(null), H(null), x({
260
+ }, O = () => {
261
+ T(), i(null), h([]), _(null), B(null), x({
391
262
  show: !1,
392
263
  localStorageCodes: []
393
264
  });
394
- }, E = async () => {
265
+ }, k = async () => {
395
266
  await S();
396
- }, te = async (e) => {
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
- }, k = async (e) => {
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
- }, A = async (e) => {
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
- }, j = n(async () => {
285
+ }, M = r(async () => {
415
286
  y(!0);
416
287
  try {
417
288
  let e = [];
418
- if (r) {
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 = B();
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 = B();
298
+ let t = z();
428
299
  h(t), e = t.map((e) => e.ally_code);
429
300
  }
430
- let t = de(), n = t && e.includes(t) ? t : null;
431
- _(n), n !== t && H(n);
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
- }, [r]), M = n(async (e) => {
438
- r && typeof e == "number" ? (await L.put(`/api/v1/users/me/ally-codes/${e}/use`, {}), await j()) : !r && typeof e == "string" && (V(e), h(B()));
439
- }, [r, j]), N = n((e) => {
440
- if (_(e), H(e), e && r) {
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 && M(t.id);
443
- } else e && !r && V(e);
313
+ t && "id" in t && N(t.id);
314
+ } else e && !n && le(e);
444
315
  }, [
445
- r,
316
+ n,
446
317
  m,
447
- M
448
- ]), P = n(async (e) => {
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 (r) {
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 && N(e);
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
- le({
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(B()), m.length === 0 && N(e);
331
+ }), h(z()), m.length === 0 && P(e);
461
332
  }
462
333
  }, [
463
- r,
334
+ n,
464
335
  m.length,
465
- N
466
- ]), ne = n(async (e) => {
467
- r && typeof e == "number" ? (await L.delete(`/api/v1/users/me/ally-codes/${e}`), h((t) => t.filter((t) => "id" in t && t.id !== e))) : !r && typeof e == "string" && (ue(e), h(B()), g === e && N(null));
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
- r,
340
+ n,
470
341
  g,
471
- N
472
- ]), F = n(() => {
342
+ P
343
+ ]), I = r(() => {
473
344
  x({
474
345
  show: !1,
475
346
  localStorageCodes: []
476
347
  });
477
- }, []), I = n(async () => {
478
- if (!r) return;
479
- let e = B();
348
+ }, []), ne = r(async () => {
349
+ if (!n) return;
350
+ let e = z();
480
351
  for (let t of e) try {
481
- await P(t.ally_code);
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
- fe(), F();
356
+ de(), I();
486
357
  }, [
487
- r,
488
- P,
489
- F
358
+ n,
359
+ F,
360
+ I
490
361
  ]);
491
- i(() => {
492
- j();
493
- }, [j]);
362
+ a(() => {
363
+ M();
364
+ }, [M]);
494
365
  let re = {
495
- user: r,
496
- isAuthenticated: !!r,
497
- isLoading: c,
366
+ user: n,
367
+ isAuthenticated: !!n,
368
+ isLoading: o,
498
369
  login: C,
499
- register: w,
500
- logout: T,
501
- refreshUser: E,
502
- forgotPassword: te,
503
- resetPassword: k,
504
- resendVerification: A,
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: j,
511
- addAllyCode: P,
512
- removeAllyCode: ne,
513
- selectAllyCode: N,
514
- updateAllyCodeLastUsed: M,
381
+ fetchAllyCodes: M,
382
+ addAllyCode: F,
383
+ removeAllyCode: te,
384
+ selectAllyCode: P,
385
+ updateAllyCodeLastUsed: N,
515
386
  migrationPrompt: b,
516
- dismissMigrationPrompt: F,
517
- migrateLocalStorageCodes: I
387
+ dismissMigrationPrompt: I,
388
+ migrateLocalStorageCodes: ne
518
389
  };
519
- return /* @__PURE__ */ s(pe.Provider, {
390
+ return /* @__PURE__ */ l(fe.Provider, {
520
391
  value: re,
521
392
  children: e
522
393
  });
523
- }, U = () => {
524
- let e = r(pe);
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
- }, W = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, he = (e) => e.replace(/-/g, ""), G = {
528
- allyCodeDropdown: "_allyCodeDropdown_1m0tw_1",
529
- select: "_select_1m0tw_8",
530
- manageButton: "_manageButton_1m0tw_12",
531
- managePanel: "_managePanel_1m0tw_16",
532
- addSection: "_addSection_1m0tw_37",
533
- addInputGroup: "_addInputGroup_1m0tw_43",
534
- error: "_error_1m0tw_55",
535
- success: "_success_1m0tw_61",
536
- codesList: "_codesList_1m0tw_67",
537
- codeItem: "_codeItem_1m0tw_71",
538
- doneButton: "_doneButton_1m0tw_88"
539
- }, ge = ({ onAllyCodeSelected: e, className: t = "" }) => {
540
- let { allyCodes: n, selectedAllyCode: r, selectAllyCode: i, removeAllyCode: o, addAllyCode: l, isLoadingAllyCodes: u } = U(), [d, f] = a(!1), [p, h] = a(""), [_, y] = a(""), [b, x] = a(""), [S, C] = a(!1), w = n.map((e) => ({
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: "Grid",
537
+ href: "/mod-ledger/"
538
+ },
539
+ {
540
+ id: "evaluations",
541
+ label: "Evaluations",
542
+ href: "/mod-ledger/evaluations"
543
+ },
544
+ {
545
+ id: "moderation",
546
+ label: "Moderation",
547
+ href: "/mod-ledger/moderation",
548
+ roles: ["admin", "mod"]
549
+ }
550
+ ]
551
+ },
552
+ {
553
+ id: "navicharts",
554
+ label: "Navicharts",
555
+ href: "/navicharts/",
556
+ status: "available",
557
+ sections: [{
558
+ id: "library",
559
+ label: "My Star Charts",
560
+ href: "/navicharts/"
561
+ }]
562
+ },
563
+ {
564
+ id: "nightwatcher",
565
+ label: "Nightwatcher",
566
+ href: "/nightwatcher/",
567
+ status: "available",
568
+ sections: [{
569
+ id: "overview",
570
+ label: "Overview",
571
+ href: "/nightwatcher/"
572
+ }]
573
+ }
574
+ ], U = {
575
+ selectWrapper: "_selectWrapper_ir4bq_1",
576
+ fullWidth: "_fullWidth_ir4bq_7",
577
+ label: "_label_ir4bq_11",
578
+ required: "_required_ir4bq_20",
579
+ selectContainer: "_selectContainer_ir4bq_24",
580
+ select: "_select_ir4bq_1",
581
+ error: "_error_ir4bq_63",
582
+ arrow: "_arrow_ir4bq_71",
583
+ errorText: "_errorText_ir4bq_81",
584
+ helperText: "_helperText_ir4bq_86"
585
+ }, ye = e.forwardRef(({ label: e, error: t, helperText: n, options: r, placeholder: i, fullWidth: a = !1, className: o = "", id: s, ...c }, d) => {
586
+ let f = s || `select-${Math.random().toString(36).substr(2, 9)}`, p = !!t;
587
+ return /* @__PURE__ */ u("div", {
588
+ className: `${U.selectWrapper} ${a ? U.fullWidth : ""} ${o}`,
589
+ children: [
590
+ e && /* @__PURE__ */ u("label", {
591
+ htmlFor: f,
592
+ className: U.label,
593
+ children: [e, c.required && /* @__PURE__ */ l("span", {
594
+ className: U.required,
595
+ children: "*"
596
+ })]
597
+ }),
598
+ /* @__PURE__ */ u("div", {
599
+ className: U.selectContainer,
600
+ children: [/* @__PURE__ */ u("select", {
601
+ ref: d,
602
+ id: f,
603
+ className: `${U.select} ${p ? U.error : ""}`,
604
+ ...c,
605
+ children: [
606
+ i && /* @__PURE__ */ l("option", {
607
+ value: "",
608
+ disabled: !0,
609
+ children: i
610
+ }),
611
+ r && r.map((e) => /* @__PURE__ */ l("option", {
612
+ value: e.value,
613
+ disabled: e.disabled,
614
+ children: e.label
615
+ }, e.value)),
616
+ !r && c.children
617
+ ]
618
+ }), /* @__PURE__ */ l("span", {
619
+ className: U.arrow,
620
+ children: "▼"
621
+ })]
622
+ }),
623
+ t && /* @__PURE__ */ l("span", {
624
+ className: U.errorText,
625
+ children: t
626
+ }),
627
+ n && !t && /* @__PURE__ */ l("span", {
628
+ className: U.helperText,
629
+ children: n
630
+ })
631
+ ]
632
+ });
633
+ });
634
+ ye.displayName = "Select";
635
+ var W = {
636
+ button: "_button_159ms_1",
637
+ sm: "_sm_159ms_22",
638
+ md: "_md_159ms_28",
639
+ lg: "_lg_159ms_34",
640
+ primary: "_primary_159ms_41",
641
+ secondary: "_secondary_159ms_55",
642
+ outline: "_outline_159ms_69",
643
+ ghost: "_ghost_159ms_80",
644
+ danger: "_danger_159ms_89",
645
+ fullWidth: "_fullWidth_159ms_100",
646
+ loading: "_loading_159ms_105",
647
+ loadingSpinner: "_loadingSpinner_159ms_110",
648
+ spinner: "_spinner_159ms_116",
649
+ spin: "_spin_159ms_116",
650
+ loadingText: "_loadingText_159ms_131"
651
+ }, G = ({ children: e, variant: t = "primary", size: n = "md", fullWidth: r = !1, loading: i = !1, disabled: a = !1, className: o = "", ...s }) => /* @__PURE__ */ l("button", {
652
+ className: `${W.button} ${W[t]} ${W[n]} ${r ? W.fullWidth : ""} ${i ? W.loading : ""} ${o}`,
653
+ disabled: a || i,
654
+ ...s,
655
+ children: i ? /* @__PURE__ */ u("span", {
656
+ className: W.loadingSpinner,
657
+ children: [/* @__PURE__ */ l("span", { className: W.spinner }), /* @__PURE__ */ l("span", {
658
+ className: W.loadingText,
659
+ children: e
660
+ })]
661
+ }) : e
662
+ }), K = {
663
+ inputWrapper: "_inputWrapper_15t4g_1",
664
+ fullWidth: "_fullWidth_15t4g_7",
665
+ label: "_label_15t4g_11",
666
+ required: "_required_15t4g_20",
667
+ input: "_input_15t4g_1",
668
+ error: "_error_15t4g_55",
669
+ errorText: "_errorText_15t4g_63",
670
+ helperText: "_helperText_15t4g_68"
671
+ }, be = e.forwardRef(({ label: e, error: t, helperText: n, fullWidth: r = !1, className: i = "", id: a, ...o }, s) => {
672
+ let c = a || `input-${Math.random().toString(36).substr(2, 9)}`, d = !!t;
673
+ return /* @__PURE__ */ u("div", {
674
+ className: `${K.inputWrapper} ${r ? K.fullWidth : ""} ${i}`,
675
+ children: [
676
+ e && /* @__PURE__ */ u("label", {
677
+ htmlFor: c,
678
+ className: K.label,
679
+ children: [e, o.required && /* @__PURE__ */ l("span", {
680
+ className: K.required,
681
+ children: "*"
682
+ })]
683
+ }),
684
+ /* @__PURE__ */ l("input", {
685
+ ref: s,
686
+ id: c,
687
+ className: `${K.input} ${d ? K.error : ""}`,
688
+ ...o
689
+ }),
690
+ t && /* @__PURE__ */ l("span", {
691
+ className: K.errorText,
692
+ children: t
693
+ }),
694
+ n && !t && /* @__PURE__ */ l("span", {
695
+ className: K.helperText,
696
+ children: n
697
+ })
698
+ ]
699
+ });
700
+ });
701
+ be.displayName = "Input";
702
+ //#endregion
703
+ //#region src/utils/formatAllyCode.ts
704
+ 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 = {
705
+ allyCodeDropdown: "_allyCodeDropdown_1pawi_1",
706
+ select: "_select_1pawi_8",
707
+ manageButton: "_manageButton_1pawi_12",
708
+ managePanel: "_managePanel_1pawi_16",
709
+ addSection: "_addSection_1pawi_37",
710
+ addInputGroup: "_addInputGroup_1pawi_43",
711
+ error: "_error_1pawi_55",
712
+ success: "_success_1pawi_61",
713
+ codesList: "_codesList_1pawi_67",
714
+ codeItem: "_codeItem_1pawi_71",
715
+ doneButton: "_doneButton_1pawi_88",
716
+ inline: "_inline_1pawi_107"
717
+ }, Se = ({ onAllyCodeSelected: e, className: t = "", isOpen: n, onOpenChange: r, variant: i = "floating" }) => {
718
+ let { allyCodes: a, selectedAllyCode: c, selectAllyCode: d, removeAllyCode: f, addAllyCode: p, isLoadingAllyCodes: m } = V(), [h, g] = s(!1), _ = n ?? h, v = (e) => {
719
+ g(e), r?.(e);
720
+ }, [y, b] = s(""), [x, S] = s(""), [C, w] = s(""), [T, E] = s(!1), D = o(null), O = o(null);
721
+ me({
722
+ isOpen: _ && i === "floating",
723
+ onClose: () => v(!1),
724
+ triggerRef: D,
725
+ panelRef: O
726
+ });
727
+ let k = a.map((e) => ({
541
728
  value: e.ally_code,
542
- label: e.player_name ? `${e.player_name} (${W(e.ally_code)})` : W(e.ally_code)
543
- })), T = (t) => {
729
+ label: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code)
730
+ })), A = (t) => {
544
731
  let n = t.target.value || null;
545
- i(n), e?.(n);
546
- }, E = async (e) => {
547
- let t = n.find((t) => t.ally_code === e);
548
- t && await o("id" in t ? t.id : t.ally_code);
549
- }, D = async () => {
550
- if (y(""), x(""), !/^\d{9}$/.test(p)) {
551
- y("Ally code must be exactly 9 digits");
732
+ d(n), e?.(n);
733
+ }, j = async (e) => {
734
+ let t = a.find((t) => t.ally_code === e);
735
+ t && await f("id" in t ? t.id : t.ally_code);
736
+ }, ee = async () => {
737
+ if (S(""), w(""), !/^\d{9}$/.test(y)) {
738
+ S("Ally code must be exactly 9 digits");
552
739
  return;
553
740
  }
554
- C(!0);
741
+ E(!0);
555
742
  try {
556
- await l(p), x("Added successfully!"), h(""), setTimeout(() => x(""), 2e3);
743
+ await p(y), w("Added successfully!"), b(""), setTimeout(() => w(""), 2e3);
557
744
  } catch (e) {
558
- y(e.message || "Failed to add ally code");
745
+ S(e.message || "Failed to add ally code");
559
746
  } finally {
560
- C(!1);
747
+ E(!1);
561
748
  }
562
- }, O = n.length > 0;
563
- return /* @__PURE__ */ c("div", {
564
- className: `${G.allyCodeDropdown} ${t}`,
749
+ }, M = a.length > 0;
750
+ return /* @__PURE__ */ u("div", {
751
+ className: `${J.allyCodeDropdown} ${i === "inline" ? J.inline : ""} ${t}`,
565
752
  children: [
566
- O && /* @__PURE__ */ s(g, {
567
- options: w,
568
- value: r || "",
569
- onChange: T,
753
+ M && /* @__PURE__ */ l(ye, {
754
+ options: k,
755
+ value: c || "",
756
+ onChange: A,
570
757
  placeholder: "Select ally code",
571
- disabled: u,
572
- className: G.select
758
+ disabled: m,
759
+ className: J.select
573
760
  }),
574
- d && /* @__PURE__ */ c("div", {
575
- className: G.managePanel,
761
+ _ && /* @__PURE__ */ u("div", {
762
+ className: J.managePanel,
763
+ ref: O,
764
+ id: "ally-code-manage-panel",
576
765
  children: [
577
- /* @__PURE__ */ s("h4", { children: "Manage Ally Codes" }),
578
- /* @__PURE__ */ c("div", {
579
- className: G.addSection,
766
+ /* @__PURE__ */ l("h4", { children: "Manage Ally Codes" }),
767
+ /* @__PURE__ */ u("div", {
768
+ className: J.addSection,
580
769
  children: [
581
- /* @__PURE__ */ c("div", {
582
- className: G.addInputGroup,
583
- children: [/* @__PURE__ */ s(v, {
770
+ /* @__PURE__ */ u("div", {
771
+ className: J.addInputGroup,
772
+ children: [/* @__PURE__ */ l(be, {
584
773
  type: "text",
585
774
  placeholder: "9-digit ally code",
586
- value: p,
587
- onChange: (e) => h(e.target.value.replace(/\D/g, "").slice(0, 9)),
588
- disabled: S
589
- }), /* @__PURE__ */ s(m, {
775
+ value: y,
776
+ onChange: (e) => b(e.target.value.replace(/\D/g, "").slice(0, 9)),
777
+ disabled: T
778
+ }), /* @__PURE__ */ l(G, {
590
779
  variant: "primary",
591
780
  size: "sm",
592
- onClick: D,
593
- loading: S,
594
- disabled: p.length !== 9,
781
+ onClick: ee,
782
+ loading: T,
783
+ disabled: y.length !== 9,
595
784
  children: "Add"
596
785
  })]
597
786
  }),
598
- _ && /* @__PURE__ */ s("div", {
599
- className: G.error,
600
- children: _
787
+ x && /* @__PURE__ */ l("div", {
788
+ className: J.error,
789
+ children: x
601
790
  }),
602
- b && /* @__PURE__ */ s("div", {
603
- className: G.success,
604
- children: b
791
+ C && /* @__PURE__ */ l("div", {
792
+ className: J.success,
793
+ children: C
605
794
  })
606
795
  ]
607
796
  }),
608
- /* @__PURE__ */ s("div", {
609
- className: G.codesList,
610
- children: n.map((e) => /* @__PURE__ */ c("div", {
611
- className: G.codeItem,
612
- children: [/* @__PURE__ */ s("span", { children: e.player_name ? `${e.player_name} (${W(e.ally_code)})` : W(e.ally_code) }), /* @__PURE__ */ s(m, {
797
+ /* @__PURE__ */ l("div", {
798
+ className: J.codesList,
799
+ children: a.map((e) => /* @__PURE__ */ u("div", {
800
+ className: J.codeItem,
801
+ children: [/* @__PURE__ */ l("span", { children: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code) }), /* @__PURE__ */ l(G, {
613
802
  variant: "ghost",
614
803
  size: "sm",
615
- onClick: () => E(e.ally_code),
804
+ onClick: () => j(e.ally_code),
616
805
  children: "Remove"
617
806
  })]
618
807
  }, e.ally_code))
619
808
  }),
620
- /* @__PURE__ */ s(m, {
809
+ /* @__PURE__ */ l(G, {
621
810
  variant: "secondary",
622
811
  size: "sm",
623
- onClick: () => f(!1),
624
- className: G.doneButton,
812
+ onClick: () => v(!1),
813
+ className: J.doneButton,
625
814
  children: "Done"
626
815
  })
627
816
  ]
628
817
  }),
629
- /* @__PURE__ */ s(m, {
818
+ /* @__PURE__ */ l("span", {
819
+ ref: D,
820
+ children: /* @__PURE__ */ l(G, {
821
+ variant: "ghost",
822
+ size: "sm",
823
+ onClick: () => v(!_),
824
+ className: J.manageButton,
825
+ "aria-expanded": _,
826
+ "aria-controls": "ally-code-manage-panel",
827
+ "aria-haspopup": "true",
828
+ children: M ? "Manage" : "+ Add ally code"
829
+ })
830
+ })
831
+ ]
832
+ });
833
+ }, Ce = {
834
+ authCluster: "_authCluster_17o10_1",
835
+ userLink: "_userLink_17o10_7",
836
+ adminLink: "_adminLink_17o10_16"
837
+ }, we = ({ showAuth: e = !0 }) => {
838
+ let { user: t, isAuthenticated: n, logout: r, authEnabled: i } = V();
839
+ return e ? n ? /* @__PURE__ */ u("div", {
840
+ className: Ce.authCluster,
841
+ children: [
842
+ t?.role === "admin" && /* @__PURE__ */ l("a", {
843
+ href: "/admin/users",
844
+ className: Ce.adminLink,
845
+ children: "Admin"
846
+ }),
847
+ /* @__PURE__ */ l("a", {
848
+ href: "/profile",
849
+ className: Ce.userLink,
850
+ children: t?.username
851
+ }),
852
+ /* @__PURE__ */ l(G, {
630
853
  variant: "ghost",
631
854
  size: "sm",
632
- onClick: () => f(!d),
633
- className: G.manageButton,
634
- children: O ? "Manage" : "+ Add ally code"
855
+ onClick: () => {
856
+ r(), window.location.href = "/";
857
+ },
858
+ children: "Logout"
635
859
  })
636
860
  ]
637
- });
638
- }, K = {
639
- logoLink: "_logoLink_84pn2_3",
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", {
861
+ }) : i ? /* @__PURE__ */ u("div", {
862
+ className: Ce.authCluster,
863
+ children: [/* @__PURE__ */ l("a", {
666
864
  href: "/login",
667
- children: /* @__PURE__ */ s(m, {
865
+ children: /* @__PURE__ */ l(G, {
668
866
  variant: "ghost",
669
867
  size: "sm",
670
868
  children: "Login"
671
869
  })
672
- }), /* @__PURE__ */ s("a", {
870
+ }), /* @__PURE__ */ l("a", {
673
871
  href: "/register",
674
- children: /* @__PURE__ */ s(m, {
872
+ children: /* @__PURE__ */ l(G, {
675
873
  variant: "primary",
676
874
  size: "sm",
677
875
  children: "Sign Up"
678
876
  })
679
877
  })]
680
878
  }) : null : null;
681
- return /* @__PURE__ */ s(f, {
879
+ }, Y = {
880
+ backdrop: "_backdrop_1n4uh_1",
881
+ panel: "_panel_1n4uh_11",
882
+ accordion: "_accordion_1n4uh_24",
883
+ accordionItem: "_accordionItem_1n4uh_29",
884
+ accordionHeader: "_accordionHeader_1n4uh_33",
885
+ currentApp: "_currentApp_1n4uh_48",
886
+ chevron: "_chevron_1n4uh_53",
887
+ chevronOpen: "_chevronOpen_1n4uh_58",
888
+ accordionPanel: "_accordionPanel_1n4uh_62",
889
+ sectionLink: "_sectionLink_1n4uh_68",
890
+ sectionActive: "_sectionActive_1n4uh_79",
891
+ comingSoon: "_comingSoon_1n4uh_85",
892
+ allySection: "_allySection_1n4uh_91",
893
+ extrasSection: "_extrasSection_1n4uh_92",
894
+ accountSection: "_accountSection_1n4uh_93"
895
+ }, Te = ({ isOpen: e, onClose: t, currentApp: n, activeSectionId: r, onSectionClick: i, rightExtras: c, showAuth: f, panelId: p, returnFocusRef: m }) => {
896
+ let { isAuthenticated: h, user: g } = V(), [_, v] = s(n === "hub" ? null : n), y = o(null);
897
+ if (a(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
898
+ document.body.style.overflow = "unset";
899
+ }), [e]), a(() => {
900
+ if (!e) return;
901
+ let r = (e) => {
902
+ e.key === "Escape" && (t(), m.current?.focus());
903
+ };
904
+ return document.addEventListener("keydown", r), v(n === "hub" ? null : n), y.current?.focus(), () => document.removeEventListener("keydown", r);
905
+ }, [e]), !e) return null;
906
+ let b = (e, r) => (a) => {
907
+ e === n && i?.(r, a), t();
908
+ };
909
+ return d(/* @__PURE__ */ l("div", {
910
+ className: Y.backdrop,
911
+ onClick: t,
912
+ children: /* @__PURE__ */ u("div", {
913
+ ref: y,
914
+ id: p,
915
+ role: "dialog",
916
+ "aria-modal": "true",
917
+ "aria-label": "Navigation menu",
918
+ tabIndex: -1,
919
+ className: Y.panel,
920
+ onClick: (e) => e.stopPropagation(),
921
+ children: [
922
+ /* @__PURE__ */ l("div", {
923
+ className: Y.accordion,
924
+ children: ve.map((e) => {
925
+ 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}`;
926
+ return /* @__PURE__ */ u("div", {
927
+ className: Y.accordionItem,
928
+ children: [/* @__PURE__ */ u("button", {
929
+ type: "button",
930
+ className: `${Y.accordionHeader} ${i ? Y.currentApp : ""}`,
931
+ "aria-expanded": t,
932
+ "aria-controls": o,
933
+ onClick: () => v(t ? null : e.id),
934
+ children: [e.label, /* @__PURE__ */ l("svg", {
935
+ className: `${Y.chevron} ${t ? Y.chevronOpen : ""}`,
936
+ width: "10",
937
+ height: "6",
938
+ viewBox: "0 0 10 6",
939
+ "aria-hidden": "true",
940
+ children: /* @__PURE__ */ l("path", {
941
+ d: "M1 1l4 4 4-4",
942
+ stroke: "currentColor",
943
+ strokeWidth: "1.5",
944
+ fill: "none",
945
+ strokeLinecap: "round",
946
+ strokeLinejoin: "round"
947
+ })
948
+ })]
949
+ }), t && /* @__PURE__ */ l("div", {
950
+ id: o,
951
+ className: Y.accordionPanel,
952
+ children: e.status === "coming-soon" ? /* @__PURE__ */ l("div", {
953
+ className: Y.comingSoon,
954
+ children: "Coming soon"
955
+ }) : a.map((t) => {
956
+ let n = i && r === t.id;
957
+ return /* @__PURE__ */ l("a", {
958
+ href: t.href,
959
+ className: `${Y.sectionLink} ${n ? Y.sectionActive : ""}`,
960
+ "aria-current": n ? "page" : void 0,
961
+ onClick: b(e.id, t),
962
+ children: t.label
963
+ }, t.id);
964
+ })
965
+ })]
966
+ }, e.id);
967
+ })
968
+ }),
969
+ /* @__PURE__ */ l("div", {
970
+ className: Y.allySection,
971
+ children: /* @__PURE__ */ l(Se, { variant: "inline" })
972
+ }),
973
+ c && /* @__PURE__ */ l("div", {
974
+ className: Y.extrasSection,
975
+ children: c
976
+ }),
977
+ /* @__PURE__ */ l("div", {
978
+ className: Y.accountSection,
979
+ children: /* @__PURE__ */ l(we, { showAuth: f })
980
+ })
981
+ ]
982
+ })
983
+ }), document.body);
984
+ }, Ee = {
985
+ logoLink: "_logoLink_12f5f_3",
986
+ appMenus: "_appMenus_12f5f_10",
987
+ desktopRight: "_desktopRight_12f5f_19",
988
+ extrasGroup: "_extrasGroup_12f5f_25"
989
+ }, De = ({ currentApp: e, activeSectionId: t, onNavigate: n, rightExtras: r, showAuth: i = !0, className: d }) => {
990
+ let [f, p] = s(null), [m, g] = s(!1), _ = o(null), v = "suite-mobile-nav-panel";
991
+ return a(() => {
992
+ let e = window.matchMedia("(max-width: 768px)"), t = () => {
993
+ p(null), g(!1);
994
+ };
995
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
996
+ }, []), /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(h, {
682
997
  className: d,
683
- logo: /* @__PURE__ */ s("a", {
684
- href: t,
685
- className: K.logoLink,
998
+ logo: /* @__PURE__ */ l("a", {
999
+ href: "/",
1000
+ className: Ee.logoLink,
686
1001
  children: "The Astrogator's Table"
687
1002
  }),
688
- leftContent: x ? /* @__PURE__ */ c("div", {
689
- className: K.appNav,
690
- children: [n && /* @__PURE__ */ s("a", {
691
- href: r,
692
- className: K.appName,
693
- children: n
694
- }), b && /* @__PURE__ */ s("nav", {
695
- className: K.tabs,
696
- children: i.map((t) => {
697
- let n = `${K.tab} ${t.active ? K.tabActive : ""}`;
698
- return t.render ? /* @__PURE__ */ s(e.Fragment, { children: t.render({
699
- className: n,
700
- children: t.label
701
- }) }, t.href) : /* @__PURE__ */ s("a", {
702
- href: t.href,
703
- className: n,
704
- children: t.label
705
- }, t.href);
706
- })
707
- })]
708
- }) : void 0,
709
- rightContent: /* @__PURE__ */ c(o, { children: [y && /* @__PURE__ */ c("div", {
710
- className: K.extrasGroup,
711
- children: [u, a && /* @__PURE__ */ s(ge, {})]
712
- }), S] })
713
- });
714
- }, q = {
1003
+ leftContent: /* @__PURE__ */ l("nav", {
1004
+ className: Ee.appMenus,
1005
+ children: ve.map((r) => /* @__PURE__ */ l(he, {
1006
+ app: r,
1007
+ isCurrentApp: e === r.id,
1008
+ activeSectionId: t,
1009
+ isOpen: f === r.id,
1010
+ onOpenChange: (e) => p(e ? r.id : null),
1011
+ onSectionClick: n
1012
+ }, r.id))
1013
+ }),
1014
+ rightContent: /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
1015
+ className: Ee.desktopRight,
1016
+ children: [
1017
+ r && /* @__PURE__ */ l("div", {
1018
+ className: Ee.extrasGroup,
1019
+ children: r
1020
+ }),
1021
+ /* @__PURE__ */ l(Se, {
1022
+ isOpen: f === "ally",
1023
+ onOpenChange: (e) => p(e ? "ally" : null)
1024
+ }),
1025
+ /* @__PURE__ */ l(we, { showAuth: i })
1026
+ ]
1027
+ }), /* @__PURE__ */ l(_e, {
1028
+ ref: _,
1029
+ isOpen: m,
1030
+ onClick: () => {
1031
+ p(null), g((e) => !e);
1032
+ },
1033
+ controlsId: v
1034
+ })] })
1035
+ }), /* @__PURE__ */ l(Te, {
1036
+ isOpen: m,
1037
+ onClose: () => g(!1),
1038
+ currentApp: e,
1039
+ activeSectionId: t,
1040
+ onSectionClick: n,
1041
+ rightExtras: r,
1042
+ showAuth: i,
1043
+ panelId: v,
1044
+ returnFocusRef: _
1045
+ })] });
1046
+ }, X = {
715
1047
  footer: "_footer_zjuj8_1",
716
1048
  content: "_content_zjuj8_7",
717
1049
  defaultContent: "_defaultContent_zjuj8_13",
718
1050
  copyright: "_copyright_zjuj8_21",
719
1051
  disclaimer: "_disclaimer_zjuj8_26"
720
- }, ve = ({ children: e, className: t = "" }) => /* @__PURE__ */ s("footer", {
721
- className: `${q.footer} ${t}`,
722
- children: /* @__PURE__ */ s("div", {
723
- className: q.content,
724
- children: e || /* @__PURE__ */ c("div", {
725
- className: q.defaultContent,
726
- children: [/* @__PURE__ */ c("p", {
727
- className: q.copyright,
1052
+ }, Oe = ({ children: e, className: t = "" }) => /* @__PURE__ */ l("footer", {
1053
+ className: `${X.footer} ${t}`,
1054
+ children: /* @__PURE__ */ l("div", {
1055
+ className: X.content,
1056
+ children: e || /* @__PURE__ */ u("div", {
1057
+ className: X.defaultContent,
1058
+ children: [/* @__PURE__ */ u("p", {
1059
+ className: X.copyright,
728
1060
  children: [
729
1061
  "© ",
730
1062
  (/* @__PURE__ */ new Date()).getFullYear(),
731
1063
  " The Astrogator's Table. All rights reserved."
732
1064
  ]
733
- }), /* @__PURE__ */ s("p", {
734
- className: q.disclaimer,
1065
+ }), /* @__PURE__ */ l("p", {
1066
+ className: X.disclaimer,
735
1067
  children: "Star Wars: Galaxy of Heroes is a trademark of Electronic Arts Inc."
736
1068
  })]
737
1069
  })
@@ -739,11 +1071,11 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
739
1071
  });
740
1072
  //#endregion
741
1073
  //#region src/utils/formatTime.ts
742
- function ye(e) {
1074
+ function ke(e) {
743
1075
  let t = /([zZ]|[+-]\d{2}:?\d{2})$/.test(e);
744
1076
  return new Date(t ? e : `${e}Z`);
745
1077
  }
746
- function be(e, t) {
1078
+ function Ae(e, t) {
747
1079
  let n = Math.max(0, Math.floor((t - e.getTime()) / 1e3));
748
1080
  if (n < 60) return `${n}s ago`;
749
1081
  let r = Math.floor(n / 60);
@@ -751,43 +1083,43 @@ function be(e, t) {
751
1083
  let i = Math.floor(r / 60);
752
1084
  return i < 24 ? `${i}h ago` : `${Math.floor(i / 24)}d ago`;
753
1085
  }
754
- function J(e) {
1086
+ function je(e) {
755
1087
  return `${Math.floor(e / 60)}:${(e % 60).toString().padStart(2, "0")}`;
756
1088
  }
757
- var Y = {
1089
+ var Me = {
758
1090
  rosterRefresh: "_rosterRefresh_1rbul_3",
759
1091
  updatedLabel: "_updatedLabel_1rbul_11",
760
1092
  refreshButton: "_refreshButton_1rbul_19",
761
1093
  spin: "_spin_1rbul_31"
762
- }, xe = ({ onRefresh: e, isRefreshing: t, cachedAt: n = null, refreshAvailableAt: r = null, labelPrefix: o = "Updated", className: l = "" }) => {
763
- let [u, d] = a(() => Date.now()), f = !!n || r != null && r > u;
764
- i(() => {
1094
+ }, Ne = ({ onRefresh: e, isRefreshing: t, cachedAt: n = null, refreshAvailableAt: r = null, labelPrefix: i = "Updated", className: o = "" }) => {
1095
+ let [c, d] = s(() => Date.now()), f = !!n || r != null && r > c;
1096
+ a(() => {
765
1097
  if (!f) return;
766
1098
  let e = setInterval(() => d(Date.now()), 1e3);
767
1099
  return () => clearInterval(e);
768
1100
  }, [f]);
769
- let p = r ? Math.max(0, Math.ceil((r - u) / 1e3)) : 0, h = n ? be(ye(n), u) : null, g = t || p > 0, _ = p > 0 ? `Fresh data available in ${J(p)}` : "Refresh roster";
770
- return /* @__PURE__ */ c("div", {
771
- className: `${Y.rosterRefresh} ${l}`,
772
- children: [h && /* @__PURE__ */ s("span", {
773
- className: Y.updatedLabel,
774
- title: _,
775
- children: p > 0 ? `${o} ${h} · fresh in ${J(p)}` : `${o} ${h}`
776
- }), /* @__PURE__ */ s(m, {
1101
+ 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";
1102
+ return /* @__PURE__ */ u("div", {
1103
+ className: `${Me.rosterRefresh} ${o}`,
1104
+ children: [m && /* @__PURE__ */ l("span", {
1105
+ className: Me.updatedLabel,
1106
+ title: g,
1107
+ children: p > 0 ? `${i} ${m} · fresh in ${je(p)}` : `${i} ${m}`
1108
+ }), /* @__PURE__ */ l(G, {
777
1109
  variant: "outline",
778
1110
  size: "sm",
779
1111
  onClick: e,
780
- disabled: g,
781
- title: _,
1112
+ disabled: h,
1113
+ title: g,
782
1114
  "aria-label": "Refresh roster",
783
- className: Y.refreshButton,
784
- children: /* @__PURE__ */ s("span", {
785
- className: t ? Y.spin : void 0,
1115
+ className: Me.refreshButton,
1116
+ children: /* @__PURE__ */ l("span", {
1117
+ className: t ? Me.spin : void 0,
786
1118
  children: "⟳"
787
1119
  })
788
1120
  })]
789
1121
  });
790
- }, X = {
1122
+ }, Z = {
791
1123
  card: "_card_1vw8g_1",
792
1124
  chamfered: "_chamfered_1vw8g_15",
793
1125
  default: "_default_1vw8g_20",
@@ -798,37 +1130,37 @@ var Y = {
798
1130
  "padding-md": "_padding-md_1vw8g_43",
799
1131
  "padding-lg": "_padding-lg_1vw8g_47",
800
1132
  hoverable: "_hoverable_1vw8g_52"
801
- }, Se = ({ children: e, variant: t = "default", chamfered: n = !1, chamferSize: r = "md", padding: i = "md", hoverable: a = !1, showDiagonalBorders: l = !0, edgeColor: u, className: d = "", onClick: f, style: p }) => {
802
- let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h = u ?? (n ? "var(--color-border)" : void 0), g = h ? { color: h } : void 0, _ = h ? {
1133
+ }, 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 }) => {
1134
+ 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
1135
  ...p,
804
1136
  "--card-edge-color": h
805
1137
  } : p;
806
- return /* @__PURE__ */ c("div", {
807
- className: `${X.card} ${n ? X.chamfered : ""} ${X[t]} ${X[`padding-${i}`]} ${m} ${a ? X.hoverable : ""} ${d}`,
1138
+ return /* @__PURE__ */ u("div", {
1139
+ className: `${Z.card} ${n ? Z.chamfered : ""} ${Z[t]} ${Z[`padding-${i}`]} ${m} ${a ? Z.hoverable : ""} ${d}`,
808
1140
  onClick: f,
809
1141
  role: f ? "button" : void 0,
810
1142
  tabIndex: f ? 0 : void 0,
811
1143
  style: _,
812
- children: [n && l && /* @__PURE__ */ c(o, { children: [
813
- /* @__PURE__ */ s("div", {
1144
+ children: [n && o && /* @__PURE__ */ u(c, { children: [
1145
+ /* @__PURE__ */ l("div", {
814
1146
  className: "chamfered-diagonal-border chamfered-diagonal-tl",
815
1147
  style: g
816
1148
  }),
817
- /* @__PURE__ */ s("div", {
1149
+ /* @__PURE__ */ l("div", {
818
1150
  className: "chamfered-diagonal-border chamfered-diagonal-tr",
819
1151
  style: g
820
1152
  }),
821
- /* @__PURE__ */ s("div", {
1153
+ /* @__PURE__ */ l("div", {
822
1154
  className: "chamfered-diagonal-border chamfered-diagonal-bl",
823
1155
  style: g
824
1156
  }),
825
- /* @__PURE__ */ s("div", {
1157
+ /* @__PURE__ */ l("div", {
826
1158
  className: "chamfered-diagonal-border chamfered-diagonal-br",
827
1159
  style: g
828
1160
  })
829
1161
  ] }), e]
830
1162
  });
831
- }, Z = {
1163
+ }, Fe = {
832
1164
  badge: "_badge_rk7t5_1",
833
1165
  sm: "_sm_rk7t5_11",
834
1166
  md: "_md_rk7t5_16",
@@ -840,8 +1172,8 @@ var Y = {
840
1172
  warning: "_warning_rk7t5_47",
841
1173
  error: "_error_rk7t5_52",
842
1174
  info: "_info_rk7t5_57"
843
- }, Ce = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ s("span", {
844
- className: `${Z.badge} ${Z[t]} ${Z[n]} ${r}`,
1175
+ }, Ie = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ l("span", {
1176
+ className: `${Fe.badge} ${Fe[t]} ${Fe[n]} ${r}`,
845
1177
  children: e
846
1178
  }), Q = {
847
1179
  overlay: "_overlay_1b3yt_1",
@@ -856,34 +1188,34 @@ var Y = {
856
1188
  title: "_title_1b3yt_53",
857
1189
  closeButton: "_closeButton_1b3yt_60",
858
1190
  content: "_content_1b3yt_78"
859
- }, we = ({ isOpen: e, onClose: t, title: n, children: r, size: a = "md", closeOnOverlayClick: o = !0, className: l = "" }) => (i(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
1191
+ }, 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
1192
  document.body.style.overflow = "unset";
861
- }), [e]), i(() => {
1193
+ }), [e]), a(() => {
862
1194
  let n = (n) => {
863
1195
  n.key === "Escape" && e && t();
864
1196
  };
865
1197
  return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
866
- }, [e, t]), e ? /* @__PURE__ */ s("div", {
1198
+ }, [e, t]), e ? /* @__PURE__ */ l("div", {
867
1199
  className: Q.overlay,
868
1200
  onClick: (e) => {
869
1201
  o && e.target === e.currentTarget && t();
870
1202
  },
871
- children: /* @__PURE__ */ c("div", {
872
- className: `${Q.modal} ${Q[a]} ${l}`,
1203
+ children: /* @__PURE__ */ u("div", {
1204
+ className: `${Q.modal} ${Q[i]} ${s}`,
873
1205
  role: "dialog",
874
1206
  "aria-modal": "true",
875
- children: [n && /* @__PURE__ */ c("div", {
1207
+ children: [n && /* @__PURE__ */ u("div", {
876
1208
  className: Q.header,
877
- children: [/* @__PURE__ */ s("h2", {
1209
+ children: [/* @__PURE__ */ l("h2", {
878
1210
  className: Q.title,
879
1211
  children: n
880
- }), /* @__PURE__ */ s("button", {
1212
+ }), /* @__PURE__ */ l("button", {
881
1213
  className: Q.closeButton,
882
1214
  onClick: t,
883
1215
  "aria-label": "Close modal",
884
1216
  children: "✕"
885
1217
  })]
886
- }), /* @__PURE__ */ s("div", {
1218
+ }), /* @__PURE__ */ l("div", {
887
1219
  className: Q.content,
888
1220
  children: r
889
1221
  })]
@@ -898,24 +1230,24 @@ var Y = {
898
1230
  dot: "_dot_1uhnh_34",
899
1231
  bounce: "_bounce_1uhnh_1",
900
1232
  visuallyHidden: "_visuallyHidden_1uhnh_91"
901
- }, Te = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ c("div", {
1233
+ }, Re = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ u("div", {
902
1234
  className: `${$.dots} ${$[e]} ${n}`,
903
1235
  children: [
904
- /* @__PURE__ */ s("span", { className: $.dot }),
905
- /* @__PURE__ */ s("span", { className: $.dot }),
906
- /* @__PURE__ */ s("span", { className: $.dot })
1236
+ /* @__PURE__ */ l("span", { className: $.dot }),
1237
+ /* @__PURE__ */ l("span", { className: $.dot }),
1238
+ /* @__PURE__ */ l("span", { className: $.dot })
907
1239
  ]
908
- }) : /* @__PURE__ */ s("div", {
1240
+ }) : /* @__PURE__ */ l("div", {
909
1241
  className: `${$.spinner} ${$[e]} ${n}`,
910
1242
  role: "status",
911
- children: /* @__PURE__ */ s("span", {
1243
+ children: /* @__PURE__ */ l("span", {
912
1244
  className: $.visuallyHidden,
913
1245
  children: "Loading..."
914
1246
  })
915
- }), Ee = async (e) => {
1247
+ }), ze = async (e) => {
916
1248
  if (e.length === 0) return {};
917
1249
  let t = [...new Set(e)], n = await L.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
918
1250
  return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
919
1251
  };
920
1252
  //#endregion
921
- export { ge as AllyCodeDropdown, se as ApiClient, me as AuthProvider, Ce as Badge, m as Button, Se as Card, u as Container, ve as Footer, v as Input, Te as Loader, we as Modal, _e as NavBar, xe as RosterRefresh, g as Select, f as TopBar, L as apiClient, oe as authedFetch, fe as clearAllyCodes, O as clearTokens, j as configureAuthRefresh, Ee as fetchUsernames, W as formatAllyCode, J as formatCountdown, be as formatRelativeTime, x as getAccessToken, B as getAllyCodesFromStorage, w as getRefreshToken, de as getSelectedAllyCode, ce as initializeApiClient, ee as isAuthenticated, ye as parseBackendTimestamp, M as refreshAccessToken, C as removeAccessToken, ue as removeAllyCodeFromStorage, E as removeRefreshToken, le as saveAllyCodeToStorage, S as setAccessToken, T as setRefreshToken, H as setSelectedAllyCode, D as setTokens, he as unformatAllyCode, V as updateAllyCodeLastUsed, U as useAuth };
1253
+ 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 };