astrogators-shared-ui 0.16.0 → 0.16.2

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