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