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