@pitvox/partner-react 0.5.1 → 0.5.3

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