@pitvox/partner-react 0.4.0 → 0.5.0

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