@pitvox/partner-react 0.6.0 → 0.6.2

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,44 +1,44 @@
1
- import { jsx as e, jsxs as l, Fragment as A } from "react/jsx-runtime";
2
- import { createContext as we, useMemo as w, useContext as Ce, useState as M, useCallback as K, useRef as Le, useEffect as Re } from "react";
3
- import { useQueryClient as U, QueryClient as Te, QueryClientProvider as Se, useQuery as C, useMutation as H, useQueries as te } from "@tanstack/react-query";
1
+ import { jsx as e, jsxs as l, Fragment as U } from "react/jsx-runtime";
2
+ import { createContext as we, useMemo as L, useContext as Ce, useState as M, useCallback as K, useRef as Le, useEffect as Re } from "react";
3
+ import { useQueryClient as E, QueryClient as Te, QueryClientProvider as Se, useQuery as R, useMutation as H, useQueries as se } from "@tanstack/react-query";
4
4
  const Y = we(null), $e = "https://cdn.pitvox.com", Me = "https://pitvox.com";
5
5
  let z = null;
6
6
  function Ur({
7
7
  partnerSlug: r = null,
8
- cdnUrl: n = $e,
8
+ cdnUrl: t = $e,
9
9
  pitvoxUrl: s = Me,
10
- getSteamId: t,
10
+ getSteamId: n,
11
11
  onRegister: a,
12
12
  onWithdraw: i,
13
13
  onFetchNotifications: o,
14
14
  onMarkNotificationRead: d,
15
- onMarkAllNotificationsRead: u,
15
+ onMarkAllNotificationsRead: m,
16
16
  onFetchServerPassword: c,
17
- children: v
17
+ children: h
18
18
  }) {
19
- const x = w(() => ({
19
+ const x = L(() => ({
20
20
  partnerSlug: r,
21
- cdnUrl: n.replace(/\/$/, ""),
21
+ cdnUrl: t.replace(/\/$/, ""),
22
22
  pitvoxUrl: s.replace(/\/$/, ""),
23
- getSteamId: t || (() => null),
23
+ getSteamId: n || (() => null),
24
24
  onRegister: a || null,
25
25
  onWithdraw: i || null,
26
26
  onFetchNotifications: o || null,
27
27
  onMarkNotificationRead: d || null,
28
- onMarkAllNotificationsRead: u || null,
28
+ onMarkAllNotificationsRead: m || null,
29
29
  onFetchServerPassword: c || null
30
- }), [r, n, s, t, a, i, o, d, u, c]);
31
- let N = !1;
30
+ }), [r, t, s, n, a, i, o, d, m, c]);
31
+ let f = !1;
32
32
  try {
33
- U(), N = !0;
33
+ E(), f = !0;
34
34
  } catch {
35
- N = !1;
35
+ f = !1;
36
36
  }
37
- return N ? /* @__PURE__ */ e(Y.Provider, { value: x, children: v }) : (z || (z = new Te({
37
+ return f ? /* @__PURE__ */ e(Y.Provider, { value: x, children: h }) : (z || (z = new Te({
38
38
  defaultOptions: {
39
39
  queries: { staleTime: 6e4 }
40
40
  }
41
- })), /* @__PURE__ */ e(Se, { client: z, children: /* @__PURE__ */ e(Y.Provider, { value: x, children: v }) }));
41
+ })), /* @__PURE__ */ e(Se, { client: z, children: /* @__PURE__ */ e(Y.Provider, { value: x, children: h }) }));
42
42
  }
43
43
  function k() {
44
44
  const r = Ce(Y);
@@ -46,43 +46,44 @@ function k() {
46
46
  throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
47
47
  return r;
48
48
  }
49
- async function R(r, n) {
50
- const s = await fetch(`${r}/${n}`);
49
+ async function T(r, t) {
50
+ const s = await fetch(`${r}/${t}`);
51
51
  if (!s.ok) {
52
52
  if (s.status === 404 || s.status === 403) return null;
53
53
  throw new Error(`CDN fetch failed: ${s.status}`);
54
54
  }
55
55
  return s.json();
56
56
  }
57
- function J(r, ...n) {
58
- return [r ? `leaderboards/partners/${r}` : "leaderboards", ...n].join("/");
57
+ function J(r, ...t) {
58
+ return [r ? `leaderboards/partners/${r}` : "leaderboards", ...t].join("/");
59
59
  }
60
- function Ie(r, n) {
61
- return r ? `laps/partners/${r}/${n}.json` : `laps/${n}.json`;
60
+ function Ie(r, t) {
61
+ return r ? `laps/partners/${r}/${t}.json` : `laps/${t}.json`;
62
62
  }
63
63
  function De(r) {
64
64
  return r ? `recent-laps/partners/${r}.json` : "recent-laps.json";
65
65
  }
66
66
  function B(r) {
67
67
  if (!r && r !== 0) return "-";
68
- const n = Math.floor(r / 1e3), s = Math.floor(n / 60), t = n % 60, a = r % 1e3;
69
- return `${s}:${String(t).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
68
+ const t = Math.floor(r / 1e3), s = Math.floor(t / 60), n = t % 60, a = r % 1e3;
69
+ return `${s}:${String(n).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
70
70
  }
71
71
  function D(r) {
72
- return !r && r !== 0 ? "-" : (r / 1e3).toFixed(3);
72
+ return !r && r !== 0 ? "-" : r >= 6e4 ? B(r) : (r / 1e3).toFixed(3);
73
73
  }
74
74
  function I(r) {
75
75
  if (!r) return "";
76
- let n = r;
77
- return n.startsWith("ks_") && (n = n.slice(3)), n.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
76
+ let t = r;
77
+ return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
78
78
  }
79
- function E(r, n, s) {
80
- const t = r.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (n == null ? void 0 : n.toLowerCase()) === "track config";
81
- if (!n || n === "default" || a) return t;
82
- const i = n.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
83
- return `${t} ${i}`;
79
+ function F(r, t, s) {
80
+ if (!r) return "";
81
+ const n = r.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (t == null ? void 0 : t.toLowerCase()) === "track config";
82
+ if (!t || t === "default" || a) return n;
83
+ const i = t.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
84
+ return `${n} ${i}`;
84
85
  }
85
- function F(r) {
86
+ function _(r) {
86
87
  if (!r) return "-";
87
88
  try {
88
89
  return new Date(r).toLocaleDateString("en-GB", {
@@ -94,25 +95,25 @@ function F(r) {
94
95
  return "-";
95
96
  }
96
97
  }
97
- function ie(r) {
98
+ function oe(r) {
98
99
  if (!r) return "";
99
- const n = Date.now() - new Date(r).getTime(), s = Math.floor(n / 1e3);
100
+ const t = Date.now() - new Date(r).getTime(), s = Math.floor(t / 1e3);
100
101
  if (s < 60) return "Just now";
101
- const t = Math.floor(s / 60);
102
- if (t < 60) return `${t}m ago`;
103
- const a = Math.floor(t / 60);
102
+ const n = Math.floor(s / 60);
103
+ if (n < 60) return `${n}m ago`;
104
+ const a = Math.floor(n / 60);
104
105
  if (a < 24) return `${a}h ago`;
105
106
  const i = Math.floor(a / 24);
106
- return i < 30 ? `${i}d ago` : F(r);
107
+ return i < 30 ? `${i}d ago` : _(r);
107
108
  }
108
109
  function Er(r) {
109
110
  return r == null ? "" : `${r >= 0 ? "+" : "-"}${(Math.abs(r) / 1e3).toFixed(3)}`;
110
111
  }
111
- function Be(r, n) {
112
- const { type: s, title: t, trackId: a, trackLayout: i, carId: o, game: d, data: u } = r, c = typeof u == "string" ? JSON.parse(u) : u, v = a ? E(a, i, d) : null, x = o ? I(o) : null, N = [v, x].filter(Boolean).join(" — ");
113
- return s === "RECORD_BEATEN" && N ? `${c != null && c.beatenBySteamId && n ? n(c.beatenBySteamId).displayName : "Someone"} beat your record on ${N}` : s === "RECORD_SET" && N ? `You set a new record on ${N}` : t || "New notification";
112
+ function Be(r, t) {
113
+ const { type: s, title: n, trackId: a, trackLayout: i, carId: o, game: d, data: m } = r, c = typeof m == "string" ? JSON.parse(m) : m, h = a ? F(a, i, d) : null, x = o ? I(o) : null, f = [h, x].filter(Boolean).join(" — ");
114
+ return s === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : s === "RECORD_SET" && f ? `You set a new record on ${f}` : n || "New notification";
114
115
  }
115
- function oe(r) {
116
+ function ce(r) {
116
117
  return r ? {
117
118
  E: "Eco",
118
119
  RD: "Road",
@@ -127,231 +128,237 @@ function oe(r) {
127
128
  }[r] || r : "Unknown";
128
129
  }
129
130
  function Fr(r = {}) {
130
- var u, c, v, x, N, p;
131
- const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion: a } = r, i = J(s, "index.json"), o = C({
131
+ var m, c, h, x, f, u;
132
+ const { cdnUrl: t, partnerSlug: s } = k(), { game: n, gameVersion: a } = r, i = J(s, "index.json"), o = R({
132
133
  queryKey: ["pitvox", "leaderboards", s, "index"],
133
- queryFn: () => R(n, i),
134
+ queryFn: () => T(t, i),
134
135
  staleTime: 3e4,
135
136
  refetchInterval: 3e4
136
- }), d = w(() => {
137
+ }), d = L(() => {
137
138
  var g;
138
139
  if (!((g = o.data) != null && g.tracks)) return [];
139
- let b = o.data.tracks;
140
- return t && (b = b.filter((m) => m.game === t)), a && (b = b.filter((m) => m.gameVersion === a)), b.map((m) => ({
141
- id: m.trackId,
142
- layout: m.layout,
143
- game: m.game,
144
- gameVersion: m.gameVersion,
145
- displayName: E(m.trackId, m.layout, m.game),
146
- driverCount: m.driverCount || 0,
147
- carCount: m.carCount || 0,
148
- record: m.recordHolder ? {
149
- visibleId: m.recordHolder.steamId || m.recordHolder.userId,
150
- carId: m.recordHolder.carId,
151
- carDisplayName: I(m.recordHolder.carId),
152
- lapTimeMs: m.recordHolder.lapTimeMs,
153
- timestamp: m.recordHolder.recordedAt
140
+ let y = o.data.tracks;
141
+ return n && (y = y.filter((v) => v.game === n)), a && (y = y.filter((v) => v.gameVersion === a)), y.map((v) => ({
142
+ id: v.trackId,
143
+ layout: v.layout,
144
+ game: v.game,
145
+ gameVersion: v.gameVersion,
146
+ displayName: F(v.trackId, v.layout, v.game),
147
+ driverCount: v.driverCount || 0,
148
+ carCount: v.carCount || 0,
149
+ record: v.recordHolder ? {
150
+ visibleId: v.recordHolder.steamId || v.recordHolder.userId,
151
+ carId: v.recordHolder.carId,
152
+ carDisplayName: I(v.recordHolder.carId),
153
+ lapTimeMs: v.recordHolder.lapTimeMs,
154
+ timestamp: v.recordHolder.recordedAt
154
155
  } : null,
155
- recordByTag: m.recordByTag || null
156
+ recordByTag: v.recordByTag || null
156
157
  }));
157
- }, [(u = o.data) == null ? void 0 : u.tracks, t, a]);
158
+ }, [(m = o.data) == null ? void 0 : m.tracks, n, a]);
158
159
  return {
159
160
  ...o,
160
161
  data: d,
161
162
  partner: ((c = o.data) == null ? void 0 : c.partner) || null,
162
- generatedAt: (v = o.data) == null ? void 0 : v.generatedAt,
163
+ generatedAt: (h = o.data) == null ? void 0 : h.generatedAt,
163
164
  totalLaps: ((x = o.data) == null ? void 0 : x.totalLaps) || 0,
164
- totalUsers: ((N = o.data) == null ? void 0 : N.totalUsers) || 0,
165
- versions: ((p = o.data) == null ? void 0 : p.versions) || {}
165
+ totalUsers: ((f = o.data) == null ? void 0 : f.totalUsers) || 0,
166
+ versions: ((u = o.data) == null ? void 0 : u.versions) || {}
166
167
  };
167
168
  }
168
- function Pe(r, n, s = {}) {
169
- const { cdnUrl: t, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, u = n || "default", c = d ? `v/${d}/` : "", v = J(a, `${c}tracks/${r}/${u}.json`), { data: x, isLoading: N, error: p } = C({
170
- queryKey: ["pitvox", "leaderboards", a, "track", r, u, d],
171
- queryFn: () => R(t, v),
169
+ function Pe(r, t, s = {}) {
170
+ const { cdnUrl: n, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, m = t || "default", c = d ? `v/${d}/` : "", h = J(a, `${c}tracks/${r}/${m}.json`), { data: x, isLoading: f, error: u } = R({
171
+ queryKey: ["pitvox", "leaderboards", a, "track", r, m, d],
172
+ queryFn: () => T(n, h),
172
173
  enabled: !!r,
173
174
  staleTime: 3e4,
174
175
  refetchInterval: 3e4
175
176
  });
176
- return { data: w(() => {
177
+ return { data: L(() => {
177
178
  if (!(x != null && x.entries)) return [];
178
179
  let g = x.entries;
179
- if (o && (g = g.filter((m) => m.game === o)), !i) {
180
- const m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
181
- for (const h of g) {
182
- const y = h.steamId || h.userId;
183
- f.has(h.carId) || f.set(h.carId, /* @__PURE__ */ new Set()), f.get(h.carId).add(y), (!m.has(h.carId) || h.lapTimeMs < m.get(h.carId).lapTimeMs) && m.set(h.carId, h);
180
+ if (o && (g = g.filter((v) => v.game === o)), !i) {
181
+ const v = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
182
+ for (const p of g) {
183
+ const b = p.steamId || p.userId;
184
+ N.has(p.carId) || N.set(p.carId, /* @__PURE__ */ new Set()), N.get(p.carId).add(b), (!v.has(p.carId) || p.lapTimeMs < v.get(p.carId).lapTimeMs) && v.set(p.carId, p);
184
185
  }
185
- return Array.from(m.values()).map((h) => {
186
- var y;
187
- return { ...h, driverCount: ((y = f.get(h.carId)) == null ? void 0 : y.size) || 0 };
188
- }).sort((h, y) => h.lapTimeMs - y.lapTimeMs);
186
+ return Array.from(v.values()).map((p) => {
187
+ var b;
188
+ return { ...p, driverCount: ((b = N.get(p.carId)) == null ? void 0 : b.size) || 0 };
189
+ }).sort((p, b) => p.lapTimeMs - b.lapTimeMs);
189
190
  }
190
- return g.filter((m) => m.carId === i).sort((m, f) => m.lapTimeMs - f.lapTimeMs);
191
- }, [x == null ? void 0 : x.entries, i, o]), isLoading: N, error: p };
191
+ return g.filter((v) => v.carId === i).sort((v, N) => v.lapTimeMs - N.lapTimeMs);
192
+ }, [x == null ? void 0 : x.entries, i, o]), isLoading: f, error: u };
192
193
  }
193
- function Ae(r, n, s, t, a = {}) {
194
- var p, b;
195
- const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: u, gameVersion: c } = a, v = Ie(o, r), x = C({
194
+ function Ae(r, t, s, n, a = {}) {
195
+ var y, g;
196
+ const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: m, gameVersion: c } = a, h = Ie(o, r), x = R({
196
197
  queryKey: ["pitvox", "laps", o, r],
197
- queryFn: () => R(i, v),
198
+ queryFn: () => T(i, h),
198
199
  enabled: !!r,
199
200
  staleTime: 3e4,
200
201
  refetchInterval: 3e4
201
- }), N = w(() => {
202
- var g;
203
- return (g = x.data) != null && g.laps ? x.data.laps.filter((m) => {
204
- if (m.trackId !== n) return !1;
202
+ }), f = L(() => {
203
+ var v;
204
+ return (v = x.data) != null && v.laps ? x.data.laps.filter((N) => {
205
+ if (N.trackId !== t) return !1;
205
206
  if (s) {
206
- if (m.trackLayout !== s) return !1;
207
- } else if (m.trackLayout && m.trackLayout !== "default") return !1;
208
- return !(m.carId !== t || u && m.game !== u || c && m.gameVersion !== c || !d && !m.isValid);
209
- }).sort((m, f) => m.lapTimeMs - f.lapTimeMs) : [];
210
- }, [(p = x.data) == null ? void 0 : p.laps, n, s, t, u, c, d]);
207
+ if (N.trackLayout !== s) return !1;
208
+ } else if (N.trackLayout && N.trackLayout !== "default") return !1;
209
+ return !(N.carId !== n || m && N.game !== m || c && N.gameVersion !== c || !d && !N.isValid);
210
+ }).sort((N, p) => N.lapTimeMs - p.lapTimeMs) : [];
211
+ }, [(y = x.data) == null ? void 0 : y.laps, t, s, n, m, c, d]), u = L(() => {
212
+ const v = f.filter((w) => w.isValid && w.sector1Ms && w.sector2Ms && w.sector3Ms);
213
+ if (v.length < 2) return null;
214
+ const N = Math.min(...v.map((w) => w.sector1Ms)), p = Math.min(...v.map((w) => w.sector2Ms)), b = Math.min(...v.map((w) => w.sector3Ms)), C = N + p + b, $ = Math.min(...v.map((w) => w.lapTimeMs));
215
+ return C >= $ ? null : { lapTimeMs: C, sector1Ms: N, sector2Ms: p, sector3Ms: b };
216
+ }, [f]);
211
217
  return {
212
218
  ...x,
213
- data: N,
214
- driverName: ((b = x.data) == null ? void 0 : b.driverName) || "Driver"
219
+ data: f,
220
+ driverName: ((g = x.data) == null ? void 0 : g.driverName) || "Driver",
221
+ theoreticalBest: u
215
222
  };
216
223
  }
217
- function ce() {
218
- const { cdnUrl: r } = k(), { data: n } = C({
224
+ function le() {
225
+ const { cdnUrl: r } = k(), { data: t } = R({
219
226
  queryKey: ["pitvox", "users", "index"],
220
- queryFn: () => R(r, "users/index.json"),
227
+ queryFn: () => T(r, "users/index.json"),
221
228
  staleTime: 5 * 6e4,
222
229
  gcTime: 30 * 6e4
223
- }), s = (n == null ? void 0 : n.users) || {};
224
- return (t, a) => {
225
- const i = s[t];
230
+ }), s = (t == null ? void 0 : t.users) || {};
231
+ return (n, a) => {
232
+ const i = s[n];
226
233
  return {
227
- displayName: (i == null ? void 0 : i.displayName) || a || t || "Unknown",
234
+ displayName: (i == null ? void 0 : i.displayName) || a || n || "Unknown",
228
235
  avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
229
236
  affiliations: (i == null ? void 0 : i.affiliations) || []
230
237
  };
231
238
  };
232
239
  }
233
240
  function _r() {
234
- const { cdnUrl: r } = k(), { data: n } = C({
241
+ const { cdnUrl: r } = k(), { data: t } = R({
235
242
  queryKey: ["pitvox", "cars", "index"],
236
- queryFn: () => R(r, "cars/index.json"),
243
+ queryFn: () => T(r, "cars/index.json"),
237
244
  staleTime: 5 * 6e4,
238
245
  gcTime: 30 * 6e4
239
246
  });
240
247
  return {
241
- tags: (n == null ? void 0 : n.tags) || [],
242
- cars: (n == null ? void 0 : n.cars) || {}
248
+ tags: (t == null ? void 0 : t.tags) || [],
249
+ cars: (t == null ? void 0 : t.cars) || {}
243
250
  };
244
251
  }
245
252
  function qr() {
246
253
  var a, i;
247
- const { cdnUrl: r, partnerSlug: n } = k(), s = De(n), t = C({
248
- queryKey: ["pitvox", "recentLaps", n],
249
- queryFn: () => R(r, s),
254
+ const { cdnUrl: r, partnerSlug: t } = k(), s = De(t), n = R({
255
+ queryKey: ["pitvox", "recentLaps", t],
256
+ queryFn: () => T(r, s),
250
257
  staleTime: 3e4,
251
258
  refetchInterval: 3e4,
252
259
  gcTime: 10 * 6e4
253
260
  });
254
261
  return {
255
- groups: ((a = t.data) == null ? void 0 : a.groups) || [],
256
- generatedAt: ((i = t.data) == null ? void 0 : i.generatedAt) || null,
257
- isLoading: t.isLoading
262
+ groups: ((a = n.data) == null ? void 0 : a.groups) || [],
263
+ generatedAt: ((i = n.data) == null ? void 0 : i.generatedAt) || null,
264
+ isLoading: n.isLoading
258
265
  };
259
266
  }
260
- function jr(r, n) {
261
- return Pe(r, null, { carId: n });
267
+ function jr(r, t) {
268
+ return Pe(r, null, { carId: t });
262
269
  }
263
270
  function Vr() {
264
- const { cdnUrl: r, partnerSlug: n } = k();
265
- return C({
266
- queryKey: ["pitvox", "competitions", n],
271
+ const { cdnUrl: r, partnerSlug: t } = k();
272
+ return R({
273
+ queryKey: ["pitvox", "competitions", t],
267
274
  queryFn: async () => {
268
- const s = await R(r, "competitions/index.json");
269
- return s != null && s.competitions ? n ? s.competitions.filter((t) => t.partnerSlug === n) : s.competitions : [];
275
+ const s = await T(r, "competitions/index.json");
276
+ return s != null && s.competitions ? t ? s.competitions.filter((n) => n.partnerSlug === t) : s.competitions : [];
270
277
  },
271
278
  staleTime: 6e4
272
279
  });
273
280
  }
274
- function Ue(r, n = {}) {
275
- const s = k(), t = n.partnerSlug || s.partnerSlug;
276
- return C({
277
- queryKey: ["pitvox", "competition", t, r, "config"],
278
- queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/config.json`),
279
- enabled: !!t && !!r,
281
+ function Ue(r, t = {}) {
282
+ const s = k(), n = t.partnerSlug || s.partnerSlug;
283
+ return R({
284
+ queryKey: ["pitvox", "competition", n, r, "config"],
285
+ queryFn: () => T(s.cdnUrl, `competitions/${n}/${r}/config.json`),
286
+ enabled: !!n && !!r,
280
287
  staleTime: 6e4
281
288
  });
282
289
  }
283
- function Ee(r, n = {}) {
284
- const s = k(), t = n.partnerSlug || s.partnerSlug;
285
- return C({
286
- queryKey: ["pitvox", "competition", t, r, "standings"],
287
- queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/standings.json`),
288
- enabled: !!t && !!r,
290
+ function Ee(r, t = {}) {
291
+ const s = k(), n = t.partnerSlug || s.partnerSlug;
292
+ return R({
293
+ queryKey: ["pitvox", "competition", n, r, "standings"],
294
+ queryFn: () => T(s.cdnUrl, `competitions/${n}/${r}/standings.json`),
295
+ enabled: !!n && !!r,
289
296
  staleTime: 6e4
290
297
  });
291
298
  }
292
- function Fe(r, n, s = {}) {
293
- const t = k(), a = s.partnerSlug || t.partnerSlug;
294
- return C({
295
- queryKey: ["pitvox", "competition", a, r, "round", n],
296
- queryFn: () => R(t.cdnUrl, `competitions/${a}/${r}/rounds/${n}.json`),
297
- enabled: !!a && !!r && n != null,
299
+ function Fe(r, t, s = {}) {
300
+ const n = k(), a = s.partnerSlug || n.partnerSlug;
301
+ return R({
302
+ queryKey: ["pitvox", "competition", a, r, "round", t],
303
+ queryFn: () => T(n.cdnUrl, `competitions/${a}/${r}/rounds/${t}.json`),
304
+ enabled: !!a && !!r && t != null,
298
305
  staleTime: 6e4
299
306
  });
300
307
  }
301
- function Kr(r, n = [], s = {}) {
302
- const t = k(), a = s.partnerSlug || t.partnerSlug;
303
- return C({
304
- queryKey: ["pitvox", "competition", a, r, "allRounds", n],
308
+ function Kr(r, t = [], s = {}) {
309
+ const n = k(), a = s.partnerSlug || n.partnerSlug;
310
+ return R({
311
+ queryKey: ["pitvox", "competition", a, r, "allRounds", t],
305
312
  queryFn: async () => (await Promise.all(
306
- n.map(
307
- (o) => R(t.cdnUrl, `competitions/${a}/${r}/rounds/${o}.json`).catch(() => null)
313
+ t.map(
314
+ (o) => T(n.cdnUrl, `competitions/${a}/${r}/rounds/${o}.json`).catch(() => null)
308
315
  )
309
316
  )).filter(Boolean),
310
- enabled: !!a && !!r && n.length > 0,
317
+ enabled: !!a && !!r && t.length > 0,
311
318
  staleTime: 6e4
312
319
  });
313
320
  }
314
- function le(r, n = {}) {
315
- const s = k(), t = n.partnerSlug || s.partnerSlug;
316
- return C({
317
- queryKey: ["pitvox", "competition", t, r, "entrylist"],
318
- queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/entrylist.json`),
319
- enabled: !!t && !!r,
321
+ function de(r, t = {}) {
322
+ const s = k(), n = t.partnerSlug || s.partnerSlug;
323
+ return R({
324
+ queryKey: ["pitvox", "competition", n, r, "entrylist"],
325
+ queryFn: () => T(s.cdnUrl, `competitions/${n}/${r}/entrylist.json`),
326
+ enabled: !!n && !!r,
320
327
  staleTime: 6e4
321
328
  });
322
329
  }
323
330
  function Z(r) {
324
- const { cdnUrl: n, partnerSlug: s, getSteamId: t } = k(), a = t();
325
- return C({
331
+ const { cdnUrl: t, partnerSlug: s, getSteamId: n } = k(), a = n();
332
+ return R({
326
333
  queryKey: ["pitvox", "registration", s, r, a],
327
334
  queryFn: async () => {
328
- var u;
329
- const i = await fetch(`${n}/competitions/${s}/${r}/entrylist.json`);
335
+ var m;
336
+ const i = await fetch(`${t}/competitions/${s}/${r}/entrylist.json`);
330
337
  if (!i.ok) return { isRegistered: !1, entryList: null };
331
338
  const o = await i.json();
332
- return { isRegistered: !!a && ((u = o.drivers) == null ? void 0 : u.some((c) => c.steamId === a)), entryList: o };
339
+ return { isRegistered: !!a && ((m = o.drivers) == null ? void 0 : m.some((c) => c.steamId === a)), entryList: o };
333
340
  },
334
341
  enabled: !!r,
335
342
  staleTime: 6e4
336
343
  });
337
344
  }
338
- function de(r) {
339
- const { onRegister: n, partnerSlug: s, getSteamId: t } = k(), a = U(), i = ce();
345
+ function pe(r) {
346
+ const { onRegister: t, partnerSlug: s, getSteamId: n } = k(), a = E(), i = le();
340
347
  return H({
341
348
  mutationFn: (o) => {
342
- if (!n)
349
+ if (!t)
343
350
  throw new Error(
344
351
  "No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
345
352
  );
346
- return n(r, o);
353
+ return t(r, o);
347
354
  },
348
355
  onSuccess: () => {
349
- const o = t();
356
+ const o = n();
350
357
  if (a.setQueriesData(
351
358
  { queryKey: ["pitvox", "registration", s, r] },
352
359
  (d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
353
360
  ), o) {
354
- const d = i(o), u = {
361
+ const d = i(o), m = {
355
362
  steamId: o,
356
363
  displayName: d.displayName,
357
364
  avatarUrl: d.avatarUrl
@@ -360,27 +367,27 @@ function de(r) {
360
367
  { queryKey: ["pitvox", "competition", s, r, "entrylist"] },
361
368
  (c) => {
362
369
  var x;
363
- return c ? ((x = c.drivers) == null ? void 0 : x.some((N) => N.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], u] } : { drivers: [u] };
370
+ return c ? ((x = c.drivers) == null ? void 0 : x.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], m] } : { drivers: [m] };
364
371
  }
365
372
  );
366
373
  }
367
374
  }
368
375
  });
369
376
  }
370
- function pe(r) {
371
- const { onWithdraw: n, partnerSlug: s, getSteamId: t } = k(), a = U();
377
+ function ue(r) {
378
+ const { onWithdraw: t, partnerSlug: s, getSteamId: n } = k(), a = E();
372
379
  return H({
373
380
  mutationFn: (i) => {
374
- if (!n)
381
+ if (!t)
375
382
  throw new Error(
376
383
  "No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
377
384
  );
378
- const o = i || t();
385
+ const o = i || n();
379
386
  if (!o) throw new Error("No Steam ID available");
380
- return n(r, o);
387
+ return t(r, o);
381
388
  },
382
389
  onSuccess: () => {
383
- const i = t();
390
+ const i = n();
384
391
  a.setQueriesData(
385
392
  { queryKey: ["pitvox", "registration", s, r] },
386
393
  (o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
@@ -392,12 +399,12 @@ function pe(r) {
392
399
  });
393
400
  }
394
401
  function X() {
395
- const { onRegister: r, onWithdraw: n } = k(), s = !!(r && n);
402
+ const { onRegister: r, onWithdraw: t } = k(), s = !!(r && t);
396
403
  return { isPowerMode: s, isBasicMode: !s };
397
404
  }
398
405
  function ee(r) {
399
- const { pitvoxUrl: n, partnerSlug: s } = k();
400
- return `${n}/p/${s}/competitions/${r}/register`;
406
+ const { pitvoxUrl: t, partnerSlug: s } = k();
407
+ return `${t}/p/${s}/competitions/${r}/register`;
401
408
  }
402
409
  const _e = {
403
410
  formula: "Formula",
@@ -419,97 +426,97 @@ const _e = {
419
426
  "2000s": "2000s",
420
427
  "2010s": "2010s",
421
428
  "2020s": "2020s"
422
- }, ue = [
429
+ }, me = [
423
430
  { id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
424
431
  { id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
425
432
  { id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
426
433
  ];
427
434
  function qe(r) {
428
- for (const n of ue)
429
- if (n.tags.includes(r)) return n.id;
435
+ for (const t of me)
436
+ if (t.tags.includes(r)) return t.id;
430
437
  return "other";
431
438
  }
432
- function me(r, n) {
433
- if (n.size === 0) return !0;
439
+ function ve(r, t) {
440
+ if (t.size === 0) return !0;
434
441
  const s = {};
435
- for (const t of n) {
436
- const a = qe(t);
437
- s[a] || (s[a] = []), s[a].push(t);
442
+ for (const n of t) {
443
+ const a = qe(n);
444
+ s[a] || (s[a] = []), s[a].push(n);
438
445
  }
439
- for (const t of Object.values(s))
440
- if (!t.some((a) => r.includes(a))) return !1;
446
+ for (const n of Object.values(s))
447
+ if (!n.some((a) => r.includes(a))) return !1;
441
448
  return !0;
442
449
  }
443
- function ve(r, n) {
444
- const [s, t] = M(/* @__PURE__ */ new Set()), a = r !== void 0, i = a ? r : s, o = K((u) => {
450
+ function he(r, t) {
451
+ const [s, n] = M(/* @__PURE__ */ new Set()), a = r !== void 0, i = a ? r : s, o = K((m) => {
445
452
  const c = new Set(i);
446
- c.has(u) ? c.delete(u) : c.add(u), a && n ? n(c) : t(c);
447
- }, [i, a, n]), d = K(() => {
448
- a && n ? n(/* @__PURE__ */ new Set()) : t(/* @__PURE__ */ new Set());
449
- }, [a, n]);
453
+ c.has(m) ? c.delete(m) : c.add(m), a && t ? t(c) : n(c);
454
+ }, [i, a, t]), d = K(() => {
455
+ a && t ? t(/* @__PURE__ */ new Set()) : n(/* @__PURE__ */ new Set());
456
+ }, [a, t]);
450
457
  return { activeTags: i, toggle: o, clear: d };
451
458
  }
452
459
  function W(r) {
453
- const [n, s] = M(r), t = K((a) => {
460
+ const [t, s] = M(r), n = K((a) => {
454
461
  s(
455
462
  (i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
456
463
  );
457
464
  }, []);
458
- return [n, t];
465
+ return [t, n];
459
466
  }
460
- function O(r, n, s) {
461
- return [...r].sort((t, a) => {
462
- const i = s(t, n.key), o = s(a, n.key);
467
+ function O(r, t, s) {
468
+ return [...r].sort((n, a) => {
469
+ const i = s(n, t.key), o = s(a, t.key);
463
470
  if (i == null && o == null) return 0;
464
471
  if (i == null) return 1;
465
472
  if (o == null) return -1;
466
473
  const d = typeof i == "string" ? i.localeCompare(o) : i - o;
467
- return n.dir === "desc" ? -d : d;
474
+ return t.dir === "desc" ? -d : d;
468
475
  });
469
476
  }
470
- function he(r, n = !1) {
471
- const s = n ? r == null ? void 0 : r.filter((t) => t.isValid) : r;
477
+ function xe(r, t = !1) {
478
+ const s = t ? r == null ? void 0 : r.filter((n) => n.isValid) : r;
472
479
  return s != null && s.length ? {
473
- s1: Math.min(...s.map((t) => t.sector1Ms).filter(Boolean)),
474
- s2: Math.min(...s.map((t) => t.sector2Ms).filter(Boolean)),
475
- s3: Math.min(...s.map((t) => t.sector3Ms).filter(Boolean))
480
+ s1: Math.min(...s.map((n) => n.sector1Ms).filter(Boolean)),
481
+ s2: Math.min(...s.map((n) => n.sector2Ms).filter(Boolean)),
482
+ s3: Math.min(...s.map((n) => n.sector3Ms).filter(Boolean))
476
483
  } : null;
477
484
  }
478
- function je({ active: r, dir: n }) {
479
- return r ? 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" }) });
485
+ function je({ active: r, dir: t }) {
486
+ 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" }) });
480
487
  }
481
- function T({ label: r, sortKey: n, config: s, onSort: t, className: a = "" }) {
488
+ function S({ label: r, sortKey: t, config: s, onSort: n, className: a = "" }) {
482
489
  return /* @__PURE__ */ e(
483
490
  "th",
484
491
  {
485
492
  className: `pvx-th pvx-th--sortable ${a}`,
486
- onClick: () => t(n),
493
+ onClick: () => n(t),
487
494
  children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
488
495
  r,
489
- /* @__PURE__ */ e(je, { active: s.key === n, dir: s.dir })
496
+ /* @__PURE__ */ e(je, { active: s.key === t, dir: s.dir })
490
497
  ] })
491
498
  }
492
499
  );
493
500
  }
494
- function G({ userId: r, getUserDisplay: n }) {
495
- const { displayName: s, avatarUrl: t } = n(r);
501
+ function G({ userId: r, getUserDisplay: t }) {
502
+ const { displayName: s, avatarUrl: n } = t(r);
496
503
  return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
497
- t ? /* @__PURE__ */ e("img", { src: t, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
504
+ n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
498
505
  /* @__PURE__ */ e("span", { className: "pvx-driver-name", children: s })
499
506
  ] });
500
507
  }
501
- function re({ rank: r, podium: n = !1 }) {
502
- return /* @__PURE__ */ e("span", { className: n ? 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 });
508
+ function re({ rank: r, podium: t = !1 }) {
509
+ 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 });
503
510
  }
504
- function xe({ availableTags: r, activeTags: n, onToggle: s, onClear: t }) {
511
+ function ge({ availableTags: r, activeTags: t, onToggle: s, onClear: n }) {
505
512
  if (!r || r.length < 2) return null;
506
- const a = ue.map((i) => ({ id: i.id, tags: i.tags.filter((o) => r.includes(o)) })).filter((i) => i.tags.length > 0);
513
+ const a = me.map((i) => ({ id: i.id, tags: i.tags.filter((o) => r.includes(o)) })).filter((i) => i.tags.length > 0);
507
514
  return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
508
515
  /* @__PURE__ */ e(
509
516
  "button",
510
517
  {
511
- onClick: t,
512
- className: `pvx-tag ${n.size === 0 ? "pvx-tag--active" : ""}`,
518
+ onClick: n,
519
+ className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
513
520
  children: "All"
514
521
  }
515
522
  ),
@@ -519,7 +526,7 @@ function xe({ availableTags: r, activeTags: n, onToggle: s, onClear: t }) {
519
526
  "button",
520
527
  {
521
528
  onClick: () => s(d),
522
- className: `pvx-tag ${n.has(d) ? "pvx-tag--active" : ""}`,
529
+ className: `pvx-tag ${t.has(d) ? "pvx-tag--active" : ""}`,
523
530
  children: _e[d] || d
524
531
  },
525
532
  d
@@ -527,22 +534,22 @@ function xe({ availableTags: r, activeTags: n, onToggle: s, onClear: t }) {
527
534
  ] }, i.id))
528
535
  ] });
529
536
  }
530
- function ne({ segments: r }) {
531
- return /* @__PURE__ */ e("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ e("ol", { className: "pvx-breadcrumb-list", children: r.map((n, s) => {
532
- const t = s === r.length - 1;
537
+ function te({ segments: r }) {
538
+ return /* @__PURE__ */ e("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ e("ol", { className: "pvx-breadcrumb-list", children: r.map((t, s) => {
539
+ const n = s === r.length - 1;
533
540
  return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
534
541
  s > 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" }) }),
535
- !t && 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 })
536
- ] }, n.key);
542
+ !n && 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 })
543
+ ] }, t.key);
537
544
  }) }) });
538
545
  }
539
- function _({ message: r }) {
546
+ function q({ message: r }) {
540
547
  return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
541
548
  /* @__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" }) }),
542
549
  /* @__PURE__ */ e("p", { children: r })
543
550
  ] });
544
551
  }
545
- function q() {
552
+ function j() {
546
553
  return /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading..." });
547
554
  }
548
555
  function Ve() {
@@ -551,66 +558,66 @@ function Ve() {
551
558
  function Ke() {
552
559
  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" }) });
553
560
  }
554
- function Hr({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrackSelect: a, tags: i, onTagChange: o }) {
555
- const [d, u] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: v, clear: x } = ve(i, o), N = w(() => {
556
- var m;
557
- if (!((m = s == null ? void 0 : s.tags) != null && m.length)) return [];
561
+ function Hr({ tracks: r, isLoading: t, carMetadata: s, getUserDisplay: n, onTrackSelect: a, tags: i, onTagChange: o }) {
562
+ const [d, m] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: h, clear: x } = he(i, o), f = L(() => {
563
+ var v;
564
+ if (!((v = s == null ? void 0 : s.tags) != null && v.length)) return [];
558
565
  const g = /* @__PURE__ */ new Set();
559
- for (const f of r || [])
560
- f.recordByTag && Object.keys(f.recordByTag).forEach((h) => g.add(h));
561
- return s.tags.filter((f) => g.has(f));
562
- }, [r, s]), p = w(() => r ? c.size === 0 ? r : r.map((g) => {
563
- var h, y;
566
+ for (const N of r || [])
567
+ N.recordByTag && Object.keys(N.recordByTag).forEach((p) => g.add(p));
568
+ return s.tags.filter((N) => g.has(N));
569
+ }, [r, s]), u = L(() => r ? c.size === 0 ? r : r.map((g) => {
570
+ var p, b;
564
571
  if (!g.recordByTag) return null;
565
- let m = null;
566
- const f = /* @__PURE__ */ new Set();
567
- for (const L of Object.values(g.recordByTag)) {
568
- if (f.has(L.carId)) continue;
569
- f.add(L.carId);
570
- const $ = ((y = (h = s == null ? void 0 : s.cars) == null ? void 0 : h[L.carId]) == null ? void 0 : y.tags) || ["sports_car"];
571
- me($, c) && (!m || L.lapTimeMs < m.lapTimeMs) && (m = L);
572
+ let v = null;
573
+ const N = /* @__PURE__ */ new Set();
574
+ for (const C of Object.values(g.recordByTag)) {
575
+ if (N.has(C.carId)) continue;
576
+ N.add(C.carId);
577
+ const $ = ((b = (p = s == null ? void 0 : s.cars) == null ? void 0 : p[C.carId]) == null ? void 0 : b.tags) || ["sports_car"];
578
+ ve($, c) && (!v || C.lapTimeMs < v.lapTimeMs) && (v = C);
572
579
  }
573
- return m ? {
580
+ return v ? {
574
581
  ...g,
575
582
  record: {
576
- visibleId: m.steamId || m.identifier,
577
- carId: m.carId,
578
- carDisplayName: I(m.carId),
579
- lapTimeMs: m.lapTimeMs,
580
- timestamp: m.recordedAt
583
+ visibleId: v.steamId || v.identifier,
584
+ carId: v.carId,
585
+ carDisplayName: I(v.carId),
586
+ lapTimeMs: v.lapTimeMs,
587
+ timestamp: v.recordedAt
581
588
  }
582
589
  } : null;
583
- }).filter(Boolean) : [], [r, c, s]), b = w(() => O(p, d, (g, m) => {
584
- var f, h;
585
- switch (m) {
590
+ }).filter(Boolean) : [], [r, c, s]), y = L(() => O(u, d, (g, v) => {
591
+ var N, p;
592
+ switch (v) {
586
593
  case "displayName":
587
594
  return g.displayName;
588
595
  case "record.lapTimeMs":
589
- return (f = g.record) == null ? void 0 : f.lapTimeMs;
596
+ return (N = g.record) == null ? void 0 : N.lapTimeMs;
590
597
  case "driverCount":
591
598
  return g.driverCount || 0;
592
599
  case "carCount":
593
600
  return g.carCount || 0;
594
601
  case "record.timestamp":
595
602
  default:
596
- return (h = g.record) != null && h.timestamp ? new Date(g.record.timestamp).getTime() : 0;
603
+ return (p = g.record) != null && p.timestamp ? new Date(g.record.timestamp).getTime() : 0;
597
604
  }
598
- }), [p, d]);
599
- return n ? /* @__PURE__ */ e(q, {}) : r != null && r.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
605
+ }), [u, d]);
606
+ return t ? /* @__PURE__ */ e(j, {}) : r != null && r.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
600
607
  /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Track Records" }) }),
601
- /* @__PURE__ */ e(xe, { availableTags: N, activeTags: c, onToggle: v, onClear: x }),
608
+ /* @__PURE__ */ e(ge, { availableTags: f, activeTags: c, onToggle: h, onClear: x }),
602
609
  /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
603
610
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
604
- /* @__PURE__ */ e(T, { label: "Track", sortKey: "displayName", config: d, onSort: u }),
611
+ /* @__PURE__ */ e(S, { label: "Track", sortKey: "displayName", config: d, onSort: m }),
605
612
  /* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
606
613
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
607
- /* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: u }),
608
- /* @__PURE__ */ e(T, { label: "Drivers", sortKey: "driverCount", config: d, onSort: u, className: "pvx-hidden-below-md" }),
609
- /* @__PURE__ */ e(T, { label: "Cars", sortKey: "carCount", config: d, onSort: u, className: "pvx-hidden-below-lg" }),
610
- /* @__PURE__ */ e(T, { label: "Date", sortKey: "record.timestamp", config: d, onSort: u, className: "pvx-hidden-below-xl" })
614
+ /* @__PURE__ */ e(S, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: m }),
615
+ /* @__PURE__ */ e(S, { label: "Drivers", sortKey: "driverCount", config: d, onSort: m, className: "pvx-hidden-below-md" }),
616
+ /* @__PURE__ */ e(S, { label: "Cars", sortKey: "carCount", config: d, onSort: m, className: "pvx-hidden-below-lg" }),
617
+ /* @__PURE__ */ e(S, { label: "Date", sortKey: "record.timestamp", config: d, onSort: m, className: "pvx-hidden-below-xl" })
611
618
  ] }) }),
612
- /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: b.map((g) => {
613
- var m, f, h;
619
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: y.map((g) => {
620
+ var v, N, p;
614
621
  return /* @__PURE__ */ l(
615
622
  "tr",
616
623
  {
@@ -618,149 +625,149 @@ function Hr({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrac
618
625
  onClick: () => a(g.id, g.layout),
619
626
  children: [
620
627
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: g.displayName }),
621
- /* @__PURE__ */ e("td", { className: "pvx-td", children: (m = g.record) != null && m.visibleId ? /* @__PURE__ */ e(G, { userId: g.record.visibleId, getUserDisplay: t }) : "-" }),
622
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((f = g.record) == null ? void 0 : f.carDisplayName) || "-" }),
628
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: (v = g.record) != null && v.visibleId ? /* @__PURE__ */ e(G, { userId: g.record.visibleId, getUserDisplay: n }) : "-" }),
629
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = g.record) == null ? void 0 : N.carDisplayName) || "-" }),
623
630
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: g.record ? B(g.record.lapTimeMs) : "-" }),
624
631
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: g.driverCount || "-" }),
625
632
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: g.carCount || "-" }),
626
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (h = g.record) != null && h.timestamp ? F(g.record.timestamp) : "-" })
633
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (p = g.record) != null && p.timestamp ? _(g.record.timestamp) : "-" })
627
634
  ]
628
635
  },
629
636
  `${g.id}|${g.layout || ""}`
630
637
  );
631
638
  }) })
632
639
  ] }) })
633
- ] }) : /* @__PURE__ */ e(_, { message: "No lap times recorded yet." });
634
- }
635
- function Wr({ entries: r, isLoading: n, track: s, carMetadata: t, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: u }) {
636
- const [c, v] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: x, toggle: N, clear: p } = ve(d, u), b = w(() => {
637
- var y, L, $;
638
- if (!r || !((y = t == null ? void 0 : t.tags) != null && y.length)) return [];
639
- const h = /* @__PURE__ */ new Set();
640
- for (const S of r)
641
- ((($ = (L = t.cars) == null ? void 0 : L[S.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((ke) => h.add(ke));
642
- return t.tags.filter((S) => h.has(S));
643
- }, [r, t]), g = w(() => r ? x.size === 0 ? r : r.filter((h) => {
644
- var L, $;
645
- const y = (($ = (L = t == null ? void 0 : t.cars) == null ? void 0 : L[h.carId]) == null ? void 0 : $.tags) || ["sports_car"];
646
- return me(y, x);
647
- }) : [], [r, x, t]), m = w(() => O(g, c, (h, y) => {
648
- switch (y) {
640
+ ] }) : /* @__PURE__ */ e(q, { message: "No lap times recorded yet." });
641
+ }
642
+ function Wr({ entries: r, isLoading: t, track: s, carMetadata: n, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: m }) {
643
+ const [c, h] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: x, toggle: f, clear: u } = he(d, m), y = L(() => {
644
+ var b, C, $;
645
+ if (!r || !((b = n == null ? void 0 : n.tags) != null && b.length)) return [];
646
+ const p = /* @__PURE__ */ new Set();
647
+ for (const w of r)
648
+ ((($ = (C = n.cars) == null ? void 0 : C[w.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((A) => p.add(A));
649
+ return n.tags.filter((w) => p.has(w));
650
+ }, [r, n]), g = L(() => r ? x.size === 0 ? r : r.filter((p) => {
651
+ var C, $;
652
+ const b = (($ = (C = n == null ? void 0 : n.cars) == null ? void 0 : C[p.carId]) == null ? void 0 : $.tags) || ["sports_car"];
653
+ return ve(b, x);
654
+ }) : [], [r, x, n]), v = L(() => O(g, c, (p, b) => {
655
+ switch (b) {
649
656
  case "carId":
650
- return I(h.carId);
657
+ return I(p.carId);
651
658
  case "driverCount":
652
- return h.driverCount || 0;
659
+ return p.driverCount || 0;
653
660
  case "lapTimeMs":
654
661
  default:
655
- return h.lapTimeMs;
662
+ return p.lapTimeMs;
656
663
  }
657
- }), [g, c]), f = [
664
+ }), [g, c]), N = [
658
665
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
659
666
  { key: "track", label: s.displayName }
660
667
  ];
661
- return n ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
662
- /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ne, { segments: f }) }),
663
- /* @__PURE__ */ e(xe, { availableTags: b, activeTags: x, onToggle: N, onClear: p }),
668
+ return t ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
669
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(te, { segments: N }) }),
670
+ /* @__PURE__ */ e(ge, { availableTags: y, activeTags: x, onToggle: f, onClear: u }),
664
671
  r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
665
672
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
666
673
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
667
- /* @__PURE__ */ e(T, { label: "Car", sortKey: "carId", config: c, onSort: v }),
674
+ /* @__PURE__ */ e(S, { label: "Car", sortKey: "carId", config: c, onSort: h }),
668
675
  /* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
669
- /* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: v }),
670
- /* @__PURE__ */ e(T, { label: "Drivers", sortKey: "driverCount", config: c, onSort: v, className: "pvx-hidden-below-md" }),
676
+ /* @__PURE__ */ e(S, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: h }),
677
+ /* @__PURE__ */ e(S, { label: "Drivers", sortKey: "driverCount", config: c, onSort: h, className: "pvx-hidden-below-md" }),
671
678
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
672
679
  ] }) }),
673
- /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: m.map((h, y) => /* @__PURE__ */ l(
680
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: v.map((p, b) => /* @__PURE__ */ l(
674
681
  "tr",
675
682
  {
676
683
  className: "pvx-row pvx-row--clickable",
677
- onClick: () => i(h.carId),
684
+ onClick: () => i(p.carId),
678
685
  children: [
679
- /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: y + 1, podium: !0 }) }),
680
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(h.carId) }),
681
- /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(G, { userId: h.steamId || h.userId, getUserDisplay: a }) }),
682
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(h.lapTimeMs) }),
683
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
684
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: h.recordedAt ? F(h.recordedAt) : "-" })
686
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: b + 1, podium: !0 }) }),
687
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(p.carId) }),
688
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(G, { userId: p.steamId || p.userId, getUserDisplay: a }) }),
689
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(p.lapTimeMs) }),
690
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: p.driverCount || "-" }),
691
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: p.recordedAt ? _(p.recordedAt) : "-" })
685
692
  ]
686
693
  },
687
- h.carId
694
+ p.carId
688
695
  )) })
689
- ] }) }) : /* @__PURE__ */ e(_, { message: "No lap times for this track yet." })
696
+ ] }) }) : /* @__PURE__ */ e(q, { message: "No lap times for this track yet." })
690
697
  ] });
691
698
  }
692
- function Or({ entries: r, isLoading: n, track: s, carId: t, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
693
- const [u, c] = W({ key: "lapTimeMs", dir: "asc" }), v = w(() => he(r), [r]), x = w(() => O(r || [], u, (p, b) => {
694
- switch (b) {
699
+ function Or({ entries: r, isLoading: t, track: s, carId: n, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
700
+ const [m, c] = W({ key: "lapTimeMs", dir: "asc" }), h = L(() => xe(r), [r]), x = L(() => O(r || [], m, (u, y) => {
701
+ switch (y) {
695
702
  case "userId":
696
- return a(p.steamId || p.userId).displayName;
703
+ return a(u.steamId || u.userId).displayName;
697
704
  case "lapCount":
698
- return p.lapCount || 0;
705
+ return u.lapCount || 0;
699
706
  case "lapTimeMs":
700
707
  default:
701
- return p.lapTimeMs;
708
+ return u.lapTimeMs;
702
709
  }
703
- }), [r, u, a]), N = [
710
+ }), [r, m, a]), f = [
704
711
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
705
712
  { key: "track", label: s.displayName, onClick: () => o("track") },
706
- { key: "car", label: I(t) }
713
+ { key: "car", label: I(n) }
707
714
  ];
708
- return n ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
709
- /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ne, { segments: N }) }),
715
+ return t ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
716
+ /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(te, { segments: f }) }),
710
717
  r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
711
718
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
712
719
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
713
- /* @__PURE__ */ e(T, { label: "Driver", sortKey: "userId", config: u, onSort: c }),
714
- /* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "lapTimeMs", config: u, onSort: c }),
720
+ /* @__PURE__ */ e(S, { label: "Driver", sortKey: "userId", config: m, onSort: c }),
721
+ /* @__PURE__ */ e(S, { label: "Lap Time", sortKey: "lapTimeMs", config: m, onSort: c }),
715
722
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
716
723
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
717
724
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
718
725
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
719
726
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
720
- /* @__PURE__ */ e(T, { label: "Laps", sortKey: "lapCount", config: u, onSort: c, className: "pvx-hidden-below-lg" }),
727
+ /* @__PURE__ */ e(S, { label: "Laps", sortKey: "lapCount", config: m, onSort: c, className: "pvx-hidden-below-lg" }),
721
728
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
722
729
  ] }) }),
723
- /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: x.map((p, b) => {
724
- const g = b + 1, m = p.steamId || p.userId, f = v && p.sector1Ms === v.s1, h = v && p.sector2Ms === v.s2, y = v && p.sector3Ms === v.s3;
730
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: x.map((u, y) => {
731
+ const g = y + 1, v = u.steamId || u.userId, N = h && u.sector1Ms === h.s1, p = h && u.sector2Ms === h.s2, b = h && u.sector3Ms === h.s3;
725
732
  return /* @__PURE__ */ l(
726
733
  "tr",
727
734
  {
728
- className: `pvx-row pvx-row--clickable ${d && m === d ? "pvx-row--highlight" : g <= 3 ? "pvx-row--podium" : ""}`,
729
- onClick: () => i(m),
735
+ className: `pvx-row pvx-row--clickable ${d && v === d ? "pvx-row--highlight" : g <= 3 ? "pvx-row--podium" : ""}`,
736
+ onClick: () => i(v),
730
737
  children: [
731
738
  /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: g, podium: !0 }) }),
732
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: m, getUserDisplay: a }) }),
733
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(p.lapTimeMs) }),
734
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${f ? "pvx-td--best-sector" : ""}`, children: D(p.sector1Ms) }),
735
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: D(p.sector2Ms) }),
736
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: D(p.sector3Ms) }),
737
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: oe(p.tyreCompound), children: p.tyreCompound || "-" }),
738
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: p.startingFuelL ? `${p.startingFuelL}L` : "-" }),
739
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: p.lapCount || "-" }),
740
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: p.recordedAt ? F(p.recordedAt) : "-" })
739
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: v, getUserDisplay: a }) }),
740
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(u.lapTimeMs) }),
741
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: D(u.sector1Ms) }),
742
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${p ? "pvx-td--best-sector" : ""}`, children: D(u.sector2Ms) }),
743
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${b ? "pvx-td--best-sector" : ""}`, children: D(u.sector3Ms) }),
744
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(u.tyreCompound), children: u.tyreCompound || "-" }),
745
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: u.startingFuelL ? `${u.startingFuelL}L` : "-" }),
746
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.lapCount || "-" }),
747
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: u.recordedAt ? _(u.recordedAt) : "-" })
741
748
  ]
742
749
  },
743
- m
750
+ v
744
751
  );
745
752
  }) })
746
- ] }) }) : /* @__PURE__ */ e(_, { message: "No lap times for this car yet." })
753
+ ] }) }) : /* @__PURE__ */ e(q, { message: "No lap times for this car yet." })
747
754
  ] });
748
755
  }
749
- function Gr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: u }) {
750
- const { data: c, driverName: v, isLoading: x } = Ae(r, n.id, n.layout, s, { showInvalid: i, game: t, gameVersion: a }), { displayName: N, avatarUrl: p } = o(r, v), b = w(() => he(c, !0), [c]), g = w(() => {
751
- const f = (c == null ? void 0 : c.filter((h) => h.isValid)) || [];
752
- return f.length ? Math.min(...f.map((h) => h.lapTimeMs)) : null;
753
- }, [c]), m = [
754
- { key: "tracks", label: "Tracks", onClick: () => u("tracks") },
755
- { key: "track", label: n.displayName, onClick: () => u("track") },
756
- { key: "car", label: I(s), onClick: () => u("car") },
757
- { key: "driver", label: N }
756
+ function Gr({ userId: r, track: t, carId: s, game: n, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: m }) {
757
+ const { data: c, driverName: h, theoreticalBest: x, isLoading: f } = Ae(r, t.id, t.layout, s, { showInvalid: i, game: n, gameVersion: a }), { displayName: u, avatarUrl: y } = o(r, h), g = L(() => xe(c, !0), [c]), v = L(() => {
758
+ const p = (c == null ? void 0 : c.filter((b) => b.isValid)) || [];
759
+ return p.length ? Math.min(...p.map((b) => b.lapTimeMs)) : null;
760
+ }, [c]), N = [
761
+ { key: "tracks", label: "Tracks", onClick: () => m("tracks") },
762
+ { key: "track", label: t.displayName, onClick: () => m("track") },
763
+ { key: "car", label: I(s), onClick: () => m("car") },
764
+ { key: "driver", label: u }
758
765
  ];
759
- return x ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
766
+ return f ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
760
767
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
761
768
  /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
762
- /* @__PURE__ */ e(ne, { segments: m }),
763
- p ? /* @__PURE__ */ e("img", { src: p, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
769
+ /* @__PURE__ */ e(te, { segments: N }),
770
+ y ? /* @__PURE__ */ e("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
764
771
  ] }),
765
772
  /* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
766
773
  /* @__PURE__ */ e(
@@ -775,6 +782,19 @@ function Gr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvali
775
782
  /* @__PURE__ */ e("span", { children: "Show invalid laps" })
776
783
  ] })
777
784
  ] }),
785
+ x && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
786
+ /* @__PURE__ */ e("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
787
+ /* @__PURE__ */ e("span", { className: "pvx-theoretical-best-time", children: B(x.lapTimeMs) }),
788
+ /* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
789
+ "(",
790
+ D(x.sector1Ms),
791
+ " + ",
792
+ D(x.sector2Ms),
793
+ " + ",
794
+ D(x.sector3Ms),
795
+ ")"
796
+ ] })
797
+ ] }),
778
798
  c != null && c.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
779
799
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
780
800
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
@@ -788,42 +808,42 @@ function Gr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvali
788
808
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
789
809
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
790
810
  ] }) }),
791
- /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: c.map((f, h) => {
792
- const y = f.isValid && f.lapTimeMs === g, L = b && f.isValid && f.sector1Ms === b.s1, $ = b && f.isValid && f.sector2Ms === b.s2, S = b && f.isValid && f.sector3Ms === b.s3;
793
- let V = "pvx-row";
794
- return f.isValid || (V += " pvx-row--invalid"), y && (V += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: V, children: [
795
- /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${y ? "pvx-rank--gold" : ""}`, children: h + 1 }) }),
796
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: f.lapNumber || "-" }),
797
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(f.lapTimeMs) }),
798
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: D(f.sector1Ms) }),
799
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(f.sector2Ms) }),
800
- /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${S ? "pvx-td--best-sector" : ""}`, children: D(f.sector3Ms) }),
801
- /* @__PURE__ */ e("td", { className: "pvx-td", title: f.isValid ? void 0 : f.invalidReason || "Invalid", children: f.isValid ? /* @__PURE__ */ e(Ve, {}) : /* @__PURE__ */ e(Ke, {}) }),
802
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: oe(f.tyreCompound), children: f.tyreCompound || "-" }),
803
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: f.startingFuelL ? `${f.startingFuelL}L` : "-" }),
804
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: F(f.timestamp) })
805
- ] }, f.id);
811
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: c.map((p, b) => {
812
+ const C = p.isValid && p.lapTimeMs === v, $ = g && p.isValid && p.sector1Ms === g.s1, w = g && p.isValid && p.sector2Ms === g.s2, ne = g && p.isValid && p.sector3Ms === g.s3;
813
+ let A = "pvx-row";
814
+ return p.isValid || (A += " pvx-row--invalid"), C && (A += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: A, children: [
815
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: b + 1 }) }),
816
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: p.lapNumber || "-" }),
817
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(p.lapTimeMs) }),
818
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(p.sector1Ms) }),
819
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: D(p.sector2Ms) }),
820
+ /* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${ne ? "pvx-td--best-sector" : ""}`, children: D(p.sector3Ms) }),
821
+ /* @__PURE__ */ e("td", { className: "pvx-td", title: p.isValid ? void 0 : p.invalidReason || "Invalid", children: p.isValid ? /* @__PURE__ */ e(Ve, {}) : /* @__PURE__ */ e(Ke, {}) }),
822
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(p.tyreCompound), children: p.tyreCompound || "-" }),
823
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: p.startingFuelL ? `${p.startingFuelL}L` : "-" }),
824
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: _(p.timestamp) })
825
+ ] }, p.id);
806
826
  }) })
807
- ] }) }) : /* @__PURE__ */ e(_, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
827
+ ] }) }) : /* @__PURE__ */ e(q, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
808
828
  ] });
809
829
  }
810
- function zr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion: a, onComboSelect: i }) {
811
- const [o, d] = W({ key: "rank", dir: "asc" }), [u, c] = M(null), v = w(() => r ? O(r, o, (N, p) => {
812
- switch (p) {
830
+ function zr({ drivers: r, isLoading: t, getUserDisplay: s, game: n, gameVersion: a, onComboSelect: i }) {
831
+ const [o, d] = W({ key: "rank", dir: "asc" }), [m, c] = M(null), h = L(() => r ? O(r, o, (f, u) => {
832
+ switch (u) {
813
833
  case "rating":
814
- return N.rating;
834
+ return f.rating;
815
835
  case "comboCount":
816
- return N.comboCount || 0;
836
+ return f.comboCount || 0;
817
837
  case "distinctCars":
818
- return N.distinctCars || 0;
838
+ return f.distinctCars || 0;
819
839
  case "rank":
820
840
  default:
821
- return N.rank;
841
+ return f.rank;
822
842
  }
823
843
  }) : [], [r, o]);
824
- if (n) return /* @__PURE__ */ e(q, {});
844
+ if (t) return /* @__PURE__ */ e(j, {});
825
845
  if (!(r != null && r.length))
826
- return /* @__PURE__ */ e("div", { className: "pvx-card", children: /* @__PURE__ */ e(_, { message: "Not enough data for rankings yet." }) });
846
+ return /* @__PURE__ */ e("div", { className: "pvx-card", children: /* @__PURE__ */ e(q, { message: "Not enough data for rankings yet." }) });
827
847
  const x = 5;
828
848
  return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
829
849
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
@@ -843,43 +863,43 @@ function zr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion:
843
863
  ] }),
844
864
  /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
845
865
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
846
- /* @__PURE__ */ e(T, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
866
+ /* @__PURE__ */ e(S, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
847
867
  /* @__PURE__ */ e("th", { className: "pvx-th", children: "Driver" }),
848
- /* @__PURE__ */ e(T, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
849
- /* @__PURE__ */ e(T, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
850
- /* @__PURE__ */ e(T, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
868
+ /* @__PURE__ */ e(S, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
869
+ /* @__PURE__ */ e(S, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
870
+ /* @__PURE__ */ e(S, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
851
871
  ] }) }),
852
- /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: v.map((N) => {
853
- const p = u === N.identifier;
872
+ /* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: h.map((f) => {
873
+ const u = m === f.identifier;
854
874
  return /* @__PURE__ */ e(
855
875
  He,
856
876
  {
857
- driver: N,
877
+ driver: f,
858
878
  getUserDisplay: s,
859
- isExpanded: p,
860
- onToggle: () => c(p ? null : N.identifier),
879
+ isExpanded: u,
880
+ onToggle: () => c(u ? null : f.identifier),
861
881
  colCount: x,
862
- game: t,
882
+ game: n,
863
883
  gameVersion: a,
864
884
  onComboSelect: i
865
885
  },
866
- N.identifier
886
+ f.identifier
867
887
  );
868
888
  }) })
869
889
  ] }) })
870
890
  ] });
871
891
  }
872
- function He({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
873
- const u = r.identifier;
874
- return /* @__PURE__ */ l(A, { children: [
892
+ function He({ driver: r, getUserDisplay: t, isExpanded: s, onToggle: n, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
893
+ const m = r.identifier;
894
+ return /* @__PURE__ */ l(U, { children: [
875
895
  /* @__PURE__ */ l(
876
896
  "tr",
877
897
  {
878
898
  className: `pvx-row pvx-row--clickable ${r.rank <= 3 ? "pvx-row--podium" : ""}`,
879
- onClick: t,
899
+ onClick: n,
880
900
  children: [
881
901
  /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: r.rank, podium: !0 }) }),
882
- /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: u, getUserDisplay: n }) }),
902
+ /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: m, getUserDisplay: t }) }),
883
903
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: r.rating.toFixed(1) }),
884
904
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: r.distinctCars || "-" }),
885
905
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
@@ -889,17 +909,17 @@ function He({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
889
909
  ]
890
910
  }
891
911
  ),
892
- s && r.combos && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ e("div", { className: "pvx-rankings-combos", children: r.combos.map((c, v) => {
893
- const x = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, N = d ? () => d({ track: x, car: c.carId, highlight: u, game: i, gameVersion: o }) : void 0;
912
+ s && r.combos && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ e("div", { className: "pvx-rankings-combos", children: r.combos.map((c, h) => {
913
+ const x = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: x, car: c.carId, highlight: m, game: i, gameVersion: o }) : void 0;
894
914
  return /* @__PURE__ */ l(
895
915
  "div",
896
916
  {
897
- className: `pvx-rankings-combo ${N ? "pvx-rankings-combo--clickable" : ""}`,
898
- onClick: N,
899
- role: N ? "button" : void 0,
917
+ className: `pvx-rankings-combo ${f ? "pvx-rankings-combo--clickable" : ""}`,
918
+ onClick: f,
919
+ role: f ? "button" : void 0,
900
920
  children: [
901
921
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
902
- /* @__PURE__ */ e("p", { className: "pvx-rankings-combo-track", children: E(c.trackId, c.layout, i) }),
922
+ /* @__PURE__ */ e("p", { className: "pvx-rankings-combo-track", children: F(c.trackId, c.layout, i) }),
903
923
  /* @__PURE__ */ e("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
904
924
  ] }),
905
925
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
@@ -918,7 +938,7 @@ function He({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
918
938
  ] })
919
939
  ]
920
940
  },
921
- v
941
+ h
922
942
  );
923
943
  }) }) }) })
924
944
  ] });
@@ -958,24 +978,24 @@ const We = {
958
978
  championship: "Championship",
959
979
  series: "Series",
960
980
  event: "Event"
961
- }, se = ["PRACTICE", "QUALIFYING", "RACE"];
962
- function ge({ position: r }) {
981
+ }, ae = ["PRACTICE", "QUALIFYING", "RACE"];
982
+ function fe({ position: r }) {
963
983
  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 });
964
984
  }
965
- function fe({ nation: r }) {
966
- const n = r && We[r];
967
- return n ? /* @__PURE__ */ e("span", { className: "pvx-nation-flag", title: r, children: n }) : null;
985
+ function Ne({ nation: r }) {
986
+ const t = r && We[r];
987
+ return t ? /* @__PURE__ */ e("span", { className: "pvx-nation-flag", title: r, children: t }) : null;
968
988
  }
969
- function ze({ sessions: r, activeSession: n, onSelect: s }) {
989
+ function ze({ sessions: r, activeSession: t, onSelect: s }) {
970
990
  if (!r || r.length <= 1) return null;
971
- const t = [...r].sort(
972
- (a, i) => se.indexOf(a.type) - se.indexOf(i.type)
991
+ const n = [...r].sort(
992
+ (a, i) => ae.indexOf(a.type) - ae.indexOf(i.type)
973
993
  );
974
- return /* @__PURE__ */ e("div", { className: "pvx-session-tabs", children: t.map((a) => /* @__PURE__ */ e(
994
+ return /* @__PURE__ */ e("div", { className: "pvx-session-tabs", children: n.map((a) => /* @__PURE__ */ e(
975
995
  "button",
976
996
  {
977
997
  onClick: () => s(a.type),
978
- className: `pvx-session-tab ${n === a.type ? "pvx-session-tab--active" : ""}`,
998
+ className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
979
999
  children: a.type
980
1000
  },
981
1001
  a.type
@@ -984,46 +1004,46 @@ function ze({ sessions: r, activeSession: n, onSelect: s }) {
984
1004
  function Qe({ type: r }) {
985
1005
  return /* @__PURE__ */ e("span", { className: `pvx-comp-badge pvx-comp-badge--${r}`, children: Ge[r] || r });
986
1006
  }
987
- function Q({ children: r, variant: n = "default" }) {
988
- return /* @__PURE__ */ e("span", { className: `pvx-info-pill ${n !== "default" ? `pvx-info-pill--${n}` : ""}`, children: r });
1007
+ function Q({ children: r, variant: t = "default" }) {
1008
+ return /* @__PURE__ */ e("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: r });
989
1009
  }
990
1010
  function Ye(r) {
991
1011
  if (!r) return "TBD";
992
- const n = new Date(r);
993
- if (isNaN(n)) return "TBD";
994
- const s = n.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), t = n.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
995
- return `${s} • ${t}`;
1012
+ const t = new Date(r);
1013
+ if (isNaN(t)) return "TBD";
1014
+ const s = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), n = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1015
+ return `${s} • ${n}`;
996
1016
  }
997
1017
  function Je(r) {
998
- return r.reduce((n, s) => {
999
- var t;
1000
- return (t = s.splits) != null && t.length ? n ? n.map((a, i) => {
1018
+ return r.reduce((t, s) => {
1019
+ var n;
1020
+ return (n = s.splits) != null && n.length ? t ? t.map((a, i) => {
1001
1021
  const o = s.splits[i];
1002
1022
  return o && o < a ? o : a;
1003
- }) : [...s.splits] : n;
1023
+ }) : [...s.splits] : t;
1004
1024
  }, null);
1005
1025
  }
1006
- function j({ message: r = "Loading..." }) {
1026
+ function V({ message: r = "Loading..." }) {
1007
1027
  return /* @__PURE__ */ e("div", { className: "pvx-loading", children: r });
1008
1028
  }
1009
1029
  function P({ message: r = "No data available." }) {
1010
1030
  return /* @__PURE__ */ e("div", { className: "pvx-empty", children: /* @__PURE__ */ e("p", { children: r }) });
1011
1031
  }
1012
- function Qr({ competitions: r, isLoading: n, onSelect: s, onRegister: t, className: a }) {
1013
- return n ? /* @__PURE__ */ e(j, { message: "Loading competitions..." }) : r != null && r.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${a || ""}`, children: r.map((i) => /* @__PURE__ */ e(Ze, { comp: i, onSelect: s, onRegister: t || s }, i.id)) }) : /* @__PURE__ */ e(P, { message: "No competitions available." });
1032
+ function Qr({ competitions: r, isLoading: t, onSelect: s, onRegister: n, className: a }) {
1033
+ return t ? /* @__PURE__ */ e(V, { message: "Loading competitions..." }) : r != null && r.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${a || ""}`, children: r.map((i) => /* @__PURE__ */ e(Ze, { comp: i, onSelect: s, onRegister: n || s }, i.id)) }) : /* @__PURE__ */ e(P, { message: "No competitions available." });
1014
1034
  }
1015
- function Ze({ comp: r, onSelect: n, onRegister: s }) {
1016
- var g, m, f;
1017
- const { cdnUrl: t } = k(), a = r.posterCdnPath ? `${t}/${r.posterCdnPath}` : null, i = r.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, u = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), v = (i == null ? void 0 : i.isOpen) && !c && !u, x = /* @__PURE__ */ new Date(), N = (g = r.rounds) == null ? void 0 : g.find((h) => h.startTime && new Date(h.startTime) >= x), p = ((m = r.rounds) == null ? void 0 : m.length) || 0, b = ((f = r.rounds) == null ? void 0 : f.filter((h) => h.isFinalized).length) || 0;
1035
+ function Ze({ comp: r, onSelect: t, onRegister: s }) {
1036
+ var g, v, N;
1037
+ const { cdnUrl: n } = k(), a = r.posterCdnPath ? `${n}/${r.posterCdnPath}` : null, i = r.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, m = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), h = (i == null ? void 0 : i.isOpen) && !c && !m, x = /* @__PURE__ */ new Date(), f = (g = r.rounds) == null ? void 0 : g.find((p) => p.startTime && new Date(p.startTime) >= x), u = ((v = r.rounds) == null ? void 0 : v.length) || 0, y = ((N = r.rounds) == null ? void 0 : N.filter((p) => p.isFinalized).length) || 0;
1018
1038
  return /* @__PURE__ */ l(
1019
1039
  "div",
1020
1040
  {
1021
1041
  className: "pvx-comp-card",
1022
- onClick: () => n(r.id),
1042
+ onClick: () => t(r.id),
1023
1043
  role: "button",
1024
1044
  tabIndex: 0,
1025
- onKeyDown: (h) => {
1026
- (h.key === "Enter" || h.key === " ") && (h.preventDefault(), n(r.id));
1045
+ onKeyDown: (p) => {
1046
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), t(r.id));
1027
1047
  },
1028
1048
  children: [
1029
1049
  /* @__PURE__ */ e("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ e("img", { src: a, alt: r.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ e("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ e(er, {}) }) }),
@@ -1033,37 +1053,37 @@ function Ze({ comp: r, onSelect: n, onRegister: s }) {
1033
1053
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
1034
1054
  /* @__PURE__ */ e(Qe, { type: r.type }),
1035
1055
  r.game && /* @__PURE__ */ e(Q, { children: r.game.toUpperCase() }),
1036
- r.formatDescription && r.formatDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { variant: "format", children: h }, y))
1056
+ r.formatDescription && r.formatDescription.split(", ").map((p, b) => /* @__PURE__ */ e(Q, { variant: "format", children: p }, b))
1037
1057
  ] }),
1038
- r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { children: h }, y)) }),
1058
+ r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((p, b) => /* @__PURE__ */ e(Q, { children: p }, b)) }),
1039
1059
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
1040
- N ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1060
+ f ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1041
1061
  /* @__PURE__ */ e("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1042
1062
  " ",
1043
1063
  "R",
1044
- N.roundNumber,
1064
+ f.roundNumber,
1045
1065
  " ",
1046
- N.track || "TBD",
1066
+ f.track || "TBD",
1047
1067
  " — ",
1048
- Ye(N.startTime)
1049
- ] }) : p > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1050
- b,
1068
+ Ye(f.startTime)
1069
+ ] }) : u > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1070
+ y,
1051
1071
  "/",
1052
- p,
1072
+ u,
1053
1073
  " rounds completed"
1054
1074
  ] }) : null,
1055
- p > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1056
- p,
1075
+ u > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1076
+ u,
1057
1077
  " round",
1058
- p !== 1 ? "s" : ""
1078
+ u !== 1 ? "s" : ""
1059
1079
  ] })
1060
1080
  ] }),
1061
1081
  i && /* @__PURE__ */ e(
1062
1082
  Xe,
1063
1083
  {
1064
1084
  competitionId: r.id,
1065
- regOpen: v,
1066
- isFull: u,
1085
+ regOpen: h,
1086
+ isFull: m,
1067
1087
  deadlinePassed: c,
1068
1088
  regCount: o,
1069
1089
  regMax: d,
@@ -1075,41 +1095,41 @@ function Ze({ comp: r, onSelect: n, onRegister: s }) {
1075
1095
  }
1076
1096
  );
1077
1097
  }
1078
- function Xe({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCount: a, regMax: i, onRegister: o }) {
1079
- const { isPowerMode: d } = X(), u = ee(r), { data: c } = Z(r), v = (c == null ? void 0 : c.isRegistered) || !1, x = i ? a / i * 100 : 0, N = x >= 100 ? "full" : x >= 75 ? "warning" : "ok";
1098
+ function Xe({ competitionId: r, regOpen: t, isFull: s, deadlinePassed: n, regCount: a, regMax: i, onRegister: o }) {
1099
+ const { isPowerMode: d } = X(), m = ee(r), { data: c } = Z(r), h = (c == null ? void 0 : c.isRegistered) || !1, x = i ? a / i * 100 : 0, f = x >= 100 ? "full" : x >= 75 ? "warning" : "ok";
1080
1100
  return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
1081
- /* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${N}`, children: [
1101
+ /* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
1082
1102
  a,
1083
1103
  "/",
1084
1104
  i || "∞",
1085
1105
  " drivers"
1086
1106
  ] }) }),
1087
- /* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-action", children: v ? /* @__PURE__ */ e(
1107
+ /* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-action", children: h ? /* @__PURE__ */ e(
1088
1108
  "button",
1089
1109
  {
1090
1110
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
1091
- onClick: (p) => {
1092
- p.stopPropagation(), o(r);
1111
+ onClick: (u) => {
1112
+ u.stopPropagation(), o(r);
1093
1113
  },
1094
1114
  children: "✓ Registered"
1095
1115
  }
1096
- ) : n ? d ? /* @__PURE__ */ e(
1116
+ ) : t ? d ? /* @__PURE__ */ e(
1097
1117
  "button",
1098
1118
  {
1099
1119
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1100
- onClick: (p) => {
1101
- p.stopPropagation(), o(r);
1120
+ onClick: (u) => {
1121
+ u.stopPropagation(), o(r);
1102
1122
  },
1103
1123
  children: "Register"
1104
1124
  }
1105
1125
  ) : /* @__PURE__ */ e(
1106
1126
  "a",
1107
1127
  {
1108
- href: u,
1128
+ href: m,
1109
1129
  target: "_blank",
1110
1130
  rel: "noopener noreferrer",
1111
1131
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1112
- onClick: (p) => p.stopPropagation(),
1132
+ onClick: (u) => u.stopPropagation(),
1113
1133
  children: "Register"
1114
1134
  }
1115
1135
  ) : /* @__PURE__ */ e("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
@@ -1125,15 +1145,15 @@ function er() {
1125
1145
  /* @__PURE__ */ e("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1126
1146
  ] });
1127
1147
  }
1128
- function Yr({ competitionId: r, className: n }) {
1129
- var d, u;
1130
- const { data: s, isLoading: t } = Ee(r), { data: a, isLoading: i } = Ue(r);
1131
- if (t || i)
1132
- return /* @__PURE__ */ e(j, { message: "Loading standings..." });
1148
+ function Yr({ competitionId: r, className: t }) {
1149
+ var d, m;
1150
+ const { data: s, isLoading: n } = Ee(r), { data: a, isLoading: i } = Ue(r);
1151
+ if (n || i)
1152
+ return /* @__PURE__ */ e(V, { message: "Loading standings..." });
1133
1153
  if (!((d = s == null ? void 0 : s.standings) != null && d.length))
1134
1154
  return /* @__PURE__ */ e(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
1135
- const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((c) => c.isFinalized)) || [];
1136
- return /* @__PURE__ */ l("div", { className: `pvx-card ${n || ""}`, children: [
1155
+ const o = ((m = a == null ? void 0 : a.rounds) == null ? void 0 : m.filter((c) => c.isFinalized)) || [];
1156
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
1137
1157
  /* @__PURE__ */ e("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
1138
1158
  /* @__PURE__ */ e("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1139
1159
  /* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
@@ -1175,32 +1195,32 @@ function Yr({ competitionId: r, className: n }) {
1175
1195
  ] }) })
1176
1196
  ] });
1177
1197
  }
1178
- function rr({ driver: r, finalizedRounds: n }) {
1179
- var o, d, u;
1180
- const s = r.position <= 3, t = new Map(
1198
+ function rr({ driver: r, finalizedRounds: t }) {
1199
+ var o, d, m;
1200
+ const s = r.position <= 3, n = new Map(
1181
1201
  ((o = r.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
1182
- ), a = ((d = r.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((u = r.roundResults) == null ? void 0 : u.filter((c) => c.position <= 3).length) || 0;
1202
+ ), a = ((d = r.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((m = r.roundResults) == null ? void 0 : m.filter((c) => c.position <= 3).length) || 0;
1183
1203
  return /* @__PURE__ */ l("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
1184
- /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(ge, { position: r.position }) }),
1204
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(fe, { position: r.position }) }),
1185
1205
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1186
- /* @__PURE__ */ e(fe, { nation: r.nation }),
1206
+ /* @__PURE__ */ e(Ne, { nation: r.nation }),
1187
1207
  r.driverName
1188
1208
  ] }),
1189
1209
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1190
1210
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1191
1211
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: r.totalPoints }),
1192
- n.map((c) => {
1193
- const v = t.get(c.roundNumber), x = v == null ? void 0 : v.dropped;
1212
+ t.map((c) => {
1213
+ const h = n.get(c.roundNumber), x = h == null ? void 0 : h.dropped;
1194
1214
  return /* @__PURE__ */ e(
1195
1215
  "td",
1196
1216
  {
1197
- className: `pvx-td pvx-td--center pvx-hidden-below-md ${!x && (v == null ? void 0 : v.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
1198
- children: v ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${x ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1217
+ className: `pvx-td pvx-td--center pvx-hidden-below-md ${!x && (h == null ? void 0 : h.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
1218
+ children: h ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${x ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1199
1219
  /* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
1200
1220
  "P",
1201
- v.position
1221
+ h.position
1202
1222
  ] }),
1203
- /* @__PURE__ */ e("span", { className: "pvx-standings-round-pts", children: v.points })
1223
+ /* @__PURE__ */ e("span", { className: "pvx-standings-round-pts", children: h.points })
1204
1224
  ] }) : /* @__PURE__ */ e("span", { className: "pvx-td--muted", children: "-" })
1205
1225
  },
1206
1226
  c.roundNumber
@@ -1208,23 +1228,23 @@ function rr({ driver: r, finalizedRounds: n }) {
1208
1228
  })
1209
1229
  ] });
1210
1230
  }
1211
- function Jr({ competitionId: r, roundNumber: n, className: s }) {
1212
- var u;
1213
- const { data: t, isLoading: a } = Fe(r, n);
1231
+ function Jr({ competitionId: r, roundNumber: t, className: s }) {
1232
+ var m;
1233
+ const { data: n, isLoading: a } = Fe(r, t);
1214
1234
  if (a)
1215
- return /* @__PURE__ */ e(j, { message: "Loading results..." });
1216
- if (!t)
1235
+ return /* @__PURE__ */ e(V, { message: "Loading results..." });
1236
+ if (!n)
1217
1237
  return /* @__PURE__ */ e(P, { message: "No results for this round." });
1218
- const o = (t.sessions || []).find((c) => c.type === "RACE"), d = (u = o == null ? void 0 : o.results) == null ? void 0 : u.filter((c) => c.position <= 3).sort((c, v) => c.position - v.position);
1238
+ const o = (n.sessions || []).find((c) => c.type === "RACE"), d = (m = o == null ? void 0 : o.results) == null ? void 0 : m.filter((c) => c.position <= 3).sort((c, h) => c.position - h.position);
1219
1239
  return /* @__PURE__ */ l("div", { className: `pvx-round-results ${s || ""}`, children: [
1220
1240
  /* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
1221
1241
  /* @__PURE__ */ l("div", { children: [
1222
1242
  /* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
1223
1243
  "Round ",
1224
- t.roundNumber,
1225
- t.track ? `: ${t.track}` : ""
1244
+ n.roundNumber,
1245
+ n.track ? `: ${n.track}` : ""
1226
1246
  ] }),
1227
- t.startTime && /* @__PURE__ */ e("p", { className: "pvx-round-results-date", children: new Date(t.startTime).toLocaleDateString("en-GB", {
1247
+ n.startTime && /* @__PURE__ */ e("p", { className: "pvx-round-results-date", children: new Date(n.startTime).toLocaleDateString("en-GB", {
1228
1248
  day: "numeric",
1229
1249
  month: "long",
1230
1250
  year: "numeric"
@@ -1235,31 +1255,31 @@ function Jr({ competitionId: r, roundNumber: n, className: s }) {
1235
1255
  /* @__PURE__ */ e("span", { children: c.driverName })
1236
1256
  ] }, c.driverId)) })
1237
1257
  ] }),
1238
- /* @__PURE__ */ e(nr, { round: t })
1258
+ /* @__PURE__ */ e(tr, { round: n })
1239
1259
  ] });
1240
1260
  }
1241
- function nr({ round: r, className: n }) {
1242
- var d, u;
1243
- const [s, t] = M(null), a = (r == null ? void 0 : r.sessions) || [];
1261
+ function tr({ round: r, className: t }) {
1262
+ var d, m;
1263
+ const [s, n] = M(null), a = (r == null ? void 0 : r.sessions) || [];
1244
1264
  if (!a.length)
1245
1265
  return /* @__PURE__ */ e(P, { message: "No session data for this round." });
1246
- const i = s || ((d = a.find((c) => c.type === "RACE")) == null ? void 0 : d.type) || ((u = a[0]) == null ? void 0 : u.type), o = a.find((c) => c.type === i) || a[0];
1247
- return /* @__PURE__ */ l("div", { className: n || "", children: [
1266
+ const i = s || ((d = a.find((c) => c.type === "RACE")) == null ? void 0 : d.type) || ((m = a[0]) == null ? void 0 : m.type), o = a.find((c) => c.type === i) || a[0];
1267
+ return /* @__PURE__ */ l("div", { className: t || "", children: [
1248
1268
  /* @__PURE__ */ e(
1249
1269
  ze,
1250
1270
  {
1251
1271
  sessions: a,
1252
1272
  activeSession: i,
1253
- onSelect: t
1273
+ onSelect: n
1254
1274
  }
1255
1275
  ),
1256
- /* @__PURE__ */ e(tr, { session: o })
1276
+ /* @__PURE__ */ e(nr, { session: o })
1257
1277
  ] });
1258
1278
  }
1259
- function tr({ session: r }) {
1260
- var t;
1261
- const n = r.type === "RACE";
1262
- if (!((t = r.results) != null && t.length))
1279
+ function nr({ session: r }) {
1280
+ var n;
1281
+ const t = r.type === "RACE";
1282
+ if (!((n = r.results) != null && n.length))
1263
1283
  return /* @__PURE__ */ e(P, { message: `No results for ${r.type}.` });
1264
1284
  const s = Je(r.results);
1265
1285
  return /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
@@ -1268,7 +1288,7 @@ function tr({ session: r }) {
1268
1288
  /* @__PURE__ */ e("th", { className: "pvx-th", children: "Driver" }),
1269
1289
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1270
1290
  /* @__PURE__ */ e("th", { className: "pvx-th", children: "Best Lap" }),
1271
- n && /* @__PURE__ */ l(A, { children: [
1291
+ t && /* @__PURE__ */ l(U, { children: [
1272
1292
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1273
1293
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1274
1294
  /* @__PURE__ */ e("th", { className: "pvx-th pvx-th--center", children: "Points" })
@@ -1278,7 +1298,7 @@ function tr({ session: r }) {
1278
1298
  sr,
1279
1299
  {
1280
1300
  result: a,
1281
- isRace: n,
1301
+ isRace: t,
1282
1302
  fastestSplits: s,
1283
1303
  rowIndex: i
1284
1304
  },
@@ -1286,12 +1306,12 @@ function tr({ session: r }) {
1286
1306
  )) })
1287
1307
  ] }) });
1288
1308
  }
1289
- function sr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
1309
+ function sr({ result: r, isRace: t, fastestSplits: s, rowIndex: n }) {
1290
1310
  const a = r.position <= 3;
1291
1311
  return /* @__PURE__ */ l("tr", { className: `pvx-row ${a ? "pvx-row--podium" : ""}`, children: [
1292
- /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(ge, { position: r.position }) }),
1312
+ /* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(fe, { position: r.position }) }),
1293
1313
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1294
- /* @__PURE__ */ e(fe, { nation: r.nation }),
1314
+ /* @__PURE__ */ e(Ne, { nation: r.nation }),
1295
1315
  r.driverName,
1296
1316
  r.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
1297
1317
  "#",
@@ -1307,10 +1327,10 @@ function sr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
1307
1327
  hasBestLap: r.hasBestLap,
1308
1328
  splits: r.splits,
1309
1329
  fastestSplits: s,
1310
- showAbove: t <= 1
1330
+ showAbove: n <= 1
1311
1331
  }
1312
1332
  ) }),
1313
- n && /* @__PURE__ */ l(A, { children: [
1333
+ t && /* @__PURE__ */ l(U, { children: [
1314
1334
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-sm", children: r.lapsCompleted }),
1315
1335
  /* @__PURE__ */ e("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: r.position === 1 ? r.totalTime || "-" : r.gap || "-" }),
1316
1336
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
@@ -1325,11 +1345,11 @@ function sr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
1325
1345
  ] })
1326
1346
  ] });
1327
1347
  }
1328
- function ar({ bestLap: r, hasBestLap: n, splits: s, fastestSplits: t, showAbove: a }) {
1329
- return r ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${n ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1348
+ function ar({ bestLap: r, hasBestLap: t, splits: s, fastestSplits: n, showAbove: a }) {
1349
+ return r ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1330
1350
  /* @__PURE__ */ e("span", { className: "pvx-best-lap-time", children: r }),
1331
1351
  (s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ e("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ e("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
1332
- const d = t && i === t[o];
1352
+ const d = n && i === n[o];
1333
1353
  return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
1334
1354
  /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
1335
1355
  "S",
@@ -1340,15 +1360,15 @@ function ar({ bestLap: r, hasBestLap: n, splits: s, fastestSplits: t, showAbove:
1340
1360
  }) }) })
1341
1361
  ] }) : /* @__PURE__ */ e("span", { className: "pvx-td--muted", children: "-" });
1342
1362
  }
1343
- function Zr({ competitionId: r, className: n }) {
1344
- const { getSteamId: s } = k(), { data: t, isLoading: a } = le(r), i = s();
1363
+ function Zr({ competitionId: r, className: t }) {
1364
+ const { getSteamId: s } = k(), { data: n, isLoading: a } = de(r), i = s();
1345
1365
  if (a)
1346
- return /* @__PURE__ */ e(j, { message: "Loading drivers..." });
1347
- const o = (t == null ? void 0 : t.drivers) || (t == null ? void 0 : t.entries) || [];
1348
- return o.length ? /* @__PURE__ */ e("div", { className: `pvx-entry-grid ${n || ""}`, children: o.map((d) => {
1349
- var c, v;
1350
- const u = i && d.steamId === i;
1351
- return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${u ? "pvx-entry-card--you" : ""}`, children: [
1366
+ return /* @__PURE__ */ e(V, { message: "Loading drivers..." });
1367
+ const o = (n == null ? void 0 : n.drivers) || (n == null ? void 0 : n.entries) || [];
1368
+ return o.length ? /* @__PURE__ */ e("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
1369
+ var c, h;
1370
+ const m = i && d.steamId === i;
1371
+ return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${m ? "pvx-entry-card--you" : ""}`, children: [
1352
1372
  d.avatarUrl ? /* @__PURE__ */ e(
1353
1373
  "img",
1354
1374
  {
@@ -1356,32 +1376,32 @@ function Zr({ competitionId: r, className: n }) {
1356
1376
  alt: "",
1357
1377
  className: "pvx-entry-avatar"
1358
1378
  }
1359
- ) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((v = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : v.toUpperCase()) || "?" }),
1379
+ ) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((h = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : h.toUpperCase()) || "?" }),
1360
1380
  /* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
1361
1381
  d.displayName,
1362
- u && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
1382
+ m && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
1363
1383
  ] })
1364
1384
  ] }, d.steamId || d.driverId);
1365
1385
  }) }) : /* @__PURE__ */ e(P, { message: "No drivers registered yet." });
1366
1386
  }
1367
1387
  function Xr({
1368
1388
  competitionId: r,
1369
- driverData: n,
1389
+ driverData: t,
1370
1390
  className: s,
1371
- children: t
1391
+ children: n
1372
1392
  }) {
1373
- const { data: a, isLoading: i } = Z(r), { isPowerMode: o } = X(), d = ee(r), u = de(r), c = pe(r), v = (a == null ? void 0 : a.isRegistered) || !1, x = i || u.isPending || c.isPending, N = u.error || c.error || null, p = () => {
1374
- o && u.mutate(n || {});
1375
- }, b = () => {
1393
+ const { data: a, isLoading: i } = Z(r), { isPowerMode: o } = X(), d = ee(r), m = pe(r), c = ue(r), h = (a == null ? void 0 : a.isRegistered) || !1, x = i || m.isPending || c.isPending, f = m.error || c.error || null, u = () => {
1394
+ o && m.mutate(t || {});
1395
+ }, y = () => {
1376
1396
  o && c.mutate();
1377
1397
  };
1378
- return typeof t == "function" ? t({ isRegistered: v, isLoading: x, register: p, withdraw: b, error: N, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ e(
1398
+ return typeof n == "function" ? n({ isRegistered: h, isLoading: x, register: u, withdraw: y, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ e(
1379
1399
  "button",
1380
1400
  {
1381
1401
  className: `pvx-comp-register-btn ${s || ""}`,
1382
- onClick: v ? b : p,
1402
+ onClick: h ? y : u,
1383
1403
  disabled: x,
1384
- children: x ? "Loading..." : v ? "Withdraw" : "Register"
1404
+ children: x ? "Loading..." : h ? "Withdraw" : "Register"
1385
1405
  }
1386
1406
  ) : /* @__PURE__ */ e(
1387
1407
  "a",
@@ -1390,50 +1410,50 @@ function Xr({
1390
1410
  target: "_blank",
1391
1411
  rel: "noopener noreferrer",
1392
1412
  className: `pvx-comp-register-link ${s || ""}`,
1393
- children: v ? "View Registration" : "Register on PitVox"
1413
+ children: h ? "View Registration" : "Register on PitVox"
1394
1414
  }
1395
1415
  );
1396
1416
  }
1397
- function en({ competitionId: r, registration: n, onWithdrawSuccess: s, className: t }) {
1398
- const { getSteamId: a } = k(), { isPowerMode: i } = X(), o = ee(r), { data: d, isLoading: u } = Z(r), { data: c, isLoading: v } = le(r), x = de(r), N = pe(r), p = a(), b = (d == null ? void 0 : d.isRegistered) || !1, g = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], m = n || {}, f = g.length || m.currentCount || 0, h = m.maxParticipants && f >= m.maxParticipants, y = m.deadline && new Date(m.deadline) < /* @__PURE__ */ new Date(), L = m.isOpen && !y && !h;
1399
- return u || v ? /* @__PURE__ */ e(j, { message: "Loading registration..." }) : b ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
1417
+ function et({ competitionId: r, registration: t, onWithdrawSuccess: s, className: n }) {
1418
+ const { getSteamId: a } = k(), { isPowerMode: i } = X(), o = ee(r), { data: d, isLoading: m } = Z(r), { data: c, isLoading: h } = de(r), x = pe(r), f = ue(r), u = a(), y = (d == null ? void 0 : d.isRegistered) || !1, g = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], v = t || {}, N = g.length || v.currentCount || 0, p = v.maxParticipants && N >= v.maxParticipants, b = v.deadline && new Date(v.deadline) < /* @__PURE__ */ new Date(), C = v.isOpen && !b && !p;
1419
+ return m || h ? /* @__PURE__ */ e(V, { message: "Loading registration..." }) : y ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${n || ""}`, children: /* @__PURE__ */ e(
1400
1420
  or,
1401
1421
  {
1402
1422
  competitionId: r,
1403
1423
  drivers: g,
1404
- steamId: p,
1424
+ steamId: u,
1405
1425
  isPowerMode: i,
1406
1426
  registrationUrl: o,
1407
- withdrawMutation: N,
1427
+ withdrawMutation: f,
1408
1428
  onWithdrawSuccess: s,
1409
- registration: m
1429
+ registration: v
1410
1430
  }
1411
- ) }) : L ? p ? i ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
1431
+ ) }) : C ? u ? i ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${n || ""}`, children: /* @__PURE__ */ e(
1412
1432
  ir,
1413
1433
  {
1414
1434
  competitionId: r,
1415
1435
  registerMutation: x,
1416
- registration: m
1436
+ registration: v
1417
1437
  }
1418
- ) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: i ? /* @__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: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${t || ""}`, children: [
1419
- /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
1420
- g.length > 0 && /* @__PURE__ */ e(Ne, { drivers: g, steamId: p })
1438
+ ) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${n || ""}`, children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${n || ""}`, children: i ? /* @__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: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${n || ""}`, children: [
1439
+ /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: p ? "Registration is full." : b ? "Registration deadline has passed." : "Registration is closed." }),
1440
+ g.length > 0 && /* @__PURE__ */ e(be, { drivers: g, steamId: u })
1421
1441
  ] });
1422
1442
  }
1423
- function ir({ competitionId: r, registerMutation: n, registration: s }) {
1424
- const [t, a] = M(""), [i, o] = M("intermediate"), [d, u] = M(""), c = (p) => {
1425
- p.preventDefault(), n.mutate({
1426
- discordUsername: t || void 0,
1443
+ function ir({ competitionId: r, registerMutation: t, registration: s }) {
1444
+ const [n, a] = M(""), [i, o] = M("intermediate"), [d, m] = M(""), c = (u) => {
1445
+ u.preventDefault(), t.mutate({
1446
+ discordUsername: n || void 0,
1427
1447
  experience: i,
1428
1448
  comments: d || void 0
1429
1449
  });
1430
- }, v = s || {}, x = v.currentCount || 0, N = v.maxParticipants;
1450
+ }, h = s || {}, x = h.currentCount || 0, f = h.maxParticipants;
1431
1451
  return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
1432
1452
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1433
1453
  /* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Register" }),
1434
- N && /* @__PURE__ */ e(be, { count: x, max: N })
1454
+ f && /* @__PURE__ */ e(ye, { count: x, max: f })
1435
1455
  ] }),
1436
- n.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: n.error.message || "Registration failed" }),
1456
+ t.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
1437
1457
  /* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
1438
1458
  /* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${r}`, children: [
1439
1459
  "Discord Username ",
@@ -1446,8 +1466,8 @@ function ir({ competitionId: r, registerMutation: n, registration: s }) {
1446
1466
  type: "text",
1447
1467
  className: "pvx-reg-input",
1448
1468
  placeholder: "e.g. username",
1449
- value: t,
1450
- onChange: (p) => a(p.target.value)
1469
+ value: n,
1470
+ onChange: (u) => a(u.target.value)
1451
1471
  }
1452
1472
  )
1453
1473
  ] }),
@@ -1459,7 +1479,7 @@ function ir({ competitionId: r, registerMutation: n, registration: s }) {
1459
1479
  id: `pvx-exp-${r}`,
1460
1480
  className: "pvx-reg-select",
1461
1481
  value: i,
1462
- onChange: (p) => o(p.target.value),
1482
+ onChange: (u) => o(u.target.value),
1463
1483
  children: [
1464
1484
  /* @__PURE__ */ e("option", { value: "beginner", children: "Beginner" }),
1465
1485
  /* @__PURE__ */ e("option", { value: "intermediate", children: "Intermediate" }),
@@ -1481,7 +1501,7 @@ function ir({ competitionId: r, registerMutation: n, registration: s }) {
1481
1501
  rows: 3,
1482
1502
  placeholder: "Anything the organisers should know?",
1483
1503
  value: d,
1484
- onChange: (p) => u(p.target.value)
1504
+ onChange: (u) => m(u.target.value)
1485
1505
  }
1486
1506
  )
1487
1507
  ] }),
@@ -1490,28 +1510,28 @@ function ir({ competitionId: r, registerMutation: n, registration: s }) {
1490
1510
  {
1491
1511
  type: "submit",
1492
1512
  className: "pvx-comp-register-btn",
1493
- disabled: n.isPending,
1494
- children: n.isPending ? "Registering..." : "Register"
1513
+ disabled: t.isPending,
1514
+ children: t.isPending ? "Registering..." : "Register"
1495
1515
  }
1496
1516
  ) })
1497
1517
  ] });
1498
1518
  }
1499
- function or({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1500
- const [u, c] = M(!1), v = () => {
1519
+ function or({ competitionId: r, drivers: t, steamId: s, isPowerMode: n, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1520
+ const [m, c] = M(!1), h = () => {
1501
1521
  i.mutate(void 0, {
1502
1522
  onSuccess: () => {
1503
1523
  c(!1), o && o();
1504
1524
  }
1505
1525
  });
1506
- }, x = d || {}, N = n.length || x.currentCount || 0, p = x.maxParticipants;
1507
- return /* @__PURE__ */ l(A, { children: [
1526
+ }, x = d || {}, f = t.length || x.currentCount || 0, u = x.maxParticipants;
1527
+ return /* @__PURE__ */ l(U, { children: [
1508
1528
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1509
1529
  /* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
1510
- p && /* @__PURE__ */ e(be, { count: N, max: p })
1530
+ u && /* @__PURE__ */ e(ye, { count: f, max: u })
1511
1531
  ] }),
1512
- /* @__PURE__ */ e(Ne, { drivers: n, steamId: s }),
1532
+ /* @__PURE__ */ e(be, { drivers: t, steamId: s }),
1513
1533
  i.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
1514
- t ? /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
1534
+ n ? /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: m ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
1515
1535
  /* @__PURE__ */ e("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
1516
1536
  /* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
1517
1537
  /* @__PURE__ */ e(
@@ -1528,7 +1548,7 @@ function or({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registra
1528
1548
  {
1529
1549
  type: "button",
1530
1550
  className: "pvx-reg-danger-btn",
1531
- onClick: v,
1551
+ onClick: h,
1532
1552
  disabled: i.isPending,
1533
1553
  children: i.isPending ? "Unregistering..." : "Yes, Unregister"
1534
1554
  }
@@ -1545,159 +1565,159 @@ function or({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registra
1545
1565
  ) }) : /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ e("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
1546
1566
  ] });
1547
1567
  }
1548
- function Ne({ drivers: r, steamId: n }) {
1568
+ function be({ drivers: r, steamId: t }) {
1549
1569
  if (!r.length)
1550
1570
  return /* @__PURE__ */ e("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
1551
- const s = [...r].sort((t, a) => {
1552
- const i = n && t.steamId === n ? -1 : 0, o = n && a.steamId === n ? -1 : 0;
1571
+ const s = [...r].sort((n, a) => {
1572
+ const i = t && n.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
1553
1573
  return i - o;
1554
1574
  });
1555
- return /* @__PURE__ */ e("div", { className: "pvx-reg-driver-list", children: s.map((t) => {
1575
+ return /* @__PURE__ */ e("div", { className: "pvx-reg-driver-list", children: s.map((n) => {
1556
1576
  var i, o;
1557
- const a = n && t.steamId === n;
1577
+ const a = t && n.steamId === t;
1558
1578
  return /* @__PURE__ */ l(
1559
1579
  "div",
1560
1580
  {
1561
1581
  className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
1562
1582
  children: [
1563
- t.avatarUrl ? /* @__PURE__ */ e("img", { src: t.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = t.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1583
+ n.avatarUrl ? /* @__PURE__ */ e("img", { src: n.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = n.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1564
1584
  /* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
1565
- t.displayName,
1585
+ n.displayName,
1566
1586
  a && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
1567
1587
  ] })
1568
1588
  ]
1569
1589
  },
1570
- t.steamId || t.driverId
1590
+ n.steamId || n.driverId
1571
1591
  );
1572
1592
  }) });
1573
1593
  }
1574
- function be({ count: r, max: n }) {
1575
- const s = n ? r / n * 100 : 0, t = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
1576
- return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${t}`, children: [
1594
+ function ye({ count: r, max: t }) {
1595
+ const s = t ? r / t * 100 : 0, n = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
1596
+ return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${n}`, children: [
1577
1597
  r,
1578
1598
  "/",
1579
- n,
1599
+ t,
1580
1600
  " drivers"
1581
1601
  ] });
1582
1602
  }
1583
1603
  function cr(r) {
1584
- const { cdnUrl: n } = k(), s = C({
1604
+ const { cdnUrl: t } = k(), s = R({
1585
1605
  queryKey: ["pitvox", "laps", "global", r],
1586
- queryFn: () => R(n, `laps/${r}.json`),
1606
+ queryFn: () => T(t, `laps/${r}.json`),
1587
1607
  enabled: !!r,
1588
1608
  staleTime: 3e4,
1589
1609
  refetchInterval: 3e4
1590
- }), t = s.data;
1610
+ }), n = s.data;
1591
1611
  return {
1592
1612
  isLoading: s.isLoading,
1593
1613
  error: s.error,
1594
- data: t ? {
1595
- driverName: t.driverName || "Driver",
1596
- lapCount: t.lapCount || 0,
1597
- trackBreakdown: t.trackBreakdown || [],
1598
- carBreakdown: t.carBreakdown || [],
1599
- recordsHeld: t.recordsHeld || 0,
1600
- currentRecords: t.currentRecords || [],
1601
- bestRanking: t.bestRanking ?? null,
1602
- bestRankingTrackId: t.bestRankingTrackId ?? null,
1603
- bestRankingLayout: t.bestRankingLayout ?? null,
1604
- bestRankingCarId: t.bestRankingCarId ?? null,
1605
- generatedAt: t.generatedAt
1614
+ data: n ? {
1615
+ driverName: n.driverName || "Driver",
1616
+ lapCount: n.lapCount || 0,
1617
+ trackBreakdown: n.trackBreakdown || [],
1618
+ carBreakdown: n.carBreakdown || [],
1619
+ recordsHeld: n.recordsHeld || 0,
1620
+ currentRecords: n.currentRecords || [],
1621
+ bestRanking: n.bestRanking ?? null,
1622
+ bestRankingTrackId: n.bestRankingTrackId ?? null,
1623
+ bestRankingLayout: n.bestRankingLayout ?? null,
1624
+ bestRankingCarId: n.bestRankingCarId ?? null,
1625
+ generatedAt: n.generatedAt
1606
1626
  } : null
1607
1627
  };
1608
1628
  }
1609
- function ye(r = {}) {
1610
- const { cdnUrl: n, partnerSlug: s } = k(), { gameVersion: t, enabled: a = !0 } = r, i = t ? `v/${t}/` : "", o = J(s, `${i}ratings.json`);
1611
- return C({
1612
- queryKey: ["pitvox", "ratings", s, t || null],
1613
- queryFn: () => R(n, o),
1629
+ function ke(r = {}) {
1630
+ const { cdnUrl: t, partnerSlug: s } = k(), { gameVersion: n, enabled: a = !0 } = r, i = n ? `v/${n}/` : "", o = J(s, `${i}ratings.json`);
1631
+ return R({
1632
+ queryKey: ["pitvox", "ratings", s, n || null],
1633
+ queryFn: () => T(t, o),
1614
1634
  staleTime: 3e4,
1615
1635
  refetchInterval: 3e4,
1616
1636
  enabled: a
1617
1637
  });
1618
1638
  }
1619
1639
  function lr(r) {
1620
- var t;
1621
- const n = ye(), s = w(() => {
1640
+ var n;
1641
+ const t = ke(), s = L(() => {
1622
1642
  var a;
1623
- return !((a = n.data) != null && a.drivers) || !r ? null : n.data.drivers.find(
1643
+ return !((a = t.data) != null && a.drivers) || !r ? null : t.data.drivers.find(
1624
1644
  (i) => i.identifier === r
1625
1645
  ) || null;
1626
- }, [(t = n.data) == null ? void 0 : t.drivers, r]);
1646
+ }, [(n = t.data) == null ? void 0 : n.drivers, r]);
1627
1647
  return {
1628
- isLoading: n.isLoading,
1629
- error: n.error,
1648
+ isLoading: t.isLoading,
1649
+ error: t.error,
1630
1650
  data: s ? {
1631
1651
  rating: s.rating,
1632
1652
  rank: s.rank,
1633
- totalDrivers: n.data.driverCount || n.data.drivers.length,
1653
+ totalDrivers: t.data.driverCount || t.data.drivers.length,
1634
1654
  comboCount: s.comboCount || 0,
1635
1655
  distinctCars: s.distinctCars || 0,
1636
1656
  combos: s.combos || []
1637
1657
  } : null
1638
1658
  };
1639
1659
  }
1640
- function rn(r = {}) {
1641
- const n = ye(r);
1660
+ function rt(r = {}) {
1661
+ const t = ke(r);
1642
1662
  return {
1643
- data: n.data || null,
1644
- isLoading: n.isLoading,
1645
- error: n.error
1663
+ data: t.data || null,
1664
+ isLoading: t.isLoading,
1665
+ error: t.error
1646
1666
  };
1647
1667
  }
1648
1668
  function dr() {
1649
- const { cdnUrl: r, partnerSlug: n, getSteamId: s, onFetchServerPassword: t } = k(), a = s(), { data: i, isLoading: o } = C({
1650
- queryKey: ["pitvox", "competitions", n],
1669
+ const { cdnUrl: r, partnerSlug: t, getSteamId: s, onFetchServerPassword: n } = k(), a = s(), { data: i, isLoading: o } = R({
1670
+ queryKey: ["pitvox", "competitions", t],
1651
1671
  queryFn: async () => {
1652
- const p = await R(r, "competitions/index.json");
1653
- return p != null && p.competitions ? p.competitions.filter((b) => b.partnerSlug === n) : [];
1672
+ const u = await T(r, "competitions/index.json");
1673
+ return u != null && u.competitions ? u.competitions.filter((y) => y.partnerSlug === t) : [];
1654
1674
  },
1655
1675
  staleTime: 6e4
1656
- }), d = (i == null ? void 0 : i.map((p) => p.id)) || [], u = te({
1657
- queries: d.map((p) => ({
1658
- queryKey: ["pitvox", "competition", n, p, "entrylist"],
1659
- queryFn: () => R(r, `competitions/${n}/${p}/entrylist.json`),
1676
+ }), d = (i == null ? void 0 : i.map((u) => u.id)) || [], m = se({
1677
+ queries: d.map((u) => ({
1678
+ queryKey: ["pitvox", "competition", t, u, "entrylist"],
1679
+ queryFn: () => T(r, `competitions/${t}/${u}/entrylist.json`),
1660
1680
  enabled: !!a && d.length > 0,
1661
1681
  staleTime: 6e4
1662
1682
  }))
1663
- }), c = u.some((p) => p.isLoading), v = w(() => {
1664
- var g, m;
1683
+ }), c = m.some((u) => u.isLoading), h = L(() => {
1684
+ var g, v;
1665
1685
  if (!i || !a || c) return [];
1666
- const p = /* @__PURE__ */ new Date(), b = [];
1667
- for (let f = 0; f < i.length; f++) {
1668
- const h = i[f], y = (g = u[f]) == null ? void 0 : g.data;
1669
- if (!((m = y == null ? void 0 : y.drivers) == null ? void 0 : m.some((S) => S.steamId === a))) continue;
1670
- const $ = h.rounds || [];
1671
- for (const S of $)
1672
- S.isFinalized || !S.startTime || new Date(S.startTime) <= p || b.push({
1673
- competitionId: h.id,
1674
- competitionName: h.name,
1675
- roundNumber: S.roundNumber,
1676
- track: S.track || "TBD",
1677
- startTime: S.startTime
1686
+ const u = /* @__PURE__ */ new Date(), y = [];
1687
+ for (let N = 0; N < i.length; N++) {
1688
+ const p = i[N], b = (g = m[N]) == null ? void 0 : g.data;
1689
+ if (!((v = b == null ? void 0 : b.drivers) == null ? void 0 : v.some((w) => w.steamId === a))) continue;
1690
+ const $ = p.rounds || [];
1691
+ for (const w of $)
1692
+ w.isFinalized || !w.startTime || new Date(w.startTime) <= u || y.push({
1693
+ competitionId: p.id,
1694
+ competitionName: p.name,
1695
+ roundNumber: w.roundNumber,
1696
+ track: w.track || "TBD",
1697
+ startTime: w.startTime
1678
1698
  });
1679
1699
  }
1680
- return b.sort((f, h) => new Date(f.startTime) - new Date(h.startTime)), b.length > 0 && (b[0].isNext = !0), b;
1681
- }, [i, a, c, u]), x = te({
1682
- queries: v.map((p) => ({
1683
- queryKey: ["pitvox", "serverInfo", p.competitionId, p.roundNumber],
1684
- queryFn: () => t(p.competitionId, p.roundNumber),
1685
- enabled: !!t && v.length > 0,
1700
+ return y.sort((N, p) => new Date(N.startTime) - new Date(p.startTime)), y.length > 0 && (y[0].isNext = !0), y;
1701
+ }, [i, a, c, m]), x = se({
1702
+ queries: h.map((u) => ({
1703
+ queryKey: ["pitvox", "serverInfo", u.competitionId, u.roundNumber],
1704
+ queryFn: () => n(u.competitionId, u.roundNumber),
1705
+ enabled: !!n && h.length > 0,
1686
1706
  staleTime: 5 * 6e4,
1687
1707
  // 5 minutes
1688
1708
  retry: !1
1689
1709
  }))
1690
1710
  });
1691
1711
  return {
1692
- data: w(() => v.length ? t ? v.map((p, b) => {
1693
- var m;
1694
- const g = (m = x[b]) == null ? void 0 : m.data;
1712
+ data: L(() => h.length ? n ? h.map((u, y) => {
1713
+ var v;
1714
+ const g = (v = x[y]) == null ? void 0 : v.data;
1695
1715
  return g != null && g.success ? {
1696
- ...p,
1716
+ ...u,
1697
1717
  serverAddress: g.serverAddress || null,
1698
1718
  serverPassword: g.serverPassword || null
1699
- } : p;
1700
- }) : v : [], [v, t, x]),
1719
+ } : u;
1720
+ }) : h : [], [h, n, x]),
1701
1721
  isLoading: o || !!a && c
1702
1722
  };
1703
1723
  }
@@ -1706,37 +1726,37 @@ function pr() {
1706
1726
  return !!r;
1707
1727
  }
1708
1728
  function ur(r = {}) {
1709
- const { onFetchNotifications: n, partnerSlug: s } = k(), { limit: t = 20, unreadOnly: a = !1 } = r;
1710
- return C({
1711
- queryKey: ["pitvox", "notifications", s, { limit: t, unreadOnly: a }],
1712
- queryFn: () => n({ limit: t, unreadOnly: a }),
1713
- enabled: !!n,
1729
+ const { onFetchNotifications: t, partnerSlug: s } = k(), { limit: n = 20, unreadOnly: a = !1 } = r;
1730
+ return R({
1731
+ queryKey: ["pitvox", "notifications", s, { limit: n, unreadOnly: a }],
1732
+ queryFn: () => t({ limit: n, unreadOnly: a }),
1733
+ enabled: !!t,
1714
1734
  staleTime: 3e4,
1715
1735
  refetchInterval: 3e4
1716
1736
  });
1717
1737
  }
1718
- function nn() {
1719
- const { onFetchNotifications: r, partnerSlug: n } = k(), { data: s, isLoading: t } = C({
1720
- queryKey: ["pitvox", "notifications", n, { limit: 1, unreadOnly: !1 }],
1738
+ function tt() {
1739
+ const { onFetchNotifications: r, partnerSlug: t } = k(), { data: s, isLoading: n } = R({
1740
+ queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
1721
1741
  queryFn: () => r({ limit: 1 }),
1722
1742
  enabled: !!r,
1723
1743
  staleTime: 3e4,
1724
1744
  refetchInterval: 3e4,
1725
1745
  select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
1726
1746
  });
1727
- return { count: s ?? 0, isLoading: t };
1747
+ return { count: s ?? 0, isLoading: n };
1728
1748
  }
1729
1749
  function mr() {
1730
- const { onMarkNotificationRead: r, partnerSlug: n } = k(), s = U();
1750
+ const { onMarkNotificationRead: r, partnerSlug: t } = k(), s = E();
1731
1751
  return H({
1732
- mutationFn: (t) => {
1752
+ mutationFn: (n) => {
1733
1753
  if (!r)
1734
1754
  throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
1735
- return r(t);
1755
+ return r(n);
1736
1756
  },
1737
- onSuccess: (t, a) => {
1757
+ onSuccess: (n, a) => {
1738
1758
  s.setQueriesData(
1739
- { queryKey: ["pitvox", "notifications", n] },
1759
+ { queryKey: ["pitvox", "notifications", t] },
1740
1760
  (i) => i != null && i.notifications ? {
1741
1761
  ...i,
1742
1762
  unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
@@ -1749,7 +1769,7 @@ function mr() {
1749
1769
  });
1750
1770
  }
1751
1771
  function vr() {
1752
- const { onMarkAllNotificationsRead: r, partnerSlug: n } = k(), s = U();
1772
+ const { onMarkAllNotificationsRead: r, partnerSlug: t } = k(), s = E();
1753
1773
  return H({
1754
1774
  mutationFn: () => {
1755
1775
  if (!r)
@@ -1758,24 +1778,24 @@ function vr() {
1758
1778
  },
1759
1779
  onSuccess: () => {
1760
1780
  s.setQueriesData(
1761
- { queryKey: ["pitvox", "notifications", n] },
1762
- (t) => t != null && t.notifications ? {
1763
- ...t,
1781
+ { queryKey: ["pitvox", "notifications", t] },
1782
+ (n) => n != null && n.notifications ? {
1783
+ ...n,
1764
1784
  unreadCount: 0,
1765
- notifications: t.notifications.map((a) => ({
1785
+ notifications: n.notifications.map((a) => ({
1766
1786
  ...a,
1767
1787
  isRead: !0,
1768
1788
  readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
1769
1789
  }))
1770
- } : t
1790
+ } : n
1771
1791
  );
1772
1792
  }
1773
1793
  });
1774
1794
  }
1775
- function hr({ driverName: r, avatarUrl: n, memberSince: s, className: t = "" }) {
1795
+ function hr({ driverName: r, avatarUrl: t, memberSince: s, className: n = "" }) {
1776
1796
  const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
1777
- return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${t}`, children: [
1778
- 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: (r || "?")[0].toUpperCase() }),
1797
+ return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${n}`, children: [
1798
+ 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() }),
1779
1799
  /* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
1780
1800
  /* @__PURE__ */ e("h2", { className: "pvx-dash-profile-name", children: r }),
1781
1801
  a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
@@ -1805,40 +1825,40 @@ function gr() {
1805
1825
  function fr() {
1806
1826
  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" }) });
1807
1827
  }
1808
- function ae({ icon: r, value: n, label: s, items: t, labelKey: a, countKey: i }) {
1809
- const [o, d] = M(!1), u = Le(null);
1828
+ function ie({ icon: r, value: t, label: s, items: n, labelKey: a, countKey: i }) {
1829
+ const [o, d] = M(!1), m = Le(null);
1810
1830
  Re(() => {
1811
1831
  if (!o) return;
1812
- function v(x) {
1813
- u.current && !u.current.contains(x.target) && d(!1);
1832
+ function h(x) {
1833
+ m.current && !m.current.contains(x.target) && d(!1);
1814
1834
  }
1815
- return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
1835
+ return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
1816
1836
  }, [o]);
1817
- const c = t != null && t.length ? t.slice().sort((v, x) => x[i] - v[i]) : null;
1837
+ const c = n != null && n.length ? n.slice().sort((h, x) => x[i] - h[i]) : null;
1818
1838
  return /* @__PURE__ */ l(
1819
1839
  "div",
1820
1840
  {
1821
- ref: u,
1841
+ ref: m,
1822
1842
  className: `pvx-dash-stat-card ${c ? "pvx-dash-stat-card--clickable" : ""}`,
1823
- onClick: c ? () => d((v) => !v) : void 0,
1843
+ onClick: c ? () => d((h) => !h) : void 0,
1824
1844
  children: [
1825
1845
  r,
1826
1846
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
1827
- /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: n }),
1847
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: t }),
1828
1848
  /* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: s })
1829
1849
  ] }),
1830
- c && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((v, x) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
1831
- /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: v[a] }),
1832
- /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: v[i] })
1850
+ c && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((h, x) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
1851
+ /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: h[a] }),
1852
+ /* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: h[i] })
1833
1853
  ] }, x)) })
1834
1854
  ]
1835
1855
  }
1836
1856
  );
1837
1857
  }
1838
- function Nr({ stats: r, rating: n, className: s = "" }) {
1858
+ function Nr({ stats: r, rating: t, className: s = "" }) {
1839
1859
  if (!r) return null;
1840
- const t = r.trackBreakdown.map((i) => ({
1841
- name: E(i.trackId, i.layout),
1860
+ const n = r.trackBreakdown.map((i) => ({
1861
+ name: F(i.trackId, i.layout),
1842
1862
  lapCount: i.lapCount
1843
1863
  })), a = r.carBreakdown.map((i) => ({
1844
1864
  name: I(i.carId),
@@ -1846,18 +1866,18 @@ function Nr({ stats: r, rating: n, className: s = "" }) {
1846
1866
  }));
1847
1867
  return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${s}`, children: [
1848
1868
  /* @__PURE__ */ e(
1849
- ae,
1869
+ ie,
1850
1870
  {
1851
1871
  icon: /* @__PURE__ */ e(xr, {}),
1852
1872
  value: r.lapCount.toLocaleString(),
1853
1873
  label: "Total Laps",
1854
- items: t,
1874
+ items: n,
1855
1875
  labelKey: "name",
1856
1876
  countKey: "lapCount"
1857
1877
  }
1858
1878
  ),
1859
1879
  /* @__PURE__ */ e(
1860
- ae,
1880
+ ie,
1861
1881
  {
1862
1882
  icon: /* @__PURE__ */ e(gr, {}),
1863
1883
  value: r.carBreakdown.length,
@@ -1867,27 +1887,27 @@ function Nr({ stats: r, rating: n, className: s = "" }) {
1867
1887
  countKey: "lapCount"
1868
1888
  }
1869
1889
  ),
1870
- n && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
1890
+ t && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
1871
1891
  /* @__PURE__ */ e(fr, {}),
1872
1892
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
1873
- /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: n.rating.toFixed(1) }),
1893
+ /* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: t.rating.toFixed(1) }),
1874
1894
  /* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
1875
1895
  /* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
1876
1896
  "#",
1877
- n.rank,
1897
+ t.rank,
1878
1898
  " of ",
1879
- n.totalDrivers
1899
+ t.totalDrivers
1880
1900
  ] })
1881
1901
  ] })
1882
1902
  ] })
1883
1903
  ] });
1884
1904
  }
1885
- function br({ records: r, className: n = "" }) {
1886
- const s = w(() => r != null && r.length ? r.slice().sort((t, a) => {
1887
- const i = t.recordedAt ? new Date(t.recordedAt).getTime() : 0;
1905
+ function br({ records: r, className: t = "" }) {
1906
+ const s = L(() => r != null && r.length ? r.slice().sort((n, a) => {
1907
+ const i = n.recordedAt ? new Date(n.recordedAt).getTime() : 0;
1888
1908
  return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
1889
1909
  }) : [], [r]);
1890
- return s.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${n}`, children: [
1910
+ return s.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
1891
1911
  /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
1892
1912
  /* @__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: [
1893
1913
  /* @__PURE__ */ e("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
@@ -1904,27 +1924,27 @@ function br({ records: r, className: n = "" }) {
1904
1924
  ")"
1905
1925
  ] })
1906
1926
  ] }) }),
1907
- /* @__PURE__ */ e("div", { className: "pvx-dash-records-list", children: s.map((t, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
1927
+ /* @__PURE__ */ e("div", { className: "pvx-dash-records-list", children: s.map((n, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
1908
1928
  /* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
1909
- /* @__PURE__ */ e("span", { className: "pvx-dash-record-track", children: E(t.trackId, t.layout, t.game) }),
1910
- /* @__PURE__ */ e("span", { className: "pvx-dash-record-car", children: I(t.carId) })
1929
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-track", children: F(n.trackId, n.layout, n.game) }),
1930
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-car", children: I(n.carId) })
1911
1931
  ] }),
1912
1932
  /* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
1913
- /* @__PURE__ */ e("span", { className: "pvx-dash-record-lap", children: B(t.lapTimeMs) }),
1914
- /* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${t.game || "evo"}`, children: [
1915
- (t.game || "evo").toUpperCase(),
1916
- t.gameVersion ? ` ${t.gameVersion}` : ""
1933
+ /* @__PURE__ */ e("span", { className: "pvx-dash-record-lap", children: B(n.lapTimeMs) }),
1934
+ /* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${n.game || "evo"}`, children: [
1935
+ (n.game || "evo").toUpperCase(),
1936
+ n.gameVersion ? ` ${n.gameVersion}` : ""
1917
1937
  ] })
1918
1938
  ] })
1919
1939
  ] }, a)) })
1920
1940
  ] }) : null;
1921
1941
  }
1922
- function yr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
1923
- if (n)
1942
+ function yr({ events: r, isLoading: t, className: s, limit: n = 3 }) {
1943
+ if (t)
1924
1944
  return /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading upcoming events..." });
1925
1945
  if (!(r != null && r.length))
1926
1946
  return null;
1927
- const a = t ? r.slice(0, t) : r, i = r.length - a.length;
1947
+ const a = n ? r.slice(0, n) : r, i = r.length - a.length;
1928
1948
  return /* @__PURE__ */ l("div", { className: `pvx-card ${s || ""}`, children: [
1929
1949
  /* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
1930
1950
  /* @__PURE__ */ e(Cr, {}),
@@ -1979,11 +1999,11 @@ function yr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
1979
1999
  ] })
1980
2000
  ] });
1981
2001
  }
1982
- function kr({ password: r, address: n }) {
1983
- const [s, t] = M(!1), [a, i] = M(!1), o = n ? r ? `join:${n}|${r}` : `join:${n}` : null, d = K(async () => {
2002
+ function kr({ password: r, address: t }) {
2003
+ const [s, n] = M(!1), [a, i] = M(!1), o = t ? r ? `join:${t}|${r}` : `join:${t}` : null, d = K(async () => {
1984
2004
  if (o)
1985
2005
  try {
1986
- await navigator.clipboard.writeText(o), t(!0), setTimeout(() => t(!1), 2e3);
2006
+ await navigator.clipboard.writeText(o), n(!0), setTimeout(() => n(!1), 2e3);
1987
2007
  } catch {
1988
2008
  }
1989
2009
  }, [o]);
@@ -2001,12 +2021,12 @@ function kr({ password: r, address: n }) {
2001
2021
  ]
2002
2022
  }
2003
2023
  ),
2004
- r && /* @__PURE__ */ l(A, { children: [
2024
+ r && /* @__PURE__ */ l(U, { children: [
2005
2025
  /* @__PURE__ */ e(
2006
2026
  "span",
2007
2027
  {
2008
2028
  className: "pvx-server-detail pvx-server-detail--clickable",
2009
- onClick: () => i((u) => !u),
2029
+ onClick: () => i((m) => !m),
2010
2030
  title: a ? "Hide password" : "Reveal password",
2011
2031
  children: a ? /* @__PURE__ */ e(Sr, {}) : /* @__PURE__ */ e(Tr, {})
2012
2032
  }
@@ -2020,19 +2040,19 @@ function kr({ password: r, address: n }) {
2020
2040
  ] });
2021
2041
  }
2022
2042
  function wr(r) {
2023
- const n = new Date(r).getTime() - Date.now();
2024
- if (n <= 0) return "Now";
2025
- const s = Math.floor(n / (1e3 * 60 * 60));
2043
+ const t = new Date(r).getTime() - Date.now();
2044
+ if (t <= 0) return "Now";
2045
+ const s = Math.floor(t / (1e3 * 60 * 60));
2026
2046
  if (s < 1) return "Less than 1 hour";
2027
2047
  if (s < 24) return `in ${s}h`;
2028
- const t = Math.floor(s / 24);
2029
- if (t === 1) return "Tomorrow";
2030
- if (t < 7) return `in ${t} days`;
2031
- if (t < 30) {
2032
- const a = Math.floor(t / 7);
2048
+ const n = Math.floor(s / 24);
2049
+ if (n === 1) return "Tomorrow";
2050
+ if (n < 7) return `in ${n} days`;
2051
+ if (n < 30) {
2052
+ const a = Math.floor(n / 7);
2033
2053
  return `in ${a} week${a !== 1 ? "s" : ""}`;
2034
2054
  }
2035
- return ie(r);
2055
+ return oe(r);
2036
2056
  }
2037
2057
  function Cr() {
2038
2058
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -2064,16 +2084,16 @@ function Sr() {
2064
2084
  /* @__PURE__ */ e("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2065
2085
  ] });
2066
2086
  }
2067
- function $r({ notifications: r, unreadCount: n = 0, onMarkRead: s, onMarkAllRead: t, isLoading: a, className: i }) {
2068
- const o = ce();
2087
+ function $r({ notifications: r, unreadCount: t = 0, onMarkRead: s, onMarkAllRead: n, isLoading: a, className: i }) {
2088
+ const o = le();
2069
2089
  return a ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
2070
2090
  /* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
2071
2091
  /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2072
2092
  /* @__PURE__ */ e(Dr, {}),
2073
2093
  "Notifications",
2074
- n > 0 && /* @__PURE__ */ e("span", { className: "pvx-notif-badge", children: n > 99 ? "99+" : n })
2094
+ t > 0 && /* @__PURE__ */ e("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
2075
2095
  ] }),
2076
- n > 0 && t && /* @__PURE__ */ e("button", { className: "pvx-notif-mark-all", onClick: t, children: "Mark all read" })
2096
+ t > 0 && n && /* @__PURE__ */ e("button", { className: "pvx-notif-mark-all", onClick: n, children: "Mark all read" })
2077
2097
  ] }),
2078
2098
  r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-notif-list", children: r.map((d) => /* @__PURE__ */ e(
2079
2099
  Mr,
@@ -2086,20 +2106,20 @@ function $r({ notifications: r, unreadCount: n = 0, onMarkRead: s, onMarkAllRead
2086
2106
  )) }) : /* @__PURE__ */ e("div", { className: "pvx-notif-empty", children: "No notifications" })
2087
2107
  ] });
2088
2108
  }
2089
- function Mr({ notification: r, getUserDisplay: n, onMarkRead: s }) {
2090
- const t = () => {
2109
+ function Mr({ notification: r, getUserDisplay: t, onMarkRead: s }) {
2110
+ const n = () => {
2091
2111
  !r.isRead && s && s(r.id);
2092
2112
  };
2093
2113
  return /* @__PURE__ */ l(
2094
2114
  "button",
2095
2115
  {
2096
2116
  className: `pvx-notif-item ${r.isRead ? "" : "pvx-notif-item--unread"}`,
2097
- onClick: t,
2117
+ onClick: n,
2098
2118
  children: [
2099
2119
  /* @__PURE__ */ e(Ir, { type: r.type }),
2100
2120
  /* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
2101
- /* @__PURE__ */ e("span", { className: "pvx-notif-message", children: Be(r, n) }),
2102
- /* @__PURE__ */ e("span", { className: "pvx-notif-time", children: ie(r.createdAt) })
2121
+ /* @__PURE__ */ e("span", { className: "pvx-notif-message", children: Be(r, t) }),
2122
+ /* @__PURE__ */ e("span", { className: "pvx-notif-time", children: oe(r.createdAt) })
2103
2123
  ] }),
2104
2124
  !r.isRead && /* @__PURE__ */ e("span", { className: "pvx-notif-dot" })
2105
2125
  ]
@@ -2125,29 +2145,29 @@ function Dr() {
2125
2145
  /* @__PURE__ */ e("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
2126
2146
  ] });
2127
2147
  }
2128
- function tn({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
2129
- const { data: a, isLoading: i, error: o } = cr(r), { data: d, isLoading: u } = lr(r), { data: c, isLoading: v } = dr(), x = pr(), { data: N, isLoading: p } = ur({ limit: 10 }), b = mr(), g = vr();
2130
- return i || u ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ e("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ l("div", { className: `pvx-dash ${t}`, children: [
2148
+ function nt({ steamId: r, avatarUrl: t, memberSince: s, className: n = "" }) {
2149
+ const { data: a, isLoading: i, error: o } = cr(r), { data: d, isLoading: m } = lr(r), { data: c, isLoading: h } = dr(), x = pr(), { data: f, isLoading: u } = ur({ limit: 10 }), y = mr(), g = vr();
2150
+ return i || m ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ e("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ l("div", { className: `pvx-dash ${n}`, children: [
2131
2151
  /* @__PURE__ */ e(
2132
2152
  hr,
2133
2153
  {
2134
2154
  driverName: a.driverName,
2135
- avatarUrl: n,
2155
+ avatarUrl: t,
2136
2156
  memberSince: s
2137
2157
  }
2138
2158
  ),
2139
2159
  /* @__PURE__ */ e(Nr, { stats: a, rating: d }),
2140
- r && /* @__PURE__ */ e(yr, { events: c, isLoading: v }),
2160
+ r && /* @__PURE__ */ e(yr, { events: c, isLoading: h }),
2141
2161
  /* @__PURE__ */ l("div", { className: `pvx-dash-row ${x ? "pvx-dash-row--2col" : ""}`, children: [
2142
2162
  /* @__PURE__ */ e(br, { records: a.currentRecords }),
2143
2163
  x && /* @__PURE__ */ e(
2144
2164
  $r,
2145
2165
  {
2146
- notifications: N == null ? void 0 : N.notifications,
2147
- unreadCount: (N == null ? void 0 : N.unreadCount) || 0,
2148
- onMarkRead: (m) => b.mutate(m),
2166
+ notifications: f == null ? void 0 : f.notifications,
2167
+ unreadCount: (f == null ? void 0 : f.unreadCount) || 0,
2168
+ onMarkRead: (v) => y.mutate(v),
2149
2169
  onMarkAllRead: () => g.mutate(),
2150
- isLoading: p
2170
+ isLoading: u
2151
2171
  }
2152
2172
  )
2153
2173
  ] })
@@ -2156,10 +2176,10 @@ function tn({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
2156
2176
  export {
2157
2177
  Wr as CarsTable,
2158
2178
  P as CompEmptyState,
2159
- j as CompLoadingState,
2179
+ V as CompLoadingState,
2160
2180
  Ze as CompetitionCard,
2161
2181
  Qr as CompetitionCards,
2162
- tn as DriverDashboard,
2182
+ nt as DriverDashboard,
2163
2183
  hr as DriverProfile,
2164
2184
  Or as DriversTable,
2165
2185
  Zr as EntryList,
@@ -2171,9 +2191,9 @@ export {
2171
2191
  zr as RankingsTable,
2172
2192
  br as RecordsTable,
2173
2193
  Xr as RegisterButton,
2174
- en as RegistrationPanel,
2194
+ et as RegistrationPanel,
2175
2195
  Jr as RoundResults,
2176
- nr as RoundSessionResults,
2196
+ tr as RoundSessionResults,
2177
2197
  Yr as StandingsTable,
2178
2198
  Nr as StatsCards,
2179
2199
  Hr as TracksTable,
@@ -2182,27 +2202,27 @@ export {
2182
2202
  Ie as buildLapsPath,
2183
2203
  J as buildLeaderboardPath,
2184
2204
  De as buildRecentLapsPath,
2185
- R as fetchCdnJson,
2205
+ T as fetchCdnJson,
2186
2206
  I as formatCarName,
2187
- F as formatDate,
2207
+ _ as formatDate,
2188
2208
  Er as formatDelta,
2189
2209
  B as formatLapTime,
2190
2210
  Be as formatNotificationMessage,
2191
- ie as formatRelativeTime,
2211
+ oe as formatRelativeTime,
2192
2212
  D as formatSectorTime,
2193
- E as formatTrackName,
2194
- oe as formatTyreCompound,
2213
+ F as formatTrackName,
2214
+ ce as formatTyreCompound,
2195
2215
  jr as useCarLeaderboard,
2196
2216
  _r as useCarMetadata,
2197
2217
  Kr as useCompetitionAllRounds,
2198
2218
  Ue as useCompetitionConfig,
2199
- le as useCompetitionEntryList,
2219
+ de as useCompetitionEntryList,
2200
2220
  Fe as useCompetitionRound,
2201
2221
  Ee as useCompetitionStandings,
2202
2222
  Vr as useCompetitions,
2203
2223
  Ae as useDriverLaps,
2204
2224
  lr as useDriverRating,
2205
- rn as useDriverRatings,
2225
+ rt as useDriverRatings,
2206
2226
  cr as useDriverStats,
2207
2227
  Fr as useLeaderboardIndex,
2208
2228
  vr as useMarkAllNotificationsRead,
@@ -2211,13 +2231,13 @@ export {
2211
2231
  pr as useNotificationsEnabled,
2212
2232
  k as usePitVox,
2213
2233
  qr as useRecentLaps,
2214
- de as useRegister,
2234
+ pe as useRegister,
2215
2235
  X as useRegistrationMode,
2216
2236
  Z as useRegistrationStatus,
2217
2237
  ee as useRegistrationUrl,
2218
2238
  Pe as useTrackLeaderboard,
2219
- nn as useUnreadCount,
2239
+ tt as useUnreadCount,
2220
2240
  dr as useUpcomingEvents,
2221
- ce as useUserLookup,
2222
- pe as useWithdraw
2241
+ le as useUserLookup,
2242
+ ue as useWithdraw
2223
2243
  };