@pitvox/partner-react 0.7.20 → 0.7.22

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,12 +1,12 @@
1
- import { jsx as n, jsxs as l, Fragment as _ } from "react/jsx-runtime";
2
- import { createContext as Ee, useMemo as $, useContext as qe, useState as B, useCallback as K, useRef as _e, useEffect as je } from "react";
3
- import { useQueryClient as H, QueryClient as Ve, QueryClientProvider as Ke, useQuery as T, useMutation as Q, useQueries as me } from "@tanstack/react-query";
4
- const te = Ee(null), He = "https://cdn.pitvox.com", We = "https://pitvox.com";
5
- let X = null;
6
- function ut({
1
+ import { jsx as n, jsxs as l, Fragment as B } from "react/jsx-runtime";
2
+ import { createContext as He, useMemo as T, useContext as je, useState as E, useCallback as K, useRef as Ve, useEffect as We } from "react";
3
+ import { useQueryClient as O, QueryClient as Ke, QueryClientProvider as Oe, useQuery as $, useMutation as Y, useQueries as xe } from "@tanstack/react-query";
4
+ const ae = He(null), Ge = "https://cdn.pitvox.com", ze = "https://pitvox.com";
5
+ let te = null;
6
+ function Rt({
7
7
  partnerSlug: e = null,
8
- cdnUrl: r = He,
9
- pitvoxUrl: t = We,
8
+ cdnUrl: t = Ge,
9
+ pitvoxUrl: r = ze,
10
10
  getSteamId: s,
11
11
  onRegister: a,
12
12
  onWithdraw: i,
@@ -14,12 +14,12 @@ function ut({
14
14
  onMarkNotificationRead: d,
15
15
  onMarkAllNotificationsRead: p,
16
16
  onFetchServerPassword: c,
17
- children: h
17
+ children: u
18
18
  }) {
19
- const g = $(() => ({
19
+ const v = T(() => ({
20
20
  partnerSlug: e,
21
- cdnUrl: r.replace(/\/$/, ""),
22
- pitvoxUrl: t.replace(/\/$/, ""),
21
+ cdnUrl: t.replace(/\/$/, ""),
22
+ pitvoxUrl: r.replace(/\/$/, ""),
23
23
  getSteamId: s || (() => null),
24
24
  onRegister: a || null,
25
25
  onWithdraw: i || null,
@@ -27,68 +27,68 @@ function ut({
27
27
  onMarkNotificationRead: d || null,
28
28
  onMarkAllNotificationsRead: p || null,
29
29
  onFetchServerPassword: c || null
30
- }), [e, r, t, s, a, i, o, d, p, c]);
30
+ }), [e, t, r, s, a, i, o, d, p, c]);
31
31
  let f = !1;
32
32
  try {
33
- H(), f = !0;
33
+ O(), f = !0;
34
34
  } catch {
35
35
  f = !1;
36
36
  }
37
- return f ? /* @__PURE__ */ n(te.Provider, { value: g, children: h }) : (X || (X = new Ve({
37
+ return f ? /* @__PURE__ */ n(ae.Provider, { value: v, children: u }) : (te || (te = new Ke({
38
38
  defaultOptions: {
39
39
  queries: { staleTime: 6e4 }
40
40
  }
41
- })), /* @__PURE__ */ n(Ke, { client: X, children: /* @__PURE__ */ n(te.Provider, { value: g, children: h }) }));
41
+ })), /* @__PURE__ */ n(Oe, { client: te, children: /* @__PURE__ */ n(ae.Provider, { value: v, children: u }) }));
42
42
  }
43
43
  function L() {
44
- const e = qe(te);
44
+ const e = je(ae);
45
45
  if (!e)
46
46
  throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
47
47
  return e;
48
48
  }
49
- async function M(e, r) {
50
- const t = await fetch(`${e}/${r}`);
51
- if (!t.ok) {
52
- if (t.status === 404 || t.status === 403) return null;
53
- throw new Error(`CDN fetch failed: ${t.status}`);
49
+ async function D(e, t) {
50
+ const r = await fetch(`${e}/${t}`);
51
+ if (!r.ok) {
52
+ if (r.status === 404 || r.status === 403) return null;
53
+ throw new Error(`CDN fetch failed: ${r.status}`);
54
54
  }
55
- return t.json();
55
+ return r.json();
56
56
  }
57
- function re(e, r, t, ...s) {
57
+ function ie(e, t, r, ...s) {
58
58
  const a = ["leaderboards"];
59
- return e && a.push(`partners/${e}`), r && a.push(r), t && a.push(`v/${t}`), [...a, ...s].join("/");
59
+ return e && a.push(`partners/${e}`), t && a.push(t), r && a.push(`v/${r}`), [...a, ...s].join("/");
60
60
  }
61
- function Oe(e, r, t, s) {
61
+ function Qe(e, t, r, s) {
62
62
  const a = s || "default";
63
- return e ? `laps/partners/${e}/${r}/${t}/${a}.json` : `laps/${r}/${t}/${a}.json`;
63
+ return e ? `laps/partners/${e}/${t}/${r}/${a}.json` : `laps/${t}/${r}/${a}.json`;
64
64
  }
65
- function Ne(e, r) {
66
- return e ? `laps/partners/${e}/${r}/index.json` : `laps/${r}/index.json`;
65
+ function ye(e, t) {
66
+ return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
67
67
  }
68
- function ze(e) {
68
+ function Ye(e) {
69
69
  return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
70
70
  }
71
71
  function q(e) {
72
72
  if (!e && e !== 0) return "-";
73
- const r = Math.floor(e / 1e3), t = Math.floor(r / 60), s = r % 60, a = e % 1e3;
74
- return `${t}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
73
+ const t = Math.floor(e / 1e3), r = Math.floor(t / 60), s = t % 60, a = e % 1e3;
74
+ return `${r}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
75
75
  }
76
- function E(e) {
76
+ function F(e) {
77
77
  return !e && e !== 0 ? "-" : e >= 6e4 ? q(e) : (e / 1e3).toFixed(3);
78
78
  }
79
- function A(e) {
79
+ function _(e) {
80
80
  if (!e) return "";
81
- let r = e;
82
- return r.startsWith("ks_") && (r = r.slice(3)), r.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
81
+ let t = e;
82
+ return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
83
83
  }
84
- function j(e, r, t) {
84
+ function V(e, t, r) {
85
85
  if (!e) return "";
86
- const s = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = t === "acc" || !t && (r == null ? void 0 : r.toLowerCase()) === "track config";
87
- if (!r || r === "default" || a) return s;
88
- const i = r.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
86
+ const s = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = r === "acc" || !r && (t == null ? void 0 : t.toLowerCase()) === "track config";
87
+ if (!t || t === "default" || a) return s;
88
+ const i = t.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
89
89
  return `${s} ${i}`;
90
90
  }
91
- function W(e) {
91
+ function G(e) {
92
92
  if (!e) return "-";
93
93
  try {
94
94
  return new Date(e).toLocaleDateString("en-GB", {
@@ -100,25 +100,25 @@ function W(e) {
100
100
  return "-";
101
101
  }
102
102
  }
103
- function se(e) {
103
+ function oe(e) {
104
104
  if (!e) return "";
105
- const r = Date.now() - new Date(e).getTime(), t = Math.floor(r / 1e3);
106
- if (t < 60) return "Just now";
107
- const s = Math.floor(t / 60);
105
+ const t = Date.now() - new Date(e).getTime(), r = Math.floor(t / 1e3);
106
+ if (r < 60) return "Just now";
107
+ const s = Math.floor(r / 60);
108
108
  if (s < 60) return `${s}m ago`;
109
109
  const a = Math.floor(s / 60);
110
110
  if (a < 24) return `${a}h ago`;
111
111
  const i = Math.floor(a / 24);
112
- return i < 30 ? `${i}d ago` : W(e);
112
+ return i < 30 ? `${i}d ago` : G(e);
113
113
  }
114
- function ht(e) {
114
+ function Tt(e) {
115
115
  return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
116
116
  }
117
- function Qe(e, r) {
118
- const { type: t, title: s, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, h = a ? j(a, i, d) : null, g = o ? A(o) : null, f = [h, g].filter(Boolean).join(" — ");
119
- return t === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && r ? r(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : t === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
117
+ function Ze(e, t) {
118
+ const { type: r, title: s, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? V(a, i, d) : null, v = o ? _(o) : null, f = [u, v].filter(Boolean).join(" — ");
119
+ return r === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : r === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
120
120
  }
121
- function be(e) {
121
+ function ke(e) {
122
122
  return e ? {
123
123
  E: "Eco",
124
124
  RD: "Road",
@@ -132,108 +132,108 @@ function be(e) {
132
132
  S: "Soft"
133
133
  }[e] || e : "Unknown";
134
134
  }
135
- function ye(e) {
135
+ function we(e) {
136
136
  if (!e) return "-";
137
- const r = Number(e);
138
- return isNaN(r) ? "-" : r % 1 ? `${r.toFixed(1)}L` : `${r}L`;
139
- }
140
- function Ge(e = {}) {
141
- var p, c, h, g, f, u;
142
- const { cdnUrl: r, partnerSlug: t } = L(), { game: s, gameVersion: a } = e, i = re(t, null, null, "index.json"), o = T({
143
- queryKey: ["pitvox", "leaderboards", t, "index"],
144
- queryFn: () => M(r, i),
137
+ const t = Number(e);
138
+ return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
139
+ }
140
+ function Je(e = {}) {
141
+ var p, c, u, v, f, h;
142
+ const { cdnUrl: t, partnerSlug: r } = L(), { game: s, gameVersion: a } = e, i = ie(r, null, null, "index.json"), o = $({
143
+ queryKey: ["pitvox", "leaderboards", r, "index"],
144
+ queryFn: () => D(t, i),
145
145
  staleTime: 3e4,
146
146
  refetchInterval: 3e4
147
- }), d = $(() => {
148
- var x;
149
- if (!((x = o.data) != null && x.tracks)) return [];
150
- let y = o.data.tracks;
151
- return s && (y = y.filter((v) => v.game === s)), a && (y = y.filter((v) => v.gameVersion === a)), y.map((v) => ({
152
- id: v.trackId,
153
- layout: v.layout,
154
- game: v.game,
155
- gameVersion: v.gameVersion,
156
- displayName: j(v.trackId, v.layout, v.game),
157
- driverCount: v.driverCount || 0,
158
- carCount: v.carCount || 0,
159
- record: v.recordHolder ? {
160
- visibleId: v.recordHolder.steamId || v.recordHolder.userId,
161
- carId: v.recordHolder.carId,
162
- carDisplayName: A(v.recordHolder.carId),
163
- lapTimeMs: v.recordHolder.lapTimeMs,
164
- timestamp: v.recordHolder.recordedAt
147
+ }), d = T(() => {
148
+ var m;
149
+ if (!((m = o.data) != null && m.tracks)) return [];
150
+ let k = o.data.tracks;
151
+ return s && (k = k.filter((g) => g.game === s)), a && (k = k.filter((g) => g.gameVersion === a)), k.map((g) => ({
152
+ id: g.trackId,
153
+ layout: g.layout,
154
+ game: g.game,
155
+ gameVersion: g.gameVersion,
156
+ displayName: V(g.trackId, g.layout, g.game),
157
+ driverCount: g.driverCount || 0,
158
+ carCount: g.carCount || 0,
159
+ record: g.recordHolder ? {
160
+ visibleId: g.recordHolder.steamId || g.recordHolder.userId,
161
+ carId: g.recordHolder.carId,
162
+ carDisplayName: _(g.recordHolder.carId),
163
+ lapTimeMs: g.recordHolder.lapTimeMs,
164
+ timestamp: g.recordHolder.recordedAt
165
165
  } : null,
166
- recordByTag: v.recordByTag || null
166
+ recordByTag: g.recordByTag || null
167
167
  }));
168
168
  }, [(p = o.data) == null ? void 0 : p.tracks, s, a]);
169
169
  return {
170
170
  ...o,
171
171
  data: d,
172
172
  partner: ((c = o.data) == null ? void 0 : c.partner) || null,
173
- generatedAt: (h = o.data) == null ? void 0 : h.generatedAt,
174
- totalLaps: ((g = o.data) == null ? void 0 : g.totalLaps) || 0,
173
+ generatedAt: (u = o.data) == null ? void 0 : u.generatedAt,
174
+ totalLaps: ((v = o.data) == null ? void 0 : v.totalLaps) || 0,
175
175
  totalUsers: ((f = o.data) == null ? void 0 : f.totalUsers) || 0,
176
- versions: ((u = o.data) == null ? void 0 : u.versions) || {}
176
+ versions: ((h = o.data) == null ? void 0 : h.versions) || {}
177
177
  };
178
178
  }
179
- function Ye(e, r, t = {}) {
180
- const { cdnUrl: s, partnerSlug: a } = L(), { carId: i, game: o, gameVersion: d } = t, p = r || "default", c = re(a, o, d, `tracks/${e}/${p}.json`), { data: h, isLoading: g, error: f } = T({
179
+ function Xe(e, t, r = {}) {
180
+ const { cdnUrl: s, partnerSlug: a } = L(), { carId: i, game: o, gameVersion: d } = r, p = t || "default", c = ie(a, o, d, `tracks/${e}/${p}.json`), { data: u, isLoading: v, error: f } = $({
181
181
  queryKey: ["pitvox", "leaderboards", a, "track", e, p, o, d],
182
- queryFn: () => M(s, c),
182
+ queryFn: () => D(s, c),
183
183
  enabled: !!e,
184
184
  staleTime: 3e4,
185
185
  refetchInterval: 3e4
186
186
  });
187
- return { data: $(() => {
188
- if (!(h != null && h.entries)) return [];
189
- let y = h.entries;
190
- if (o && (y = y.filter((x) => x.game === o)), !i) {
191
- const x = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
192
- for (const N of y) {
193
- const m = N.steamId || N.userId;
194
- v.has(N.carId) || v.set(N.carId, /* @__PURE__ */ new Set()), v.get(N.carId).add(m), (!x.has(N.carId) || N.lapTimeMs < x.get(N.carId).lapTimeMs) && x.set(N.carId, N);
187
+ return { data: T(() => {
188
+ if (!(u != null && u.entries)) return [];
189
+ let k = u.entries;
190
+ if (o && (k = k.filter((m) => m.game === o)), !i) {
191
+ const m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
192
+ for (const b of k) {
193
+ const x = b.steamId || b.userId;
194
+ g.has(b.carId) || g.set(b.carId, /* @__PURE__ */ new Set()), g.get(b.carId).add(x), (!m.has(b.carId) || b.lapTimeMs < m.get(b.carId).lapTimeMs) && m.set(b.carId, b);
195
195
  }
196
- return Array.from(x.values()).map((N) => {
197
- var m;
198
- return { ...N, driverCount: ((m = v.get(N.carId)) == null ? void 0 : m.size) || 0 };
199
- }).sort((N, m) => N.lapTimeMs - m.lapTimeMs);
196
+ return Array.from(m.values()).map((b) => {
197
+ var x;
198
+ return { ...b, driverCount: ((x = g.get(b.carId)) == null ? void 0 : x.size) || 0 };
199
+ }).sort((b, x) => b.lapTimeMs - x.lapTimeMs);
200
200
  }
201
- return y.filter((x) => x.carId === i).sort((x, v) => x.lapTimeMs - v.lapTimeMs);
202
- }, [h == null ? void 0 : h.entries, i, o]), isLoading: g, error: f };
203
- }
204
- function Je(e, r, t, s, a = {}) {
205
- var x, v;
206
- const { cdnUrl: i, partnerSlug: o } = L(), { showInvalid: d = !1, game: p, gameVersion: c } = a, h = e && r ? Oe(o, e, r, t) : null, f = T({
207
- queryKey: ["pitvox", "laps", o, e, r, t || "default"],
208
- queryFn: () => M(i, h),
209
- enabled: !!e && !!r,
201
+ return k.filter((m) => m.carId === i).sort((m, g) => m.lapTimeMs - g.lapTimeMs);
202
+ }, [u == null ? void 0 : u.entries, i, o]), isLoading: v, error: f };
203
+ }
204
+ function en(e, t, r, s, a = {}) {
205
+ var m, g;
206
+ const { cdnUrl: i, partnerSlug: o } = L(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && t ? Qe(o, e, t, r) : null, f = $({
207
+ queryKey: ["pitvox", "laps", o, e, t, r || "default"],
208
+ queryFn: () => D(i, u),
209
+ enabled: !!e && !!t,
210
210
  staleTime: 3e4,
211
211
  refetchInterval: 3e4
212
- }), u = $(() => {
213
- var N;
214
- return (N = f.data) != null && N.laps ? f.data.laps.filter((m) => !(m.carId !== s || p && m.game !== p || c && m.gameVersion !== c || !d && !m.isValid)).sort((m, k) => m.lapTimeMs - k.lapTimeMs) : [];
215
- }, [(x = f.data) == null ? void 0 : x.laps, s, p, c, d]), y = $(() => {
216
- const N = u.filter((b) => b.isValid && b.sector1Ms && b.sector2Ms && b.sector3Ms);
217
- if (N.length < 2) return null;
218
- const m = Math.min(...N.map((b) => b.sector1Ms)), k = Math.min(...N.map((b) => b.sector2Ms)), w = Math.min(...N.map((b) => b.sector3Ms)), C = m + k + w, D = Math.min(...N.map((b) => b.lapTimeMs));
219
- return C >= D ? null : { lapTimeMs: C, sector1Ms: m, sector2Ms: k, sector3Ms: w };
220
- }, [u]);
212
+ }), h = T(() => {
213
+ var b;
214
+ return (b = f.data) != null && b.laps ? f.data.laps.filter((x) => !(x.carId !== s || p && x.game !== p || c && x.gameVersion !== c || !d && !x.isValid)).sort((x, w) => x.lapTimeMs - w.lapTimeMs) : [];
215
+ }, [(m = f.data) == null ? void 0 : m.laps, s, p, c, d]), k = T(() => {
216
+ const b = h.filter((N) => N.isValid && N.sector1Ms && N.sector2Ms && N.sector3Ms);
217
+ if (b.length < 2) return null;
218
+ const x = Math.min(...b.map((N) => N.sector1Ms)), w = Math.min(...b.map((N) => N.sector2Ms)), C = Math.min(...b.map((N) => N.sector3Ms)), M = x + w + C, P = Math.min(...b.map((N) => N.lapTimeMs));
219
+ return M >= P ? null : { lapTimeMs: M, sector1Ms: x, sector2Ms: w, sector3Ms: C };
220
+ }, [h]);
221
221
  return {
222
222
  ...f,
223
- data: u,
224
- driverName: ((v = f.data) == null ? void 0 : v.driverName) || "Driver",
225
- theoreticalBest: y
223
+ data: h,
224
+ driverName: ((g = f.data) == null ? void 0 : g.driverName) || "Driver",
225
+ theoreticalBest: k
226
226
  };
227
227
  }
228
- function ke() {
229
- const { cdnUrl: e } = L(), { data: r } = T({
228
+ function Ce() {
229
+ const { cdnUrl: e } = L(), { data: t } = $({
230
230
  queryKey: ["pitvox", "users", "index"],
231
- queryFn: () => M(e, "users/index.json"),
231
+ queryFn: () => D(e, "users/index.json"),
232
232
  staleTime: 5 * 6e4,
233
233
  gcTime: 30 * 6e4
234
- }), t = (r == null ? void 0 : r.users) || {};
234
+ }), r = (t == null ? void 0 : t.users) || {};
235
235
  return (s, a) => {
236
- const i = t[s];
236
+ const i = r[s];
237
237
  return {
238
238
  displayName: (i == null ? void 0 : i.displayName) || a || s || "Unknown",
239
239
  avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
@@ -241,25 +241,25 @@ function ke() {
241
241
  };
242
242
  };
243
243
  }
244
- function mt(e = "evo") {
245
- const { cdnUrl: r } = L(), { data: t } = T({
244
+ function $t(e = "evo") {
245
+ const { cdnUrl: t } = L(), { data: r } = $({
246
246
  queryKey: ["pitvox", "cars", e],
247
- queryFn: () => M(r, `cars/${e}.json`),
247
+ queryFn: () => D(t, `cars/${e}.json`),
248
248
  staleTime: 5 * 6e4,
249
249
  gcTime: 30 * 6e4
250
250
  });
251
251
  return {
252
- tags: (t == null ? void 0 : t.tags) || [],
253
- cars: (t == null ? void 0 : t.cars) || {},
254
- categories: (t == null ? void 0 : t.categories) || [],
255
- tagLabels: (t == null ? void 0 : t.tagLabels) || {}
252
+ tags: (r == null ? void 0 : r.tags) || [],
253
+ cars: (r == null ? void 0 : r.cars) || {},
254
+ categories: (r == null ? void 0 : r.categories) || [],
255
+ tagLabels: (r == null ? void 0 : r.tagLabels) || {}
256
256
  };
257
257
  }
258
- function vt() {
258
+ function Mt() {
259
259
  var a, i;
260
- const { cdnUrl: e, partnerSlug: r } = L(), t = ze(r), s = T({
261
- queryKey: ["pitvox", "recentLaps", r],
262
- queryFn: () => M(e, t),
260
+ const { cdnUrl: e, partnerSlug: t } = L(), r = Ye(t), s = $({
261
+ queryKey: ["pitvox", "recentLaps", t],
262
+ queryFn: () => D(e, r),
263
263
  staleTime: 3e4,
264
264
  refetchInterval: 3e4,
265
265
  gcTime: 10 * 6e4
@@ -270,103 +270,112 @@ function vt() {
270
270
  isLoading: s.isLoading
271
271
  };
272
272
  }
273
- function xt(e, r) {
274
- return Ye(e, null, { carId: r });
273
+ function Dt(e, t) {
274
+ return Xe(e, null, { carId: t });
275
275
  }
276
- function gt() {
277
- const { cdnUrl: e, partnerSlug: r } = L();
278
- return T({
279
- queryKey: ["pitvox", "competitions", r],
276
+ function At() {
277
+ const { cdnUrl: e, partnerSlug: t } = L();
278
+ return $({
279
+ queryKey: ["pitvox", "competitions", t],
280
280
  queryFn: async () => {
281
- const t = await M(e, "competitions/index.json");
282
- return t != null && t.competitions ? r ? t.competitions.filter((s) => s.partnerSlug === r) : t.competitions : [];
281
+ const r = await D(e, "competitions/index.json");
282
+ return r != null && r.competitions ? t ? r.competitions.filter((s) => s.partnerSlug === t) : r.competitions : [];
283
283
  },
284
284
  staleTime: 6e4
285
285
  });
286
286
  }
287
- function we(e, r = {}) {
288
- const t = L(), s = r.partnerSlug || t.partnerSlug;
289
- return T({
287
+ function Se(e, t = {}) {
288
+ const r = L(), s = t.partnerSlug || r.partnerSlug;
289
+ return $({
290
290
  queryKey: ["pitvox", "competition", s, e, "config"],
291
- queryFn: () => M(t.cdnUrl, `competitions/${s}/${e}/config.json`),
291
+ queryFn: () => D(r.cdnUrl, `competitions/${s}/${e}/config.json`),
292
292
  enabled: !!s && !!e,
293
293
  staleTime: 6e4
294
294
  });
295
295
  }
296
- function Ce(e, r = {}) {
297
- const t = L(), s = r.partnerSlug || t.partnerSlug;
298
- return T({
296
+ function Le(e, t = {}) {
297
+ const r = L(), s = t.partnerSlug || r.partnerSlug;
298
+ return $({
299
299
  queryKey: ["pitvox", "competition", s, e, "standings"],
300
- queryFn: () => M(t.cdnUrl, `competitions/${s}/${e}/standings.json`),
300
+ queryFn: () => D(r.cdnUrl, `competitions/${s}/${e}/standings.json`),
301
301
  enabled: !!s && !!e,
302
302
  staleTime: 6e4
303
303
  });
304
304
  }
305
- function Ze(e, r, t = {}) {
306
- const s = L(), a = t.partnerSlug || s.partnerSlug;
307
- return T({
308
- queryKey: ["pitvox", "competition", a, e, "round", r],
309
- queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${r}.json`),
310
- enabled: !!a && !!e && r != null,
305
+ function nn(e, t, r = {}) {
306
+ const s = L(), a = r.partnerSlug || s.partnerSlug;
307
+ return $({
308
+ queryKey: ["pitvox", "competition", a, e, "round", t],
309
+ queryFn: () => D(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
310
+ enabled: !!a && !!e && t != null,
311
311
  staleTime: 6e4
312
312
  });
313
313
  }
314
- function Xe(e, r = [], t = {}) {
315
- const s = L(), a = t.partnerSlug || s.partnerSlug;
316
- return T({
317
- queryKey: ["pitvox", "competition", a, e, "allRounds", r],
314
+ function tn(e, t = [], r = {}) {
315
+ const s = L(), a = r.partnerSlug || s.partnerSlug;
316
+ return $({
317
+ queryKey: ["pitvox", "competition", a, e, "allRounds", t],
318
318
  queryFn: async () => (await Promise.all(
319
- r.map(
320
- (o) => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
319
+ t.map(
320
+ (o) => D(s.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
321
321
  )
322
322
  )).filter(Boolean),
323
- enabled: !!a && !!e && r.length > 0,
323
+ enabled: !!a && !!e && t.length > 0,
324
324
  staleTime: 6e4
325
325
  });
326
326
  }
327
- function en(e, r = {}) {
328
- const t = L(), s = r.partnerSlug || t.partnerSlug;
329
- return T({
327
+ function rn(e, t = {}) {
328
+ const r = L(), s = t.partnerSlug || r.partnerSlug;
329
+ return $({
330
330
  queryKey: ["pitvox", "competition", s, e, "leaderboard"],
331
- queryFn: () => M(t.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
331
+ queryFn: () => D(r.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
332
332
  enabled: !!s && !!e,
333
333
  staleTime: 6e4
334
334
  });
335
335
  }
336
- function nn(e, r, t = {}) {
337
- const s = L(), a = t.partnerSlug || s.partnerSlug;
338
- return T({
339
- queryKey: ["pitvox", "competition", a, e, "round", r, "laps"],
340
- queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${r}/laps.json`).catch(() => null),
341
- enabled: !!a && !!e && r != null,
336
+ function sn(e, t, r = {}) {
337
+ const s = L(), a = r.partnerSlug || s.partnerSlug;
338
+ return $({
339
+ queryKey: ["pitvox", "competition", a, e, "round", t, "leaderboard"],
340
+ queryFn: () => D(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/leaderboard.json`).catch(() => null),
341
+ enabled: !!a && !!e && t != null,
342
+ staleTime: 6e4
343
+ });
344
+ }
345
+ function an(e, t, r = {}) {
346
+ const s = L(), a = r.partnerSlug || s.partnerSlug;
347
+ return $({
348
+ queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
349
+ queryFn: () => D(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
350
+ enabled: !!a && !!e && t != null,
342
351
  staleTime: 6e4
343
352
  });
344
353
  }
345
- function tn(e, r, t = {}) {
346
- const s = L(), a = t.partnerSlug || s.partnerSlug;
347
- return T({
348
- queryKey: ["pitvox", "competition", a, e, "round", r, "positions"],
349
- queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${r}/positions.json`).catch(() => null),
350
- enabled: (t.enabled ?? !0) && !!a && !!e && r != null,
354
+ function on(e, t, r = {}) {
355
+ const s = L(), a = r.partnerSlug || s.partnerSlug;
356
+ return $({
357
+ queryKey: ["pitvox", "competition", a, e, "round", t, "positions"],
358
+ queryFn: () => D(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/positions.json`).catch(() => null),
359
+ enabled: (r.enabled ?? !0) && !!a && !!e && t != null,
351
360
  staleTime: 6e4
352
361
  });
353
362
  }
354
- function Le(e, r = {}) {
355
- const t = L(), s = r.partnerSlug || t.partnerSlug;
356
- return T({
363
+ function Re(e, t = {}) {
364
+ const r = L(), s = t.partnerSlug || r.partnerSlug;
365
+ return $({
357
366
  queryKey: ["pitvox", "competition", s, e, "entrylist"],
358
- queryFn: () => M(t.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
367
+ queryFn: () => D(r.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
359
368
  enabled: !!s && !!e,
360
369
  staleTime: 6e4
361
370
  });
362
371
  }
363
- function ae(e) {
364
- const { cdnUrl: r, partnerSlug: t, getSteamId: s } = L(), a = s();
365
- return T({
366
- queryKey: ["pitvox", "registration", t, e, a],
372
+ function le(e) {
373
+ const { cdnUrl: t, partnerSlug: r, getSteamId: s } = L(), a = s();
374
+ return $({
375
+ queryKey: ["pitvox", "registration", r, e, a],
367
376
  queryFn: async () => {
368
377
  var p;
369
- const i = await fetch(`${r}/competitions/${t}/${e}/entrylist.json`);
378
+ const i = await fetch(`${t}/competitions/${r}/${e}/entrylist.json`);
370
379
  if (!i.ok) return { isRegistered: !1, entryList: null };
371
380
  const o = await i.json();
372
381
  return { isRegistered: !!a && ((p = o.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: o };
@@ -375,20 +384,20 @@ function ae(e) {
375
384
  staleTime: 6e4
376
385
  });
377
386
  }
378
- function Se(e) {
379
- const { onRegister: r, partnerSlug: t, getSteamId: s } = L(), a = H(), i = ke();
380
- return Q({
387
+ function Te(e) {
388
+ const { onRegister: t, partnerSlug: r, getSteamId: s } = L(), a = O(), i = Ce();
389
+ return Y({
381
390
  mutationFn: (o) => {
382
- if (!r)
391
+ if (!t)
383
392
  throw new Error(
384
393
  "No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
385
394
  );
386
- return r(e, o);
395
+ return t(e, o);
387
396
  },
388
397
  onSuccess: () => {
389
398
  const o = s();
390
399
  if (a.setQueriesData(
391
- { queryKey: ["pitvox", "registration", t, e] },
400
+ { queryKey: ["pitvox", "registration", r, e] },
392
401
  (d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
393
402
  ), o) {
394
403
  const d = i(o), p = {
@@ -397,10 +406,10 @@ function Se(e) {
397
406
  avatarUrl: d.avatarUrl
398
407
  };
399
408
  a.setQueriesData(
400
- { queryKey: ["pitvox", "competition", t, e, "entrylist"] },
409
+ { queryKey: ["pitvox", "competition", r, e, "entrylist"] },
401
410
  (c) => {
402
- var g;
403
- return c ? ((g = c.drivers) == null ? void 0 : g.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
411
+ var v;
412
+ return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
404
413
  }
405
414
  );
406
415
  }
@@ -408,115 +417,115 @@ function Se(e) {
408
417
  });
409
418
  }
410
419
  function $e(e) {
411
- const { onWithdraw: r, partnerSlug: t, getSteamId: s } = L(), a = H();
412
- return Q({
420
+ const { onWithdraw: t, partnerSlug: r, getSteamId: s } = L(), a = O();
421
+ return Y({
413
422
  mutationFn: (i) => {
414
- if (!r)
423
+ if (!t)
415
424
  throw new Error(
416
425
  "No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
417
426
  );
418
427
  const o = i || s();
419
428
  if (!o) throw new Error("No Steam ID available");
420
- return r(e, o);
429
+ return t(e, o);
421
430
  },
422
431
  onSuccess: () => {
423
432
  const i = s();
424
433
  a.setQueriesData(
425
- { queryKey: ["pitvox", "registration", t, e] },
434
+ { queryKey: ["pitvox", "registration", r, e] },
426
435
  (o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
427
436
  ), i && a.setQueriesData(
428
- { queryKey: ["pitvox", "competition", t, e, "entrylist"] },
437
+ { queryKey: ["pitvox", "competition", r, e, "entrylist"] },
429
438
  (o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
430
439
  );
431
440
  }
432
441
  });
433
442
  }
434
- function ie() {
435
- const { onRegister: e, onWithdraw: r } = L(), t = !!(e && r);
436
- return { isPowerMode: t, isBasicMode: !t };
443
+ function ce() {
444
+ const { onRegister: e, onWithdraw: t } = L(), r = !!(e && t);
445
+ return { isPowerMode: r, isBasicMode: !r };
437
446
  }
438
- function oe(e) {
439
- const { pitvoxUrl: r, partnerSlug: t } = L();
440
- return `${r}/p/${t}/competitions/${e}/register`;
447
+ function de(e) {
448
+ const { pitvoxUrl: t, partnerSlug: r } = L();
449
+ return `${t}/p/${r}/competitions/${e}/register`;
441
450
  }
442
- function rn(e, r) {
443
- for (const t of r)
444
- if (t.tags.includes(e)) return t.id;
451
+ function ln(e, t) {
452
+ for (const r of t)
453
+ if (r.tags.includes(e)) return r.id;
445
454
  return "other";
446
455
  }
447
- function Re(e, r, t = []) {
448
- if (r.size === 0) return !0;
456
+ function Me(e, t, r = []) {
457
+ if (t.size === 0) return !0;
449
458
  const s = {};
450
- for (const a of r) {
451
- const i = rn(a, t);
459
+ for (const a of t) {
460
+ const i = ln(a, r);
452
461
  s[i] || (s[i] = []), s[i].push(a);
453
462
  }
454
463
  for (const a of Object.values(s))
455
464
  if (!a.some((i) => e.includes(i))) return !1;
456
465
  return !0;
457
466
  }
458
- function Te(e, r) {
459
- const [t, s] = B(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : t, o = K((p) => {
467
+ function De(e, t) {
468
+ const [r, s] = E(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : r, o = K((p) => {
460
469
  const c = new Set(i);
461
- c.has(p) ? c.delete(p) : c.add(p), a && r ? r(c) : s(c);
462
- }, [i, a, r]), d = K(() => {
463
- a && r ? r(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
464
- }, [a, r]);
470
+ c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) : s(c);
471
+ }, [i, a, t]), d = K(() => {
472
+ a && t ? t(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
473
+ }, [a, t]);
465
474
  return { activeTags: i, toggle: o, clear: d };
466
475
  }
467
- function G(e) {
468
- const [r, t] = B(e), s = K((a) => {
469
- t(
476
+ function Z(e) {
477
+ const [t, r] = E(e), s = K((a) => {
478
+ r(
470
479
  (i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
471
480
  );
472
481
  }, []);
473
- return [r, s];
482
+ return [t, s];
474
483
  }
475
- function Y(e, r, t) {
484
+ function J(e, t, r) {
476
485
  return [...e].sort((s, a) => {
477
- const i = t(s, r.key), o = t(a, r.key);
486
+ const i = r(s, t.key), o = r(a, t.key);
478
487
  if (i == null && o == null) return 0;
479
488
  if (i == null) return 1;
480
489
  if (o == null) return -1;
481
490
  const d = typeof i == "string" ? i.localeCompare(o) : i - o;
482
- return r.dir === "desc" ? -d : d;
491
+ return t.dir === "desc" ? -d : d;
483
492
  });
484
493
  }
485
- function Me(e, r = !1) {
486
- const t = r ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
487
- return t != null && t.length ? {
488
- s1: Math.min(...t.map((s) => s.sector1Ms).filter(Boolean)),
489
- s2: Math.min(...t.map((s) => s.sector2Ms).filter(Boolean)),
490
- s3: Math.min(...t.map((s) => s.sector3Ms).filter(Boolean))
494
+ function Ae(e, t = !1) {
495
+ const r = t ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
496
+ return r != null && r.length ? {
497
+ s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
498
+ s2: Math.min(...r.map((s) => s.sector2Ms).filter(Boolean)),
499
+ s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
491
500
  } : null;
492
501
  }
493
- function sn({ active: e, dir: r }) {
494
- return e ? r === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
502
+ function cn({ active: e, dir: t }) {
503
+ return e ? t === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
495
504
  }
496
- function P({ label: e, sortKey: r, config: t, onSort: s, className: a = "" }) {
505
+ function I({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
497
506
  return /* @__PURE__ */ n(
498
507
  "th",
499
508
  {
500
509
  className: `pvx-th pvx-th--sortable ${a}`,
501
- onClick: () => s(r),
510
+ onClick: () => s(t),
502
511
  children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
503
512
  e,
504
- /* @__PURE__ */ n(sn, { active: t.key === r, dir: t.dir })
513
+ /* @__PURE__ */ n(cn, { active: r.key === t, dir: r.dir })
505
514
  ] })
506
515
  }
507
516
  );
508
517
  }
509
- function J({ userId: e, getUserDisplay: r }) {
510
- const { displayName: t, avatarUrl: s } = r(e);
518
+ function X({ userId: e, getUserDisplay: t }) {
519
+ const { displayName: r, avatarUrl: s } = t(e);
511
520
  return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
512
521
  s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
513
- /* @__PURE__ */ n("span", { className: "pvx-driver-name", children: t })
522
+ /* @__PURE__ */ n("span", { className: "pvx-driver-name", children: r })
514
523
  ] });
515
524
  }
516
- function le({ rank: e, podium: r = !1 }) {
517
- return /* @__PURE__ */ n("span", { className: r ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
525
+ function pe({ rank: e, podium: t = !1 }) {
526
+ return /* @__PURE__ */ n("span", { className: t ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
518
527
  }
519
- function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categories: a = [], tagLabels: i = {} }) {
528
+ function Pe({ availableTags: e, activeTags: t, onToggle: r, onClear: s, categories: a = [], tagLabels: i = {} }) {
520
529
  if (!e || e.length < 2) return null;
521
530
  const o = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
522
531
  return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
@@ -524,7 +533,7 @@ function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categori
524
533
  "button",
525
534
  {
526
535
  onClick: s,
527
- className: `pvx-tag ${r.size === 0 ? "pvx-tag--active" : ""}`,
536
+ className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
528
537
  children: "All"
529
538
  }
530
539
  ),
@@ -533,8 +542,8 @@ function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categori
533
542
  d.tags.map((c) => /* @__PURE__ */ n(
534
543
  "button",
535
544
  {
536
- onClick: () => t(c),
537
- className: `pvx-tag ${r.has(c) ? "pvx-tag--active" : ""}`,
545
+ onClick: () => r(c),
546
+ className: `pvx-tag ${t.has(c) ? "pvx-tag--active" : ""}`,
538
547
  children: i[c] || c
539
548
  },
540
549
  c
@@ -542,156 +551,156 @@ function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categori
542
551
  ] }, d.id))
543
552
  ] });
544
553
  }
545
- function ce({ segments: e }) {
546
- return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((r, t) => {
547
- const s = t === e.length - 1;
554
+ function ue({ segments: e }) {
555
+ return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, r) => {
556
+ const s = r === e.length - 1;
548
557
  return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
549
- t > 0 && /* @__PURE__ */ n("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
550
- !s && r.onClick ? /* @__PURE__ */ n("button", { onClick: r.onClick, className: "pvx-breadcrumb-link", children: r.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: r.label })
551
- ] }, r.key);
558
+ r > 0 && /* @__PURE__ */ n("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
559
+ !s && t.onClick ? /* @__PURE__ */ n("button", { onClick: t.onClick, className: "pvx-breadcrumb-link", children: t.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: t.label })
560
+ ] }, t.key);
552
561
  }) }) });
553
562
  }
554
- function O({ message: e }) {
563
+ function z({ message: e }) {
555
564
  return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
556
565
  /* @__PURE__ */ n("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-4.5A3.375 3.375 0 0013.125 10.875h-2.25A3.375 3.375 0 007.5 14.25v4.5" }) }),
557
566
  /* @__PURE__ */ n("p", { children: e })
558
567
  ] });
559
568
  }
560
- function z() {
569
+ function Q() {
561
570
  return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
562
571
  }
563
- function an() {
572
+ function dn() {
564
573
  return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
565
574
  }
566
- function on() {
575
+ function pn() {
567
576
  return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
568
577
  }
569
- function ft({ tracks: e, isLoading: r, carMetadata: t, getUserDisplay: s, onTrackSelect: a, tags: i, onTagChange: o }) {
570
- const [d, p] = G({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: h, clear: g } = Te(i, o), f = $(() => {
571
- var v;
572
- if (!((v = t == null ? void 0 : t.tags) != null && v.length)) return [];
573
- const x = /* @__PURE__ */ new Set();
574
- for (const N of e || [])
575
- N.recordByTag && Object.keys(N.recordByTag).forEach((m) => x.add(m));
576
- return t.tags.filter((N) => x.has(N));
577
- }, [e, t]), u = $(() => e ? c.size === 0 ? e : e.map((x) => {
578
- var m, k;
579
- if (!x.recordByTag) return null;
580
- let v = null;
581
- const N = /* @__PURE__ */ new Set();
582
- for (const w of Object.values(x.recordByTag)) {
583
- if (N.has(w.carId)) continue;
584
- N.add(w.carId);
585
- const C = ((k = (m = t == null ? void 0 : t.cars) == null ? void 0 : m[w.carId]) == null ? void 0 : k.tags) || [];
586
- Re(C, c, t == null ? void 0 : t.categories) && (!v || w.lapTimeMs < v.lapTimeMs) && (v = w);
578
+ function Pt({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrackSelect: a, tags: i, onTagChange: o }) {
579
+ const [d, p] = Z({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: v } = De(i, o), f = T(() => {
580
+ var g;
581
+ if (!((g = r == null ? void 0 : r.tags) != null && g.length)) return [];
582
+ const m = /* @__PURE__ */ new Set();
583
+ for (const b of e || [])
584
+ b.recordByTag && Object.keys(b.recordByTag).forEach((x) => m.add(x));
585
+ return r.tags.filter((b) => m.has(b));
586
+ }, [e, r]), h = T(() => e ? c.size === 0 ? e : e.map((m) => {
587
+ var x, w;
588
+ if (!m.recordByTag) return null;
589
+ let g = null;
590
+ const b = /* @__PURE__ */ new Set();
591
+ for (const C of Object.values(m.recordByTag)) {
592
+ if (b.has(C.carId)) continue;
593
+ b.add(C.carId);
594
+ const M = ((w = (x = r == null ? void 0 : r.cars) == null ? void 0 : x[C.carId]) == null ? void 0 : w.tags) || [];
595
+ Me(M, c, r == null ? void 0 : r.categories) && (!g || C.lapTimeMs < g.lapTimeMs) && (g = C);
587
596
  }
588
- return v ? {
589
- ...x,
597
+ return g ? {
598
+ ...m,
590
599
  record: {
591
- visibleId: v.steamId || v.identifier,
592
- carId: v.carId,
593
- carDisplayName: A(v.carId),
594
- lapTimeMs: v.lapTimeMs,
595
- timestamp: v.recordedAt
600
+ visibleId: g.steamId || g.identifier,
601
+ carId: g.carId,
602
+ carDisplayName: _(g.carId),
603
+ lapTimeMs: g.lapTimeMs,
604
+ timestamp: g.recordedAt
596
605
  }
597
606
  } : null;
598
- }).filter(Boolean) : [], [e, c, t]), y = $(() => Y(u, d, (x, v) => {
599
- var N, m;
600
- switch (v) {
607
+ }).filter(Boolean) : [], [e, c, r]), k = T(() => J(h, d, (m, g) => {
608
+ var b, x;
609
+ switch (g) {
601
610
  case "displayName":
602
- return x.displayName;
611
+ return m.displayName;
603
612
  case "record.lapTimeMs":
604
- return (N = x.record) == null ? void 0 : N.lapTimeMs;
613
+ return (b = m.record) == null ? void 0 : b.lapTimeMs;
605
614
  case "driverCount":
606
- return x.driverCount || 0;
615
+ return m.driverCount || 0;
607
616
  case "carCount":
608
- return x.carCount || 0;
617
+ return m.carCount || 0;
609
618
  case "record.timestamp":
610
619
  default:
611
- return (m = x.record) != null && m.timestamp ? new Date(x.record.timestamp).getTime() : 0;
620
+ return (x = m.record) != null && x.timestamp ? new Date(m.record.timestamp).getTime() : 0;
612
621
  }
613
- }), [u, d]);
614
- return r ? /* @__PURE__ */ n(z, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
622
+ }), [h, d]);
623
+ return t ? /* @__PURE__ */ n(Q, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
615
624
  /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
616
625
  /* @__PURE__ */ n(
617
- De,
626
+ Pe,
618
627
  {
619
628
  availableTags: f,
620
629
  activeTags: c,
621
- onToggle: h,
622
- onClear: g,
623
- categories: t == null ? void 0 : t.categories,
624
- tagLabels: t == null ? void 0 : t.tagLabels
630
+ onToggle: u,
631
+ onClear: v,
632
+ categories: r == null ? void 0 : r.categories,
633
+ tagLabels: r == null ? void 0 : r.tagLabels
625
634
  }
626
635
  ),
627
636
  /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
628
637
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
629
- /* @__PURE__ */ n(P, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
638
+ /* @__PURE__ */ n(I, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
630
639
  /* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
631
640
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
632
- /* @__PURE__ */ n(P, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
633
- /* @__PURE__ */ n(P, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
634
- /* @__PURE__ */ n(P, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
635
- /* @__PURE__ */ n(P, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
641
+ /* @__PURE__ */ n(I, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
642
+ /* @__PURE__ */ n(I, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
643
+ /* @__PURE__ */ n(I, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
644
+ /* @__PURE__ */ n(I, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
636
645
  ] }) }),
637
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: y.map((x) => {
638
- var v, N, m;
646
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: k.map((m) => {
647
+ var g, b, x;
639
648
  return /* @__PURE__ */ l(
640
649
  "tr",
641
650
  {
642
651
  className: "pvx-row pvx-row--clickable",
643
- onClick: () => a(x.id, x.layout),
652
+ onClick: () => a(m.id, m.layout),
644
653
  children: [
645
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
646
- /* @__PURE__ */ n("td", { className: "pvx-td", children: (v = x.record) != null && v.visibleId ? /* @__PURE__ */ n(J, { userId: x.record.visibleId, getUserDisplay: s }) : "-" }),
647
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
648
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? q(x.record.lapTimeMs) : "-" }),
649
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
650
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
651
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (m = x.record) != null && m.timestamp ? W(x.record.timestamp) : "-" })
654
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: m.displayName }),
655
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: (g = m.record) != null && g.visibleId ? /* @__PURE__ */ n(X, { userId: m.record.visibleId, getUserDisplay: s }) : "-" }),
656
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((b = m.record) == null ? void 0 : b.carDisplayName) || "-" }),
657
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: m.record ? q(m.record.lapTimeMs) : "-" }),
658
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: m.driverCount || "-" }),
659
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.carCount || "-" }),
660
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (x = m.record) != null && x.timestamp ? G(m.record.timestamp) : "-" })
652
661
  ]
653
662
  },
654
- `${x.id}|${x.layout || ""}`
663
+ `${m.id}|${m.layout || ""}`
655
664
  );
656
665
  }) })
657
666
  ] }) })
658
- ] }) : /* @__PURE__ */ n(O, { message: "No lap times recorded yet." });
667
+ ] }) : /* @__PURE__ */ n(z, { message: "No lap times recorded yet." });
659
668
  }
660
- function Nt({ entries: e, isLoading: r, track: t, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
661
- const [c, h] = G({ key: "lapTimeMs", dir: "asc" }), { activeTags: g, toggle: f, clear: u } = Te(d, p), y = $(() => {
662
- var k, w, C;
663
- if (!e || !((k = s == null ? void 0 : s.tags) != null && k.length)) return [];
664
- const m = /* @__PURE__ */ new Set();
665
- for (const D of e)
666
- (((C = (w = s.cars) == null ? void 0 : w[D.carId]) == null ? void 0 : C.tags) || []).forEach((S) => m.add(S));
667
- return s.tags.filter((D) => m.has(D));
668
- }, [e, s]), x = $(() => e ? g.size === 0 ? e : e.filter((m) => {
669
- var w, C;
670
- const k = ((C = (w = s == null ? void 0 : s.cars) == null ? void 0 : w[m.carId]) == null ? void 0 : C.tags) || [];
671
- return Re(k, g, s == null ? void 0 : s.categories);
672
- }) : [], [e, g, s]), v = $(() => Y(x, c, (m, k) => {
673
- switch (k) {
669
+ function Bt({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
670
+ const [c, u] = Z({ key: "lapTimeMs", dir: "asc" }), { activeTags: v, toggle: f, clear: h } = De(d, p), k = T(() => {
671
+ var w, C, M;
672
+ if (!e || !((w = s == null ? void 0 : s.tags) != null && w.length)) return [];
673
+ const x = /* @__PURE__ */ new Set();
674
+ for (const P of e)
675
+ (((M = (C = s.cars) == null ? void 0 : C[P.carId]) == null ? void 0 : M.tags) || []).forEach((S) => x.add(S));
676
+ return s.tags.filter((P) => x.has(P));
677
+ }, [e, s]), m = T(() => e ? v.size === 0 ? e : e.filter((x) => {
678
+ var C, M;
679
+ const w = ((M = (C = s == null ? void 0 : s.cars) == null ? void 0 : C[x.carId]) == null ? void 0 : M.tags) || [];
680
+ return Me(w, v, s == null ? void 0 : s.categories);
681
+ }) : [], [e, v, s]), g = T(() => J(m, c, (x, w) => {
682
+ switch (w) {
674
683
  case "carId":
675
- return A(m.carId);
684
+ return _(x.carId);
676
685
  case "driverCount":
677
- return m.driverCount || 0;
686
+ return x.driverCount || 0;
678
687
  case "lapTimeMs":
679
688
  default:
680
- return m.lapTimeMs;
689
+ return x.lapTimeMs;
681
690
  }
682
- }), [x, c]), N = [
691
+ }), [m, c]), b = [
683
692
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
684
- { key: "track", label: t.displayName }
693
+ { key: "track", label: r.displayName }
685
694
  ];
686
- return r ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
687
- /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ce, { segments: N }) }),
695
+ return t ? /* @__PURE__ */ n(Q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
696
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ue, { segments: b }) }),
688
697
  /* @__PURE__ */ n(
689
- De,
698
+ Pe,
690
699
  {
691
- availableTags: y,
692
- activeTags: g,
700
+ availableTags: k,
701
+ activeTags: v,
693
702
  onToggle: f,
694
- onClear: u,
703
+ onClear: h,
695
704
  categories: s == null ? void 0 : s.categories,
696
705
  tagLabels: s == null ? void 0 : s.tagLabels
697
706
  }
@@ -699,103 +708,103 @@ function Nt({ entries: e, isLoading: r, track: t, carMetadata: s, getUserDisplay
699
708
  e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
700
709
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
701
710
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
702
- /* @__PURE__ */ n(P, { label: "Car", sortKey: "carId", config: c, onSort: h }),
711
+ /* @__PURE__ */ n(I, { label: "Car", sortKey: "carId", config: c, onSort: u }),
703
712
  /* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
704
- /* @__PURE__ */ n(P, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: h }),
705
- /* @__PURE__ */ n(P, { label: "Drivers", sortKey: "driverCount", config: c, onSort: h, className: "pvx-hidden-below-md" }),
713
+ /* @__PURE__ */ n(I, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
714
+ /* @__PURE__ */ n(I, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
706
715
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
707
716
  ] }) }),
708
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((m, k) => /* @__PURE__ */ l(
717
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: g.map((x, w) => /* @__PURE__ */ l(
709
718
  "tr",
710
719
  {
711
720
  className: "pvx-row pvx-row--clickable",
712
- onClick: () => i(m.carId),
721
+ onClick: () => i(x.carId),
713
722
  children: [
714
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(le, { rank: k + 1, podium: !0 }) }),
715
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: A(m.carId) }),
716
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(J, { userId: m.steamId || m.userId, getUserDisplay: a }) }),
717
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(m.lapTimeMs) }),
718
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: m.driverCount || "-" }),
719
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: m.recordedAt ? W(m.recordedAt) : "-" })
723
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: w + 1, podium: !0 }) }),
724
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: _(x.carId) }),
725
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(X, { userId: x.steamId || x.userId, getUserDisplay: a }) }),
726
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(x.lapTimeMs) }),
727
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
728
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: x.recordedAt ? G(x.recordedAt) : "-" })
720
729
  ]
721
730
  },
722
- m.carId
731
+ x.carId
723
732
  )) })
724
- ] }) }) : /* @__PURE__ */ n(O, { message: "No lap times for this track yet." })
733
+ ] }) }) : /* @__PURE__ */ n(z, { message: "No lap times for this track yet." })
725
734
  ] });
726
735
  }
727
- function bt({ entries: e, isLoading: r, track: t, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
728
- const [p, c] = G({ key: "lapTimeMs", dir: "asc" }), h = $(() => Me(e), [e]), g = $(() => Y(e || [], p, (u, y) => {
729
- switch (y) {
736
+ function It({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
737
+ const [p, c] = Z({ key: "lapTimeMs", dir: "asc" }), u = T(() => Ae(e), [e]), v = T(() => J(e || [], p, (h, k) => {
738
+ switch (k) {
730
739
  case "userId":
731
- return a(u.steamId || u.userId).displayName;
740
+ return a(h.steamId || h.userId).displayName;
732
741
  case "lapCount":
733
- return u.lapCount || 0;
742
+ return h.lapCount || 0;
734
743
  case "lapTimeMs":
735
744
  default:
736
- return u.lapTimeMs;
745
+ return h.lapTimeMs;
737
746
  }
738
747
  }), [e, p, a]), f = [
739
748
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
740
- { key: "track", label: t.displayName, onClick: () => o("track") },
741
- { key: "car", label: A(s) }
749
+ { key: "track", label: r.displayName, onClick: () => o("track") },
750
+ { key: "car", label: _(s) }
742
751
  ];
743
- return r ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
744
- /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ce, { segments: f }) }),
752
+ return t ? /* @__PURE__ */ n(Q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
753
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ue, { segments: f }) }),
745
754
  e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
746
755
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
747
756
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
748
- /* @__PURE__ */ n(P, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
749
- /* @__PURE__ */ n(P, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
757
+ /* @__PURE__ */ n(I, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
758
+ /* @__PURE__ */ n(I, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
750
759
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
751
760
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
752
761
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
753
762
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
754
763
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
755
- /* @__PURE__ */ n(P, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
764
+ /* @__PURE__ */ n(I, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
756
765
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
757
766
  ] }) }),
758
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: g.map((u, y) => {
759
- const x = y + 1, v = u.steamId || u.userId, N = h && u.sector1Ms === h.s1, m = h && u.sector2Ms === h.s2, k = h && u.sector3Ms === h.s3;
767
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h, k) => {
768
+ const m = k + 1, g = h.steamId || h.userId, b = u && h.sector1Ms === u.s1, x = u && h.sector2Ms === u.s2, w = u && h.sector3Ms === u.s3;
760
769
  return /* @__PURE__ */ l(
761
770
  "tr",
762
771
  {
763
- className: `pvx-row pvx-row--clickable ${d && v === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
764
- onClick: () => i(v),
772
+ className: `pvx-row pvx-row--clickable ${d && g === d ? "pvx-row--highlight" : m <= 3 ? "pvx-row--podium" : ""}`,
773
+ onClick: () => i(g),
765
774
  children: [
766
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(le, { rank: x, podium: !0 }) }),
767
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId: v, getUserDisplay: a }) }),
768
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(u.lapTimeMs) }),
769
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: E(u.sector1Ms) }),
770
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${m ? "pvx-td--best-sector" : ""}`, children: E(u.sector2Ms) }),
771
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: E(u.sector3Ms) }),
772
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: be(u.tyreCompound), children: u.tyreCompound || "-" }),
773
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: ye(u.startingFuelL) }),
774
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.lapCount || "-" }),
775
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: u.recordedAt ? W(u.recordedAt) : "-" })
775
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: m, podium: !0 }) }),
776
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(X, { userId: g, getUserDisplay: a }) }),
777
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(h.lapTimeMs) }),
778
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${b ? "pvx-td--best-sector" : ""}`, children: F(h.sector1Ms) }),
779
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${x ? "pvx-td--best-sector" : ""}`, children: F(h.sector2Ms) }),
780
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: F(h.sector3Ms) }),
781
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ke(h.tyreCompound), children: h.tyreCompound || "-" }),
782
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: we(h.startingFuelL) }),
783
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.lapCount || "-" }),
784
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ? G(h.recordedAt) : "-" })
776
785
  ]
777
786
  },
778
- v
787
+ g
779
788
  );
780
789
  }) })
781
- ] }) }) : /* @__PURE__ */ n(O, { message: "No lap times for this car yet." })
790
+ ] }) }) : /* @__PURE__ */ n(z, { message: "No lap times for this car yet." })
782
791
  ] });
783
792
  }
784
- function yt({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
785
- const { data: c, driverName: h, theoreticalBest: g, isLoading: f } = Je(e, r.id, r.layout, t, { showInvalid: i, game: s, gameVersion: a }), { displayName: u, avatarUrl: y } = o(e, h), x = $(() => Me(c, !0), [c]), v = $(() => {
786
- const m = (c == null ? void 0 : c.filter((k) => k.isValid)) || [];
787
- return m.length ? Math.min(...m.map((k) => k.lapTimeMs)) : null;
788
- }, [c]), N = [
793
+ function Et({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
794
+ const { data: c, driverName: u, theoreticalBest: v, isLoading: f } = en(e, t.id, t.layout, r, { showInvalid: i, game: s, gameVersion: a }), { displayName: h, avatarUrl: k } = o(e, u), m = T(() => Ae(c, !0), [c]), g = T(() => {
795
+ const x = (c == null ? void 0 : c.filter((w) => w.isValid)) || [];
796
+ return x.length ? Math.min(...x.map((w) => w.lapTimeMs)) : null;
797
+ }, [c]), b = [
789
798
  { key: "tracks", label: "Tracks", onClick: () => p("tracks") },
790
- { key: "track", label: r.displayName, onClick: () => p("track") },
791
- { key: "car", label: A(t), onClick: () => p("car") },
792
- { key: "driver", label: u }
799
+ { key: "track", label: t.displayName, onClick: () => p("track") },
800
+ { key: "car", label: _(r), onClick: () => p("car") },
801
+ { key: "driver", label: h }
793
802
  ];
794
- return f ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
803
+ return f ? /* @__PURE__ */ n(Q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
795
804
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
796
805
  /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
797
- /* @__PURE__ */ n(ce, { segments: N }),
798
- y ? /* @__PURE__ */ n("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
806
+ /* @__PURE__ */ n(ue, { segments: b }),
807
+ k ? /* @__PURE__ */ n("img", { src: k, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
799
808
  ] }),
800
809
  /* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
801
810
  /* @__PURE__ */ n(
@@ -810,16 +819,16 @@ function yt({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvali
810
819
  /* @__PURE__ */ n("span", { children: "Show invalid laps" })
811
820
  ] })
812
821
  ] }),
813
- g && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
822
+ v && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
814
823
  /* @__PURE__ */ n("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
815
- /* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: q(g.lapTimeMs) }),
824
+ /* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: q(v.lapTimeMs) }),
816
825
  /* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
817
826
  "(",
818
- E(g.sector1Ms),
827
+ F(v.sector1Ms),
819
828
  " + ",
820
- E(g.sector2Ms),
829
+ F(v.sector2Ms),
821
830
  " + ",
822
- E(g.sector3Ms),
831
+ F(v.sector3Ms),
823
832
  ")"
824
833
  ] })
825
834
  ] }),
@@ -836,28 +845,28 @@ function yt({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvali
836
845
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
837
846
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
838
847
  ] }) }),
839
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((m, k) => {
840
- const w = m.isValid && m.lapTimeMs === v, C = x && m.isValid && m.sector1Ms === x.s1, D = x && m.isValid && m.sector2Ms === x.s2, b = x && m.isValid && m.sector3Ms === x.s3;
848
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((x, w) => {
849
+ const C = x.isValid && x.lapTimeMs === g, M = m && x.isValid && x.sector1Ms === m.s1, P = m && x.isValid && x.sector2Ms === m.s2, N = m && x.isValid && x.sector3Ms === m.s3;
841
850
  let S = "pvx-row";
842
- return m.isValid || (S += " pvx-row--invalid"), w && (S += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: S, children: [
843
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${w ? "pvx-rank--gold" : ""}`, children: k + 1 }) }),
844
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: m.lapNumber || "-" }),
845
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(m.lapTimeMs) }),
846
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${C ? "pvx-td--best-sector" : ""}`, children: E(m.sector1Ms) }),
847
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${D ? "pvx-td--best-sector" : ""}`, children: E(m.sector2Ms) }),
848
- /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${b ? "pvx-td--best-sector" : ""}`, children: E(m.sector3Ms) }),
849
- /* @__PURE__ */ n("td", { className: "pvx-td", title: m.isValid ? void 0 : m.invalidReason || "Invalid", children: m.isValid ? /* @__PURE__ */ n(an, {}) : /* @__PURE__ */ n(on, {}) }),
850
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: be(m.tyreCompound), children: m.tyreCompound || "-" }),
851
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: ye(m.startingFuelL) }),
852
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: W(m.timestamp) })
853
- ] }, m.id);
851
+ return x.isValid || (S += " pvx-row--invalid"), C && (S += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: S, children: [
852
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: w + 1 }) }),
853
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: x.lapNumber || "-" }),
854
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(x.lapTimeMs) }),
855
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${M ? "pvx-td--best-sector" : ""}`, children: F(x.sector1Ms) }),
856
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${P ? "pvx-td--best-sector" : ""}`, children: F(x.sector2Ms) }),
857
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: F(x.sector3Ms) }),
858
+ /* @__PURE__ */ n("td", { className: "pvx-td", title: x.isValid ? void 0 : x.invalidReason || "Invalid", children: x.isValid ? /* @__PURE__ */ n(dn, {}) : /* @__PURE__ */ n(pn, {}) }),
859
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ke(x.tyreCompound), children: x.tyreCompound || "-" }),
860
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: we(x.startingFuelL) }),
861
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: G(x.timestamp) })
862
+ ] }, x.id);
854
863
  }) })
855
- ] }) }) : /* @__PURE__ */ n(O, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
864
+ ] }) }) : /* @__PURE__ */ n(z, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
856
865
  ] });
857
866
  }
858
- function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion: a, onComboSelect: i }) {
859
- const [o, d] = G({ key: "rank", dir: "asc" }), [p, c] = B(null), h = $(() => e ? Y(e, o, (f, u) => {
860
- switch (u) {
867
+ function _t({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion: a, onComboSelect: i }) {
868
+ const [o, d] = Z({ key: "rank", dir: "asc" }), [p, c] = E(null), u = T(() => e ? J(e, o, (f, h) => {
869
+ switch (h) {
861
870
  case "rating":
862
871
  return f.rating;
863
872
  case "comboCount":
@@ -869,10 +878,10 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
869
878
  return f.rank;
870
879
  }
871
880
  }) : [], [e, o]);
872
- if (r) return /* @__PURE__ */ n(z, {});
881
+ if (t) return /* @__PURE__ */ n(Q, {});
873
882
  if (!(e != null && e.length))
874
- return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(O, { message: "Not enough data for rankings yet." }) });
875
- const g = 5;
883
+ return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(z, { message: "Not enough data for rankings yet." }) });
884
+ const v = 5;
876
885
  return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
877
886
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
878
887
  /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
@@ -891,22 +900,22 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
891
900
  ] }),
892
901
  /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
893
902
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
894
- /* @__PURE__ */ n(P, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
903
+ /* @__PURE__ */ n(I, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
895
904
  /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
896
- /* @__PURE__ */ n(P, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
897
- /* @__PURE__ */ n(P, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
898
- /* @__PURE__ */ n(P, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
905
+ /* @__PURE__ */ n(I, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
906
+ /* @__PURE__ */ n(I, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
907
+ /* @__PURE__ */ n(I, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
899
908
  ] }) }),
900
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: h.map((f) => {
901
- const u = p === f.identifier;
909
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
910
+ const h = p === f.identifier;
902
911
  return /* @__PURE__ */ n(
903
- ln,
912
+ un,
904
913
  {
905
914
  driver: f,
906
- getUserDisplay: t,
907
- isExpanded: u,
908
- onToggle: () => c(u ? null : f.identifier),
909
- colCount: g,
915
+ getUserDisplay: r,
916
+ isExpanded: h,
917
+ onToggle: () => c(h ? null : f.identifier),
918
+ colCount: v,
910
919
  game: s,
911
920
  gameVersion: a,
912
921
  onComboSelect: i
@@ -917,28 +926,28 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
917
926
  ] }) })
918
927
  ] });
919
928
  }
920
- function ln({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
929
+ function un({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
921
930
  const p = e.identifier;
922
- return /* @__PURE__ */ l(_, { children: [
931
+ return /* @__PURE__ */ l(B, { children: [
923
932
  /* @__PURE__ */ l(
924
933
  "tr",
925
934
  {
926
935
  className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
927
936
  onClick: s,
928
937
  children: [
929
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(le, { rank: e.rank, podium: !0 }) }),
930
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId: p, getUserDisplay: r }) }),
938
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: e.rank, podium: !0 }) }),
939
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(X, { userId: p, getUserDisplay: t }) }),
931
940
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
932
941
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
933
942
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
934
943
  e.comboCount,
935
- /* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${t ? "pvx-rankings-chevron--open" : ""}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) })
944
+ /* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${r ? "pvx-rankings-chevron--open" : ""}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) })
936
945
  ] }) })
937
946
  ]
938
947
  }
939
948
  ),
940
- t && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, h) => {
941
- const g = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: g, car: c.carId, highlight: p, game: i, gameVersion: o }) : void 0;
949
+ r && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
950
+ const v = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: v, car: c.carId, highlight: p, game: i, gameVersion: o }) : void 0;
942
951
  return /* @__PURE__ */ l(
943
952
  "div",
944
953
  {
@@ -947,8 +956,8 @@ function ln({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount
947
956
  role: f ? "button" : void 0,
948
957
  children: [
949
958
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
950
- /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: j(c.trackId, c.layout, i) }),
951
- /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: A(c.carId) })
959
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: V(c.trackId, c.layout, i) }),
960
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: _(c.carId) })
952
961
  ] }),
953
962
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
954
963
  /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-time", children: q(c.lapTimeMs) }),
@@ -966,12 +975,12 @@ function ln({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount
966
975
  ] })
967
976
  ]
968
977
  },
969
- h
978
+ u
970
979
  );
971
980
  }) }) }) })
972
981
  ] });
973
982
  }
974
- const cn = {
983
+ const hn = {
975
984
  GBR: "🇬🇧",
976
985
  DEU: "🇩🇪",
977
986
  NLD: "🇳🇱",
@@ -1002,173 +1011,308 @@ const cn = {
1002
1011
  RUS: "🇷🇺",
1003
1012
  TUR: "🇹🇷",
1004
1013
  KOR: "🇰🇷"
1005
- }, de = ["🥇", "🥈", "🥉"], dn = {
1014
+ }, he = ["🥇", "🥈", "🥉"], mn = {
1006
1015
  championship: "Championship",
1007
1016
  series: "Series",
1008
1017
  event: "Event",
1009
1018
  hotlap: "Hotlap"
1010
- }, pn = ["PRACTICE", "QUALIFYING", "RACE"];
1011
- function ve(e) {
1012
- const r = pn.indexOf(e);
1013
- if (r >= 0) return r;
1014
- const t = e.match(/^PRACTICE_(\d+)$/);
1015
- return t ? 100 + parseInt(t[1]) : 999;
1016
- }
1017
- function pe(e) {
1019
+ }, vn = ["PRACTICE", "QUALIFYING", "RACE"];
1020
+ function ge(e) {
1021
+ const t = vn.indexOf(e);
1022
+ if (t >= 0) return t;
1018
1023
  const r = e.match(/^PRACTICE_(\d+)$/);
1019
- return r ? `P${r[1]}` : e;
1024
+ return r ? 100 + parseInt(r[1]) : 999;
1025
+ }
1026
+ function ee(e) {
1027
+ const t = e.match(/^PRACTICE_(\d+)$/);
1028
+ return t ? `P${t[1]}` : e;
1020
1029
  }
1021
- function ue({ position: e }) {
1030
+ function me({ position: e }) {
1022
1031
  return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
1023
1032
  }
1024
- function Z({ nation: e }) {
1025
- const r = e && cn[e];
1026
- return r ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: r }) : null;
1033
+ function ne({ nation: e }) {
1034
+ const t = e && hn[e];
1035
+ return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
1027
1036
  }
1028
- function un({ sessions: e, activeSession: r, onSelect: t }) {
1037
+ function xn({ sessions: e, activeSession: t, onSelect: r }) {
1029
1038
  if (!e || e.length <= 1) return null;
1030
1039
  const s = [...e].sort(
1031
- (a, i) => ve(a.type) - ve(i.type)
1040
+ (a, i) => ge(a.type) - ge(i.type)
1032
1041
  );
1033
1042
  return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
1034
1043
  "button",
1035
1044
  {
1036
- onClick: () => t(a.type),
1037
- className: `pvx-session-tab ${r === a.type ? "pvx-session-tab--active" : ""}`,
1038
- children: pe(a.type)
1045
+ onClick: () => r(a.type),
1046
+ className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
1047
+ children: ee(a.type)
1039
1048
  },
1040
1049
  a.type
1041
1050
  )) });
1042
1051
  }
1043
- function hn({ type: e }) {
1044
- return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: dn[e] || e });
1052
+ function gn({ type: e }) {
1053
+ return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: mn[e] || e });
1045
1054
  }
1046
- function ee({ children: e, variant: r = "default" }) {
1047
- return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${r !== "default" ? `pvx-info-pill--${r}` : ""}`, children: e });
1055
+ function re({ children: e, variant: t = "default" }) {
1056
+ return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
1048
1057
  }
1049
- function mn(e) {
1058
+ function fn(e) {
1050
1059
  if (!e) return "TBD";
1051
- const r = new Date(e);
1052
- if (isNaN(r)) return "TBD";
1053
- const t = r.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = r.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1054
- return `${t} • ${s}`;
1060
+ const t = new Date(e);
1061
+ if (isNaN(t)) return "TBD";
1062
+ const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1063
+ return `${r} • ${s}`;
1055
1064
  }
1056
- function vn(e) {
1057
- return e.reduce((r, t) => {
1065
+ function Nn(e) {
1066
+ return e.reduce((t, r) => {
1058
1067
  var s;
1059
- return (s = t.splits) != null && s.length ? r ? r.map((a, i) => {
1060
- const o = t.splits[i];
1068
+ return (s = r.splits) != null && s.length ? t ? t.map((a, i) => {
1069
+ const o = r.splits[i];
1061
1070
  return o && o < a ? o : a;
1062
- }) : [...t.splits] : r;
1071
+ }) : [...r.splits] : t;
1063
1072
  }, null);
1064
1073
  }
1065
- function V({ message: e = "Loading..." }) {
1074
+ function W({ message: e = "Loading..." }) {
1066
1075
  return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
1067
1076
  }
1068
1077
  function U({ message: e = "No data available." }) {
1069
1078
  return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
1070
1079
  }
1071
- const Pe = 3;
1072
- function xn(e) {
1073
- const r = e == null ? void 0 : e.rounds;
1074
- return r != null && r.length ? e.type === "hotlap" ? r.every((t) => t.isFinalized && t.dediStatus === "completed") : r.every((t) => t.isFinalized) : !1;
1080
+ const Be = 3;
1081
+ function j(e) {
1082
+ if (!e) return !1;
1083
+ if (e.closesAt) {
1084
+ const t = new Date(e.closesAt).getTime();
1085
+ if (!Number.isNaN(t)) return Date.now() >= t;
1086
+ }
1087
+ return !!e.isClosed;
1088
+ }
1089
+ function bn(e) {
1090
+ const t = e == null ? void 0 : e.rounds;
1091
+ return t != null && t.length ? e.type === "hotlap" ? t.every((r) => j(r)) : t.every((r) => r.isFinalized) : !1;
1075
1092
  }
1076
- function gn(e) {
1077
- const r = e == null ? void 0 : e.rounds;
1078
- if (!(r != null && r.length)) return null;
1079
- let t = null;
1080
- for (const s of r) {
1093
+ function yn(e) {
1094
+ const t = e == null ? void 0 : e.rounds;
1095
+ if (!(t != null && t.length)) return null;
1096
+ let r = null;
1097
+ for (const s of t) {
1081
1098
  if (!s.startTime) continue;
1082
1099
  const a = new Date(s.startTime);
1083
- isNaN(a) || (!t || a > t) && (t = a);
1100
+ isNaN(a) || (!r || a > r) && (r = a);
1084
1101
  }
1085
- return t;
1102
+ return r;
1086
1103
  }
1087
- function Be(e, r = Pe) {
1088
- if (!xn(e)) return "active";
1089
- const t = gn(e);
1090
- if (!t) return "recently-completed";
1091
- const s = r * 24 * 60 * 60 * 1e3;
1092
- return Date.now() - t.getTime() <= s ? "recently-completed" : "archived";
1104
+ function Ie(e, t = Be) {
1105
+ if (!bn(e)) return "active";
1106
+ const r = yn(e);
1107
+ if (!r) return "recently-completed";
1108
+ const s = t * 24 * 60 * 60 * 1e3;
1109
+ return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
1093
1110
  }
1094
- function wt(e, r, t = Pe) {
1111
+ function Ut(e, t, r = Be) {
1095
1112
  if (!(e != null && e.length)) return [];
1096
- const s = new Set(Array.isArray(r) ? r : [r]);
1097
- return e.filter((a) => s.has(Be(a, t)));
1113
+ const s = new Set(Array.isArray(t) ? t : [t]);
1114
+ return e.filter((a) => s.has(Ie(a, r)));
1098
1115
  }
1099
- function fn(e, r = 3) {
1100
- const t = e == null ? void 0 : e.standings;
1101
- return Array.isArray(t) ? [...t].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, r) : [];
1116
+ function kn(e, t = 3) {
1117
+ const r = e == null ? void 0 : e.standings;
1118
+ return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
1102
1119
  }
1103
- function Nn({ competitionId: e, topN: r = 3, label: t = "Completed", className: s }) {
1104
- const { data: a } = Ce(e), i = fn(a, r);
1120
+ function wn({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
1121
+ const { data: a } = Le(e), i = kn(a, t);
1105
1122
  return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
1106
- /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: t }),
1123
+ /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
1107
1124
  i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
1108
- /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: de[d] || "" }),
1109
- /* @__PURE__ */ n(Z, { nation: o.nation }),
1125
+ /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: he[d] || "" }),
1126
+ /* @__PURE__ */ n(ne, { nation: o.nation }),
1110
1127
  /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
1111
1128
  ] }, o.driverId || d)) })
1112
1129
  ] });
1113
1130
  }
1114
- function Ct({ competitions: e, isLoading: r, onSelect: t, onRegister: s, className: a }) {
1115
- return r ? /* @__PURE__ */ n(V, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(bn, { comp: i, onSelect: t, onRegister: s || t }, i.id)) }) : /* @__PURE__ */ n(U, { message: "No competitions available." });
1131
+ const Cn = {
1132
+ GameModeSelectionWeatherType_CLEAR: "Clear",
1133
+ GameModeSelectionWeatherType_SCATTERED_CLOUDS: "Scattered Clouds",
1134
+ GameModeSelectionWeatherType_BROKEN_CLOUDS: "Broken Clouds",
1135
+ GameModeSelectionWeatherType_OVERCAST: "Overcast",
1136
+ GameModeSelectionWeatherType_DRIZZLE: "Drizzle",
1137
+ GameModeSelectionWeatherType_DAMP: "Damp",
1138
+ GameModeSelectionWeatherType_RAIN: "Rain",
1139
+ GameModeSelectionWeatherType_HEAVY_RAIN: "Heavy Rain"
1140
+ }, Sn = {
1141
+ viewBox: "0 0 24 24",
1142
+ fill: "none",
1143
+ stroke: "currentColor",
1144
+ strokeWidth: 1.5,
1145
+ strokeLinecap: "round",
1146
+ strokeLinejoin: "round"
1147
+ };
1148
+ function Ln() {
1149
+ return /* @__PURE__ */ l(B, { children: [
1150
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
1151
+ /* @__PURE__ */ n("path", { d: "M12 2v2" }),
1152
+ /* @__PURE__ */ n("path", { d: "M12 20v2" }),
1153
+ /* @__PURE__ */ n("path", { d: "m4.93 4.93 1.41 1.41" }),
1154
+ /* @__PURE__ */ n("path", { d: "m17.66 17.66 1.41 1.41" }),
1155
+ /* @__PURE__ */ n("path", { d: "M2 12h2" }),
1156
+ /* @__PURE__ */ n("path", { d: "M20 12h2" }),
1157
+ /* @__PURE__ */ n("path", { d: "m6.34 17.66-1.41 1.41" }),
1158
+ /* @__PURE__ */ n("path", { d: "m19.07 4.93-1.41 1.41" })
1159
+ ] });
1160
+ }
1161
+ function Rn() {
1162
+ return /* @__PURE__ */ l(B, { children: [
1163
+ /* @__PURE__ */ n("path", { d: "M12 2v2" }),
1164
+ /* @__PURE__ */ n("path", { d: "m4.93 4.93 1.41 1.41" }),
1165
+ /* @__PURE__ */ n("path", { d: "M20 12h2" }),
1166
+ /* @__PURE__ */ n("path", { d: "m19.07 4.93-1.41 1.41" }),
1167
+ /* @__PURE__ */ n("path", { d: "M15.947 12.65a4 4 0 0 0-5.925-4.128" }),
1168
+ /* @__PURE__ */ n("path", { d: "M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z" })
1169
+ ] });
1170
+ }
1171
+ function Tn() {
1172
+ return /* @__PURE__ */ l(B, { children: [
1173
+ /* @__PURE__ */ n("path", { d: "M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" }),
1174
+ /* @__PURE__ */ n("path", { d: "M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5" })
1175
+ ] });
1176
+ }
1177
+ function $n() {
1178
+ return /* @__PURE__ */ n("path", { d: "M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" });
1179
+ }
1180
+ function Mn() {
1181
+ return /* @__PURE__ */ l(B, { children: [
1182
+ /* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
1183
+ /* @__PURE__ */ n("path", { d: "M8 19v1" }),
1184
+ /* @__PURE__ */ n("path", { d: "M8 14v1" }),
1185
+ /* @__PURE__ */ n("path", { d: "M16 19v1" }),
1186
+ /* @__PURE__ */ n("path", { d: "M16 14v1" }),
1187
+ /* @__PURE__ */ n("path", { d: "M12 21v1" }),
1188
+ /* @__PURE__ */ n("path", { d: "M12 16v1" })
1189
+ ] });
1190
+ }
1191
+ function Dn() {
1192
+ return /* @__PURE__ */ l(B, { children: [
1193
+ /* @__PURE__ */ n("path", { d: "M16 17H7" }),
1194
+ /* @__PURE__ */ n("path", { d: "M17 21H9" }),
1195
+ /* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" })
1196
+ ] });
1197
+ }
1198
+ function An() {
1199
+ return /* @__PURE__ */ l(B, { children: [
1200
+ /* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
1201
+ /* @__PURE__ */ n("path", { d: "M16 14v6" }),
1202
+ /* @__PURE__ */ n("path", { d: "M8 14v6" }),
1203
+ /* @__PURE__ */ n("path", { d: "M12 16v6" })
1204
+ ] });
1205
+ }
1206
+ function Pn() {
1207
+ return /* @__PURE__ */ l(B, { children: [
1208
+ /* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
1209
+ /* @__PURE__ */ n("path", { d: "m9.2 22 3-7" }),
1210
+ /* @__PURE__ */ n("path", { d: "m9 13-3 7" }),
1211
+ /* @__PURE__ */ n("path", { d: "m17 13-3 7" })
1212
+ ] });
1116
1213
  }
1117
- function bn({ comp: e, onSelect: r, onRegister: t }) {
1118
- var m, k, w;
1119
- const { cdnUrl: s } = L(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), h = (i == null ? void 0 : i.isOpen) && !c && !p, g = /* @__PURE__ */ new Date(), f = (m = e.rounds) == null ? void 0 : m.find((C) => C.startTime && new Date(C.startTime) >= g), u = ((k = e.rounds) == null ? void 0 : k.length) || 0, y = ((w = e.rounds) == null ? void 0 : w.filter((C) => C.isFinalized).length) || 0, x = Be(e), v = x === "recently-completed" || x === "archived", N = e.type === "championship";
1214
+ const Bn = {
1215
+ GameModeSelectionWeatherType_CLEAR: Ln,
1216
+ GameModeSelectionWeatherType_SCATTERED_CLOUDS: Rn,
1217
+ GameModeSelectionWeatherType_BROKEN_CLOUDS: Tn,
1218
+ GameModeSelectionWeatherType_OVERCAST: $n,
1219
+ GameModeSelectionWeatherType_DRIZZLE: Mn,
1220
+ GameModeSelectionWeatherType_DAMP: Dn,
1221
+ GameModeSelectionWeatherType_RAIN: An,
1222
+ GameModeSelectionWeatherType_HEAVY_RAIN: Pn
1223
+ };
1224
+ function In({ weatherType: e, weatherBehaviour: t, className: r }) {
1225
+ const s = e ? Bn[e] : null;
1226
+ if (!s) return null;
1227
+ const a = Cn[e] || e, i = t === "GameModeSelectionWeatherBehaviour_DYNAMIC", o = i ? `${a} · Dynamic` : a;
1228
+ return /* @__PURE__ */ l(
1229
+ "span",
1230
+ {
1231
+ className: `pvx-weather-icon ${r || ""}`.trim(),
1232
+ title: o,
1233
+ "aria-label": o,
1234
+ children: [
1235
+ /* @__PURE__ */ n("svg", { className: "pvx-weather-icon-main", ...Sn, children: /* @__PURE__ */ n(s, {}) }),
1236
+ i && /* @__PURE__ */ n("span", { className: "pvx-weather-icon-dynamic", "aria-hidden": "true", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1237
+ /* @__PURE__ */ n("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
1238
+ /* @__PURE__ */ n("path", { d: "M21 3v5h-5" }),
1239
+ /* @__PURE__ */ n("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
1240
+ /* @__PURE__ */ n("path", { d: "M8 16H3v5" })
1241
+ ] }) })
1242
+ ]
1243
+ }
1244
+ );
1245
+ }
1246
+ function Ft({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
1247
+ return t ? /* @__PURE__ */ n(W, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(En, { comp: i, onSelect: r, onRegister: s || r }, i.id)) }) : /* @__PURE__ */ n(U, { message: "No competitions available." });
1248
+ }
1249
+ function En({ comp: e, onSelect: t, onRegister: r }) {
1250
+ var P, N, S, y, A;
1251
+ const { cdnUrl: s } = L(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), u = (i == null ? void 0 : i.isOpen) && !c && !p, v = /* @__PURE__ */ new Date(), f = (P = e.rounds) == null ? void 0 : P.find(
1252
+ (R) => R.startTime && new Date(R.startTime) <= v && !j(R)
1253
+ ), h = f || ((N = e.rounds) == null ? void 0 : N.find((R) => R.startTime && new Date(R.startTime) >= v)), k = !!f, m = ((S = e.rounds) == null ? void 0 : S.length) || 0, g = e.type === "hotlap", b = g && m > 1, x = g ? ((y = e.rounds) == null ? void 0 : y.filter(j).length) || 0 : ((A = e.rounds) == null ? void 0 : A.filter((R) => R.isFinalized).length) || 0, w = Ie(e), C = w === "recently-completed" || w === "archived", M = e.type === "championship";
1120
1254
  return /* @__PURE__ */ l(
1121
1255
  "div",
1122
1256
  {
1123
1257
  className: "pvx-comp-card",
1124
- onClick: () => r(e.id),
1258
+ onClick: () => t(e.id),
1125
1259
  role: "button",
1126
1260
  tabIndex: 0,
1127
- onKeyDown: (C) => {
1128
- (C.key === "Enter" || C.key === " ") && (C.preventDefault(), r(e.id));
1261
+ onKeyDown: (R) => {
1262
+ (R.key === "Enter" || R.key === " ") && (R.preventDefault(), t(e.id));
1129
1263
  },
1130
1264
  children: [
1131
- /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(kn, {}) }) }),
1265
+ /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(Un, {}) }) }),
1132
1266
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
1133
1267
  /* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
1134
1268
  e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
1135
1269
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
1136
- /* @__PURE__ */ n(hn, { type: e.type }),
1137
- e.game && /* @__PURE__ */ n(ee, { children: e.game.toUpperCase() }),
1138
- e.formatDescription && e.formatDescription.split(", ").map((C, D) => /* @__PURE__ */ n(ee, { variant: "format", children: C }, D))
1270
+ /* @__PURE__ */ n(gn, { type: e.type }),
1271
+ e.game && /* @__PURE__ */ n(re, { children: e.game.toUpperCase() }),
1272
+ e.formatDescription && e.formatDescription.split(", ").map((R, H) => /* @__PURE__ */ n(re, { variant: "format", children: R }, H))
1139
1273
  ] }),
1140
- e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((C, D) => /* @__PURE__ */ n(ee, { children: C }, D)) }),
1274
+ e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((R, H) => /* @__PURE__ */ n(re, { children: R }, H)) }),
1141
1275
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
1142
- f ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1143
- /* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1276
+ h ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1277
+ /* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: k ? "Live:" : "Next:" }),
1144
1278
  " ",
1145
- e.type !== "hotlap" && `R${f.roundNumber} `,
1146
- f.track || "TBD",
1279
+ (e.type !== "hotlap" || b) && `R${h.roundNumber} `,
1280
+ h.track || "TBD",
1147
1281
  " · ",
1148
- mn(f.startTime)
1149
- ] }) : u > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1150
- y,
1282
+ fn(h.startTime),
1283
+ (h.weatherType || e.weatherType) && /* @__PURE__ */ l(B, { children: [
1284
+ " ",
1285
+ /* @__PURE__ */ n(
1286
+ In,
1287
+ {
1288
+ weatherType: h.weatherType || e.weatherType,
1289
+ weatherBehaviour: h.weatherBehaviour || e.weatherBehaviour
1290
+ }
1291
+ )
1292
+ ] })
1293
+ ] }) : m > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1294
+ x,
1151
1295
  "/",
1152
- u,
1296
+ m,
1153
1297
  " rounds completed"
1154
1298
  ] }) : null,
1155
- u > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1156
- u,
1299
+ m > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1300
+ m,
1157
1301
  " round",
1158
- u !== 1 ? "s" : ""
1302
+ m !== 1 ? "s" : ""
1159
1303
  ] })
1160
1304
  ] }),
1161
- v && N && /* @__PURE__ */ n(Nn, { competitionId: e.id }),
1162
- i && !v && /* @__PURE__ */ n(
1163
- yn,
1305
+ C && (M || b) && /* @__PURE__ */ n(wn, { competitionId: e.id }),
1306
+ i && !C && /* @__PURE__ */ n(
1307
+ _n,
1164
1308
  {
1165
1309
  competitionId: e.id,
1166
- regOpen: h,
1310
+ regOpen: u,
1167
1311
  isFull: p,
1168
1312
  deadlinePassed: c,
1169
1313
  regCount: o,
1170
1314
  regMax: d,
1171
- onRegister: t
1315
+ onRegister: r
1172
1316
  }
1173
1317
  )
1174
1318
  ] })
@@ -1176,8 +1320,8 @@ function bn({ comp: e, onSelect: r, onRegister: t }) {
1176
1320
  }
1177
1321
  );
1178
1322
  }
1179
- function yn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
1180
- const { isPowerMode: d } = ie(), p = oe(e), { data: c } = ae(e), h = (c == null ? void 0 : c.isRegistered) || !1, g = i ? a / i * 100 : 0, f = g >= 100 ? "full" : g >= 75 ? "warning" : "ok";
1323
+ function _n({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
1324
+ const { isPowerMode: d } = ce(), p = de(e), { data: c } = le(e), u = (c == null ? void 0 : c.isRegistered) || !1, v = i ? a / i * 100 : 0, f = v >= 100 ? "full" : v >= 75 ? "warning" : "ok";
1181
1325
  return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
1182
1326
  /* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
1183
1327
  a,
@@ -1185,21 +1329,21 @@ function yn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCou
1185
1329
  i || "∞",
1186
1330
  " drivers"
1187
1331
  ] }) }),
1188
- /* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: h ? /* @__PURE__ */ n(
1332
+ /* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
1189
1333
  "button",
1190
1334
  {
1191
1335
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
1192
- onClick: (u) => {
1193
- u.stopPropagation(), o(e);
1336
+ onClick: (h) => {
1337
+ h.stopPropagation(), o(e);
1194
1338
  },
1195
1339
  children: "✓ Registered"
1196
1340
  }
1197
- ) : r ? d ? /* @__PURE__ */ n(
1341
+ ) : t ? d ? /* @__PURE__ */ n(
1198
1342
  "button",
1199
1343
  {
1200
1344
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1201
- onClick: (u) => {
1202
- u.stopPropagation(), o(e);
1345
+ onClick: (h) => {
1346
+ h.stopPropagation(), o(e);
1203
1347
  },
1204
1348
  children: "Register"
1205
1349
  }
@@ -1210,13 +1354,13 @@ function yn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCou
1210
1354
  target: "_blank",
1211
1355
  rel: "noopener noreferrer",
1212
1356
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1213
- onClick: (u) => u.stopPropagation(),
1357
+ onClick: (h) => h.stopPropagation(),
1214
1358
  children: "Register"
1215
1359
  }
1216
- ) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: t ? "Full" : "Closed" }) })
1360
+ ) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
1217
1361
  ] });
1218
1362
  }
1219
- function kn() {
1363
+ function Un() {
1220
1364
  return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1221
1365
  /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1222
1366
  /* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
@@ -1226,23 +1370,24 @@ function kn() {
1226
1370
  /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1227
1371
  ] });
1228
1372
  }
1229
- function wn({ competitionId: e, className: r }) {
1230
- var d, p;
1231
- const { data: t, isLoading: s } = Ce(e), { data: a, isLoading: i } = we(e);
1373
+ function Fn({ competitionId: e, className: t }) {
1374
+ var c, u, v;
1375
+ const { data: r, isLoading: s } = Le(e), { data: a, isLoading: i } = Se(e);
1232
1376
  if (s || i)
1233
- return /* @__PURE__ */ n(V, { message: "Loading standings..." });
1234
- if (!((d = t == null ? void 0 : t.standings) != null && d.length))
1377
+ return /* @__PURE__ */ n(W, { message: "Loading standings..." });
1378
+ if (!((c = r == null ? void 0 : r.standings) != null && c.length))
1235
1379
  return /* @__PURE__ */ n(U, { message: "No standings data yet. Results will appear once rounds are finalised." });
1236
- const o = ((p = a == null ? void 0 : a.rounds) == null ? void 0 : p.filter((c) => c.isFinalized)) || [];
1237
- return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
1380
+ const o = (a == null ? void 0 : a.type) === "hotlap", d = o ? ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter(j)) || [] : ((v = a == null ? void 0 : a.rounds) == null ? void 0 : v.filter((f) => f.isFinalized)) || [], p = r.roundsClosed ?? r.roundsCompleted ?? 0;
1381
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
1238
1382
  /* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
1239
- /* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1383
+ /* @__PURE__ */ n("h3", { className: "pvx-card-title", children: o ? "Overall Standings" : "Championship Standings" }),
1240
1384
  /* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
1241
1385
  "After ",
1242
- t.roundsCompleted,
1386
+ p,
1243
1387
  " round",
1244
- t.roundsCompleted !== 1 ? "s" : "",
1245
- t.countingRounds > 0 && ` (best ${t.countingRounds} count)`
1388
+ p !== 1 ? "s" : "",
1389
+ o ? " closed" : "",
1390
+ r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
1246
1391
  ] })
1247
1392
  ] }) }),
1248
1393
  /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
@@ -1252,56 +1397,56 @@ function wn({ competitionId: e, className: r }) {
1252
1397
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1253
1398
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1254
1399
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1255
- o.map((c) => /* @__PURE__ */ l(
1400
+ d.map((f) => /* @__PURE__ */ l(
1256
1401
  "th",
1257
1402
  {
1258
1403
  className: "pvx-th pvx-th--center pvx-hidden-below-md",
1259
- title: c.track || `Round ${c.roundNumber}`,
1404
+ title: f.track || `Round ${f.roundNumber}`,
1260
1405
  children: [
1261
1406
  "R",
1262
- c.roundNumber
1407
+ f.roundNumber
1263
1408
  ]
1264
1409
  },
1265
- c.roundNumber
1410
+ f.roundNumber
1266
1411
  ))
1267
1412
  ] }) }),
1268
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: t.standings.map((c) => /* @__PURE__ */ n(
1269
- Cn,
1413
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((f) => /* @__PURE__ */ n(
1414
+ qn,
1270
1415
  {
1271
- driver: c,
1272
- finalizedRounds: o
1416
+ driver: f,
1417
+ columnRounds: d
1273
1418
  },
1274
- c.driverId || c.driverName
1419
+ f.driverId || f.driverName
1275
1420
  )) })
1276
1421
  ] }) })
1277
1422
  ] });
1278
1423
  }
1279
- function Cn({ driver: e, finalizedRounds: r }) {
1424
+ function qn({ driver: e, columnRounds: t }) {
1280
1425
  var o, d, p;
1281
- const t = e.position <= 3, s = new Map(
1426
+ const r = e.position <= 3, s = new Map(
1282
1427
  ((o = e.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
1283
1428
  ), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
1284
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${t ? "pvx-row--podium" : ""}`, children: [
1285
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ue, { position: e.position }) }),
1429
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
1430
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: e.position }) }),
1286
1431
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1287
- /* @__PURE__ */ n(Z, { nation: e.nation }),
1432
+ /* @__PURE__ */ n(ne, { nation: e.nation }),
1288
1433
  e.driverName
1289
1434
  ] }),
1290
1435
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1291
1436
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1292
1437
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
1293
- r.map((c) => {
1294
- const h = s.get(c.roundNumber), g = h == null ? void 0 : h.dropped;
1438
+ t.map((c) => {
1439
+ const u = s.get(c.roundNumber), v = u == null ? void 0 : u.dropped;
1295
1440
  return /* @__PURE__ */ n(
1296
1441
  "td",
1297
1442
  {
1298
- className: `pvx-td pvx-td--center pvx-hidden-below-md ${!g && (h == null ? void 0 : h.position) === 1 ? "pvx-standings-cell--p1" : !g && (h == null ? void 0 : h.position) === 2 ? "pvx-standings-cell--p2" : !g && (h == null ? void 0 : h.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
1299
- children: h ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${g ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1443
+ className: `pvx-td pvx-td--center pvx-hidden-below-md ${!v && (u == null ? void 0 : u.position) === 1 ? "pvx-standings-cell--p1" : !v && (u == null ? void 0 : u.position) === 2 ? "pvx-standings-cell--p2" : !v && (u == null ? void 0 : u.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
1444
+ children: u ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${v ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1300
1445
  /* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
1301
1446
  "P",
1302
- h.position
1447
+ u.position
1303
1448
  ] }),
1304
- /* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: h.points })
1449
+ /* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: u.points })
1305
1450
  ] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" })
1306
1451
  },
1307
1452
  c.roundNumber
@@ -1309,7 +1454,7 @@ function Cn({ driver: e, finalizedRounds: r }) {
1309
1454
  })
1310
1455
  ] });
1311
1456
  }
1312
- const xe = [
1457
+ const fe = [
1313
1458
  "#f59e0b",
1314
1459
  "#3b82f6",
1315
1460
  "#ef4444",
@@ -1335,118 +1480,118 @@ const xe = [
1335
1480
  "#f87171",
1336
1481
  "#38bdf8"
1337
1482
  ];
1338
- function Ln(e, r) {
1339
- return e.map((t) => ({
1340
- driverName: t.driverName,
1341
- carClass: t.carClass,
1342
- positions: t.positions.map((s, a) => {
1343
- const o = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName === t.driverName);
1483
+ function Hn(e, t) {
1484
+ return e.map((r) => ({
1485
+ driverName: r.driverName,
1486
+ carClass: r.carClass,
1487
+ positions: r.positions.map((s, a) => {
1488
+ const o = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName === r.driverName);
1344
1489
  return o === -1 ? null : o + 1;
1345
1490
  })
1346
1491
  }));
1347
1492
  }
1348
- function Sn({ title: e, drivers: r, timingPoints: t }) {
1349
- const [s, a] = B(() => /* @__PURE__ */ new Set()), i = K((b) => {
1493
+ function jn({ title: e, drivers: t, timingPoints: r }) {
1494
+ const [s, a] = E(() => /* @__PURE__ */ new Set()), i = K((N) => {
1350
1495
  a((S) => {
1351
- const R = new Set(S);
1352
- return R.has(b) ? R.delete(b) : R.add(b), R;
1496
+ const y = new Set(S);
1497
+ return y.has(N) ? y.delete(N) : y.add(N), y;
1353
1498
  });
1354
- }, []), { series: o, maxPos: d } = $(() => {
1355
- let b = 1;
1356
- return { series: r.map((R, I) => {
1357
- for (const F of R.positions) F != null && F > b && (b = F);
1358
- return { ...R, colour: xe[I % xe.length] };
1359
- }), maxPos: b };
1360
- }, [r]);
1361
- if (!o.length || t.length < 2)
1499
+ }, []), { series: o, maxPos: d } = T(() => {
1500
+ let N = 1;
1501
+ return { series: t.map((y, A) => {
1502
+ for (const R of y.positions) R != null && R > N && (N = R);
1503
+ return { ...y, colour: fe[A % fe.length] };
1504
+ }), maxPos: N };
1505
+ }, [t]);
1506
+ if (!o.length || r.length < 2)
1362
1507
  return /* @__PURE__ */ l("div", { className: "pvx-positions-empty", children: [
1363
1508
  "No position data for ",
1364
1509
  e || "this race",
1365
1510
  "."
1366
1511
  ] });
1367
- const p = 800, c = 34, h = 12, g = 12, f = 22, u = 34, y = p - c - h, x = Math.max(f * (d - 1), f), v = g + x + u, N = t.length, m = (b) => c + (N === 1 ? 0 : b / (N - 1) * y), k = (b) => g + (d === 1 ? 0 : (b - 1) / (d - 1) * x), w = (b) => {
1512
+ const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34, k = p - c - u, m = Math.max(f * (d - 1), f), g = v + m + h, b = r.length, x = (N) => c + (b === 1 ? 0 : N / (b - 1) * k), w = (N) => v + (d === 1 ? 0 : (N - 1) / (d - 1) * m), C = (N) => {
1368
1513
  const S = [];
1369
- let R = [];
1370
- return b.forEach((I, F) => {
1371
- I == null ? R.length && (S.push(R), R = []) : R.push([m(F), k(I)]);
1372
- }), R.length && S.push(R), S;
1373
- }, C = s.size > 0, D = Math.ceil(N / 24);
1514
+ let y = [];
1515
+ return N.forEach((A, R) => {
1516
+ A == null ? y.length && (S.push(y), y = []) : y.push([x(R), w(A)]);
1517
+ }), y.length && S.push(y), S;
1518
+ }, M = s.size > 0, P = Math.ceil(b / 24);
1374
1519
  return /* @__PURE__ */ l("div", { className: "pvx-positions-chart", children: [
1375
1520
  e && /* @__PURE__ */ n("div", { className: "pvx-positions-title", children: e }),
1376
1521
  /* @__PURE__ */ l(
1377
1522
  "svg",
1378
1523
  {
1379
1524
  className: "pvx-positions-svg",
1380
- viewBox: `0 0 ${p} ${v}`,
1525
+ viewBox: `0 0 ${p} ${g}`,
1381
1526
  preserveAspectRatio: "xMidYMid meet",
1382
1527
  role: "img",
1383
1528
  "aria-label": `Race position progression${e ? ` — ${e}` : ""}`,
1384
1529
  children: [
1385
- Array.from({ length: d }, (b, S) => S + 1).map((b) => /* @__PURE__ */ l("g", { children: [
1530
+ Array.from({ length: d }, (N, S) => S + 1).map((N) => /* @__PURE__ */ l("g", { children: [
1386
1531
  /* @__PURE__ */ n(
1387
1532
  "line",
1388
1533
  {
1389
1534
  className: "pvx-positions-grid",
1390
1535
  x1: c,
1391
- y1: k(b),
1392
- x2: p - h,
1393
- y2: k(b)
1536
+ y1: w(N),
1537
+ x2: p - u,
1538
+ y2: w(N)
1394
1539
  }
1395
1540
  ),
1396
- /* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y: k(b) + 3, textAnchor: "end", children: [
1541
+ /* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y: w(N) + 3, textAnchor: "end", children: [
1397
1542
  "P",
1398
- b
1543
+ N
1399
1544
  ] })
1400
- ] }, `y${b}`)),
1401
- t.map((b, S) => S % D === 0 && /* @__PURE__ */ n(
1545
+ ] }, `y${N}`)),
1546
+ r.map((N, S) => S % P === 0 && /* @__PURE__ */ n(
1402
1547
  "text",
1403
1548
  {
1404
1549
  className: "pvx-positions-axis",
1405
- x: m(S),
1406
- y: v - u + 16,
1550
+ x: x(S),
1551
+ y: g - h + 16,
1407
1552
  textAnchor: "middle",
1408
- children: b.label
1553
+ children: N.label
1409
1554
  },
1410
1555
  `x${S}`
1411
1556
  )),
1412
- o.map((b) => {
1413
- const S = C && !s.has(b.driverName);
1557
+ o.map((N) => {
1558
+ const S = M && !s.has(N.driverName);
1414
1559
  return /* @__PURE__ */ l("g", { opacity: S ? 0.12 : 1, children: [
1415
- w(b.positions).map((R, I) => /* @__PURE__ */ n(
1560
+ C(N.positions).map((y, A) => /* @__PURE__ */ n(
1416
1561
  "polyline",
1417
1562
  {
1418
1563
  fill: "none",
1419
- stroke: b.colour,
1564
+ stroke: N.colour,
1420
1565
  strokeWidth: S ? 1 : 2,
1421
- points: R.map(([F, Fe]) => `${F},${Fe}`).join(" ")
1566
+ points: y.map(([R, H]) => `${R},${H}`).join(" ")
1422
1567
  },
1423
- I
1568
+ A
1424
1569
  )),
1425
- !S && b.positions.map((R, I) => R != null && /* @__PURE__ */ n("circle", { cx: m(I), cy: k(R), r: 2.4, fill: b.colour, children: /* @__PURE__ */ n("title", { children: `${b.driverName} — ${t[I].label}: P${R}` }) }, I))
1426
- ] }, b.driverName);
1570
+ !S && N.positions.map((y, A) => y != null && /* @__PURE__ */ n("circle", { cx: x(A), cy: w(y), r: 2.4, fill: N.colour, children: /* @__PURE__ */ n("title", { children: `${N.driverName} — ${r[A].label}: P${y}` }) }, A))
1571
+ ] }, N.driverName);
1427
1572
  })
1428
1573
  ]
1429
1574
  }
1430
1575
  ),
1431
1576
  /* @__PURE__ */ l("div", { className: "pvx-positions-legend", children: [
1432
- o.map((b) => {
1433
- const S = C && !s.has(b.driverName);
1577
+ o.map((N) => {
1578
+ const S = M && !s.has(N.driverName);
1434
1579
  return /* @__PURE__ */ l(
1435
1580
  "button",
1436
1581
  {
1437
1582
  type: "button",
1438
1583
  className: "pvx-positions-legend-item",
1439
1584
  style: { opacity: S ? 0.4 : 1 },
1440
- onClick: () => i(b.driverName),
1585
+ onClick: () => i(N.driverName),
1441
1586
  children: [
1442
- /* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background: b.colour } }),
1443
- b.driverName
1587
+ /* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background: N.colour } }),
1588
+ N.driverName
1444
1589
  ]
1445
1590
  },
1446
- b.driverName
1591
+ N.driverName
1447
1592
  );
1448
1593
  }),
1449
- C && /* @__PURE__ */ n(
1594
+ M && /* @__PURE__ */ n(
1450
1595
  "button",
1451
1596
  {
1452
1597
  type: "button",
@@ -1458,36 +1603,36 @@ function Sn({ title: e, drivers: r, timingPoints: t }) {
1458
1603
  ] })
1459
1604
  ] });
1460
1605
  }
1461
- function $n({ positions: e }) {
1462
- const r = (e == null ? void 0 : e.timingPoints) || [], t = (e == null ? void 0 : e.drivers) || [], s = $(() => {
1463
- const a = [...new Set(t.map((i) => i.carClass).filter(Boolean))];
1464
- return a.length <= 1 ? [{ title: a[0] || null, drivers: t }] : a.sort().map((i) => ({
1606
+ function Vn({ positions: e }) {
1607
+ const t = (e == null ? void 0 : e.timingPoints) || [], r = (e == null ? void 0 : e.drivers) || [], s = T(() => {
1608
+ const a = [...new Set(r.map((i) => i.carClass).filter(Boolean))];
1609
+ return a.length <= 1 ? [{ title: a[0] || null, drivers: r }] : a.sort().map((i) => ({
1465
1610
  title: i,
1466
- drivers: Ln(
1467
- t.filter((o) => o.carClass === i),
1468
- r.length
1611
+ drivers: Hn(
1612
+ r.filter((o) => o.carClass === i),
1613
+ t.length
1469
1614
  )
1470
1615
  }));
1471
- }, [t, r.length]);
1472
- return !r.length || !t.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: s.map((a, i) => /* @__PURE__ */ n(
1473
- Sn,
1616
+ }, [r, t.length]);
1617
+ return !t.length || !r.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: s.map((a, i) => /* @__PURE__ */ n(
1618
+ jn,
1474
1619
  {
1475
1620
  title: s.length > 1 ? a.title : null,
1476
1621
  drivers: a.drivers,
1477
- timingPoints: r
1622
+ timingPoints: t
1478
1623
  },
1479
1624
  a.title || i
1480
1625
  )) });
1481
1626
  }
1482
- function Lt({ competitionId: e, roundNumber: r, className: t }) {
1627
+ function qt({ competitionId: e, roundNumber: t, className: r }) {
1483
1628
  var p;
1484
- const { data: s, isLoading: a } = Ze(e, r);
1629
+ const { data: s, isLoading: a } = nn(e, t);
1485
1630
  if (a)
1486
- return /* @__PURE__ */ n(V, { message: "Loading results..." });
1631
+ return /* @__PURE__ */ n(W, { message: "Loading results..." });
1487
1632
  if (!s)
1488
1633
  return /* @__PURE__ */ n(U, { message: "No results for this round." });
1489
- const o = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, h) => c.position - h.position);
1490
- return /* @__PURE__ */ l("div", { className: `pvx-round-results ${t || ""}`, children: [
1634
+ const o = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
1635
+ return /* @__PURE__ */ l("div", { className: `pvx-round-results ${r || ""}`, children: [
1491
1636
  /* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
1492
1637
  /* @__PURE__ */ l("div", { children: [
1493
1638
  /* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
@@ -1502,66 +1647,66 @@ function Lt({ competitionId: e, roundNumber: r, className: t }) {
1502
1647
  }) })
1503
1648
  ] }),
1504
1649
  (d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1505
- /* @__PURE__ */ n("span", { children: de[c.position - 1] }),
1650
+ /* @__PURE__ */ n("span", { children: he[c.position - 1] }),
1506
1651
  /* @__PURE__ */ n("span", { children: c.driverName })
1507
1652
  ] }, c.driverId)) })
1508
1653
  ] }),
1509
- /* @__PURE__ */ n(he, { round: s, competitionId: e })
1654
+ /* @__PURE__ */ n(ve, { round: s, competitionId: e })
1510
1655
  ] });
1511
1656
  }
1512
- function he({ round: e, competitionId: r, className: t }) {
1513
- var u, y, x, v, N, m;
1514
- const [s, a] = B(null), i = (e == null ? void 0 : e.sessions) || [];
1657
+ function ve({ round: e, competitionId: t, className: r }) {
1658
+ var h, k, m, g, b, x;
1659
+ const [s, a] = E(null), i = (e == null ? void 0 : e.sessions) || [];
1515
1660
  if (!i.length)
1516
1661
  return /* @__PURE__ */ n(U, { message: "No session data for this round." });
1517
- const { data: o } = nn(
1518
- r,
1662
+ const { data: o } = an(
1663
+ t,
1519
1664
  e == null ? void 0 : e.roundNumber,
1520
1665
  {}
1521
- ), d = i.some((k) => k.type === "RACE"), { data: p } = tn(
1522
- r,
1666
+ ), d = i.some((w) => w.type === "RACE"), { data: p } = on(
1667
+ t,
1523
1668
  e == null ? void 0 : e.roundNumber,
1524
- { enabled: !!r && d }
1525
- ), c = s || ((u = i.find((k) => k.type === "RACE")) == null ? void 0 : u.type) || ((y = i[0]) == null ? void 0 : y.type), h = i.find((k) => k.type === c) || i[0], g = ((v = (x = o == null ? void 0 : o.sessions) == null ? void 0 : x.find((k) => k.type === c)) == null ? void 0 : v.drivers) || null, f = (h == null ? void 0 : h.type) === "RACE" && ((N = p == null ? void 0 : p.timingPoints) == null ? void 0 : N.length) > 0 && ((m = p == null ? void 0 : p.drivers) == null ? void 0 : m.length) > 0;
1526
- return /* @__PURE__ */ l("div", { className: t || "", children: [
1669
+ { enabled: !!t && d }
1670
+ ), c = s || ((h = i.find((w) => w.type === "RACE")) == null ? void 0 : h.type) || ((k = i[0]) == null ? void 0 : k.type), u = i.find((w) => w.type === c) || i[0], v = ((g = (m = o == null ? void 0 : o.sessions) == null ? void 0 : m.find((w) => w.type === c)) == null ? void 0 : g.drivers) || null, f = (u == null ? void 0 : u.type) === "RACE" && ((b = p == null ? void 0 : p.timingPoints) == null ? void 0 : b.length) > 0 && ((x = p == null ? void 0 : p.drivers) == null ? void 0 : x.length) > 0;
1671
+ return /* @__PURE__ */ l("div", { className: r || "", children: [
1527
1672
  /* @__PURE__ */ n(
1528
- un,
1673
+ xn,
1529
1674
  {
1530
1675
  sessions: i,
1531
1676
  activeSession: c,
1532
1677
  onSelect: a
1533
1678
  }
1534
1679
  ),
1535
- /* @__PURE__ */ n(Rn, { session: h, sessionLaps: g }),
1680
+ /* @__PURE__ */ n(Wn, { session: u, sessionLaps: v }),
1536
1681
  f && /* @__PURE__ */ l("div", { className: "pvx-positions-section", children: [
1537
1682
  /* @__PURE__ */ n("div", { className: "pvx-positions-section-title", children: "Race Positions" }),
1538
- /* @__PURE__ */ n($n, { positions: p })
1683
+ /* @__PURE__ */ n(Vn, { positions: p })
1539
1684
  ] })
1540
1685
  ] });
1541
1686
  }
1542
- function Rn({ session: e, sessionLaps: r }) {
1543
- var h;
1544
- const t = e.type === "RACE", [s, a] = B(null);
1545
- if (!((h = e.results) != null && h.length))
1687
+ function Wn({ session: e, sessionLaps: t }) {
1688
+ var u;
1689
+ const r = e.type === "RACE", [s, a] = E(null);
1690
+ if (!((u = e.results) != null && u.length))
1546
1691
  return /* @__PURE__ */ n(U, { message: `No results for ${e.type}.` });
1547
- const i = vn(e.results), o = t ? 7 : 4, d = [...new Set(e.results.map((g) => g.carClass).filter(Boolean))], p = d.length > 1, c = (g, f, u) => {
1548
- var v;
1549
- const y = (v = r == null ? void 0 : r[g.driverId]) == null ? void 0 : v.laps, x = s === g.driverId && !!y;
1692
+ const i = Nn(e.results), o = r ? 7 : 4, d = [...new Set(e.results.map((v) => v.carClass).filter(Boolean))], p = d.length > 1, c = (v, f, h) => {
1693
+ var g;
1694
+ const k = (g = t == null ? void 0 : t[v.driverId]) == null ? void 0 : g.laps, m = s === v.driverId && !!k;
1550
1695
  return /* @__PURE__ */ n(
1551
- Tn,
1696
+ Kn,
1552
1697
  {
1553
- result: g,
1554
- isRace: t,
1698
+ result: v,
1699
+ isRace: r,
1555
1700
  fastestSplits: i,
1556
1701
  rowIndex: f,
1557
- displayPosition: u,
1558
- hasLapDetail: !!y,
1559
- isExpanded: x,
1560
- onToggle: () => a(x ? null : g.driverId),
1561
- driverLaps: x ? y : null,
1702
+ displayPosition: h,
1703
+ hasLapDetail: !!k,
1704
+ isExpanded: m,
1705
+ onToggle: () => a(m ? null : v.driverId),
1706
+ driverLaps: m ? k : null,
1562
1707
  colCount: o
1563
1708
  },
1564
- g.driverId || f
1709
+ v.driverId || f
1565
1710
  );
1566
1711
  };
1567
1712
  return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
@@ -1570,36 +1715,36 @@ function Rn({ session: e, sessionLaps: r }) {
1570
1715
  /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
1571
1716
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1572
1717
  /* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
1573
- t && /* @__PURE__ */ l(_, { children: [
1718
+ r && /* @__PURE__ */ l(B, { children: [
1574
1719
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1575
1720
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1576
1721
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
1577
1722
  ] })
1578
1723
  ] }) }),
1579
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((g) => {
1580
- const f = e.results.filter((u) => u.carClass === g).sort((u, y) => (u.classPosition ?? u.position) - (y.classPosition ?? y.position));
1724
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((v) => {
1725
+ const f = e.results.filter((h) => h.carClass === v).sort((h, k) => (h.classPosition ?? h.position) - (k.classPosition ?? k.position));
1581
1726
  return [
1582
- /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: o, className: "pvx-td pvx-td--class-header", children: g }) }, `hdr-${g}`),
1727
+ /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: o, className: "pvx-td pvx-td--class-header", children: v }) }, `hdr-${v}`),
1583
1728
  ...f.map(
1584
- (u, y) => c(u, y, u.classPosition ?? u.position)
1729
+ (h, k) => c(h, k, h.classPosition ?? h.position)
1585
1730
  )
1586
1731
  ];
1587
- }) : e.results.map((g, f) => c(g, f)) })
1732
+ }) : e.results.map((v, f) => c(v, f)) })
1588
1733
  ] }) });
1589
1734
  }
1590
- function Tn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, displayPosition: a, hasLapDetail: i, isExpanded: o, onToggle: d, driverLaps: p, colCount: c }) {
1591
- const h = a ?? e.position, g = h <= 3;
1592
- return /* @__PURE__ */ l(_, { children: [
1735
+ function Kn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, displayPosition: a, hasLapDetail: i, isExpanded: o, onToggle: d, driverLaps: p, colCount: c }) {
1736
+ const u = a ?? e.position, v = u <= 3;
1737
+ return /* @__PURE__ */ l(B, { children: [
1593
1738
  /* @__PURE__ */ l(
1594
1739
  "tr",
1595
1740
  {
1596
- className: `pvx-row ${g ? "pvx-row--podium" : ""} ${i ? "pvx-row--expandable" : ""}`,
1741
+ className: `pvx-row ${v ? "pvx-row--podium" : ""} ${i ? "pvx-row--expandable" : ""}`,
1597
1742
  onClick: i ? d : void 0,
1598
1743
  style: i ? { cursor: "pointer" } : void 0,
1599
1744
  children: [
1600
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ue, { position: h }) }),
1745
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: u }) }),
1601
1746
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1602
- /* @__PURE__ */ n(Z, { nation: e.nation }),
1747
+ /* @__PURE__ */ n(ne, { nation: e.nation }),
1603
1748
  e.driverName,
1604
1749
  e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
1605
1750
  "#",
@@ -1607,18 +1752,18 @@ function Tn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, displayPositi
1607
1752
  ] }),
1608
1753
  e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
1609
1754
  ] }),
1610
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: A(e.carId) }),
1755
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: _(e.carId) }),
1611
1756
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
1612
- Dn,
1757
+ Gn,
1613
1758
  {
1614
1759
  bestLap: e.bestLapFormatted,
1615
1760
  hasBestLap: e.hasBestLap,
1616
1761
  splits: e.splits,
1617
- fastestSplits: t,
1762
+ fastestSplits: r,
1618
1763
  showAbove: s <= 1
1619
1764
  }
1620
1765
  ) }),
1621
- r && /* @__PURE__ */ l(_, { children: [
1766
+ t && /* @__PURE__ */ l(B, { children: [
1622
1767
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
1623
1768
  /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
1624
1769
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
@@ -1634,11 +1779,11 @@ function Tn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, displayPositi
1634
1779
  ]
1635
1780
  }
1636
1781
  ),
1637
- o && p && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: c, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(Mn, { laps: p }) }) })
1782
+ o && p && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: c, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(On, { laps: p }) }) })
1638
1783
  ] });
1639
1784
  }
1640
- function Mn({ laps: e }) {
1641
- const r = Math.min(...e.filter((t) => t.valid && t.timeMs > 0).map((t) => t.timeMs));
1785
+ function On({ laps: e }) {
1786
+ const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
1642
1787
  return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
1643
1788
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1644
1789
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
@@ -1647,22 +1792,22 @@ function Mn({ laps: e }) {
1647
1792
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
1648
1793
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
1649
1794
  ] }) }),
1650
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((t) => {
1795
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((r) => {
1651
1796
  var a;
1652
- const s = t.valid && t.timeMs === r;
1653
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${t.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
1654
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: t.lap }),
1655
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: t.time }),
1656
- (t.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
1657
- Array.from({ length: Math.max(0, 3 - (((a = t.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
1658
- ] }, t.lap);
1797
+ const s = r.valid && r.timeMs === t;
1798
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
1799
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
1800
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
1801
+ (r.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
1802
+ Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
1803
+ ] }, r.lap);
1659
1804
  }) })
1660
1805
  ] });
1661
1806
  }
1662
- function Dn({ bestLap: e, hasBestLap: r, splits: t, fastestSplits: s, showAbove: a }) {
1663
- return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${r ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1807
+ function Gn({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
1808
+ return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1664
1809
  /* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
1665
- (t == null ? void 0 : t.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: t.map((i, o) => {
1810
+ (r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((i, o) => {
1666
1811
  const d = s && i === s[o];
1667
1812
  return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
1668
1813
  /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
@@ -1674,13 +1819,13 @@ function Dn({ bestLap: e, hasBestLap: r, splits: t, fastestSplits: s, showAbove:
1674
1819
  }) }) })
1675
1820
  ] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
1676
1821
  }
1677
- function St({ competitionId: e, className: r }) {
1678
- const { getSteamId: t } = L(), { data: s, isLoading: a } = Le(e), i = t();
1822
+ function Ht({ competitionId: e, className: t }) {
1823
+ const { getSteamId: r } = L(), { data: s, isLoading: a } = Re(e), i = r();
1679
1824
  if (a)
1680
- return /* @__PURE__ */ n(V, { message: "Loading drivers..." });
1825
+ return /* @__PURE__ */ n(W, { message: "Loading drivers..." });
1681
1826
  const o = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
1682
- return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${r || ""}`, children: o.map((d) => {
1683
- var c, h;
1827
+ return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
1828
+ var c, u;
1684
1829
  const p = i && d.steamId === i;
1685
1830
  return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
1686
1831
  d.avatarUrl ? /* @__PURE__ */ n(
@@ -1690,7 +1835,7 @@ function St({ competitionId: e, className: r }) {
1690
1835
  alt: "",
1691
1836
  className: "pvx-entry-avatar"
1692
1837
  }
1693
- ) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((h = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : h.toUpperCase()) || "?" }),
1838
+ ) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((u = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : u.toUpperCase()) || "?" }),
1694
1839
  /* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
1695
1840
  d.displayName,
1696
1841
  p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
@@ -1698,24 +1843,24 @@ function St({ competitionId: e, className: r }) {
1698
1843
  ] }, d.steamId || d.driverId);
1699
1844
  }) }) : /* @__PURE__ */ n(U, { message: "No drivers registered yet." });
1700
1845
  }
1701
- function $t({
1846
+ function jt({
1702
1847
  competitionId: e,
1703
- driverData: r,
1704
- className: t,
1848
+ driverData: t,
1849
+ className: r,
1705
1850
  children: s
1706
1851
  }) {
1707
- const { data: a, isLoading: i } = ae(e), { isPowerMode: o } = ie(), d = oe(e), p = Se(e), c = $e(e), h = (a == null ? void 0 : a.isRegistered) || !1, g = i || p.isPending || c.isPending, f = p.error || c.error || null, u = () => {
1708
- o && p.mutate(r || {});
1709
- }, y = () => {
1852
+ const { data: a, isLoading: i } = le(e), { isPowerMode: o } = ce(), d = de(e), p = Te(e), c = $e(e), u = (a == null ? void 0 : a.isRegistered) || !1, v = i || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
1853
+ o && p.mutate(t || {});
1854
+ }, k = () => {
1710
1855
  o && c.mutate();
1711
1856
  };
1712
- return typeof s == "function" ? s({ isRegistered: h, isLoading: g, register: u, withdraw: y, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
1857
+ return typeof s == "function" ? s({ isRegistered: u, isLoading: v, register: h, withdraw: k, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
1713
1858
  "button",
1714
1859
  {
1715
- className: `pvx-comp-register-btn ${t || ""}`,
1716
- onClick: h ? y : u,
1717
- disabled: g,
1718
- children: g ? "Loading..." : h ? "Withdraw" : "Register"
1860
+ className: `pvx-comp-register-btn ${r || ""}`,
1861
+ onClick: u ? k : h,
1862
+ disabled: v,
1863
+ children: v ? "Loading..." : u ? "Withdraw" : "Register"
1719
1864
  }
1720
1865
  ) : /* @__PURE__ */ n(
1721
1866
  "a",
@@ -1723,51 +1868,51 @@ function $t({
1723
1868
  href: d,
1724
1869
  target: "_blank",
1725
1870
  rel: "noopener noreferrer",
1726
- className: `pvx-comp-register-link ${t || ""}`,
1727
- children: h ? "View Registration" : "Register on PitVox"
1871
+ className: `pvx-comp-register-link ${r || ""}`,
1872
+ children: u ? "View Registration" : "Register on PitVox"
1728
1873
  }
1729
1874
  );
1730
1875
  }
1731
- function Rt({ competitionId: e, registration: r, onWithdrawSuccess: t, className: s }) {
1732
- const { getSteamId: a } = L(), { isPowerMode: i } = ie(), o = oe(e), { data: d, isLoading: p } = ae(e), { data: c, isLoading: h } = Le(e), g = Se(e), f = $e(e), u = a(), y = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], v = r || {}, N = x.length || v.currentCount || 0, m = v.maxParticipants && N >= v.maxParticipants, k = v.deadline && new Date(v.deadline) < /* @__PURE__ */ new Date(), w = v.isOpen && !k && !m;
1733
- return p || h ? /* @__PURE__ */ n(V, { message: "Loading registration..." }) : y ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1734
- Bn,
1876
+ function Vt({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
1877
+ const { getSteamId: a } = L(), { isPowerMode: i } = ce(), o = de(e), { data: d, isLoading: p } = le(e), { data: c, isLoading: u } = Re(e), v = Te(e), f = $e(e), h = a(), k = (d == null ? void 0 : d.isRegistered) || !1, m = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], g = t || {}, b = m.length || g.currentCount || 0, x = g.maxParticipants && b >= g.maxParticipants, w = g.deadline && new Date(g.deadline) < /* @__PURE__ */ new Date(), C = g.isOpen && !w && !x;
1878
+ return p || u ? /* @__PURE__ */ n(W, { message: "Loading registration..." }) : k ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1879
+ Qn,
1735
1880
  {
1736
1881
  competitionId: e,
1737
- drivers: x,
1738
- steamId: u,
1882
+ drivers: m,
1883
+ steamId: h,
1739
1884
  isPowerMode: i,
1740
1885
  registrationUrl: o,
1741
1886
  withdrawMutation: f,
1742
- onWithdrawSuccess: t,
1743
- registration: v
1887
+ onWithdrawSuccess: r,
1888
+ registration: g
1744
1889
  }
1745
- ) }) : w ? u ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1746
- Pn,
1890
+ ) }) : C ? h ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1891
+ zn,
1747
1892
  {
1748
1893
  competitionId: e,
1749
- registerMutation: g,
1750
- registration: v
1894
+ registerMutation: v,
1895
+ registration: g
1751
1896
  }
1752
1897
  ) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: i ? /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${s || ""}`, children: [
1753
- /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: m ? "Registration is full." : k ? "Registration deadline has passed." : "Registration is closed." }),
1754
- x.length > 0 && /* @__PURE__ */ n(Ae, { drivers: x, steamId: u })
1898
+ /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: x ? "Registration is full." : w ? "Registration deadline has passed." : "Registration is closed." }),
1899
+ m.length > 0 && /* @__PURE__ */ n(Ee, { drivers: m, steamId: h })
1755
1900
  ] });
1756
1901
  }
1757
- function Pn({ competitionId: e, registerMutation: r, registration: t }) {
1758
- const [s, a] = B(""), [i, o] = B("intermediate"), [d, p] = B(""), c = (u) => {
1759
- u.preventDefault(), r.mutate({
1902
+ function zn({ competitionId: e, registerMutation: t, registration: r }) {
1903
+ const [s, a] = E(""), [i, o] = E("intermediate"), [d, p] = E(""), c = (h) => {
1904
+ h.preventDefault(), t.mutate({
1760
1905
  discordUsername: s || void 0,
1761
1906
  experience: i,
1762
1907
  comments: d || void 0
1763
1908
  });
1764
- }, h = t || {}, g = h.currentCount || 0, f = h.maxParticipants;
1909
+ }, u = r || {}, v = u.currentCount || 0, f = u.maxParticipants;
1765
1910
  return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
1766
1911
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1767
1912
  /* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
1768
- f && /* @__PURE__ */ n(Ie, { count: g, max: f })
1913
+ f && /* @__PURE__ */ n(_e, { count: v, max: f })
1769
1914
  ] }),
1770
- r.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: r.error.message || "Registration failed" }),
1915
+ t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
1771
1916
  /* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
1772
1917
  /* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${e}`, children: [
1773
1918
  "Discord Username ",
@@ -1781,7 +1926,7 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
1781
1926
  className: "pvx-reg-input",
1782
1927
  placeholder: "e.g. username",
1783
1928
  value: s,
1784
- onChange: (u) => a(u.target.value)
1929
+ onChange: (h) => a(h.target.value)
1785
1930
  }
1786
1931
  )
1787
1932
  ] }),
@@ -1793,7 +1938,7 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
1793
1938
  id: `pvx-exp-${e}`,
1794
1939
  className: "pvx-reg-select",
1795
1940
  value: i,
1796
- onChange: (u) => o(u.target.value),
1941
+ onChange: (h) => o(h.target.value),
1797
1942
  children: [
1798
1943
  /* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
1799
1944
  /* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
@@ -1815,7 +1960,7 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
1815
1960
  rows: 3,
1816
1961
  placeholder: "Anything the organisers should know?",
1817
1962
  value: d,
1818
- onChange: (u) => p(u.target.value)
1963
+ onChange: (h) => p(h.target.value)
1819
1964
  }
1820
1965
  )
1821
1966
  ] }),
@@ -1824,26 +1969,26 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
1824
1969
  {
1825
1970
  type: "submit",
1826
1971
  className: "pvx-comp-register-btn",
1827
- disabled: r.isPending,
1828
- children: r.isPending ? "Registering..." : "Register"
1972
+ disabled: t.isPending,
1973
+ children: t.isPending ? "Registering..." : "Register"
1829
1974
  }
1830
1975
  ) })
1831
1976
  ] });
1832
1977
  }
1833
- function Bn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1834
- const [p, c] = B(!1), h = () => {
1978
+ function Qn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1979
+ const [p, c] = E(!1), u = () => {
1835
1980
  i.mutate(void 0, {
1836
1981
  onSuccess: () => {
1837
1982
  c(!1), o && o();
1838
1983
  }
1839
1984
  });
1840
- }, g = d || {}, f = r.length || g.currentCount || 0, u = g.maxParticipants;
1841
- return /* @__PURE__ */ l(_, { children: [
1985
+ }, v = d || {}, f = t.length || v.currentCount || 0, h = v.maxParticipants;
1986
+ return /* @__PURE__ */ l(B, { children: [
1842
1987
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1843
1988
  /* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
1844
- u && /* @__PURE__ */ n(Ie, { count: f, max: u })
1989
+ h && /* @__PURE__ */ n(_e, { count: f, max: h })
1845
1990
  ] }),
1846
- /* @__PURE__ */ n(Ae, { drivers: r, steamId: t }),
1991
+ /* @__PURE__ */ n(Ee, { drivers: t, steamId: r }),
1847
1992
  i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
1848
1993
  s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
1849
1994
  /* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
@@ -1862,7 +2007,7 @@ function Bn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registra
1862
2007
  {
1863
2008
  type: "button",
1864
2009
  className: "pvx-reg-danger-btn",
1865
- onClick: h,
2010
+ onClick: u,
1866
2011
  disabled: i.isPending,
1867
2012
  children: i.isPending ? "Unregistering..." : "Yes, Unregister"
1868
2013
  }
@@ -1879,16 +2024,16 @@ function Bn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registra
1879
2024
  ) }) : /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
1880
2025
  ] });
1881
2026
  }
1882
- function Ae({ drivers: e, steamId: r }) {
2027
+ function Ee({ drivers: e, steamId: t }) {
1883
2028
  if (!e.length)
1884
2029
  return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
1885
- const t = [...e].sort((s, a) => {
1886
- const i = r && s.steamId === r ? -1 : 0, o = r && a.steamId === r ? -1 : 0;
2030
+ const r = [...e].sort((s, a) => {
2031
+ const i = t && s.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
1887
2032
  return i - o;
1888
2033
  });
1889
- return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: t.map((s) => {
2034
+ return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
1890
2035
  var i, o;
1891
- const a = r && s.steamId === r;
2036
+ const a = t && s.steamId === t;
1892
2037
  return /* @__PURE__ */ l(
1893
2038
  "div",
1894
2039
  {
@@ -1905,73 +2050,89 @@ function Ae({ drivers: e, steamId: r }) {
1905
2050
  );
1906
2051
  }) });
1907
2052
  }
1908
- function Ie({ count: e, max: r }) {
1909
- const t = r ? e / r * 100 : 0, s = t >= 100 ? "full" : t >= 75 ? "warning" : "ok";
2053
+ function _e({ count: e, max: t }) {
2054
+ const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
1910
2055
  return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
1911
2056
  e,
1912
2057
  "/",
1913
- r,
2058
+ t,
1914
2059
  " drivers"
1915
2060
  ] });
1916
2061
  }
1917
- function Tt({ competitionId: e, className: r }) {
1918
- const { data: t, isLoading: s } = we(e), a = (t == null ? void 0 : t.type) === "championship", i = (t == null ? void 0 : t.type) === "hotlap", { data: o } = en(i ? e : null), d = $(
1919
- () => {
1920
- var w;
1921
- return ((w = t == null ? void 0 : t.rounds) == null ? void 0 : w.filter((C) => C.isFinalized)) || [];
1922
- },
1923
- [t]
1924
- ), p = $(
1925
- () => d.map((w) => w.roundNumber),
1926
- [d]
1927
- ), { data: c = [], isLoading: h } = Xe(
2062
+ function Wt({ competitionId: e, className: t }) {
2063
+ const { data: r, isLoading: s } = Se(e), a = (r == null ? void 0 : r.type) === "championship", i = (r == null ? void 0 : r.type) === "hotlap", o = T(() => (r == null ? void 0 : r.rounds) || [], [r]), d = i && o.length > 1, p = i && !d, { data: c } = rn(p ? e : null), u = T(
2064
+ () => o.filter((y) => y.isFinalized),
2065
+ [o]
2066
+ ), v = T(
2067
+ () => u.map((y) => y.roundNumber),
2068
+ [u]
2069
+ ), { data: f = [], isLoading: h } = tn(
1928
2070
  e,
1929
- p
1930
- ), g = i && c.length > 0 ? c[0] : null, f = (g == null ? void 0 : g.sessions) || [], u = i ? "leaderboard" : a ? "standings" : p.length > 0 ? `round-${p[p.length - 1]}` : null, [y, x] = B(null), v = y || u;
2071
+ v
2072
+ ), k = p && f.length > 0 ? f[0] : null, m = (k == null ? void 0 : k.sessions) || [], g = d ? o.find(
2073
+ (y) => y.startTime && new Date(y.startTime) <= /* @__PURE__ */ new Date() && !j(y)
2074
+ ) : null, b = d ? g ? `hlround-${g.roundNumber}` : "standings" : p ? "leaderboard" : a ? "standings" : v.length > 0 ? `round-${v[v.length - 1]}` : null, [x, w] = E(null), C = x || b;
1931
2075
  if (s || h)
1932
- return /* @__PURE__ */ n(V, { message: "Loading results..." });
1933
- if (!t)
2076
+ return /* @__PURE__ */ n(W, { message: "Loading results..." });
2077
+ if (!r)
1934
2078
  return /* @__PURE__ */ n(U, { message: "Competition not found." });
1935
- if (!d.length)
2079
+ if (!u.length)
1936
2080
  return /* @__PURE__ */ n(U, { message: "No results available yet. Results will appear here once rounds are finalised." });
1937
- const N = new Map(c.map((w) => [`round-${w.roundNumber}`, w])), m = [];
1938
- if (a && m.push({ id: "standings", label: "Standings" }), i) {
1939
- m.push({ id: "leaderboard", label: "Leaderboard" });
1940
- for (const w of f)
1941
- m.push({ id: `session-${w.type}`, label: pe(w.type) });
2081
+ const M = new Map(f.map((y) => [`round-${y.roundNumber}`, y])), P = new Map(f.map((y) => [y.roundNumber, y])), N = [];
2082
+ if (d) {
2083
+ N.push({ id: "standings", label: "Standings" });
2084
+ for (const y of [...o].sort((A, R) => A.roundNumber - R.roundNumber))
2085
+ N.push({ id: `hlround-${y.roundNumber}`, label: `R${y.roundNumber}`, track: y.track || null });
2086
+ } else if (p) {
2087
+ N.push({ id: "leaderboard", label: "Leaderboard" });
2088
+ for (const y of m)
2089
+ N.push({ id: `session-${y.type}`, label: ee(y.type) });
2090
+ } else if (a) {
2091
+ N.push({ id: "standings", label: "Standings" });
2092
+ for (const y of u)
2093
+ N.push({ id: `round-${y.roundNumber}`, label: `R${y.roundNumber}`, track: null });
1942
2094
  } else
1943
- for (const w of d)
1944
- m.push({
1945
- id: `round-${w.roundNumber}`,
1946
- label: `R${w.roundNumber}`,
1947
- track: null
1948
- });
1949
- const k = N.get(v);
1950
- return /* @__PURE__ */ l("div", { className: r || "", children: [
1951
- /* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: m.map((w) => /* @__PURE__ */ l(
2095
+ for (const y of u)
2096
+ N.push({ id: `round-${y.roundNumber}`, label: `R${y.roundNumber}`, track: null });
2097
+ let S;
2098
+ if (C === "standings")
2099
+ S = /* @__PURE__ */ n(Fn, { competitionId: e });
2100
+ else if (C === "leaderboard")
2101
+ S = /* @__PURE__ */ n(Ue, { leaderboard: c, config: r });
2102
+ else if (C != null && C.startsWith("hlround-")) {
2103
+ const y = parseInt(C.slice(8), 10), A = o.find((R) => R.roundNumber === y);
2104
+ S = A ? /* @__PURE__ */ n(Zn, { competitionId: e, roundMeta: A, roundData: P.get(y) }) : /* @__PURE__ */ n(U, { message: "No results for this round." });
2105
+ } else if (C != null && C.startsWith("session-"))
2106
+ S = /* @__PURE__ */ n(
2107
+ Fe,
2108
+ {
2109
+ session: m.find((y) => `session-${y.type}` === C),
2110
+ round: k,
2111
+ competitionId: e
2112
+ }
2113
+ );
2114
+ else {
2115
+ const y = M.get(C);
2116
+ S = y ? /* @__PURE__ */ n(Yn, { round: y, competitionId: e }) : /* @__PURE__ */ n(U, { message: "No results for this round." });
2117
+ }
2118
+ return /* @__PURE__ */ l("div", { className: t || "", children: [
2119
+ /* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: N.map((y) => /* @__PURE__ */ l(
1952
2120
  "button",
1953
2121
  {
1954
- className: `pvx-results-tab ${v === w.id ? "pvx-results-tab--active" : ""}`,
1955
- onClick: () => x(w.id),
1956
- title: w.track || void 0,
2122
+ className: `pvx-results-tab ${C === y.id ? "pvx-results-tab--active" : ""}`,
2123
+ onClick: () => w(y.id),
2124
+ title: y.track || void 0,
1957
2125
  children: [
1958
- /* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: w.label }),
1959
- w.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: w.track })
2126
+ /* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: y.label }),
2127
+ y.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: y.track })
1960
2128
  ]
1961
2129
  },
1962
- w.id
2130
+ y.id
1963
2131
  )) }),
1964
- v === "standings" ? /* @__PURE__ */ n(wn, { competitionId: e }) : v === "leaderboard" ? /* @__PURE__ */ n(In, { leaderboard: o, config: t }) : v != null && v.startsWith("session-") ? /* @__PURE__ */ n(
1965
- Un,
1966
- {
1967
- session: f.find((w) => `session-${w.type}` === v),
1968
- round: g,
1969
- competitionId: e
1970
- }
1971
- ) : k ? /* @__PURE__ */ n(An, { round: k, competitionId: e }) : /* @__PURE__ */ n(U, { message: "No results for this round." })
2132
+ S
1972
2133
  ] });
1973
2134
  }
1974
- function An({ round: e, competitionId: r }) {
2135
+ function Yn({ round: e, competitionId: t }) {
1975
2136
  var i;
1976
2137
  const s = (e.sessions || []).find((o) => o.type === "RACE"), a = (i = s == null ? void 0 : s.results) == null ? void 0 : i.filter((o) => o.position <= 3).sort((o, d) => o.position - d.position);
1977
2138
  return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
@@ -1989,18 +2150,18 @@ function An({ round: e, competitionId: r }) {
1989
2150
  }) })
1990
2151
  ] }),
1991
2152
  (a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((o) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1992
- /* @__PURE__ */ n("span", { children: de[o.position - 1] }),
2153
+ /* @__PURE__ */ n("span", { children: he[o.position - 1] }),
1993
2154
  /* @__PURE__ */ n("span", { children: o.driverName })
1994
2155
  ] }, o.driverId)) })
1995
2156
  ] }),
1996
- /* @__PURE__ */ n(he, { round: e, competitionId: r })
2157
+ /* @__PURE__ */ n(ve, { round: e, competitionId: t })
1997
2158
  ] });
1998
2159
  }
1999
- function In({ leaderboard: e, config: r }) {
2000
- var t;
2001
- return (t = e == null ? void 0 : e.drivers) != null && t.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
2160
+ function Ue({ leaderboard: e, config: t, heading: r }) {
2161
+ var s;
2162
+ return (s = e == null ? void 0 : e.drivers) != null && s.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
2002
2163
  /* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
2003
- /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: e.track || (r == null ? void 0 : r.name) || "Hotlap Leaderboard" }),
2164
+ /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: r || e.track || (t == null ? void 0 : t.name) || "Hotlap Leaderboard" }),
2004
2165
  /* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
2005
2166
  e.sessionsCompleted,
2006
2167
  " session",
@@ -2018,47 +2179,72 @@ function In({ leaderboard: e, config: r }) {
2018
2179
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Sessions" }),
2019
2180
  /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
2020
2181
  ] }) }),
2021
- /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((s) => {
2022
- const a = s.position === 1 ? "" : `+${((s.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
2023
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${s.position <= 3 ? "pvx-row--podium" : ""}`, children: [
2024
- /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ue, { position: s.position }) }),
2182
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((a) => {
2183
+ const i = a.position === 1 ? "" : `+${((a.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
2184
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${a.position <= 3 ? "pvx-row--podium" : ""}`, children: [
2185
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: a.position }) }),
2025
2186
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
2026
- /* @__PURE__ */ n(Z, { nation: s.nation }),
2027
- s.driverName
2187
+ /* @__PURE__ */ n(ne, { nation: a.nation }),
2188
+ a.driverName
2028
2189
  ] }),
2029
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: A(s.carId) }),
2030
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: s.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: s.bestLapFormatted }) }),
2031
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.totalLaps }),
2032
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.sessionsParticipated }),
2033
- /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: a })
2034
- ] }, s.driverId);
2190
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: _(a.carId) }),
2191
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: a.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: a.bestLapFormatted }) }),
2192
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.totalLaps }),
2193
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.sessionsParticipated }),
2194
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i })
2195
+ ] }, a.driverId);
2035
2196
  }) })
2036
2197
  ] }) })
2037
2198
  ] }) : /* @__PURE__ */ n(U, { message: "No lap times recorded yet." });
2038
2199
  }
2039
- function Un({ session: e, round: r, competitionId: t }) {
2200
+ function Fe({ session: e, round: t, competitionId: r }) {
2040
2201
  return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
2041
- /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: pe(e.type) }) }),
2202
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: ee(e.type) }) }),
2042
2203
  /* @__PURE__ */ n(
2043
- he,
2204
+ ve,
2044
2205
  {
2045
- round: { ...r, sessions: [e] },
2046
- competitionId: t
2206
+ round: { ...t, sessions: [e] },
2207
+ competitionId: r
2047
2208
  }
2048
2209
  )
2049
2210
  ] }) : /* @__PURE__ */ n(U, { message: "Session data not available." });
2050
2211
  }
2051
- function Fn(e) {
2052
- const { cdnUrl: r } = L(), t = T({
2212
+ function Zn({ competitionId: e, roundMeta: t, roundData: r }) {
2213
+ const { data: s } = sn(e, t.roundNumber), a = (r == null ? void 0 : r.sessions) || [], [i, o] = E("leaderboard"), d = [
2214
+ { id: "leaderboard", label: "Leaderboard" },
2215
+ ...a.map((u) => ({ id: `session-${u.type}`, label: ee(u.type) }))
2216
+ ], p = d.some((u) => u.id === i) ? i : "leaderboard", c = `Round ${t.roundNumber}${t.track ? ` — ${t.track}` : ""}`;
2217
+ return /* @__PURE__ */ l("div", { children: [
2218
+ /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: d.map((u) => /* @__PURE__ */ n(
2219
+ "button",
2220
+ {
2221
+ onClick: () => o(u.id),
2222
+ className: `pvx-session-tab ${p === u.id ? "pvx-session-tab--active" : ""}`,
2223
+ children: u.label
2224
+ },
2225
+ u.id
2226
+ )) }),
2227
+ p === "leaderboard" ? /* @__PURE__ */ n(Ue, { leaderboard: s, heading: c }) : /* @__PURE__ */ n(
2228
+ Fe,
2229
+ {
2230
+ session: a.find((u) => `session-${u.type}` === p),
2231
+ round: r,
2232
+ competitionId: e
2233
+ }
2234
+ )
2235
+ ] });
2236
+ }
2237
+ function Jn(e) {
2238
+ const { cdnUrl: t } = L(), r = $({
2053
2239
  queryKey: ["pitvox", "laps", "global", e, "index"],
2054
- queryFn: () => M(r, Ne(null, e)),
2240
+ queryFn: () => D(t, ye(null, e)),
2055
2241
  enabled: !!e,
2056
2242
  staleTime: 3e4,
2057
2243
  refetchInterval: 3e4
2058
- }), s = t.data;
2244
+ }), s = r.data;
2059
2245
  return {
2060
- isLoading: t.isLoading,
2061
- error: t.error,
2246
+ isLoading: r.isLoading,
2247
+ error: r.error,
2062
2248
  data: s ? {
2063
2249
  driverName: s.driverName || "Driver",
2064
2250
  lapCount: s.lapCount || 0,
@@ -2074,14 +2260,14 @@ function Fn(e) {
2074
2260
  } : null
2075
2261
  };
2076
2262
  }
2077
- function En(e) {
2078
- const { cdnUrl: r, partnerSlug: t } = L(), s = T({
2079
- queryKey: ["pitvox", "laps", t || "global", e, "index"],
2080
- queryFn: () => M(r, Ne(t, e)),
2263
+ function Xn(e) {
2264
+ const { cdnUrl: t, partnerSlug: r } = L(), s = $({
2265
+ queryKey: ["pitvox", "laps", r || "global", e, "index"],
2266
+ queryFn: () => D(t, ye(r, e)),
2081
2267
  enabled: !!e,
2082
2268
  staleTime: 3e4,
2083
2269
  refetchInterval: 3e4
2084
- }), a = $(() => {
2270
+ }), a = T(() => {
2085
2271
  var i;
2086
2272
  return ((i = s.data) == null ? void 0 : i.combos) || [];
2087
2273
  }, [s.data]);
@@ -2091,168 +2277,168 @@ function En(e) {
2091
2277
  data: a
2092
2278
  };
2093
2279
  }
2094
- function Ue(e = {}) {
2095
- const { cdnUrl: r, partnerSlug: t } = L(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = re(t, s, a, "ratings.json");
2096
- return T({
2097
- queryKey: ["pitvox", "ratings", t, s || null, a || null],
2098
- queryFn: () => M(r, o),
2280
+ function qe(e = {}) {
2281
+ const { cdnUrl: t, partnerSlug: r } = L(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = ie(r, s, a, "ratings.json");
2282
+ return $({
2283
+ queryKey: ["pitvox", "ratings", r, s || null, a || null],
2284
+ queryFn: () => D(t, o),
2099
2285
  staleTime: 3e4,
2100
2286
  refetchInterval: 3e4,
2101
2287
  enabled: i
2102
2288
  });
2103
2289
  }
2104
- function Mt(e) {
2290
+ function Kt(e) {
2105
2291
  var s;
2106
- const r = Ue(), t = $(() => {
2292
+ const t = qe(), r = T(() => {
2107
2293
  var a;
2108
- return !((a = r.data) != null && a.drivers) || !e ? null : r.data.drivers.find(
2294
+ return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
2109
2295
  (i) => i.identifier === e
2110
2296
  ) || null;
2111
- }, [(s = r.data) == null ? void 0 : s.drivers, e]);
2297
+ }, [(s = t.data) == null ? void 0 : s.drivers, e]);
2112
2298
  return {
2113
- isLoading: r.isLoading,
2114
- error: r.error,
2115
- data: t ? {
2116
- rating: t.rating,
2117
- rank: t.rank,
2118
- totalDrivers: r.data.driverCount || r.data.drivers.length,
2119
- comboCount: t.comboCount || 0,
2120
- distinctCars: t.distinctCars || 0,
2121
- combos: t.combos || []
2299
+ isLoading: t.isLoading,
2300
+ error: t.error,
2301
+ data: r ? {
2302
+ rating: r.rating,
2303
+ rank: r.rank,
2304
+ totalDrivers: t.data.driverCount || t.data.drivers.length,
2305
+ comboCount: r.comboCount || 0,
2306
+ distinctCars: r.distinctCars || 0,
2307
+ combos: r.combos || []
2122
2308
  } : null
2123
2309
  };
2124
2310
  }
2125
- function ne(e = {}) {
2126
- const r = Ue(e);
2311
+ function se(e = {}) {
2312
+ const t = qe(e);
2127
2313
  return {
2128
- data: r.data || null,
2129
- isLoading: r.isLoading,
2130
- error: r.error
2314
+ data: t.data || null,
2315
+ isLoading: t.isLoading,
2316
+ error: t.error
2131
2317
  };
2132
2318
  }
2133
- function qn(e) {
2319
+ function et(e) {
2134
2320
  var p, c;
2135
- const { versions: r } = Ge(), t = (p = r == null ? void 0 : r.evo) == null ? void 0 : p.default, s = (c = r == null ? void 0 : r.lmu) == null ? void 0 : c.default, a = ne({ game: "evo", gameVersion: t, enabled: !!t }), i = ne({ game: "acc" }), o = ne({ game: "lmu", gameVersion: s, enabled: !!s });
2321
+ const { versions: t } = Je(), r = (p = t == null ? void 0 : t.evo) == null ? void 0 : p.default, s = (c = t == null ? void 0 : t.lmu) == null ? void 0 : c.default, a = se({ game: "evo", gameVersion: r, enabled: !!r }), i = se({ game: "acc" }), o = se({ game: "lmu", gameVersion: s, enabled: !!s });
2136
2322
  return {
2137
- data: $(() => e ? [
2323
+ data: T(() => e ? [
2138
2324
  { data: a.data, game: "evo", label: "EVO" },
2139
2325
  { data: i.data, game: "acc", label: "ACC" },
2140
2326
  { data: o.data, game: "lmu", label: "LMU" }
2141
- ].map(({ data: h, game: g, label: f }) => {
2142
- var x;
2143
- if (!((x = h == null ? void 0 : h.drivers) != null && x.length)) return null;
2144
- const u = [...h.drivers].sort((v, N) => N.rating - v.rating), y = u.findIndex((v) => v.identifier === e);
2145
- return y === -1 ? null : {
2146
- game: g,
2327
+ ].map(({ data: u, game: v, label: f }) => {
2328
+ var m;
2329
+ if (!((m = u == null ? void 0 : u.drivers) != null && m.length)) return null;
2330
+ const h = [...u.drivers].sort((g, b) => b.rating - g.rating), k = h.findIndex((g) => g.identifier === e);
2331
+ return k === -1 ? null : {
2332
+ game: v,
2147
2333
  label: f,
2148
- rating: u[y].rating,
2149
- rank: y + 1,
2150
- totalDrivers: u.length
2334
+ rating: h[k].rating,
2335
+ rank: k + 1,
2336
+ totalDrivers: h.length
2151
2337
  };
2152
2338
  }).filter(Boolean) : [], [e, a.data, i.data, o.data]),
2153
2339
  isLoading: a.isLoading || i.isLoading || o.isLoading
2154
2340
  };
2155
2341
  }
2156
- function _n() {
2157
- const { cdnUrl: e, partnerSlug: r, getSteamId: t, onFetchServerPassword: s } = L(), a = t(), { data: i, isLoading: o } = T({
2158
- queryKey: ["pitvox", "competitions", r],
2342
+ function nt() {
2343
+ const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = L(), a = r(), { data: i, isLoading: o } = $({
2344
+ queryKey: ["pitvox", "competitions", t],
2159
2345
  queryFn: async () => {
2160
- const u = await M(e, "competitions/index.json");
2161
- return u != null && u.competitions ? u.competitions.filter((y) => y.partnerSlug === r) : [];
2346
+ const h = await D(e, "competitions/index.json");
2347
+ return h != null && h.competitions ? h.competitions.filter((k) => k.partnerSlug === t) : [];
2162
2348
  },
2163
2349
  staleTime: 6e4
2164
- }), d = (i == null ? void 0 : i.map((u) => u.id)) || [], p = me({
2165
- queries: d.map((u) => ({
2166
- queryKey: ["pitvox", "competition", r, u, "entrylist"],
2167
- queryFn: () => M(e, `competitions/${r}/${u}/entrylist.json`),
2350
+ }), d = (i == null ? void 0 : i.map((h) => h.id)) || [], p = xe({
2351
+ queries: d.map((h) => ({
2352
+ queryKey: ["pitvox", "competition", t, h, "entrylist"],
2353
+ queryFn: () => D(e, `competitions/${t}/${h}/entrylist.json`),
2168
2354
  enabled: !!a && d.length > 0,
2169
2355
  staleTime: 6e4
2170
2356
  }))
2171
- }), c = p.some((u) => u.isLoading), h = $(() => {
2172
- var x, v;
2357
+ }), c = p.some((h) => h.isLoading), u = T(() => {
2358
+ var m, g;
2173
2359
  if (!i || !a || c) return [];
2174
- const u = /* @__PURE__ */ new Date(), y = [];
2175
- for (let N = 0; N < i.length; N++) {
2176
- const m = i[N], k = (x = p[N]) == null ? void 0 : x.data;
2177
- if (!((v = k == null ? void 0 : k.drivers) == null ? void 0 : v.some((b) => b.steamId === a))) continue;
2178
- const C = m.type === "hotlap", D = m.rounds || [];
2179
- for (const b of D) {
2180
- if (b.isFinalized && (!C || b.dediStatus === "completed")) continue;
2181
- const S = b.dediStatus === "running" || b.dediStatus === "provisioning", R = b.dediStatus === "scheduled", I = b.startTime && new Date(b.startTime) > u, F = S || R || b.dediServerAddress;
2182
- !S && !I && !F || y.push({
2183
- competitionId: m.id,
2184
- competitionName: m.name,
2185
- roundNumber: b.roundNumber,
2186
- track: b.track || "TBD",
2187
- startTime: b.startTime,
2188
- dediStatus: b.dediStatus || null,
2189
- dediServerAddress: b.dediServerAddress || null
2360
+ const h = /* @__PURE__ */ new Date(), k = [];
2361
+ for (let b = 0; b < i.length; b++) {
2362
+ const x = i[b], w = (m = p[b]) == null ? void 0 : m.data;
2363
+ if (!((g = w == null ? void 0 : w.drivers) == null ? void 0 : g.some((N) => N.steamId === a))) continue;
2364
+ const M = x.type === "hotlap", P = x.rounds || [];
2365
+ for (const N of P) {
2366
+ if (M ? j(N) : N.isFinalized) continue;
2367
+ const y = N.dediStatus === "running" || N.dediStatus === "provisioning", A = N.dediStatus === "scheduled", R = N.startTime && new Date(N.startTime) > h, H = y || A || N.dediServerAddress;
2368
+ !y && !R && !H || k.push({
2369
+ competitionId: x.id,
2370
+ competitionName: x.name,
2371
+ roundNumber: N.roundNumber,
2372
+ track: N.track || "TBD",
2373
+ startTime: N.startTime,
2374
+ dediStatus: N.dediStatus || null,
2375
+ dediServerAddress: N.dediServerAddress || null
2190
2376
  });
2191
2377
  }
2192
2378
  }
2193
- return y.sort((N, m) => {
2194
- const k = N.dediStatus === "running" || N.dediStatus === "provisioning", w = m.dediStatus === "running" || m.dediStatus === "provisioning";
2195
- return k && !w ? -1 : !k && w ? 1 : new Date(N.startTime) - new Date(m.startTime);
2196
- }), y.length > 0 && (y[0].isNext = !0), y;
2197
- }, [i, a, c, p]), g = me({
2198
- queries: h.map((u) => ({
2199
- queryKey: ["pitvox", "serverInfo", u.competitionId, u.roundNumber],
2200
- queryFn: () => s(u.competitionId, u.roundNumber),
2201
- enabled: !!s && h.length > 0,
2379
+ return k.sort((b, x) => {
2380
+ const w = b.dediStatus === "running" || b.dediStatus === "provisioning", C = x.dediStatus === "running" || x.dediStatus === "provisioning";
2381
+ return w && !C ? -1 : !w && C ? 1 : new Date(b.startTime) - new Date(x.startTime);
2382
+ }), k.length > 0 && (k[0].isNext = !0), k;
2383
+ }, [i, a, c, p]), v = xe({
2384
+ queries: u.map((h) => ({
2385
+ queryKey: ["pitvox", "serverInfo", h.competitionId, h.roundNumber],
2386
+ queryFn: () => s(h.competitionId, h.roundNumber),
2387
+ enabled: !!s && u.length > 0,
2202
2388
  staleTime: 5 * 6e4,
2203
2389
  // 5 minutes
2204
2390
  retry: !1
2205
2391
  }))
2206
2392
  });
2207
2393
  return {
2208
- data: $(() => h.length ? s ? h.map((u, y) => {
2209
- var v;
2210
- const x = (v = g[y]) == null ? void 0 : v.data;
2211
- return x != null && x.success ? {
2212
- ...u,
2213
- serverAddress: x.serverAddress || null,
2214
- serverPassword: x.serverPassword || null
2215
- } : u;
2216
- }) : h : [], [h, s, g]),
2394
+ data: T(() => u.length ? s ? u.map((h, k) => {
2395
+ var g;
2396
+ const m = (g = v[k]) == null ? void 0 : g.data;
2397
+ return m != null && m.success ? {
2398
+ ...h,
2399
+ serverAddress: m.serverAddress || null,
2400
+ serverPassword: m.serverPassword || null
2401
+ } : h;
2402
+ }) : u : [], [u, s, v]),
2217
2403
  isLoading: o || !!a && c
2218
2404
  };
2219
2405
  }
2220
- function jn() {
2406
+ function tt() {
2221
2407
  const { onFetchNotifications: e } = L();
2222
2408
  return !!e;
2223
2409
  }
2224
- function Vn(e = {}) {
2225
- const { onFetchNotifications: r, partnerSlug: t } = L(), { limit: s = 20, unreadOnly: a = !1 } = e;
2226
- return T({
2227
- queryKey: ["pitvox", "notifications", t, { limit: s, unreadOnly: a }],
2228
- queryFn: () => r({ limit: s, unreadOnly: a }),
2229
- enabled: !!r,
2410
+ function rt(e = {}) {
2411
+ const { onFetchNotifications: t, partnerSlug: r } = L(), { limit: s = 20, unreadOnly: a = !1 } = e;
2412
+ return $({
2413
+ queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
2414
+ queryFn: () => t({ limit: s, unreadOnly: a }),
2415
+ enabled: !!t,
2230
2416
  staleTime: 3e4,
2231
2417
  refetchInterval: 3e4
2232
2418
  });
2233
2419
  }
2234
- function Dt() {
2235
- const { onFetchNotifications: e, partnerSlug: r } = L(), { data: t, isLoading: s } = T({
2236
- queryKey: ["pitvox", "notifications", r, { limit: 1, unreadOnly: !1 }],
2420
+ function Ot() {
2421
+ const { onFetchNotifications: e, partnerSlug: t } = L(), { data: r, isLoading: s } = $({
2422
+ queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
2237
2423
  queryFn: () => e({ limit: 1 }),
2238
2424
  enabled: !!e,
2239
2425
  staleTime: 3e4,
2240
2426
  refetchInterval: 3e4,
2241
2427
  select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
2242
2428
  });
2243
- return { count: t ?? 0, isLoading: s };
2429
+ return { count: r ?? 0, isLoading: s };
2244
2430
  }
2245
- function Kn() {
2246
- const { onMarkNotificationRead: e, partnerSlug: r } = L(), t = H();
2247
- return Q({
2431
+ function st() {
2432
+ const { onMarkNotificationRead: e, partnerSlug: t } = L(), r = O();
2433
+ return Y({
2248
2434
  mutationFn: (s) => {
2249
2435
  if (!e)
2250
2436
  throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
2251
2437
  return e(s);
2252
2438
  },
2253
2439
  onSuccess: (s, a) => {
2254
- t.setQueriesData(
2255
- { queryKey: ["pitvox", "notifications", r] },
2440
+ r.setQueriesData(
2441
+ { queryKey: ["pitvox", "notifications", t] },
2256
2442
  (i) => i != null && i.notifications ? {
2257
2443
  ...i,
2258
2444
  unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
@@ -2264,17 +2450,17 @@ function Kn() {
2264
2450
  }
2265
2451
  });
2266
2452
  }
2267
- function Hn() {
2268
- const { onMarkAllNotificationsRead: e, partnerSlug: r } = L(), t = H();
2269
- return Q({
2453
+ function at() {
2454
+ const { onMarkAllNotificationsRead: e, partnerSlug: t } = L(), r = O();
2455
+ return Y({
2270
2456
  mutationFn: () => {
2271
2457
  if (!e)
2272
2458
  throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
2273
2459
  return e();
2274
2460
  },
2275
2461
  onSuccess: () => {
2276
- t.setQueriesData(
2277
- { queryKey: ["pitvox", "notifications", r] },
2462
+ r.setQueriesData(
2463
+ { queryKey: ["pitvox", "notifications", t] },
2278
2464
  (s) => s != null && s.notifications ? {
2279
2465
  ...s,
2280
2466
  unreadCount: 0,
@@ -2288,10 +2474,10 @@ function Hn() {
2288
2474
  }
2289
2475
  });
2290
2476
  }
2291
- function Wn({ driverName: e, avatarUrl: r, memberSince: t, className: s = "" }) {
2292
- const a = t ? new Date(t).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
2477
+ function it({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
2478
+ const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
2293
2479
  return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
2294
- r ? /* @__PURE__ */ n("img", { src: r, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
2480
+ t ? /* @__PURE__ */ n("img", { src: t, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
2295
2481
  /* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
2296
2482
  /* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
2297
2483
  a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
@@ -2301,7 +2487,7 @@ function Wn({ driverName: e, avatarUrl: r, memberSince: t, className: s = "" })
2301
2487
  ] })
2302
2488
  ] });
2303
2489
  }
2304
- function On() {
2490
+ function ot() {
2305
2491
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2306
2492
  /* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
2307
2493
  /* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
@@ -2309,7 +2495,7 @@ function On() {
2309
2495
  /* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
2310
2496
  ] });
2311
2497
  }
2312
- function zn() {
2498
+ function lt() {
2313
2499
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2314
2500
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
2315
2501
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
@@ -2318,53 +2504,53 @@ function zn() {
2318
2504
  /* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
2319
2505
  ] });
2320
2506
  }
2321
- function ge() {
2507
+ function Ne() {
2322
2508
  return /* @__PURE__ */ n("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
2323
2509
  }
2324
- function fe({ icon: e, value: r, label: t, items: s, labelKey: a, countKey: i }) {
2325
- const [o, d] = B(!1), p = _e(null);
2326
- je(() => {
2510
+ function be({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: i }) {
2511
+ const [o, d] = E(!1), p = Ve(null);
2512
+ We(() => {
2327
2513
  if (!o) return;
2328
- function h(g) {
2329
- p.current && !p.current.contains(g.target) && d(!1);
2514
+ function u(v) {
2515
+ p.current && !p.current.contains(v.target) && d(!1);
2330
2516
  }
2331
- return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
2517
+ return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
2332
2518
  }, [o]);
2333
- const c = s != null && s.length ? s.slice().sort((h, g) => g[i] - h[i]) : null;
2519
+ const c = s != null && s.length ? s.slice().sort((u, v) => v[i] - u[i]) : null;
2334
2520
  return /* @__PURE__ */ l(
2335
2521
  "div",
2336
2522
  {
2337
2523
  ref: p,
2338
2524
  className: `pvx-dash-stat-card ${c ? "pvx-dash-stat-card--clickable" : ""}`,
2339
- onClick: c ? () => d((h) => !h) : void 0,
2525
+ onClick: c ? () => d((u) => !u) : void 0,
2340
2526
  children: [
2341
2527
  e,
2342
2528
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2343
- /* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: r }),
2344
- /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: t })
2529
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
2530
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
2345
2531
  ] }),
2346
- c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((h, g) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
2347
- /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: h[a] }),
2348
- /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: h[i] })
2349
- ] }, g)) })
2532
+ c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, v) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
2533
+ /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
2534
+ /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[i] })
2535
+ ] }, v)) })
2350
2536
  ]
2351
2537
  }
2352
2538
  );
2353
2539
  }
2354
- function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, className: a = "" }) {
2540
+ function ct({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, className: a = "" }) {
2355
2541
  if (!e) return null;
2356
2542
  const i = e.trackBreakdown.map((p) => ({
2357
- name: j(p.trackId, p.layout),
2543
+ name: V(p.trackId, p.layout),
2358
2544
  lapCount: p.lapCount
2359
2545
  })), o = e.carBreakdown.map((p) => ({
2360
- name: A(p.carId),
2546
+ name: _(p.carId),
2361
2547
  lapCount: p.lapCount
2362
- })), d = Array.isArray(r) && r.length > 0;
2548
+ })), d = Array.isArray(t) && t.length > 0;
2363
2549
  return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${a}`, children: [
2364
2550
  /* @__PURE__ */ n(
2365
- fe,
2551
+ be,
2366
2552
  {
2367
- icon: /* @__PURE__ */ n(On, {}),
2553
+ icon: /* @__PURE__ */ n(ot, {}),
2368
2554
  value: e.lapCount.toLocaleString(),
2369
2555
  label: "Total Laps",
2370
2556
  items: i,
@@ -2373,9 +2559,9 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
2373
2559
  }
2374
2560
  ),
2375
2561
  /* @__PURE__ */ n(
2376
- fe,
2562
+ be,
2377
2563
  {
2378
- icon: /* @__PURE__ */ n(zn, {}),
2564
+ icon: /* @__PURE__ */ n(lt, {}),
2379
2565
  value: e.carBreakdown.length,
2380
2566
  label: "Cars Used",
2381
2567
  items: o,
@@ -2384,18 +2570,18 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
2384
2570
  }
2385
2571
  ),
2386
2572
  d ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating-chips", children: [
2387
- /* @__PURE__ */ n(ge, {}),
2573
+ /* @__PURE__ */ n(Ne, {}),
2388
2574
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2389
2575
  /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
2390
- /* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: r.map((p) => {
2391
- const c = !!t;
2576
+ /* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: t.map((p) => {
2577
+ const c = !!r;
2392
2578
  return /* @__PURE__ */ l(
2393
2579
  "span",
2394
2580
  {
2395
2581
  className: `pvx-dash-rating-chip${c ? " pvx-dash-rating-chip--clickable" : ""}`,
2396
- onClick: c ? () => t(p) : void 0,
2397
- onKeyDown: c ? (g) => {
2398
- c && (g.key === "Enter" || g.key === " ") && (g.preventDefault(), t(p));
2582
+ onClick: c ? () => r(p) : void 0,
2583
+ onKeyDown: c ? (v) => {
2584
+ c && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), r(p));
2399
2585
  } : void 0,
2400
2586
  role: c ? "button" : void 0,
2401
2587
  tabIndex: c ? 0 : void 0,
@@ -2416,7 +2602,7 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
2416
2602
  }) })
2417
2603
  ] })
2418
2604
  ] }) : s ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
2419
- /* @__PURE__ */ n(ge, {}),
2605
+ /* @__PURE__ */ n(Ne, {}),
2420
2606
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2421
2607
  /* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: s.rating.toFixed(1) }),
2422
2608
  /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
@@ -2430,8 +2616,8 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
2430
2616
  ] }) : null
2431
2617
  ] });
2432
2618
  }
2433
- function Gn({ combos: e, onComboSelect: r, className: t = "" }) {
2434
- return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
2619
+ function dt({ combos: e, onComboSelect: t, className: r = "" }) {
2620
+ return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
2435
2621
  /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2436
2622
  /* @__PURE__ */ n("span", { className: "pvx-dash-combos-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2437
2623
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
@@ -2445,36 +2631,36 @@ function Gn({ combos: e, onComboSelect: r, className: t = "" }) {
2445
2631
  ] })
2446
2632
  ] }) }),
2447
2633
  /* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((s) => /* @__PURE__ */ n(
2448
- Yn,
2634
+ pt,
2449
2635
  {
2450
2636
  combo: s,
2451
- onClick: r ? () => r(s) : null
2637
+ onClick: t ? () => t(s) : null
2452
2638
  },
2453
2639
  `${s.trackId}|${s.trackLayout || ""}|${s.carId}|${s.game || ""}|${s.gameVersion || ""}`
2454
2640
  )) })
2455
2641
  ] }) : null;
2456
2642
  }
2457
- function Yn({ combo: e, onClick: r }) {
2458
- const t = e.game || "evo", s = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
2643
+ function pt({ combo: e, onClick: t }) {
2644
+ const r = e.game || "evo", s = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
2459
2645
  return /* @__PURE__ */ l(
2460
2646
  "div",
2461
2647
  {
2462
- className: `pvx-dash-combo-row${r ? " pvx-dash-combo-row--clickable" : ""}`,
2463
- onClick: r || void 0,
2464
- onKeyDown: r ? (d) => {
2465
- r && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), r());
2648
+ className: `pvx-dash-combo-row${t ? " pvx-dash-combo-row--clickable" : ""}`,
2649
+ onClick: t || void 0,
2650
+ onKeyDown: t ? (d) => {
2651
+ t && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), t());
2466
2652
  } : void 0,
2467
- role: r ? "button" : void 0,
2468
- tabIndex: r ? 0 : void 0,
2653
+ role: t ? "button" : void 0,
2654
+ tabIndex: t ? 0 : void 0,
2469
2655
  children: [
2470
2656
  /* @__PURE__ */ l("div", { className: "pvx-dash-combo-info", children: [
2471
2657
  /* @__PURE__ */ l("div", { className: "pvx-dash-combo-title", children: [
2472
- e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${t}`, children: t.toUpperCase() }),
2473
- /* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: j(e.trackId, e.trackLayout, e.game) })
2658
+ e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r}`, children: r.toUpperCase() }),
2659
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: V(e.trackId, e.trackLayout, e.game) })
2474
2660
  ] }),
2475
2661
  /* @__PURE__ */ l("div", { className: "pvx-dash-combo-meta", children: [
2476
- /* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: A(e.carId) }),
2477
- e.lapCount > 0 && /* @__PURE__ */ l(_, { children: [
2662
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: _(e.carId) }),
2663
+ e.lapCount > 0 && /* @__PURE__ */ l(B, { children: [
2478
2664
  /* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
2479
2665
  /* @__PURE__ */ l("span", { children: [
2480
2666
  e.lapCount,
@@ -2482,9 +2668,9 @@ function Yn({ combo: e, onClick: r }) {
2482
2668
  e.lapCount === 1 ? "lap" : "laps"
2483
2669
  ] })
2484
2670
  ] }),
2485
- e.lastDrivenAt && /* @__PURE__ */ l(_, { children: [
2671
+ e.lastDrivenAt && /* @__PURE__ */ l(B, { children: [
2486
2672
  /* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
2487
- /* @__PURE__ */ n("span", { children: se(e.lastDrivenAt) })
2673
+ /* @__PURE__ */ n("span", { children: oe(e.lastDrivenAt) })
2488
2674
  ] })
2489
2675
  ] })
2490
2676
  ] }),
@@ -2520,15 +2706,15 @@ function Yn({ combo: e, onClick: r }) {
2520
2706
  }
2521
2707
  );
2522
2708
  }
2523
- function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
2524
- if (r)
2709
+ function ut({ events: e, isLoading: t, className: r, limit: s = 3 }) {
2710
+ if (t)
2525
2711
  return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
2526
2712
  if (!(e != null && e.length))
2527
2713
  return null;
2528
2714
  const a = s ? e.slice(0, s) : e, i = e.length - a.length;
2529
- return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
2715
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
2530
2716
  /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2531
- /* @__PURE__ */ n(et, {}),
2717
+ /* @__PURE__ */ n(vt, {}),
2532
2718
  "Upcoming Events",
2533
2719
  /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
2534
2720
  "(",
@@ -2551,7 +2737,7 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
2551
2737
  o.track
2552
2738
  ] }),
2553
2739
  o.serverPassword && /* @__PURE__ */ n(
2554
- Zn,
2740
+ ht,
2555
2741
  {
2556
2742
  password: o.serverPassword,
2557
2743
  address: o.serverAddress
@@ -2564,7 +2750,7 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
2564
2750
  month: "short",
2565
2751
  year: "numeric"
2566
2752
  }) }),
2567
- /* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : Xn(o.startTime) }),
2753
+ /* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : mt(o.startTime) }),
2568
2754
  o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
2569
2755
  !o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
2570
2756
  ] })
@@ -2581,8 +2767,8 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
2581
2767
  ] })
2582
2768
  ] });
2583
2769
  }
2584
- function Zn({ password: e, address: r }) {
2585
- const [t, s] = B(!1), [a, i] = B(!1), o = r ? e ? `join:${r}|${e}` : `join:${r}` : null, d = K(async () => {
2770
+ function ht({ password: e, address: t }) {
2771
+ const [r, s] = E(!1), [a, i] = E(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = K(async () => {
2586
2772
  if (o)
2587
2773
  try {
2588
2774
  await navigator.clipboard.writeText(o), s(!0), setTimeout(() => s(!1), 2e3);
@@ -2597,100 +2783,100 @@ function Zn({ password: e, address: r }) {
2597
2783
  onClick: d,
2598
2784
  title: "Copy join string to clipboard",
2599
2785
  children: [
2600
- /* @__PURE__ */ n(tt, {}),
2786
+ /* @__PURE__ */ n(gt, {}),
2601
2787
  " ",
2602
- t ? "Copied!" : "Join"
2788
+ r ? "Copied!" : "Join"
2603
2789
  ]
2604
2790
  }
2605
2791
  ),
2606
- e && /* @__PURE__ */ l(_, { children: [
2792
+ e && /* @__PURE__ */ l(B, { children: [
2607
2793
  /* @__PURE__ */ n(
2608
2794
  "span",
2609
2795
  {
2610
2796
  className: "pvx-server-detail pvx-server-detail--clickable",
2611
2797
  onClick: () => i((p) => !p),
2612
2798
  title: a ? "Hide password" : "Reveal password",
2613
- children: a ? /* @__PURE__ */ n(st, {}) : /* @__PURE__ */ n(rt, {})
2799
+ children: a ? /* @__PURE__ */ n(Nt, {}) : /* @__PURE__ */ n(ft, {})
2614
2800
  }
2615
2801
  ),
2616
2802
  a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
2617
- /* @__PURE__ */ n(nt, {}),
2803
+ /* @__PURE__ */ n(xt, {}),
2618
2804
  " ",
2619
2805
  e
2620
2806
  ] })
2621
2807
  ] })
2622
2808
  ] });
2623
2809
  }
2624
- function Xn(e) {
2625
- const r = new Date(e).getTime() - Date.now();
2626
- if (r <= 0) return "Now";
2627
- const t = Math.floor(r / (1e3 * 60 * 60));
2628
- if (t < 1) return "Less than 1 hour";
2629
- if (t < 24) return `in ${t}h`;
2630
- const s = Math.floor(t / 24);
2810
+ function mt(e) {
2811
+ const t = new Date(e).getTime() - Date.now();
2812
+ if (t <= 0) return "Now";
2813
+ const r = Math.floor(t / (1e3 * 60 * 60));
2814
+ if (r < 1) return "Less than 1 hour";
2815
+ if (r < 24) return `in ${r}h`;
2816
+ const s = Math.floor(r / 24);
2631
2817
  if (s === 1) return "Tomorrow";
2632
2818
  if (s < 7) return `in ${s} days`;
2633
2819
  if (s < 30) {
2634
2820
  const a = Math.floor(s / 7);
2635
2821
  return `in ${a} week${a !== 1 ? "s" : ""}`;
2636
2822
  }
2637
- return se(e);
2823
+ return oe(e);
2638
2824
  }
2639
- function et() {
2825
+ function vt() {
2640
2826
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2641
2827
  /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2642
2828
  /* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
2643
2829
  ] });
2644
2830
  }
2645
- function nt() {
2831
+ function xt() {
2646
2832
  return /* @__PURE__ */ l("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2647
2833
  /* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
2648
2834
  /* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2649
2835
  ] });
2650
2836
  }
2651
- function tt() {
2837
+ function gt() {
2652
2838
  return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2653
2839
  /* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
2654
2840
  /* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
2655
2841
  ] });
2656
2842
  }
2657
- function rt() {
2843
+ function ft() {
2658
2844
  return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2659
2845
  /* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
2660
2846
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
2661
2847
  ] });
2662
2848
  }
2663
- function st() {
2849
+ function Nt() {
2664
2850
  return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2665
2851
  /* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
2666
2852
  /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2667
2853
  ] });
2668
2854
  }
2669
- function at({ notifications: e, unreadCount: r = 0, onMarkRead: t, onMarkAllRead: s, isLoading: a, className: i }) {
2670
- const o = ke();
2855
+ function bt({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: i }) {
2856
+ const o = Ce();
2671
2857
  return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
2672
2858
  /* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
2673
2859
  /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2674
- /* @__PURE__ */ n(lt, {}),
2860
+ /* @__PURE__ */ n(wt, {}),
2675
2861
  "Notifications",
2676
- r > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: r > 99 ? "99+" : r })
2862
+ t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
2677
2863
  ] }),
2678
- r > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
2864
+ t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
2679
2865
  ] }),
2680
2866
  e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
2681
- it,
2867
+ yt,
2682
2868
  {
2683
2869
  notification: d,
2684
2870
  getUserDisplay: o,
2685
- onMarkRead: t
2871
+ onMarkRead: r
2686
2872
  },
2687
2873
  d.id
2688
2874
  )) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
2689
2875
  ] });
2690
2876
  }
2691
- function it({ notification: e, getUserDisplay: r, onMarkRead: t }) {
2877
+ function yt({ notification: e, getUserDisplay: t, onMarkRead: r }) {
2692
2878
  const s = () => {
2693
- !e.isRead && t && t(e.id);
2879
+ !e.isRead && r && r(e.id);
2694
2880
  };
2695
2881
  return /* @__PURE__ */ l(
2696
2882
  "button",
@@ -2698,17 +2884,17 @@ function it({ notification: e, getUserDisplay: r, onMarkRead: t }) {
2698
2884
  className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
2699
2885
  onClick: s,
2700
2886
  children: [
2701
- /* @__PURE__ */ n(ot, { type: e.type }),
2887
+ /* @__PURE__ */ n(kt, { type: e.type }),
2702
2888
  /* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
2703
- /* @__PURE__ */ n("span", { className: "pvx-notif-message", children: Qe(e, r) }),
2704
- /* @__PURE__ */ n("span", { className: "pvx-notif-time", children: se(e.createdAt) })
2889
+ /* @__PURE__ */ n("span", { className: "pvx-notif-message", children: Ze(e, t) }),
2890
+ /* @__PURE__ */ n("span", { className: "pvx-notif-time", children: oe(e.createdAt) })
2705
2891
  ] }),
2706
2892
  !e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
2707
2893
  ]
2708
2894
  }
2709
2895
  );
2710
2896
  }
2711
- function ot({ type: e }) {
2897
+ function kt({ type: e }) {
2712
2898
  return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2713
2899
  /* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
2714
2900
  /* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
@@ -2721,61 +2907,61 @@ function ot({ type: e }) {
2721
2907
  /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
2722
2908
  ] }) });
2723
2909
  }
2724
- function lt() {
2910
+ function wt() {
2725
2911
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2726
2912
  /* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
2727
2913
  /* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
2728
2914
  ] });
2729
2915
  }
2730
- function Pt({
2916
+ function Gt({
2731
2917
  steamId: e,
2732
- avatarUrl: r,
2733
- memberSince: t,
2918
+ avatarUrl: t,
2919
+ memberSince: r,
2734
2920
  hideProfile: s = !1,
2735
2921
  onComboSelect: a,
2736
2922
  onGameRatingSelect: i,
2737
2923
  className: o = ""
2738
2924
  }) {
2739
- const { data: d, isLoading: p, error: c } = Fn(e), { data: h } = qn(e), { data: g } = En(e), { data: f, isLoading: u } = _n(), y = jn(), { data: x, isLoading: v } = Vn({ limit: 10 }), N = Kn(), m = Hn();
2925
+ const { data: d, isLoading: p, error: c } = Jn(e), { data: u } = et(e), { data: v } = Xn(e), { data: f, isLoading: h } = nt(), k = tt(), { data: m, isLoading: g } = rt({ limit: 10 }), b = st(), x = at();
2740
2926
  return p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : d ? /* @__PURE__ */ l("div", { className: `pvx-dash ${o}`, children: [
2741
2927
  !s && /* @__PURE__ */ n(
2742
- Wn,
2928
+ it,
2743
2929
  {
2744
2930
  driverName: d.driverName,
2745
- avatarUrl: r,
2746
- memberSince: t
2931
+ avatarUrl: t,
2932
+ memberSince: r
2747
2933
  }
2748
2934
  ),
2749
2935
  /* @__PURE__ */ n(
2750
- Qn,
2936
+ ct,
2751
2937
  {
2752
2938
  stats: d,
2753
- gameRatings: h,
2939
+ gameRatings: u,
2754
2940
  onGameRatingSelect: i
2755
2941
  }
2756
2942
  ),
2757
- e && /* @__PURE__ */ n(Jn, { events: f, isLoading: u }),
2758
- /* @__PURE__ */ l("div", { className: `pvx-dash-row ${y ? "pvx-dash-row--2col" : ""}`, children: [
2759
- /* @__PURE__ */ n(Gn, { combos: g, onComboSelect: a }),
2760
- y && /* @__PURE__ */ n(
2761
- at,
2943
+ e && /* @__PURE__ */ n(ut, { events: f, isLoading: h }),
2944
+ /* @__PURE__ */ l("div", { className: `pvx-dash-row ${k ? "pvx-dash-row--2col" : ""}`, children: [
2945
+ /* @__PURE__ */ n(dt, { combos: v, onComboSelect: a }),
2946
+ k && /* @__PURE__ */ n(
2947
+ bt,
2762
2948
  {
2763
- notifications: x == null ? void 0 : x.notifications,
2764
- unreadCount: (x == null ? void 0 : x.unreadCount) || 0,
2765
- onMarkRead: (k) => N.mutate(k),
2766
- onMarkAllRead: () => m.mutate(),
2767
- isLoading: v
2949
+ notifications: m == null ? void 0 : m.notifications,
2950
+ unreadCount: (m == null ? void 0 : m.unreadCount) || 0,
2951
+ onMarkRead: (w) => b.mutate(w),
2952
+ onMarkAllRead: () => x.mutate(),
2953
+ isLoading: g
2768
2954
  }
2769
2955
  )
2770
2956
  ] })
2771
2957
  ] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
2772
2958
  }
2773
- function Bt({ records: e, className: r = "" }) {
2774
- const t = $(() => e != null && e.length ? e.slice().sort((s, a) => {
2959
+ function zt({ records: e, className: t = "" }) {
2960
+ const r = T(() => e != null && e.length ? e.slice().sort((s, a) => {
2775
2961
  const i = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
2776
2962
  return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
2777
2963
  }) : [], [e]);
2778
- return t.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
2964
+ return r.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
2779
2965
  /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2780
2966
  /* @__PURE__ */ n("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2781
2967
  /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
@@ -2788,14 +2974,14 @@ function Bt({ records: e, className: r = "" }) {
2788
2974
  "Current Records",
2789
2975
  /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
2790
2976
  "(",
2791
- t.length,
2977
+ r.length,
2792
2978
  ")"
2793
2979
  ] })
2794
2980
  ] }) }),
2795
- /* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: t.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
2981
+ /* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
2796
2982
  /* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
2797
- /* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: j(s.trackId, s.layout, s.game) }),
2798
- /* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: A(s.carId) })
2983
+ /* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: V(s.trackId, s.layout, s.game) }),
2984
+ /* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: _(s.carId) })
2799
2985
  ] }),
2800
2986
  /* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
2801
2987
  /* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(s.lapTimeMs) }),
@@ -2808,88 +2994,91 @@ function Bt({ records: e, className: r = "" }) {
2808
2994
  ] }) : null;
2809
2995
  }
2810
2996
  export {
2811
- Nt as CarsTable,
2997
+ Bt as CarsTable,
2812
2998
  U as CompEmptyState,
2813
- V as CompLoadingState,
2814
- bn as CompetitionCard,
2815
- Ct as CompetitionCards,
2816
- Tt as CompetitionResultsTabs,
2817
- Nn as CompletedBadge,
2818
- Pe as DEFAULT_COMPLETION_GRACE_DAYS,
2819
- Pt as DriverDashboard,
2820
- Wn as DriverProfile,
2821
- bt as DriversTable,
2822
- St as EntryList,
2823
- ee as InfoPill,
2824
- yt as LapHistoryTable,
2825
- at as NotificationsCard,
2826
- de as PODIUM_MEDALS,
2827
- ut as PitVoxPartnerProvider,
2828
- $n as RacePositionsChart,
2829
- kt as RankingsTable,
2830
- Gn as RecentCombosCard,
2831
- Bt as RecordsTable,
2832
- $t as RegisterButton,
2833
- Rt as RegistrationPanel,
2834
- Lt as RoundResults,
2835
- he as RoundSessionResults,
2836
- wn as StandingsTable,
2837
- Qn as StatsCards,
2838
- ft as TracksTable,
2839
- hn as TypeBadge,
2840
- Jn as UpcomingEvents,
2841
- Ne as buildDriverIndexPath,
2842
- Oe as buildLapsPath,
2843
- re as buildLeaderboardPath,
2844
- ze as buildRecentLapsPath,
2845
- M as fetchCdnJson,
2846
- wt as filterCompetitionsByStatus,
2847
- A as formatCarName,
2848
- W as formatDate,
2849
- ht as formatDelta,
2850
- ye as formatFuel,
2999
+ W as CompLoadingState,
3000
+ En as CompetitionCard,
3001
+ Ft as CompetitionCards,
3002
+ Wt as CompetitionResultsTabs,
3003
+ wn as CompletedBadge,
3004
+ Be as DEFAULT_COMPLETION_GRACE_DAYS,
3005
+ Gt as DriverDashboard,
3006
+ it as DriverProfile,
3007
+ It as DriversTable,
3008
+ Ht as EntryList,
3009
+ re as InfoPill,
3010
+ Et as LapHistoryTable,
3011
+ bt as NotificationsCard,
3012
+ he as PODIUM_MEDALS,
3013
+ Rt as PitVoxPartnerProvider,
3014
+ Vn as RacePositionsChart,
3015
+ _t as RankingsTable,
3016
+ dt as RecentCombosCard,
3017
+ zt as RecordsTable,
3018
+ jt as RegisterButton,
3019
+ Vt as RegistrationPanel,
3020
+ qt as RoundResults,
3021
+ ve as RoundSessionResults,
3022
+ Fn as StandingsTable,
3023
+ ct as StatsCards,
3024
+ Pt as TracksTable,
3025
+ gn as TypeBadge,
3026
+ ut as UpcomingEvents,
3027
+ In as WeatherIcon,
3028
+ ye as buildDriverIndexPath,
3029
+ Qe as buildLapsPath,
3030
+ ie as buildLeaderboardPath,
3031
+ Ye as buildRecentLapsPath,
3032
+ D as fetchCdnJson,
3033
+ Ut as filterCompetitionsByStatus,
3034
+ _ as formatCarName,
3035
+ G as formatDate,
3036
+ Tt as formatDelta,
3037
+ we as formatFuel,
2851
3038
  q as formatLapTime,
2852
- Qe as formatNotificationMessage,
2853
- se as formatRelativeTime,
2854
- E as formatSectorTime,
2855
- pe as formatSessionLabel,
2856
- j as formatTrackName,
2857
- be as formatTyreCompound,
2858
- fn as getCompetitionPodium,
2859
- Be as getCompetitionStatus,
2860
- gn as getCompletionDate,
2861
- xn as isCompetitionComplete,
2862
- xt as useCarLeaderboard,
2863
- mt as useCarMetadata,
2864
- Xe as useCompetitionAllRounds,
2865
- we as useCompetitionConfig,
2866
- Le as useCompetitionEntryList,
2867
- en as useCompetitionLeaderboard,
2868
- Ze as useCompetitionRound,
2869
- nn as useCompetitionRoundLaps,
2870
- tn as useCompetitionRoundPositions,
2871
- Ce as useCompetitionStandings,
2872
- gt as useCompetitions,
2873
- En as useDriverCombos,
2874
- Je as useDriverLaps,
2875
- Mt as useDriverRating,
2876
- ne as useDriverRatings,
2877
- qn as useDriverRatingsByGame,
2878
- Fn as useDriverStats,
2879
- Ge as useLeaderboardIndex,
2880
- Hn as useMarkAllNotificationsRead,
2881
- Kn as useMarkNotificationRead,
2882
- Vn as useNotifications,
2883
- jn as useNotificationsEnabled,
3039
+ Ze as formatNotificationMessage,
3040
+ oe as formatRelativeTime,
3041
+ F as formatSectorTime,
3042
+ ee as formatSessionLabel,
3043
+ V as formatTrackName,
3044
+ ke as formatTyreCompound,
3045
+ kn as getCompetitionPodium,
3046
+ Ie as getCompetitionStatus,
3047
+ yn as getCompletionDate,
3048
+ bn as isCompetitionComplete,
3049
+ j as isRoundClosed,
3050
+ Dt as useCarLeaderboard,
3051
+ $t as useCarMetadata,
3052
+ tn as useCompetitionAllRounds,
3053
+ Se as useCompetitionConfig,
3054
+ Re as useCompetitionEntryList,
3055
+ rn as useCompetitionLeaderboard,
3056
+ nn as useCompetitionRound,
3057
+ an as useCompetitionRoundLaps,
3058
+ sn as useCompetitionRoundLeaderboard,
3059
+ on as useCompetitionRoundPositions,
3060
+ Le as useCompetitionStandings,
3061
+ At as useCompetitions,
3062
+ Xn as useDriverCombos,
3063
+ en as useDriverLaps,
3064
+ Kt as useDriverRating,
3065
+ se as useDriverRatings,
3066
+ et as useDriverRatingsByGame,
3067
+ Jn as useDriverStats,
3068
+ Je as useLeaderboardIndex,
3069
+ at as useMarkAllNotificationsRead,
3070
+ st as useMarkNotificationRead,
3071
+ rt as useNotifications,
3072
+ tt as useNotificationsEnabled,
2884
3073
  L as usePitVox,
2885
- vt as useRecentLaps,
2886
- Se as useRegister,
2887
- ie as useRegistrationMode,
2888
- ae as useRegistrationStatus,
2889
- oe as useRegistrationUrl,
2890
- Ye as useTrackLeaderboard,
2891
- Dt as useUnreadCount,
2892
- _n as useUpcomingEvents,
2893
- ke as useUserLookup,
3074
+ Mt as useRecentLaps,
3075
+ Te as useRegister,
3076
+ ce as useRegistrationMode,
3077
+ le as useRegistrationStatus,
3078
+ de as useRegistrationUrl,
3079
+ Xe as useTrackLeaderboard,
3080
+ Ot as useUnreadCount,
3081
+ nt as useUpcomingEvents,
3082
+ Ce as useUserLookup,
2894
3083
  $e as useWithdraw
2895
3084
  };