@pitvox/partner-react 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,73 +1,73 @@
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";
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({
8
- partnerSlug: e,
9
- apiKey: n,
10
- cdnUrl: r = Me,
11
- apiUrl: s = Ie,
12
- getSteamId: a,
1
+ import { jsx as e, jsxs as l, Fragment as Q } from "react/jsx-runtime";
2
+ import { createContext as Re, useMemo as k, useContext as De, useState as j, useCallback as G } from "react";
3
+ import { useQueryClient as J, QueryClient as Ie, QueryClientProvider as Me, useQuery as L, useMutation as ie } from "@tanstack/react-query";
4
+ import { useSearchParams as oe } from "react-router-dom";
5
+ const z = Re(null), Be = "https://cdn.pitvox.com", Ae = "https://api.pitvox.com";
6
+ let W = null;
7
+ function At({
8
+ partnerSlug: t,
9
+ apiKey: r,
10
+ cdnUrl: n = Be,
11
+ apiUrl: a = Ae,
12
+ getSteamId: s,
13
13
  children: i
14
14
  }) {
15
- const l = S(() => ({
16
- partnerSlug: e,
17
- apiKey: n,
18
- cdnUrl: r.replace(/\/$/, ""),
19
- apiUrl: s.replace(/\/$/, ""),
20
- getSteamId: a || (() => null)
21
- }), [e, n, r, s, a]);
15
+ const c = k(() => ({
16
+ partnerSlug: t,
17
+ apiKey: r,
18
+ cdnUrl: n.replace(/\/$/, ""),
19
+ apiUrl: a.replace(/\/$/, ""),
20
+ getSteamId: s || (() => null)
21
+ }), [t, r, n, a, s]);
22
22
  let o = !1;
23
23
  try {
24
- Q(), o = !0;
24
+ J(), o = !0;
25
25
  } catch {
26
26
  o = !1;
27
27
  }
28
- return o ? /* @__PURE__ */ t(G.Provider, { value: l, children: i }) : (O || (O = new Re({
28
+ return o ? /* @__PURE__ */ e(z.Provider, { value: c, children: i }) : (W || (W = new Ie({
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__ */ e(Me, { client: W, children: /* @__PURE__ */ e(z.Provider, { value: c, children: i }) }));
33
33
  }
34
- function k() {
35
- const e = $e(G);
36
- if (!e)
34
+ function T() {
35
+ const t = De(z);
36
+ if (!t)
37
37
  throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
38
- return e;
38
+ return t;
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 $(t, r) {
41
+ const n = await fetch(`${t}/${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) {
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")}`;
48
+ function E(t) {
49
+ if (!t && t !== 0) return "-";
50
+ const r = Math.floor(t / 1e3), n = Math.floor(r / 60), a = r % 60, s = t % 1e3;
51
+ return `${n}:${String(a).padStart(2, "0")}.${String(s).padStart(3, "0")}`;
52
52
  }
53
- function P(e) {
54
- return !e && e !== 0 ? "-" : (e / 1e3).toFixed(3);
53
+ function P(t) {
54
+ return !t && t !== 0 ? "-" : (t / 1e3).toFixed(3);
55
55
  }
56
- function B(e) {
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(" ");
56
+ function I(t) {
57
+ if (!t) return "";
58
+ let r = t;
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 V(t, r, n) {
62
+ const a = t.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) {
68
- if (!e) return "-";
67
+ function F(t) {
68
+ if (!t) return "-";
69
69
  try {
70
- return new Date(e).toLocaleDateString("en-GB", {
70
+ return new Date(t).toLocaleDateString("en-GB", {
71
71
  day: "numeric",
72
72
  month: "short",
73
73
  year: "numeric"
@@ -76,22 +76,22 @@ function U(e) {
76
76
  return "-";
77
77
  }
78
78
  }
79
- function St(e) {
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) {
91
- return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
92
- }
93
- function ie(e) {
94
- return e ? {
79
+ function Pt(t) {
80
+ if (!t) return "";
81
+ const r = Date.now() - new Date(t).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` : F(t);
89
+ }
90
+ function Ut(t) {
91
+ return t == null ? "" : `${t >= 0 ? "+" : "-"}${(Math.abs(t) / 1e3).toFixed(3)}`;
92
+ }
93
+ function le(t) {
94
+ return t ? {
95
95
  E: "Eco",
96
96
  RD: "Road",
97
97
  SC: "SuperCar",
@@ -102,259 +102,259 @@ function ie(e) {
102
102
  MR: "Medium Race",
103
103
  SR: "Soft Race",
104
104
  S: "Soft"
105
- }[e] || e : "Unknown";
105
+ }[t] || t : "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 Pe(t = {}) {
108
+ var o, m, d, g, N, x;
109
+ const { cdnUrl: r, partnerSlug: n } = T(), { game: a, gameVersion: s } = t, i = L({
110
+ queryKey: ["pitvox", "leaderboards", n, "index"],
111
+ queryFn: () => $(r, `leaderboards/partners/${n}/index.json`),
112
112
  staleTime: 3e4,
113
113
  refetchInterval: 3e4
114
- }), l = S(() => {
115
- var g;
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) => ({
114
+ }), c = k(() => {
115
+ var f;
116
+ if (!((f = i.data) != null && f.tracks)) return [];
117
+ let h = i.data.tracks;
118
+ return a && (h = h.filter((p) => p.game === a)), s && (h = h.filter((p) => p.gameVersion === s)), h.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: V(p.trackId, p.layout, p.game),
124
124
  driverCount: p.driverCount || 0,
125
125
  carCount: p.carCount || 0,
126
126
  record: p.recordHolder ? {
127
127
  visibleId: p.recordHolder.steamId || p.recordHolder.userId,
128
128
  carId: p.recordHolder.carId,
129
- carDisplayName: B(p.recordHolder.carId),
129
+ carDisplayName: I(p.recordHolder.carId),
130
130
  lapTimeMs: p.recordHolder.lapTimeMs,
131
131
  timestamp: p.recordHolder.recordedAt
132
132
  } : null,
133
133
  recordByTag: p.recordByTag || null
134
134
  }));
135
- }, [(o = i.data) == null ? void 0 : o.tracks, s, a]);
135
+ }, [(o = i.data) == null ? void 0 : o.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: ((m = i.data) == null ? void 0 : m.partner) || null,
140
140
  generatedAt: (d = i.data) == null ? void 0 : d.generatedAt,
141
- totalLaps: ((f = i.data) == null ? void 0 : f.totalLaps) || 0,
141
+ totalLaps: ((g = i.data) == null ? void 0 : g.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),
150
- enabled: !!e,
146
+ function ce(t, r, n = {}) {
147
+ const { cdnUrl: a, partnerSlug: s } = T(), { carId: i, game: c, gameVersion: o } = n, m = r || "default", d = o ? `leaderboards/partners/${s}/v/${o}/tracks/${t}/${m}.json` : `leaderboards/partners/${s}/tracks/${t}/${m}.json`, { data: g, isLoading: N, error: x } = L({
148
+ queryKey: ["pitvox", "leaderboards", s, "track", t, m, o],
149
+ queryFn: () => $(a, d),
150
+ enabled: !!t,
151
151
  staleTime: 3e4,
152
152
  refetchInterval: 3e4
153
153
  });
154
- return { data: S(() => {
155
- if (!(f != null && f.entries)) return [];
156
- let g = f.entries;
157
- if (l && (g = g.filter((p) => p.game === l)), !i) {
154
+ return { data: k(() => {
155
+ if (!(g != null && g.entries)) return [];
156
+ let f = g.entries;
157
+ if (c && (f = f.filter((p) => p.game === c)), !i) {
158
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);
159
+ for (const u of f) {
160
+ const y = u.steamId || u.userId;
161
+ v.has(u.carId) || v.set(u.carId, /* @__PURE__ */ new Set()), v.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 = v.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`),
176
- enabled: !!e,
168
+ return f.filter((p) => p.carId === i).sort((p, v) => p.lapTimeMs - v.lapTimeMs);
169
+ }, [g == null ? void 0 : g.entries, i, c]), isLoading: N, error: x };
170
+ }
171
+ function Ue(t, r, n, a, s = {}) {
172
+ var x, h;
173
+ const { cdnUrl: i, partnerSlug: c } = T(), { showInvalid: o = !1, game: m, gameVersion: d } = s, g = L({
174
+ queryKey: ["pitvox", "laps", c, t],
175
+ queryFn: () => $(i, `laps/partners/${c}/${t}.json`),
176
+ enabled: !!t,
177
177
  staleTime: 3e4,
178
178
  refetchInterval: 3e4
179
- }), N = S(() => {
180
- var g;
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;
179
+ }), N = k(() => {
180
+ var f;
181
+ return (f = g.data) != null && f.laps ? g.data.laps.filter((p) => {
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);
186
+ return !(p.carId !== a || m && p.game !== m || d && p.gameVersion !== d || !o && !p.isValid);
187
187
  }).sort((p, v) => p.lapTimeMs - v.lapTimeMs) : [];
188
- }, [(x = f.data) == null ? void 0 : x.laps, n, r, s, h, d, o]);
188
+ }, [(x = g.data) == null ? void 0 : x.laps, r, n, a, m, d, o]);
189
189
  return {
190
- ...f,
190
+ ...g,
191
191
  data: N,
192
- driverName: ((u = f.data) == null ? void 0 : u.driverName) || "Driver"
192
+ driverName: ((h = g.data) == null ? void 0 : h.driverName) || "Driver"
193
193
  };
194
194
  }
195
- function Pe() {
196
- const { cdnUrl: e } = k(), { data: n } = $({
195
+ function Ee() {
196
+ const { cdnUrl: t } = T(), { data: r } = L({
197
197
  queryKey: ["pitvox", "users", "index"],
198
- queryFn: () => D(e, "users/index.json"),
198
+ queryFn: () => $(t, "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: t } = T(), { data: r } = L({
213
213
  queryKey: ["pitvox", "cars", "index"],
214
- queryFn: () => D(e, "cars/index.json"),
214
+ queryFn: () => $(t, "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 Et(t, r) {
224
+ return ce(t, null, { carId: r });
225
225
  }
226
- function Ue() {
227
- const { cdnUrl: e, partnerSlug: n } = k();
228
- return $({
229
- queryKey: ["pitvox", "competitions", n],
226
+ function _e() {
227
+ const { cdnUrl: t, 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 $(t, "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`),
242
- enabled: !!e,
237
+ function de(t) {
238
+ const { cdnUrl: r, partnerSlug: n } = T();
239
+ return L({
240
+ queryKey: ["pitvox", "competition", n, t, "config"],
241
+ queryFn: () => $(r, `competitions/${n}/${t}/config.json`),
242
+ enabled: !!t,
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`),
251
- enabled: !!e,
246
+ function qe(t) {
247
+ const { cdnUrl: r, partnerSlug: n } = T();
248
+ return L({
249
+ queryKey: ["pitvox", "competition", n, t, "standings"],
250
+ queryFn: () => $(r, `competitions/${n}/${t}/standings.json`),
251
+ enabled: !!t,
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 je(t, r) {
256
+ const { cdnUrl: n, partnerSlug: a } = T();
257
+ return L({
258
+ queryKey: ["pitvox", "competition", a, t, "round", r],
259
+ queryFn: () => $(n, `competitions/${a}/${t}/rounds/${r}.json`),
260
+ enabled: !!t && 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 Ft(t, r = []) {
265
+ const { cdnUrl: n, partnerSlug: a } = T();
266
+ return L({
267
+ queryKey: ["pitvox", "competition", a, t, "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) => $(n, `competitions/${a}/${t}/rounds/${i}.json`).catch(() => null)
271
271
  )
272
272
  )).filter(Boolean),
273
- enabled: !!e && n.length > 0,
273
+ enabled: !!t && 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`),
282
- enabled: !!e,
277
+ function Ve(t) {
278
+ const { cdnUrl: r, partnerSlug: n } = T();
279
+ return L({
280
+ queryKey: ["pitvox", "competition", n, t, "entrylist"],
281
+ queryFn: () => $(r, `competitions/${n}/${t}/entrylist.json`),
282
+ enabled: !!t,
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 pe(t, r, n, a = {}) {
287
+ const s = await fetch(`${t}${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 Ke(t, r, n, a) {
302
+ return pe(t, 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 He(t, r, n, a) {
308
+ return pe(t, r, `/api/v1/competitions/${n}/register/${a}`, {
309
309
  method: "DELETE"
310
310
  });
311
311
  }
312
- function Ke(e) {
313
- const { cdnUrl: n, partnerSlug: r, getSteamId: s } = k(), a = s();
314
- return $({
315
- queryKey: ["pitvox", "registration", r, e, a],
312
+ function Oe(t) {
313
+ const { cdnUrl: r, partnerSlug: n, getSteamId: a } = T(), s = a();
314
+ return L({
315
+ queryKey: ["pitvox", "registration", n, t, s],
316
316
  queryFn: async () => {
317
- var h;
318
- const i = await fetch(`${n}/competitions/${r}/${e}/entrylist.json`);
317
+ var m;
318
+ const i = await fetch(`${r}/competitions/${n}/${t}/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 && ((m = c.drivers) == null ? void 0 : m.some((d) => d.steamId === s)), entryList: c };
322
322
  },
323
- enabled: !!e,
323
+ enabled: !!t,
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 We(t) {
328
+ const { apiUrl: r, apiKey: n, partnerSlug: a } = T(), s = J();
329
+ return ie({
330
+ mutationFn: (i) => Ke(r, n, t, 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, t]
334
+ }), s.invalidateQueries({
335
+ queryKey: ["pitvox", "competition", a, t, "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();
340
+ function Ge(t) {
341
+ const { apiUrl: r, apiKey: n, partnerSlug: a, getSteamId: s } = T(), i = J();
342
+ return ie({
343
+ mutationFn: (c) => {
344
+ const o = c || s();
345
345
  if (!o) throw new Error("No Steam ID available");
346
- return Ve(n, r, e, o);
346
+ return He(r, n, t, o);
347
347
  },
348
348
  onSuccess: () => {
349
349
  i.invalidateQueries({
350
- queryKey: ["pitvox", "registration", s, e]
350
+ queryKey: ["pitvox", "registration", a, t]
351
351
  }), i.invalidateQueries({
352
- queryKey: ["pitvox", "competition", s, e, "entrylist"]
352
+ queryKey: ["pitvox", "competition", a, t, "entrylist"]
353
353
  });
354
354
  }
355
355
  });
356
356
  }
357
- const Ge = {
357
+ const ze = {
358
358
  formula: "Formula",
359
359
  gt3: "GT3",
360
360
  gt2: "GT2",
@@ -374,351 +374,351 @@ const Ge = {
374
374
  "2000s": "2000s",
375
375
  "2010s": "2010s",
376
376
  "2020s": "2020s"
377
- }, de = [
377
+ }, ue = [
378
378
  { id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
379
379
  { id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
380
380
  { id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
381
381
  ];
382
- function ze(e) {
383
- for (const n of de)
384
- if (n.tags.includes(e)) return n.id;
382
+ function Qe(t) {
383
+ for (const r of ue)
384
+ if (r.tags.includes(t)) 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 me(t, r) {
388
+ if (r.size === 0) return !0;
389
+ const n = {};
390
+ for (const a of r) {
391
+ const s = Qe(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) => t.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 he() {
399
+ const [t, r] = j(/* @__PURE__ */ new Set()), n = G((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 = G(() => r(/* @__PURE__ */ new Set()), []);
405
+ return { activeTags: t, 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(t) {
408
+ const [r, n] = j(t), a = G((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(t, r, n) {
416
+ return [...t].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 o = typeof i == "string" ? i.localeCompare(c) : i - c;
422
+ return r.dir === "desc" ? -o : o;
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 ve(t, r = !1) {
426
+ const n = r ? t == null ? void 0 : t.filter((a) => a.isValid) : t;
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 Je({ active: t, dir: r }) {
434
+ return t ? r === "asc" ? /* @__PURE__ */ e("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ e("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ e("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("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 = "" }) {
437
- return /* @__PURE__ */ t(
436
+ function D({ label: t, sortKey: r, config: n, onSort: a, className: s = "" }) {
437
+ return /* @__PURE__ */ e(
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: [
443
- e,
444
- /* @__PURE__ */ t(We, { active: r.key === n, dir: r.dir })
440
+ className: `pvx-th pvx-th--sortable ${s}`,
441
+ onClick: () => a(r),
442
+ children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
443
+ t,
444
+ /* @__PURE__ */ e(Je, { 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: t, getUserDisplay: r }) {
450
+ const { displayName: n, avatarUrl: a } = r(t);
451
+ return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
452
+ a ? /* @__PURE__ */ e("img", { src: a, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
453
+ /* @__PURE__ */ e("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 xe({ rank: t, podium: r = !1 }) {
457
+ return /* @__PURE__ */ e("span", { className: r ? t === 1 ? "pvx-rank pvx-rank--gold" : t === 2 ? "pvx-rank pvx-rank--silver" : t === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: t });
458
458
  }
459
- function he({ availableTags: e, activeTags: n, onToggle: r, onClear: s }) {
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: [
463
- /* @__PURE__ */ t(
459
+ function ge({ availableTags: t, activeTags: r, onToggle: n, onClear: a }) {
460
+ if (!t || t.length < 2) return null;
461
+ const s = ue.map((i) => ({ id: i.id, tags: i.tags.filter((c) => t.includes(c)) })).filter((i) => i.tags.length > 0);
462
+ return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
463
+ /* @__PURE__ */ e(
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__ */ l("span", { className: "contents", children: [
472
+ c > 0 && /* @__PURE__ */ e("span", { className: "pvx-tag-separator" }),
473
+ i.tags.map((o) => /* @__PURE__ */ e(
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(o),
477
+ className: `pvx-tag ${r.has(o) ? "pvx-tag--active" : ""}`,
478
+ children: ze[o] || o
479
479
  },
480
480
  o
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: t }) {
486
+ return /* @__PURE__ */ e("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ e("ol", { className: "pvx-breadcrumb-list", children: t.map((r, n) => {
487
+ const a = n === t.length - 1;
488
+ return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
489
+ n > 0 && /* @__PURE__ */ e("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
490
+ !a && r.onClick ? /* @__PURE__ */ e("button", { onClick: r.onClick, className: "pvx-breadcrumb-link", children: r.label }) : /* @__PURE__ */ e("span", { className: "pvx-breadcrumb-current", children: r.label })
491
+ ] }, r.key);
492
492
  }) }) });
493
493
  }
494
- function j({ message: e }) {
495
- return /* @__PURE__ */ c("div", { className: "pvx-empty", children: [
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
- /* @__PURE__ */ t("p", { children: e })
494
+ function K({ message: t }) {
495
+ return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
496
+ /* @__PURE__ */ e("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ e("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
+ /* @__PURE__ */ e("p", { children: t })
498
498
  ] });
499
499
  }
500
- function V() {
501
- return /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading..." });
502
- }
503
- function Qe() {
504
- return /* @__PURE__ */ t("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
505
- }
506
- function Je() {
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
- }
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(() => {
511
- var g;
512
- if (!((g = r == null ? void 0 : r.tags) != null && g.length)) return [];
513
- const u = /* @__PURE__ */ new Set();
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;
520
- let g = null;
500
+ function H() {
501
+ return /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading..." });
502
+ }
503
+ function Ze() {
504
+ return /* @__PURE__ */ e("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
505
+ }
506
+ function Xe() {
507
+ return /* @__PURE__ */ e("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
508
+ }
509
+ function Ye({ tracks: t, isLoading: r, carMetadata: n, getUserDisplay: a, onTrackSelect: s }) {
510
+ const [i, c] = Z({ key: "record.timestamp", dir: "desc" }), { activeTags: o, toggle: m, clear: d } = he(), g = k(() => {
511
+ var f;
512
+ if (!((f = n == null ? void 0 : n.tags) != null && f.length)) return [];
513
+ const h = /* @__PURE__ */ new Set();
514
+ for (const p of t || [])
515
+ p.recordByTag && Object.keys(p.recordByTag).forEach((v) => h.add(v));
516
+ return n.tags.filter((p) => h.has(p));
517
+ }, [t, n]), N = k(() => t ? o.size === 0 ? t : t.map((h) => {
518
+ var v, u;
519
+ if (!h.recordByTag) return null;
520
+ let f = null;
521
521
  const p = /* @__PURE__ */ new Set();
522
- for (const y of Object.values(u.recordByTag)) {
522
+ for (const y of Object.values(h.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 = (v = n == null ? void 0 : n.cars) == null ? void 0 : v[y.carId]) == null ? void 0 : u.tags) || ["sports_car"];
526
+ me(C, o) && (!f || y.lapTimeMs < f.lapTimeMs) && (f = y);
527
527
  }
528
- return g ? {
529
- ...u,
528
+ return f ? {
529
+ ...h,
530
530
  record: {
531
- visibleId: g.steamId || g.identifier,
532
- carId: g.carId,
533
- carDisplayName: B(g.carId),
534
- lapTimeMs: g.lapTimeMs,
535
- timestamp: g.recordedAt
531
+ visibleId: f.steamId || f.identifier,
532
+ carId: f.carId,
533
+ carDisplayName: I(f.carId),
534
+ lapTimeMs: f.lapTimeMs,
535
+ timestamp: f.recordedAt
536
536
  }
537
537
  } : null;
538
- }).filter(Boolean) : [], [e, o, r]), x = S(() => Z(N, i, (u, g) => {
538
+ }).filter(Boolean) : [], [t, o, n]), x = k(() => X(N, i, (h, f) => {
539
539
  var p, v;
540
- switch (g) {
540
+ switch (f) {
541
541
  case "displayName":
542
- return u.displayName;
542
+ return h.displayName;
543
543
  case "record.lapTimeMs":
544
- return (p = u.record) == null ? void 0 : p.lapTimeMs;
544
+ return (p = h.record) == null ? void 0 : p.lapTimeMs;
545
545
  case "driverCount":
546
- return u.driverCount || 0;
546
+ return h.driverCount || 0;
547
547
  case "carCount":
548
- return u.carCount || 0;
548
+ return h.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 (v = h.record) != null && v.timestamp ? new Date(h.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: [
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 }),
560
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Record Holder" }),
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" })
554
+ return r ? /* @__PURE__ */ e(H, {}) : t != null && t.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
555
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Track Records" }) }),
556
+ /* @__PURE__ */ e(ge, { availableTags: g, activeTags: o, onToggle: m, onClear: d }),
557
+ /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
558
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
559
+ /* @__PURE__ */ e(D, { label: "Track", sortKey: "displayName", config: i, onSort: c }),
560
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
561
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
562
+ /* @__PURE__ */ e(D, { label: "Lap Time", sortKey: "record.lapTimeMs", config: i, onSort: c }),
563
+ /* @__PURE__ */ e(D, { label: "Drivers", sortKey: "driverCount", config: i, onSort: c, className: "pvx-hidden-below-md" }),
564
+ /* @__PURE__ */ e(D, { label: "Cars", sortKey: "carCount", config: i, onSort: c, className: "pvx-hidden-below-lg" }),
565
+ /* @__PURE__ */ e(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__ */ e("tbody", { className: "pvx-tbody", children: x.map((h) => {
568
+ var f, p, v;
569
+ return /* @__PURE__ */ l(
570
570
  "tr",
571
571
  {
572
572
  className: "pvx-row pvx-row--clickable",
573
- onClick: () => a(u.id, u.layout),
573
+ onClick: () => s(h.id, h.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__ */ e("td", { className: "pvx-td pvx-td--primary", children: h.displayName }),
576
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: (f = h.record) != null && f.visibleId ? /* @__PURE__ */ e(Y, { userId: h.record.visibleId, getUserDisplay: a }) : "-" }),
577
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((p = h.record) == null ? void 0 : p.carDisplayName) || "-" }),
578
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: h.record ? E(h.record.lapTimeMs) : "-" }),
579
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
580
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.carCount || "-" }),
581
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (v = h.record) != null && v.timestamp ? F(h.record.timestamp) : "-" })
582
582
  ]
583
583
  },
584
- `${u.id}|${u.layout || ""}`
584
+ `${h.id}|${h.layout || ""}`
585
585
  );
586
586
  }) })
587
587
  ] }) })
588
- ] }) : /* @__PURE__ */ t(j, { message: "No lap times recorded yet." });
588
+ ] }) : /* @__PURE__ */ e(K, { 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 [];
590
+ function et({ entries: t, isLoading: r, track: n, carMetadata: a, getUserDisplay: s, onCarSelect: i, onNavigate: c }) {
591
+ const [o, m] = Z({ key: "lapTimeMs", dir: "asc" }), { activeTags: d, toggle: g, clear: N } = he(), x = k(() => {
592
+ var u, y, C;
593
+ if (!t || !((u = a == null ? void 0 : a.tags) != null && u.length)) return [];
594
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) => {
595
+ for (const R of t)
596
+ (((C = (y = a.cars) == null ? void 0 : y[R.carId]) == null ? void 0 : C.tags) || ["sports_car"]).forEach((S) => v.add(S));
597
+ return a.tags.filter((R) => v.has(R));
598
+ }, [t, a]), h = k(() => t ? d.size === 0 ? t : t.filter((v) => {
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[v.carId]) == null ? void 0 : C.tags) || ["sports_car"];
601
+ return me(u, d);
602
+ }) : [], [t, d, a]), f = k(() => X(h, o, (v, u) => {
603
+ switch (u) {
604
604
  case "carId":
605
- return B(v.carId);
605
+ return I(v.carId);
606
606
  case "driverCount":
607
607
  return v.driverCount || 0;
608
608
  case "lapTimeMs":
609
609
  default:
610
610
  return v.lapTimeMs;
611
611
  }
612
- }), [u, o]), p = [
613
- { key: "tracks", label: "Tracks", onClick: () => l("tracks") },
614
- { key: "track", label: r.displayName }
612
+ }), [h, o]), 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 }) }),
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: [
621
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
622
- /* @__PURE__ */ t(R, { label: "Car", sortKey: "carId", config: o, onSort: h }),
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" }),
626
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
616
+ return r ? /* @__PURE__ */ e(H, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
617
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ee, { segments: p }) }),
618
+ /* @__PURE__ */ e(ge, { availableTags: x, activeTags: d, onToggle: g, onClear: N }),
619
+ t != null && t.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
620
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
621
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
622
+ /* @__PURE__ */ e(D, { label: "Car", sortKey: "carId", config: o, onSort: m }),
623
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
624
+ /* @__PURE__ */ e(D, { label: "Lap Time", sortKey: "lapTimeMs", config: o, onSort: m }),
625
+ /* @__PURE__ */ e(D, { label: "Drivers", sortKey: "driverCount", config: o, onSort: m, className: "pvx-hidden-below-md" }),
626
+ /* @__PURE__ */ e("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__ */ e("tbody", { className: "pvx-tbody", children: f.map((v, u) => /* @__PURE__ */ l(
629
629
  "tr",
630
630
  {
631
631
  className: "pvx-row pvx-row--clickable",
632
632
  onClick: () => i(v.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__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(xe, { rank: u + 1, podium: !0 }) }),
635
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(v.carId) }),
636
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(Y, { userId: v.steamId || v.userId, getUserDisplay: s }) }),
637
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: E(v.lapTimeMs) }),
638
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: v.driverCount || "-" }),
639
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: v.recordedAt ? F(v.recordedAt) : "-" })
640
640
  ]
641
641
  },
642
642
  v.carId
643
643
  )) })
644
- ] }) }) : /* @__PURE__ */ t(j, { message: "No lap times for this track yet." })
644
+ ] }) }) : /* @__PURE__ */ e(K, { 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 tt({ entries: t, isLoading: r, track: n, carId: a, getUserDisplay: s, onDriverSelect: i, onNavigate: c }) {
648
+ const [o, m] = Z({ key: "lapTimeMs", dir: "asc" }), d = k(() => ve(t), [t]), g = k(() => X(t || [], o, (x, h) => {
649
+ switch (h) {
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
+ }), [t, o, s]), N = [
659
+ { key: "tracks", label: "Tracks", onClick: () => c("tracks") },
660
+ { key: "track", label: n.displayName, onClick: () => c("track") },
661
+ { key: "car", label: I(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: [
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 }),
670
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
671
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
672
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
673
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
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" }),
676
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
663
+ return r ? /* @__PURE__ */ e(H, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
664
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ee, { segments: N }) }),
665
+ t != null && t.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
666
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
667
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
668
+ /* @__PURE__ */ e(D, { label: "Driver", sortKey: "userId", config: o, onSort: m }),
669
+ /* @__PURE__ */ e(D, { label: "Lap Time", sortKey: "lapTimeMs", config: o, onSort: m }),
670
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
671
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
672
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
673
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
674
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
675
+ /* @__PURE__ */ e(D, { label: "Laps", sortKey: "lapCount", config: o, onSort: m, className: "pvx-hidden-below-lg" }),
676
+ /* @__PURE__ */ e("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__ */ e("tbody", { className: "pvx-tbody", children: g.map((x, h) => {
679
+ const f = h + 1, p = x.steamId || x.userId, v = d && x.sector1Ms === d.s1, u = d && x.sector2Ms === d.s2, y = d && x.sector3Ms === d.s3;
680
+ return /* @__PURE__ */ l(
681
681
  "tr",
682
682
  {
683
- className: `pvx-row pvx-row--clickable ${g <= 3 ? "pvx-row--podium" : ""}`,
683
+ className: `pvx-row pvx-row--clickable ${f <= 3 ? "pvx-row--podium" : ""}`,
684
684
  onClick: () => i(p),
685
685
  children: [
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) }),
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
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ie(x.tyreCompound), children: x.tyreCompound || "-" }),
693
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: x.startingFuelL ? `${x.startingFuelL}L` : "-" }),
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) : "-" })
686
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(xe, { rank: f, podium: !0 }) }),
687
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(Y, { userId: p, getUserDisplay: s }) }),
688
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: E(x.lapTimeMs) }),
689
+ /* @__PURE__ */ e("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__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${u ? "pvx-td--best-sector" : ""}`, children: P(x.sector2Ms) }),
691
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: P(x.sector3Ms) }),
692
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: le(x.tyreCompound), children: x.tyreCompound || "-" }),
693
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: x.startingFuelL ? `${x.startingFuelL}L` : "-" }),
694
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.lapCount || "-" }),
695
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: x.recordedAt ? F(x.recordedAt) : "-" })
696
696
  ]
697
697
  },
698
698
  p
699
699
  );
700
700
  }) })
701
- ] }) }) : /* @__PURE__ */ t(j, { message: "No lap times for this car yet." })
701
+ ] }) }) : /* @__PURE__ */ e(K, { 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;
704
+ function nt({ userId: t, track: r, carId: n, game: a, gameVersion: s, showInvalid: i, getUserDisplay: c, onToggleInvalid: o, onNavigate: m }) {
705
+ const { data: d, driverName: g, isLoading: N } = Ue(t, r.id, r.layout, n, { showInvalid: i, game: a, gameVersion: s }), { displayName: x, avatarUrl: h } = c(t, g), f = k(() => ve(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
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") },
709
+ { key: "tracks", label: "Tracks", onClick: () => m("tracks") },
710
+ { key: "track", label: r.displayName, onClick: () => m("track") },
711
+ { key: "car", label: I(n), onClick: () => m("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__ */ e(H, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
715
+ /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
716
+ /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
717
+ /* @__PURE__ */ e(ee, { segments: v }),
718
+ h ? /* @__PURE__ */ e("img", { src: h, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
719
719
  ] }),
720
- /* @__PURE__ */ c("label", { className: "pvx-checkbox-label", children: [
721
- /* @__PURE__ */ t(
720
+ /* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
721
+ /* @__PURE__ */ e(
722
722
  "input",
723
723
  {
724
724
  type: "checkbox",
@@ -727,165 +727,165 @@ function et({ userId: e, track: n, carId: r, game: s, gameVersion: a, showInvali
727
727
  className: "pvx-checkbox"
728
728
  }
729
729
  ),
730
- /* @__PURE__ */ t("span", { children: "Show invalid laps" })
730
+ /* @__PURE__ */ e("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: [
735
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
736
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
737
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Lap Time" }),
738
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
739
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
740
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
741
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
742
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
743
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
744
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
733
+ d != null && d.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
734
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
735
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
736
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
737
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Lap Time" }),
738
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
739
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
740
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
741
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
742
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
743
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
744
+ /* @__PURE__ */ e("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__ */ e("tbody", { className: "pvx-tbody", children: d.map((u, y) => {
747
+ const C = u.isValid && u.lapTimeMs === p, R = f && u.isValid && u.sector1Ms === f.s1, q = f && u.isValid && u.sector2Ms === f.s2, S = f && u.isValid && u.sector3Ms === f.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: [
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);
749
+ return u.isValid || (A += " pvx-row--invalid"), C && (A += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: A, children: [
750
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: y + 1 }) }),
751
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: u.lapNumber || "-" }),
752
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: E(u.lapTimeMs) }),
753
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${R ? "pvx-td--best-sector" : ""}`, children: P(u.sector1Ms) }),
754
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${q ? "pvx-td--best-sector" : ""}`, children: P(u.sector2Ms) }),
755
+ /* @__PURE__ */ e("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__ */ e("td", { className: "pvx-td", title: u.isValid ? void 0 : u.invalidReason || "Invalid", children: u.isValid ? /* @__PURE__ */ e(Ze, {}) : /* @__PURE__ */ e(Xe, {}) }),
757
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: le(u.tyreCompound), children: u.tyreCompound || "-" }),
758
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.startingFuelL ? `${u.startingFuelL}L` : "-" }),
759
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: F(u.timestamp) })
760
+ ] }, u.id);
761
761
  }) })
762
- ] }) }) : /* @__PURE__ */ t(j, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
762
+ ] }) }) : /* @__PURE__ */ e(K, { 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,
768
- isLoading: g,
765
+ function _t({ className: t, defaultGame: r = "evo", title: n = "Leaderboards" }) {
766
+ const [a, s] = oe(), i = Ee(), c = Fe(), o = a.get("game") || r, m = a.get("version"), d = a.get("track"), g = a.get("car"), N = a.get("driver"), x = a.get("invalid") === "true", {
767
+ data: h,
768
+ isLoading: f,
769
769
  generatedAt: p,
770
770
  totalLaps: v,
771
- totalUsers: m,
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
+ } = Pe({ game: o }), C = y == null ? void 0 : y[o], R = m || (C == null ? void 0 : C.default) || null, q = k(() => !h || !R ? h || [] : h.filter((b) => b.gameVersion === R), [h, R]), 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: V(b, w, o) };
777
+ }, [d, o]), { data: A, isLoading: te } = ce(
778
+ S == null ? void 0 : S.id,
779
+ S == null ? void 0 : S.layout,
780
+ { carId: g, game: o, gameVersion: R }
781
781
  );
782
- function I(b) {
783
- a(b);
782
+ function B(b) {
783
+ s(b);
784
784
  }
785
- function be(b) {
786
- I({ game: b });
785
+ function Ce(b) {
786
+ B({ game: b });
787
787
  }
788
- function ye(b) {
788
+ function we(b) {
789
789
  const w = { game: o };
790
- b && b !== (C == null ? void 0 : C.default) && (w.version = b), I(w);
790
+ b && b !== (C == null ? void 0 : C.default) && (w.version = b), B(w);
791
791
  }
792
- function Ce(b, w) {
793
- const te = { game: o, track: w ? `${b}|${w}` : b };
794
- h && (te.version = h), I(te);
792
+ function ke(b, w) {
793
+ const ne = { game: o, track: w ? `${b}|${w}` : b };
794
+ m && (ne.version = m), B(ne);
795
795
  }
796
- function we(b) {
796
+ function Te(b) {
797
797
  const w = { game: o, track: d };
798
- h && (w.version = h), b && (w.car = b), I(w);
798
+ m && (w.version = m), b && (w.car = b), B(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 Se(b) {
801
+ const w = { game: o, track: d, car: g, driver: b };
802
+ m && (w.version = m), B(w);
803
803
  }
804
- function K(b) {
804
+ function O(b) {
805
805
  const w = { game: o };
806
- h && (w.version = h), (b === "track" || b === "car") && (w.track = d), b === "car" && (w.car = f), I(w);
806
+ m && (w.version = m), (b === "track" || b === "car") && (w.track = d), b === "car" && (w.car = g), B(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 Le() {
809
+ const b = { game: o, track: d, car: g, driver: N };
810
+ m && (b.version = m), x || (b.invalid = "true"), B(b);
811
811
  }
812
- const ke = () => T && f && N ? /* @__PURE__ */ t(
813
- et,
812
+ const $e = () => S && g && N ? /* @__PURE__ */ e(
813
+ nt,
814
814
  {
815
815
  userId: N,
816
- track: T,
817
- carId: f,
816
+ track: S,
817
+ carId: g,
818
818
  game: o,
819
- gameVersion: L,
819
+ gameVersion: R,
820
820
  showInvalid: x,
821
821
  getUserDisplay: i,
822
- onToggleInvalid: Se,
823
- onNavigate: K
822
+ onToggleInvalid: Le,
823
+ onNavigate: O
824
824
  }
825
- ) : T && f ? /* @__PURE__ */ t(
826
- Ye,
825
+ ) : S && g ? /* @__PURE__ */ e(
826
+ tt,
827
827
  {
828
828
  entries: A || [],
829
- isLoading: ee,
830
- track: T,
831
- carId: f,
829
+ isLoading: te,
830
+ track: S,
831
+ carId: g,
832
832
  getUserDisplay: i,
833
- onDriverSelect: Te,
834
- onNavigate: K
833
+ onDriverSelect: Se,
834
+ onNavigate: O
835
835
  }
836
- ) : T ? /* @__PURE__ */ t(
837
- Xe,
836
+ ) : S ? /* @__PURE__ */ e(
837
+ et,
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
- onCarSelect: we,
845
- onNavigate: K
844
+ onCarSelect: Te,
845
+ onNavigate: O
846
846
  }
847
- ) : /* @__PURE__ */ t(
848
- Ze,
847
+ ) : /* @__PURE__ */ e(
848
+ Ye,
849
849
  {
850
- tracks: _,
851
- isLoading: g,
852
- carMetadata: l,
850
+ tracks: q,
851
+ isLoading: f,
852
+ carMetadata: c,
853
853
  getUserDisplay: i,
854
- onTrackSelect: Ce
854
+ onTrackSelect: ke
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: [
857
+ return /* @__PURE__ */ l("div", { className: `pvx-leaderboard-explorer ${t || ""}`, children: [
858
+ /* @__PURE__ */ l("div", { className: "pvx-explorer-header", children: [
859
+ /* @__PURE__ */ e("h1", { className: "pvx-explorer-title", children: n }),
860
+ /* @__PURE__ */ l("div", { className: "pvx-explorer-stats", children: [
861
+ v > 0 && /* @__PURE__ */ l("span", { children: [
862
862
  v.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
+ v > 0 && u > 0 && /* @__PURE__ */ e("span", { className: "pvx-explorer-stats-sep", children: "|" }),
866
+ u > 0 && /* @__PURE__ */ l("span", { children: [
867
+ u.toLocaleString(),
868
868
  " drivers"
869
869
  ] })
870
870
  ] })
871
871
  ] }),
872
- /* @__PURE__ */ c("div", { className: "pvx-explorer-controls", children: [
873
- /* @__PURE__ */ t("div", { className: "pvx-game-tabs", children: ["evo", "acc"].map((b) => /* @__PURE__ */ t(
872
+ /* @__PURE__ */ l("div", { className: "pvx-explorer-controls", children: [
873
+ /* @__PURE__ */ e("div", { className: "pvx-game-tabs", children: ["evo", "acc"].map((b) => /* @__PURE__ */ e(
874
874
  "button",
875
875
  {
876
- onClick: () => be(b),
876
+ onClick: () => Ce(b),
877
877
  className: `pvx-game-tab ${o === b ? "pvx-game-tab--active" : ""}`,
878
878
  children: b === "evo" ? "AC EVO" : "ACC"
879
879
  },
880
880
  b
881
881
  )) }),
882
- C && /* @__PURE__ */ t(
882
+ C && /* @__PURE__ */ e(
883
883
  "select",
884
884
  {
885
- value: L || "",
886
- onChange: (b) => ye(b.target.value),
885
+ value: R || "",
886
+ onChange: (b) => we(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__ */ l("option", { value: b, children: [
889
889
  "v",
890
890
  b,
891
891
  b === C.default ? " (Latest)" : ""
@@ -893,14 +893,14 @@ 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
+ $e(),
897
+ p && /* @__PURE__ */ l("p", { className: "pvx-data-timestamp", children: [
898
898
  "Data updated: ",
899
899
  new Date(p).toLocaleString()
900
900
  ] })
901
901
  ] });
902
902
  }
903
- const tt = {
903
+ const rt = {
904
904
  GBR: "🇬🇧",
905
905
  DEU: "🇩🇪",
906
906
  NLD: "🇳🇱",
@@ -931,116 +931,116 @@ const tt = {
931
931
  RUS: "🇷🇺",
932
932
  TUR: "🇹🇷",
933
933
  KOR: "🇰🇷"
934
- }, nt = {
934
+ }, at = {
935
935
  championship: "Championship",
936
936
  series: "Series",
937
937
  event: "Event"
938
- }, ne = ["PRACTICE", "QUALIFYING", "RACE"];
939
- function xe({ position: e }) {
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
- }
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;
945
- }
946
- function rt({ sessions: e, activeSession: n, onSelect: r }) {
947
- if (!e || e.length <= 1) return null;
948
- const s = [...e].sort(
949
- (a, i) => ne.indexOf(a.type) - ne.indexOf(i.type)
938
+ }, re = ["PRACTICE", "QUALIFYING", "RACE"];
939
+ function fe({ position: t }) {
940
+ return /* @__PURE__ */ e("span", { className: t === 1 ? "pvx-rank pvx-rank--gold" : t === 2 ? "pvx-rank pvx-rank--silver" : t === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: t });
941
+ }
942
+ function Ne({ nation: t }) {
943
+ const r = t && rt[t];
944
+ return r ? /* @__PURE__ */ e("span", { className: "pvx-nation-flag", title: t, children: r }) : null;
945
+ }
946
+ function st({ sessions: t, activeSession: r, onSelect: n }) {
947
+ if (!t || t.length <= 1) return null;
948
+ const a = [...t].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__ */ e("div", { className: "pvx-session-tabs", children: a.map((s) => /* @__PURE__ */ e(
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
- function ge({ type: e }) {
962
- return /* @__PURE__ */ t("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: nt[e] || e });
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 });
966
- }
967
- function Ne(e) {
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;
961
+ function be({ type: t }) {
962
+ return /* @__PURE__ */ e("span", { className: `pvx-comp-badge pvx-comp-badge--${t}`, children: at[t] || t });
963
+ }
964
+ function U({ children: t, variant: r = "default" }) {
965
+ return /* @__PURE__ */ e("span", { className: `pvx-info-pill ${r !== "default" ? `pvx-info-pill--${r}` : ""}`, children: t });
966
+ }
967
+ function ye(t) {
968
+ if (!t) return "TBD";
969
+ const r = new Date(t);
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 it(t) {
975
+ return t.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..." }) {
984
- return /* @__PURE__ */ t("div", { className: "pvx-loading", children: e });
983
+ function _({ message: t = "Loading..." }) {
984
+ return /* @__PURE__ */ e("div", { className: "pvx-loading", children: t });
985
985
  }
986
- function M({ message: e = "No data available." }) {
987
- return /* @__PURE__ */ t("div", { className: "pvx-empty", children: /* @__PURE__ */ t("p", { children: e }) });
986
+ function M({ message: t = "No data available." }) {
987
+ return /* @__PURE__ */ e("div", { className: "pvx-empty", children: /* @__PURE__ */ e("p", { children: t }) });
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 ot({ competitions: t, isLoading: r, onSelect: n, className: a }) {
990
+ return r ? /* @__PURE__ */ e(_, { message: "Loading competitions..." }) : t != null && t.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${a || ""}`, children: t.map((s) => /* @__PURE__ */ e(lt, { comp: s, onSelect: n }, s.id)) }) : /* @__PURE__ */ e(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 lt({ comp: t, onSelect: r }) {
993
+ var f, p, v;
994
+ const { cdnUrl: n } = T(), a = t.posterCdnPath ? `${n}/${t.posterCdnPath}` : null, s = t.registration, i = (s == null ? void 0 : s.currentCount) || 0, c = s == null ? void 0 : s.maxParticipants, o = c && i >= c, m = (s == null ? void 0 : s.deadline) && new Date(s.deadline) < /* @__PURE__ */ new Date(), d = (s == null ? void 0 : s.isOpen) && !m && !o, g = /* @__PURE__ */ new Date(), N = (f = t.rounds) == null ? void 0 : f.find((u) => u.startTime && new Date(u.startTime) >= g), x = ((p = t.rounds) == null ? void 0 : p.length) || 0, h = ((v = t.rounds) == null ? void 0 : v.filter((u) => u.isFinalized).length) || 0;
995
+ return /* @__PURE__ */ l(
996
996
  "div",
997
997
  {
998
998
  className: "pvx-comp-card",
999
- onClick: () => n(e.id),
999
+ onClick: () => r(t.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(t.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: [
1008
- /* @__PURE__ */ t("h3", { className: "pvx-comp-card-title", children: e.name }),
1009
- e.description && /* @__PURE__ */ t("p", { className: "pvx-comp-card-desc", children: e.description }),
1010
- /* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
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))
1006
+ /* @__PURE__ */ e("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ e("img", { src: a, alt: t.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ e("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ e(ct, {}) }) }),
1007
+ /* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
1008
+ /* @__PURE__ */ e("h3", { className: "pvx-comp-card-title", children: t.name }),
1009
+ t.description && /* @__PURE__ */ e("p", { className: "pvx-comp-card-desc", children: t.description }),
1010
+ /* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
1011
+ /* @__PURE__ */ e(be, { type: t.type }),
1012
+ t.game && /* @__PURE__ */ e(U, { children: t.game.toUpperCase() }),
1013
+ t.formatDescription && t.formatDescription.split(", ").map((u, y) => /* @__PURE__ */ e(U, { 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: [
1018
- /* @__PURE__ */ t("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1015
+ t.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: t.carsDescription.split(", ").map((u, y) => /* @__PURE__ */ e(U, { children: u }, y)) }),
1016
+ /* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
1017
+ N ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1018
+ /* @__PURE__ */ e("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1019
1019
  " ",
1020
1020
  "R",
1021
1021
  N.roundNumber,
1022
1022
  " ",
1023
1023
  N.track || "TBD",
1024
1024
  " — ",
1025
- Ne(N.startTime)
1026
- ] }) : x > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
1027
- u,
1025
+ ye(N.startTime)
1026
+ ] }) : x > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1027
+ h,
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__ */ l("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__ */ l("div", { className: "pvx-comp-card-reg", children: [
1039
+ /* @__PURE__ */ e("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__ */ l("span", { className: "pvx-comp-reg-count", children: [
1041
1041
  i,
1042
1042
  "/",
1043
- l || "∞",
1043
+ c || "∞",
1044
1044
  " drivers"
1045
1045
  ] })
1046
1046
  ] })
@@ -1049,43 +1049,43 @@ 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: [
1054
- /* @__PURE__ */ t("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1055
- /* @__PURE__ */ t("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
1056
- /* @__PURE__ */ t("path", { d: "M4 22h16" }),
1057
- /* @__PURE__ */ t("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
1058
- /* @__PURE__ */ t("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
1059
- /* @__PURE__ */ t("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1052
+ function ct() {
1053
+ return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1054
+ /* @__PURE__ */ e("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1055
+ /* @__PURE__ */ e("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
1056
+ /* @__PURE__ */ e("path", { d: "M4 22h16" }),
1057
+ /* @__PURE__ */ e("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
1058
+ /* @__PURE__ */ e("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
1059
+ /* @__PURE__ */ e("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))
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: [
1072
- /* @__PURE__ */ t("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1073
- /* @__PURE__ */ c("span", { className: "pvx-standings-subtitle", children: [
1062
+ function dt({ competitionId: t, className: r }) {
1063
+ var o, m;
1064
+ const { data: n, isLoading: a } = qe(t), { data: s, isLoading: i } = de(t);
1065
+ if (a || i)
1066
+ return /* @__PURE__ */ e(_, { message: "Loading standings..." });
1067
+ if (!((o = n == null ? void 0 : n.standings) != null && o.length))
1068
+ return /* @__PURE__ */ e(M, { message: "No standings data yet. Results will appear once rounds are finalised." });
1069
+ const c = ((m = s == null ? void 0 : s.rounds) == null ? void 0 : m.filter((d) => d.isFinalized)) || [];
1070
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
1071
+ /* @__PURE__ */ e("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
1072
+ /* @__PURE__ */ e("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1073
+ /* @__PURE__ */ l("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: [
1083
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1084
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1085
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1086
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1087
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1088
- l.map((d) => /* @__PURE__ */ c(
1081
+ /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1082
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1083
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1084
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Driver" }),
1085
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1086
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1087
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1088
+ c.map((d) => /* @__PURE__ */ l(
1089
1089
  "th",
1090
1090
  {
1091
1091
  className: "pvx-th pvx-th--center pvx-hidden-below-md",
@@ -1098,417 +1098,627 @@ 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(
1102
- ct,
1101
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: n.standings.map((d) => /* @__PURE__ */ e(
1102
+ pt,
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: [
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: [
1120
- /* @__PURE__ */ t(fe, { nation: e.nation }),
1121
- e.driverName
1112
+ function pt({ driver: t, finalizedRounds: r }) {
1113
+ var c, o, m;
1114
+ const n = t.position <= 3, a = new Map(
1115
+ ((c = t.roundResults) == null ? void 0 : c.map((d) => [d.roundNumber, d])) || []
1116
+ ), s = ((o = t.roundResults) == null ? void 0 : o.filter((d) => d.position === 1).length) || 0, i = ((m = t.roundResults) == null ? void 0 : m.filter((d) => d.position <= 3).length) || 0;
1117
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${n ? "pvx-row--podium" : ""}`, children: [
1118
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(fe, { position: t.position }) }),
1119
+ /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1120
+ /* @__PURE__ */ e(Ne, { nation: t.nation }),
1121
+ t.driverName
1122
1122
  ] }),
1123
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1124
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
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;
1128
- return /* @__PURE__ */ t(
1123
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: s || "-" }),
1124
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1125
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: t.totalPoints }),
1126
+ r.map((d) => {
1127
+ const g = a.get(d.roundNumber), N = g == null ? void 0 : g.dropped;
1128
+ return /* @__PURE__ */ e(
1129
1129
  "td",
1130
1130
  {
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: [
1131
+ className: `pvx-td pvx-td--center pvx-hidden-below-md ${!N && (g == null ? void 0 : g.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
1132
+ children: g ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${N ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1133
+ /* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
1134
1134
  "P",
1135
- f.position
1135
+ g.position
1136
1136
  ] }),
1137
- /* @__PURE__ */ t("span", { className: "pvx-standings-round-pts", children: f.points })
1138
- ] }) : /* @__PURE__ */ t("span", { className: "pvx-td--muted", children: "-" })
1137
+ /* @__PURE__ */ e("span", { className: "pvx-standings-round-pts", children: g.points })
1138
+ ] }) : /* @__PURE__ */ e("span", { className: "pvx-td--muted", children: "-" })
1139
1139
  },
1140
1140
  d.roundNumber
1141
1141
  );
1142
1142
  })
1143
1143
  ] });
1144
1144
  }
1145
- function dt({ competitionId: e, roundNumber: n, className: r }) {
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)
1151
- return /* @__PURE__ */ t(M, { message: "No results for this round." });
1152
- const o = s.sessions || [];
1145
+ function ut({ competitionId: t, roundNumber: r, className: n }) {
1146
+ var g, N;
1147
+ const { data: a, isLoading: s } = je(t, r), [i, c] = j(null);
1148
+ if (s)
1149
+ return /* @__PURE__ */ e(_, { message: "Loading results..." });
1150
+ if (!a)
1151
+ return /* @__PURE__ */ e(M, { message: "No results for this round." });
1152
+ const o = a.sessions || [];
1153
1153
  if (!o.length)
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: [
1154
+ return /* @__PURE__ */ e(M, { message: "No session data for this round." });
1155
+ const m = i || ((g = o.find((x) => x.type === "RACE")) == null ? void 0 : g.type) || ((N = o[0]) == null ? void 0 : N.type), d = o.find((x) => x.type === m) || o[0];
1156
+ return /* @__PURE__ */ l("div", { className: `pvx-round-results ${n || ""}`, children: [
1157
+ /* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
1158
+ /* @__PURE__ */ l("div", { children: [
1159
+ /* @__PURE__ */ l("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__ */ e("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__ */ e(mt, { sessions: o })
1171
1171
  ] }),
1172
- /* @__PURE__ */ t(
1173
- rt,
1172
+ /* @__PURE__ */ e(
1173
+ st,
1174
1174
  {
1175
1175
  sessions: o,
1176
- activeSession: h,
1177
- onSelect: l
1176
+ activeSession: m,
1177
+ onSelect: c
1178
1178
  }
1179
1179
  ),
1180
- /* @__PURE__ */ t(mt, { session: d })
1180
+ /* @__PURE__ */ e(ht, { session: d })
1181
1181
  ] });
1182
1182
  }
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] }),
1190
- /* @__PURE__ */ t("span", { children: i.driverName })
1183
+ function mt({ sessions: t }) {
1184
+ var s;
1185
+ const r = t.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__ */ e("div", { className: "pvx-round-podium-summary", children: n.map((i) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1189
+ /* @__PURE__ */ e("span", { children: a[i.position - 1] }),
1190
+ /* @__PURE__ */ e("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))
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: [
1201
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1202
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1203
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1204
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Best Lap" }),
1205
- n && /* @__PURE__ */ c(z, { children: [
1206
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1207
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1208
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" })
1193
+ function ht({ session: t }) {
1194
+ var a;
1195
+ const r = t.type === "RACE";
1196
+ if (!((a = t.results) != null && a.length))
1197
+ return /* @__PURE__ */ e(M, { message: `No results for ${t.type}.` });
1198
+ const n = it(t.results);
1199
+ return /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1200
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1201
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1202
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Driver" }),
1203
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1204
+ /* @__PURE__ */ e("th", { className: "pvx-th", children: "Best Lap" }),
1205
+ r && /* @__PURE__ */ l(Q, { children: [
1206
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1207
+ /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1208
+ /* @__PURE__ */ e("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__ */ e("tbody", { className: "pvx-tbody", children: t.results.map((s, i) => /* @__PURE__ */ e(
1212
+ vt,
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: [
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: [
1228
- /* @__PURE__ */ t(fe, { nation: e.nation }),
1229
- e.driverName,
1230
- e.carNumber != null && /* @__PURE__ */ c("span", { className: "pvx-car-number", children: [
1223
+ function vt({ result: t, isRace: r, fastestSplits: n, rowIndex: a }) {
1224
+ const s = t.position <= 3;
1225
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
1226
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(fe, { position: t.position }) }),
1227
+ /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1228
+ /* @__PURE__ */ e(Ne, { nation: t.nation }),
1229
+ t.driverName,
1230
+ t.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
1231
1231
  "#",
1232
- e.carNumber
1232
+ t.carNumber
1233
1233
  ] }),
1234
- e.penalty && /* @__PURE__ */ t("span", { className: "pvx-penalty", children: e.penalty })
1234
+ t.penalty && /* @__PURE__ */ e("span", { className: "pvx-penalty", children: t.penalty })
1235
1235
  ] }),
1236
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: B(e.carId) }),
1237
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ t(
1238
- vt,
1236
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-sm", children: I(t.carId) }),
1237
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ e(
1238
+ xt,
1239
1239
  {
1240
- bestLap: e.bestLapFormatted,
1241
- hasBestLap: e.hasBestLap,
1242
- splits: e.splits,
1243
- fastestSplits: r,
1244
- showAbove: s <= 1
1240
+ bestLap: t.bestLapFormatted,
1241
+ hasBestLap: t.hasBestLap,
1242
+ splits: t.splits,
1243
+ fastestSplits: n,
1244
+ showAbove: a <= 1
1245
1245
  }
1246
1246
  ) }),
1247
- n && /* @__PURE__ */ c(z, { children: [
1248
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
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: [
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: [
1247
+ r && /* @__PURE__ */ l(Q, { children: [
1248
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-sm", children: t.lapsCompleted }),
1249
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: t.position === 1 ? t.totalTime || "-" : t.gap || "-" }),
1250
+ /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
1251
+ /* @__PURE__ */ e("span", { className: "pvx-session-points", children: t.points }),
1252
+ t.pointsOverride !== 0 && t.pointsOverride && /* @__PURE__ */ l("span", { className: "pvx-points-override", children: [
1253
1253
  "(",
1254
- e.pointsOverride > 0 ? "+" : "",
1255
- e.pointsOverride,
1254
+ t.pointsOverride > 0 ? "+" : "",
1255
+ t.pointsOverride,
1256
1256
  ")"
1257
1257
  ] })
1258
1258
  ] })
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: [
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: [
1262
+ function xt({ bestLap: t, hasBestLap: r, splits: n, fastestSplits: a, showAbove: s }) {
1263
+ return t ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${r ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1264
+ /* @__PURE__ */ e("span", { className: "pvx-best-lap-time", children: t }),
1265
+ (n == null ? void 0 : n.length) > 0 && /* @__PURE__ */ e("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ e("span", { className: `pvx-splits-tooltip ${s ? "" : "pvx-splits-tooltip--above"}`, children: n.map((i, c) => {
1266
+ const o = a && i === a[c];
1267
+ return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
1268
+ /* @__PURE__ */ l("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__ */ e("span", { className: o ? "pvx-splits-tooltip-best" : "", children: i })
1273
+ ] }, c);
1274
1274
  }) }) })
1275
- ] }) : /* @__PURE__ */ t("span", { className: "pvx-td--muted", children: "-" });
1275
+ ] }) : /* @__PURE__ */ e("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: [
1285
- i.avatarUrl ? /* @__PURE__ */ t(
1277
+ function gt({ competitionId: t, className: r }) {
1278
+ const { data: n, isLoading: a } = Ve(t);
1279
+ if (a)
1280
+ return /* @__PURE__ */ e(_, { message: "Loading drivers..." });
1281
+ const s = (n == null ? void 0 : n.drivers) || (n == null ? void 0 : n.entries) || [];
1282
+ return s.length ? /* @__PURE__ */ e("div", { className: `pvx-entry-grid ${r || ""}`, children: s.map((i) => {
1283
+ var c, o;
1284
+ return /* @__PURE__ */ l("div", { className: "pvx-entry-card", children: [
1285
+ i.avatarUrl ? /* @__PURE__ */ e(
1286
1286
  "img",
1287
1287
  {
1288
1288
  src: i.avatarUrl,
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()) || "?" }),
1293
- /* @__PURE__ */ t("span", { className: "pvx-entry-name", children: i.displayName })
1292
+ ) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((o = (c = i.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1293
+ /* @__PURE__ */ e("span", { className: "pvx-entry-name", children: i.displayName })
1294
1294
  ] }, i.steamId || i.driverId);
1295
- }) }) : /* @__PURE__ */ t(M, { message: "No drivers registered yet." });
1295
+ }) }) : /* @__PURE__ */ e(M, { message: "No drivers registered yet." });
1296
1296
  }
1297
- const xt = [
1297
+ const ft = [
1298
1298
  { id: "standings", label: "Standings" },
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();
1304
- function d(g) {
1305
- s({ competition: g });
1302
+ function qt({ className: t, title: r = "Competitions" }) {
1303
+ const [n, a] = oe(), s = n.get("competition"), i = n.get("tab") || "standings", c = n.get("round") ? Number(n.get("round")) : null, { data: o, isLoading: m } = _e();
1304
+ function d(f) {
1305
+ a({ competition: f });
1306
1306
  }
1307
- function f() {
1308
- s({});
1307
+ function g() {
1308
+ a({});
1309
1309
  }
1310
- function N(g) {
1311
- s({ competition: a, tab: g });
1310
+ function N(f) {
1311
+ a({ competition: s, tab: f });
1312
1312
  }
1313
- function x(g) {
1314
- s({ competition: a, tab: "rounds", round: String(g) });
1313
+ function x(f) {
1314
+ a({ competition: s, tab: "rounds", round: String(f) });
1315
1315
  }
1316
- function u() {
1317
- s({ competition: a, tab: "rounds" });
1316
+ function h() {
1317
+ a({ competition: s, tab: "rounds" });
1318
1318
  }
1319
- return a ? /* @__PURE__ */ t("div", { className: `pvx-comp-explorer ${e || ""}`, children: /* @__PURE__ */ t(
1320
- ft,
1319
+ return s ? /* @__PURE__ */ e("div", { className: `pvx-comp-explorer ${t || ""}`, children: /* @__PURE__ */ e(
1320
+ Nt,
1321
1321
  {
1322
- competitionId: a,
1322
+ competitionId: s,
1323
1323
  activeTab: i,
1324
- selectedRound: l,
1325
- onBack: f,
1324
+ selectedRound: c,
1325
+ onBack: g,
1326
1326
  onTabChange: N,
1327
1327
  onSelectRound: x,
1328
- onDeselectRound: u
1328
+ onDeselectRound: h
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: [
1330
+ ) }) : /* @__PURE__ */ l("div", { className: `pvx-comp-explorer ${t || ""}`, children: [
1331
+ /* @__PURE__ */ l("div", { className: "pvx-explorer-header", children: [
1332
+ /* @__PURE__ */ e("h2", { className: "pvx-explorer-title", children: r }),
1333
+ !m && (o == null ? void 0 : o.length) > 0 && /* @__PURE__ */ e("div", { className: "pvx-explorer-stats", children: /* @__PURE__ */ l("span", { children: [
1334
1334
  o.length,
1335
1335
  " competition",
1336
1336
  o.length !== 1 ? "s" : ""
1337
1337
  ] }) })
1338
1338
  ] }),
1339
- /* @__PURE__ */ t(
1340
- at,
1339
+ /* @__PURE__ */ e(
1340
+ ot,
1341
1341
  {
1342
1342
  competitions: o,
1343
- isLoading: h,
1343
+ isLoading: m,
1344
1344
  onSelect: d
1345
1345
  }
1346
1346
  )
1347
1347
  ] });
1348
1348
  }
1349
- function ft({
1350
- competitionId: e,
1351
- activeTab: n,
1352
- selectedRound: r,
1353
- onBack: s,
1354
- onTabChange: a,
1349
+ function Nt({
1350
+ competitionId: t,
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
- var g, p;
1359
- const { data: o, isLoading: h } = le(e);
1360
- if (h)
1361
- return /* @__PURE__ */ t(F, { message: "Loading competition..." });
1358
+ var f, p;
1359
+ const { data: o, isLoading: m } = de(t);
1360
+ if (m)
1361
+ return /* @__PURE__ */ e(_, { message: "Loading competition..." });
1362
1362
  if (!o)
1363
- return /* @__PURE__ */ c("div", { children: [
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" }) })
1363
+ return /* @__PURE__ */ l("div", { children: [
1364
+ /* @__PURE__ */ e(M, { message: "Competition not found." }),
1365
+ /* @__PURE__ */ e("div", { className: "pvx-comp-back-link-wrap", children: /* @__PURE__ */ e("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 = o.type === "championship", g = ((f = o.rounds) == null ? void 0 : f.filter((v) => v.isFinalized)) || [], N = o.rounds || [], x = ft.filter((v) => !(v.id === "standings" && !d || v.id === "rounds" && g.length === 0)), h = x.find((v) => v.id === r) ? r : ((p = x[0]) == null ? void 0 : p.id) || "standings";
1368
+ return /* @__PURE__ */ l(Q, { children: [
1369
+ /* @__PURE__ */ e("button", { onClick: a, className: "pvx-comp-back-link", children: "← Competitions" }),
1370
+ /* @__PURE__ */ l("div", { className: "pvx-comp-detail-header", children: [
1371
+ /* @__PURE__ */ e("h2", { className: "pvx-explorer-title", children: o.name }),
1372
+ o.description && /* @__PURE__ */ e("p", { className: "pvx-comp-detail-desc", children: o.description }),
1373
+ /* @__PURE__ */ l("div", { className: "pvx-comp-detail-meta", children: [
1374
+ /* @__PURE__ */ e(be, { type: o.type }),
1375
+ o.game && /* @__PURE__ */ e(U, { children: o.game.toUpperCase() }),
1376
+ o.countingRounds > 0 && /* @__PURE__ */ l(U, { variant: "format", children: [
1377
1377
  "Best ",
1378
1378
  o.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__ */ l(U, { children: [
1384
1384
  N.length,
1385
1385
  " round",
1386
1386
  N.length !== 1 ? "s" : ""
1387
1387
  ] })
1388
1388
  ] })
1389
1389
  ] }),
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(
1390
+ N.length > 0 && /* @__PURE__ */ e(bt, { rounds: N }),
1391
+ x.length > 1 && /* @__PURE__ */ e("div", { className: "pvx-comp-tabs", children: x.map((v) => /* @__PURE__ */ e(
1392
1392
  "button",
1393
1393
  {
1394
- onClick: () => a(v.id),
1395
- className: `pvx-comp-tab ${u === v.id ? "pvx-comp-tab--active" : ""}`,
1394
+ onClick: () => s(v.id),
1395
+ className: `pvx-comp-tab ${h === v.id ? "pvx-comp-tab--active" : ""}`,
1396
1396
  children: v.label
1397
1397
  },
1398
1398
  v.id
1399
1399
  )) }),
1400
- u === "standings" && /* @__PURE__ */ t(lt, { competitionId: e }),
1401
- u === "rounds" && /* @__PURE__ */ t(
1402
- Nt,
1400
+ h === "standings" && /* @__PURE__ */ e(dt, { competitionId: t }),
1401
+ h === "rounds" && /* @__PURE__ */ e(
1402
+ yt,
1403
1403
  {
1404
- competitionId: e,
1405
- finalizedRounds: f,
1406
- selectedRound: r,
1404
+ competitionId: t,
1405
+ finalizedRounds: g,
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
+ h === "drivers" && /* @__PURE__ */ e(gt, { competitionId: t })
1412
1412
  ] });
1413
1413
  }
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(
1414
+ function bt({ rounds: t }) {
1415
+ const r = /* @__PURE__ */ new Date(), n = t.find((a) => a.startTime && new Date(a.startTime) >= r);
1416
+ return /* @__PURE__ */ e("div", { className: "pvx-comp-schedule", children: /* @__PURE__ */ e("div", { className: "pvx-comp-schedule-list", children: t.map((a) => {
1417
+ const s = a === n, i = a.startTime && new Date(a.startTime) < r;
1418
+ return /* @__PURE__ */ l(
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__ */ l("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__ */ e("span", { className: "pvx-comp-schedule-track", children: a.track || "TBD" }),
1428
+ /* @__PURE__ */ e("span", { className: "pvx-comp-schedule-date", children: ye(a.startTime) }),
1429
+ a.isFinalized && /* @__PURE__ */ e("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 yt({ competitionId: t, finalizedRounds: r, selectedRound: n, onSelectRound: a, onDeselectRound: s }) {
1437
+ return r.length ? /* @__PURE__ */ l("div", { className: "pvx-comp-rounds", children: [
1438
+ /* @__PURE__ */ e("div", { className: "pvx-comp-round-pills", children: r.map((i) => /* @__PURE__ */ l(
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__ */ l("span", { className: "pvx-comp-round-pill-num", children: [
1445
1445
  "R",
1446
1446
  i.roundNumber
1447
1447
  ] }),
1448
- i.track && /* @__PURE__ */ t("span", { className: "pvx-comp-round-pill-track", children: i.track })
1448
+ i.track && /* @__PURE__ */ e("span", { className: "pvx-comp-round-pill-track", children: i.track })
1449
1449
  ]
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." }) })
1454
- ] }) : /* @__PURE__ */ t(M, { message: "No finalised rounds yet." });
1455
- }
1456
- function Mt({
1457
- competitionId: e,
1458
- driverData: n,
1459
- className: r,
1460
- children: s
1453
+ n ? /* @__PURE__ */ e(ut, { competitionId: t, roundNumber: n }) : /* @__PURE__ */ e("div", { className: "pvx-empty", children: /* @__PURE__ */ e("p", { children: "Select a round to view results." }) })
1454
+ ] }) : /* @__PURE__ */ e(M, { message: "No finalised rounds yet." });
1455
+ }
1456
+ function jt({
1457
+ competitionId: t,
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 } = Oe(t), c = We(t), o = Ge(t), m = (s == null ? void 0 : s.isRegistered) || !1, d = i || c.isPending || o.isPending, g = c.error || o.error || null, N = () => {
1463
+ r && c.mutate(r);
1464
1464
  }, x = () => {
1465
1465
  o.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: m, isLoading: d, register: N, withdraw: x, error: g }) : /* @__PURE__ */ e(
1468
1468
  "button",
1469
1469
  {
1470
- className: r,
1471
- onClick: h ? x : N,
1470
+ className: n,
1471
+ onClick: m ? x : N,
1472
1472
  disabled: d,
1473
- children: d ? "Loading..." : h ? "Withdraw" : "Register"
1473
+ children: d ? "Loading..." : m ? "Withdraw" : "Register"
1474
1474
  }
1475
1475
  );
1476
1476
  }
1477
+ function Ct(t) {
1478
+ const { cdnUrl: r, partnerSlug: n } = T(), a = L({
1479
+ queryKey: ["pitvox", "laps", n, t],
1480
+ queryFn: () => $(r, `laps/partners/${n}/${t}.json`),
1481
+ enabled: !!t,
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 wt(t) {
1504
+ var i;
1505
+ const { cdnUrl: r, partnerSlug: n } = T(), a = L({
1506
+ queryKey: ["pitvox", "ratings", n],
1507
+ queryFn: () => $(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) || !t ? null : a.data.drivers.find(
1513
+ (o) => o.identifier === t
1514
+ ) || null;
1515
+ }, [(i = a.data) == null ? void 0 : i.drivers, t]);
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 kt({ driverName: t, avatarUrl: r, memberSince: n, className: a = "" }) {
1530
+ const s = n ? new Date(n).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
1531
+ return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${a}`, children: [
1532
+ r ? /* @__PURE__ */ e("img", { src: r, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (t || "?")[0].toUpperCase() }),
1533
+ /* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
1534
+ /* @__PURE__ */ e("h2", { className: "pvx-dash-profile-name", children: t }),
1535
+ s && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
1536
+ "Racing since ",
1537
+ s
1538
+ ] })
1539
+ ] })
1540
+ ] });
1541
+ }
1542
+ function Tt() {
1543
+ return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1544
+ /* @__PURE__ */ e("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
1545
+ /* @__PURE__ */ e("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
1546
+ /* @__PURE__ */ e("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
1547
+ /* @__PURE__ */ e("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
1548
+ ] });
1549
+ }
1550
+ function St() {
1551
+ return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1552
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
1553
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "2" }),
1554
+ /* @__PURE__ */ e("path", { d: "M12 14v4" }),
1555
+ /* @__PURE__ */ e("path", { d: "M10.5 12.5l-4 2.5" }),
1556
+ /* @__PURE__ */ e("path", { d: "M13.5 12.5l4 2.5" })
1557
+ ] });
1558
+ }
1559
+ function Lt() {
1560
+ return /* @__PURE__ */ e("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
1561
+ }
1562
+ function ae({ items: t, labelKey: r, countKey: n }) {
1563
+ if (!(t != null && t.length)) return null;
1564
+ const a = t.slice().sort((s, i) => i[n] - s[n]).slice(0, 10);
1565
+ return /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip", children: [
1566
+ a.map((s, i) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
1567
+ /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: s[r] }),
1568
+ /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: s[n] })
1569
+ ] }, i)),
1570
+ t.length > 10 && /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row pvx-dash-tooltip-more", children: [
1571
+ "+",
1572
+ t.length - 10,
1573
+ " more"
1574
+ ] })
1575
+ ] });
1576
+ }
1577
+ function $t({ stats: t, rating: r, className: n = "" }) {
1578
+ if (!t) return null;
1579
+ const a = t.trackBreakdown.map((i) => ({
1580
+ name: V(i.trackId, i.layout),
1581
+ lapCount: i.lapCount
1582
+ })), s = t.carBreakdown.map((i) => ({
1583
+ name: I(i.carId),
1584
+ lapCount: i.lapCount
1585
+ }));
1586
+ return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${n}`, children: [
1587
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--has-tooltip", children: [
1588
+ /* @__PURE__ */ e(Tt, {}),
1589
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
1590
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: t.lapCount.toLocaleString() }),
1591
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: "Total Laps" })
1592
+ ] }),
1593
+ /* @__PURE__ */ e(ae, { items: a, labelKey: "name", countKey: "lapCount" })
1594
+ ] }),
1595
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--has-tooltip", children: [
1596
+ /* @__PURE__ */ e(St, {}),
1597
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
1598
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: t.carBreakdown.length }),
1599
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: "Cars Used" })
1600
+ ] }),
1601
+ /* @__PURE__ */ e(ae, { items: s, labelKey: "name", countKey: "lapCount" })
1602
+ ] }),
1603
+ r && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
1604
+ /* @__PURE__ */ e(Lt, {}),
1605
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
1606
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: r.rating.toFixed(1) }),
1607
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
1608
+ /* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
1609
+ "#",
1610
+ r.rank,
1611
+ " of ",
1612
+ r.totalDrivers
1613
+ ] })
1614
+ ] })
1615
+ ] })
1616
+ ] });
1617
+ }
1618
+ const se = 10;
1619
+ function Rt({ records: t, className: r = "" }) {
1620
+ const [n, a] = j(!1), s = k(() => t != null && t.length ? t.slice().sort((o, m) => {
1621
+ const d = o.recordedAt ? new Date(o.recordedAt).getTime() : 0;
1622
+ return (m.recordedAt ? new Date(m.recordedAt).getTime() : 0) - d;
1623
+ }) : [], [t]);
1624
+ if (!s.length) return null;
1625
+ const i = n ? s : s.slice(0, se), c = s.length > se;
1626
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
1627
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
1628
+ /* @__PURE__ */ e("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1629
+ /* @__PURE__ */ e("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
1630
+ /* @__PURE__ */ e("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
1631
+ /* @__PURE__ */ e("path", { d: "M4 22h16" }),
1632
+ /* @__PURE__ */ e("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
1633
+ /* @__PURE__ */ e("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
1634
+ /* @__PURE__ */ e("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
1635
+ ] }) }),
1636
+ "Current Records",
1637
+ /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
1638
+ "(",
1639
+ s.length,
1640
+ ")"
1641
+ ] })
1642
+ ] }) }),
1643
+ /* @__PURE__ */ e("div", { className: "pvx-dash-records-list", children: i.map((o, m) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
1644
+ /* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
1645
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-track", children: V(o.trackId, o.layout, o.game) }),
1646
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-car", children: I(o.carId) })
1647
+ ] }),
1648
+ /* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
1649
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-lap", children: E(o.lapTimeMs) }),
1650
+ /* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${o.game || "evo"}`, children: [
1651
+ (o.game || "evo").toUpperCase(),
1652
+ o.gameVersion ? ` ${o.gameVersion}` : ""
1653
+ ] })
1654
+ ] })
1655
+ ] }, m)) }),
1656
+ c && /* @__PURE__ */ e(
1657
+ "button",
1658
+ {
1659
+ className: "pvx-dash-records-toggle",
1660
+ onClick: () => a(!n),
1661
+ children: n ? "Show less" : `Show all ${s.length} records`
1662
+ }
1663
+ )
1664
+ ] });
1665
+ }
1666
+ function Vt({ steamId: t, avatarUrl: r, memberSince: n, className: a = "" }) {
1667
+ const { data: s, isLoading: i, error: c } = Ct(t), { data: o, isLoading: m } = wt(t);
1668
+ return i || m ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ e("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : s ? /* @__PURE__ */ l("div", { className: `pvx-dash ${a}`, children: [
1669
+ /* @__PURE__ */ e(
1670
+ kt,
1671
+ {
1672
+ driverName: s.driverName,
1673
+ avatarUrl: r,
1674
+ memberSince: n
1675
+ }
1676
+ ),
1677
+ /* @__PURE__ */ e($t, { stats: s, rating: o }),
1678
+ /* @__PURE__ */ e(Rt, { records: s.currentRecords })
1679
+ ] }) : /* @__PURE__ */ e("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
1680
+ }
1477
1681
  export {
1478
- Xe as CarsTable,
1479
- at as CompetitionCards,
1480
- Dt as CompetitionExplorer,
1481
- Ye as DriversTable,
1482
- ht as EntryList,
1483
- et as LapHistoryTable,
1484
- Rt as LeaderboardExplorer,
1485
- Tt as PitVoxPartnerProvider,
1486
- Mt as RegisterButton,
1487
- dt as RoundResults,
1488
- lt as StandingsTable,
1489
- Ze as TracksTable,
1490
- B as formatCarName,
1491
- U as formatDate,
1492
- kt as formatDelta,
1493
- q as formatLapTime,
1494
- St as formatRelativeTime,
1682
+ et as CarsTable,
1683
+ ot as CompetitionCards,
1684
+ qt as CompetitionExplorer,
1685
+ Vt as DriverDashboard,
1686
+ kt as DriverProfile,
1687
+ tt as DriversTable,
1688
+ gt as EntryList,
1689
+ nt as LapHistoryTable,
1690
+ _t as LeaderboardExplorer,
1691
+ At as PitVoxPartnerProvider,
1692
+ Rt as RecordsTable,
1693
+ jt as RegisterButton,
1694
+ ut as RoundResults,
1695
+ dt as StandingsTable,
1696
+ $t as StatsCards,
1697
+ Ye as TracksTable,
1698
+ I as formatCarName,
1699
+ F as formatDate,
1700
+ Ut as formatDelta,
1701
+ E as formatLapTime,
1702
+ Pt as formatRelativeTime,
1495
1703
  P as formatSectorTime,
1496
- ae as formatTrackName,
1497
- 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,
1505
- Ue as useCompetitions,
1506
- Ae as useDriverLaps,
1507
- Be as useLeaderboardIndex,
1508
- k as usePitVox,
1509
- Oe as useRegister,
1510
- Ke as useRegistrationStatus,
1511
- oe as useTrackLeaderboard,
1512
- Pe as useUserLookup,
1513
- He as useWithdraw
1704
+ V as formatTrackName,
1705
+ le as formatTyreCompound,
1706
+ Et as useCarLeaderboard,
1707
+ Fe as useCarMetadata,
1708
+ Ft as useCompetitionAllRounds,
1709
+ de as useCompetitionConfig,
1710
+ Ve as useCompetitionEntryList,
1711
+ je as useCompetitionRound,
1712
+ qe as useCompetitionStandings,
1713
+ _e as useCompetitions,
1714
+ Ue as useDriverLaps,
1715
+ wt as useDriverRating,
1716
+ Ct as useDriverStats,
1717
+ Pe as useLeaderboardIndex,
1718
+ T as usePitVox,
1719
+ We as useRegister,
1720
+ Oe as useRegistrationStatus,
1721
+ ce as useTrackLeaderboard,
1722
+ Ee as useUserLookup,
1723
+ Ge as useWithdraw
1514
1724
  };