@pitvox/partner-react 0.2.0 → 0.3.0

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