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