@pitvox/partner-react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,70 +1,70 @@
1
- import { jsx as t, jsxs as c, Fragment as z } from "react/jsx-runtime";
2
- import { createContext as Le, useMemo as S, useContext as $e, useState as W, useCallback as H } from "react";
3
- import { useQueryClient as Q, QueryClient as Re, QueryClientProvider as De, useQuery as $, useMutation as re } from "@tanstack/react-query";
1
+ import { jsx as t, jsxs as o, Fragment as z } from "react/jsx-runtime";
2
+ import { createContext as Le, useMemo as k, useContext as Re, useState as W, useCallback as O } from "react";
3
+ import { useQueryClient as Q, QueryClient as $e, QueryClientProvider as De, useQuery as L, useMutation as ae } from "@tanstack/react-query";
4
4
  import { useSearchParams as se } from "react-router-dom";
5
- const G = Le(null), Me = "https://cdn.pitvox.com", Ie = "https://api.pitvox.com";
6
- let O = null;
7
- function Tt({
5
+ const G = Le(null), Be = "https://cdn.pitvox.com", Me = "https://api.pitvox.com";
6
+ let H = null;
7
+ function $t({
8
8
  partnerSlug: e,
9
- apiKey: n,
10
- cdnUrl: r = Me,
11
- apiUrl: s = Ie,
12
- getSteamId: a,
9
+ apiKey: r,
10
+ cdnUrl: n = Be,
11
+ apiUrl: a = Me,
12
+ getSteamId: s,
13
13
  children: i
14
14
  }) {
15
- const l = S(() => ({
15
+ const c = k(() => ({
16
16
  partnerSlug: e,
17
- apiKey: n,
18
- cdnUrl: r.replace(/\/$/, ""),
19
- apiUrl: s.replace(/\/$/, ""),
20
- getSteamId: a || (() => null)
21
- }), [e, n, r, s, a]);
22
- let o = !1;
17
+ apiKey: r,
18
+ cdnUrl: n.replace(/\/$/, ""),
19
+ apiUrl: a.replace(/\/$/, ""),
20
+ getSteamId: s || (() => null)
21
+ }), [e, r, n, a, s]);
22
+ let l = !1;
23
23
  try {
24
- Q(), o = !0;
24
+ Q(), l = !0;
25
25
  } catch {
26
- o = !1;
26
+ l = !1;
27
27
  }
28
- return o ? /* @__PURE__ */ t(G.Provider, { value: l, children: i }) : (O || (O = new Re({
28
+ return l ? /* @__PURE__ */ t(G.Provider, { value: c, children: i }) : (H || (H = new $e({
29
29
  defaultOptions: {
30
30
  queries: { staleTime: 6e4 }
31
31
  }
32
- })), /* @__PURE__ */ t(De, { client: O, children: /* @__PURE__ */ t(G.Provider, { value: l, children: i }) }));
32
+ })), /* @__PURE__ */ t(De, { client: H, children: /* @__PURE__ */ t(G.Provider, { value: c, children: i }) }));
33
33
  }
34
- function k() {
35
- const e = $e(G);
34
+ function T() {
35
+ const e = Re(G);
36
36
  if (!e)
37
37
  throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
38
38
  return e;
39
39
  }
40
- async function D(e, n) {
41
- const r = await fetch(`${e}/${n}`);
42
- if (!r.ok) {
43
- if (r.status === 404 || r.status === 403) return null;
44
- throw new Error(`CDN fetch failed: ${r.status}`);
40
+ async function R(e, r) {
41
+ const n = await fetch(`${e}/${r}`);
42
+ if (!n.ok) {
43
+ if (n.status === 404 || n.status === 403) return null;
44
+ throw new Error(`CDN fetch failed: ${n.status}`);
45
45
  }
46
- return r.json();
46
+ return n.json();
47
47
  }
48
- function q(e) {
48
+ function U(e) {
49
49
  if (!e && e !== 0) return "-";
50
- const n = Math.floor(e / 1e3), r = Math.floor(n / 60), s = n % 60, a = e % 1e3;
51
- return `${r}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
50
+ const r = Math.floor(e / 1e3), n = Math.floor(r / 60), a = r % 60, s = e % 1e3;
51
+ return `${n}:${String(a).padStart(2, "0")}.${String(s).padStart(3, "0")}`;
52
52
  }
53
53
  function P(e) {
54
54
  return !e && e !== 0 ? "-" : (e / 1e3).toFixed(3);
55
55
  }
56
56
  function B(e) {
57
57
  if (!e) return "";
58
- let n = e;
59
- return n.startsWith("ks_") && (n = n.slice(3)), n.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
58
+ let r = e;
59
+ return r.startsWith("ks_") && (r = r.slice(3)), r.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
60
60
  }
61
- function ae(e, n, r) {
62
- const s = e.split("_").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" "), a = r === "acc" || !r && (n == null ? void 0 : n.toLowerCase()) === "track config";
63
- if (!n || n === "default" || a) return s;
64
- const i = n.split("_").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" ");
65
- return `${s} ${i}`;
61
+ function J(e, r, n) {
62
+ const a = e.split("_").map((c) => c.charAt(0).toUpperCase() + c.slice(1)).join(" "), s = n === "acc" || !n && (r == null ? void 0 : r.toLowerCase()) === "track config";
63
+ if (!r || r === "default" || s) return a;
64
+ const i = r.split("_").map((c) => c.charAt(0).toUpperCase() + c.slice(1)).join(" ");
65
+ return `${a} ${i}`;
66
66
  }
67
- function U(e) {
67
+ function E(e) {
68
68
  if (!e) return "-";
69
69
  try {
70
70
  return new Date(e).toLocaleDateString("en-GB", {
@@ -76,18 +76,18 @@ function U(e) {
76
76
  return "-";
77
77
  }
78
78
  }
79
- function St(e) {
79
+ function Dt(e) {
80
80
  if (!e) return "";
81
- const n = Date.now() - new Date(e).getTime(), r = Math.floor(n / 1e3);
82
- if (r < 60) return "Just now";
83
- const s = Math.floor(r / 60);
84
- if (s < 60) return `${s}m ago`;
85
- const a = Math.floor(s / 60);
86
- if (a < 24) return `${a}h ago`;
87
- const i = Math.floor(a / 24);
88
- return i < 30 ? `${i}d ago` : U(e);
89
- }
90
- function kt(e) {
81
+ const r = Date.now() - new Date(e).getTime(), n = Math.floor(r / 1e3);
82
+ if (n < 60) return "Just now";
83
+ const a = Math.floor(n / 60);
84
+ if (a < 60) return `${a}m ago`;
85
+ const s = Math.floor(a / 60);
86
+ if (s < 24) return `${s}h ago`;
87
+ const i = Math.floor(s / 24);
88
+ return i < 30 ? `${i}d ago` : E(e);
89
+ }
90
+ function Bt(e) {
91
91
  return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
92
92
  }
93
93
  function ie(e) {
@@ -104,23 +104,23 @@ function ie(e) {
104
104
  S: "Soft"
105
105
  }[e] || e : "Unknown";
106
106
  }
107
- function Be(e = {}) {
108
- var o, h, d, f, N, x;
109
- const { cdnUrl: n, partnerSlug: r } = k(), { game: s, gameVersion: a } = e, i = $({
110
- queryKey: ["pitvox", "leaderboards", r, "index"],
111
- queryFn: () => D(n, `leaderboards/partners/${r}/index.json`),
107
+ function Ie(e = {}) {
108
+ var l, v, d, f, N, x;
109
+ const { cdnUrl: r, partnerSlug: n } = T(), { game: a, gameVersion: s } = e, i = L({
110
+ queryKey: ["pitvox", "leaderboards", n, "index"],
111
+ queryFn: () => R(r, `leaderboards/partners/${n}/index.json`),
112
112
  staleTime: 3e4,
113
113
  refetchInterval: 3e4
114
- }), l = S(() => {
114
+ }), c = k(() => {
115
115
  var g;
116
116
  if (!((g = i.data) != null && g.tracks)) return [];
117
- let u = i.data.tracks;
118
- return s && (u = u.filter((p) => p.game === s)), a && (u = u.filter((p) => p.gameVersion === a)), u.map((p) => ({
117
+ let m = i.data.tracks;
118
+ return a && (m = m.filter((p) => p.game === a)), s && (m = m.filter((p) => p.gameVersion === s)), m.map((p) => ({
119
119
  id: p.trackId,
120
120
  layout: p.layout,
121
121
  game: p.game,
122
122
  gameVersion: p.gameVersion,
123
- displayName: ae(p.trackId, p.layout, p.game),
123
+ displayName: J(p.trackId, p.layout, p.game),
124
124
  driverCount: p.driverCount || 0,
125
125
  carCount: p.carCount || 0,
126
126
  record: p.recordHolder ? {
@@ -132,224 +132,224 @@ function Be(e = {}) {
132
132
  } : null,
133
133
  recordByTag: p.recordByTag || null
134
134
  }));
135
- }, [(o = i.data) == null ? void 0 : o.tracks, s, a]);
135
+ }, [(l = i.data) == null ? void 0 : l.tracks, a, s]);
136
136
  return {
137
137
  ...i,
138
- data: l,
139
- partner: ((h = i.data) == null ? void 0 : h.partner) || null,
138
+ data: c,
139
+ partner: ((v = i.data) == null ? void 0 : v.partner) || null,
140
140
  generatedAt: (d = i.data) == null ? void 0 : d.generatedAt,
141
141
  totalLaps: ((f = i.data) == null ? void 0 : f.totalLaps) || 0,
142
142
  totalUsers: ((N = i.data) == null ? void 0 : N.totalUsers) || 0,
143
143
  versions: ((x = i.data) == null ? void 0 : x.versions) || {}
144
144
  };
145
145
  }
146
- function oe(e, n, r = {}) {
147
- const { cdnUrl: s, partnerSlug: a } = k(), { carId: i, game: l, gameVersion: o } = r, h = n || "default", d = o ? `leaderboards/partners/${a}/v/${o}/tracks/${e}/${h}.json` : `leaderboards/partners/${a}/tracks/${e}/${h}.json`, { data: f, isLoading: N, error: x } = $({
148
- queryKey: ["pitvox", "leaderboards", a, "track", e, h, o],
149
- queryFn: () => D(s, d),
146
+ function le(e, r, n = {}) {
147
+ const { cdnUrl: a, partnerSlug: s } = T(), { carId: i, game: c, gameVersion: l } = n, v = r || "default", d = l ? `leaderboards/partners/${s}/v/${l}/tracks/${e}/${v}.json` : `leaderboards/partners/${s}/tracks/${e}/${v}.json`, { data: f, isLoading: N, error: x } = L({
148
+ queryKey: ["pitvox", "leaderboards", s, "track", e, v, l],
149
+ queryFn: () => R(a, d),
150
150
  enabled: !!e,
151
151
  staleTime: 3e4,
152
152
  refetchInterval: 3e4
153
153
  });
154
- return { data: S(() => {
154
+ return { data: k(() => {
155
155
  if (!(f != null && f.entries)) return [];
156
156
  let g = f.entries;
157
- if (l && (g = g.filter((p) => p.game === l)), !i) {
158
- const p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
159
- for (const m of g) {
160
- const y = m.steamId || m.userId;
161
- v.has(m.carId) || v.set(m.carId, /* @__PURE__ */ new Set()), v.get(m.carId).add(y), (!p.has(m.carId) || m.lapTimeMs < p.get(m.carId).lapTimeMs) && p.set(m.carId, m);
157
+ if (c && (g = g.filter((p) => p.game === c)), !i) {
158
+ const p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
159
+ for (const u of g) {
160
+ const y = u.steamId || u.userId;
161
+ h.has(u.carId) || h.set(u.carId, /* @__PURE__ */ new Set()), h.get(u.carId).add(y), (!p.has(u.carId) || u.lapTimeMs < p.get(u.carId).lapTimeMs) && p.set(u.carId, u);
162
162
  }
163
- return Array.from(p.values()).map((m) => {
163
+ return Array.from(p.values()).map((u) => {
164
164
  var y;
165
- return { ...m, driverCount: ((y = v.get(m.carId)) == null ? void 0 : y.size) || 0 };
166
- }).sort((m, y) => m.lapTimeMs - y.lapTimeMs);
165
+ return { ...u, driverCount: ((y = h.get(u.carId)) == null ? void 0 : y.size) || 0 };
166
+ }).sort((u, y) => u.lapTimeMs - y.lapTimeMs);
167
167
  }
168
- return g.filter((p) => p.carId === i).sort((p, v) => p.lapTimeMs - v.lapTimeMs);
169
- }, [f == null ? void 0 : f.entries, i, l]), isLoading: N, error: x };
170
- }
171
- function Ae(e, n, r, s, a = {}) {
172
- var x, u;
173
- const { cdnUrl: i, partnerSlug: l } = k(), { showInvalid: o = !1, game: h, gameVersion: d } = a, f = $({
174
- queryKey: ["pitvox", "laps", l, e],
175
- queryFn: () => D(i, `laps/partners/${l}/${e}.json`),
168
+ return g.filter((p) => p.carId === i).sort((p, h) => p.lapTimeMs - h.lapTimeMs);
169
+ }, [f == null ? void 0 : f.entries, i, c]), isLoading: N, error: x };
170
+ }
171
+ function Ae(e, r, n, a, s = {}) {
172
+ var x, m;
173
+ const { cdnUrl: i, partnerSlug: c } = T(), { showInvalid: l = !1, game: v, gameVersion: d } = s, f = L({
174
+ queryKey: ["pitvox", "laps", c, e],
175
+ queryFn: () => R(i, `laps/partners/${c}/${e}.json`),
176
176
  enabled: !!e,
177
177
  staleTime: 3e4,
178
178
  refetchInterval: 3e4
179
- }), N = S(() => {
179
+ }), N = k(() => {
180
180
  var g;
181
181
  return (g = f.data) != null && g.laps ? f.data.laps.filter((p) => {
182
- if (p.trackId !== n) return !1;
183
- if (r) {
184
- if (p.trackLayout !== r) return !1;
182
+ if (p.trackId !== r) return !1;
183
+ if (n) {
184
+ if (p.trackLayout !== n) return !1;
185
185
  } else if (p.trackLayout && p.trackLayout !== "default") return !1;
186
- return !(p.carId !== s || h && p.game !== h || d && p.gameVersion !== d || !o && !p.isValid);
187
- }).sort((p, v) => p.lapTimeMs - v.lapTimeMs) : [];
188
- }, [(x = f.data) == null ? void 0 : x.laps, n, r, s, h, d, o]);
186
+ return !(p.carId !== a || v && p.game !== v || d && p.gameVersion !== d || !l && !p.isValid);
187
+ }).sort((p, h) => p.lapTimeMs - h.lapTimeMs) : [];
188
+ }, [(x = f.data) == null ? void 0 : x.laps, r, n, a, v, d, l]);
189
189
  return {
190
190
  ...f,
191
191
  data: N,
192
- driverName: ((u = f.data) == null ? void 0 : u.driverName) || "Driver"
192
+ driverName: ((m = f.data) == null ? void 0 : m.driverName) || "Driver"
193
193
  };
194
194
  }
195
195
  function Pe() {
196
- const { cdnUrl: e } = k(), { data: n } = $({
196
+ const { cdnUrl: e } = T(), { data: r } = L({
197
197
  queryKey: ["pitvox", "users", "index"],
198
- queryFn: () => D(e, "users/index.json"),
198
+ queryFn: () => R(e, "users/index.json"),
199
199
  staleTime: 5 * 6e4,
200
200
  gcTime: 30 * 6e4
201
- }), r = (n == null ? void 0 : n.users) || {};
202
- return (s, a) => {
203
- const i = r[s];
201
+ }), n = (r == null ? void 0 : r.users) || {};
202
+ return (a, s) => {
203
+ const i = n[a];
204
204
  return {
205
- displayName: (i == null ? void 0 : i.displayName) || a || s || "Unknown",
205
+ displayName: (i == null ? void 0 : i.displayName) || s || a || "Unknown",
206
206
  avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
207
207
  affiliations: (i == null ? void 0 : i.affiliations) || []
208
208
  };
209
209
  };
210
210
  }
211
- function Ee() {
212
- const { cdnUrl: e } = k(), { data: n } = $({
211
+ function Fe() {
212
+ const { cdnUrl: e } = T(), { data: r } = L({
213
213
  queryKey: ["pitvox", "cars", "index"],
214
- queryFn: () => D(e, "cars/index.json"),
214
+ queryFn: () => R(e, "cars/index.json"),
215
215
  staleTime: 5 * 6e4,
216
216
  gcTime: 30 * 6e4
217
217
  });
218
218
  return {
219
- tags: (n == null ? void 0 : n.tags) || [],
220
- cars: (n == null ? void 0 : n.cars) || {}
219
+ tags: (r == null ? void 0 : r.tags) || [],
220
+ cars: (r == null ? void 0 : r.cars) || {}
221
221
  };
222
222
  }
223
- function Lt(e, n) {
224
- return oe(e, null, { carId: n });
223
+ function Mt(e, r) {
224
+ return le(e, null, { carId: r });
225
225
  }
226
226
  function Ue() {
227
- const { cdnUrl: e, partnerSlug: n } = k();
228
- return $({
229
- queryKey: ["pitvox", "competitions", n],
227
+ const { cdnUrl: e, partnerSlug: r } = T();
228
+ return L({
229
+ queryKey: ["pitvox", "competitions", r],
230
230
  queryFn: async () => {
231
- const r = await D(e, "competitions/index.json");
232
- return r != null && r.competitions ? r.competitions.filter((s) => s.partnerSlug === n) : [];
231
+ const n = await R(e, "competitions/index.json");
232
+ return n != null && n.competitions ? n.competitions.filter((a) => a.partnerSlug === r) : [];
233
233
  },
234
234
  staleTime: 6e4
235
235
  });
236
236
  }
237
- function le(e) {
238
- const { cdnUrl: n, partnerSlug: r } = k();
239
- return $({
240
- queryKey: ["pitvox", "competition", r, e, "config"],
241
- queryFn: () => D(n, `competitions/${r}/${e}/config.json`),
237
+ function oe(e) {
238
+ const { cdnUrl: r, partnerSlug: n } = T();
239
+ return L({
240
+ queryKey: ["pitvox", "competition", n, e, "config"],
241
+ queryFn: () => R(r, `competitions/${n}/${e}/config.json`),
242
242
  enabled: !!e,
243
243
  staleTime: 6e4
244
244
  });
245
245
  }
246
- function Fe(e) {
247
- const { cdnUrl: n, partnerSlug: r } = k();
248
- return $({
249
- queryKey: ["pitvox", "competition", r, e, "standings"],
250
- queryFn: () => D(n, `competitions/${r}/${e}/standings.json`),
246
+ function Ee(e) {
247
+ const { cdnUrl: r, partnerSlug: n } = T();
248
+ return L({
249
+ queryKey: ["pitvox", "competition", n, e, "standings"],
250
+ queryFn: () => R(r, `competitions/${n}/${e}/standings.json`),
251
251
  enabled: !!e,
252
252
  staleTime: 6e4
253
253
  });
254
254
  }
255
- function _e(e, n) {
256
- const { cdnUrl: r, partnerSlug: s } = k();
257
- return $({
258
- queryKey: ["pitvox", "competition", s, e, "round", n],
259
- queryFn: () => D(r, `competitions/${s}/${e}/rounds/${n}.json`),
260
- enabled: !!e && n != null,
255
+ function qe(e, r) {
256
+ const { cdnUrl: n, partnerSlug: a } = T();
257
+ return L({
258
+ queryKey: ["pitvox", "competition", a, e, "round", r],
259
+ queryFn: () => R(n, `competitions/${a}/${e}/rounds/${r}.json`),
260
+ enabled: !!e && r != null,
261
261
  staleTime: 6e4
262
262
  });
263
263
  }
264
- function $t(e, n = []) {
265
- const { cdnUrl: r, partnerSlug: s } = k();
266
- return $({
267
- queryKey: ["pitvox", "competition", s, e, "allRounds", n],
264
+ function It(e, r = []) {
265
+ const { cdnUrl: n, partnerSlug: a } = T();
266
+ return L({
267
+ queryKey: ["pitvox", "competition", a, e, "allRounds", r],
268
268
  queryFn: async () => (await Promise.all(
269
- n.map(
270
- (i) => D(r, `competitions/${s}/${e}/rounds/${i}.json`).catch(() => null)
269
+ r.map(
270
+ (i) => R(n, `competitions/${a}/${e}/rounds/${i}.json`).catch(() => null)
271
271
  )
272
272
  )).filter(Boolean),
273
- enabled: !!e && n.length > 0,
273
+ enabled: !!e && r.length > 0,
274
274
  staleTime: 6e4
275
275
  });
276
276
  }
277
- function qe(e) {
278
- const { cdnUrl: n, partnerSlug: r } = k();
279
- return $({
280
- queryKey: ["pitvox", "competition", r, e, "entrylist"],
281
- queryFn: () => D(n, `competitions/${r}/${e}/entrylist.json`),
277
+ function _e(e) {
278
+ const { cdnUrl: r, partnerSlug: n } = T();
279
+ return L({
280
+ queryKey: ["pitvox", "competition", n, e, "entrylist"],
281
+ queryFn: () => R(r, `competitions/${n}/${e}/entrylist.json`),
282
282
  enabled: !!e,
283
283
  staleTime: 6e4
284
284
  });
285
285
  }
286
- async function ce(e, n, r, s = {}) {
287
- const a = await fetch(`${e}${r}`, {
288
- ...s,
286
+ async function ce(e, r, n, a = {}) {
287
+ const s = await fetch(`${e}${n}`, {
288
+ ...a,
289
289
  headers: {
290
290
  "Content-Type": "application/json",
291
- "X-Partner-Key": n,
292
- ...s.headers
291
+ "X-Partner-Key": r,
292
+ ...a.headers
293
293
  }
294
294
  });
295
- if (!a.ok) {
296
- const i = await a.json().catch(() => ({}));
297
- throw new Error(i.detail || `API request failed: ${a.status}`);
295
+ if (!s.ok) {
296
+ const i = await s.json().catch(() => ({}));
297
+ throw new Error(i.detail || `API request failed: ${s.status}`);
298
298
  }
299
- return a.json();
299
+ return s.json();
300
300
  }
301
- function je(e, n, r, s) {
302
- return ce(e, n, `/api/v1/competitions/${r}/register`, {
301
+ function je(e, r, n, a) {
302
+ return ce(e, r, `/api/v1/competitions/${n}/register`, {
303
303
  method: "POST",
304
- body: JSON.stringify(s)
304
+ body: JSON.stringify(a)
305
305
  });
306
306
  }
307
- function Ve(e, n, r, s) {
308
- return ce(e, n, `/api/v1/competitions/${r}/register/${s}`, {
307
+ function Ve(e, r, n, a) {
308
+ return ce(e, r, `/api/v1/competitions/${n}/register/${a}`, {
309
309
  method: "DELETE"
310
310
  });
311
311
  }
312
312
  function Ke(e) {
313
- const { cdnUrl: n, partnerSlug: r, getSteamId: s } = k(), a = s();
314
- return $({
315
- queryKey: ["pitvox", "registration", r, e, a],
313
+ const { cdnUrl: r, partnerSlug: n, getSteamId: a } = T(), s = a();
314
+ return L({
315
+ queryKey: ["pitvox", "registration", n, e, s],
316
316
  queryFn: async () => {
317
- var h;
318
- const i = await fetch(`${n}/competitions/${r}/${e}/entrylist.json`);
317
+ var v;
318
+ const i = await fetch(`${r}/competitions/${n}/${e}/entrylist.json`);
319
319
  if (!i.ok) return { isRegistered: !1, entryList: null };
320
- const l = await i.json();
321
- return { isRegistered: !!a && ((h = l.drivers) == null ? void 0 : h.some((d) => d.steamId === a)), entryList: l };
320
+ const c = await i.json();
321
+ return { isRegistered: !!s && ((v = c.drivers) == null ? void 0 : v.some((d) => d.steamId === s)), entryList: c };
322
322
  },
323
323
  enabled: !!e,
324
324
  staleTime: 6e4
325
325
  });
326
326
  }
327
- function Oe(e) {
328
- const { apiUrl: n, apiKey: r, partnerSlug: s } = k(), a = Q();
329
- return re({
330
- mutationFn: (i) => je(n, r, e, i),
327
+ function He(e) {
328
+ const { apiUrl: r, apiKey: n, partnerSlug: a } = T(), s = Q();
329
+ return ae({
330
+ mutationFn: (i) => je(r, n, e, i),
331
331
  onSuccess: () => {
332
- a.invalidateQueries({
333
- queryKey: ["pitvox", "registration", s, e]
334
- }), a.invalidateQueries({
335
- queryKey: ["pitvox", "competition", s, e, "entrylist"]
332
+ s.invalidateQueries({
333
+ queryKey: ["pitvox", "registration", a, e]
334
+ }), s.invalidateQueries({
335
+ queryKey: ["pitvox", "competition", a, e, "entrylist"]
336
336
  });
337
337
  }
338
338
  });
339
339
  }
340
- function He(e) {
341
- const { apiUrl: n, apiKey: r, partnerSlug: s, getSteamId: a } = k(), i = Q();
342
- return re({
343
- mutationFn: (l) => {
344
- const o = l || a();
345
- if (!o) throw new Error("No Steam ID available");
346
- return Ve(n, r, e, o);
340
+ function Oe(e) {
341
+ const { apiUrl: r, apiKey: n, partnerSlug: a, getSteamId: s } = T(), i = Q();
342
+ return ae({
343
+ mutationFn: (c) => {
344
+ const l = c || s();
345
+ if (!l) throw new Error("No Steam ID available");
346
+ return Ve(r, n, e, l);
347
347
  },
348
348
  onSuccess: () => {
349
349
  i.invalidateQueries({
350
- queryKey: ["pitvox", "registration", s, e]
350
+ queryKey: ["pitvox", "registration", a, e]
351
351
  }), i.invalidateQueries({
352
- queryKey: ["pitvox", "competition", s, e, "entrylist"]
352
+ queryKey: ["pitvox", "competition", a, e, "entrylist"]
353
353
  });
354
354
  }
355
355
  });
@@ -380,119 +380,119 @@ const Ge = {
380
380
  { id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
381
381
  ];
382
382
  function ze(e) {
383
- for (const n of de)
384
- if (n.tags.includes(e)) return n.id;
383
+ for (const r of de)
384
+ if (r.tags.includes(e)) return r.id;
385
385
  return "other";
386
386
  }
387
- function pe(e, n) {
388
- if (n.size === 0) return !0;
389
- const r = {};
390
- for (const s of n) {
391
- const a = ze(s);
392
- r[a] || (r[a] = []), r[a].push(s);
387
+ function pe(e, r) {
388
+ if (r.size === 0) return !0;
389
+ const n = {};
390
+ for (const a of r) {
391
+ const s = ze(a);
392
+ n[s] || (n[s] = []), n[s].push(a);
393
393
  }
394
- for (const s of Object.values(r))
395
- if (!s.some((a) => e.includes(a))) return !1;
394
+ for (const a of Object.values(n))
395
+ if (!a.some((s) => e.includes(s))) return !1;
396
396
  return !0;
397
397
  }
398
- function me() {
399
- const [e, n] = W(/* @__PURE__ */ new Set()), r = H((a) => {
400
- n((i) => {
401
- const l = new Set(i);
402
- return l.has(a) ? l.delete(a) : l.add(a), l;
398
+ function ue() {
399
+ const [e, r] = W(/* @__PURE__ */ new Set()), n = O((s) => {
400
+ r((i) => {
401
+ const c = new Set(i);
402
+ return c.has(s) ? c.delete(s) : c.add(s), c;
403
403
  });
404
- }, []), s = H(() => n(/* @__PURE__ */ new Set()), []);
405
- return { activeTags: e, toggle: r, clear: s };
404
+ }, []), a = O(() => r(/* @__PURE__ */ new Set()), []);
405
+ return { activeTags: e, toggle: n, clear: a };
406
406
  }
407
- function J(e) {
408
- const [n, r] = W(e), s = H((a) => {
409
- r(
410
- (i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
407
+ function Z(e) {
408
+ const [r, n] = W(e), a = O((s) => {
409
+ n(
410
+ (i) => i.key === s ? { key: s, dir: i.dir === "asc" ? "desc" : "asc" } : { key: s, dir: s.includes("timestamp") || s.includes("Date") ? "desc" : "asc" }
411
411
  );
412
412
  }, []);
413
- return [n, s];
413
+ return [r, a];
414
414
  }
415
- function Z(e, n, r) {
416
- return [...e].sort((s, a) => {
417
- const i = r(s, n.key), l = r(a, n.key);
418
- if (i == null && l == null) return 0;
415
+ function X(e, r, n) {
416
+ return [...e].sort((a, s) => {
417
+ const i = n(a, r.key), c = n(s, r.key);
418
+ if (i == null && c == null) return 0;
419
419
  if (i == null) return 1;
420
- if (l == null) return -1;
421
- const o = typeof i == "string" ? i.localeCompare(l) : i - l;
422
- return n.dir === "desc" ? -o : o;
420
+ if (c == null) return -1;
421
+ const l = typeof i == "string" ? i.localeCompare(c) : i - c;
422
+ return r.dir === "desc" ? -l : l;
423
423
  });
424
424
  }
425
- function ue(e, n = !1) {
426
- const r = n ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
427
- return r != null && r.length ? {
428
- s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
429
- s2: Math.min(...r.map((s) => s.sector2Ms).filter(Boolean)),
430
- s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
425
+ function me(e, r = !1) {
426
+ const n = r ? e == null ? void 0 : e.filter((a) => a.isValid) : e;
427
+ return n != null && n.length ? {
428
+ s1: Math.min(...n.map((a) => a.sector1Ms).filter(Boolean)),
429
+ s2: Math.min(...n.map((a) => a.sector2Ms).filter(Boolean)),
430
+ s3: Math.min(...n.map((a) => a.sector3Ms).filter(Boolean))
431
431
  } : null;
432
432
  }
433
- function We({ active: e, dir: n }) {
434
- return e ? n === "asc" ? /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
433
+ function We({ active: e, dir: r }) {
434
+ return e ? r === "asc" ? /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
435
435
  }
436
- function R({ label: e, sortKey: n, config: r, onSort: s, className: a = "" }) {
436
+ function D({ label: e, sortKey: r, config: n, onSort: a, className: s = "" }) {
437
437
  return /* @__PURE__ */ t(
438
438
  "th",
439
439
  {
440
- className: `pvx-th pvx-th--sortable ${a}`,
441
- onClick: () => s(n),
442
- children: /* @__PURE__ */ c("span", { className: "pvx-th-inner", children: [
440
+ className: `pvx-th pvx-th--sortable ${s}`,
441
+ onClick: () => a(r),
442
+ children: /* @__PURE__ */ o("span", { className: "pvx-th-inner", children: [
443
443
  e,
444
- /* @__PURE__ */ t(We, { active: r.key === n, dir: r.dir })
444
+ /* @__PURE__ */ t(We, { active: n.key === r, dir: n.dir })
445
445
  ] })
446
446
  }
447
447
  );
448
448
  }
449
- function X({ userId: e, getUserDisplay: n }) {
450
- const { displayName: r, avatarUrl: s } = n(e);
451
- return /* @__PURE__ */ c("span", { className: "pvx-driver", children: [
452
- s ? /* @__PURE__ */ t("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
453
- /* @__PURE__ */ t("span", { className: "pvx-driver-name", children: r })
449
+ function Y({ userId: e, getUserDisplay: r }) {
450
+ const { displayName: n, avatarUrl: a } = r(e);
451
+ return /* @__PURE__ */ o("span", { className: "pvx-driver", children: [
452
+ a ? /* @__PURE__ */ t("img", { src: a, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
453
+ /* @__PURE__ */ t("span", { className: "pvx-driver-name", children: n })
454
454
  ] });
455
455
  }
456
- function ve({ rank: e, podium: n = !1 }) {
457
- return /* @__PURE__ */ t("span", { className: n ? 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 });
456
+ function ve({ rank: e, podium: r = !1 }) {
457
+ return /* @__PURE__ */ t("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 });
458
458
  }
459
- function he({ availableTags: e, activeTags: n, onToggle: r, onClear: s }) {
459
+ function he({ availableTags: e, activeTags: r, onToggle: n, onClear: a }) {
460
460
  if (!e || e.length < 2) return null;
461
- const a = de.map((i) => ({ id: i.id, tags: i.tags.filter((l) => e.includes(l)) })).filter((i) => i.tags.length > 0);
462
- return /* @__PURE__ */ c("div", { className: "pvx-tag-bar", children: [
461
+ const s = de.map((i) => ({ id: i.id, tags: i.tags.filter((c) => e.includes(c)) })).filter((i) => i.tags.length > 0);
462
+ return /* @__PURE__ */ o("div", { className: "pvx-tag-bar", children: [
463
463
  /* @__PURE__ */ t(
464
464
  "button",
465
465
  {
466
- onClick: s,
467
- className: `pvx-tag ${n.size === 0 ? "pvx-tag--active" : ""}`,
466
+ onClick: a,
467
+ className: `pvx-tag ${r.size === 0 ? "pvx-tag--active" : ""}`,
468
468
  children: "All"
469
469
  }
470
470
  ),
471
- a.map((i, l) => /* @__PURE__ */ c("span", { className: "contents", children: [
472
- l > 0 && /* @__PURE__ */ t("span", { className: "pvx-tag-separator" }),
473
- i.tags.map((o) => /* @__PURE__ */ t(
471
+ s.map((i, c) => /* @__PURE__ */ o("span", { className: "contents", children: [
472
+ c > 0 && /* @__PURE__ */ t("span", { className: "pvx-tag-separator" }),
473
+ i.tags.map((l) => /* @__PURE__ */ t(
474
474
  "button",
475
475
  {
476
- onClick: () => r(o),
477
- className: `pvx-tag ${n.has(o) ? "pvx-tag--active" : ""}`,
478
- children: Ge[o] || o
476
+ onClick: () => n(l),
477
+ className: `pvx-tag ${r.has(l) ? "pvx-tag--active" : ""}`,
478
+ children: Ge[l] || l
479
479
  },
480
- o
480
+ l
481
481
  ))
482
482
  ] }, i.id))
483
483
  ] });
484
484
  }
485
- function Y({ segments: e }) {
486
- return /* @__PURE__ */ t("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ t("ol", { className: "pvx-breadcrumb-list", children: e.map((n, r) => {
487
- const s = r === e.length - 1;
488
- return /* @__PURE__ */ c("li", { className: "pvx-breadcrumb-item", children: [
489
- r > 0 && /* @__PURE__ */ t("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
490
- !s && n.onClick ? /* @__PURE__ */ t("button", { onClick: n.onClick, className: "pvx-breadcrumb-link", children: n.label }) : /* @__PURE__ */ t("span", { className: "pvx-breadcrumb-current", children: n.label })
491
- ] }, n.key);
485
+ function ee({ segments: e }) {
486
+ return /* @__PURE__ */ t("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ t("ol", { className: "pvx-breadcrumb-list", children: e.map((r, n) => {
487
+ const a = n === e.length - 1;
488
+ return /* @__PURE__ */ o("li", { className: "pvx-breadcrumb-item", children: [
489
+ n > 0 && /* @__PURE__ */ t("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
490
+ !a && r.onClick ? /* @__PURE__ */ t("button", { onClick: r.onClick, className: "pvx-breadcrumb-link", children: r.label }) : /* @__PURE__ */ t("span", { className: "pvx-breadcrumb-current", children: r.label })
491
+ ] }, r.key);
492
492
  }) }) });
493
493
  }
494
494
  function j({ message: e }) {
495
- return /* @__PURE__ */ c("div", { className: "pvx-empty", children: [
495
+ return /* @__PURE__ */ o("div", { className: "pvx-empty", children: [
496
496
  /* @__PURE__ */ t("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ t("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" }) }),
497
497
  /* @__PURE__ */ t("p", { children: e })
498
498
  ] });
@@ -506,27 +506,27 @@ function Qe() {
506
506
  function Je() {
507
507
  return /* @__PURE__ */ t("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
508
508
  }
509
- function Ze({ tracks: e, isLoading: n, carMetadata: r, getUserDisplay: s, onTrackSelect: a }) {
510
- const [i, l] = J({ key: "record.timestamp", dir: "desc" }), { activeTags: o, toggle: h, clear: d } = me(), f = S(() => {
509
+ function Ze({ tracks: e, isLoading: r, carMetadata: n, getUserDisplay: a, onTrackSelect: s }) {
510
+ const [i, c] = Z({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle: v, clear: d } = ue(), f = k(() => {
511
511
  var g;
512
- if (!((g = r == null ? void 0 : r.tags) != null && g.length)) return [];
513
- const u = /* @__PURE__ */ new Set();
512
+ if (!((g = n == null ? void 0 : n.tags) != null && g.length)) return [];
513
+ const m = /* @__PURE__ */ new Set();
514
514
  for (const p of e || [])
515
- p.recordByTag && Object.keys(p.recordByTag).forEach((v) => u.add(v));
516
- return r.tags.filter((p) => u.has(p));
517
- }, [e, r]), N = S(() => e ? o.size === 0 ? e : e.map((u) => {
518
- var v, m;
519
- if (!u.recordByTag) return null;
515
+ p.recordByTag && Object.keys(p.recordByTag).forEach((h) => m.add(h));
516
+ return n.tags.filter((p) => m.has(p));
517
+ }, [e, n]), N = k(() => e ? l.size === 0 ? e : e.map((m) => {
518
+ var h, u;
519
+ if (!m.recordByTag) return null;
520
520
  let g = null;
521
521
  const p = /* @__PURE__ */ new Set();
522
- for (const y of Object.values(u.recordByTag)) {
522
+ for (const y of Object.values(m.recordByTag)) {
523
523
  if (p.has(y.carId)) continue;
524
524
  p.add(y.carId);
525
- const C = ((m = (v = r == null ? void 0 : r.cars) == null ? void 0 : v[y.carId]) == null ? void 0 : m.tags) || ["sports_car"];
526
- pe(C, o) && (!g || y.lapTimeMs < g.lapTimeMs) && (g = y);
525
+ const C = ((u = (h = n == null ? void 0 : n.cars) == null ? void 0 : h[y.carId]) == null ? void 0 : u.tags) || ["sports_car"];
526
+ pe(C, l) && (!g || y.lapTimeMs < g.lapTimeMs) && (g = y);
527
527
  }
528
528
  return g ? {
529
- ...u,
529
+ ...m,
530
530
  record: {
531
531
  visibleId: g.steamId || g.identifier,
532
532
  carId: g.carId,
@@ -535,164 +535,164 @@ function Ze({ tracks: e, isLoading: n, carMetadata: r, getUserDisplay: s, onTrac
535
535
  timestamp: g.recordedAt
536
536
  }
537
537
  } : null;
538
- }).filter(Boolean) : [], [e, o, r]), x = S(() => Z(N, i, (u, g) => {
539
- var p, v;
538
+ }).filter(Boolean) : [], [e, l, n]), x = k(() => X(N, i, (m, g) => {
539
+ var p, h;
540
540
  switch (g) {
541
541
  case "displayName":
542
- return u.displayName;
542
+ return m.displayName;
543
543
  case "record.lapTimeMs":
544
- return (p = u.record) == null ? void 0 : p.lapTimeMs;
544
+ return (p = m.record) == null ? void 0 : p.lapTimeMs;
545
545
  case "driverCount":
546
- return u.driverCount || 0;
546
+ return m.driverCount || 0;
547
547
  case "carCount":
548
- return u.carCount || 0;
548
+ return m.carCount || 0;
549
549
  case "record.timestamp":
550
550
  default:
551
- return (v = u.record) != null && v.timestamp ? new Date(u.record.timestamp).getTime() : 0;
551
+ return (h = m.record) != null && h.timestamp ? new Date(m.record.timestamp).getTime() : 0;
552
552
  }
553
553
  }), [N, i]);
554
- return n ? /* @__PURE__ */ t(V, {}) : e != null && e.length ? /* @__PURE__ */ c("div", { className: "pvx-card", children: [
554
+ return r ? /* @__PURE__ */ t(V, {}) : e != null && e.length ? /* @__PURE__ */ o("div", { className: "pvx-card", children: [
555
555
  /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t("h2", { className: "pvx-card-title", children: "Track Records" }) }),
556
- /* @__PURE__ */ t(he, { availableTags: f, activeTags: o, onToggle: h, onClear: d }),
557
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
558
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
559
- /* @__PURE__ */ t(R, { label: "Track", sortKey: "displayName", config: i, onSort: l }),
556
+ /* @__PURE__ */ t(he, { availableTags: f, activeTags: l, onToggle: v, onClear: d }),
557
+ /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
558
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
559
+ /* @__PURE__ */ t(D, { label: "Track", sortKey: "displayName", config: i, onSort: c }),
560
560
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Record Holder" }),
561
561
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
562
- /* @__PURE__ */ t(R, { label: "Lap Time", sortKey: "record.lapTimeMs", config: i, onSort: l }),
563
- /* @__PURE__ */ t(R, { label: "Drivers", sortKey: "driverCount", config: i, onSort: l, className: "pvx-hidden-below-md" }),
564
- /* @__PURE__ */ t(R, { label: "Cars", sortKey: "carCount", config: i, onSort: l, className: "pvx-hidden-below-lg" }),
565
- /* @__PURE__ */ t(R, { label: "Date", sortKey: "record.timestamp", config: i, onSort: l, className: "pvx-hidden-below-xl" })
562
+ /* @__PURE__ */ t(D, { label: "Lap Time", sortKey: "record.lapTimeMs", config: i, onSort: c }),
563
+ /* @__PURE__ */ t(D, { label: "Drivers", sortKey: "driverCount", config: i, onSort: c, className: "pvx-hidden-below-md" }),
564
+ /* @__PURE__ */ t(D, { label: "Cars", sortKey: "carCount", config: i, onSort: c, className: "pvx-hidden-below-lg" }),
565
+ /* @__PURE__ */ t(D, { label: "Date", sortKey: "record.timestamp", config: i, onSort: c, className: "pvx-hidden-below-xl" })
566
566
  ] }) }),
567
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: x.map((u) => {
568
- var g, p, v;
569
- return /* @__PURE__ */ c(
567
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: x.map((m) => {
568
+ var g, p, h;
569
+ return /* @__PURE__ */ o(
570
570
  "tr",
571
571
  {
572
572
  className: "pvx-row pvx-row--clickable",
573
- onClick: () => a(u.id, u.layout),
573
+ onClick: () => s(m.id, m.layout),
574
574
  children: [
575
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: u.displayName }),
576
- /* @__PURE__ */ t("td", { className: "pvx-td", children: (g = u.record) != null && g.visibleId ? /* @__PURE__ */ t(X, { userId: u.record.visibleId, getUserDisplay: s }) : "-" }),
577
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-lg", children: ((p = u.record) == null ? void 0 : p.carDisplayName) || "-" }),
578
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: u.record ? q(u.record.lapTimeMs) : "-" }),
579
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: u.driverCount || "-" }),
580
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.carCount || "-" }),
581
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (v = u.record) != null && v.timestamp ? U(u.record.timestamp) : "-" })
575
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: m.displayName }),
576
+ /* @__PURE__ */ t("td", { className: "pvx-td", children: (g = m.record) != null && g.visibleId ? /* @__PURE__ */ t(Y, { userId: m.record.visibleId, getUserDisplay: a }) : "-" }),
577
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-lg", children: ((p = m.record) == null ? void 0 : p.carDisplayName) || "-" }),
578
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: m.record ? U(m.record.lapTimeMs) : "-" }),
579
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: m.driverCount || "-" }),
580
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.carCount || "-" }),
581
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (h = m.record) != null && h.timestamp ? E(m.record.timestamp) : "-" })
582
582
  ]
583
583
  },
584
- `${u.id}|${u.layout || ""}`
584
+ `${m.id}|${m.layout || ""}`
585
585
  );
586
586
  }) })
587
587
  ] }) })
588
588
  ] }) : /* @__PURE__ */ t(j, { message: "No lap times recorded yet." });
589
589
  }
590
- function Xe({ entries: e, isLoading: n, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: l }) {
591
- const [o, h] = J({ key: "lapTimeMs", dir: "asc" }), { activeTags: d, toggle: f, clear: N } = me(), x = S(() => {
592
- var m, y, C;
593
- if (!e || !((m = s == null ? void 0 : s.tags) != null && m.length)) return [];
594
- const v = /* @__PURE__ */ new Set();
595
- for (const L of e)
596
- (((C = (y = s.cars) == null ? void 0 : y[L.carId]) == null ? void 0 : C.tags) || ["sports_car"]).forEach((T) => v.add(T));
597
- return s.tags.filter((L) => v.has(L));
598
- }, [e, s]), u = S(() => e ? d.size === 0 ? e : e.filter((v) => {
590
+ function Xe({ entries: e, isLoading: r, track: n, carMetadata: a, getUserDisplay: s, onCarSelect: i, onNavigate: c }) {
591
+ const [l, v] = Z({ key: "lapTimeMs", dir: "asc" }), { activeTags: d, toggle: f, clear: N } = ue(), x = k(() => {
592
+ var u, y, C;
593
+ if (!e || !((u = a == null ? void 0 : a.tags) != null && u.length)) return [];
594
+ const h = /* @__PURE__ */ new Set();
595
+ for (const $ of e)
596
+ (((C = (y = a.cars) == null ? void 0 : y[$.carId]) == null ? void 0 : C.tags) || ["sports_car"]).forEach((S) => h.add(S));
597
+ return a.tags.filter(($) => h.has($));
598
+ }, [e, a]), m = k(() => e ? d.size === 0 ? e : e.filter((h) => {
599
599
  var y, C;
600
- const m = ((C = (y = s == null ? void 0 : s.cars) == null ? void 0 : y[v.carId]) == null ? void 0 : C.tags) || ["sports_car"];
601
- return pe(m, d);
602
- }) : [], [e, d, s]), g = S(() => Z(u, o, (v, m) => {
603
- switch (m) {
600
+ const u = ((C = (y = a == null ? void 0 : a.cars) == null ? void 0 : y[h.carId]) == null ? void 0 : C.tags) || ["sports_car"];
601
+ return pe(u, d);
602
+ }) : [], [e, d, a]), g = k(() => X(m, l, (h, u) => {
603
+ switch (u) {
604
604
  case "carId":
605
- return B(v.carId);
605
+ return B(h.carId);
606
606
  case "driverCount":
607
- return v.driverCount || 0;
607
+ return h.driverCount || 0;
608
608
  case "lapTimeMs":
609
609
  default:
610
- return v.lapTimeMs;
610
+ return h.lapTimeMs;
611
611
  }
612
- }), [u, o]), p = [
613
- { key: "tracks", label: "Tracks", onClick: () => l("tracks") },
614
- { key: "track", label: r.displayName }
612
+ }), [m, l]), p = [
613
+ { key: "tracks", label: "Tracks", onClick: () => c("tracks") },
614
+ { key: "track", label: n.displayName }
615
615
  ];
616
- return n ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
617
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(Y, { segments: p }) }),
616
+ return r ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ o("div", { className: "pvx-card", children: [
617
+ /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(ee, { segments: p }) }),
618
618
  /* @__PURE__ */ t(he, { availableTags: x, activeTags: d, onToggle: f, onClear: N }),
619
- e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
620
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
619
+ e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
620
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
621
621
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
622
- /* @__PURE__ */ t(R, { label: "Car", sortKey: "carId", config: o, onSort: h }),
622
+ /* @__PURE__ */ t(D, { label: "Car", sortKey: "carId", config: l, onSort: v }),
623
623
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Record Holder" }),
624
- /* @__PURE__ */ t(R, { label: "Lap Time", sortKey: "lapTimeMs", config: o, onSort: h }),
625
- /* @__PURE__ */ t(R, { label: "Drivers", sortKey: "driverCount", config: o, onSort: h, className: "pvx-hidden-below-md" }),
624
+ /* @__PURE__ */ t(D, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort: v }),
625
+ /* @__PURE__ */ t(D, { label: "Drivers", sortKey: "driverCount", config: l, onSort: v, className: "pvx-hidden-below-md" }),
626
626
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
627
627
  ] }) }),
628
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: g.map((v, m) => /* @__PURE__ */ c(
628
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: g.map((h, u) => /* @__PURE__ */ o(
629
629
  "tr",
630
630
  {
631
631
  className: "pvx-row pvx-row--clickable",
632
- onClick: () => i(v.carId),
632
+ onClick: () => i(h.carId),
633
633
  children: [
634
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(ve, { rank: m + 1, podium: !0 }) }),
635
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: B(v.carId) }),
636
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(X, { userId: v.steamId || v.userId, getUserDisplay: a }) }),
637
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(v.lapTimeMs) }),
638
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: v.driverCount || "-" }),
639
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: v.recordedAt ? U(v.recordedAt) : "-" })
634
+ /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(ve, { rank: u + 1, podium: !0 }) }),
635
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: B(h.carId) }),
636
+ /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(Y, { userId: h.steamId || h.userId, getUserDisplay: s }) }),
637
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(h.lapTimeMs) }),
638
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
639
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: h.recordedAt ? E(h.recordedAt) : "-" })
640
640
  ]
641
641
  },
642
- v.carId
642
+ h.carId
643
643
  )) })
644
644
  ] }) }) : /* @__PURE__ */ t(j, { message: "No lap times for this track yet." })
645
645
  ] });
646
646
  }
647
- function Ye({ entries: e, isLoading: n, track: r, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: l }) {
648
- const [o, h] = J({ key: "lapTimeMs", dir: "asc" }), d = S(() => ue(e), [e]), f = S(() => Z(e || [], o, (x, u) => {
649
- switch (u) {
647
+ function Ye({ entries: e, isLoading: r, track: n, carId: a, getUserDisplay: s, onDriverSelect: i, onNavigate: c }) {
648
+ const [l, v] = Z({ key: "lapTimeMs", dir: "asc" }), d = k(() => me(e), [e]), f = k(() => X(e || [], l, (x, m) => {
649
+ switch (m) {
650
650
  case "userId":
651
- return a(x.steamId || x.userId).displayName;
651
+ return s(x.steamId || x.userId).displayName;
652
652
  case "lapCount":
653
653
  return x.lapCount || 0;
654
654
  case "lapTimeMs":
655
655
  default:
656
656
  return x.lapTimeMs;
657
657
  }
658
- }), [e, o, a]), N = [
659
- { key: "tracks", label: "Tracks", onClick: () => l("tracks") },
660
- { key: "track", label: r.displayName, onClick: () => l("track") },
661
- { key: "car", label: B(s) }
658
+ }), [e, l, s]), N = [
659
+ { key: "tracks", label: "Tracks", onClick: () => c("tracks") },
660
+ { key: "track", label: n.displayName, onClick: () => c("track") },
661
+ { key: "car", label: B(a) }
662
662
  ];
663
- return n ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
664
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(Y, { segments: N }) }),
665
- e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
666
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
663
+ return r ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ o("div", { className: "pvx-card", children: [
664
+ /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(ee, { segments: N }) }),
665
+ e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
666
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
667
667
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
668
- /* @__PURE__ */ t(R, { label: "Driver", sortKey: "userId", config: o, onSort: h }),
669
- /* @__PURE__ */ t(R, { label: "Lap Time", sortKey: "lapTimeMs", config: o, onSort: h }),
668
+ /* @__PURE__ */ t(D, { label: "Driver", sortKey: "userId", config: l, onSort: v }),
669
+ /* @__PURE__ */ t(D, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort: v }),
670
670
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
671
671
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
672
672
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
673
673
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
674
674
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
675
- /* @__PURE__ */ t(R, { label: "Laps", sortKey: "lapCount", config: o, onSort: h, className: "pvx-hidden-below-lg" }),
675
+ /* @__PURE__ */ t(D, { label: "Laps", sortKey: "lapCount", config: l, onSort: v, className: "pvx-hidden-below-lg" }),
676
676
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
677
677
  ] }) }),
678
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: f.map((x, u) => {
679
- const g = u + 1, p = x.steamId || x.userId, v = d && x.sector1Ms === d.s1, m = d && x.sector2Ms === d.s2, y = d && x.sector3Ms === d.s3;
680
- return /* @__PURE__ */ c(
678
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: f.map((x, m) => {
679
+ const g = m + 1, p = x.steamId || x.userId, h = d && x.sector1Ms === d.s1, u = d && x.sector2Ms === d.s2, y = d && x.sector3Ms === d.s3;
680
+ return /* @__PURE__ */ o(
681
681
  "tr",
682
682
  {
683
683
  className: `pvx-row pvx-row--clickable ${g <= 3 ? "pvx-row--podium" : ""}`,
684
684
  onClick: () => i(p),
685
685
  children: [
686
686
  /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(ve, { rank: g, podium: !0 }) }),
687
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ t(X, { userId: p, getUserDisplay: a }) }),
688
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(x.lapTimeMs) }),
689
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${v ? "pvx-td--best-sector" : ""}`, children: P(x.sector1Ms) }),
690
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${m ? "pvx-td--best-sector" : ""}`, children: P(x.sector2Ms) }),
687
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ t(Y, { userId: p, getUserDisplay: s }) }),
688
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(x.lapTimeMs) }),
689
+ /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: P(x.sector1Ms) }),
690
+ /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${u ? "pvx-td--best-sector" : ""}`, children: P(x.sector2Ms) }),
691
691
  /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: P(x.sector3Ms) }),
692
692
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ie(x.tyreCompound), children: x.tyreCompound || "-" }),
693
693
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: x.startingFuelL ? `${x.startingFuelL}L` : "-" }),
694
694
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.lapCount || "-" }),
695
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: x.recordedAt ? U(x.recordedAt) : "-" })
695
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: x.recordedAt ? E(x.recordedAt) : "-" })
696
696
  ]
697
697
  },
698
698
  p
@@ -701,37 +701,37 @@ function Ye({ entries: e, isLoading: n, track: r, carId: s, getUserDisplay: a, o
701
701
  ] }) }) : /* @__PURE__ */ t(j, { message: "No lap times for this car yet." })
702
702
  ] });
703
703
  }
704
- function et({ userId: e, track: n, carId: r, game: s, gameVersion: a, showInvalid: i, getUserDisplay: l, onToggleInvalid: o, onNavigate: h }) {
705
- const { data: d, driverName: f, isLoading: N } = Ae(e, n.id, n.layout, r, { showInvalid: i, game: s, gameVersion: a }), { displayName: x, avatarUrl: u } = l(e, f), g = S(() => ue(d, !0), [d]), p = S(() => {
706
- const m = (d == null ? void 0 : d.filter((y) => y.isValid)) || [];
707
- return m.length ? Math.min(...m.map((y) => y.lapTimeMs)) : null;
708
- }, [d]), v = [
709
- { key: "tracks", label: "Tracks", onClick: () => h("tracks") },
710
- { key: "track", label: n.displayName, onClick: () => h("track") },
711
- { key: "car", label: B(r), onClick: () => h("car") },
704
+ function et({ userId: e, track: r, carId: n, game: a, gameVersion: s, showInvalid: i, getUserDisplay: c, onToggleInvalid: l, onNavigate: v }) {
705
+ const { data: d, driverName: f, isLoading: N } = Ae(e, r.id, r.layout, n, { showInvalid: i, game: a, gameVersion: s }), { displayName: x, avatarUrl: m } = c(e, f), g = k(() => me(d, !0), [d]), p = k(() => {
706
+ const u = (d == null ? void 0 : d.filter((y) => y.isValid)) || [];
707
+ return u.length ? Math.min(...u.map((y) => y.lapTimeMs)) : null;
708
+ }, [d]), h = [
709
+ { key: "tracks", label: "Tracks", onClick: () => v("tracks") },
710
+ { key: "track", label: r.displayName, onClick: () => v("track") },
711
+ { key: "car", label: B(n), onClick: () => v("car") },
712
712
  { key: "driver", label: x }
713
713
  ];
714
- return N ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
715
- /* @__PURE__ */ c("div", { className: "pvx-card-header pvx-card-header--split", children: [
716
- /* @__PURE__ */ c("div", { className: "pvx-card-header-left", children: [
717
- /* @__PURE__ */ t(Y, { segments: v }),
718
- u ? /* @__PURE__ */ t("img", { src: u, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
714
+ return N ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ o("div", { className: "pvx-card", children: [
715
+ /* @__PURE__ */ o("div", { className: "pvx-card-header pvx-card-header--split", children: [
716
+ /* @__PURE__ */ o("div", { className: "pvx-card-header-left", children: [
717
+ /* @__PURE__ */ t(ee, { segments: h }),
718
+ m ? /* @__PURE__ */ t("img", { src: m, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
719
719
  ] }),
720
- /* @__PURE__ */ c("label", { className: "pvx-checkbox-label", children: [
720
+ /* @__PURE__ */ o("label", { className: "pvx-checkbox-label", children: [
721
721
  /* @__PURE__ */ t(
722
722
  "input",
723
723
  {
724
724
  type: "checkbox",
725
725
  checked: i,
726
- onChange: o,
726
+ onChange: l,
727
727
  className: "pvx-checkbox"
728
728
  }
729
729
  ),
730
730
  /* @__PURE__ */ t("span", { children: "Show invalid laps" })
731
731
  ] })
732
732
  ] }),
733
- d != null && d.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
734
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
733
+ d != null && d.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
734
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
735
735
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
736
736
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
737
737
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Lap Time" }),
@@ -743,103 +743,103 @@ function et({ userId: e, track: n, carId: r, game: s, gameVersion: a, showInvali
743
743
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
744
744
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
745
745
  ] }) }),
746
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: d.map((m, y) => {
747
- const C = m.isValid && m.lapTimeMs === p, L = g && m.isValid && m.sector1Ms === g.s1, _ = g && m.isValid && m.sector2Ms === g.s2, T = g && m.isValid && m.sector3Ms === g.s3;
746
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: d.map((u, y) => {
747
+ const C = u.isValid && u.lapTimeMs === p, $ = g && u.isValid && u.sector1Ms === g.s1, _ = g && u.isValid && u.sector2Ms === g.s2, S = g && u.isValid && u.sector3Ms === g.s3;
748
748
  let A = "pvx-row";
749
- return m.isValid || (A += " pvx-row--invalid"), C && (A += " pvx-row--personal-best"), /* @__PURE__ */ c("tr", { className: A, children: [
749
+ return u.isValid || (A += " pvx-row--invalid"), C && (A += " pvx-row--personal-best"), /* @__PURE__ */ o("tr", { className: A, children: [
750
750
  /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: y + 1 }) }),
751
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: m.lapNumber || "-" }),
752
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(m.lapTimeMs) }),
753
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: P(m.sector1Ms) }),
754
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${_ ? "pvx-td--best-sector" : ""}`, children: P(m.sector2Ms) }),
755
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${T ? "pvx-td--best-sector" : ""}`, children: P(m.sector3Ms) }),
756
- /* @__PURE__ */ t("td", { className: "pvx-td", title: m.isValid ? void 0 : m.invalidReason || "Invalid", children: m.isValid ? /* @__PURE__ */ t(Qe, {}) : /* @__PURE__ */ t(Je, {}) }),
757
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ie(m.tyreCompound), children: m.tyreCompound || "-" }),
758
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.startingFuelL ? `${m.startingFuelL}L` : "-" }),
759
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: U(m.timestamp) })
760
- ] }, m.id);
751
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: u.lapNumber || "-" }),
752
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(u.lapTimeMs) }),
753
+ /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: P(u.sector1Ms) }),
754
+ /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${_ ? "pvx-td--best-sector" : ""}`, children: P(u.sector2Ms) }),
755
+ /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${S ? "pvx-td--best-sector" : ""}`, children: P(u.sector3Ms) }),
756
+ /* @__PURE__ */ t("td", { className: "pvx-td", title: u.isValid ? void 0 : u.invalidReason || "Invalid", children: u.isValid ? /* @__PURE__ */ t(Qe, {}) : /* @__PURE__ */ t(Je, {}) }),
757
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ie(u.tyreCompound), children: u.tyreCompound || "-" }),
758
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.startingFuelL ? `${u.startingFuelL}L` : "-" }),
759
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: E(u.timestamp) })
760
+ ] }, u.id);
761
761
  }) })
762
762
  ] }) }) : /* @__PURE__ */ t(j, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
763
763
  ] });
764
764
  }
765
- function Rt({ className: e, defaultGame: n = "evo", title: r = "Leaderboards" }) {
766
- const [s, a] = se(), i = Pe(), l = Ee(), o = s.get("game") || n, h = s.get("version"), d = s.get("track"), f = s.get("car"), N = s.get("driver"), x = s.get("invalid") === "true", {
767
- data: u,
765
+ function At({ className: e, defaultGame: r = "evo", title: n = "Leaderboards" }) {
766
+ const [a, s] = se(), i = Pe(), c = Fe(), l = a.get("game") || r, v = a.get("version"), d = a.get("track"), f = a.get("car"), N = a.get("driver"), x = a.get("invalid") === "true", {
767
+ data: m,
768
768
  isLoading: g,
769
769
  generatedAt: p,
770
- totalLaps: v,
771
- totalUsers: m,
770
+ totalLaps: h,
771
+ totalUsers: u,
772
772
  versions: y
773
- } = Be({ game: o }), C = y == null ? void 0 : y[o], L = h || (C == null ? void 0 : C.default) || null, _ = S(() => !u || !L ? u || [] : u.filter((b) => b.gameVersion === L), [u, L]), T = S(() => {
773
+ } = Ie({ game: l }), C = y == null ? void 0 : y[l], $ = v || (C == null ? void 0 : C.default) || null, _ = k(() => !m || !$ ? m || [] : m.filter((b) => b.gameVersion === $), [m, $]), S = k(() => {
774
774
  if (!d) return null;
775
775
  const [b, w] = d.split("|");
776
- return { id: b, layout: w || null, displayName: ae(b, w, o) };
777
- }, [d, o]), { data: A, isLoading: ee } = oe(
778
- T == null ? void 0 : T.id,
779
- T == null ? void 0 : T.layout,
780
- { carId: f, game: o, gameVersion: L }
776
+ return { id: b, layout: w || null, displayName: J(b, w, l) };
777
+ }, [d, l]), { data: A, isLoading: te } = le(
778
+ S == null ? void 0 : S.id,
779
+ S == null ? void 0 : S.layout,
780
+ { carId: f, game: l, gameVersion: $ }
781
781
  );
782
782
  function I(b) {
783
- a(b);
783
+ s(b);
784
784
  }
785
785
  function be(b) {
786
786
  I({ game: b });
787
787
  }
788
788
  function ye(b) {
789
- const w = { game: o };
789
+ const w = { game: l };
790
790
  b && b !== (C == null ? void 0 : C.default) && (w.version = b), I(w);
791
791
  }
792
792
  function Ce(b, w) {
793
- const te = { game: o, track: w ? `${b}|${w}` : b };
794
- h && (te.version = h), I(te);
793
+ const ne = { game: l, track: w ? `${b}|${w}` : b };
794
+ v && (ne.version = v), I(ne);
795
795
  }
796
796
  function we(b) {
797
- const w = { game: o, track: d };
798
- h && (w.version = h), b && (w.car = b), I(w);
797
+ const w = { game: l, track: d };
798
+ v && (w.version = v), b && (w.car = b), I(w);
799
799
  }
800
- function Te(b) {
801
- const w = { game: o, track: d, car: f, driver: b };
802
- h && (w.version = h), I(w);
800
+ function ke(b) {
801
+ const w = { game: l, track: d, car: f, driver: b };
802
+ v && (w.version = v), I(w);
803
803
  }
804
804
  function K(b) {
805
- const w = { game: o };
806
- h && (w.version = h), (b === "track" || b === "car") && (w.track = d), b === "car" && (w.car = f), I(w);
805
+ const w = { game: l };
806
+ v && (w.version = v), (b === "track" || b === "car") && (w.track = d), b === "car" && (w.car = f), I(w);
807
807
  }
808
- function Se() {
809
- const b = { game: o, track: d, car: f, driver: N };
810
- h && (b.version = h), x || (b.invalid = "true"), I(b);
808
+ function Te() {
809
+ const b = { game: l, track: d, car: f, driver: N };
810
+ v && (b.version = v), x || (b.invalid = "true"), I(b);
811
811
  }
812
- const ke = () => T && f && N ? /* @__PURE__ */ t(
812
+ const Se = () => S && f && N ? /* @__PURE__ */ t(
813
813
  et,
814
814
  {
815
815
  userId: N,
816
- track: T,
816
+ track: S,
817
817
  carId: f,
818
- game: o,
819
- gameVersion: L,
818
+ game: l,
819
+ gameVersion: $,
820
820
  showInvalid: x,
821
821
  getUserDisplay: i,
822
- onToggleInvalid: Se,
822
+ onToggleInvalid: Te,
823
823
  onNavigate: K
824
824
  }
825
- ) : T && f ? /* @__PURE__ */ t(
825
+ ) : S && f ? /* @__PURE__ */ t(
826
826
  Ye,
827
827
  {
828
828
  entries: A || [],
829
- isLoading: ee,
830
- track: T,
829
+ isLoading: te,
830
+ track: S,
831
831
  carId: f,
832
832
  getUserDisplay: i,
833
- onDriverSelect: Te,
833
+ onDriverSelect: ke,
834
834
  onNavigate: K
835
835
  }
836
- ) : T ? /* @__PURE__ */ t(
836
+ ) : S ? /* @__PURE__ */ t(
837
837
  Xe,
838
838
  {
839
839
  entries: A || [],
840
- isLoading: ee,
841
- track: T,
842
- carMetadata: l,
840
+ isLoading: te,
841
+ track: S,
842
+ carMetadata: c,
843
843
  getUserDisplay: i,
844
844
  onCarSelect: we,
845
845
  onNavigate: K
@@ -849,32 +849,32 @@ function Rt({ className: e, defaultGame: n = "evo", title: r = "Leaderboards" })
849
849
  {
850
850
  tracks: _,
851
851
  isLoading: g,
852
- carMetadata: l,
852
+ carMetadata: c,
853
853
  getUserDisplay: i,
854
854
  onTrackSelect: Ce
855
855
  }
856
856
  );
857
- return /* @__PURE__ */ c("div", { className: `pvx-leaderboard-explorer ${e || ""}`, children: [
858
- /* @__PURE__ */ c("div", { className: "pvx-explorer-header", children: [
859
- /* @__PURE__ */ t("h1", { className: "pvx-explorer-title", children: r }),
860
- /* @__PURE__ */ c("div", { className: "pvx-explorer-stats", children: [
861
- v > 0 && /* @__PURE__ */ c("span", { children: [
862
- v.toLocaleString(),
857
+ return /* @__PURE__ */ o("div", { className: `pvx-leaderboard-explorer ${e || ""}`, children: [
858
+ /* @__PURE__ */ o("div", { className: "pvx-explorer-header", children: [
859
+ /* @__PURE__ */ t("h1", { className: "pvx-explorer-title", children: n }),
860
+ /* @__PURE__ */ o("div", { className: "pvx-explorer-stats", children: [
861
+ h > 0 && /* @__PURE__ */ o("span", { children: [
862
+ h.toLocaleString(),
863
863
  " laps"
864
864
  ] }),
865
- v > 0 && m > 0 && /* @__PURE__ */ t("span", { className: "pvx-explorer-stats-sep", children: "|" }),
866
- m > 0 && /* @__PURE__ */ c("span", { children: [
867
- m.toLocaleString(),
865
+ h > 0 && u > 0 && /* @__PURE__ */ t("span", { className: "pvx-explorer-stats-sep", children: "|" }),
866
+ u > 0 && /* @__PURE__ */ o("span", { children: [
867
+ u.toLocaleString(),
868
868
  " drivers"
869
869
  ] })
870
870
  ] })
871
871
  ] }),
872
- /* @__PURE__ */ c("div", { className: "pvx-explorer-controls", children: [
872
+ /* @__PURE__ */ o("div", { className: "pvx-explorer-controls", children: [
873
873
  /* @__PURE__ */ t("div", { className: "pvx-game-tabs", children: ["evo", "acc"].map((b) => /* @__PURE__ */ t(
874
874
  "button",
875
875
  {
876
876
  onClick: () => be(b),
877
- className: `pvx-game-tab ${o === b ? "pvx-game-tab--active" : ""}`,
877
+ className: `pvx-game-tab ${l === b ? "pvx-game-tab--active" : ""}`,
878
878
  children: b === "evo" ? "AC EVO" : "ACC"
879
879
  },
880
880
  b
@@ -882,10 +882,10 @@ function Rt({ className: e, defaultGame: n = "evo", title: r = "Leaderboards" })
882
882
  C && /* @__PURE__ */ t(
883
883
  "select",
884
884
  {
885
- value: L || "",
885
+ value: $ || "",
886
886
  onChange: (b) => ye(b.target.value),
887
887
  className: "pvx-version-select",
888
- children: C.available.slice().reverse().map((b) => /* @__PURE__ */ c("option", { value: b, children: [
888
+ children: C.available.slice().reverse().map((b) => /* @__PURE__ */ o("option", { value: b, children: [
889
889
  "v",
890
890
  b,
891
891
  b === C.default ? " (Latest)" : ""
@@ -893,8 +893,8 @@ function Rt({ className: e, defaultGame: n = "evo", title: r = "Leaderboards" })
893
893
  }
894
894
  )
895
895
  ] }),
896
- ke(),
897
- p && /* @__PURE__ */ c("p", { className: "pvx-data-timestamp", children: [
896
+ Se(),
897
+ p && /* @__PURE__ */ o("p", { className: "pvx-data-timestamp", children: [
898
898
  "Data updated: ",
899
899
  new Date(p).toLocaleString()
900
900
  ] })
@@ -935,86 +935,86 @@ const tt = {
935
935
  championship: "Championship",
936
936
  series: "Series",
937
937
  event: "Event"
938
- }, ne = ["PRACTICE", "QUALIFYING", "RACE"];
938
+ }, re = ["PRACTICE", "QUALIFYING", "RACE"];
939
939
  function xe({ position: e }) {
940
940
  return /* @__PURE__ */ t("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 });
941
941
  }
942
942
  function fe({ nation: e }) {
943
- const n = e && tt[e];
944
- return n ? /* @__PURE__ */ t("span", { className: "pvx-nation-flag", title: e, children: n }) : null;
943
+ const r = e && tt[e];
944
+ return r ? /* @__PURE__ */ t("span", { className: "pvx-nation-flag", title: e, children: r }) : null;
945
945
  }
946
- function rt({ sessions: e, activeSession: n, onSelect: r }) {
946
+ function rt({ sessions: e, activeSession: r, onSelect: n }) {
947
947
  if (!e || e.length <= 1) return null;
948
- const s = [...e].sort(
949
- (a, i) => ne.indexOf(a.type) - ne.indexOf(i.type)
948
+ const a = [...e].sort(
949
+ (s, i) => re.indexOf(s.type) - re.indexOf(i.type)
950
950
  );
951
- return /* @__PURE__ */ t("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ t(
951
+ return /* @__PURE__ */ t("div", { className: "pvx-session-tabs", children: a.map((s) => /* @__PURE__ */ t(
952
952
  "button",
953
953
  {
954
- onClick: () => r(a.type),
955
- className: `pvx-session-tab ${n === a.type ? "pvx-session-tab--active" : ""}`,
956
- children: a.type
954
+ onClick: () => n(s.type),
955
+ className: `pvx-session-tab ${r === s.type ? "pvx-session-tab--active" : ""}`,
956
+ children: s.type
957
957
  },
958
- a.type
958
+ s.type
959
959
  )) });
960
960
  }
961
961
  function ge({ type: e }) {
962
962
  return /* @__PURE__ */ t("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: nt[e] || e });
963
963
  }
964
- function E({ children: e, variant: n = "default" }) {
965
- return /* @__PURE__ */ t("span", { className: `pvx-info-pill ${n !== "default" ? `pvx-info-pill--${n}` : ""}`, children: e });
964
+ function F({ children: e, variant: r = "default" }) {
965
+ return /* @__PURE__ */ t("span", { className: `pvx-info-pill ${r !== "default" ? `pvx-info-pill--${r}` : ""}`, children: e });
966
966
  }
967
967
  function Ne(e) {
968
968
  if (!e) return "TBD";
969
- const n = new Date(e);
970
- if (isNaN(n)) return "TBD";
971
- const r = n.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = n.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
972
- return `${r} • ${s}`;
973
- }
974
- function st(e) {
975
- return e.reduce((n, r) => {
976
- var s;
977
- return (s = r.splits) != null && s.length ? n ? n.map((a, i) => {
978
- const l = r.splits[i];
979
- return l && l < a ? l : a;
980
- }) : [...r.splits] : n;
969
+ const r = new Date(e);
970
+ if (isNaN(r)) return "TBD";
971
+ const n = r.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), a = r.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
972
+ return `${n} • ${a}`;
973
+ }
974
+ function at(e) {
975
+ return e.reduce((r, n) => {
976
+ var a;
977
+ return (a = n.splits) != null && a.length ? r ? r.map((s, i) => {
978
+ const c = n.splits[i];
979
+ return c && c < s ? c : s;
980
+ }) : [...n.splits] : r;
981
981
  }, null);
982
982
  }
983
- function F({ message: e = "Loading..." }) {
983
+ function q({ message: e = "Loading..." }) {
984
984
  return /* @__PURE__ */ t("div", { className: "pvx-loading", children: e });
985
985
  }
986
986
  function M({ message: e = "No data available." }) {
987
987
  return /* @__PURE__ */ t("div", { className: "pvx-empty", children: /* @__PURE__ */ t("p", { children: e }) });
988
988
  }
989
- function at({ competitions: e, isLoading: n, onSelect: r, className: s }) {
990
- return n ? /* @__PURE__ */ t(F, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ t("div", { className: `pvx-comp-grid ${s || ""}`, children: e.map((a) => /* @__PURE__ */ t(it, { comp: a, onSelect: r }, a.id)) }) : /* @__PURE__ */ t(M, { message: "No competitions available." });
989
+ function st({ competitions: e, isLoading: r, onSelect: n, className: a }) {
990
+ return r ? /* @__PURE__ */ t(q, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ t("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((s) => /* @__PURE__ */ t(it, { comp: s, onSelect: n }, s.id)) }) : /* @__PURE__ */ t(M, { message: "No competitions available." });
991
991
  }
992
- function it({ comp: e, onSelect: n }) {
993
- var g, p, v;
994
- const { cdnUrl: r } = k(), s = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, a = e.registration, i = (a == null ? void 0 : a.currentCount) || 0, l = a == null ? void 0 : a.maxParticipants, o = l && i >= l, h = (a == null ? void 0 : a.deadline) && new Date(a.deadline) < /* @__PURE__ */ new Date(), d = (a == null ? void 0 : a.isOpen) && !h && !o, f = /* @__PURE__ */ new Date(), N = (g = e.rounds) == null ? void 0 : g.find((m) => m.startTime && new Date(m.startTime) >= f), x = ((p = e.rounds) == null ? void 0 : p.length) || 0, u = ((v = e.rounds) == null ? void 0 : v.filter((m) => m.isFinalized).length) || 0;
995
- return /* @__PURE__ */ c(
992
+ function it({ comp: e, onSelect: r }) {
993
+ var g, p, h;
994
+ const { cdnUrl: n } = T(), a = e.posterCdnPath ? `${n}/${e.posterCdnPath}` : null, s = e.registration, i = (s == null ? void 0 : s.currentCount) || 0, c = s == null ? void 0 : s.maxParticipants, l = c && i >= c, v = (s == null ? void 0 : s.deadline) && new Date(s.deadline) < /* @__PURE__ */ new Date(), d = (s == null ? void 0 : s.isOpen) && !v && !l, f = /* @__PURE__ */ new Date(), N = (g = e.rounds) == null ? void 0 : g.find((u) => u.startTime && new Date(u.startTime) >= f), x = ((p = e.rounds) == null ? void 0 : p.length) || 0, m = ((h = e.rounds) == null ? void 0 : h.filter((u) => u.isFinalized).length) || 0;
995
+ return /* @__PURE__ */ o(
996
996
  "div",
997
997
  {
998
998
  className: "pvx-comp-card",
999
- onClick: () => n(e.id),
999
+ onClick: () => r(e.id),
1000
1000
  role: "button",
1001
1001
  tabIndex: 0,
1002
- onKeyDown: (m) => {
1003
- (m.key === "Enter" || m.key === " ") && (m.preventDefault(), n(e.id));
1002
+ onKeyDown: (u) => {
1003
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), r(e.id));
1004
1004
  },
1005
1005
  children: [
1006
- /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster", children: s ? /* @__PURE__ */ t("img", { src: s, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ t(ot, {}) }) }),
1007
- /* @__PURE__ */ c("div", { className: "pvx-comp-card-body", children: [
1006
+ /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ t("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ t(lt, {}) }) }),
1007
+ /* @__PURE__ */ o("div", { className: "pvx-comp-card-body", children: [
1008
1008
  /* @__PURE__ */ t("h3", { className: "pvx-comp-card-title", children: e.name }),
1009
1009
  e.description && /* @__PURE__ */ t("p", { className: "pvx-comp-card-desc", children: e.description }),
1010
- /* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
1010
+ /* @__PURE__ */ o("div", { className: "pvx-comp-card-pills", children: [
1011
1011
  /* @__PURE__ */ t(ge, { type: e.type }),
1012
- e.game && /* @__PURE__ */ t(E, { children: e.game.toUpperCase() }),
1013
- e.formatDescription && e.formatDescription.split(", ").map((m, y) => /* @__PURE__ */ t(E, { variant: "format", children: m }, y))
1012
+ e.game && /* @__PURE__ */ t(F, { children: e.game.toUpperCase() }),
1013
+ e.formatDescription && e.formatDescription.split(", ").map((u, y) => /* @__PURE__ */ t(F, { variant: "format", children: u }, y))
1014
1014
  ] }),
1015
- e.carsDescription && /* @__PURE__ */ t("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((m, y) => /* @__PURE__ */ t(E, { children: m }, y)) }),
1016
- /* @__PURE__ */ c("div", { className: "pvx-comp-card-schedule", children: [
1017
- N ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
1015
+ e.carsDescription && /* @__PURE__ */ t("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((u, y) => /* @__PURE__ */ t(F, { children: u }, y)) }),
1016
+ /* @__PURE__ */ o("div", { className: "pvx-comp-card-schedule", children: [
1017
+ N ? /* @__PURE__ */ o("span", { className: "pvx-comp-card-schedule-next", children: [
1018
1018
  /* @__PURE__ */ t("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1019
1019
  " ",
1020
1020
  "R",
@@ -1023,24 +1023,24 @@ function it({ comp: e, onSelect: n }) {
1023
1023
  N.track || "TBD",
1024
1024
  " — ",
1025
1025
  Ne(N.startTime)
1026
- ] }) : x > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
1027
- u,
1026
+ ] }) : x > 0 ? /* @__PURE__ */ o("span", { className: "pvx-comp-card-schedule-next", children: [
1027
+ m,
1028
1028
  "/",
1029
1029
  x,
1030
1030
  " rounds completed"
1031
1031
  ] }) : null,
1032
- x > 0 && /* @__PURE__ */ c("span", { className: "pvx-comp-card-round-count", children: [
1032
+ x > 0 && /* @__PURE__ */ o("span", { className: "pvx-comp-card-round-count", children: [
1033
1033
  x,
1034
1034
  " round",
1035
1035
  x !== 1 ? "s" : ""
1036
1036
  ] })
1037
1037
  ] }),
1038
- a && /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
1039
- /* @__PURE__ */ t("span", { className: `pvx-comp-reg-badge ${d ? "pvx-comp-reg-badge--open" : o ? "pvx-comp-reg-badge--full" : "pvx-comp-reg-badge--closed"}`, children: d ? "Registration Open" : o ? "Full" : "Registration Closed" }),
1040
- /* @__PURE__ */ c("span", { className: "pvx-comp-reg-count", children: [
1038
+ s && /* @__PURE__ */ o("div", { className: "pvx-comp-card-reg", children: [
1039
+ /* @__PURE__ */ t("span", { className: `pvx-comp-reg-badge ${d ? "pvx-comp-reg-badge--open" : l ? "pvx-comp-reg-badge--full" : "pvx-comp-reg-badge--closed"}`, children: d ? "Registration Open" : l ? "Full" : "Registration Closed" }),
1040
+ /* @__PURE__ */ o("span", { className: "pvx-comp-reg-count", children: [
1041
1041
  i,
1042
1042
  "/",
1043
- l || "∞",
1043
+ c || "∞",
1044
1044
  " drivers"
1045
1045
  ] })
1046
1046
  ] })
@@ -1049,8 +1049,8 @@ function it({ comp: e, onSelect: n }) {
1049
1049
  }
1050
1050
  );
1051
1051
  }
1052
- function ot() {
1053
- return /* @__PURE__ */ c("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1052
+ function lt() {
1053
+ return /* @__PURE__ */ o("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1054
1054
  /* @__PURE__ */ t("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1055
1055
  /* @__PURE__ */ t("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
1056
1056
  /* @__PURE__ */ t("path", { d: "M4 22h16" }),
@@ -1059,33 +1059,33 @@ function ot() {
1059
1059
  /* @__PURE__ */ t("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1060
1060
  ] });
1061
1061
  }
1062
- function lt({ competitionId: e, className: n }) {
1063
- var o, h;
1064
- const { data: r, isLoading: s } = Fe(e), { data: a, isLoading: i } = le(e);
1065
- if (s || i)
1066
- return /* @__PURE__ */ t(F, { message: "Loading standings..." });
1067
- if (!((o = r == null ? void 0 : r.standings) != null && o.length))
1062
+ function ot({ competitionId: e, className: r }) {
1063
+ var l, v;
1064
+ const { data: n, isLoading: a } = Ee(e), { data: s, isLoading: i } = oe(e);
1065
+ if (a || i)
1066
+ return /* @__PURE__ */ t(q, { message: "Loading standings..." });
1067
+ if (!((l = n == null ? void 0 : n.standings) != null && l.length))
1068
1068
  return /* @__PURE__ */ t(M, { message: "No standings data yet. Results will appear once rounds are finalised." });
1069
- const l = ((h = a == null ? void 0 : a.rounds) == null ? void 0 : h.filter((d) => d.isFinalized)) || [];
1070
- return /* @__PURE__ */ c("div", { className: `pvx-card ${n || ""}`, children: [
1071
- /* @__PURE__ */ t("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ c("div", { className: "pvx-card-header-left", children: [
1069
+ const c = ((v = s == null ? void 0 : s.rounds) == null ? void 0 : v.filter((d) => d.isFinalized)) || [];
1070
+ return /* @__PURE__ */ o("div", { className: `pvx-card ${r || ""}`, children: [
1071
+ /* @__PURE__ */ t("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ o("div", { className: "pvx-card-header-left", children: [
1072
1072
  /* @__PURE__ */ t("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1073
- /* @__PURE__ */ c("span", { className: "pvx-standings-subtitle", children: [
1073
+ /* @__PURE__ */ o("span", { className: "pvx-standings-subtitle", children: [
1074
1074
  "After ",
1075
- r.roundsCompleted,
1075
+ n.roundsCompleted,
1076
1076
  " round",
1077
- r.roundsCompleted !== 1 ? "s" : "",
1078
- r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
1077
+ n.roundsCompleted !== 1 ? "s" : "",
1078
+ n.countingRounds > 0 && ` (best ${n.countingRounds} count)`
1079
1079
  ] })
1080
1080
  ] }) }),
1081
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
1082
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
1081
+ /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
1082
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
1083
1083
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1084
1084
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1085
1085
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1086
1086
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1087
1087
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1088
- l.map((d) => /* @__PURE__ */ c(
1088
+ c.map((d) => /* @__PURE__ */ o(
1089
1089
  "th",
1090
1090
  {
1091
1091
  className: "pvx-th pvx-th--center pvx-hidden-below-md",
@@ -1098,39 +1098,39 @@ function lt({ competitionId: e, className: n }) {
1098
1098
  d.roundNumber
1099
1099
  ))
1100
1100
  ] }) }),
1101
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: r.standings.map((d) => /* @__PURE__ */ t(
1101
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: n.standings.map((d) => /* @__PURE__ */ t(
1102
1102
  ct,
1103
1103
  {
1104
1104
  driver: d,
1105
- finalizedRounds: l
1105
+ finalizedRounds: c
1106
1106
  },
1107
1107
  d.driverId || d.driverName
1108
1108
  )) })
1109
1109
  ] }) })
1110
1110
  ] });
1111
1111
  }
1112
- function ct({ driver: e, finalizedRounds: n }) {
1113
- var l, o, h;
1114
- const r = e.position <= 3, s = new Map(
1115
- ((l = e.roundResults) == null ? void 0 : l.map((d) => [d.roundNumber, d])) || []
1116
- ), a = ((o = e.roundResults) == null ? void 0 : o.filter((d) => d.position === 1).length) || 0, i = ((h = e.roundResults) == null ? void 0 : h.filter((d) => d.position <= 3).length) || 0;
1117
- return /* @__PURE__ */ c("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
1112
+ function ct({ driver: e, finalizedRounds: r }) {
1113
+ var c, l, v;
1114
+ const n = e.position <= 3, a = new Map(
1115
+ ((c = e.roundResults) == null ? void 0 : c.map((d) => [d.roundNumber, d])) || []
1116
+ ), s = ((l = e.roundResults) == null ? void 0 : l.filter((d) => d.position === 1).length) || 0, i = ((v = e.roundResults) == null ? void 0 : v.filter((d) => d.position <= 3).length) || 0;
1117
+ return /* @__PURE__ */ o("tr", { className: `pvx-row ${n ? "pvx-row--podium" : ""}`, children: [
1118
1118
  /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(xe, { position: e.position }) }),
1119
- /* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
1119
+ /* @__PURE__ */ o("td", { className: "pvx-td pvx-td--primary", children: [
1120
1120
  /* @__PURE__ */ t(fe, { nation: e.nation }),
1121
1121
  e.driverName
1122
1122
  ] }),
1123
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1123
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: s || "-" }),
1124
1124
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1125
1125
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
1126
- n.map((d) => {
1127
- const f = s.get(d.roundNumber), N = f == null ? void 0 : f.dropped;
1126
+ r.map((d) => {
1127
+ const f = a.get(d.roundNumber), N = f == null ? void 0 : f.dropped;
1128
1128
  return /* @__PURE__ */ t(
1129
1129
  "td",
1130
1130
  {
1131
1131
  className: `pvx-td pvx-td--center pvx-hidden-below-md ${!N && (f == null ? void 0 : f.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
1132
- children: f ? /* @__PURE__ */ c("div", { className: `pvx-standings-round-cell ${N ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1133
- /* @__PURE__ */ c("span", { className: "pvx-standings-round-pos", children: [
1132
+ children: f ? /* @__PURE__ */ o("div", { className: `pvx-standings-round-cell ${N ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1133
+ /* @__PURE__ */ o("span", { className: "pvx-standings-round-pos", children: [
1134
1134
  "P",
1135
1135
  f.position
1136
1136
  ] }),
@@ -1142,92 +1142,92 @@ function ct({ driver: e, finalizedRounds: n }) {
1142
1142
  })
1143
1143
  ] });
1144
1144
  }
1145
- function dt({ competitionId: e, roundNumber: n, className: r }) {
1145
+ function dt({ competitionId: e, roundNumber: r, className: n }) {
1146
1146
  var f, N;
1147
- const { data: s, isLoading: a } = _e(e, n), [i, l] = W(null);
1148
- if (a)
1149
- return /* @__PURE__ */ t(F, { message: "Loading results..." });
1150
- if (!s)
1147
+ const { data: a, isLoading: s } = qe(e, r), [i, c] = W(null);
1148
+ if (s)
1149
+ return /* @__PURE__ */ t(q, { message: "Loading results..." });
1150
+ if (!a)
1151
1151
  return /* @__PURE__ */ t(M, { message: "No results for this round." });
1152
- const o = s.sessions || [];
1153
- if (!o.length)
1152
+ const l = a.sessions || [];
1153
+ if (!l.length)
1154
1154
  return /* @__PURE__ */ t(M, { message: "No session data for this round." });
1155
- const h = i || ((f = o.find((x) => x.type === "RACE")) == null ? void 0 : f.type) || ((N = o[0]) == null ? void 0 : N.type), d = o.find((x) => x.type === h) || o[0];
1156
- return /* @__PURE__ */ c("div", { className: `pvx-round-results ${r || ""}`, children: [
1157
- /* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
1158
- /* @__PURE__ */ c("div", { children: [
1159
- /* @__PURE__ */ c("h4", { className: "pvx-round-results-title", children: [
1155
+ const v = i || ((f = l.find((x) => x.type === "RACE")) == null ? void 0 : f.type) || ((N = l[0]) == null ? void 0 : N.type), d = l.find((x) => x.type === v) || l[0];
1156
+ return /* @__PURE__ */ o("div", { className: `pvx-round-results ${n || ""}`, children: [
1157
+ /* @__PURE__ */ o("div", { className: "pvx-round-results-header", children: [
1158
+ /* @__PURE__ */ o("div", { children: [
1159
+ /* @__PURE__ */ o("h4", { className: "pvx-round-results-title", children: [
1160
1160
  "Round ",
1161
- s.roundNumber,
1162
- s.track ? `: ${s.track}` : ""
1161
+ a.roundNumber,
1162
+ a.track ? `: ${a.track}` : ""
1163
1163
  ] }),
1164
- s.startTime && /* @__PURE__ */ t("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
1164
+ a.startTime && /* @__PURE__ */ t("p", { className: "pvx-round-results-date", children: new Date(a.startTime).toLocaleDateString("en-GB", {
1165
1165
  day: "numeric",
1166
1166
  month: "long",
1167
1167
  year: "numeric"
1168
1168
  }) })
1169
1169
  ] }),
1170
- /* @__PURE__ */ t(pt, { sessions: o })
1170
+ /* @__PURE__ */ t(pt, { sessions: l })
1171
1171
  ] }),
1172
1172
  /* @__PURE__ */ t(
1173
1173
  rt,
1174
1174
  {
1175
- sessions: o,
1176
- activeSession: h,
1177
- onSelect: l
1175
+ sessions: l,
1176
+ activeSession: v,
1177
+ onSelect: c
1178
1178
  }
1179
1179
  ),
1180
- /* @__PURE__ */ t(mt, { session: d })
1180
+ /* @__PURE__ */ t(ut, { session: d })
1181
1181
  ] });
1182
1182
  }
1183
1183
  function pt({ sessions: e }) {
1184
- var a;
1185
- const n = e.find((i) => i.type === "RACE"), r = (a = n == null ? void 0 : n.results) == null ? void 0 : a.filter((i) => i.position <= 3).sort((i, l) => i.position - l.position);
1186
- if (!(r != null && r.length)) return null;
1187
- const s = ["🥇", "🥈", "🥉"];
1188
- return /* @__PURE__ */ t("div", { className: "pvx-round-podium-summary", children: r.map((i) => /* @__PURE__ */ c("span", { className: "pvx-round-podium-item", children: [
1189
- /* @__PURE__ */ t("span", { children: s[i.position - 1] }),
1184
+ var s;
1185
+ const r = e.find((i) => i.type === "RACE"), n = (s = r == null ? void 0 : r.results) == null ? void 0 : s.filter((i) => i.position <= 3).sort((i, c) => i.position - c.position);
1186
+ if (!(n != null && n.length)) return null;
1187
+ const a = ["🥇", "🥈", "🥉"];
1188
+ return /* @__PURE__ */ t("div", { className: "pvx-round-podium-summary", children: n.map((i) => /* @__PURE__ */ o("span", { className: "pvx-round-podium-item", children: [
1189
+ /* @__PURE__ */ t("span", { children: a[i.position - 1] }),
1190
1190
  /* @__PURE__ */ t("span", { children: i.driverName })
1191
1191
  ] }, i.driverId)) });
1192
1192
  }
1193
- function mt({ session: e }) {
1194
- var s;
1195
- const n = e.type === "RACE";
1196
- if (!((s = e.results) != null && s.length))
1193
+ function ut({ session: e }) {
1194
+ var a;
1195
+ const r = e.type === "RACE";
1196
+ if (!((a = e.results) != null && a.length))
1197
1197
  return /* @__PURE__ */ t(M, { message: `No results for ${e.type}.` });
1198
- const r = st(e.results);
1199
- return /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
1200
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
1198
+ const n = at(e.results);
1199
+ return /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
1200
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
1201
1201
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1202
1202
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1203
1203
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1204
1204
  /* @__PURE__ */ t("th", { className: "pvx-th", children: "Best Lap" }),
1205
- n && /* @__PURE__ */ c(z, { children: [
1205
+ r && /* @__PURE__ */ o(z, { children: [
1206
1206
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1207
1207
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1208
1208
  /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" })
1209
1209
  ] })
1210
1210
  ] }) }),
1211
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.results.map((a, i) => /* @__PURE__ */ t(
1212
- ut,
1211
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.results.map((s, i) => /* @__PURE__ */ t(
1212
+ mt,
1213
1213
  {
1214
- result: a,
1215
- isRace: n,
1216
- fastestSplits: r,
1214
+ result: s,
1215
+ isRace: r,
1216
+ fastestSplits: n,
1217
1217
  rowIndex: i
1218
1218
  },
1219
- a.driverId || i
1219
+ s.driverId || i
1220
1220
  )) })
1221
1221
  ] }) });
1222
1222
  }
1223
- function ut({ result: e, isRace: n, fastestSplits: r, rowIndex: s }) {
1224
- const a = e.position <= 3;
1225
- return /* @__PURE__ */ c("tr", { className: `pvx-row ${a ? "pvx-row--podium" : ""}`, children: [
1223
+ function mt({ result: e, isRace: r, fastestSplits: n, rowIndex: a }) {
1224
+ const s = e.position <= 3;
1225
+ return /* @__PURE__ */ o("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
1226
1226
  /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(xe, { position: e.position }) }),
1227
- /* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
1227
+ /* @__PURE__ */ o("td", { className: "pvx-td pvx-td--primary", children: [
1228
1228
  /* @__PURE__ */ t(fe, { nation: e.nation }),
1229
1229
  e.driverName,
1230
- e.carNumber != null && /* @__PURE__ */ c("span", { className: "pvx-car-number", children: [
1230
+ e.carNumber != null && /* @__PURE__ */ o("span", { className: "pvx-car-number", children: [
1231
1231
  "#",
1232
1232
  e.carNumber
1233
1233
  ] }),
@@ -1240,16 +1240,16 @@ function ut({ result: e, isRace: n, fastestSplits: r, rowIndex: s }) {
1240
1240
  bestLap: e.bestLapFormatted,
1241
1241
  hasBestLap: e.hasBestLap,
1242
1242
  splits: e.splits,
1243
- fastestSplits: r,
1244
- showAbove: s <= 1
1243
+ fastestSplits: n,
1244
+ showAbove: a <= 1
1245
1245
  }
1246
1246
  ) }),
1247
- n && /* @__PURE__ */ c(z, { children: [
1247
+ r && /* @__PURE__ */ o(z, { children: [
1248
1248
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
1249
1249
  /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
1250
- /* @__PURE__ */ c("td", { className: "pvx-td pvx-td--center", children: [
1250
+ /* @__PURE__ */ o("td", { className: "pvx-td pvx-td--center", children: [
1251
1251
  /* @__PURE__ */ t("span", { className: "pvx-session-points", children: e.points }),
1252
- e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ c("span", { className: "pvx-points-override", children: [
1252
+ e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ o("span", { className: "pvx-points-override", children: [
1253
1253
  "(",
1254
1254
  e.pointsOverride > 0 ? "+" : "",
1255
1255
  e.pointsOverride,
@@ -1259,29 +1259,29 @@ function ut({ result: e, isRace: n, fastestSplits: r, rowIndex: s }) {
1259
1259
  ] })
1260
1260
  ] });
1261
1261
  }
1262
- function vt({ bestLap: e, hasBestLap: n, splits: r, fastestSplits: s, showAbove: a }) {
1263
- return e ? /* @__PURE__ */ c("span", { className: `pvx-best-lap-cell ${n ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1262
+ function vt({ bestLap: e, hasBestLap: r, splits: n, fastestSplits: a, showAbove: s }) {
1263
+ return e ? /* @__PURE__ */ o("span", { className: `pvx-best-lap-cell ${r ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1264
1264
  /* @__PURE__ */ t("span", { className: "pvx-best-lap-time", children: e }),
1265
- (r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ t("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ t("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((i, l) => {
1266
- const o = s && i === s[l];
1267
- return /* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-row", children: [
1268
- /* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-label", children: [
1265
+ (n == null ? void 0 : n.length) > 0 && /* @__PURE__ */ t("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ t("span", { className: `pvx-splits-tooltip ${s ? "" : "pvx-splits-tooltip--above"}`, children: n.map((i, c) => {
1266
+ const l = a && i === a[c];
1267
+ return /* @__PURE__ */ o("span", { className: "pvx-splits-tooltip-row", children: [
1268
+ /* @__PURE__ */ o("span", { className: "pvx-splits-tooltip-label", children: [
1269
1269
  "S",
1270
- l + 1
1270
+ c + 1
1271
1271
  ] }),
1272
- /* @__PURE__ */ t("span", { className: o ? "pvx-splits-tooltip-best" : "", children: i })
1273
- ] }, l);
1272
+ /* @__PURE__ */ t("span", { className: l ? "pvx-splits-tooltip-best" : "", children: i })
1273
+ ] }, c);
1274
1274
  }) }) })
1275
1275
  ] }) : /* @__PURE__ */ t("span", { className: "pvx-td--muted", children: "-" });
1276
1276
  }
1277
- function ht({ competitionId: e, className: n }) {
1278
- const { data: r, isLoading: s } = qe(e);
1279
- if (s)
1280
- return /* @__PURE__ */ t(F, { message: "Loading drivers..." });
1281
- const a = (r == null ? void 0 : r.drivers) || (r == null ? void 0 : r.entries) || [];
1282
- return a.length ? /* @__PURE__ */ t("div", { className: `pvx-entry-grid ${n || ""}`, children: a.map((i) => {
1283
- var l, o;
1284
- return /* @__PURE__ */ c("div", { className: "pvx-entry-card", children: [
1277
+ function ht({ competitionId: e, className: r }) {
1278
+ const { data: n, isLoading: a } = _e(e);
1279
+ if (a)
1280
+ return /* @__PURE__ */ t(q, { message: "Loading drivers..." });
1281
+ const s = (n == null ? void 0 : n.drivers) || (n == null ? void 0 : n.entries) || [];
1282
+ return s.length ? /* @__PURE__ */ t("div", { className: `pvx-entry-grid ${r || ""}`, children: s.map((i) => {
1283
+ var c, l;
1284
+ return /* @__PURE__ */ o("div", { className: "pvx-entry-card", children: [
1285
1285
  i.avatarUrl ? /* @__PURE__ */ t(
1286
1286
  "img",
1287
1287
  {
@@ -1289,7 +1289,7 @@ function ht({ competitionId: e, className: n }) {
1289
1289
  alt: "",
1290
1290
  className: "pvx-entry-avatar"
1291
1291
  }
1292
- ) : /* @__PURE__ */ t("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((o = (l = i.displayName) == null ? void 0 : l.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1292
+ ) : /* @__PURE__ */ t("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((l = (c = i.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : l.toUpperCase()) || "?" }),
1293
1293
  /* @__PURE__ */ t("span", { className: "pvx-entry-name", children: i.displayName })
1294
1294
  ] }, i.steamId || i.driverId);
1295
1295
  }) }) : /* @__PURE__ */ t(M, { message: "No drivers registered yet." });
@@ -1299,48 +1299,48 @@ const xt = [
1299
1299
  { id: "rounds", label: "Rounds" },
1300
1300
  { id: "drivers", label: "Drivers" }
1301
1301
  ];
1302
- function Dt({ className: e, title: n = "Competitions" }) {
1303
- const [r, s] = se(), a = r.get("competition"), i = r.get("tab") || "standings", l = r.get("round") ? Number(r.get("round")) : null, { data: o, isLoading: h } = Ue();
1302
+ function Pt({ className: e, title: r = "Competitions" }) {
1303
+ const [n, a] = se(), s = n.get("competition"), i = n.get("tab") || "standings", c = n.get("round") ? Number(n.get("round")) : null, { data: l, isLoading: v } = Ue();
1304
1304
  function d(g) {
1305
- s({ competition: g });
1305
+ a({ competition: g });
1306
1306
  }
1307
1307
  function f() {
1308
- s({});
1308
+ a({});
1309
1309
  }
1310
1310
  function N(g) {
1311
- s({ competition: a, tab: g });
1311
+ a({ competition: s, tab: g });
1312
1312
  }
1313
1313
  function x(g) {
1314
- s({ competition: a, tab: "rounds", round: String(g) });
1314
+ a({ competition: s, tab: "rounds", round: String(g) });
1315
1315
  }
1316
- function u() {
1317
- s({ competition: a, tab: "rounds" });
1316
+ function m() {
1317
+ a({ competition: s, tab: "rounds" });
1318
1318
  }
1319
- return a ? /* @__PURE__ */ t("div", { className: `pvx-comp-explorer ${e || ""}`, children: /* @__PURE__ */ t(
1319
+ return s ? /* @__PURE__ */ t("div", { className: `pvx-comp-explorer ${e || ""}`, children: /* @__PURE__ */ t(
1320
1320
  ft,
1321
1321
  {
1322
- competitionId: a,
1322
+ competitionId: s,
1323
1323
  activeTab: i,
1324
- selectedRound: l,
1324
+ selectedRound: c,
1325
1325
  onBack: f,
1326
1326
  onTabChange: N,
1327
1327
  onSelectRound: x,
1328
- onDeselectRound: u
1328
+ onDeselectRound: m
1329
1329
  }
1330
- ) }) : /* @__PURE__ */ c("div", { className: `pvx-comp-explorer ${e || ""}`, children: [
1331
- /* @__PURE__ */ c("div", { className: "pvx-explorer-header", children: [
1332
- /* @__PURE__ */ t("h2", { className: "pvx-explorer-title", children: n }),
1333
- !h && (o == null ? void 0 : o.length) > 0 && /* @__PURE__ */ t("div", { className: "pvx-explorer-stats", children: /* @__PURE__ */ c("span", { children: [
1334
- o.length,
1330
+ ) }) : /* @__PURE__ */ o("div", { className: `pvx-comp-explorer ${e || ""}`, children: [
1331
+ /* @__PURE__ */ o("div", { className: "pvx-explorer-header", children: [
1332
+ /* @__PURE__ */ t("h2", { className: "pvx-explorer-title", children: r }),
1333
+ !v && (l == null ? void 0 : l.length) > 0 && /* @__PURE__ */ t("div", { className: "pvx-explorer-stats", children: /* @__PURE__ */ o("span", { children: [
1334
+ l.length,
1335
1335
  " competition",
1336
- o.length !== 1 ? "s" : ""
1336
+ l.length !== 1 ? "s" : ""
1337
1337
  ] }) })
1338
1338
  ] }),
1339
1339
  /* @__PURE__ */ t(
1340
- at,
1340
+ st,
1341
1341
  {
1342
- competitions: o,
1343
- isLoading: h,
1342
+ competitions: l,
1343
+ isLoading: v,
1344
1344
  onSelect: d
1345
1345
  }
1346
1346
  )
@@ -1348,39 +1348,39 @@ function Dt({ className: e, title: n = "Competitions" }) {
1348
1348
  }
1349
1349
  function ft({
1350
1350
  competitionId: e,
1351
- activeTab: n,
1352
- selectedRound: r,
1353
- onBack: s,
1354
- onTabChange: a,
1351
+ activeTab: r,
1352
+ selectedRound: n,
1353
+ onBack: a,
1354
+ onTabChange: s,
1355
1355
  onSelectRound: i,
1356
- onDeselectRound: l
1356
+ onDeselectRound: c
1357
1357
  }) {
1358
1358
  var g, p;
1359
- const { data: o, isLoading: h } = le(e);
1360
- if (h)
1361
- return /* @__PURE__ */ t(F, { message: "Loading competition..." });
1362
- if (!o)
1363
- return /* @__PURE__ */ c("div", { children: [
1359
+ const { data: l, isLoading: v } = oe(e);
1360
+ if (v)
1361
+ return /* @__PURE__ */ t(q, { message: "Loading competition..." });
1362
+ if (!l)
1363
+ return /* @__PURE__ */ o("div", { children: [
1364
1364
  /* @__PURE__ */ t(M, { message: "Competition not found." }),
1365
- /* @__PURE__ */ t("div", { className: "pvx-comp-back-link-wrap", children: /* @__PURE__ */ t("button", { onClick: s, className: "pvx-comp-back-link", children: "← Back to competitions" }) })
1365
+ /* @__PURE__ */ t("div", { className: "pvx-comp-back-link-wrap", children: /* @__PURE__ */ t("button", { onClick: a, className: "pvx-comp-back-link", children: "← Back to competitions" }) })
1366
1366
  ] });
1367
- const d = o.type === "championship", f = ((g = o.rounds) == null ? void 0 : g.filter((v) => v.isFinalized)) || [], N = o.rounds || [], x = xt.filter((v) => !(v.id === "standings" && !d || v.id === "rounds" && f.length === 0)), u = x.find((v) => v.id === n) ? n : ((p = x[0]) == null ? void 0 : p.id) || "standings";
1368
- return /* @__PURE__ */ c(z, { children: [
1369
- /* @__PURE__ */ t("button", { onClick: s, className: "pvx-comp-back-link", children: "← Competitions" }),
1370
- /* @__PURE__ */ c("div", { className: "pvx-comp-detail-header", children: [
1371
- /* @__PURE__ */ t("h2", { className: "pvx-explorer-title", children: o.name }),
1372
- o.description && /* @__PURE__ */ t("p", { className: "pvx-comp-detail-desc", children: o.description }),
1373
- /* @__PURE__ */ c("div", { className: "pvx-comp-detail-meta", children: [
1374
- /* @__PURE__ */ t(ge, { type: o.type }),
1375
- o.game && /* @__PURE__ */ t(E, { children: o.game.toUpperCase() }),
1376
- o.countingRounds > 0 && /* @__PURE__ */ c(E, { variant: "format", children: [
1367
+ const d = l.type === "championship", f = ((g = l.rounds) == null ? void 0 : g.filter((h) => h.isFinalized)) || [], N = l.rounds || [], x = xt.filter((h) => !(h.id === "standings" && !d || h.id === "rounds" && f.length === 0)), m = x.find((h) => h.id === r) ? r : ((p = x[0]) == null ? void 0 : p.id) || "standings";
1368
+ return /* @__PURE__ */ o(z, { children: [
1369
+ /* @__PURE__ */ t("button", { onClick: a, className: "pvx-comp-back-link", children: "← Competitions" }),
1370
+ /* @__PURE__ */ o("div", { className: "pvx-comp-detail-header", children: [
1371
+ /* @__PURE__ */ t("h2", { className: "pvx-explorer-title", children: l.name }),
1372
+ l.description && /* @__PURE__ */ t("p", { className: "pvx-comp-detail-desc", children: l.description }),
1373
+ /* @__PURE__ */ o("div", { className: "pvx-comp-detail-meta", children: [
1374
+ /* @__PURE__ */ t(ge, { type: l.type }),
1375
+ l.game && /* @__PURE__ */ t(F, { children: l.game.toUpperCase() }),
1376
+ l.countingRounds > 0 && /* @__PURE__ */ o(F, { variant: "format", children: [
1377
1377
  "Best ",
1378
- o.countingRounds,
1378
+ l.countingRounds,
1379
1379
  " of ",
1380
1380
  N.length,
1381
1381
  " rounds count"
1382
1382
  ] }),
1383
- N.length > 0 && /* @__PURE__ */ c(E, { children: [
1383
+ N.length > 0 && /* @__PURE__ */ o(F, { children: [
1384
1384
  N.length,
1385
1385
  " round",
1386
1386
  N.length !== 1 ? "s" : ""
@@ -1388,60 +1388,60 @@ function ft({
1388
1388
  ] })
1389
1389
  ] }),
1390
1390
  N.length > 0 && /* @__PURE__ */ t(gt, { rounds: N }),
1391
- x.length > 1 && /* @__PURE__ */ t("div", { className: "pvx-comp-tabs", children: x.map((v) => /* @__PURE__ */ t(
1391
+ x.length > 1 && /* @__PURE__ */ t("div", { className: "pvx-comp-tabs", children: x.map((h) => /* @__PURE__ */ t(
1392
1392
  "button",
1393
1393
  {
1394
- onClick: () => a(v.id),
1395
- className: `pvx-comp-tab ${u === v.id ? "pvx-comp-tab--active" : ""}`,
1396
- children: v.label
1394
+ onClick: () => s(h.id),
1395
+ className: `pvx-comp-tab ${m === h.id ? "pvx-comp-tab--active" : ""}`,
1396
+ children: h.label
1397
1397
  },
1398
- v.id
1398
+ h.id
1399
1399
  )) }),
1400
- u === "standings" && /* @__PURE__ */ t(lt, { competitionId: e }),
1401
- u === "rounds" && /* @__PURE__ */ t(
1400
+ m === "standings" && /* @__PURE__ */ t(ot, { competitionId: e }),
1401
+ m === "rounds" && /* @__PURE__ */ t(
1402
1402
  Nt,
1403
1403
  {
1404
1404
  competitionId: e,
1405
1405
  finalizedRounds: f,
1406
- selectedRound: r,
1406
+ selectedRound: n,
1407
1407
  onSelectRound: i,
1408
- onDeselectRound: l
1408
+ onDeselectRound: c
1409
1409
  }
1410
1410
  ),
1411
- u === "drivers" && /* @__PURE__ */ t(ht, { competitionId: e })
1411
+ m === "drivers" && /* @__PURE__ */ t(ht, { competitionId: e })
1412
1412
  ] });
1413
1413
  }
1414
1414
  function gt({ rounds: e }) {
1415
- const n = /* @__PURE__ */ new Date(), r = e.find((s) => s.startTime && new Date(s.startTime) >= n);
1416
- return /* @__PURE__ */ t("div", { className: "pvx-comp-schedule", children: /* @__PURE__ */ t("div", { className: "pvx-comp-schedule-list", children: e.map((s) => {
1417
- const a = s === r, i = s.startTime && new Date(s.startTime) < n;
1418
- return /* @__PURE__ */ c(
1415
+ const r = /* @__PURE__ */ new Date(), n = e.find((a) => a.startTime && new Date(a.startTime) >= r);
1416
+ return /* @__PURE__ */ t("div", { className: "pvx-comp-schedule", children: /* @__PURE__ */ t("div", { className: "pvx-comp-schedule-list", children: e.map((a) => {
1417
+ const s = a === n, i = a.startTime && new Date(a.startTime) < r;
1418
+ return /* @__PURE__ */ o(
1419
1419
  "div",
1420
1420
  {
1421
- className: `pvx-comp-schedule-item ${a ? "pvx-comp-schedule-item--next" : ""} ${i ? "pvx-comp-schedule-item--past" : ""}`,
1421
+ className: `pvx-comp-schedule-item ${s ? "pvx-comp-schedule-item--next" : ""} ${i ? "pvx-comp-schedule-item--past" : ""}`,
1422
1422
  children: [
1423
- /* @__PURE__ */ c("span", { className: "pvx-comp-schedule-round", children: [
1423
+ /* @__PURE__ */ o("span", { className: "pvx-comp-schedule-round", children: [
1424
1424
  "R",
1425
- s.roundNumber
1425
+ a.roundNumber
1426
1426
  ] }),
1427
- /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-track", children: s.track || "TBD" }),
1428
- /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-date", children: Ne(s.startTime) }),
1429
- s.isFinalized && /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-badge", children: "Results" })
1427
+ /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-track", children: a.track || "TBD" }),
1428
+ /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-date", children: Ne(a.startTime) }),
1429
+ a.isFinalized && /* @__PURE__ */ t("span", { className: "pvx-comp-schedule-badge", children: "Results" })
1430
1430
  ]
1431
1431
  },
1432
- s.roundNumber
1432
+ a.roundNumber
1433
1433
  );
1434
1434
  }) }) });
1435
1435
  }
1436
- function Nt({ competitionId: e, finalizedRounds: n, selectedRound: r, onSelectRound: s, onDeselectRound: a }) {
1437
- return n.length ? /* @__PURE__ */ c("div", { className: "pvx-comp-rounds", children: [
1438
- /* @__PURE__ */ t("div", { className: "pvx-comp-round-pills", children: n.map((i) => /* @__PURE__ */ c(
1436
+ function Nt({ competitionId: e, finalizedRounds: r, selectedRound: n, onSelectRound: a, onDeselectRound: s }) {
1437
+ return r.length ? /* @__PURE__ */ o("div", { className: "pvx-comp-rounds", children: [
1438
+ /* @__PURE__ */ t("div", { className: "pvx-comp-round-pills", children: r.map((i) => /* @__PURE__ */ o(
1439
1439
  "button",
1440
1440
  {
1441
- onClick: () => r === i.roundNumber ? a() : s(i.roundNumber),
1442
- className: `pvx-comp-round-pill ${r === i.roundNumber ? "pvx-comp-round-pill--active" : ""}`,
1441
+ onClick: () => n === i.roundNumber ? s() : a(i.roundNumber),
1442
+ className: `pvx-comp-round-pill ${n === i.roundNumber ? "pvx-comp-round-pill--active" : ""}`,
1443
1443
  children: [
1444
- /* @__PURE__ */ c("span", { className: "pvx-comp-round-pill-num", children: [
1444
+ /* @__PURE__ */ o("span", { className: "pvx-comp-round-pill-num", children: [
1445
1445
  "R",
1446
1446
  i.roundNumber
1447
1447
  ] }),
@@ -1450,65 +1450,185 @@ function Nt({ competitionId: e, finalizedRounds: n, selectedRound: r, onSelectRo
1450
1450
  },
1451
1451
  i.roundNumber
1452
1452
  )) }),
1453
- r ? /* @__PURE__ */ t(dt, { competitionId: e, roundNumber: r }) : /* @__PURE__ */ t("div", { className: "pvx-empty", children: /* @__PURE__ */ t("p", { children: "Select a round to view results." }) })
1453
+ n ? /* @__PURE__ */ t(dt, { competitionId: e, roundNumber: n }) : /* @__PURE__ */ t("div", { className: "pvx-empty", children: /* @__PURE__ */ t("p", { children: "Select a round to view results." }) })
1454
1454
  ] }) : /* @__PURE__ */ t(M, { message: "No finalised rounds yet." });
1455
1455
  }
1456
- function Mt({
1456
+ function Ft({
1457
1457
  competitionId: e,
1458
- driverData: n,
1459
- className: r,
1460
- children: s
1458
+ driverData: r,
1459
+ className: n,
1460
+ children: a
1461
1461
  }) {
1462
- const { data: a, isLoading: i } = Ke(e), l = Oe(e), o = He(e), h = (a == null ? void 0 : a.isRegistered) || !1, d = i || l.isPending || o.isPending, f = l.error || o.error || null, N = () => {
1463
- n && l.mutate(n);
1462
+ const { data: s, isLoading: i } = Ke(e), c = He(e), l = Oe(e), v = (s == null ? void 0 : s.isRegistered) || !1, d = i || c.isPending || l.isPending, f = c.error || l.error || null, N = () => {
1463
+ r && c.mutate(r);
1464
1464
  }, x = () => {
1465
- o.mutate();
1465
+ l.mutate();
1466
1466
  };
1467
- return typeof s == "function" ? s({ isRegistered: h, isLoading: d, register: N, withdraw: x, error: f }) : /* @__PURE__ */ t(
1467
+ return typeof a == "function" ? a({ isRegistered: v, isLoading: d, register: N, withdraw: x, error: f }) : /* @__PURE__ */ t(
1468
1468
  "button",
1469
1469
  {
1470
- className: r,
1471
- onClick: h ? x : N,
1470
+ className: n,
1471
+ onClick: v ? x : N,
1472
1472
  disabled: d,
1473
- children: d ? "Loading..." : h ? "Withdraw" : "Register"
1473
+ children: d ? "Loading..." : v ? "Withdraw" : "Register"
1474
1474
  }
1475
1475
  );
1476
1476
  }
1477
+ function bt(e) {
1478
+ const { cdnUrl: r, partnerSlug: n } = T(), a = L({
1479
+ queryKey: ["pitvox", "laps", n, e],
1480
+ queryFn: () => R(r, `laps/partners/${n}/${e}.json`),
1481
+ enabled: !!e,
1482
+ staleTime: 3e4,
1483
+ refetchInterval: 3e4
1484
+ }), s = a.data;
1485
+ return {
1486
+ isLoading: a.isLoading,
1487
+ error: a.error,
1488
+ data: s ? {
1489
+ driverName: s.driverName || "Driver",
1490
+ lapCount: s.lapCount || 0,
1491
+ trackBreakdown: s.trackBreakdown || [],
1492
+ carBreakdown: s.carBreakdown || [],
1493
+ recordsHeld: s.recordsHeld || 0,
1494
+ currentRecords: s.currentRecords || [],
1495
+ bestRanking: s.bestRanking ?? null,
1496
+ bestRankingTrackId: s.bestRankingTrackId ?? null,
1497
+ bestRankingLayout: s.bestRankingLayout ?? null,
1498
+ bestRankingCarId: s.bestRankingCarId ?? null,
1499
+ generatedAt: s.generatedAt
1500
+ } : null
1501
+ };
1502
+ }
1503
+ function yt(e) {
1504
+ var i;
1505
+ const { cdnUrl: r, partnerSlug: n } = T(), a = L({
1506
+ queryKey: ["pitvox", "ratings", n],
1507
+ queryFn: () => R(r, `leaderboards/partners/${n}/ratings.json`),
1508
+ staleTime: 6e4,
1509
+ refetchInterval: 6e4
1510
+ }), s = k(() => {
1511
+ var c;
1512
+ return !((c = a.data) != null && c.drivers) || !e ? null : a.data.drivers.find(
1513
+ (l) => l.identifier === e
1514
+ ) || null;
1515
+ }, [(i = a.data) == null ? void 0 : i.drivers, e]);
1516
+ return {
1517
+ isLoading: a.isLoading,
1518
+ error: a.error,
1519
+ data: s ? {
1520
+ rating: s.rating,
1521
+ rank: s.rank,
1522
+ totalDrivers: a.data.driverCount || a.data.drivers.length,
1523
+ comboCount: s.comboCount || 0,
1524
+ distinctCars: s.distinctCars || 0,
1525
+ combos: s.combos || []
1526
+ } : null
1527
+ };
1528
+ }
1529
+ function Ct({ driverName: e, avatarUrl: r, memberSince: n, className: a = "" }) {
1530
+ const s = n ? new Date(n).toLocaleDateString("en-GB", { month: "short", year: "numeric" }) : null;
1531
+ return /* @__PURE__ */ o("div", { className: `pvx-dash-profile ${a}`, children: [
1532
+ r ? /* @__PURE__ */ t("img", { src: r, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ t("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
1533
+ /* @__PURE__ */ o("div", { className: "pvx-dash-profile-info", children: [
1534
+ /* @__PURE__ */ t("h2", { className: "pvx-dash-profile-name", children: e }),
1535
+ s && /* @__PURE__ */ o("p", { className: "pvx-dash-profile-since", children: [
1536
+ "Racing since ",
1537
+ s
1538
+ ] })
1539
+ ] })
1540
+ ] });
1541
+ }
1542
+ function wt({ stats: e, rating: r, className: n = "" }) {
1543
+ const a = [];
1544
+ return e && (a.push({ label: "Total Laps", value: e.lapCount.toLocaleString() }), a.push({ label: "Cars Driven", value: e.carBreakdown.length }), a.push({ label: "Tracks Driven", value: e.trackBreakdown.length }), a.push({ label: "Records Held", value: e.recordsHeld }), e.bestRanking != null && a.push({ label: "Best Ranking", value: `#${e.bestRanking}` })), r && a.push({
1545
+ label: "Driver Rating",
1546
+ value: r.rating.toFixed(1),
1547
+ sub: `#${r.rank} of ${r.totalDrivers}`
1548
+ }), a.length ? /* @__PURE__ */ t("div", { className: `pvx-dash-stats ${n}`, children: a.map((s) => /* @__PURE__ */ o("div", { className: "pvx-dash-stat-card", children: [
1549
+ /* @__PURE__ */ t("span", { className: "pvx-dash-stat-value", children: s.value }),
1550
+ /* @__PURE__ */ t("span", { className: "pvx-dash-stat-label", children: s.label }),
1551
+ s.sub && /* @__PURE__ */ t("span", { className: "pvx-dash-stat-sub", children: s.sub })
1552
+ ] }, s.label)) }) : null;
1553
+ }
1554
+ function kt({ records: e, className: r = "" }) {
1555
+ return e != null && e.length ? /* @__PURE__ */ o("div", { className: `pvx-card ${r}`, children: [
1556
+ /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t("h3", { className: "pvx-card-title", children: "Current Records" }) }),
1557
+ /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ o("table", { className: "pvx-table", children: [
1558
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ o("tr", { className: "pvx-thead-row", children: [
1559
+ /* @__PURE__ */ t("th", { className: "pvx-th", children: "Track" }),
1560
+ /* @__PURE__ */ t("th", { className: "pvx-th", children: "Car" }),
1561
+ /* @__PURE__ */ t("th", { className: "pvx-th", children: "Lap Time" }),
1562
+ /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Game" })
1563
+ ] }) }),
1564
+ /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.map((n, a) => /* @__PURE__ */ o("tr", { className: "pvx-row", children: [
1565
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: J(n.trackId, n.layout, n.game) }),
1566
+ /* @__PURE__ */ t("td", { className: "pvx-td", children: B(n.carId) }),
1567
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono", children: U(n.lapTimeMs) }),
1568
+ /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: /* @__PURE__ */ o("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${n.game || "evo"}`, children: [
1569
+ (n.game || "evo").toUpperCase(),
1570
+ n.gameVersion ? ` ${n.gameVersion}` : ""
1571
+ ] }) })
1572
+ ] }, a)) })
1573
+ ] }) })
1574
+ ] }) : null;
1575
+ }
1576
+ function Ut({ steamId: e, avatarUrl: r, memberSince: n, className: a = "" }) {
1577
+ const { data: s, isLoading: i, error: c } = bt(e), { data: l, isLoading: v } = yt(e);
1578
+ return i || v ? /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ t("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : s ? /* @__PURE__ */ o("div", { className: `pvx-dash ${a}`, children: [
1579
+ /* @__PURE__ */ t(
1580
+ Ct,
1581
+ {
1582
+ driverName: s.driverName,
1583
+ avatarUrl: r,
1584
+ memberSince: n
1585
+ }
1586
+ ),
1587
+ /* @__PURE__ */ t(wt, { stats: s, rating: l }),
1588
+ /* @__PURE__ */ t(kt, { records: s.currentRecords })
1589
+ ] }) : /* @__PURE__ */ t("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
1590
+ }
1477
1591
  export {
1478
1592
  Xe as CarsTable,
1479
- at as CompetitionCards,
1480
- Dt as CompetitionExplorer,
1593
+ st as CompetitionCards,
1594
+ Pt as CompetitionExplorer,
1595
+ Ut as DriverDashboard,
1596
+ Ct as DriverProfile,
1481
1597
  Ye as DriversTable,
1482
1598
  ht as EntryList,
1483
1599
  et as LapHistoryTable,
1484
- Rt as LeaderboardExplorer,
1485
- Tt as PitVoxPartnerProvider,
1486
- Mt as RegisterButton,
1600
+ At as LeaderboardExplorer,
1601
+ $t as PitVoxPartnerProvider,
1602
+ kt as RecordsTable,
1603
+ Ft as RegisterButton,
1487
1604
  dt as RoundResults,
1488
- lt as StandingsTable,
1605
+ ot as StandingsTable,
1606
+ wt as StatsCards,
1489
1607
  Ze as TracksTable,
1490
1608
  B as formatCarName,
1491
- U as formatDate,
1492
- kt as formatDelta,
1493
- q as formatLapTime,
1494
- St as formatRelativeTime,
1609
+ E as formatDate,
1610
+ Bt as formatDelta,
1611
+ U as formatLapTime,
1612
+ Dt as formatRelativeTime,
1495
1613
  P as formatSectorTime,
1496
- ae as formatTrackName,
1614
+ J as formatTrackName,
1497
1615
  ie as formatTyreCompound,
1498
- Lt as useCarLeaderboard,
1499
- Ee as useCarMetadata,
1500
- $t as useCompetitionAllRounds,
1501
- le as useCompetitionConfig,
1502
- qe as useCompetitionEntryList,
1503
- _e as useCompetitionRound,
1504
- Fe as useCompetitionStandings,
1616
+ Mt as useCarLeaderboard,
1617
+ Fe as useCarMetadata,
1618
+ It as useCompetitionAllRounds,
1619
+ oe as useCompetitionConfig,
1620
+ _e as useCompetitionEntryList,
1621
+ qe as useCompetitionRound,
1622
+ Ee as useCompetitionStandings,
1505
1623
  Ue as useCompetitions,
1506
1624
  Ae as useDriverLaps,
1507
- Be as useLeaderboardIndex,
1508
- k as usePitVox,
1509
- Oe as useRegister,
1625
+ yt as useDriverRating,
1626
+ bt as useDriverStats,
1627
+ Ie as useLeaderboardIndex,
1628
+ T as usePitVox,
1629
+ He as useRegister,
1510
1630
  Ke as useRegistrationStatus,
1511
- oe as useTrackLeaderboard,
1631
+ le as useTrackLeaderboard,
1512
1632
  Pe as useUserLookup,
1513
- He as useWithdraw
1633
+ Oe as useWithdraw
1514
1634
  };