@pitvox/partner-react 0.7.21 → 0.7.23
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 +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1801 -1275
- package/dist/styles.css +505 -0
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -1,94 +1,99 @@
|
|
|
1
|
-
import { jsx as n, jsxs as l, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as n, jsxs as l, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Qe, useMemo as T, useContext as Ye, useState as E, useEffect as $e, useCallback as H, useRef as Ze } from "react";
|
|
3
|
+
import { useQueryClient as V, QueryClient as Je, QueryClientProvider as Xe, useQuery as R, useMutation as G, useQueries as be } from "@tanstack/react-query";
|
|
4
|
+
import en from "react-markdown";
|
|
5
|
+
const oe = Qe(null), nn = "https://cdn.pitvox.com", tn = "https://pitvox.com";
|
|
6
|
+
let se = null;
|
|
7
|
+
function Zt({
|
|
7
8
|
partnerSlug: e = null,
|
|
8
|
-
cdnUrl: t =
|
|
9
|
-
pitvoxUrl:
|
|
10
|
-
getSteamId:
|
|
9
|
+
cdnUrl: t = nn,
|
|
10
|
+
pitvoxUrl: r = tn,
|
|
11
|
+
getSteamId: s,
|
|
11
12
|
onRegister: a,
|
|
12
|
-
onWithdraw:
|
|
13
|
-
onFetchNotifications:
|
|
13
|
+
onWithdraw: o,
|
|
14
|
+
onFetchNotifications: i,
|
|
14
15
|
onMarkNotificationRead: d,
|
|
15
16
|
onMarkAllNotificationsRead: p,
|
|
16
17
|
onFetchServerPassword: c,
|
|
17
|
-
|
|
18
|
+
onEnterPromotion: u,
|
|
19
|
+
onWithdrawPromotionEntry: v,
|
|
20
|
+
children: f
|
|
18
21
|
}) {
|
|
19
|
-
const
|
|
22
|
+
const h = T(() => ({
|
|
20
23
|
partnerSlug: e,
|
|
21
24
|
cdnUrl: t.replace(/\/$/, ""),
|
|
22
|
-
pitvoxUrl:
|
|
23
|
-
getSteamId:
|
|
25
|
+
pitvoxUrl: r.replace(/\/$/, ""),
|
|
26
|
+
getSteamId: s || (() => null),
|
|
24
27
|
onRegister: a || null,
|
|
25
|
-
onWithdraw:
|
|
26
|
-
onFetchNotifications:
|
|
28
|
+
onWithdraw: o || null,
|
|
29
|
+
onFetchNotifications: i || null,
|
|
27
30
|
onMarkNotificationRead: d || null,
|
|
28
31
|
onMarkAllNotificationsRead: p || null,
|
|
29
|
-
onFetchServerPassword: c || null
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
onFetchServerPassword: c || null,
|
|
33
|
+
onEnterPromotion: u || null,
|
|
34
|
+
onWithdrawPromotionEntry: v || null
|
|
35
|
+
}), [e, t, r, s, a, o, i, d, p, c, u, v]);
|
|
36
|
+
let y = !1;
|
|
32
37
|
try {
|
|
33
|
-
|
|
38
|
+
V(), y = !0;
|
|
34
39
|
} catch {
|
|
35
|
-
|
|
40
|
+
y = !1;
|
|
36
41
|
}
|
|
37
|
-
return
|
|
42
|
+
return y ? /* @__PURE__ */ n(oe.Provider, { value: h, children: f }) : (se || (se = new Je({
|
|
38
43
|
defaultOptions: {
|
|
39
44
|
queries: { staleTime: 6e4 }
|
|
40
45
|
}
|
|
41
|
-
})), /* @__PURE__ */ n(
|
|
46
|
+
})), /* @__PURE__ */ n(Xe, { client: se, children: /* @__PURE__ */ n(oe.Provider, { value: h, children: f }) }));
|
|
42
47
|
}
|
|
43
|
-
function
|
|
44
|
-
const e =
|
|
48
|
+
function S() {
|
|
49
|
+
const e = Ye(oe);
|
|
45
50
|
if (!e)
|
|
46
51
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
52
|
return e;
|
|
48
53
|
}
|
|
49
|
-
async function
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
throw new Error(`CDN fetch failed: ${
|
|
54
|
+
async function M(e, t) {
|
|
55
|
+
const r = await fetch(`${e}/${t}`);
|
|
56
|
+
if (!r.ok) {
|
|
57
|
+
if (r.status === 404 || r.status === 403) return null;
|
|
58
|
+
throw new Error(`CDN fetch failed: ${r.status}`);
|
|
54
59
|
}
|
|
55
|
-
return
|
|
60
|
+
return r.json();
|
|
56
61
|
}
|
|
57
|
-
function
|
|
62
|
+
function de(e, t, r, ...s) {
|
|
58
63
|
const a = ["leaderboards"];
|
|
59
|
-
return e && a.push(`partners/${e}`), t && a.push(t),
|
|
64
|
+
return e && a.push(`partners/${e}`), t && a.push(t), r && a.push(`v/${r}`), [...a, ...s].join("/");
|
|
60
65
|
}
|
|
61
|
-
function
|
|
62
|
-
const a =
|
|
63
|
-
return e ? `laps/partners/${e}/${t}/${
|
|
66
|
+
function rn(e, t, r, s) {
|
|
67
|
+
const a = s || "default";
|
|
68
|
+
return e ? `laps/partners/${e}/${t}/${r}/${a}.json` : `laps/${t}/${r}/${a}.json`;
|
|
64
69
|
}
|
|
65
|
-
function
|
|
70
|
+
function Te(e, t) {
|
|
66
71
|
return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
|
|
67
72
|
}
|
|
68
|
-
function
|
|
73
|
+
function sn(e) {
|
|
69
74
|
return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
|
|
70
75
|
}
|
|
71
76
|
function q(e) {
|
|
72
77
|
if (!e && e !== 0) return "-";
|
|
73
|
-
const t = Math.floor(e / 1e3),
|
|
74
|
-
return `${
|
|
78
|
+
const t = Math.floor(e / 1e3), r = Math.floor(t / 60), s = t % 60, a = e % 1e3;
|
|
79
|
+
return `${r}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
|
|
75
80
|
}
|
|
76
|
-
function
|
|
81
|
+
function F(e) {
|
|
77
82
|
return !e && e !== 0 ? "-" : e >= 6e4 ? q(e) : (e / 1e3).toFixed(3);
|
|
78
83
|
}
|
|
79
84
|
function I(e) {
|
|
80
85
|
if (!e) return "";
|
|
81
86
|
let t = e;
|
|
82
|
-
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((
|
|
87
|
+
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
|
|
83
88
|
}
|
|
84
|
-
function
|
|
89
|
+
function z(e, t, r) {
|
|
85
90
|
if (!e) return "";
|
|
86
|
-
const
|
|
87
|
-
if (!t || t === "default" || a) return
|
|
88
|
-
const
|
|
89
|
-
return `${
|
|
91
|
+
const s = e.split("_").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" "), a = r === "acc" || !r && (t == null ? void 0 : t.toLowerCase()) === "track config";
|
|
92
|
+
if (!t || t === "default" || a) return s;
|
|
93
|
+
const o = t.split("_").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
|
|
94
|
+
return `${s} ${o}`;
|
|
90
95
|
}
|
|
91
|
-
function
|
|
96
|
+
function Q(e) {
|
|
92
97
|
if (!e) return "-";
|
|
93
98
|
try {
|
|
94
99
|
return new Date(e).toLocaleDateString("en-GB", {
|
|
@@ -100,25 +105,25 @@ function W(e) {
|
|
|
100
105
|
return "-";
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
function
|
|
108
|
+
function pe(e) {
|
|
104
109
|
if (!e) return "";
|
|
105
|
-
const t = Date.now() - new Date(e).getTime(),
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const a = Math.floor(
|
|
110
|
+
const t = Date.now() - new Date(e).getTime(), r = Math.floor(t / 1e3);
|
|
111
|
+
if (r < 60) return "Just now";
|
|
112
|
+
const s = Math.floor(r / 60);
|
|
113
|
+
if (s < 60) return `${s}m ago`;
|
|
114
|
+
const a = Math.floor(s / 60);
|
|
110
115
|
if (a < 24) return `${a}h ago`;
|
|
111
|
-
const
|
|
112
|
-
return
|
|
116
|
+
const o = Math.floor(a / 24);
|
|
117
|
+
return o < 30 ? `${o}d ago` : Q(e);
|
|
113
118
|
}
|
|
114
|
-
function
|
|
119
|
+
function Jt(e) {
|
|
115
120
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
121
|
}
|
|
117
|
-
function
|
|
118
|
-
const { type:
|
|
119
|
-
return
|
|
122
|
+
function an(e, t) {
|
|
123
|
+
const { type: r, title: s, trackId: a, trackLayout: o, carId: i, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? z(a, o, d) : null, v = i ? I(i) : null, f = [u, v].filter(Boolean).join(" — ");
|
|
124
|
+
return r === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : r === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
|
|
120
125
|
}
|
|
121
|
-
function
|
|
126
|
+
function Re(e) {
|
|
122
127
|
return e ? {
|
|
123
128
|
E: "Eco",
|
|
124
129
|
RD: "Road",
|
|
@@ -132,519 +137,1028 @@ function ke(e) {
|
|
|
132
137
|
S: "Soft"
|
|
133
138
|
}[e] || e : "Unknown";
|
|
134
139
|
}
|
|
135
|
-
function
|
|
140
|
+
function Me(e) {
|
|
136
141
|
if (!e) return "-";
|
|
137
142
|
const t = Number(e);
|
|
138
143
|
return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
|
|
139
144
|
}
|
|
140
|
-
function
|
|
145
|
+
function on(e = {}) {
|
|
141
146
|
var p, c, u, v, f, h;
|
|
142
|
-
const { cdnUrl: t, partnerSlug:
|
|
143
|
-
queryKey: ["pitvox", "leaderboards",
|
|
144
|
-
queryFn: () =>
|
|
147
|
+
const { cdnUrl: t, partnerSlug: r } = S(), { game: s, gameVersion: a } = e, o = de(r, null, null, "index.json"), i = R({
|
|
148
|
+
queryKey: ["pitvox", "leaderboards", r, "index"],
|
|
149
|
+
queryFn: () => M(t, o),
|
|
145
150
|
staleTime: 3e4,
|
|
146
151
|
refetchInterval: 3e4
|
|
147
|
-
}), d =
|
|
152
|
+
}), d = T(() => {
|
|
148
153
|
var x;
|
|
149
|
-
if (!((x =
|
|
150
|
-
let
|
|
151
|
-
return
|
|
152
|
-
id:
|
|
153
|
-
layout:
|
|
154
|
-
game:
|
|
155
|
-
gameVersion:
|
|
156
|
-
displayName:
|
|
157
|
-
driverCount:
|
|
158
|
-
carCount:
|
|
159
|
-
record:
|
|
160
|
-
visibleId:
|
|
161
|
-
carId:
|
|
162
|
-
carDisplayName: I(
|
|
163
|
-
lapTimeMs:
|
|
164
|
-
timestamp:
|
|
154
|
+
if (!((x = i.data) != null && x.tracks)) return [];
|
|
155
|
+
let y = i.data.tracks;
|
|
156
|
+
return s && (y = y.filter((m) => m.game === s)), a && (y = y.filter((m) => m.gameVersion === a)), y.map((m) => ({
|
|
157
|
+
id: m.trackId,
|
|
158
|
+
layout: m.layout,
|
|
159
|
+
game: m.game,
|
|
160
|
+
gameVersion: m.gameVersion,
|
|
161
|
+
displayName: z(m.trackId, m.layout, m.game),
|
|
162
|
+
driverCount: m.driverCount || 0,
|
|
163
|
+
carCount: m.carCount || 0,
|
|
164
|
+
record: m.recordHolder ? {
|
|
165
|
+
visibleId: m.recordHolder.steamId || m.recordHolder.userId,
|
|
166
|
+
carId: m.recordHolder.carId,
|
|
167
|
+
carDisplayName: I(m.recordHolder.carId),
|
|
168
|
+
lapTimeMs: m.recordHolder.lapTimeMs,
|
|
169
|
+
timestamp: m.recordHolder.recordedAt
|
|
165
170
|
} : null,
|
|
166
|
-
recordByTag:
|
|
171
|
+
recordByTag: m.recordByTag || null
|
|
167
172
|
}));
|
|
168
|
-
}, [(p =
|
|
173
|
+
}, [(p = i.data) == null ? void 0 : p.tracks, s, a]);
|
|
169
174
|
return {
|
|
170
|
-
...
|
|
175
|
+
...i,
|
|
171
176
|
data: d,
|
|
172
|
-
partner: ((c =
|
|
173
|
-
generatedAt: (u =
|
|
174
|
-
totalLaps: ((v =
|
|
175
|
-
totalUsers: ((f =
|
|
176
|
-
versions: ((h =
|
|
177
|
+
partner: ((c = i.data) == null ? void 0 : c.partner) || null,
|
|
178
|
+
generatedAt: (u = i.data) == null ? void 0 : u.generatedAt,
|
|
179
|
+
totalLaps: ((v = i.data) == null ? void 0 : v.totalLaps) || 0,
|
|
180
|
+
totalUsers: ((f = i.data) == null ? void 0 : f.totalUsers) || 0,
|
|
181
|
+
versions: ((h = i.data) == null ? void 0 : h.versions) || {}
|
|
177
182
|
};
|
|
178
183
|
}
|
|
179
|
-
function
|
|
180
|
-
const { cdnUrl:
|
|
181
|
-
queryKey: ["pitvox", "leaderboards", a, "track", e, p,
|
|
182
|
-
queryFn: () =>
|
|
184
|
+
function ln(e, t, r = {}) {
|
|
185
|
+
const { cdnUrl: s, partnerSlug: a } = S(), { carId: o, game: i, gameVersion: d } = r, p = t || "default", c = de(a, i, d, `tracks/${e}/${p}.json`), { data: u, isLoading: v, error: f } = R({
|
|
186
|
+
queryKey: ["pitvox", "leaderboards", a, "track", e, p, i, d],
|
|
187
|
+
queryFn: () => M(s, c),
|
|
183
188
|
enabled: !!e,
|
|
184
189
|
staleTime: 3e4,
|
|
185
190
|
refetchInterval: 3e4
|
|
186
191
|
});
|
|
187
|
-
return { data:
|
|
192
|
+
return { data: T(() => {
|
|
188
193
|
if (!(u != null && u.entries)) return [];
|
|
189
|
-
let
|
|
190
|
-
if (
|
|
191
|
-
const x = /* @__PURE__ */ new Map(),
|
|
192
|
-
for (const
|
|
193
|
-
const
|
|
194
|
-
|
|
194
|
+
let y = u.entries;
|
|
195
|
+
if (i && (y = y.filter((x) => x.game === i)), !o) {
|
|
196
|
+
const x = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const b of y) {
|
|
198
|
+
const g = b.steamId || b.userId;
|
|
199
|
+
m.has(b.carId) || m.set(b.carId, /* @__PURE__ */ new Set()), m.get(b.carId).add(g), (!x.has(b.carId) || b.lapTimeMs < x.get(b.carId).lapTimeMs) && x.set(b.carId, b);
|
|
195
200
|
}
|
|
196
|
-
return Array.from(x.values()).map((
|
|
197
|
-
var
|
|
198
|
-
return { ...
|
|
199
|
-
}).sort((
|
|
201
|
+
return Array.from(x.values()).map((b) => {
|
|
202
|
+
var g;
|
|
203
|
+
return { ...b, driverCount: ((g = m.get(b.carId)) == null ? void 0 : g.size) || 0 };
|
|
204
|
+
}).sort((b, g) => b.lapTimeMs - g.lapTimeMs);
|
|
200
205
|
}
|
|
201
|
-
return
|
|
202
|
-
}, [u == null ? void 0 : u.entries,
|
|
203
|
-
}
|
|
204
|
-
function
|
|
205
|
-
var x,
|
|
206
|
-
const { cdnUrl:
|
|
207
|
-
queryKey: ["pitvox", "laps",
|
|
208
|
-
queryFn: () =>
|
|
206
|
+
return y.filter((x) => x.carId === o).sort((x, m) => x.lapTimeMs - m.lapTimeMs);
|
|
207
|
+
}, [u == null ? void 0 : u.entries, o, i]), isLoading: v, error: f };
|
|
208
|
+
}
|
|
209
|
+
function cn(e, t, r, s, a = {}) {
|
|
210
|
+
var x, m;
|
|
211
|
+
const { cdnUrl: o, partnerSlug: i } = S(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && t ? rn(i, e, t, r) : null, f = R({
|
|
212
|
+
queryKey: ["pitvox", "laps", i, e, t, r || "default"],
|
|
213
|
+
queryFn: () => M(o, u),
|
|
209
214
|
enabled: !!e && !!t,
|
|
210
215
|
staleTime: 3e4,
|
|
211
216
|
refetchInterval: 3e4
|
|
212
|
-
}), h =
|
|
213
|
-
var
|
|
214
|
-
return (
|
|
215
|
-
}, [(x = f.data) == null ? void 0 : x.laps,
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
219
|
-
return
|
|
217
|
+
}), h = T(() => {
|
|
218
|
+
var b;
|
|
219
|
+
return (b = f.data) != null && b.laps ? f.data.laps.filter((g) => !(g.carId !== s || p && g.game !== p || c && g.gameVersion !== c || !d && !g.isValid)).sort((g, k) => g.lapTimeMs - k.lapTimeMs) : [];
|
|
220
|
+
}, [(x = f.data) == null ? void 0 : x.laps, s, p, c, d]), y = T(() => {
|
|
221
|
+
const b = h.filter((N) => N.isValid && N.sector1Ms && N.sector2Ms && N.sector3Ms);
|
|
222
|
+
if (b.length < 2) return null;
|
|
223
|
+
const g = Math.min(...b.map((N) => N.sector1Ms)), k = Math.min(...b.map((N) => N.sector2Ms)), C = Math.min(...b.map((N) => N.sector3Ms)), P = g + k + C, A = Math.min(...b.map((N) => N.lapTimeMs));
|
|
224
|
+
return P >= A ? null : { lapTimeMs: P, sector1Ms: g, sector2Ms: k, sector3Ms: C };
|
|
220
225
|
}, [h]);
|
|
221
226
|
return {
|
|
222
227
|
...f,
|
|
223
228
|
data: h,
|
|
224
|
-
driverName: ((
|
|
225
|
-
theoreticalBest:
|
|
229
|
+
driverName: ((m = f.data) == null ? void 0 : m.driverName) || "Driver",
|
|
230
|
+
theoreticalBest: y
|
|
226
231
|
};
|
|
227
232
|
}
|
|
228
|
-
function
|
|
229
|
-
const { cdnUrl: e } =
|
|
233
|
+
function ue() {
|
|
234
|
+
const { cdnUrl: e } = S(), { data: t } = R({
|
|
230
235
|
queryKey: ["pitvox", "users", "index"],
|
|
231
|
-
queryFn: () =>
|
|
236
|
+
queryFn: () => M(e, "users/index.json"),
|
|
232
237
|
staleTime: 5 * 6e4,
|
|
233
238
|
gcTime: 30 * 6e4
|
|
234
|
-
}),
|
|
235
|
-
return (
|
|
236
|
-
const
|
|
239
|
+
}), r = (t == null ? void 0 : t.users) || {};
|
|
240
|
+
return (s, a) => {
|
|
241
|
+
const o = r[s];
|
|
237
242
|
return {
|
|
238
|
-
displayName: (
|
|
239
|
-
avatarUrl: (
|
|
240
|
-
affiliations: (
|
|
243
|
+
displayName: (o == null ? void 0 : o.displayName) || a || s || "Unknown",
|
|
244
|
+
avatarUrl: (o == null ? void 0 : o.avatarUrl) || null,
|
|
245
|
+
affiliations: (o == null ? void 0 : o.affiliations) || []
|
|
241
246
|
};
|
|
242
247
|
};
|
|
243
248
|
}
|
|
244
|
-
function
|
|
245
|
-
const { cdnUrl: t } =
|
|
249
|
+
function Xt(e = "evo") {
|
|
250
|
+
const { cdnUrl: t } = S(), { data: r } = R({
|
|
246
251
|
queryKey: ["pitvox", "cars", e],
|
|
247
|
-
queryFn: () =>
|
|
252
|
+
queryFn: () => M(t, `cars/${e}.json`),
|
|
248
253
|
staleTime: 5 * 6e4,
|
|
249
254
|
gcTime: 30 * 6e4
|
|
250
255
|
});
|
|
251
256
|
return {
|
|
252
|
-
tags: (
|
|
253
|
-
cars: (
|
|
254
|
-
categories: (
|
|
255
|
-
tagLabels: (
|
|
257
|
+
tags: (r == null ? void 0 : r.tags) || [],
|
|
258
|
+
cars: (r == null ? void 0 : r.cars) || {},
|
|
259
|
+
categories: (r == null ? void 0 : r.categories) || [],
|
|
260
|
+
tagLabels: (r == null ? void 0 : r.tagLabels) || {}
|
|
256
261
|
};
|
|
257
262
|
}
|
|
258
|
-
function
|
|
259
|
-
var a,
|
|
260
|
-
const { cdnUrl: e, partnerSlug: t } =
|
|
263
|
+
function er() {
|
|
264
|
+
var a, o;
|
|
265
|
+
const { cdnUrl: e, partnerSlug: t } = S(), r = sn(t), s = R({
|
|
261
266
|
queryKey: ["pitvox", "recentLaps", t],
|
|
262
|
-
queryFn: () =>
|
|
267
|
+
queryFn: () => M(e, r),
|
|
263
268
|
staleTime: 3e4,
|
|
264
269
|
refetchInterval: 3e4,
|
|
265
270
|
gcTime: 10 * 6e4
|
|
266
271
|
});
|
|
267
272
|
return {
|
|
268
|
-
groups: ((a =
|
|
269
|
-
generatedAt: ((
|
|
270
|
-
isLoading:
|
|
273
|
+
groups: ((a = s.data) == null ? void 0 : a.groups) || [],
|
|
274
|
+
generatedAt: ((o = s.data) == null ? void 0 : o.generatedAt) || null,
|
|
275
|
+
isLoading: s.isLoading
|
|
271
276
|
};
|
|
272
277
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
278
|
+
function nr(e, t) {
|
|
279
|
+
return ln(e, null, { carId: t });
|
|
275
280
|
}
|
|
276
|
-
function
|
|
277
|
-
const { cdnUrl: e, partnerSlug: t } =
|
|
278
|
-
return
|
|
281
|
+
function tr() {
|
|
282
|
+
const { cdnUrl: e, partnerSlug: t } = S();
|
|
283
|
+
return R({
|
|
279
284
|
queryKey: ["pitvox", "competitions", t],
|
|
280
285
|
queryFn: async () => {
|
|
281
|
-
const
|
|
282
|
-
return
|
|
286
|
+
const r = await M(e, "competitions/index.json");
|
|
287
|
+
return r != null && r.competitions ? t ? r.competitions.filter((s) => s.partnerSlug === t) : r.competitions : [];
|
|
283
288
|
},
|
|
284
289
|
staleTime: 6e4
|
|
285
290
|
});
|
|
286
291
|
}
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
queryKey: ["pitvox", "competition",
|
|
291
|
-
queryFn: () =>
|
|
292
|
-
enabled: !!
|
|
292
|
+
function Pe(e, t = {}) {
|
|
293
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
294
|
+
return R({
|
|
295
|
+
queryKey: ["pitvox", "competition", s, e, "config"],
|
|
296
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/config.json`),
|
|
297
|
+
enabled: !!s && !!e,
|
|
293
298
|
staleTime: 6e4
|
|
294
299
|
});
|
|
295
300
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
return
|
|
299
|
-
queryKey: ["pitvox", "competition",
|
|
300
|
-
queryFn: () =>
|
|
301
|
-
enabled: !!
|
|
301
|
+
function De(e, t = {}) {
|
|
302
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
303
|
+
return R({
|
|
304
|
+
queryKey: ["pitvox", "competition", s, e, "standings"],
|
|
305
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/standings.json`),
|
|
306
|
+
enabled: !!s && !!e,
|
|
302
307
|
staleTime: 6e4
|
|
303
308
|
});
|
|
304
309
|
}
|
|
305
|
-
function
|
|
306
|
-
const
|
|
307
|
-
return
|
|
310
|
+
function dn(e, t, r = {}) {
|
|
311
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
312
|
+
return R({
|
|
308
313
|
queryKey: ["pitvox", "competition", a, e, "round", t],
|
|
309
|
-
queryFn: () =>
|
|
314
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
|
|
310
315
|
enabled: !!a && !!e && t != null,
|
|
311
316
|
staleTime: 6e4
|
|
312
317
|
});
|
|
313
318
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
return
|
|
319
|
+
function pn(e, t = [], r = {}) {
|
|
320
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
321
|
+
return R({
|
|
317
322
|
queryKey: ["pitvox", "competition", a, e, "allRounds", t],
|
|
318
323
|
queryFn: async () => (await Promise.all(
|
|
319
324
|
t.map(
|
|
320
|
-
(
|
|
325
|
+
(i) => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${i}.json`).catch(() => null)
|
|
321
326
|
)
|
|
322
327
|
)).filter(Boolean),
|
|
323
328
|
enabled: !!a && !!e && t.length > 0,
|
|
324
329
|
staleTime: 6e4
|
|
325
330
|
});
|
|
326
331
|
}
|
|
327
|
-
function
|
|
328
|
-
const
|
|
329
|
-
return
|
|
330
|
-
queryKey: ["pitvox", "competition",
|
|
331
|
-
queryFn: () =>
|
|
332
|
-
enabled: !!
|
|
332
|
+
function un(e, t = {}) {
|
|
333
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
334
|
+
return R({
|
|
335
|
+
queryKey: ["pitvox", "competition", s, e, "leaderboard"],
|
|
336
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
|
|
337
|
+
enabled: !!s && !!e,
|
|
333
338
|
staleTime: 6e4
|
|
334
339
|
});
|
|
335
340
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
return
|
|
341
|
+
function hn(e, t, r = {}) {
|
|
342
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
343
|
+
return R({
|
|
339
344
|
queryKey: ["pitvox", "competition", a, e, "round", t, "leaderboard"],
|
|
340
|
-
queryFn: () =>
|
|
345
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/leaderboard.json`).catch(() => null),
|
|
341
346
|
enabled: !!a && !!e && t != null,
|
|
342
347
|
staleTime: 6e4
|
|
343
348
|
});
|
|
344
349
|
}
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
return
|
|
350
|
+
function mn(e, t, r = {}) {
|
|
351
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
352
|
+
return R({
|
|
348
353
|
queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
|
|
349
|
-
queryFn: () =>
|
|
354
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
|
|
350
355
|
enabled: !!a && !!e && t != null,
|
|
351
356
|
staleTime: 6e4
|
|
352
357
|
});
|
|
353
358
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
return
|
|
359
|
+
function vn(e, t, r = {}) {
|
|
360
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
361
|
+
return R({
|
|
357
362
|
queryKey: ["pitvox", "competition", a, e, "round", t, "positions"],
|
|
358
|
-
queryFn: () =>
|
|
359
|
-
enabled: (
|
|
363
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/positions.json`).catch(() => null),
|
|
364
|
+
enabled: (r.enabled ?? !0) && !!a && !!e && t != null,
|
|
360
365
|
staleTime: 6e4
|
|
361
366
|
});
|
|
362
367
|
}
|
|
363
|
-
function
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
queryKey: ["pitvox", "competition",
|
|
367
|
-
queryFn: () =>
|
|
368
|
-
enabled: !!
|
|
368
|
+
function Ae(e, t = {}) {
|
|
369
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
370
|
+
return R({
|
|
371
|
+
queryKey: ["pitvox", "competition", s, e, "entrylist"],
|
|
372
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
|
|
373
|
+
enabled: !!s && !!e,
|
|
369
374
|
staleTime: 6e4
|
|
370
375
|
});
|
|
371
376
|
}
|
|
372
|
-
function
|
|
373
|
-
const { cdnUrl: t, partnerSlug:
|
|
374
|
-
return
|
|
375
|
-
queryKey: ["pitvox", "registration",
|
|
377
|
+
function he(e) {
|
|
378
|
+
const { cdnUrl: t, partnerSlug: r, getSteamId: s } = S(), a = s();
|
|
379
|
+
return R({
|
|
380
|
+
queryKey: ["pitvox", "registration", r, e, a],
|
|
376
381
|
queryFn: async () => {
|
|
377
382
|
var p;
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const
|
|
381
|
-
return { isRegistered: !!a && ((p =
|
|
383
|
+
const o = await fetch(`${t}/competitions/${r}/${e}/entrylist.json`);
|
|
384
|
+
if (!o.ok) return { isRegistered: !1, entryList: null };
|
|
385
|
+
const i = await o.json();
|
|
386
|
+
return { isRegistered: !!a && ((p = i.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: i };
|
|
382
387
|
},
|
|
383
388
|
enabled: !!e,
|
|
384
389
|
staleTime: 6e4
|
|
385
390
|
});
|
|
386
391
|
}
|
|
387
|
-
function
|
|
388
|
-
const { onRegister: t, partnerSlug:
|
|
389
|
-
return
|
|
390
|
-
mutationFn: (
|
|
392
|
+
function Ee(e) {
|
|
393
|
+
const { onRegister: t, partnerSlug: r, getSteamId: s } = S(), a = V(), o = ue();
|
|
394
|
+
return G({
|
|
395
|
+
mutationFn: (i) => {
|
|
391
396
|
if (!t)
|
|
392
397
|
throw new Error(
|
|
393
398
|
"No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
|
|
394
399
|
);
|
|
395
|
-
return t(e,
|
|
400
|
+
return t(e, i);
|
|
396
401
|
},
|
|
397
402
|
onSuccess: () => {
|
|
398
|
-
const
|
|
403
|
+
const i = s();
|
|
399
404
|
if (a.setQueriesData(
|
|
400
|
-
{ queryKey: ["pitvox", "registration",
|
|
405
|
+
{ queryKey: ["pitvox", "registration", r, e] },
|
|
401
406
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
402
|
-
),
|
|
403
|
-
const d = i
|
|
404
|
-
steamId:
|
|
407
|
+
), i) {
|
|
408
|
+
const d = o(i), p = {
|
|
409
|
+
steamId: i,
|
|
405
410
|
displayName: d.displayName,
|
|
406
411
|
avatarUrl: d.avatarUrl
|
|
407
412
|
};
|
|
408
413
|
a.setQueriesData(
|
|
409
|
-
{ queryKey: ["pitvox", "competition",
|
|
414
|
+
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
410
415
|
(c) => {
|
|
411
416
|
var v;
|
|
412
|
-
return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId ===
|
|
417
|
+
return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId === i)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
|
|
413
418
|
}
|
|
414
419
|
);
|
|
415
420
|
}
|
|
416
421
|
}
|
|
417
422
|
});
|
|
418
423
|
}
|
|
419
|
-
function
|
|
420
|
-
const { onWithdraw: t, partnerSlug:
|
|
421
|
-
return
|
|
422
|
-
mutationFn: (
|
|
424
|
+
function Be(e) {
|
|
425
|
+
const { onWithdraw: t, partnerSlug: r, getSteamId: s } = S(), a = V();
|
|
426
|
+
return G({
|
|
427
|
+
mutationFn: (o) => {
|
|
423
428
|
if (!t)
|
|
424
429
|
throw new Error(
|
|
425
430
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
426
431
|
);
|
|
427
|
-
const
|
|
428
|
-
if (!
|
|
429
|
-
return t(e,
|
|
432
|
+
const i = o || s();
|
|
433
|
+
if (!i) throw new Error("No Steam ID available");
|
|
434
|
+
return t(e, i);
|
|
430
435
|
},
|
|
431
436
|
onSuccess: () => {
|
|
432
|
-
const
|
|
437
|
+
const o = s();
|
|
433
438
|
a.setQueriesData(
|
|
434
|
-
{ queryKey: ["pitvox", "registration",
|
|
435
|
-
(
|
|
436
|
-
),
|
|
437
|
-
{ queryKey: ["pitvox", "competition",
|
|
438
|
-
(
|
|
439
|
+
{ queryKey: ["pitvox", "registration", r, e] },
|
|
440
|
+
(i) => i ? { ...i, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
441
|
+
), o && a.setQueriesData(
|
|
442
|
+
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
443
|
+
(i) => i != null && i.drivers ? { ...i, drivers: i.drivers.filter((d) => d.steamId !== o) } : i
|
|
439
444
|
);
|
|
440
445
|
}
|
|
441
446
|
});
|
|
442
447
|
}
|
|
443
|
-
function
|
|
444
|
-
const { onRegister: e, onWithdraw: t } =
|
|
445
|
-
return { isPowerMode:
|
|
448
|
+
function me() {
|
|
449
|
+
const { onRegister: e, onWithdraw: t } = S(), r = !!(e && t);
|
|
450
|
+
return { isPowerMode: r, isBasicMode: !r };
|
|
451
|
+
}
|
|
452
|
+
function ve(e) {
|
|
453
|
+
const { pitvoxUrl: t, partnerSlug: r } = S();
|
|
454
|
+
return `${t}/p/${r}/competitions/${e}/register`;
|
|
455
|
+
}
|
|
456
|
+
function J(e, t = /* @__PURE__ */ new Date()) {
|
|
457
|
+
var r;
|
|
458
|
+
return e.winnersAnnouncedAt || (r = e.winners) != null && r.length ? "winners" : e.opensAt && t < new Date(e.opensAt) ? "upcoming" : e.closesAt && t >= new Date(e.closesAt) ? "closed" : "open";
|
|
446
459
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
460
|
+
const xn = {
|
|
461
|
+
upcoming: "Opens soon",
|
|
462
|
+
open: "Open",
|
|
463
|
+
closed: "Closed",
|
|
464
|
+
winners: "Winners announced"
|
|
465
|
+
};
|
|
466
|
+
function gn() {
|
|
467
|
+
const { cdnUrl: e, partnerSlug: t } = S();
|
|
468
|
+
return R({
|
|
469
|
+
queryKey: ["pitvox", "promotions", t],
|
|
470
|
+
queryFn: async () => {
|
|
471
|
+
const r = await M(e, "promotions/index.json");
|
|
472
|
+
return r != null && r.promotions ? t ? r.promotions.filter((s) => s.partnerSlug === t) : r.promotions : [];
|
|
473
|
+
},
|
|
474
|
+
staleTime: 6e4
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
function fn(e, t = {}) {
|
|
478
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
479
|
+
return R({
|
|
480
|
+
queryKey: ["pitvox", "promotion", s, e, "config"],
|
|
481
|
+
queryFn: () => M(r.cdnUrl, `promotions/${s}/${e}/config.json`),
|
|
482
|
+
enabled: !!s && !!e,
|
|
483
|
+
staleTime: 6e4
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function Nn(e, t = {}) {
|
|
487
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
488
|
+
return R({
|
|
489
|
+
queryKey: ["pitvox", "promotion", s, e, "entrylist"],
|
|
490
|
+
queryFn: () => M(r.cdnUrl, `promotions/${s}/${e}/entrylist.json`),
|
|
491
|
+
enabled: !!s && !!e,
|
|
492
|
+
staleTime: 6e4
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
function yn(e) {
|
|
496
|
+
const { cdnUrl: t, partnerSlug: r, getSteamId: s } = S(), a = s();
|
|
497
|
+
return R({
|
|
498
|
+
queryKey: ["pitvox", "promotionEntry", r, e, a],
|
|
499
|
+
queryFn: async () => {
|
|
500
|
+
var d;
|
|
501
|
+
const o = await M(t, `promotions/${r}/${e}/entrylist.json`);
|
|
502
|
+
return o ? { isEntered: !!a && ((d = o.entrants) == null ? void 0 : d.some((p) => p.steamId === a)), entryList: o } : { isEntered: !1, entryList: null };
|
|
503
|
+
},
|
|
504
|
+
enabled: !!e,
|
|
505
|
+
staleTime: 6e4
|
|
506
|
+
});
|
|
450
507
|
}
|
|
451
|
-
function
|
|
452
|
-
|
|
453
|
-
|
|
508
|
+
function bn(e) {
|
|
509
|
+
const { onEnterPromotion: t, partnerSlug: r, getSteamId: s } = S(), a = V(), o = ue();
|
|
510
|
+
return G({
|
|
511
|
+
mutationFn: (i) => {
|
|
512
|
+
if (!t)
|
|
513
|
+
throw new Error(
|
|
514
|
+
"No onEnterPromotion callback provided to PitVoxPartnerProvider. Provide onEnterPromotion for in-app entry, or use usePromotionUrl() to link to pitvox.com."
|
|
515
|
+
);
|
|
516
|
+
return t(e, i);
|
|
517
|
+
},
|
|
518
|
+
onSuccess: () => {
|
|
519
|
+
const i = s();
|
|
520
|
+
if (a.setQueriesData(
|
|
521
|
+
{ queryKey: ["pitvox", "promotionEntry", r, e] },
|
|
522
|
+
(d) => d ? { ...d, isEntered: !0 } : { isEntered: !0, entryList: null }
|
|
523
|
+
), i) {
|
|
524
|
+
const d = o(i), p = {
|
|
525
|
+
steamId: i,
|
|
526
|
+
displayName: d.displayName,
|
|
527
|
+
avatarUrl: d.avatarUrl
|
|
528
|
+
};
|
|
529
|
+
a.setQueriesData(
|
|
530
|
+
{ queryKey: ["pitvox", "promotion", r, e, "entrylist"] },
|
|
531
|
+
(c) => {
|
|
532
|
+
var f;
|
|
533
|
+
if (!c) return { entrants: [p], count: 1 };
|
|
534
|
+
if ((f = c.entrants) == null ? void 0 : f.some((h) => h.steamId === i)) return c;
|
|
535
|
+
const v = [...c.entrants || [], p];
|
|
536
|
+
return { ...c, entrants: v, count: v.length };
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
function wn(e) {
|
|
544
|
+
const { onWithdrawPromotionEntry: t, partnerSlug: r, getSteamId: s } = S(), a = V();
|
|
545
|
+
return G({
|
|
546
|
+
mutationFn: (o) => {
|
|
547
|
+
if (!t)
|
|
548
|
+
throw new Error(
|
|
549
|
+
"No onWithdrawPromotionEntry callback provided to PitVoxPartnerProvider. Provide onWithdrawPromotionEntry for in-app withdrawal, or use usePromotionUrl() to link to pitvox.com."
|
|
550
|
+
);
|
|
551
|
+
const i = o || s();
|
|
552
|
+
if (!i) throw new Error("No Steam ID available");
|
|
553
|
+
return t(e, i);
|
|
554
|
+
},
|
|
555
|
+
onSuccess: () => {
|
|
556
|
+
const o = s();
|
|
557
|
+
a.setQueriesData(
|
|
558
|
+
{ queryKey: ["pitvox", "promotionEntry", r, e] },
|
|
559
|
+
(i) => i ? { ...i, isEntered: !1 } : { isEntered: !1, entryList: null }
|
|
560
|
+
), o && a.setQueriesData(
|
|
561
|
+
{ queryKey: ["pitvox", "promotion", r, e, "entrylist"] },
|
|
562
|
+
(i) => {
|
|
563
|
+
if (!(i != null && i.entrants)) return i;
|
|
564
|
+
const d = i.entrants.filter((p) => p.steamId !== o);
|
|
565
|
+
return { ...i, entrants: d, count: d.length };
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function kn() {
|
|
572
|
+
const { onEnterPromotion: e, onWithdrawPromotionEntry: t } = S(), r = !!(e && t);
|
|
573
|
+
return { isPowerMode: r, isBasicMode: !r };
|
|
574
|
+
}
|
|
575
|
+
function Cn(e) {
|
|
576
|
+
const { pitvoxUrl: t, partnerSlug: r } = S();
|
|
577
|
+
return `${t}/p/${r}/promotions/${e}`;
|
|
578
|
+
}
|
|
579
|
+
const Sn = {
|
|
580
|
+
GBR: "🇬🇧",
|
|
581
|
+
DEU: "🇩🇪",
|
|
582
|
+
NLD: "🇳🇱",
|
|
583
|
+
SWE: "🇸🇪",
|
|
584
|
+
ESP: "🇪🇸",
|
|
585
|
+
ZAF: "🇿🇦",
|
|
586
|
+
FRA: "🇫🇷",
|
|
587
|
+
ITA: "🇮🇹",
|
|
588
|
+
USA: "🇺🇸",
|
|
589
|
+
AUS: "🇦🇺",
|
|
590
|
+
BRA: "🇧🇷",
|
|
591
|
+
JPN: "🇯🇵",
|
|
592
|
+
CAN: "🇨🇦",
|
|
593
|
+
POL: "🇵🇱",
|
|
594
|
+
AUT: "🇦🇹",
|
|
595
|
+
BEL: "🇧🇪",
|
|
596
|
+
PRT: "🇵🇹",
|
|
597
|
+
NOR: "🇳🇴",
|
|
598
|
+
DNK: "🇩🇰",
|
|
599
|
+
FIN: "🇫🇮",
|
|
600
|
+
IRL: "🇮🇪",
|
|
601
|
+
CHE: "🇨🇭",
|
|
602
|
+
NZL: "🇳🇿",
|
|
603
|
+
MEX: "🇲🇽",
|
|
604
|
+
ARG: "🇦🇷",
|
|
605
|
+
CZE: "🇨🇿",
|
|
606
|
+
HUN: "🇭🇺",
|
|
607
|
+
RUS: "🇷🇺",
|
|
608
|
+
TUR: "🇹🇷",
|
|
609
|
+
KOR: "🇰🇷"
|
|
610
|
+
}, xe = ["🥇", "🥈", "🥉"], Ln = {
|
|
611
|
+
championship: "Championship",
|
|
612
|
+
series: "Series",
|
|
613
|
+
event: "Event",
|
|
614
|
+
hotlap: "Hotlap"
|
|
615
|
+
}, $n = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
616
|
+
function we(e) {
|
|
617
|
+
const t = $n.indexOf(e);
|
|
618
|
+
if (t >= 0) return t;
|
|
619
|
+
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
620
|
+
return r ? 100 + parseInt(r[1]) : 999;
|
|
621
|
+
}
|
|
622
|
+
function X(e) {
|
|
623
|
+
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
624
|
+
return t ? `P${t[1]}` : e;
|
|
625
|
+
}
|
|
626
|
+
function ge({ position: e }) {
|
|
627
|
+
return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
|
|
628
|
+
}
|
|
629
|
+
function ee({ nation: e }) {
|
|
630
|
+
const t = e && Sn[e];
|
|
631
|
+
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
632
|
+
}
|
|
633
|
+
function Tn({ sessions: e, activeSession: t, onSelect: r }) {
|
|
634
|
+
if (!e || e.length <= 1) return null;
|
|
635
|
+
const s = [...e].sort(
|
|
636
|
+
(a, o) => we(a.type) - we(o.type)
|
|
637
|
+
);
|
|
638
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
639
|
+
"button",
|
|
640
|
+
{
|
|
641
|
+
onClick: () => r(a.type),
|
|
642
|
+
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
643
|
+
children: X(a.type)
|
|
644
|
+
},
|
|
645
|
+
a.type
|
|
646
|
+
)) });
|
|
647
|
+
}
|
|
648
|
+
function Rn({ type: e }) {
|
|
649
|
+
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: Ln[e] || e });
|
|
650
|
+
}
|
|
651
|
+
function ae({ children: e, variant: t = "default" }) {
|
|
652
|
+
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
653
|
+
}
|
|
654
|
+
function Mn(e) {
|
|
655
|
+
if (!e) return "TBD";
|
|
656
|
+
const t = new Date(e);
|
|
657
|
+
if (isNaN(t)) return "TBD";
|
|
658
|
+
const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
659
|
+
return `${r} • ${s}`;
|
|
660
|
+
}
|
|
661
|
+
function Pn(e) {
|
|
662
|
+
return e.reduce((t, r) => {
|
|
663
|
+
var s;
|
|
664
|
+
return (s = r.splits) != null && s.length ? t ? t.map((a, o) => {
|
|
665
|
+
const i = r.splits[o];
|
|
666
|
+
return i && i < a ? i : a;
|
|
667
|
+
}) : [...r.splits] : t;
|
|
668
|
+
}, null);
|
|
669
|
+
}
|
|
670
|
+
function W({ message: e = "Loading..." }) {
|
|
671
|
+
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
|
|
672
|
+
}
|
|
673
|
+
function _({ message: e = "No data available." }) {
|
|
674
|
+
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
675
|
+
}
|
|
676
|
+
const Ue = 3;
|
|
677
|
+
function O(e) {
|
|
678
|
+
if (!e) return !1;
|
|
679
|
+
if (e.closesAt) {
|
|
680
|
+
const t = new Date(e.closesAt).getTime();
|
|
681
|
+
if (!Number.isNaN(t)) return Date.now() >= t;
|
|
682
|
+
}
|
|
683
|
+
return !!e.isClosed;
|
|
684
|
+
}
|
|
685
|
+
function Dn(e) {
|
|
686
|
+
const t = e == null ? void 0 : e.rounds;
|
|
687
|
+
return t != null && t.length ? e.type === "hotlap" ? t.every((r) => O(r)) : t.every((r) => r.isFinalized) : !1;
|
|
688
|
+
}
|
|
689
|
+
function An(e) {
|
|
690
|
+
const t = e == null ? void 0 : e.rounds;
|
|
691
|
+
if (!(t != null && t.length)) return null;
|
|
692
|
+
let r = null;
|
|
693
|
+
for (const s of t) {
|
|
694
|
+
if (!s.startTime) continue;
|
|
695
|
+
const a = new Date(s.startTime);
|
|
696
|
+
isNaN(a) || (!r || a > r) && (r = a);
|
|
697
|
+
}
|
|
698
|
+
return r;
|
|
699
|
+
}
|
|
700
|
+
function _e(e, t = Ue) {
|
|
701
|
+
if (!Dn(e)) return "active";
|
|
702
|
+
const r = An(e);
|
|
703
|
+
if (!r) return "recently-completed";
|
|
704
|
+
const s = t * 24 * 60 * 60 * 1e3;
|
|
705
|
+
return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
|
|
706
|
+
}
|
|
707
|
+
function rr(e, t, r = Ue) {
|
|
708
|
+
if (!(e != null && e.length)) return [];
|
|
709
|
+
const s = new Set(Array.isArray(t) ? t : [t]);
|
|
710
|
+
return e.filter((a) => s.has(_e(a, r)));
|
|
711
|
+
}
|
|
712
|
+
function En(e, t = 3) {
|
|
713
|
+
const r = e == null ? void 0 : e.standings;
|
|
714
|
+
return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
715
|
+
}
|
|
716
|
+
const Bn = {
|
|
717
|
+
giveaway: "Giveaway"
|
|
718
|
+
};
|
|
719
|
+
function Ie({ promotion: e, status: t }) {
|
|
720
|
+
const r = t || J(e);
|
|
721
|
+
return /* @__PURE__ */ n("span", { className: `pvx-promo-status pvx-promo-status--${r}`, children: xn[r] || r });
|
|
722
|
+
}
|
|
723
|
+
function Fe({ type: e }) {
|
|
724
|
+
return /* @__PURE__ */ n("span", { className: `pvx-promo-type pvx-promo-type--${e || "giveaway"}`, children: Bn[e] || e });
|
|
725
|
+
}
|
|
726
|
+
function K(e) {
|
|
727
|
+
if (!e) return "";
|
|
728
|
+
const t = new Date(e);
|
|
729
|
+
if (isNaN(t)) return "";
|
|
730
|
+
const r = t.toLocaleDateString(void 0, { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
731
|
+
return `${r} ${s}`;
|
|
732
|
+
}
|
|
733
|
+
function Un(e, t) {
|
|
734
|
+
const r = t || J(e);
|
|
735
|
+
return r === "upcoming" ? `Entries open ${K(e.opensAt)}` : r === "open" && e.closesAt ? `Entries close ${K(e.closesAt)}` : r === "open" ? "Entries open now" : r === "closed" ? `Entries closed ${K(e.closesAt)}` : null;
|
|
736
|
+
}
|
|
737
|
+
function le({ className: e }) {
|
|
738
|
+
return /* @__PURE__ */ l(
|
|
739
|
+
"svg",
|
|
740
|
+
{
|
|
741
|
+
className: e,
|
|
742
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
743
|
+
viewBox: "0 0 24 24",
|
|
744
|
+
fill: "none",
|
|
745
|
+
stroke: "currentColor",
|
|
746
|
+
strokeWidth: "2",
|
|
747
|
+
strokeLinecap: "round",
|
|
748
|
+
strokeLinejoin: "round",
|
|
749
|
+
children: [
|
|
750
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "8", width: "18", height: "4", rx: "1" }),
|
|
751
|
+
/* @__PURE__ */ n("path", { d: "M12 8v13" }),
|
|
752
|
+
/* @__PURE__ */ n("path", { d: "M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7" }),
|
|
753
|
+
/* @__PURE__ */ n("path", { d: "M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5" })
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
function _n({ promotions: e, isLoading: t, onSelect: r, className: s }) {
|
|
759
|
+
if (t)
|
|
760
|
+
return /* @__PURE__ */ n(W, { message: "Loading promotions..." });
|
|
761
|
+
if (!(e != null && e.length))
|
|
762
|
+
return /* @__PURE__ */ n(_, { message: "No promotions running right now." });
|
|
763
|
+
const a = e.length === 1 ? "pvx-promo-grid--single" : e.length === 2 ? "pvx-promo-grid--pair" : "";
|
|
764
|
+
return /* @__PURE__ */ n("div", { className: `pvx-promo-grid ${a} ${s || ""}`, children: e.map((o) => /* @__PURE__ */ n(In, { promo: o, onSelect: r }, o.id)) });
|
|
765
|
+
}
|
|
766
|
+
function In({ promo: e, onSelect: t }) {
|
|
767
|
+
const { cdnUrl: r } = S(), s = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, a = J(e), o = Un(e, a);
|
|
768
|
+
return /* @__PURE__ */ l(
|
|
769
|
+
"div",
|
|
770
|
+
{
|
|
771
|
+
className: "pvx-promo-card",
|
|
772
|
+
role: "button",
|
|
773
|
+
tabIndex: 0,
|
|
774
|
+
onClick: () => t == null ? void 0 : t(e.id),
|
|
775
|
+
onKeyDown: (i) => {
|
|
776
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), t == null || t(e.id));
|
|
777
|
+
},
|
|
778
|
+
children: [
|
|
779
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-card-poster", children: s ? /* @__PURE__ */ n("img", { src: s, alt: e.title, className: "pvx-promo-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-card-poster-placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-gift-icon" }) }) }),
|
|
780
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-body", children: [
|
|
781
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-badges", children: [
|
|
782
|
+
/* @__PURE__ */ n(Ie, { promotion: e, status: a }),
|
|
783
|
+
/* @__PURE__ */ n(Fe, { type: e.type }),
|
|
784
|
+
e.game && /* @__PURE__ */ n("span", { className: "pvx-promo-game", children: e.game })
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ n("h3", { className: "pvx-promo-card-title", children: e.title }),
|
|
787
|
+
e.prizeDescription && /* @__PURE__ */ n("p", { className: "pvx-promo-card-prize", children: e.prizeDescription }),
|
|
788
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-meta", children: [
|
|
789
|
+
o && /* @__PURE__ */ n("span", { children: o }),
|
|
790
|
+
/* @__PURE__ */ l("span", { children: [
|
|
791
|
+
e.entryCount,
|
|
792
|
+
" ",
|
|
793
|
+
e.entryCount === 1 ? "entry" : "entries",
|
|
794
|
+
e.maxEntrants ? ` / ${e.maxEntrants}` : ""
|
|
795
|
+
] })
|
|
796
|
+
] })
|
|
797
|
+
] })
|
|
798
|
+
]
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
function Fn({
|
|
803
|
+
promotionId: e,
|
|
804
|
+
driverData: t,
|
|
805
|
+
className: r,
|
|
806
|
+
children: s
|
|
807
|
+
}) {
|
|
808
|
+
const { data: a, isLoading: o } = yn(e), { isPowerMode: i } = kn(), d = Cn(e), p = bn(e), c = wn(e), u = (a == null ? void 0 : a.isEntered) || !1, v = o || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
|
|
809
|
+
i && p.mutate(t || {});
|
|
810
|
+
}, y = () => {
|
|
811
|
+
i && c.mutate();
|
|
812
|
+
};
|
|
813
|
+
return typeof s == "function" ? s({ isEntered: u, isLoading: v, enter: h, withdraw: y, error: f, isPowerMode: i, promotionUrl: d }) : i ? /* @__PURE__ */ n(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
className: `pvx-promo-enter-btn ${r || ""}`,
|
|
817
|
+
onClick: u ? y : h,
|
|
818
|
+
disabled: v,
|
|
819
|
+
children: v ? "Loading..." : u ? "Withdraw Entry" : "Enter Giveaway"
|
|
820
|
+
}
|
|
821
|
+
) : /* @__PURE__ */ n(
|
|
822
|
+
"a",
|
|
823
|
+
{
|
|
824
|
+
href: d,
|
|
825
|
+
target: "_blank",
|
|
826
|
+
rel: "noopener noreferrer",
|
|
827
|
+
className: `pvx-promo-enter-link ${r || ""}`,
|
|
828
|
+
children: u ? "View Entry" : "Enter on PitVox"
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
function qn({ promotionId: e, driverData: t, onBack: r, className: s }) {
|
|
833
|
+
const { cdnUrl: a, getSteamId: o } = S(), { data: i, isLoading: d } = fn(e), { data: p } = Nn(e);
|
|
834
|
+
if (d)
|
|
835
|
+
return /* @__PURE__ */ n(W, { message: "Loading promotion..." });
|
|
836
|
+
if (!i)
|
|
837
|
+
return /* @__PURE__ */ n(_, { message: "Promotion not found." });
|
|
838
|
+
const c = J(i), u = i.winners || [], v = (p == null ? void 0 : p.entrants) || [], f = v.length || i.entryCount || 0, h = i.maxEntrants && f >= i.maxEntrants, y = i.posterCdnPath ? `${a}/${i.posterCdnPath}` : null, x = o();
|
|
839
|
+
return /* @__PURE__ */ l("div", { className: `pvx-promo-detail ${s || ""}`, children: [
|
|
840
|
+
r && /* @__PURE__ */ n("button", { type: "button", className: "pvx-promo-back", onClick: r, children: "← All promotions" }),
|
|
841
|
+
y && /* @__PURE__ */ n("div", { className: "pvx-promo-detail-poster", children: /* @__PURE__ */ n("img", { src: y, alt: i.title }) }),
|
|
842
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-detail-header", children: [
|
|
843
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-badges", children: [
|
|
844
|
+
/* @__PURE__ */ n(Ie, { promotion: i, status: c }),
|
|
845
|
+
/* @__PURE__ */ n(Fe, { type: i.type }),
|
|
846
|
+
i.game && /* @__PURE__ */ n("span", { className: "pvx-promo-game", children: i.game })
|
|
847
|
+
] }),
|
|
848
|
+
/* @__PURE__ */ n("h2", { className: "pvx-promo-detail-title", children: i.title }),
|
|
849
|
+
i.prizeDescription && /* @__PURE__ */ n("p", { className: "pvx-promo-detail-prize", children: i.prizeDescription }),
|
|
850
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-detail-meta", children: [
|
|
851
|
+
i.opensAt && c === "upcoming" && /* @__PURE__ */ l("span", { children: [
|
|
852
|
+
"Opens ",
|
|
853
|
+
K(i.opensAt)
|
|
854
|
+
] }),
|
|
855
|
+
i.closesAt && /* @__PURE__ */ l("span", { children: [
|
|
856
|
+
c === "open" || c === "upcoming" ? "Closes" : "Closed",
|
|
857
|
+
" ",
|
|
858
|
+
K(i.closesAt)
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ l("span", { children: [
|
|
861
|
+
f,
|
|
862
|
+
" ",
|
|
863
|
+
f === 1 ? "entry" : "entries",
|
|
864
|
+
i.maxEntrants ? ` / ${i.maxEntrants}` : ""
|
|
865
|
+
] })
|
|
866
|
+
] })
|
|
867
|
+
] }),
|
|
868
|
+
u.length > 0 && /* @__PURE__ */ l("div", { className: "pvx-promo-winners", children: [
|
|
869
|
+
/* @__PURE__ */ n("h3", { className: "pvx-promo-section-title", children: u.length === 1 ? "Winner" : "Winners" }),
|
|
870
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-winners-list", children: u.map((m) => /* @__PURE__ */ l("div", { className: "pvx-promo-winner", children: [
|
|
871
|
+
m.avatarUrl ? /* @__PURE__ */ n("img", { src: m.avatarUrl, alt: "", className: "pvx-promo-avatar pvx-promo-avatar--lg" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-avatar pvx-promo-avatar--lg pvx-promo-avatar--placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-avatar-glyph" }) }),
|
|
872
|
+
/* @__PURE__ */ n("span", { className: "pvx-promo-winner-name", children: m.displayName })
|
|
873
|
+
] }, m.steamId)) })
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-action", children: [
|
|
876
|
+
c === "upcoming" && /* @__PURE__ */ l("p", { className: "pvx-promo-action-note", children: [
|
|
877
|
+
"Entries aren't open yet — come back ",
|
|
878
|
+
i.opensAt ? K(i.opensAt) : "soon",
|
|
879
|
+
"."
|
|
880
|
+
] }),
|
|
881
|
+
(c === "closed" || c === "winners") && /* @__PURE__ */ l("p", { className: "pvx-promo-action-note", children: [
|
|
882
|
+
"Entries have closed.",
|
|
883
|
+
c === "closed" && " Winners will be announced here once the draw is done."
|
|
884
|
+
] }),
|
|
885
|
+
c === "open" && !x && /* @__PURE__ */ n("p", { className: "pvx-promo-action-note", children: "Sign in with Steam to enter this giveaway." }),
|
|
886
|
+
c === "open" && x && /* @__PURE__ */ n(Fn, { promotionId: e, driverData: t, children: ({ isEntered: m, isLoading: b, enter: g, withdraw: k, error: C, isPowerMode: P, promotionUrl: A }) => /* @__PURE__ */ l("div", { className: "pvx-promo-action-row", children: [
|
|
887
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-action-text", children: [
|
|
888
|
+
C && /* @__PURE__ */ n("p", { className: "pvx-promo-error", children: C.message }),
|
|
889
|
+
/* @__PURE__ */ n("p", { className: "pvx-promo-action-note", children: m ? "✓ You're in the draw." : h ? "This giveaway is full." : "One click and you're in the draw." }),
|
|
890
|
+
!m && !h && /* @__PURE__ */ n("p", { className: "pvx-promo-disclosure", children: "Entering displays your Steam name and avatar publicly; winners are announced by name." })
|
|
891
|
+
] }),
|
|
892
|
+
P ? /* @__PURE__ */ n(
|
|
893
|
+
"button",
|
|
894
|
+
{
|
|
895
|
+
type: "button",
|
|
896
|
+
className: m ? "pvx-promo-withdraw-btn" : "pvx-promo-enter-btn",
|
|
897
|
+
onClick: m ? k : g,
|
|
898
|
+
disabled: b || !m && h,
|
|
899
|
+
children: b ? "Loading..." : m ? "Withdraw Entry" : "Enter Giveaway"
|
|
900
|
+
}
|
|
901
|
+
) : /* @__PURE__ */ n(
|
|
902
|
+
"a",
|
|
903
|
+
{
|
|
904
|
+
href: A,
|
|
905
|
+
target: "_blank",
|
|
906
|
+
rel: "noopener noreferrer",
|
|
907
|
+
className: "pvx-promo-enter-link",
|
|
908
|
+
children: m ? "View Entry" : "Enter on PitVox"
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
] }) })
|
|
912
|
+
] }),
|
|
913
|
+
i.description && /* @__PURE__ */ n("div", { className: "pvx-promo-description", children: /* @__PURE__ */ n(en, { children: i.description }) }),
|
|
914
|
+
v.length > 0 && /* @__PURE__ */ l("div", { className: "pvx-promo-entrants", children: [
|
|
915
|
+
/* @__PURE__ */ l("h3", { className: "pvx-promo-section-title", children: [
|
|
916
|
+
"Entrants ",
|
|
917
|
+
/* @__PURE__ */ l("span", { className: "pvx-promo-section-count", children: [
|
|
918
|
+
"(",
|
|
919
|
+
v.length,
|
|
920
|
+
")"
|
|
921
|
+
] })
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-entrants-grid", children: v.map((m) => /* @__PURE__ */ l("div", { className: "pvx-promo-entrant", children: [
|
|
924
|
+
m.avatarUrl ? /* @__PURE__ */ n("img", { src: m.avatarUrl, alt: "", className: "pvx-promo-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-avatar pvx-promo-avatar--placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-avatar-glyph" }) }),
|
|
925
|
+
/* @__PURE__ */ n("span", { className: "pvx-promo-entrant-name", title: m.displayName, children: m.displayName })
|
|
926
|
+
] }, m.steamId)) })
|
|
927
|
+
] })
|
|
928
|
+
] });
|
|
929
|
+
}
|
|
930
|
+
const ce = "promotion";
|
|
931
|
+
function ke() {
|
|
932
|
+
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get(ce);
|
|
933
|
+
}
|
|
934
|
+
function sr({ title: e = "Promotions", driverData: t, className: r }) {
|
|
935
|
+
const { data: s = [], isLoading: a } = gn(), [o, i] = E(ke);
|
|
936
|
+
$e(() => {
|
|
937
|
+
const p = () => i(ke());
|
|
938
|
+
return window.addEventListener("popstate", p), () => window.removeEventListener("popstate", p);
|
|
939
|
+
}, []);
|
|
940
|
+
const d = H((p) => {
|
|
941
|
+
if (i(p), typeof window < "u") {
|
|
942
|
+
const c = new URL(window.location.href);
|
|
943
|
+
p ? c.searchParams.set(ce, p) : c.searchParams.delete(ce), window.history.pushState({}, "", c);
|
|
944
|
+
}
|
|
945
|
+
}, []);
|
|
946
|
+
return /* @__PURE__ */ l("div", { className: `pvx-promo-explorer ${r || ""}`, children: [
|
|
947
|
+
e && /* @__PURE__ */ n("h1", { className: "pvx-promo-explorer-title", children: e }),
|
|
948
|
+
o ? /* @__PURE__ */ n(
|
|
949
|
+
qn,
|
|
950
|
+
{
|
|
951
|
+
promotionId: o,
|
|
952
|
+
driverData: t,
|
|
953
|
+
onBack: () => d(null)
|
|
954
|
+
}
|
|
955
|
+
) : /* @__PURE__ */ n(
|
|
956
|
+
_n,
|
|
957
|
+
{
|
|
958
|
+
promotions: s,
|
|
959
|
+
isLoading: a,
|
|
960
|
+
onSelect: d
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
] });
|
|
964
|
+
}
|
|
965
|
+
function Wn(e, t) {
|
|
966
|
+
for (const r of t)
|
|
967
|
+
if (r.tags.includes(e)) return r.id;
|
|
454
968
|
return "other";
|
|
455
969
|
}
|
|
456
|
-
function
|
|
970
|
+
function qe(e, t, r = []) {
|
|
457
971
|
if (t.size === 0) return !0;
|
|
458
|
-
const
|
|
972
|
+
const s = {};
|
|
459
973
|
for (const a of t) {
|
|
460
|
-
const
|
|
461
|
-
|
|
974
|
+
const o = Wn(a, r);
|
|
975
|
+
s[o] || (s[o] = []), s[o].push(a);
|
|
462
976
|
}
|
|
463
|
-
for (const a of Object.values(
|
|
464
|
-
if (!a.some((
|
|
977
|
+
for (const a of Object.values(s))
|
|
978
|
+
if (!a.some((o) => e.includes(o))) return !1;
|
|
465
979
|
return !0;
|
|
466
980
|
}
|
|
467
|
-
function
|
|
468
|
-
const [
|
|
469
|
-
const c = new Set(
|
|
470
|
-
c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) :
|
|
471
|
-
}, [
|
|
472
|
-
a && t ? t(/* @__PURE__ */ new Set()) :
|
|
981
|
+
function We(e, t) {
|
|
982
|
+
const [r, s] = E(/* @__PURE__ */ new Set()), a = e !== void 0, o = a ? e : r, i = H((p) => {
|
|
983
|
+
const c = new Set(o);
|
|
984
|
+
c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) : s(c);
|
|
985
|
+
}, [o, a, t]), d = H(() => {
|
|
986
|
+
a && t ? t(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
|
|
473
987
|
}, [a, t]);
|
|
474
|
-
return { activeTags:
|
|
988
|
+
return { activeTags: o, toggle: i, clear: d };
|
|
475
989
|
}
|
|
476
|
-
function
|
|
477
|
-
const [t,
|
|
478
|
-
|
|
479
|
-
(
|
|
990
|
+
function ne(e) {
|
|
991
|
+
const [t, r] = E(e), s = H((a) => {
|
|
992
|
+
r(
|
|
993
|
+
(o) => o.key === a ? { key: a, dir: o.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
480
994
|
);
|
|
481
995
|
}, []);
|
|
482
|
-
return [t,
|
|
483
|
-
}
|
|
484
|
-
function
|
|
485
|
-
return [...e].sort((
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
488
|
-
if (
|
|
489
|
-
if (
|
|
490
|
-
const d = typeof
|
|
996
|
+
return [t, s];
|
|
997
|
+
}
|
|
998
|
+
function te(e, t, r) {
|
|
999
|
+
return [...e].sort((s, a) => {
|
|
1000
|
+
const o = r(s, t.key), i = r(a, t.key);
|
|
1001
|
+
if (o == null && i == null) return 0;
|
|
1002
|
+
if (o == null) return 1;
|
|
1003
|
+
if (i == null) return -1;
|
|
1004
|
+
const d = typeof o == "string" ? o.localeCompare(i) : o - i;
|
|
491
1005
|
return t.dir === "desc" ? -d : d;
|
|
492
1006
|
});
|
|
493
1007
|
}
|
|
494
|
-
function
|
|
495
|
-
const
|
|
496
|
-
return
|
|
497
|
-
s1: Math.min(...
|
|
498
|
-
s2: Math.min(...
|
|
499
|
-
s3: Math.min(...
|
|
1008
|
+
function je(e, t = !1) {
|
|
1009
|
+
const r = t ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
|
|
1010
|
+
return r != null && r.length ? {
|
|
1011
|
+
s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
|
|
1012
|
+
s2: Math.min(...r.map((s) => s.sector2Ms).filter(Boolean)),
|
|
1013
|
+
s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
|
|
500
1014
|
} : null;
|
|
501
1015
|
}
|
|
502
|
-
function
|
|
1016
|
+
function jn({ active: e, dir: t }) {
|
|
503
1017
|
return e ? t === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
|
|
504
1018
|
}
|
|
505
|
-
function
|
|
1019
|
+
function U({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
|
|
506
1020
|
return /* @__PURE__ */ n(
|
|
507
1021
|
"th",
|
|
508
1022
|
{
|
|
509
1023
|
className: `pvx-th pvx-th--sortable ${a}`,
|
|
510
|
-
onClick: () =>
|
|
1024
|
+
onClick: () => s(t),
|
|
511
1025
|
children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
|
|
512
1026
|
e,
|
|
513
|
-
/* @__PURE__ */ n(
|
|
1027
|
+
/* @__PURE__ */ n(jn, { active: r.key === t, dir: r.dir })
|
|
514
1028
|
] })
|
|
515
1029
|
}
|
|
516
1030
|
);
|
|
517
1031
|
}
|
|
518
|
-
function
|
|
519
|
-
const { displayName:
|
|
1032
|
+
function re({ userId: e, getUserDisplay: t }) {
|
|
1033
|
+
const { displayName: r, avatarUrl: s } = t(e);
|
|
520
1034
|
return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
|
|
521
|
-
|
|
522
|
-
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children:
|
|
1035
|
+
s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
1036
|
+
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children: r })
|
|
523
1037
|
] });
|
|
524
1038
|
}
|
|
525
|
-
function
|
|
1039
|
+
function fe({ rank: e, podium: t = !1 }) {
|
|
526
1040
|
return /* @__PURE__ */ n("span", { className: t ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
|
|
527
1041
|
}
|
|
528
|
-
function
|
|
1042
|
+
function Ve({ availableTags: e, activeTags: t, onToggle: r, onClear: s, categories: a = [], tagLabels: o = {} }) {
|
|
529
1043
|
if (!e || e.length < 2) return null;
|
|
530
|
-
const
|
|
1044
|
+
const i = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
|
|
531
1045
|
return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
|
|
532
1046
|
/* @__PURE__ */ n(
|
|
533
1047
|
"button",
|
|
534
1048
|
{
|
|
535
|
-
onClick:
|
|
1049
|
+
onClick: s,
|
|
536
1050
|
className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
|
|
537
1051
|
children: "All"
|
|
538
1052
|
}
|
|
539
1053
|
),
|
|
540
|
-
|
|
1054
|
+
i.map((d, p) => /* @__PURE__ */ l("span", { className: "contents", children: [
|
|
541
1055
|
p > 0 && /* @__PURE__ */ n("span", { className: "pvx-tag-separator" }),
|
|
542
1056
|
d.tags.map((c) => /* @__PURE__ */ n(
|
|
543
1057
|
"button",
|
|
544
1058
|
{
|
|
545
|
-
onClick: () =>
|
|
1059
|
+
onClick: () => r(c),
|
|
546
1060
|
className: `pvx-tag ${t.has(c) ? "pvx-tag--active" : ""}`,
|
|
547
|
-
children:
|
|
1061
|
+
children: o[c] || c
|
|
548
1062
|
},
|
|
549
1063
|
c
|
|
550
1064
|
))
|
|
551
1065
|
] }, d.id))
|
|
552
1066
|
] });
|
|
553
1067
|
}
|
|
554
|
-
function
|
|
555
|
-
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t,
|
|
556
|
-
const
|
|
1068
|
+
function Ne({ segments: e }) {
|
|
1069
|
+
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, r) => {
|
|
1070
|
+
const s = r === e.length - 1;
|
|
557
1071
|
return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
|
|
558
|
-
|
|
559
|
-
!
|
|
1072
|
+
r > 0 && /* @__PURE__ */ n("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
|
|
1073
|
+
!s && t.onClick ? /* @__PURE__ */ n("button", { onClick: t.onClick, className: "pvx-breadcrumb-link", children: t.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: t.label })
|
|
560
1074
|
] }, t.key);
|
|
561
1075
|
}) }) });
|
|
562
1076
|
}
|
|
563
|
-
function
|
|
1077
|
+
function Y({ message: e }) {
|
|
564
1078
|
return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
|
|
565
1079
|
/* @__PURE__ */ n("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("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" }) }),
|
|
566
1080
|
/* @__PURE__ */ n("p", { children: e })
|
|
567
1081
|
] });
|
|
568
1082
|
}
|
|
569
|
-
function
|
|
1083
|
+
function Z() {
|
|
570
1084
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
|
|
571
1085
|
}
|
|
572
|
-
function
|
|
1086
|
+
function Vn() {
|
|
573
1087
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
574
1088
|
}
|
|
575
|
-
function
|
|
1089
|
+
function Kn() {
|
|
576
1090
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
577
1091
|
}
|
|
578
|
-
function
|
|
579
|
-
const [d, p] =
|
|
580
|
-
var
|
|
581
|
-
if (!((
|
|
1092
|
+
function ar({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrackSelect: a, tags: o, onTagChange: i }) {
|
|
1093
|
+
const [d, p] = ne({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: v } = We(o, i), f = T(() => {
|
|
1094
|
+
var m;
|
|
1095
|
+
if (!((m = r == null ? void 0 : r.tags) != null && m.length)) return [];
|
|
582
1096
|
const x = /* @__PURE__ */ new Set();
|
|
583
|
-
for (const
|
|
584
|
-
|
|
585
|
-
return
|
|
586
|
-
}, [e,
|
|
587
|
-
var
|
|
1097
|
+
for (const b of e || [])
|
|
1098
|
+
b.recordByTag && Object.keys(b.recordByTag).forEach((g) => x.add(g));
|
|
1099
|
+
return r.tags.filter((b) => x.has(b));
|
|
1100
|
+
}, [e, r]), h = T(() => e ? c.size === 0 ? e : e.map((x) => {
|
|
1101
|
+
var g, k;
|
|
588
1102
|
if (!x.recordByTag) return null;
|
|
589
|
-
let
|
|
590
|
-
const
|
|
591
|
-
for (const
|
|
592
|
-
if (
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
|
|
1103
|
+
let m = null;
|
|
1104
|
+
const b = /* @__PURE__ */ new Set();
|
|
1105
|
+
for (const C of Object.values(x.recordByTag)) {
|
|
1106
|
+
if (b.has(C.carId)) continue;
|
|
1107
|
+
b.add(C.carId);
|
|
1108
|
+
const P = ((k = (g = r == null ? void 0 : r.cars) == null ? void 0 : g[C.carId]) == null ? void 0 : k.tags) || [];
|
|
1109
|
+
qe(P, c, r == null ? void 0 : r.categories) && (!m || C.lapTimeMs < m.lapTimeMs) && (m = C);
|
|
596
1110
|
}
|
|
597
|
-
return
|
|
1111
|
+
return m ? {
|
|
598
1112
|
...x,
|
|
599
1113
|
record: {
|
|
600
|
-
visibleId:
|
|
601
|
-
carId:
|
|
602
|
-
carDisplayName: I(
|
|
603
|
-
lapTimeMs:
|
|
604
|
-
timestamp:
|
|
1114
|
+
visibleId: m.steamId || m.identifier,
|
|
1115
|
+
carId: m.carId,
|
|
1116
|
+
carDisplayName: I(m.carId),
|
|
1117
|
+
lapTimeMs: m.lapTimeMs,
|
|
1118
|
+
timestamp: m.recordedAt
|
|
605
1119
|
}
|
|
606
1120
|
} : null;
|
|
607
|
-
}).filter(Boolean) : [], [e, c,
|
|
608
|
-
var
|
|
609
|
-
switch (
|
|
1121
|
+
}).filter(Boolean) : [], [e, c, r]), y = T(() => te(h, d, (x, m) => {
|
|
1122
|
+
var b, g;
|
|
1123
|
+
switch (m) {
|
|
610
1124
|
case "displayName":
|
|
611
1125
|
return x.displayName;
|
|
612
1126
|
case "record.lapTimeMs":
|
|
613
|
-
return (
|
|
1127
|
+
return (b = x.record) == null ? void 0 : b.lapTimeMs;
|
|
614
1128
|
case "driverCount":
|
|
615
1129
|
return x.driverCount || 0;
|
|
616
1130
|
case "carCount":
|
|
617
1131
|
return x.carCount || 0;
|
|
618
1132
|
case "record.timestamp":
|
|
619
1133
|
default:
|
|
620
|
-
return (
|
|
1134
|
+
return (g = x.record) != null && g.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
621
1135
|
}
|
|
622
1136
|
}), [h, d]);
|
|
623
|
-
return t ? /* @__PURE__ */ n(
|
|
1137
|
+
return t ? /* @__PURE__ */ n(Z, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
624
1138
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
625
1139
|
/* @__PURE__ */ n(
|
|
626
|
-
|
|
1140
|
+
Ve,
|
|
627
1141
|
{
|
|
628
1142
|
availableTags: f,
|
|
629
1143
|
activeTags: c,
|
|
630
1144
|
onToggle: u,
|
|
631
1145
|
onClear: v,
|
|
632
|
-
categories:
|
|
633
|
-
tagLabels:
|
|
1146
|
+
categories: r == null ? void 0 : r.categories,
|
|
1147
|
+
tagLabels: r == null ? void 0 : r.tagLabels
|
|
634
1148
|
}
|
|
635
1149
|
),
|
|
636
1150
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
637
1151
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
638
|
-
/* @__PURE__ */ n(
|
|
1152
|
+
/* @__PURE__ */ n(U, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
|
|
639
1153
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
640
1154
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
641
|
-
/* @__PURE__ */ n(
|
|
642
|
-
/* @__PURE__ */ n(
|
|
643
|
-
/* @__PURE__ */ n(
|
|
644
|
-
/* @__PURE__ */ n(
|
|
1155
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
|
|
1156
|
+
/* @__PURE__ */ n(U, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
|
|
1157
|
+
/* @__PURE__ */ n(U, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
|
|
1158
|
+
/* @__PURE__ */ n(U, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
|
|
645
1159
|
] }) }),
|
|
646
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
647
|
-
var
|
|
1160
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: y.map((x) => {
|
|
1161
|
+
var m, b, g;
|
|
648
1162
|
return /* @__PURE__ */ l(
|
|
649
1163
|
"tr",
|
|
650
1164
|
{
|
|
@@ -652,90 +1166,90 @@ function yt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
652
1166
|
onClick: () => a(x.id, x.layout),
|
|
653
1167
|
children: [
|
|
654
1168
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
655
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: (
|
|
656
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((
|
|
1169
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (m = x.record) != null && m.visibleId ? /* @__PURE__ */ n(re, { userId: x.record.visibleId, getUserDisplay: s }) : "-" }),
|
|
1170
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((b = x.record) == null ? void 0 : b.carDisplayName) || "-" }),
|
|
657
1171
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? q(x.record.lapTimeMs) : "-" }),
|
|
658
1172
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
659
1173
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
|
|
660
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (
|
|
1174
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (g = x.record) != null && g.timestamp ? Q(x.record.timestamp) : "-" })
|
|
661
1175
|
]
|
|
662
1176
|
},
|
|
663
1177
|
`${x.id}|${x.layout || ""}`
|
|
664
1178
|
);
|
|
665
1179
|
}) })
|
|
666
1180
|
] }) })
|
|
667
|
-
] }) : /* @__PURE__ */ n(
|
|
668
|
-
}
|
|
669
|
-
function
|
|
670
|
-
const [c, u] =
|
|
671
|
-
var
|
|
672
|
-
if (!e || !((
|
|
673
|
-
const
|
|
674
|
-
for (const
|
|
675
|
-
(((
|
|
676
|
-
return
|
|
677
|
-
}, [e,
|
|
678
|
-
var
|
|
679
|
-
const
|
|
680
|
-
return
|
|
681
|
-
}) : [], [e, v,
|
|
682
|
-
switch (
|
|
1181
|
+
] }) : /* @__PURE__ */ n(Y, { message: "No lap times recorded yet." });
|
|
1182
|
+
}
|
|
1183
|
+
function ir({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: o, onNavigate: i, tags: d, onTagChange: p }) {
|
|
1184
|
+
const [c, u] = ne({ key: "lapTimeMs", dir: "asc" }), { activeTags: v, toggle: f, clear: h } = We(d, p), y = T(() => {
|
|
1185
|
+
var k, C, P;
|
|
1186
|
+
if (!e || !((k = s == null ? void 0 : s.tags) != null && k.length)) return [];
|
|
1187
|
+
const g = /* @__PURE__ */ new Set();
|
|
1188
|
+
for (const A of e)
|
|
1189
|
+
(((P = (C = s.cars) == null ? void 0 : C[A.carId]) == null ? void 0 : P.tags) || []).forEach((L) => g.add(L));
|
|
1190
|
+
return s.tags.filter((A) => g.has(A));
|
|
1191
|
+
}, [e, s]), x = T(() => e ? v.size === 0 ? e : e.filter((g) => {
|
|
1192
|
+
var C, P;
|
|
1193
|
+
const k = ((P = (C = s == null ? void 0 : s.cars) == null ? void 0 : C[g.carId]) == null ? void 0 : P.tags) || [];
|
|
1194
|
+
return qe(k, v, s == null ? void 0 : s.categories);
|
|
1195
|
+
}) : [], [e, v, s]), m = T(() => te(x, c, (g, k) => {
|
|
1196
|
+
switch (k) {
|
|
683
1197
|
case "carId":
|
|
684
|
-
return I(
|
|
1198
|
+
return I(g.carId);
|
|
685
1199
|
case "driverCount":
|
|
686
|
-
return
|
|
1200
|
+
return g.driverCount || 0;
|
|
687
1201
|
case "lapTimeMs":
|
|
688
1202
|
default:
|
|
689
|
-
return
|
|
1203
|
+
return g.lapTimeMs;
|
|
690
1204
|
}
|
|
691
|
-
}), [x, c]),
|
|
692
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
693
|
-
{ key: "track", label:
|
|
1205
|
+
}), [x, c]), b = [
|
|
1206
|
+
{ key: "tracks", label: "Tracks", onClick: () => i("tracks") },
|
|
1207
|
+
{ key: "track", label: r.displayName }
|
|
694
1208
|
];
|
|
695
|
-
return t ? /* @__PURE__ */ n(
|
|
696
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
1209
|
+
return t ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1210
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(Ne, { segments: b }) }),
|
|
697
1211
|
/* @__PURE__ */ n(
|
|
698
|
-
|
|
1212
|
+
Ve,
|
|
699
1213
|
{
|
|
700
|
-
availableTags:
|
|
1214
|
+
availableTags: y,
|
|
701
1215
|
activeTags: v,
|
|
702
1216
|
onToggle: f,
|
|
703
1217
|
onClear: h,
|
|
704
|
-
categories:
|
|
705
|
-
tagLabels:
|
|
1218
|
+
categories: s == null ? void 0 : s.categories,
|
|
1219
|
+
tagLabels: s == null ? void 0 : s.tagLabels
|
|
706
1220
|
}
|
|
707
1221
|
),
|
|
708
1222
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
709
1223
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
710
1224
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
711
|
-
/* @__PURE__ */ n(
|
|
1225
|
+
/* @__PURE__ */ n(U, { label: "Car", sortKey: "carId", config: c, onSort: u }),
|
|
712
1226
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
713
|
-
/* @__PURE__ */ n(
|
|
714
|
-
/* @__PURE__ */ n(
|
|
1227
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
|
|
1228
|
+
/* @__PURE__ */ n(U, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
|
|
715
1229
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
716
1230
|
] }) }),
|
|
717
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1231
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: m.map((g, k) => /* @__PURE__ */ l(
|
|
718
1232
|
"tr",
|
|
719
1233
|
{
|
|
720
1234
|
className: "pvx-row pvx-row--clickable",
|
|
721
|
-
onClick: () =>
|
|
1235
|
+
onClick: () => o(g.carId),
|
|
722
1236
|
children: [
|
|
723
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
724
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: I(
|
|
725
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
726
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(
|
|
727
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
728
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children:
|
|
1237
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: k + 1, podium: !0 }) }),
|
|
1238
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: I(g.carId) }),
|
|
1239
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(re, { userId: g.steamId || g.userId, getUserDisplay: a }) }),
|
|
1240
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(g.lapTimeMs) }),
|
|
1241
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: g.driverCount || "-" }),
|
|
1242
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: g.recordedAt ? Q(g.recordedAt) : "-" })
|
|
729
1243
|
]
|
|
730
1244
|
},
|
|
731
|
-
|
|
1245
|
+
g.carId
|
|
732
1246
|
)) })
|
|
733
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1247
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: "No lap times for this track yet." })
|
|
734
1248
|
] });
|
|
735
1249
|
}
|
|
736
|
-
function
|
|
737
|
-
const [p, c] =
|
|
738
|
-
switch (
|
|
1250
|
+
function or({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, onDriverSelect: o, onNavigate: i, highlightId: d }) {
|
|
1251
|
+
const [p, c] = ne({ key: "lapTimeMs", dir: "asc" }), u = T(() => je(e), [e]), v = T(() => te(e || [], p, (h, y) => {
|
|
1252
|
+
switch (y) {
|
|
739
1253
|
case "userId":
|
|
740
1254
|
return a(h.steamId || h.userId).displayName;
|
|
741
1255
|
case "lapCount":
|
|
@@ -745,73 +1259,73 @@ function wt({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, o
|
|
|
745
1259
|
return h.lapTimeMs;
|
|
746
1260
|
}
|
|
747
1261
|
}), [e, p, a]), f = [
|
|
748
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
749
|
-
{ key: "track", label:
|
|
750
|
-
{ key: "car", label: I(
|
|
1262
|
+
{ key: "tracks", label: "Tracks", onClick: () => i("tracks") },
|
|
1263
|
+
{ key: "track", label: r.displayName, onClick: () => i("track") },
|
|
1264
|
+
{ key: "car", label: I(s) }
|
|
751
1265
|
];
|
|
752
|
-
return t ? /* @__PURE__ */ n(
|
|
753
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
1266
|
+
return t ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1267
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(Ne, { segments: f }) }),
|
|
754
1268
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
755
1269
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
756
1270
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
757
|
-
/* @__PURE__ */ n(
|
|
758
|
-
/* @__PURE__ */ n(
|
|
1271
|
+
/* @__PURE__ */ n(U, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
|
|
1272
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
|
|
759
1273
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
760
1274
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
761
1275
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
762
1276
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
763
1277
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
764
|
-
/* @__PURE__ */ n(
|
|
1278
|
+
/* @__PURE__ */ n(U, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
|
|
765
1279
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
766
1280
|
] }) }),
|
|
767
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h,
|
|
768
|
-
const x =
|
|
1281
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h, y) => {
|
|
1282
|
+
const x = y + 1, m = h.steamId || h.userId, b = u && h.sector1Ms === u.s1, g = u && h.sector2Ms === u.s2, k = u && h.sector3Ms === u.s3;
|
|
769
1283
|
return /* @__PURE__ */ l(
|
|
770
1284
|
"tr",
|
|
771
1285
|
{
|
|
772
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
773
|
-
onClick: () =>
|
|
1286
|
+
className: `pvx-row pvx-row--clickable ${d && m === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
1287
|
+
onClick: () => o(m),
|
|
774
1288
|
children: [
|
|
775
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
776
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(
|
|
1289
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: x, podium: !0 }) }),
|
|
1290
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(re, { userId: m, getUserDisplay: a }) }),
|
|
777
1291
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(h.lapTimeMs) }),
|
|
778
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
779
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
780
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
781
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
782
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children:
|
|
1292
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${b ? "pvx-td--best-sector" : ""}`, children: F(h.sector1Ms) }),
|
|
1293
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${g ? "pvx-td--best-sector" : ""}`, children: F(h.sector2Ms) }),
|
|
1294
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: F(h.sector3Ms) }),
|
|
1295
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: Re(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
1296
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: Me(h.startingFuelL) }),
|
|
783
1297
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.lapCount || "-" }),
|
|
784
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ?
|
|
1298
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ? Q(h.recordedAt) : "-" })
|
|
785
1299
|
]
|
|
786
1300
|
},
|
|
787
|
-
|
|
1301
|
+
m
|
|
788
1302
|
);
|
|
789
1303
|
}) })
|
|
790
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1304
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: "No lap times for this car yet." })
|
|
791
1305
|
] });
|
|
792
1306
|
}
|
|
793
|
-
function
|
|
794
|
-
const { data: c, driverName: u, theoreticalBest: v, isLoading: f } =
|
|
795
|
-
const
|
|
796
|
-
return
|
|
797
|
-
}, [c]),
|
|
1307
|
+
function lr({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvalid: o, getUserDisplay: i, onToggleInvalid: d, onNavigate: p }) {
|
|
1308
|
+
const { data: c, driverName: u, theoreticalBest: v, isLoading: f } = cn(e, t.id, t.layout, r, { showInvalid: o, game: s, gameVersion: a }), { displayName: h, avatarUrl: y } = i(e, u), x = T(() => je(c, !0), [c]), m = T(() => {
|
|
1309
|
+
const g = (c == null ? void 0 : c.filter((k) => k.isValid)) || [];
|
|
1310
|
+
return g.length ? Math.min(...g.map((k) => k.lapTimeMs)) : null;
|
|
1311
|
+
}, [c]), b = [
|
|
798
1312
|
{ key: "tracks", label: "Tracks", onClick: () => p("tracks") },
|
|
799
1313
|
{ key: "track", label: t.displayName, onClick: () => p("track") },
|
|
800
|
-
{ key: "car", label: I(
|
|
1314
|
+
{ key: "car", label: I(r), onClick: () => p("car") },
|
|
801
1315
|
{ key: "driver", label: h }
|
|
802
1316
|
];
|
|
803
|
-
return f ? /* @__PURE__ */ n(
|
|
1317
|
+
return f ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
804
1318
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
805
1319
|
/* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
806
|
-
/* @__PURE__ */ n(
|
|
807
|
-
|
|
1320
|
+
/* @__PURE__ */ n(Ne, { segments: b }),
|
|
1321
|
+
y ? /* @__PURE__ */ n("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
808
1322
|
] }),
|
|
809
1323
|
/* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
|
|
810
1324
|
/* @__PURE__ */ n(
|
|
811
1325
|
"input",
|
|
812
1326
|
{
|
|
813
1327
|
type: "checkbox",
|
|
814
|
-
checked:
|
|
1328
|
+
checked: o,
|
|
815
1329
|
onChange: d,
|
|
816
1330
|
className: "pvx-checkbox"
|
|
817
1331
|
}
|
|
@@ -824,11 +1338,11 @@ function Ct({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvali
|
|
|
824
1338
|
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: q(v.lapTimeMs) }),
|
|
825
1339
|
/* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
|
|
826
1340
|
"(",
|
|
827
|
-
|
|
1341
|
+
F(v.sector1Ms),
|
|
828
1342
|
" + ",
|
|
829
|
-
|
|
1343
|
+
F(v.sector2Ms),
|
|
830
1344
|
" + ",
|
|
831
|
-
|
|
1345
|
+
F(v.sector3Ms),
|
|
832
1346
|
")"
|
|
833
1347
|
] })
|
|
834
1348
|
] }),
|
|
@@ -845,27 +1359,27 @@ function Ct({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvali
|
|
|
845
1359
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
846
1360
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
847
1361
|
] }) }),
|
|
848
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((
|
|
849
|
-
const
|
|
850
|
-
let
|
|
851
|
-
return
|
|
852
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${
|
|
853
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children:
|
|
854
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(
|
|
855
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
856
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
857
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children:
|
|
858
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", title:
|
|
859
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
860
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
861
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children:
|
|
862
|
-
] },
|
|
1362
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((g, k) => {
|
|
1363
|
+
const C = g.isValid && g.lapTimeMs === m, P = x && g.isValid && g.sector1Ms === x.s1, A = x && g.isValid && g.sector2Ms === x.s2, N = x && g.isValid && g.sector3Ms === x.s3;
|
|
1364
|
+
let L = "pvx-row";
|
|
1365
|
+
return g.isValid || (L += " pvx-row--invalid"), C && (L += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: L, children: [
|
|
1366
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: k + 1 }) }),
|
|
1367
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: g.lapNumber || "-" }),
|
|
1368
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(g.lapTimeMs) }),
|
|
1369
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${P ? "pvx-td--best-sector" : ""}`, children: F(g.sector1Ms) }),
|
|
1370
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${A ? "pvx-td--best-sector" : ""}`, children: F(g.sector2Ms) }),
|
|
1371
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: F(g.sector3Ms) }),
|
|
1372
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", title: g.isValid ? void 0 : g.invalidReason || "Invalid", children: g.isValid ? /* @__PURE__ */ n(Vn, {}) : /* @__PURE__ */ n(Kn, {}) }),
|
|
1373
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: Re(g.tyreCompound), children: g.tyreCompound || "-" }),
|
|
1374
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: Me(g.startingFuelL) }),
|
|
1375
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: Q(g.timestamp) })
|
|
1376
|
+
] }, g.id);
|
|
863
1377
|
}) })
|
|
864
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1378
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: o ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
865
1379
|
] });
|
|
866
1380
|
}
|
|
867
|
-
function
|
|
868
|
-
const [
|
|
1381
|
+
function cr({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion: a, onComboSelect: o }) {
|
|
1382
|
+
const [i, d] = ne({ key: "rank", dir: "asc" }), [p, c] = E(null), u = T(() => e ? te(e, i, (f, h) => {
|
|
869
1383
|
switch (h) {
|
|
870
1384
|
case "rating":
|
|
871
1385
|
return f.rating;
|
|
@@ -877,10 +1391,10 @@ function Lt({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
877
1391
|
default:
|
|
878
1392
|
return f.rank;
|
|
879
1393
|
}
|
|
880
|
-
}) : [], [e,
|
|
881
|
-
if (t) return /* @__PURE__ */ n(
|
|
1394
|
+
}) : [], [e, i]);
|
|
1395
|
+
if (t) return /* @__PURE__ */ n(Z, {});
|
|
882
1396
|
if (!(e != null && e.length))
|
|
883
|
-
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(
|
|
1397
|
+
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(Y, { message: "Not enough data for rankings yet." }) });
|
|
884
1398
|
const v = 5;
|
|
885
1399
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
886
1400
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
@@ -900,25 +1414,25 @@ function Lt({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
900
1414
|
] }),
|
|
901
1415
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
902
1416
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
903
|
-
/* @__PURE__ */ n(
|
|
1417
|
+
/* @__PURE__ */ n(U, { label: "#", sortKey: "rank", config: i, onSort: d, className: "pvx-th--narrow" }),
|
|
904
1418
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
905
|
-
/* @__PURE__ */ n(
|
|
906
|
-
/* @__PURE__ */ n(
|
|
907
|
-
/* @__PURE__ */ n(
|
|
1419
|
+
/* @__PURE__ */ n(U, { label: "Rating", sortKey: "rating", config: i, onSort: d }),
|
|
1420
|
+
/* @__PURE__ */ n(U, { label: "Cars", sortKey: "distinctCars", config: i, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
1421
|
+
/* @__PURE__ */ n(U, { label: "Combos", sortKey: "comboCount", config: i, onSort: d, className: "pvx-hidden-below-sm" })
|
|
908
1422
|
] }) }),
|
|
909
1423
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
|
|
910
1424
|
const h = p === f.identifier;
|
|
911
1425
|
return /* @__PURE__ */ n(
|
|
912
|
-
|
|
1426
|
+
Hn,
|
|
913
1427
|
{
|
|
914
1428
|
driver: f,
|
|
915
|
-
getUserDisplay:
|
|
1429
|
+
getUserDisplay: r,
|
|
916
1430
|
isExpanded: h,
|
|
917
1431
|
onToggle: () => c(h ? null : f.identifier),
|
|
918
1432
|
colCount: v,
|
|
919
|
-
game:
|
|
1433
|
+
game: s,
|
|
920
1434
|
gameVersion: a,
|
|
921
|
-
onComboSelect:
|
|
1435
|
+
onComboSelect: o
|
|
922
1436
|
},
|
|
923
1437
|
f.identifier
|
|
924
1438
|
);
|
|
@@ -926,28 +1440,28 @@ function Lt({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
926
1440
|
] }) })
|
|
927
1441
|
] });
|
|
928
1442
|
}
|
|
929
|
-
function
|
|
1443
|
+
function Hn({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount: a, game: o, gameVersion: i, onComboSelect: d }) {
|
|
930
1444
|
const p = e.identifier;
|
|
931
|
-
return /* @__PURE__ */ l(
|
|
1445
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
932
1446
|
/* @__PURE__ */ l(
|
|
933
1447
|
"tr",
|
|
934
1448
|
{
|
|
935
1449
|
className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
936
|
-
onClick:
|
|
1450
|
+
onClick: s,
|
|
937
1451
|
children: [
|
|
938
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
939
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(
|
|
1452
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: e.rank, podium: !0 }) }),
|
|
1453
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(re, { userId: p, getUserDisplay: t }) }),
|
|
940
1454
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
|
|
941
1455
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
942
1456
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
|
|
943
1457
|
e.comboCount,
|
|
944
|
-
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${
|
|
1458
|
+
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${r ? "pvx-rankings-chevron--open" : ""}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) })
|
|
945
1459
|
] }) })
|
|
946
1460
|
]
|
|
947
1461
|
}
|
|
948
1462
|
),
|
|
949
|
-
|
|
950
|
-
const v = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: v, car: c.carId, highlight: p, game:
|
|
1463
|
+
r && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
|
|
1464
|
+
const v = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: v, car: c.carId, highlight: p, game: o, gameVersion: i }) : void 0;
|
|
951
1465
|
return /* @__PURE__ */ l(
|
|
952
1466
|
"div",
|
|
953
1467
|
{
|
|
@@ -956,7 +1470,7 @@ function un({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
956
1470
|
role: f ? "button" : void 0,
|
|
957
1471
|
children: [
|
|
958
1472
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
|
|
959
|
-
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children:
|
|
1473
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: z(c.trackId, c.layout, o) }),
|
|
960
1474
|
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
|
|
961
1475
|
] }),
|
|
962
1476
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
|
|
@@ -980,160 +1494,140 @@ function un({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
980
1494
|
}) }) }) })
|
|
981
1495
|
] });
|
|
982
1496
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
AUS: "🇦🇺",
|
|
994
|
-
BRA: "🇧🇷",
|
|
995
|
-
JPN: "🇯🇵",
|
|
996
|
-
CAN: "🇨🇦",
|
|
997
|
-
POL: "🇵🇱",
|
|
998
|
-
AUT: "🇦🇹",
|
|
999
|
-
BEL: "🇧🇪",
|
|
1000
|
-
PRT: "🇵🇹",
|
|
1001
|
-
NOR: "🇳🇴",
|
|
1002
|
-
DNK: "🇩🇰",
|
|
1003
|
-
FIN: "🇫🇮",
|
|
1004
|
-
IRL: "🇮🇪",
|
|
1005
|
-
CHE: "🇨🇭",
|
|
1006
|
-
NZL: "🇳🇿",
|
|
1007
|
-
MEX: "🇲🇽",
|
|
1008
|
-
ARG: "🇦🇷",
|
|
1009
|
-
CZE: "🇨🇿",
|
|
1010
|
-
HUN: "🇭🇺",
|
|
1011
|
-
RUS: "🇷🇺",
|
|
1012
|
-
TUR: "🇹🇷",
|
|
1013
|
-
KOR: "🇰🇷"
|
|
1014
|
-
}, he = ["🥇", "🥈", "🥉"], mn = {
|
|
1015
|
-
championship: "Championship",
|
|
1016
|
-
series: "Series",
|
|
1017
|
-
event: "Event",
|
|
1018
|
-
hotlap: "Hotlap"
|
|
1019
|
-
}, vn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1020
|
-
function ge(e) {
|
|
1021
|
-
const t = vn.indexOf(e);
|
|
1022
|
-
if (t >= 0) return t;
|
|
1023
|
-
const s = e.match(/^PRACTICE_(\d+)$/);
|
|
1024
|
-
return s ? 100 + parseInt(s[1]) : 999;
|
|
1025
|
-
}
|
|
1026
|
-
function Z(e) {
|
|
1027
|
-
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1028
|
-
return t ? `P${t[1]}` : e;
|
|
1029
|
-
}
|
|
1030
|
-
function me({ position: e }) {
|
|
1031
|
-
return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
|
|
1032
|
-
}
|
|
1033
|
-
function X({ nation: e }) {
|
|
1034
|
-
const t = e && hn[e];
|
|
1035
|
-
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
1036
|
-
}
|
|
1037
|
-
function xn({ sessions: e, activeSession: t, onSelect: s }) {
|
|
1038
|
-
if (!e || e.length <= 1) return null;
|
|
1039
|
-
const r = [...e].sort(
|
|
1040
|
-
(a, i) => ge(a.type) - ge(i.type)
|
|
1041
|
-
);
|
|
1042
|
-
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: r.map((a) => /* @__PURE__ */ n(
|
|
1043
|
-
"button",
|
|
1044
|
-
{
|
|
1045
|
-
onClick: () => s(a.type),
|
|
1046
|
-
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1047
|
-
children: Z(a.type)
|
|
1048
|
-
},
|
|
1049
|
-
a.type
|
|
1050
|
-
)) });
|
|
1051
|
-
}
|
|
1052
|
-
function gn({ type: e }) {
|
|
1053
|
-
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: mn[e] || e });
|
|
1054
|
-
}
|
|
1055
|
-
function se({ children: e, variant: t = "default" }) {
|
|
1056
|
-
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1057
|
-
}
|
|
1058
|
-
function fn(e) {
|
|
1059
|
-
if (!e) return "TBD";
|
|
1060
|
-
const t = new Date(e);
|
|
1061
|
-
if (isNaN(t)) return "TBD";
|
|
1062
|
-
const s = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), r = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1063
|
-
return `${s} • ${r}`;
|
|
1064
|
-
}
|
|
1065
|
-
function Nn(e) {
|
|
1066
|
-
return e.reduce((t, s) => {
|
|
1067
|
-
var r;
|
|
1068
|
-
return (r = s.splits) != null && r.length ? t ? t.map((a, i) => {
|
|
1069
|
-
const o = s.splits[i];
|
|
1070
|
-
return o && o < a ? o : a;
|
|
1071
|
-
}) : [...s.splits] : t;
|
|
1072
|
-
}, null);
|
|
1497
|
+
function On({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
|
|
1498
|
+
const { data: a } = De(e), o = En(a, t);
|
|
1499
|
+
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
|
|
1500
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
|
|
1501
|
+
o.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: o.map((i, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1502
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: xe[d] || "" }),
|
|
1503
|
+
/* @__PURE__ */ n(ee, { nation: i.nation }),
|
|
1504
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: i.driverName })
|
|
1505
|
+
] }, i.driverId || d)) })
|
|
1506
|
+
] });
|
|
1073
1507
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1508
|
+
const Gn = {
|
|
1509
|
+
GameModeSelectionWeatherType_CLEAR: "Clear",
|
|
1510
|
+
GameModeSelectionWeatherType_SCATTERED_CLOUDS: "Scattered Clouds",
|
|
1511
|
+
GameModeSelectionWeatherType_BROKEN_CLOUDS: "Broken Clouds",
|
|
1512
|
+
GameModeSelectionWeatherType_OVERCAST: "Overcast",
|
|
1513
|
+
GameModeSelectionWeatherType_DRIZZLE: "Drizzle",
|
|
1514
|
+
GameModeSelectionWeatherType_DAMP: "Damp",
|
|
1515
|
+
GameModeSelectionWeatherType_RAIN: "Rain",
|
|
1516
|
+
GameModeSelectionWeatherType_HEAVY_RAIN: "Heavy Rain"
|
|
1517
|
+
}, zn = {
|
|
1518
|
+
viewBox: "0 0 24 24",
|
|
1519
|
+
fill: "none",
|
|
1520
|
+
stroke: "currentColor",
|
|
1521
|
+
strokeWidth: 1.5,
|
|
1522
|
+
strokeLinecap: "round",
|
|
1523
|
+
strokeLinejoin: "round"
|
|
1524
|
+
};
|
|
1525
|
+
function Qn() {
|
|
1526
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1527
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
|
|
1528
|
+
/* @__PURE__ */ n("path", { d: "M12 2v2" }),
|
|
1529
|
+
/* @__PURE__ */ n("path", { d: "M12 20v2" }),
|
|
1530
|
+
/* @__PURE__ */ n("path", { d: "m4.93 4.93 1.41 1.41" }),
|
|
1531
|
+
/* @__PURE__ */ n("path", { d: "m17.66 17.66 1.41 1.41" }),
|
|
1532
|
+
/* @__PURE__ */ n("path", { d: "M2 12h2" }),
|
|
1533
|
+
/* @__PURE__ */ n("path", { d: "M20 12h2" }),
|
|
1534
|
+
/* @__PURE__ */ n("path", { d: "m6.34 17.66-1.41 1.41" }),
|
|
1535
|
+
/* @__PURE__ */ n("path", { d: "m19.07 4.93-1.41 1.41" })
|
|
1536
|
+
] });
|
|
1076
1537
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return /* @__PURE__ */
|
|
1538
|
+
function Yn() {
|
|
1539
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1540
|
+
/* @__PURE__ */ n("path", { d: "M12 2v2" }),
|
|
1541
|
+
/* @__PURE__ */ n("path", { d: "m4.93 4.93 1.41 1.41" }),
|
|
1542
|
+
/* @__PURE__ */ n("path", { d: "M20 12h2" }),
|
|
1543
|
+
/* @__PURE__ */ n("path", { d: "m19.07 4.93-1.41 1.41" }),
|
|
1544
|
+
/* @__PURE__ */ n("path", { d: "M15.947 12.65a4 4 0 0 0-5.925-4.128" }),
|
|
1545
|
+
/* @__PURE__ */ n("path", { d: "M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z" })
|
|
1546
|
+
] });
|
|
1079
1547
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
if (!Number.isNaN(t)) return Date.now() >= t;
|
|
1086
|
-
}
|
|
1087
|
-
return !!e.isClosed;
|
|
1548
|
+
function Zn() {
|
|
1549
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1550
|
+
/* @__PURE__ */ n("path", { d: "M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" }),
|
|
1551
|
+
/* @__PURE__ */ n("path", { d: "M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5" })
|
|
1552
|
+
] });
|
|
1088
1553
|
}
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1091
|
-
|
|
1554
|
+
function Jn() {
|
|
1555
|
+
return /* @__PURE__ */ n("path", { d: "M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" });
|
|
1556
|
+
}
|
|
1557
|
+
function Xn() {
|
|
1558
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1559
|
+
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1560
|
+
/* @__PURE__ */ n("path", { d: "M8 19v1" }),
|
|
1561
|
+
/* @__PURE__ */ n("path", { d: "M8 14v1" }),
|
|
1562
|
+
/* @__PURE__ */ n("path", { d: "M16 19v1" }),
|
|
1563
|
+
/* @__PURE__ */ n("path", { d: "M16 14v1" }),
|
|
1564
|
+
/* @__PURE__ */ n("path", { d: "M12 21v1" }),
|
|
1565
|
+
/* @__PURE__ */ n("path", { d: "M12 16v1" })
|
|
1566
|
+
] });
|
|
1092
1567
|
}
|
|
1093
|
-
function
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
const a = new Date(r.startTime);
|
|
1100
|
-
isNaN(a) || (!s || a > s) && (s = a);
|
|
1101
|
-
}
|
|
1102
|
-
return s;
|
|
1568
|
+
function et() {
|
|
1569
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1570
|
+
/* @__PURE__ */ n("path", { d: "M16 17H7" }),
|
|
1571
|
+
/* @__PURE__ */ n("path", { d: "M17 21H9" }),
|
|
1572
|
+
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" })
|
|
1573
|
+
] });
|
|
1103
1574
|
}
|
|
1104
|
-
function
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1575
|
+
function nt() {
|
|
1576
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1577
|
+
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1578
|
+
/* @__PURE__ */ n("path", { d: "M16 14v6" }),
|
|
1579
|
+
/* @__PURE__ */ n("path", { d: "M8 14v6" }),
|
|
1580
|
+
/* @__PURE__ */ n("path", { d: "M12 16v6" })
|
|
1581
|
+
] });
|
|
1110
1582
|
}
|
|
1111
|
-
function
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
const s = e == null ? void 0 : e.standings;
|
|
1118
|
-
return Array.isArray(s) ? [...s].sort((r, a) => (r.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1119
|
-
}
|
|
1120
|
-
function wn({ competitionId: e, topN: t = 3, label: s = "Completed", className: r }) {
|
|
1121
|
-
const { data: a } = Se(e), i = kn(a, t);
|
|
1122
|
-
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${r || ""}`, children: [
|
|
1123
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: s }),
|
|
1124
|
-
i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1125
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: he[d] || "" }),
|
|
1126
|
-
/* @__PURE__ */ n(X, { nation: o.nation }),
|
|
1127
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
|
|
1128
|
-
] }, o.driverId || d)) })
|
|
1583
|
+
function tt() {
|
|
1584
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1585
|
+
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1586
|
+
/* @__PURE__ */ n("path", { d: "m9.2 22 3-7" }),
|
|
1587
|
+
/* @__PURE__ */ n("path", { d: "m9 13-3 7" }),
|
|
1588
|
+
/* @__PURE__ */ n("path", { d: "m17 13-3 7" })
|
|
1129
1589
|
] });
|
|
1130
1590
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1591
|
+
const rt = {
|
|
1592
|
+
GameModeSelectionWeatherType_CLEAR: Qn,
|
|
1593
|
+
GameModeSelectionWeatherType_SCATTERED_CLOUDS: Yn,
|
|
1594
|
+
GameModeSelectionWeatherType_BROKEN_CLOUDS: Zn,
|
|
1595
|
+
GameModeSelectionWeatherType_OVERCAST: Jn,
|
|
1596
|
+
GameModeSelectionWeatherType_DRIZZLE: Xn,
|
|
1597
|
+
GameModeSelectionWeatherType_DAMP: et,
|
|
1598
|
+
GameModeSelectionWeatherType_RAIN: nt,
|
|
1599
|
+
GameModeSelectionWeatherType_HEAVY_RAIN: tt
|
|
1600
|
+
};
|
|
1601
|
+
function st({ weatherType: e, weatherBehaviour: t, className: r }) {
|
|
1602
|
+
const s = e ? rt[e] : null;
|
|
1603
|
+
if (!s) return null;
|
|
1604
|
+
const a = Gn[e] || e, o = t === "GameModeSelectionWeatherBehaviour_DYNAMIC", i = o ? `${a} · Dynamic` : a;
|
|
1605
|
+
return /* @__PURE__ */ l(
|
|
1606
|
+
"span",
|
|
1607
|
+
{
|
|
1608
|
+
className: `pvx-weather-icon ${r || ""}`.trim(),
|
|
1609
|
+
title: i,
|
|
1610
|
+
"aria-label": i,
|
|
1611
|
+
children: [
|
|
1612
|
+
/* @__PURE__ */ n("svg", { className: "pvx-weather-icon-main", ...zn, children: /* @__PURE__ */ n(s, {}) }),
|
|
1613
|
+
o && /* @__PURE__ */ n("span", { className: "pvx-weather-icon-dynamic", "aria-hidden": "true", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1614
|
+
/* @__PURE__ */ n("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1615
|
+
/* @__PURE__ */ n("path", { d: "M21 3v5h-5" }),
|
|
1616
|
+
/* @__PURE__ */ n("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
1617
|
+
/* @__PURE__ */ n("path", { d: "M8 16H3v5" })
|
|
1618
|
+
] }) })
|
|
1619
|
+
]
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1133
1622
|
}
|
|
1134
|
-
function
|
|
1135
|
-
|
|
1136
|
-
|
|
1623
|
+
function dr({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
|
|
1624
|
+
return t ? /* @__PURE__ */ n(W, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((o) => /* @__PURE__ */ n(at, { comp: o, onSelect: r, onRegister: s || r }, o.id)) }) : /* @__PURE__ */ n(_, { message: "No competitions available." });
|
|
1625
|
+
}
|
|
1626
|
+
function at({ comp: e, onSelect: t, onRegister: r }) {
|
|
1627
|
+
var A, N, L, w, D;
|
|
1628
|
+
const { cdnUrl: s } = S(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, o = e.registration, i = (o == null ? void 0 : o.currentCount) || 0, d = o == null ? void 0 : o.maxParticipants, p = d && i >= d, c = (o == null ? void 0 : o.deadline) && new Date(o.deadline) < /* @__PURE__ */ new Date(), u = (o == null ? void 0 : o.isOpen) && !c && !p, v = /* @__PURE__ */ new Date(), f = (A = e.rounds) == null ? void 0 : A.find(
|
|
1629
|
+
($) => $.startTime && new Date($.startTime) <= v && !O($)
|
|
1630
|
+
), h = f || ((N = e.rounds) == null ? void 0 : N.find(($) => $.startTime && new Date($.startTime) >= v)), y = !!f, x = ((L = e.rounds) == null ? void 0 : L.length) || 0, m = e.type === "hotlap", b = m && x > 1, g = m ? ((w = e.rounds) == null ? void 0 : w.filter(O).length) || 0 : ((D = e.rounds) == null ? void 0 : D.filter(($) => $.isFinalized).length) || 0, k = _e(e), C = k === "recently-completed" || k === "archived", P = e.type === "championship";
|
|
1137
1631
|
return /* @__PURE__ */ l(
|
|
1138
1632
|
"div",
|
|
1139
1633
|
{
|
|
@@ -1141,51 +1635,61 @@ function Cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1141
1635
|
onClick: () => t(e.id),
|
|
1142
1636
|
role: "button",
|
|
1143
1637
|
tabIndex: 0,
|
|
1144
|
-
onKeyDown: (
|
|
1145
|
-
(
|
|
1638
|
+
onKeyDown: ($) => {
|
|
1639
|
+
($.key === "Enter" || $.key === " ") && ($.preventDefault(), t(e.id));
|
|
1146
1640
|
},
|
|
1147
1641
|
children: [
|
|
1148
|
-
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(
|
|
1642
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(ot, {}) }) }),
|
|
1149
1643
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
|
|
1150
1644
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1151
1645
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1152
1646
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
|
|
1153
|
-
/* @__PURE__ */ n(
|
|
1154
|
-
e.game && /* @__PURE__ */ n(
|
|
1155
|
-
e.formatDescription && e.formatDescription.split(", ").map((
|
|
1647
|
+
/* @__PURE__ */ n(Rn, { type: e.type }),
|
|
1648
|
+
e.game && /* @__PURE__ */ n(ae, { children: e.game.toUpperCase() }),
|
|
1649
|
+
e.formatDescription && e.formatDescription.split(", ").map(($, j) => /* @__PURE__ */ n(ae, { variant: "format", children: $ }, j))
|
|
1156
1650
|
] }),
|
|
1157
|
-
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((
|
|
1651
|
+
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map(($, j) => /* @__PURE__ */ n(ae, { children: $ }, j)) }),
|
|
1158
1652
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
|
|
1159
|
-
|
|
1160
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
1653
|
+
h ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1654
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: y ? "Live:" : "Next:" }),
|
|
1161
1655
|
" ",
|
|
1162
|
-
(e.type !== "hotlap" ||
|
|
1163
|
-
|
|
1656
|
+
(e.type !== "hotlap" || b) && `R${h.roundNumber} `,
|
|
1657
|
+
h.track || "TBD",
|
|
1164
1658
|
" · ",
|
|
1165
|
-
|
|
1166
|
-
|
|
1659
|
+
Mn(h.startTime),
|
|
1660
|
+
(h.weatherType || e.weatherType) && /* @__PURE__ */ l(B, { children: [
|
|
1661
|
+
" ",
|
|
1662
|
+
/* @__PURE__ */ n(
|
|
1663
|
+
st,
|
|
1664
|
+
{
|
|
1665
|
+
weatherType: h.weatherType || e.weatherType,
|
|
1666
|
+
weatherBehaviour: h.weatherBehaviour || e.weatherBehaviour
|
|
1667
|
+
}
|
|
1668
|
+
)
|
|
1669
|
+
] })
|
|
1670
|
+
] }) : x > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1167
1671
|
g,
|
|
1168
1672
|
"/",
|
|
1169
|
-
|
|
1673
|
+
x,
|
|
1170
1674
|
" rounds completed"
|
|
1171
1675
|
] }) : null,
|
|
1172
|
-
|
|
1173
|
-
|
|
1676
|
+
x > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
|
|
1677
|
+
x,
|
|
1174
1678
|
" round",
|
|
1175
|
-
|
|
1679
|
+
x !== 1 ? "s" : ""
|
|
1176
1680
|
] })
|
|
1177
1681
|
] }),
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1682
|
+
C && (P || b) && /* @__PURE__ */ n(On, { competitionId: e.id }),
|
|
1683
|
+
o && !C && /* @__PURE__ */ n(
|
|
1684
|
+
it,
|
|
1181
1685
|
{
|
|
1182
1686
|
competitionId: e.id,
|
|
1183
1687
|
regOpen: u,
|
|
1184
1688
|
isFull: p,
|
|
1185
1689
|
deadlinePassed: c,
|
|
1186
|
-
regCount:
|
|
1690
|
+
regCount: i,
|
|
1187
1691
|
regMax: d,
|
|
1188
|
-
onRegister:
|
|
1692
|
+
onRegister: r
|
|
1189
1693
|
}
|
|
1190
1694
|
)
|
|
1191
1695
|
] })
|
|
@@ -1193,13 +1697,13 @@ function Cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1193
1697
|
}
|
|
1194
1698
|
);
|
|
1195
1699
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const { isPowerMode: d } =
|
|
1700
|
+
function it({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: o, onRegister: i }) {
|
|
1701
|
+
const { isPowerMode: d } = me(), p = ve(e), { data: c } = he(e), u = (c == null ? void 0 : c.isRegistered) || !1, v = o ? a / o * 100 : 0, f = v >= 100 ? "full" : v >= 75 ? "warning" : "ok";
|
|
1198
1702
|
return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
|
|
1199
1703
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
|
|
1200
1704
|
a,
|
|
1201
1705
|
"/",
|
|
1202
|
-
|
|
1706
|
+
o || "∞",
|
|
1203
1707
|
" drivers"
|
|
1204
1708
|
] }) }),
|
|
1205
1709
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
|
|
@@ -1207,7 +1711,7 @@ function Ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1207
1711
|
{
|
|
1208
1712
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
1209
1713
|
onClick: (h) => {
|
|
1210
|
-
h.stopPropagation(),
|
|
1714
|
+
h.stopPropagation(), i(e);
|
|
1211
1715
|
},
|
|
1212
1716
|
children: "✓ Registered"
|
|
1213
1717
|
}
|
|
@@ -1216,7 +1720,7 @@ function Ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1216
1720
|
{
|
|
1217
1721
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1218
1722
|
onClick: (h) => {
|
|
1219
|
-
h.stopPropagation(),
|
|
1723
|
+
h.stopPropagation(), i(e);
|
|
1220
1724
|
},
|
|
1221
1725
|
children: "Register"
|
|
1222
1726
|
}
|
|
@@ -1230,10 +1734,10 @@ function Ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1230
1734
|
onClick: (h) => h.stopPropagation(),
|
|
1231
1735
|
children: "Register"
|
|
1232
1736
|
}
|
|
1233
|
-
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children:
|
|
1737
|
+
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
|
|
1234
1738
|
] });
|
|
1235
1739
|
}
|
|
1236
|
-
function
|
|
1740
|
+
function ot() {
|
|
1237
1741
|
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: [
|
|
1238
1742
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1239
1743
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1243,24 +1747,24 @@ function Sn() {
|
|
|
1243
1747
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1244
1748
|
] });
|
|
1245
1749
|
}
|
|
1246
|
-
function
|
|
1750
|
+
function lt({ competitionId: e, className: t }) {
|
|
1247
1751
|
var c, u, v;
|
|
1248
|
-
const { data:
|
|
1249
|
-
if (
|
|
1250
|
-
return /* @__PURE__ */ n(
|
|
1251
|
-
if (!((c =
|
|
1252
|
-
return /* @__PURE__ */ n(
|
|
1253
|
-
const
|
|
1752
|
+
const { data: r, isLoading: s } = De(e), { data: a, isLoading: o } = Pe(e);
|
|
1753
|
+
if (s || o)
|
|
1754
|
+
return /* @__PURE__ */ n(W, { message: "Loading standings..." });
|
|
1755
|
+
if (!((c = r == null ? void 0 : r.standings) != null && c.length))
|
|
1756
|
+
return /* @__PURE__ */ n(_, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1757
|
+
const i = (a == null ? void 0 : a.type) === "hotlap", d = i ? ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter(O)) || [] : ((v = a == null ? void 0 : a.rounds) == null ? void 0 : v.filter((f) => f.isFinalized)) || [], p = r.roundsClosed ?? r.roundsCompleted ?? 0;
|
|
1254
1758
|
return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
|
|
1255
1759
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
1256
|
-
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children:
|
|
1760
|
+
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: i ? "Overall Standings" : "Championship Standings" }),
|
|
1257
1761
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
1258
1762
|
"After ",
|
|
1259
1763
|
p,
|
|
1260
1764
|
" round",
|
|
1261
1765
|
p !== 1 ? "s" : "",
|
|
1262
|
-
|
|
1263
|
-
|
|
1766
|
+
i ? " closed" : "",
|
|
1767
|
+
r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
|
|
1264
1768
|
] })
|
|
1265
1769
|
] }) }),
|
|
1266
1770
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
@@ -1283,8 +1787,8 @@ function $n({ competitionId: e, className: t }) {
|
|
|
1283
1787
|
f.roundNumber
|
|
1284
1788
|
))
|
|
1285
1789
|
] }) }),
|
|
1286
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1287
|
-
|
|
1790
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((f) => /* @__PURE__ */ n(
|
|
1791
|
+
ct,
|
|
1288
1792
|
{
|
|
1289
1793
|
driver: f,
|
|
1290
1794
|
columnRounds: d
|
|
@@ -1294,22 +1798,22 @@ function $n({ competitionId: e, className: t }) {
|
|
|
1294
1798
|
] }) })
|
|
1295
1799
|
] });
|
|
1296
1800
|
}
|
|
1297
|
-
function
|
|
1298
|
-
var
|
|
1299
|
-
const
|
|
1300
|
-
((
|
|
1301
|
-
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0,
|
|
1302
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1303
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
1801
|
+
function ct({ driver: e, columnRounds: t }) {
|
|
1802
|
+
var i, d, p;
|
|
1803
|
+
const r = e.position <= 3, s = new Map(
|
|
1804
|
+
((i = e.roundResults) == null ? void 0 : i.map((c) => [c.roundNumber, c])) || []
|
|
1805
|
+
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, o = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
|
|
1806
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
|
|
1807
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: e.position }) }),
|
|
1304
1808
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1305
|
-
/* @__PURE__ */ n(
|
|
1809
|
+
/* @__PURE__ */ n(ee, { nation: e.nation }),
|
|
1306
1810
|
e.driverName
|
|
1307
1811
|
] }),
|
|
1308
1812
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1309
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children:
|
|
1813
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: o || "-" }),
|
|
1310
1814
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1311
1815
|
t.map((c) => {
|
|
1312
|
-
const u =
|
|
1816
|
+
const u = s.get(c.roundNumber), v = u == null ? void 0 : u.dropped;
|
|
1313
1817
|
return /* @__PURE__ */ n(
|
|
1314
1818
|
"td",
|
|
1315
1819
|
{
|
|
@@ -1327,7 +1831,7 @@ function Rn({ driver: e, columnRounds: t }) {
|
|
|
1327
1831
|
})
|
|
1328
1832
|
] });
|
|
1329
1833
|
}
|
|
1330
|
-
const
|
|
1834
|
+
const Ce = [
|
|
1331
1835
|
"#f59e0b",
|
|
1332
1836
|
"#3b82f6",
|
|
1333
1837
|
"#ef4444",
|
|
@@ -1353,109 +1857,109 @@ const fe = [
|
|
|
1353
1857
|
"#f87171",
|
|
1354
1858
|
"#38bdf8"
|
|
1355
1859
|
];
|
|
1356
|
-
function
|
|
1357
|
-
return e.map((
|
|
1358
|
-
driverName:
|
|
1359
|
-
carClass:
|
|
1360
|
-
positions:
|
|
1361
|
-
const
|
|
1362
|
-
return
|
|
1860
|
+
function dt(e, t) {
|
|
1861
|
+
return e.map((r) => ({
|
|
1862
|
+
driverName: r.driverName,
|
|
1863
|
+
carClass: r.carClass,
|
|
1864
|
+
positions: r.positions.map((s, a) => {
|
|
1865
|
+
const i = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName === r.driverName);
|
|
1866
|
+
return i === -1 ? null : i + 1;
|
|
1363
1867
|
})
|
|
1364
1868
|
}));
|
|
1365
1869
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const [
|
|
1368
|
-
a((
|
|
1369
|
-
const
|
|
1370
|
-
return
|
|
1870
|
+
function pt({ title: e, drivers: t, timingPoints: r }) {
|
|
1871
|
+
const [s, a] = E(() => /* @__PURE__ */ new Set()), o = H((N) => {
|
|
1872
|
+
a((L) => {
|
|
1873
|
+
const w = new Set(L);
|
|
1874
|
+
return w.has(N) ? w.delete(N) : w.add(N), w;
|
|
1371
1875
|
});
|
|
1372
|
-
}, []), { series:
|
|
1876
|
+
}, []), { series: i, maxPos: d } = T(() => {
|
|
1373
1877
|
let N = 1;
|
|
1374
|
-
return { series: t.map((
|
|
1375
|
-
for (const
|
|
1376
|
-
return { ...
|
|
1878
|
+
return { series: t.map((w, D) => {
|
|
1879
|
+
for (const $ of w.positions) $ != null && $ > N && (N = $);
|
|
1880
|
+
return { ...w, colour: Ce[D % Ce.length] };
|
|
1377
1881
|
}), maxPos: N };
|
|
1378
1882
|
}, [t]);
|
|
1379
|
-
if (!
|
|
1883
|
+
if (!i.length || r.length < 2)
|
|
1380
1884
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-empty", children: [
|
|
1381
1885
|
"No position data for ",
|
|
1382
1886
|
e || "this race",
|
|
1383
1887
|
"."
|
|
1384
1888
|
] });
|
|
1385
|
-
const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34,
|
|
1386
|
-
const
|
|
1387
|
-
let
|
|
1388
|
-
return N.forEach((
|
|
1389
|
-
|
|
1390
|
-
}),
|
|
1391
|
-
},
|
|
1889
|
+
const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34, y = p - c - u, x = Math.max(f * (d - 1), f), m = v + x + h, b = r.length, g = (N) => c + (b === 1 ? 0 : N / (b - 1) * y), k = (N) => v + (d === 1 ? 0 : (N - 1) / (d - 1) * x), C = (N) => {
|
|
1890
|
+
const L = [];
|
|
1891
|
+
let w = [];
|
|
1892
|
+
return N.forEach((D, $) => {
|
|
1893
|
+
D == null ? w.length && (L.push(w), w = []) : w.push([g($), k(D)]);
|
|
1894
|
+
}), w.length && L.push(w), L;
|
|
1895
|
+
}, P = s.size > 0, A = Math.ceil(b / 24);
|
|
1392
1896
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-chart", children: [
|
|
1393
1897
|
e && /* @__PURE__ */ n("div", { className: "pvx-positions-title", children: e }),
|
|
1394
1898
|
/* @__PURE__ */ l(
|
|
1395
1899
|
"svg",
|
|
1396
1900
|
{
|
|
1397
1901
|
className: "pvx-positions-svg",
|
|
1398
|
-
viewBox: `0 0 ${p} ${
|
|
1902
|
+
viewBox: `0 0 ${p} ${m}`,
|
|
1399
1903
|
preserveAspectRatio: "xMidYMid meet",
|
|
1400
1904
|
role: "img",
|
|
1401
1905
|
"aria-label": `Race position progression${e ? ` — ${e}` : ""}`,
|
|
1402
1906
|
children: [
|
|
1403
|
-
Array.from({ length: d }, (N,
|
|
1907
|
+
Array.from({ length: d }, (N, L) => L + 1).map((N) => /* @__PURE__ */ l("g", { children: [
|
|
1404
1908
|
/* @__PURE__ */ n(
|
|
1405
1909
|
"line",
|
|
1406
1910
|
{
|
|
1407
1911
|
className: "pvx-positions-grid",
|
|
1408
1912
|
x1: c,
|
|
1409
|
-
y1:
|
|
1913
|
+
y1: k(N),
|
|
1410
1914
|
x2: p - u,
|
|
1411
|
-
y2:
|
|
1915
|
+
y2: k(N)
|
|
1412
1916
|
}
|
|
1413
1917
|
),
|
|
1414
|
-
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y:
|
|
1918
|
+
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y: k(N) + 3, textAnchor: "end", children: [
|
|
1415
1919
|
"P",
|
|
1416
1920
|
N
|
|
1417
1921
|
] })
|
|
1418
1922
|
] }, `y${N}`)),
|
|
1419
|
-
|
|
1923
|
+
r.map((N, L) => L % A === 0 && /* @__PURE__ */ n(
|
|
1420
1924
|
"text",
|
|
1421
1925
|
{
|
|
1422
1926
|
className: "pvx-positions-axis",
|
|
1423
|
-
x:
|
|
1424
|
-
y:
|
|
1927
|
+
x: g(L),
|
|
1928
|
+
y: m - h + 16,
|
|
1425
1929
|
textAnchor: "middle",
|
|
1426
1930
|
children: N.label
|
|
1427
1931
|
},
|
|
1428
|
-
`x${
|
|
1932
|
+
`x${L}`
|
|
1429
1933
|
)),
|
|
1430
|
-
|
|
1431
|
-
const
|
|
1432
|
-
return /* @__PURE__ */ l("g", { opacity:
|
|
1433
|
-
|
|
1934
|
+
i.map((N) => {
|
|
1935
|
+
const L = P && !s.has(N.driverName);
|
|
1936
|
+
return /* @__PURE__ */ l("g", { opacity: L ? 0.12 : 1, children: [
|
|
1937
|
+
C(N.positions).map((w, D) => /* @__PURE__ */ n(
|
|
1434
1938
|
"polyline",
|
|
1435
1939
|
{
|
|
1436
1940
|
fill: "none",
|
|
1437
1941
|
stroke: N.colour,
|
|
1438
|
-
strokeWidth:
|
|
1439
|
-
points:
|
|
1942
|
+
strokeWidth: L ? 1 : 2,
|
|
1943
|
+
points: w.map(([$, j]) => `${$},${j}`).join(" ")
|
|
1440
1944
|
},
|
|
1441
|
-
|
|
1945
|
+
D
|
|
1442
1946
|
)),
|
|
1443
|
-
!
|
|
1947
|
+
!L && N.positions.map((w, D) => w != null && /* @__PURE__ */ n("circle", { cx: g(D), cy: k(w), r: 2.4, fill: N.colour, children: /* @__PURE__ */ n("title", { children: `${N.driverName} — ${r[D].label}: P${w}` }) }, D))
|
|
1444
1948
|
] }, N.driverName);
|
|
1445
1949
|
})
|
|
1446
1950
|
]
|
|
1447
1951
|
}
|
|
1448
1952
|
),
|
|
1449
1953
|
/* @__PURE__ */ l("div", { className: "pvx-positions-legend", children: [
|
|
1450
|
-
|
|
1451
|
-
const
|
|
1954
|
+
i.map((N) => {
|
|
1955
|
+
const L = P && !s.has(N.driverName);
|
|
1452
1956
|
return /* @__PURE__ */ l(
|
|
1453
1957
|
"button",
|
|
1454
1958
|
{
|
|
1455
1959
|
type: "button",
|
|
1456
1960
|
className: "pvx-positions-legend-item",
|
|
1457
|
-
style: { opacity:
|
|
1458
|
-
onClick: () =>
|
|
1961
|
+
style: { opacity: L ? 0.4 : 1 },
|
|
1962
|
+
onClick: () => o(N.driverName),
|
|
1459
1963
|
children: [
|
|
1460
1964
|
/* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background: N.colour } }),
|
|
1461
1965
|
N.driverName
|
|
@@ -1464,7 +1968,7 @@ function Mn({ title: e, drivers: t, timingPoints: s }) {
|
|
|
1464
1968
|
N.driverName
|
|
1465
1969
|
);
|
|
1466
1970
|
}),
|
|
1467
|
-
|
|
1971
|
+
P && /* @__PURE__ */ n(
|
|
1468
1972
|
"button",
|
|
1469
1973
|
{
|
|
1470
1974
|
type: "button",
|
|
@@ -1476,108 +1980,108 @@ function Mn({ title: e, drivers: t, timingPoints: s }) {
|
|
|
1476
1980
|
] })
|
|
1477
1981
|
] });
|
|
1478
1982
|
}
|
|
1479
|
-
function
|
|
1480
|
-
const t = (e == null ? void 0 : e.timingPoints) || [],
|
|
1481
|
-
const a = [...new Set(
|
|
1482
|
-
return a.length <= 1 ? [{ title: a[0] || null, drivers:
|
|
1483
|
-
title:
|
|
1484
|
-
drivers:
|
|
1485
|
-
|
|
1983
|
+
function ut({ positions: e }) {
|
|
1984
|
+
const t = (e == null ? void 0 : e.timingPoints) || [], r = (e == null ? void 0 : e.drivers) || [], s = T(() => {
|
|
1985
|
+
const a = [...new Set(r.map((o) => o.carClass).filter(Boolean))];
|
|
1986
|
+
return a.length <= 1 ? [{ title: a[0] || null, drivers: r }] : a.sort().map((o) => ({
|
|
1987
|
+
title: o,
|
|
1988
|
+
drivers: dt(
|
|
1989
|
+
r.filter((i) => i.carClass === o),
|
|
1486
1990
|
t.length
|
|
1487
1991
|
)
|
|
1488
1992
|
}));
|
|
1489
|
-
}, [
|
|
1490
|
-
return !t.length || !
|
|
1491
|
-
|
|
1993
|
+
}, [r, t.length]);
|
|
1994
|
+
return !t.length || !r.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: s.map((a, o) => /* @__PURE__ */ n(
|
|
1995
|
+
pt,
|
|
1492
1996
|
{
|
|
1493
|
-
title:
|
|
1997
|
+
title: s.length > 1 ? a.title : null,
|
|
1494
1998
|
drivers: a.drivers,
|
|
1495
1999
|
timingPoints: t
|
|
1496
2000
|
},
|
|
1497
|
-
a.title ||
|
|
2001
|
+
a.title || o
|
|
1498
2002
|
)) });
|
|
1499
2003
|
}
|
|
1500
|
-
function
|
|
2004
|
+
function pr({ competitionId: e, roundNumber: t, className: r }) {
|
|
1501
2005
|
var p;
|
|
1502
|
-
const { data:
|
|
2006
|
+
const { data: s, isLoading: a } = dn(e, t);
|
|
1503
2007
|
if (a)
|
|
1504
|
-
return /* @__PURE__ */ n(
|
|
1505
|
-
if (!
|
|
1506
|
-
return /* @__PURE__ */ n(
|
|
1507
|
-
const
|
|
1508
|
-
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${
|
|
2008
|
+
return /* @__PURE__ */ n(W, { message: "Loading results..." });
|
|
2009
|
+
if (!s)
|
|
2010
|
+
return /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
2011
|
+
const i = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = i == null ? void 0 : i.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
|
|
2012
|
+
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${r || ""}`, children: [
|
|
1509
2013
|
/* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
|
|
1510
2014
|
/* @__PURE__ */ l("div", { children: [
|
|
1511
2015
|
/* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
|
|
1512
2016
|
"Round ",
|
|
1513
|
-
|
|
1514
|
-
|
|
2017
|
+
s.roundNumber,
|
|
2018
|
+
s.track ? `: ${s.track}` : ""
|
|
1515
2019
|
] }),
|
|
1516
|
-
|
|
2020
|
+
s.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
|
|
1517
2021
|
day: "numeric",
|
|
1518
2022
|
month: "long",
|
|
1519
2023
|
year: "numeric"
|
|
1520
2024
|
}) })
|
|
1521
2025
|
] }),
|
|
1522
2026
|
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1523
|
-
/* @__PURE__ */ n("span", { children:
|
|
2027
|
+
/* @__PURE__ */ n("span", { children: xe[c.position - 1] }),
|
|
1524
2028
|
/* @__PURE__ */ n("span", { children: c.driverName })
|
|
1525
2029
|
] }, c.driverId)) })
|
|
1526
2030
|
] }),
|
|
1527
|
-
/* @__PURE__ */ n(
|
|
2031
|
+
/* @__PURE__ */ n(ye, { round: s, competitionId: e })
|
|
1528
2032
|
] });
|
|
1529
2033
|
}
|
|
1530
|
-
function
|
|
1531
|
-
var h,
|
|
1532
|
-
const [
|
|
1533
|
-
if (!
|
|
1534
|
-
return /* @__PURE__ */ n(
|
|
1535
|
-
const { data:
|
|
2034
|
+
function ye({ round: e, competitionId: t, className: r }) {
|
|
2035
|
+
var h, y, x, m, b, g;
|
|
2036
|
+
const [s, a] = E(null), o = (e == null ? void 0 : e.sessions) || [];
|
|
2037
|
+
if (!o.length)
|
|
2038
|
+
return /* @__PURE__ */ n(_, { message: "No session data for this round." });
|
|
2039
|
+
const { data: i } = mn(
|
|
1536
2040
|
t,
|
|
1537
2041
|
e == null ? void 0 : e.roundNumber,
|
|
1538
2042
|
{}
|
|
1539
|
-
), d =
|
|
2043
|
+
), d = o.some((k) => k.type === "RACE"), { data: p } = vn(
|
|
1540
2044
|
t,
|
|
1541
2045
|
e == null ? void 0 : e.roundNumber,
|
|
1542
2046
|
{ enabled: !!t && d }
|
|
1543
|
-
), c =
|
|
1544
|
-
return /* @__PURE__ */ l("div", { className:
|
|
2047
|
+
), c = s || ((h = o.find((k) => k.type === "RACE")) == null ? void 0 : h.type) || ((y = o[0]) == null ? void 0 : y.type), u = o.find((k) => k.type === c) || o[0], v = ((m = (x = i == null ? void 0 : i.sessions) == null ? void 0 : x.find((k) => k.type === c)) == null ? void 0 : m.drivers) || null, f = (u == null ? void 0 : u.type) === "RACE" && ((b = p == null ? void 0 : p.timingPoints) == null ? void 0 : b.length) > 0 && ((g = p == null ? void 0 : p.drivers) == null ? void 0 : g.length) > 0;
|
|
2048
|
+
return /* @__PURE__ */ l("div", { className: r || "", children: [
|
|
1545
2049
|
/* @__PURE__ */ n(
|
|
1546
|
-
|
|
2050
|
+
Tn,
|
|
1547
2051
|
{
|
|
1548
|
-
sessions:
|
|
2052
|
+
sessions: o,
|
|
1549
2053
|
activeSession: c,
|
|
1550
2054
|
onSelect: a
|
|
1551
2055
|
}
|
|
1552
2056
|
),
|
|
1553
|
-
/* @__PURE__ */ n(
|
|
2057
|
+
/* @__PURE__ */ n(ht, { session: u, sessionLaps: v }),
|
|
1554
2058
|
f && /* @__PURE__ */ l("div", { className: "pvx-positions-section", children: [
|
|
1555
2059
|
/* @__PURE__ */ n("div", { className: "pvx-positions-section-title", children: "Race Positions" }),
|
|
1556
|
-
/* @__PURE__ */ n(
|
|
2060
|
+
/* @__PURE__ */ n(ut, { positions: p })
|
|
1557
2061
|
] })
|
|
1558
2062
|
] });
|
|
1559
2063
|
}
|
|
1560
|
-
function
|
|
2064
|
+
function ht({ session: e, sessionLaps: t }) {
|
|
1561
2065
|
var u;
|
|
1562
|
-
const
|
|
2066
|
+
const r = e.type === "RACE", [s, a] = E(null);
|
|
1563
2067
|
if (!((u = e.results) != null && u.length))
|
|
1564
|
-
return /* @__PURE__ */ n(
|
|
1565
|
-
const
|
|
1566
|
-
var
|
|
1567
|
-
const
|
|
2068
|
+
return /* @__PURE__ */ n(_, { message: `No results for ${e.type}.` });
|
|
2069
|
+
const o = Pn(e.results), i = r ? 7 : 4, d = [...new Set(e.results.map((v) => v.carClass).filter(Boolean))], p = d.length > 1, c = (v, f, h) => {
|
|
2070
|
+
var m;
|
|
2071
|
+
const y = (m = t == null ? void 0 : t[v.driverId]) == null ? void 0 : m.laps, x = s === v.driverId && !!y;
|
|
1568
2072
|
return /* @__PURE__ */ n(
|
|
1569
|
-
|
|
2073
|
+
mt,
|
|
1570
2074
|
{
|
|
1571
2075
|
result: v,
|
|
1572
|
-
isRace:
|
|
1573
|
-
fastestSplits:
|
|
2076
|
+
isRace: r,
|
|
2077
|
+
fastestSplits: o,
|
|
1574
2078
|
rowIndex: f,
|
|
1575
2079
|
displayPosition: h,
|
|
1576
|
-
hasLapDetail: !!
|
|
2080
|
+
hasLapDetail: !!y,
|
|
1577
2081
|
isExpanded: x,
|
|
1578
2082
|
onToggle: () => a(x ? null : v.driverId),
|
|
1579
|
-
driverLaps: x ?
|
|
1580
|
-
colCount:
|
|
2083
|
+
driverLaps: x ? y : null,
|
|
2084
|
+
colCount: i
|
|
1581
2085
|
},
|
|
1582
2086
|
v.driverId || f
|
|
1583
2087
|
);
|
|
@@ -1588,36 +2092,36 @@ function Pn({ session: e, sessionLaps: t }) {
|
|
|
1588
2092
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1589
2093
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1590
2094
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1591
|
-
|
|
2095
|
+
r && /* @__PURE__ */ l(B, { children: [
|
|
1592
2096
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1593
2097
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1594
2098
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1595
2099
|
] })
|
|
1596
2100
|
] }) }),
|
|
1597
2101
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((v) => {
|
|
1598
|
-
const f = e.results.filter((h) => h.carClass === v).sort((h,
|
|
2102
|
+
const f = e.results.filter((h) => h.carClass === v).sort((h, y) => (h.classPosition ?? h.position) - (y.classPosition ?? y.position));
|
|
1599
2103
|
return [
|
|
1600
|
-
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan:
|
|
2104
|
+
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: i, className: "pvx-td pvx-td--class-header", children: v }) }, `hdr-${v}`),
|
|
1601
2105
|
...f.map(
|
|
1602
|
-
(h,
|
|
2106
|
+
(h, y) => c(h, y, h.classPosition ?? h.position)
|
|
1603
2107
|
)
|
|
1604
2108
|
];
|
|
1605
2109
|
}) : e.results.map((v, f) => c(v, f)) })
|
|
1606
2110
|
] }) });
|
|
1607
2111
|
}
|
|
1608
|
-
function
|
|
2112
|
+
function mt({ result: e, isRace: t, fastestSplits: r, rowIndex: s, displayPosition: a, hasLapDetail: o, isExpanded: i, onToggle: d, driverLaps: p, colCount: c }) {
|
|
1609
2113
|
const u = a ?? e.position, v = u <= 3;
|
|
1610
|
-
return /* @__PURE__ */ l(
|
|
2114
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1611
2115
|
/* @__PURE__ */ l(
|
|
1612
2116
|
"tr",
|
|
1613
2117
|
{
|
|
1614
|
-
className: `pvx-row ${v ? "pvx-row--podium" : ""} ${
|
|
1615
|
-
onClick:
|
|
1616
|
-
style:
|
|
2118
|
+
className: `pvx-row ${v ? "pvx-row--podium" : ""} ${o ? "pvx-row--expandable" : ""}`,
|
|
2119
|
+
onClick: o ? d : void 0,
|
|
2120
|
+
style: o ? { cursor: "pointer" } : void 0,
|
|
1617
2121
|
children: [
|
|
1618
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
2122
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: u }) }),
|
|
1619
2123
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1620
|
-
/* @__PURE__ */ n(
|
|
2124
|
+
/* @__PURE__ */ n(ee, { nation: e.nation }),
|
|
1621
2125
|
e.driverName,
|
|
1622
2126
|
e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
|
|
1623
2127
|
"#",
|
|
@@ -1627,16 +2131,16 @@ function An({ result: e, isRace: t, fastestSplits: s, rowIndex: r, displayPositi
|
|
|
1627
2131
|
] }),
|
|
1628
2132
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1629
2133
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1630
|
-
|
|
2134
|
+
xt,
|
|
1631
2135
|
{
|
|
1632
2136
|
bestLap: e.bestLapFormatted,
|
|
1633
2137
|
hasBestLap: e.hasBestLap,
|
|
1634
2138
|
splits: e.splits,
|
|
1635
|
-
fastestSplits:
|
|
1636
|
-
showAbove:
|
|
2139
|
+
fastestSplits: r,
|
|
2140
|
+
showAbove: s <= 1
|
|
1637
2141
|
}
|
|
1638
2142
|
) }),
|
|
1639
|
-
t && /* @__PURE__ */ l(
|
|
2143
|
+
t && /* @__PURE__ */ l(B, { children: [
|
|
1640
2144
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
|
|
1641
2145
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
|
|
1642
2146
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
|
|
@@ -1652,11 +2156,11 @@ function An({ result: e, isRace: t, fastestSplits: s, rowIndex: r, displayPositi
|
|
|
1652
2156
|
]
|
|
1653
2157
|
}
|
|
1654
2158
|
),
|
|
1655
|
-
|
|
2159
|
+
i && p && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: c, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(vt, { laps: p }) }) })
|
|
1656
2160
|
] });
|
|
1657
2161
|
}
|
|
1658
|
-
function
|
|
1659
|
-
const t = Math.min(...e.filter((
|
|
2162
|
+
function vt({ laps: e }) {
|
|
2163
|
+
const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
|
|
1660
2164
|
return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1661
2165
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1662
2166
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
@@ -1665,41 +2169,41 @@ function Bn({ laps: e }) {
|
|
|
1665
2169
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1666
2170
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1667
2171
|
] }) }),
|
|
1668
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((
|
|
2172
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((r) => {
|
|
1669
2173
|
var a;
|
|
1670
|
-
const
|
|
1671
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1672
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children:
|
|
1673
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children:
|
|
1674
|
-
(
|
|
1675
|
-
Array.from({ length: Math.max(0, 3 - (((a =
|
|
1676
|
-
] },
|
|
2174
|
+
const s = r.valid && r.timeMs === t;
|
|
2175
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
|
|
2176
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
|
|
2177
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
|
|
2178
|
+
(r.splits || []).map((o, i) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: o }, i)),
|
|
2179
|
+
Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((o, i) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${i}`))
|
|
2180
|
+
] }, r.lap);
|
|
1677
2181
|
}) })
|
|
1678
2182
|
] });
|
|
1679
2183
|
}
|
|
1680
|
-
function
|
|
2184
|
+
function xt({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
|
|
1681
2185
|
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1682
2186
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1683
|
-
(
|
|
1684
|
-
const d =
|
|
2187
|
+
(r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((o, i) => {
|
|
2188
|
+
const d = s && o === s[i];
|
|
1685
2189
|
return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1686
2190
|
/* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1687
2191
|
"S",
|
|
1688
|
-
|
|
2192
|
+
i + 1
|
|
1689
2193
|
] }),
|
|
1690
|
-
/* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children:
|
|
1691
|
-
] },
|
|
2194
|
+
/* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children: o })
|
|
2195
|
+
] }, i);
|
|
1692
2196
|
}) }) })
|
|
1693
2197
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1694
2198
|
}
|
|
1695
|
-
function
|
|
1696
|
-
const { getSteamId:
|
|
2199
|
+
function ur({ competitionId: e, className: t }) {
|
|
2200
|
+
const { getSteamId: r } = S(), { data: s, isLoading: a } = Ae(e), o = r();
|
|
1697
2201
|
if (a)
|
|
1698
|
-
return /* @__PURE__ */ n(
|
|
1699
|
-
const
|
|
1700
|
-
return
|
|
2202
|
+
return /* @__PURE__ */ n(W, { message: "Loading drivers..." });
|
|
2203
|
+
const i = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
|
|
2204
|
+
return i.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: i.map((d) => {
|
|
1701
2205
|
var c, u;
|
|
1702
|
-
const p =
|
|
2206
|
+
const p = o && d.steamId === o;
|
|
1703
2207
|
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
|
|
1704
2208
|
d.avatarUrl ? /* @__PURE__ */ n(
|
|
1705
2209
|
"img",
|
|
@@ -1714,24 +2218,24 @@ function Tt({ competitionId: e, className: t }) {
|
|
|
1714
2218
|
p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1715
2219
|
] })
|
|
1716
2220
|
] }, d.steamId || d.driverId);
|
|
1717
|
-
}) }) : /* @__PURE__ */ n(
|
|
2221
|
+
}) }) : /* @__PURE__ */ n(_, { message: "No drivers registered yet." });
|
|
1718
2222
|
}
|
|
1719
|
-
function
|
|
2223
|
+
function hr({
|
|
1720
2224
|
competitionId: e,
|
|
1721
2225
|
driverData: t,
|
|
1722
|
-
className:
|
|
1723
|
-
children:
|
|
2226
|
+
className: r,
|
|
2227
|
+
children: s
|
|
1724
2228
|
}) {
|
|
1725
|
-
const { data: a, isLoading:
|
|
1726
|
-
|
|
1727
|
-
},
|
|
1728
|
-
|
|
2229
|
+
const { data: a, isLoading: o } = he(e), { isPowerMode: i } = me(), d = ve(e), p = Ee(e), c = Be(e), u = (a == null ? void 0 : a.isRegistered) || !1, v = o || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
|
|
2230
|
+
i && p.mutate(t || {});
|
|
2231
|
+
}, y = () => {
|
|
2232
|
+
i && c.mutate();
|
|
1729
2233
|
};
|
|
1730
|
-
return typeof
|
|
2234
|
+
return typeof s == "function" ? s({ isRegistered: u, isLoading: v, register: h, withdraw: y, error: f, isPowerMode: i, registrationUrl: d }) : i ? /* @__PURE__ */ n(
|
|
1731
2235
|
"button",
|
|
1732
2236
|
{
|
|
1733
|
-
className: `pvx-comp-register-btn ${
|
|
1734
|
-
onClick: u ?
|
|
2237
|
+
className: `pvx-comp-register-btn ${r || ""}`,
|
|
2238
|
+
onClick: u ? y : h,
|
|
1735
2239
|
disabled: v,
|
|
1736
2240
|
children: v ? "Loading..." : u ? "Withdraw" : "Register"
|
|
1737
2241
|
}
|
|
@@ -1741,49 +2245,49 @@ function Mt({
|
|
|
1741
2245
|
href: d,
|
|
1742
2246
|
target: "_blank",
|
|
1743
2247
|
rel: "noopener noreferrer",
|
|
1744
|
-
className: `pvx-comp-register-link ${
|
|
2248
|
+
className: `pvx-comp-register-link ${r || ""}`,
|
|
1745
2249
|
children: u ? "View Registration" : "Register on PitVox"
|
|
1746
2250
|
}
|
|
1747
2251
|
);
|
|
1748
2252
|
}
|
|
1749
|
-
function
|
|
1750
|
-
const { getSteamId: a } =
|
|
1751
|
-
return p || u ? /* @__PURE__ */ n(
|
|
1752
|
-
|
|
2253
|
+
function mr({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
|
|
2254
|
+
const { getSteamId: a } = S(), { isPowerMode: o } = me(), i = ve(e), { data: d, isLoading: p } = he(e), { data: c, isLoading: u } = Ae(e), v = Ee(e), f = Be(e), h = a(), y = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], m = t || {}, b = x.length || m.currentCount || 0, g = m.maxParticipants && b >= m.maxParticipants, k = m.deadline && new Date(m.deadline) < /* @__PURE__ */ new Date(), C = m.isOpen && !k && !g;
|
|
2255
|
+
return p || u ? /* @__PURE__ */ n(W, { message: "Loading registration..." }) : y ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
2256
|
+
ft,
|
|
1753
2257
|
{
|
|
1754
2258
|
competitionId: e,
|
|
1755
2259
|
drivers: x,
|
|
1756
2260
|
steamId: h,
|
|
1757
|
-
isPowerMode:
|
|
1758
|
-
registrationUrl:
|
|
2261
|
+
isPowerMode: o,
|
|
2262
|
+
registrationUrl: i,
|
|
1759
2263
|
withdrawMutation: f,
|
|
1760
|
-
onWithdrawSuccess:
|
|
1761
|
-
registration:
|
|
2264
|
+
onWithdrawSuccess: r,
|
|
2265
|
+
registration: m
|
|
1762
2266
|
}
|
|
1763
|
-
) }) :
|
|
1764
|
-
|
|
2267
|
+
) }) : C ? h ? o ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
2268
|
+
gt,
|
|
1765
2269
|
{
|
|
1766
2270
|
competitionId: e,
|
|
1767
2271
|
registerMutation: v,
|
|
1768
|
-
registration:
|
|
2272
|
+
registration: m
|
|
1769
2273
|
}
|
|
1770
|
-
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1771
|
-
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children:
|
|
1772
|
-
x.length > 0 && /* @__PURE__ */ n(
|
|
2274
|
+
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href: i, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: o ? /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ n("a", { href: i, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${s || ""}`, children: [
|
|
2275
|
+
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: g ? "Registration is full." : k ? "Registration deadline has passed." : "Registration is closed." }),
|
|
2276
|
+
x.length > 0 && /* @__PURE__ */ n(Ke, { drivers: x, steamId: h })
|
|
1773
2277
|
] });
|
|
1774
2278
|
}
|
|
1775
|
-
function
|
|
1776
|
-
const [
|
|
2279
|
+
function gt({ competitionId: e, registerMutation: t, registration: r }) {
|
|
2280
|
+
const [s, a] = E(""), [o, i] = E("intermediate"), [d, p] = E(""), c = (h) => {
|
|
1777
2281
|
h.preventDefault(), t.mutate({
|
|
1778
|
-
discordUsername:
|
|
1779
|
-
experience:
|
|
2282
|
+
discordUsername: s || void 0,
|
|
2283
|
+
experience: o,
|
|
1780
2284
|
comments: d || void 0
|
|
1781
2285
|
});
|
|
1782
|
-
}, u =
|
|
2286
|
+
}, u = r || {}, v = u.currentCount || 0, f = u.maxParticipants;
|
|
1783
2287
|
return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
|
|
1784
2288
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1785
2289
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1786
|
-
f && /* @__PURE__ */ n(
|
|
2290
|
+
f && /* @__PURE__ */ n(He, { count: v, max: f })
|
|
1787
2291
|
] }),
|
|
1788
2292
|
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1789
2293
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
@@ -1798,7 +2302,7 @@ function Un({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1798
2302
|
type: "text",
|
|
1799
2303
|
className: "pvx-reg-input",
|
|
1800
2304
|
placeholder: "e.g. username",
|
|
1801
|
-
value:
|
|
2305
|
+
value: s,
|
|
1802
2306
|
onChange: (h) => a(h.target.value)
|
|
1803
2307
|
}
|
|
1804
2308
|
)
|
|
@@ -1810,8 +2314,8 @@ function Un({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1810
2314
|
{
|
|
1811
2315
|
id: `pvx-exp-${e}`,
|
|
1812
2316
|
className: "pvx-reg-select",
|
|
1813
|
-
value:
|
|
1814
|
-
onChange: (h) =>
|
|
2317
|
+
value: o,
|
|
2318
|
+
onChange: (h) => i(h.target.value),
|
|
1815
2319
|
children: [
|
|
1816
2320
|
/* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
|
|
1817
2321
|
/* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
|
|
@@ -1848,22 +2352,22 @@ function Un({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1848
2352
|
) })
|
|
1849
2353
|
] });
|
|
1850
2354
|
}
|
|
1851
|
-
function
|
|
1852
|
-
const [p, c] =
|
|
1853
|
-
|
|
2355
|
+
function ft({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: o, onWithdrawSuccess: i, registration: d }) {
|
|
2356
|
+
const [p, c] = E(!1), u = () => {
|
|
2357
|
+
o.mutate(void 0, {
|
|
1854
2358
|
onSuccess: () => {
|
|
1855
|
-
c(!1),
|
|
2359
|
+
c(!1), i && i();
|
|
1856
2360
|
}
|
|
1857
2361
|
});
|
|
1858
2362
|
}, v = d || {}, f = t.length || v.currentCount || 0, h = v.maxParticipants;
|
|
1859
|
-
return /* @__PURE__ */ l(
|
|
2363
|
+
return /* @__PURE__ */ l(B, { children: [
|
|
1860
2364
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1861
2365
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1862
|
-
h && /* @__PURE__ */ n(
|
|
2366
|
+
h && /* @__PURE__ */ n(He, { count: f, max: h })
|
|
1863
2367
|
] }),
|
|
1864
|
-
/* @__PURE__ */ n(
|
|
1865
|
-
|
|
1866
|
-
|
|
2368
|
+
/* @__PURE__ */ n(Ke, { drivers: t, steamId: r }),
|
|
2369
|
+
o.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: o.error.message || "Withdrawal failed" }),
|
|
2370
|
+
s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
|
|
1867
2371
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1868
2372
|
/* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1869
2373
|
/* @__PURE__ */ n(
|
|
@@ -1881,8 +2385,8 @@ function Fn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1881
2385
|
type: "button",
|
|
1882
2386
|
className: "pvx-reg-danger-btn",
|
|
1883
2387
|
onClick: u,
|
|
1884
|
-
disabled:
|
|
1885
|
-
children:
|
|
2388
|
+
disabled: o.isPending,
|
|
2389
|
+
children: o.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1886
2390
|
}
|
|
1887
2391
|
)
|
|
1888
2392
|
] })
|
|
@@ -1897,115 +2401,117 @@ function Fn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1897
2401
|
) }) : /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
|
|
1898
2402
|
] });
|
|
1899
2403
|
}
|
|
1900
|
-
function
|
|
2404
|
+
function Ke({ drivers: e, steamId: t }) {
|
|
1901
2405
|
if (!e.length)
|
|
1902
2406
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1903
|
-
const
|
|
1904
|
-
const
|
|
1905
|
-
return
|
|
2407
|
+
const r = [...e].sort((s, a) => {
|
|
2408
|
+
const o = t && s.steamId === t ? -1 : 0, i = t && a.steamId === t ? -1 : 0;
|
|
2409
|
+
return o - i;
|
|
1906
2410
|
});
|
|
1907
|
-
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children:
|
|
1908
|
-
var
|
|
1909
|
-
const a = t &&
|
|
2411
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
|
|
2412
|
+
var o, i;
|
|
2413
|
+
const a = t && s.steamId === t;
|
|
1910
2414
|
return /* @__PURE__ */ l(
|
|
1911
2415
|
"div",
|
|
1912
2416
|
{
|
|
1913
2417
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1914
2418
|
children: [
|
|
1915
|
-
|
|
2419
|
+
s.avatarUrl ? /* @__PURE__ */ n("img", { src: s.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((i = (o = s.displayName) == null ? void 0 : o.charAt(0)) == null ? void 0 : i.toUpperCase()) || "?" }),
|
|
1916
2420
|
/* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
|
|
1917
|
-
|
|
2421
|
+
s.displayName,
|
|
1918
2422
|
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1919
2423
|
] })
|
|
1920
2424
|
]
|
|
1921
2425
|
},
|
|
1922
|
-
|
|
2426
|
+
s.steamId || s.driverId
|
|
1923
2427
|
);
|
|
1924
2428
|
}) });
|
|
1925
2429
|
}
|
|
1926
|
-
function
|
|
1927
|
-
const
|
|
1928
|
-
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
2430
|
+
function He({ count: e, max: t }) {
|
|
2431
|
+
const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
|
|
2432
|
+
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
|
|
1929
2433
|
e,
|
|
1930
2434
|
"/",
|
|
1931
2435
|
t,
|
|
1932
2436
|
" drivers"
|
|
1933
2437
|
] });
|
|
1934
2438
|
}
|
|
1935
|
-
function
|
|
1936
|
-
const { data:
|
|
1937
|
-
() =>
|
|
1938
|
-
[
|
|
1939
|
-
), v =
|
|
1940
|
-
() => u.map((
|
|
2439
|
+
function vr({ competitionId: e, className: t }) {
|
|
2440
|
+
const { data: r, isLoading: s } = Pe(e), a = (r == null ? void 0 : r.type) === "championship", o = (r == null ? void 0 : r.type) === "hotlap", i = T(() => (r == null ? void 0 : r.rounds) || [], [r]), d = o && i.length > 1, p = o && !d, { data: c } = un(p ? e : null), u = T(
|
|
2441
|
+
() => i.filter((w) => w.isFinalized),
|
|
2442
|
+
[i]
|
|
2443
|
+
), v = T(
|
|
2444
|
+
() => u.map((w) => w.roundNumber),
|
|
1941
2445
|
[u]
|
|
1942
|
-
), { data: f = [], isLoading: h } =
|
|
2446
|
+
), { data: f = [], isLoading: h } = pn(
|
|
1943
2447
|
e,
|
|
1944
2448
|
v
|
|
1945
|
-
),
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
if (
|
|
1949
|
-
return /* @__PURE__ */ n(
|
|
2449
|
+
), y = p && f.length > 0 ? f[0] : null, x = (y == null ? void 0 : y.sessions) || [], m = d ? i.find(
|
|
2450
|
+
(w) => w.startTime && new Date(w.startTime) <= /* @__PURE__ */ new Date() && !O(w)
|
|
2451
|
+
) : null, b = d ? m ? `hlround-${m.roundNumber}` : "standings" : p ? "leaderboard" : a ? "standings" : v.length > 0 ? `round-${v[v.length - 1]}` : null, [g, k] = E(null), C = g || b;
|
|
2452
|
+
if (s || h)
|
|
2453
|
+
return /* @__PURE__ */ n(W, { message: "Loading results..." });
|
|
2454
|
+
if (!r)
|
|
2455
|
+
return /* @__PURE__ */ n(_, { message: "Competition not found." });
|
|
1950
2456
|
if (!u.length)
|
|
1951
|
-
return /* @__PURE__ */ n(
|
|
1952
|
-
const
|
|
2457
|
+
return /* @__PURE__ */ n(_, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
2458
|
+
const P = new Map(f.map((w) => [`round-${w.roundNumber}`, w])), A = new Map(f.map((w) => [w.roundNumber, w])), N = [];
|
|
1953
2459
|
if (d) {
|
|
1954
|
-
|
|
1955
|
-
for (const
|
|
1956
|
-
|
|
2460
|
+
N.push({ id: "standings", label: "Standings" });
|
|
2461
|
+
for (const w of [...i].sort((D, $) => D.roundNumber - $.roundNumber))
|
|
2462
|
+
N.push({ id: `hlround-${w.roundNumber}`, label: `R${w.roundNumber}`, track: w.track || null });
|
|
1957
2463
|
} else if (p) {
|
|
1958
|
-
|
|
1959
|
-
for (const
|
|
1960
|
-
|
|
2464
|
+
N.push({ id: "leaderboard", label: "Leaderboard" });
|
|
2465
|
+
for (const w of x)
|
|
2466
|
+
N.push({ id: `session-${w.type}`, label: X(w.type) });
|
|
1961
2467
|
} else if (a) {
|
|
1962
|
-
|
|
1963
|
-
for (const
|
|
1964
|
-
|
|
2468
|
+
N.push({ id: "standings", label: "Standings" });
|
|
2469
|
+
for (const w of u)
|
|
2470
|
+
N.push({ id: `round-${w.roundNumber}`, label: `R${w.roundNumber}`, track: null });
|
|
1965
2471
|
} else
|
|
1966
|
-
for (const
|
|
1967
|
-
|
|
1968
|
-
let
|
|
1969
|
-
if (
|
|
1970
|
-
|
|
1971
|
-
else if (
|
|
1972
|
-
|
|
1973
|
-
else if (
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1976
|
-
} else if (
|
|
1977
|
-
|
|
1978
|
-
|
|
2472
|
+
for (const w of u)
|
|
2473
|
+
N.push({ id: `round-${w.roundNumber}`, label: `R${w.roundNumber}`, track: null });
|
|
2474
|
+
let L;
|
|
2475
|
+
if (C === "standings")
|
|
2476
|
+
L = /* @__PURE__ */ n(lt, { competitionId: e });
|
|
2477
|
+
else if (C === "leaderboard")
|
|
2478
|
+
L = /* @__PURE__ */ n(Oe, { leaderboard: c, config: r });
|
|
2479
|
+
else if (C != null && C.startsWith("hlround-")) {
|
|
2480
|
+
const w = parseInt(C.slice(8), 10), D = i.find(($) => $.roundNumber === w);
|
|
2481
|
+
L = D ? /* @__PURE__ */ n(yt, { competitionId: e, roundMeta: D, roundData: A.get(w) }) : /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
2482
|
+
} else if (C != null && C.startsWith("session-"))
|
|
2483
|
+
L = /* @__PURE__ */ n(
|
|
2484
|
+
Ge,
|
|
1979
2485
|
{
|
|
1980
|
-
session: x.find((
|
|
1981
|
-
round:
|
|
2486
|
+
session: x.find((w) => `session-${w.type}` === C),
|
|
2487
|
+
round: y,
|
|
1982
2488
|
competitionId: e
|
|
1983
2489
|
}
|
|
1984
2490
|
);
|
|
1985
2491
|
else {
|
|
1986
|
-
const
|
|
1987
|
-
|
|
2492
|
+
const w = P.get(C);
|
|
2493
|
+
L = w ? /* @__PURE__ */ n(Nt, { round: w, competitionId: e }) : /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
1988
2494
|
}
|
|
1989
2495
|
return /* @__PURE__ */ l("div", { className: t || "", children: [
|
|
1990
|
-
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children:
|
|
2496
|
+
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: N.map((w) => /* @__PURE__ */ l(
|
|
1991
2497
|
"button",
|
|
1992
2498
|
{
|
|
1993
|
-
className: `pvx-results-tab ${
|
|
1994
|
-
onClick: () =>
|
|
1995
|
-
title:
|
|
2499
|
+
className: `pvx-results-tab ${C === w.id ? "pvx-results-tab--active" : ""}`,
|
|
2500
|
+
onClick: () => k(w.id),
|
|
2501
|
+
title: w.track || void 0,
|
|
1996
2502
|
children: [
|
|
1997
|
-
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children:
|
|
1998
|
-
|
|
2503
|
+
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: w.label }),
|
|
2504
|
+
w.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: w.track })
|
|
1999
2505
|
]
|
|
2000
2506
|
},
|
|
2001
|
-
|
|
2507
|
+
w.id
|
|
2002
2508
|
)) }),
|
|
2003
|
-
|
|
2509
|
+
L
|
|
2004
2510
|
] });
|
|
2005
2511
|
}
|
|
2006
|
-
function
|
|
2007
|
-
var
|
|
2008
|
-
const
|
|
2512
|
+
function Nt({ round: e, competitionId: t }) {
|
|
2513
|
+
var o;
|
|
2514
|
+
const s = (e.sessions || []).find((i) => i.type === "RACE"), a = (o = s == null ? void 0 : s.results) == null ? void 0 : o.filter((i) => i.position <= 3).sort((i, d) => i.position - d.position);
|
|
2009
2515
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2010
2516
|
/* @__PURE__ */ l("div", { className: "pvx-card-header--split", children: [
|
|
2011
2517
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -2020,19 +2526,19 @@ function En({ round: e, competitionId: t }) {
|
|
|
2020
2526
|
year: "numeric"
|
|
2021
2527
|
}) })
|
|
2022
2528
|
] }),
|
|
2023
|
-
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((
|
|
2024
|
-
/* @__PURE__ */ n("span", { children:
|
|
2025
|
-
/* @__PURE__ */ n("span", { children:
|
|
2026
|
-
] },
|
|
2529
|
+
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((i) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
2530
|
+
/* @__PURE__ */ n("span", { children: xe[i.position - 1] }),
|
|
2531
|
+
/* @__PURE__ */ n("span", { children: i.driverName })
|
|
2532
|
+
] }, i.driverId)) })
|
|
2027
2533
|
] }),
|
|
2028
|
-
/* @__PURE__ */ n(
|
|
2534
|
+
/* @__PURE__ */ n(ye, { round: e, competitionId: t })
|
|
2029
2535
|
] });
|
|
2030
2536
|
}
|
|
2031
|
-
function
|
|
2032
|
-
var
|
|
2033
|
-
return (
|
|
2537
|
+
function Oe({ leaderboard: e, config: t, heading: r }) {
|
|
2538
|
+
var s;
|
|
2539
|
+
return (s = e == null ? void 0 : e.drivers) != null && s.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2034
2540
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
|
|
2035
|
-
/* @__PURE__ */ n("h4", { className: "pvx-card-title", children:
|
|
2541
|
+
/* @__PURE__ */ n("h4", { className: "pvx-card-title", children: r || e.track || (t == null ? void 0 : t.name) || "Hotlap Leaderboard" }),
|
|
2036
2542
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
2037
2543
|
e.sessionsCompleted,
|
|
2038
2544
|
" session",
|
|
@@ -2051,194 +2557,194 @@ function Ee({ leaderboard: e, config: t, heading: s }) {
|
|
|
2051
2557
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
|
|
2052
2558
|
] }) }),
|
|
2053
2559
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((a) => {
|
|
2054
|
-
const
|
|
2560
|
+
const o = a.position === 1 ? "" : `+${((a.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
|
|
2055
2561
|
return /* @__PURE__ */ l("tr", { className: `pvx-row ${a.position <= 3 ? "pvx-row--podium" : ""}`, children: [
|
|
2056
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
2562
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: a.position }) }),
|
|
2057
2563
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
2058
|
-
/* @__PURE__ */ n(
|
|
2564
|
+
/* @__PURE__ */ n(ee, { nation: a.nation }),
|
|
2059
2565
|
a.driverName
|
|
2060
2566
|
] }),
|
|
2061
2567
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(a.carId) }),
|
|
2062
2568
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: a.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: a.bestLapFormatted }) }),
|
|
2063
2569
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.totalLaps }),
|
|
2064
2570
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.sessionsParticipated }),
|
|
2065
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children:
|
|
2571
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: o })
|
|
2066
2572
|
] }, a.driverId);
|
|
2067
2573
|
}) })
|
|
2068
2574
|
] }) })
|
|
2069
|
-
] }) : /* @__PURE__ */ n(
|
|
2575
|
+
] }) : /* @__PURE__ */ n(_, { message: "No lap times recorded yet." });
|
|
2070
2576
|
}
|
|
2071
|
-
function
|
|
2577
|
+
function Ge({ session: e, round: t, competitionId: r }) {
|
|
2072
2578
|
return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2073
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children:
|
|
2579
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: X(e.type) }) }),
|
|
2074
2580
|
/* @__PURE__ */ n(
|
|
2075
|
-
|
|
2581
|
+
ye,
|
|
2076
2582
|
{
|
|
2077
2583
|
round: { ...t, sessions: [e] },
|
|
2078
|
-
competitionId:
|
|
2584
|
+
competitionId: r
|
|
2079
2585
|
}
|
|
2080
2586
|
)
|
|
2081
|
-
] }) : /* @__PURE__ */ n(
|
|
2587
|
+
] }) : /* @__PURE__ */ n(_, { message: "Session data not available." });
|
|
2082
2588
|
}
|
|
2083
|
-
function
|
|
2084
|
-
const { data:
|
|
2589
|
+
function yt({ competitionId: e, roundMeta: t, roundData: r }) {
|
|
2590
|
+
const { data: s } = hn(e, t.roundNumber), a = (r == null ? void 0 : r.sessions) || [], [o, i] = E("leaderboard"), d = [
|
|
2085
2591
|
{ id: "leaderboard", label: "Leaderboard" },
|
|
2086
|
-
...a.map((u) => ({ id: `session-${u.type}`, label:
|
|
2087
|
-
], p = d.some((u) => u.id ===
|
|
2592
|
+
...a.map((u) => ({ id: `session-${u.type}`, label: X(u.type) }))
|
|
2593
|
+
], p = d.some((u) => u.id === o) ? o : "leaderboard", c = `Round ${t.roundNumber}${t.track ? ` — ${t.track}` : ""}`;
|
|
2088
2594
|
return /* @__PURE__ */ l("div", { children: [
|
|
2089
2595
|
/* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: d.map((u) => /* @__PURE__ */ n(
|
|
2090
2596
|
"button",
|
|
2091
2597
|
{
|
|
2092
|
-
onClick: () =>
|
|
2598
|
+
onClick: () => i(u.id),
|
|
2093
2599
|
className: `pvx-session-tab ${p === u.id ? "pvx-session-tab--active" : ""}`,
|
|
2094
2600
|
children: u.label
|
|
2095
2601
|
},
|
|
2096
2602
|
u.id
|
|
2097
2603
|
)) }),
|
|
2098
|
-
p === "leaderboard" ? /* @__PURE__ */ n(
|
|
2099
|
-
|
|
2604
|
+
p === "leaderboard" ? /* @__PURE__ */ n(Oe, { leaderboard: s, heading: c }) : /* @__PURE__ */ n(
|
|
2605
|
+
Ge,
|
|
2100
2606
|
{
|
|
2101
2607
|
session: a.find((u) => `session-${u.type}` === p),
|
|
2102
|
-
round:
|
|
2608
|
+
round: r,
|
|
2103
2609
|
competitionId: e
|
|
2104
2610
|
}
|
|
2105
2611
|
)
|
|
2106
2612
|
] });
|
|
2107
2613
|
}
|
|
2108
|
-
function
|
|
2109
|
-
const { cdnUrl: t } =
|
|
2614
|
+
function bt(e) {
|
|
2615
|
+
const { cdnUrl: t } = S(), r = R({
|
|
2110
2616
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
2111
|
-
queryFn: () =>
|
|
2617
|
+
queryFn: () => M(t, Te(null, e)),
|
|
2112
2618
|
enabled: !!e,
|
|
2113
2619
|
staleTime: 3e4,
|
|
2114
2620
|
refetchInterval: 3e4
|
|
2115
|
-
}),
|
|
2621
|
+
}), s = r.data;
|
|
2116
2622
|
return {
|
|
2117
|
-
isLoading:
|
|
2118
|
-
error:
|
|
2119
|
-
data:
|
|
2120
|
-
driverName:
|
|
2121
|
-
lapCount:
|
|
2122
|
-
trackBreakdown:
|
|
2123
|
-
carBreakdown:
|
|
2124
|
-
recordsHeld:
|
|
2125
|
-
currentRecords:
|
|
2126
|
-
bestRanking:
|
|
2127
|
-
bestRankingTrackId:
|
|
2128
|
-
bestRankingLayout:
|
|
2129
|
-
bestRankingCarId:
|
|
2130
|
-
generatedAt:
|
|
2623
|
+
isLoading: r.isLoading,
|
|
2624
|
+
error: r.error,
|
|
2625
|
+
data: s ? {
|
|
2626
|
+
driverName: s.driverName || "Driver",
|
|
2627
|
+
lapCount: s.lapCount || 0,
|
|
2628
|
+
trackBreakdown: s.trackBreakdown || [],
|
|
2629
|
+
carBreakdown: s.carBreakdown || [],
|
|
2630
|
+
recordsHeld: s.recordsHeld || 0,
|
|
2631
|
+
currentRecords: s.currentRecords || [],
|
|
2632
|
+
bestRanking: s.bestRanking ?? null,
|
|
2633
|
+
bestRankingTrackId: s.bestRankingTrackId ?? null,
|
|
2634
|
+
bestRankingLayout: s.bestRankingLayout ?? null,
|
|
2635
|
+
bestRankingCarId: s.bestRankingCarId ?? null,
|
|
2636
|
+
generatedAt: s.generatedAt
|
|
2131
2637
|
} : null
|
|
2132
2638
|
};
|
|
2133
2639
|
}
|
|
2134
|
-
function
|
|
2135
|
-
const { cdnUrl: t, partnerSlug:
|
|
2136
|
-
queryKey: ["pitvox", "laps",
|
|
2137
|
-
queryFn: () =>
|
|
2640
|
+
function wt(e) {
|
|
2641
|
+
const { cdnUrl: t, partnerSlug: r } = S(), s = R({
|
|
2642
|
+
queryKey: ["pitvox", "laps", r || "global", e, "index"],
|
|
2643
|
+
queryFn: () => M(t, Te(r, e)),
|
|
2138
2644
|
enabled: !!e,
|
|
2139
2645
|
staleTime: 3e4,
|
|
2140
2646
|
refetchInterval: 3e4
|
|
2141
|
-
}), a =
|
|
2142
|
-
var
|
|
2143
|
-
return ((
|
|
2144
|
-
}, [
|
|
2647
|
+
}), a = T(() => {
|
|
2648
|
+
var o;
|
|
2649
|
+
return ((o = s.data) == null ? void 0 : o.combos) || [];
|
|
2650
|
+
}, [s.data]);
|
|
2145
2651
|
return {
|
|
2146
|
-
isLoading:
|
|
2147
|
-
error:
|
|
2652
|
+
isLoading: s.isLoading,
|
|
2653
|
+
error: s.error,
|
|
2148
2654
|
data: a
|
|
2149
2655
|
};
|
|
2150
2656
|
}
|
|
2151
|
-
function
|
|
2152
|
-
const { cdnUrl: t, partnerSlug:
|
|
2153
|
-
return
|
|
2154
|
-
queryKey: ["pitvox", "ratings",
|
|
2155
|
-
queryFn: () =>
|
|
2657
|
+
function ze(e = {}) {
|
|
2658
|
+
const { cdnUrl: t, partnerSlug: r } = S(), { game: s, gameVersion: a, enabled: o = !0 } = e, i = de(r, s, a, "ratings.json");
|
|
2659
|
+
return R({
|
|
2660
|
+
queryKey: ["pitvox", "ratings", r, s || null, a || null],
|
|
2661
|
+
queryFn: () => M(t, i),
|
|
2156
2662
|
staleTime: 3e4,
|
|
2157
2663
|
refetchInterval: 3e4,
|
|
2158
|
-
enabled:
|
|
2664
|
+
enabled: o
|
|
2159
2665
|
});
|
|
2160
2666
|
}
|
|
2161
|
-
function
|
|
2162
|
-
var
|
|
2163
|
-
const t =
|
|
2667
|
+
function xr(e) {
|
|
2668
|
+
var s;
|
|
2669
|
+
const t = ze(), r = T(() => {
|
|
2164
2670
|
var a;
|
|
2165
2671
|
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
2166
|
-
(
|
|
2672
|
+
(o) => o.identifier === e
|
|
2167
2673
|
) || null;
|
|
2168
|
-
}, [(
|
|
2674
|
+
}, [(s = t.data) == null ? void 0 : s.drivers, e]);
|
|
2169
2675
|
return {
|
|
2170
2676
|
isLoading: t.isLoading,
|
|
2171
2677
|
error: t.error,
|
|
2172
|
-
data:
|
|
2173
|
-
rating:
|
|
2174
|
-
rank:
|
|
2678
|
+
data: r ? {
|
|
2679
|
+
rating: r.rating,
|
|
2680
|
+
rank: r.rank,
|
|
2175
2681
|
totalDrivers: t.data.driverCount || t.data.drivers.length,
|
|
2176
|
-
comboCount:
|
|
2177
|
-
distinctCars:
|
|
2178
|
-
combos:
|
|
2682
|
+
comboCount: r.comboCount || 0,
|
|
2683
|
+
distinctCars: r.distinctCars || 0,
|
|
2684
|
+
combos: r.combos || []
|
|
2179
2685
|
} : null
|
|
2180
2686
|
};
|
|
2181
2687
|
}
|
|
2182
|
-
function
|
|
2183
|
-
const t =
|
|
2688
|
+
function ie(e = {}) {
|
|
2689
|
+
const t = ze(e);
|
|
2184
2690
|
return {
|
|
2185
2691
|
data: t.data || null,
|
|
2186
2692
|
isLoading: t.isLoading,
|
|
2187
2693
|
error: t.error
|
|
2188
2694
|
};
|
|
2189
2695
|
}
|
|
2190
|
-
function
|
|
2696
|
+
function kt(e) {
|
|
2191
2697
|
var p, c;
|
|
2192
|
-
const { versions: t } =
|
|
2698
|
+
const { versions: t } = on(), r = (p = t == null ? void 0 : t.evo) == null ? void 0 : p.default, s = (c = t == null ? void 0 : t.lmu) == null ? void 0 : c.default, a = ie({ game: "evo", gameVersion: r, enabled: !!r }), o = ie({ game: "acc" }), i = ie({ game: "lmu", gameVersion: s, enabled: !!s });
|
|
2193
2699
|
return {
|
|
2194
|
-
data:
|
|
2700
|
+
data: T(() => e ? [
|
|
2195
2701
|
{ data: a.data, game: "evo", label: "EVO" },
|
|
2196
|
-
{ data:
|
|
2197
|
-
{ data:
|
|
2702
|
+
{ data: o.data, game: "acc", label: "ACC" },
|
|
2703
|
+
{ data: i.data, game: "lmu", label: "LMU" }
|
|
2198
2704
|
].map(({ data: u, game: v, label: f }) => {
|
|
2199
2705
|
var x;
|
|
2200
2706
|
if (!((x = u == null ? void 0 : u.drivers) != null && x.length)) return null;
|
|
2201
|
-
const h = [...u.drivers].sort((
|
|
2202
|
-
return
|
|
2707
|
+
const h = [...u.drivers].sort((m, b) => b.rating - m.rating), y = h.findIndex((m) => m.identifier === e);
|
|
2708
|
+
return y === -1 ? null : {
|
|
2203
2709
|
game: v,
|
|
2204
2710
|
label: f,
|
|
2205
|
-
rating: h[
|
|
2206
|
-
rank:
|
|
2711
|
+
rating: h[y].rating,
|
|
2712
|
+
rank: y + 1,
|
|
2207
2713
|
totalDrivers: h.length
|
|
2208
2714
|
};
|
|
2209
|
-
}).filter(Boolean) : [], [e, a.data,
|
|
2210
|
-
isLoading: a.isLoading ||
|
|
2715
|
+
}).filter(Boolean) : [], [e, a.data, o.data, i.data]),
|
|
2716
|
+
isLoading: a.isLoading || o.isLoading || i.isLoading
|
|
2211
2717
|
};
|
|
2212
2718
|
}
|
|
2213
|
-
function
|
|
2214
|
-
const { cdnUrl: e, partnerSlug: t, getSteamId:
|
|
2719
|
+
function Ct() {
|
|
2720
|
+
const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = S(), a = r(), { data: o, isLoading: i } = R({
|
|
2215
2721
|
queryKey: ["pitvox", "competitions", t],
|
|
2216
2722
|
queryFn: async () => {
|
|
2217
|
-
const h = await
|
|
2218
|
-
return h != null && h.competitions ? h.competitions.filter((
|
|
2723
|
+
const h = await M(e, "competitions/index.json");
|
|
2724
|
+
return h != null && h.competitions ? h.competitions.filter((y) => y.partnerSlug === t) : [];
|
|
2219
2725
|
},
|
|
2220
2726
|
staleTime: 6e4
|
|
2221
|
-
}), d = (
|
|
2727
|
+
}), d = (o == null ? void 0 : o.map((h) => h.id)) || [], p = be({
|
|
2222
2728
|
queries: d.map((h) => ({
|
|
2223
2729
|
queryKey: ["pitvox", "competition", t, h, "entrylist"],
|
|
2224
|
-
queryFn: () =>
|
|
2730
|
+
queryFn: () => M(e, `competitions/${t}/${h}/entrylist.json`),
|
|
2225
2731
|
enabled: !!a && d.length > 0,
|
|
2226
2732
|
staleTime: 6e4
|
|
2227
2733
|
}))
|
|
2228
|
-
}), c = p.some((h) => h.isLoading), u =
|
|
2229
|
-
var x,
|
|
2230
|
-
if (!
|
|
2231
|
-
const h = /* @__PURE__ */ new Date(),
|
|
2232
|
-
for (let
|
|
2233
|
-
const
|
|
2234
|
-
if (!((
|
|
2235
|
-
const
|
|
2236
|
-
for (const N of
|
|
2237
|
-
if (
|
|
2238
|
-
const
|
|
2239
|
-
!
|
|
2240
|
-
competitionId:
|
|
2241
|
-
competitionName:
|
|
2734
|
+
}), c = p.some((h) => h.isLoading), u = T(() => {
|
|
2735
|
+
var x, m;
|
|
2736
|
+
if (!o || !a || c) return [];
|
|
2737
|
+
const h = /* @__PURE__ */ new Date(), y = [];
|
|
2738
|
+
for (let b = 0; b < o.length; b++) {
|
|
2739
|
+
const g = o[b], k = (x = p[b]) == null ? void 0 : x.data;
|
|
2740
|
+
if (!((m = k == null ? void 0 : k.drivers) == null ? void 0 : m.some((N) => N.steamId === a))) continue;
|
|
2741
|
+
const P = g.type === "hotlap", A = g.rounds || [];
|
|
2742
|
+
for (const N of A) {
|
|
2743
|
+
if (P ? O(N) : N.isFinalized) continue;
|
|
2744
|
+
const w = N.dediStatus === "running" || N.dediStatus === "provisioning", D = N.dediStatus === "scheduled", $ = N.startTime && new Date(N.startTime) > h, j = w || D || N.dediServerAddress;
|
|
2745
|
+
!w && !$ && !j || y.push({
|
|
2746
|
+
competitionId: g.id,
|
|
2747
|
+
competitionName: g.name,
|
|
2242
2748
|
roundNumber: N.roundNumber,
|
|
2243
2749
|
track: N.track || "TBD",
|
|
2244
2750
|
startTime: N.startTime,
|
|
@@ -2247,49 +2753,49 @@ function Kn() {
|
|
|
2247
2753
|
});
|
|
2248
2754
|
}
|
|
2249
2755
|
}
|
|
2250
|
-
return
|
|
2251
|
-
const
|
|
2252
|
-
return
|
|
2253
|
-
}),
|
|
2254
|
-
}, [
|
|
2756
|
+
return y.sort((b, g) => {
|
|
2757
|
+
const k = b.dediStatus === "running" || b.dediStatus === "provisioning", C = g.dediStatus === "running" || g.dediStatus === "provisioning";
|
|
2758
|
+
return k && !C ? -1 : !k && C ? 1 : new Date(b.startTime) - new Date(g.startTime);
|
|
2759
|
+
}), y.length > 0 && (y[0].isNext = !0), y;
|
|
2760
|
+
}, [o, a, c, p]), v = be({
|
|
2255
2761
|
queries: u.map((h) => ({
|
|
2256
2762
|
queryKey: ["pitvox", "serverInfo", h.competitionId, h.roundNumber],
|
|
2257
|
-
queryFn: () =>
|
|
2258
|
-
enabled: !!
|
|
2763
|
+
queryFn: () => s(h.competitionId, h.roundNumber),
|
|
2764
|
+
enabled: !!s && u.length > 0,
|
|
2259
2765
|
staleTime: 5 * 6e4,
|
|
2260
2766
|
// 5 minutes
|
|
2261
2767
|
retry: !1
|
|
2262
2768
|
}))
|
|
2263
2769
|
});
|
|
2264
2770
|
return {
|
|
2265
|
-
data:
|
|
2266
|
-
var
|
|
2267
|
-
const x = (
|
|
2771
|
+
data: T(() => u.length ? s ? u.map((h, y) => {
|
|
2772
|
+
var m;
|
|
2773
|
+
const x = (m = v[y]) == null ? void 0 : m.data;
|
|
2268
2774
|
return x != null && x.success ? {
|
|
2269
2775
|
...h,
|
|
2270
2776
|
serverAddress: x.serverAddress || null,
|
|
2271
2777
|
serverPassword: x.serverPassword || null
|
|
2272
2778
|
} : h;
|
|
2273
|
-
}) : u : [], [u,
|
|
2274
|
-
isLoading:
|
|
2779
|
+
}) : u : [], [u, s, v]),
|
|
2780
|
+
isLoading: i || !!a && c
|
|
2275
2781
|
};
|
|
2276
2782
|
}
|
|
2277
|
-
function
|
|
2278
|
-
const { onFetchNotifications: e } =
|
|
2783
|
+
function St() {
|
|
2784
|
+
const { onFetchNotifications: e } = S();
|
|
2279
2785
|
return !!e;
|
|
2280
2786
|
}
|
|
2281
|
-
function
|
|
2282
|
-
const { onFetchNotifications: t, partnerSlug:
|
|
2283
|
-
return
|
|
2284
|
-
queryKey: ["pitvox", "notifications",
|
|
2285
|
-
queryFn: () => t({ limit:
|
|
2787
|
+
function Lt(e = {}) {
|
|
2788
|
+
const { onFetchNotifications: t, partnerSlug: r } = S(), { limit: s = 20, unreadOnly: a = !1 } = e;
|
|
2789
|
+
return R({
|
|
2790
|
+
queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
|
|
2791
|
+
queryFn: () => t({ limit: s, unreadOnly: a }),
|
|
2286
2792
|
enabled: !!t,
|
|
2287
2793
|
staleTime: 3e4,
|
|
2288
2794
|
refetchInterval: 3e4
|
|
2289
2795
|
});
|
|
2290
2796
|
}
|
|
2291
|
-
function
|
|
2292
|
-
const { onFetchNotifications: e, partnerSlug: t } =
|
|
2797
|
+
function gr() {
|
|
2798
|
+
const { onFetchNotifications: e, partnerSlug: t } = S(), { data: r, isLoading: s } = R({
|
|
2293
2799
|
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
2294
2800
|
queryFn: () => e({ limit: 1 }),
|
|
2295
2801
|
enabled: !!e,
|
|
@@ -2297,57 +2803,57 @@ function Bt() {
|
|
|
2297
2803
|
refetchInterval: 3e4,
|
|
2298
2804
|
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
2299
2805
|
});
|
|
2300
|
-
return { count:
|
|
2806
|
+
return { count: r ?? 0, isLoading: s };
|
|
2301
2807
|
}
|
|
2302
|
-
function
|
|
2303
|
-
const { onMarkNotificationRead: e, partnerSlug: t } =
|
|
2304
|
-
return
|
|
2305
|
-
mutationFn: (
|
|
2808
|
+
function $t() {
|
|
2809
|
+
const { onMarkNotificationRead: e, partnerSlug: t } = S(), r = V();
|
|
2810
|
+
return G({
|
|
2811
|
+
mutationFn: (s) => {
|
|
2306
2812
|
if (!e)
|
|
2307
2813
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
2308
|
-
return e(
|
|
2814
|
+
return e(s);
|
|
2309
2815
|
},
|
|
2310
|
-
onSuccess: (
|
|
2311
|
-
|
|
2816
|
+
onSuccess: (s, a) => {
|
|
2817
|
+
r.setQueriesData(
|
|
2312
2818
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
2313
|
-
(
|
|
2314
|
-
...
|
|
2315
|
-
unreadCount: Math.max(0, (
|
|
2316
|
-
notifications:
|
|
2317
|
-
(
|
|
2819
|
+
(o) => o != null && o.notifications ? {
|
|
2820
|
+
...o,
|
|
2821
|
+
unreadCount: Math.max(0, (o.unreadCount || 0) - 1),
|
|
2822
|
+
notifications: o.notifications.map(
|
|
2823
|
+
(i) => i.id === a ? { ...i, isRead: !0, readAt: (/* @__PURE__ */ new Date()).toISOString() } : i
|
|
2318
2824
|
)
|
|
2319
|
-
} :
|
|
2825
|
+
} : o
|
|
2320
2826
|
);
|
|
2321
2827
|
}
|
|
2322
2828
|
});
|
|
2323
2829
|
}
|
|
2324
|
-
function
|
|
2325
|
-
const { onMarkAllNotificationsRead: e, partnerSlug: t } =
|
|
2326
|
-
return
|
|
2830
|
+
function Tt() {
|
|
2831
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: t } = S(), r = V();
|
|
2832
|
+
return G({
|
|
2327
2833
|
mutationFn: () => {
|
|
2328
2834
|
if (!e)
|
|
2329
2835
|
throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
|
|
2330
2836
|
return e();
|
|
2331
2837
|
},
|
|
2332
2838
|
onSuccess: () => {
|
|
2333
|
-
|
|
2839
|
+
r.setQueriesData(
|
|
2334
2840
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
2335
|
-
(
|
|
2336
|
-
...
|
|
2841
|
+
(s) => s != null && s.notifications ? {
|
|
2842
|
+
...s,
|
|
2337
2843
|
unreadCount: 0,
|
|
2338
|
-
notifications:
|
|
2844
|
+
notifications: s.notifications.map((a) => ({
|
|
2339
2845
|
...a,
|
|
2340
2846
|
isRead: !0,
|
|
2341
2847
|
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
2342
2848
|
}))
|
|
2343
|
-
} :
|
|
2849
|
+
} : s
|
|
2344
2850
|
);
|
|
2345
2851
|
}
|
|
2346
2852
|
});
|
|
2347
2853
|
}
|
|
2348
|
-
function
|
|
2349
|
-
const a =
|
|
2350
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${
|
|
2854
|
+
function Rt({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
2855
|
+
const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
2856
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
|
|
2351
2857
|
t ? /* @__PURE__ */ n("img", { src: t, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
|
|
2352
2858
|
/* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
|
|
2353
2859
|
/* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
@@ -2358,7 +2864,7 @@ function Qn({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" })
|
|
|
2358
2864
|
] })
|
|
2359
2865
|
] });
|
|
2360
2866
|
}
|
|
2361
|
-
function
|
|
2867
|
+
function Mt() {
|
|
2362
2868
|
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: [
|
|
2363
2869
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2364
2870
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -2366,7 +2872,7 @@ function Gn() {
|
|
|
2366
2872
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2367
2873
|
] });
|
|
2368
2874
|
}
|
|
2369
|
-
function
|
|
2875
|
+
function Pt() {
|
|
2370
2876
|
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: [
|
|
2371
2877
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2372
2878
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -2375,19 +2881,19 @@ function Yn() {
|
|
|
2375
2881
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
2376
2882
|
] });
|
|
2377
2883
|
}
|
|
2378
|
-
function
|
|
2884
|
+
function Se() {
|
|
2379
2885
|
return /* @__PURE__ */ n("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("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" }) });
|
|
2380
2886
|
}
|
|
2381
|
-
function
|
|
2382
|
-
const [
|
|
2383
|
-
|
|
2384
|
-
if (!
|
|
2887
|
+
function Le({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: o }) {
|
|
2888
|
+
const [i, d] = E(!1), p = Ze(null);
|
|
2889
|
+
$e(() => {
|
|
2890
|
+
if (!i) return;
|
|
2385
2891
|
function u(v) {
|
|
2386
2892
|
p.current && !p.current.contains(v.target) && d(!1);
|
|
2387
2893
|
}
|
|
2388
2894
|
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
2389
|
-
}, [
|
|
2390
|
-
const c =
|
|
2895
|
+
}, [i]);
|
|
2896
|
+
const c = s != null && s.length ? s.slice().sort((u, v) => v[o] - u[o]) : null;
|
|
2391
2897
|
return /* @__PURE__ */ l(
|
|
2392
2898
|
"div",
|
|
2393
2899
|
{
|
|
@@ -2398,61 +2904,61 @@ function be({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2398
2904
|
e,
|
|
2399
2905
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2400
2906
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
2401
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children:
|
|
2907
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
|
|
2402
2908
|
] }),
|
|
2403
|
-
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${
|
|
2909
|
+
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${i ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, v) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2404
2910
|
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
|
|
2405
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[
|
|
2911
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[o] })
|
|
2406
2912
|
] }, v)) })
|
|
2407
2913
|
]
|
|
2408
2914
|
}
|
|
2409
2915
|
);
|
|
2410
2916
|
}
|
|
2411
|
-
function
|
|
2917
|
+
function Dt({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, className: a = "" }) {
|
|
2412
2918
|
if (!e) return null;
|
|
2413
|
-
const
|
|
2414
|
-
name:
|
|
2919
|
+
const o = e.trackBreakdown.map((p) => ({
|
|
2920
|
+
name: z(p.trackId, p.layout),
|
|
2415
2921
|
lapCount: p.lapCount
|
|
2416
|
-
})),
|
|
2922
|
+
})), i = e.carBreakdown.map((p) => ({
|
|
2417
2923
|
name: I(p.carId),
|
|
2418
2924
|
lapCount: p.lapCount
|
|
2419
2925
|
})), d = Array.isArray(t) && t.length > 0;
|
|
2420
2926
|
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${a}`, children: [
|
|
2421
2927
|
/* @__PURE__ */ n(
|
|
2422
|
-
|
|
2928
|
+
Le,
|
|
2423
2929
|
{
|
|
2424
|
-
icon: /* @__PURE__ */ n(
|
|
2930
|
+
icon: /* @__PURE__ */ n(Mt, {}),
|
|
2425
2931
|
value: e.lapCount.toLocaleString(),
|
|
2426
2932
|
label: "Total Laps",
|
|
2427
|
-
items:
|
|
2933
|
+
items: o,
|
|
2428
2934
|
labelKey: "name",
|
|
2429
2935
|
countKey: "lapCount"
|
|
2430
2936
|
}
|
|
2431
2937
|
),
|
|
2432
2938
|
/* @__PURE__ */ n(
|
|
2433
|
-
|
|
2939
|
+
Le,
|
|
2434
2940
|
{
|
|
2435
|
-
icon: /* @__PURE__ */ n(
|
|
2941
|
+
icon: /* @__PURE__ */ n(Pt, {}),
|
|
2436
2942
|
value: e.carBreakdown.length,
|
|
2437
2943
|
label: "Cars Used",
|
|
2438
|
-
items:
|
|
2944
|
+
items: i,
|
|
2439
2945
|
labelKey: "name",
|
|
2440
2946
|
countKey: "lapCount"
|
|
2441
2947
|
}
|
|
2442
2948
|
),
|
|
2443
2949
|
d ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating-chips", children: [
|
|
2444
|
-
/* @__PURE__ */ n(
|
|
2950
|
+
/* @__PURE__ */ n(Se, {}),
|
|
2445
2951
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2446
2952
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2447
2953
|
/* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: t.map((p) => {
|
|
2448
|
-
const c = !!
|
|
2954
|
+
const c = !!r;
|
|
2449
2955
|
return /* @__PURE__ */ l(
|
|
2450
2956
|
"span",
|
|
2451
2957
|
{
|
|
2452
2958
|
className: `pvx-dash-rating-chip${c ? " pvx-dash-rating-chip--clickable" : ""}`,
|
|
2453
|
-
onClick: c ? () =>
|
|
2959
|
+
onClick: c ? () => r(p) : void 0,
|
|
2454
2960
|
onKeyDown: c ? (v) => {
|
|
2455
|
-
c && (v.key === "Enter" || v.key === " ") && (v.preventDefault(),
|
|
2961
|
+
c && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), r(p));
|
|
2456
2962
|
} : void 0,
|
|
2457
2963
|
role: c ? "button" : void 0,
|
|
2458
2964
|
tabIndex: c ? 0 : void 0,
|
|
@@ -2472,23 +2978,23 @@ function Jn({ stats: e, gameRatings: t, onGameRatingSelect: s, rating: r, classN
|
|
|
2472
2978
|
);
|
|
2473
2979
|
}) })
|
|
2474
2980
|
] })
|
|
2475
|
-
] }) :
|
|
2476
|
-
/* @__PURE__ */ n(
|
|
2981
|
+
] }) : s ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2982
|
+
/* @__PURE__ */ n(Se, {}),
|
|
2477
2983
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2478
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children:
|
|
2984
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: s.rating.toFixed(1) }),
|
|
2479
2985
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2480
2986
|
/* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
|
|
2481
2987
|
"#",
|
|
2482
|
-
|
|
2988
|
+
s.rank,
|
|
2483
2989
|
" of ",
|
|
2484
|
-
|
|
2990
|
+
s.totalDrivers
|
|
2485
2991
|
] })
|
|
2486
2992
|
] })
|
|
2487
2993
|
] }) : null
|
|
2488
2994
|
] });
|
|
2489
2995
|
}
|
|
2490
|
-
function
|
|
2491
|
-
return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
2996
|
+
function At({ combos: e, onComboSelect: t, className: r = "" }) {
|
|
2997
|
+
return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
|
|
2492
2998
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2493
2999
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combos-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2494
3000
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
@@ -2501,18 +3007,18 @@ function Zn({ combos: e, onComboSelect: t, className: s = "" }) {
|
|
|
2501
3007
|
")"
|
|
2502
3008
|
] })
|
|
2503
3009
|
] }) }),
|
|
2504
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((
|
|
2505
|
-
|
|
3010
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((s) => /* @__PURE__ */ n(
|
|
3011
|
+
Et,
|
|
2506
3012
|
{
|
|
2507
|
-
combo:
|
|
2508
|
-
onClick: t ? () => t(
|
|
3013
|
+
combo: s,
|
|
3014
|
+
onClick: t ? () => t(s) : null
|
|
2509
3015
|
},
|
|
2510
|
-
`${
|
|
3016
|
+
`${s.trackId}|${s.trackLayout || ""}|${s.carId}|${s.game || ""}|${s.gameVersion || ""}`
|
|
2511
3017
|
)) })
|
|
2512
3018
|
] }) : null;
|
|
2513
3019
|
}
|
|
2514
|
-
function
|
|
2515
|
-
const
|
|
3020
|
+
function Et({ combo: e, onClick: t }) {
|
|
3021
|
+
const r = e.game || "evo", s = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
|
|
2516
3022
|
return /* @__PURE__ */ l(
|
|
2517
3023
|
"div",
|
|
2518
3024
|
{
|
|
@@ -2526,12 +3032,12 @@ function Xn({ combo: e, onClick: t }) {
|
|
|
2526
3032
|
children: [
|
|
2527
3033
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-info", children: [
|
|
2528
3034
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-title", children: [
|
|
2529
|
-
e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2530
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children:
|
|
3035
|
+
e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r}`, children: r.toUpperCase() }),
|
|
3036
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: z(e.trackId, e.trackLayout, e.game) })
|
|
2531
3037
|
] }),
|
|
2532
3038
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-meta", children: [
|
|
2533
3039
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: I(e.carId) }),
|
|
2534
|
-
e.lapCount > 0 && /* @__PURE__ */ l(
|
|
3040
|
+
e.lapCount > 0 && /* @__PURE__ */ l(B, { children: [
|
|
2535
3041
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2536
3042
|
/* @__PURE__ */ l("span", { children: [
|
|
2537
3043
|
e.lapCount,
|
|
@@ -2539,9 +3045,9 @@ function Xn({ combo: e, onClick: t }) {
|
|
|
2539
3045
|
e.lapCount === 1 ? "lap" : "laps"
|
|
2540
3046
|
] })
|
|
2541
3047
|
] }),
|
|
2542
|
-
e.lastDrivenAt && /* @__PURE__ */ l(
|
|
3048
|
+
e.lastDrivenAt && /* @__PURE__ */ l(B, { children: [
|
|
2543
3049
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2544
|
-
/* @__PURE__ */ n("span", { children:
|
|
3050
|
+
/* @__PURE__ */ n("span", { children: pe(e.lastDrivenAt) })
|
|
2545
3051
|
] })
|
|
2546
3052
|
] })
|
|
2547
3053
|
] }),
|
|
@@ -2567,9 +3073,9 @@ function Xn({ combo: e, onClick: t }) {
|
|
|
2567
3073
|
e.totalDrivers,
|
|
2568
3074
|
" on leaderboard"
|
|
2569
3075
|
] }) : null,
|
|
2570
|
-
|
|
3076
|
+
s && /* @__PURE__ */ l("span", { className: "pvx-dash-combo-gap", children: [
|
|
2571
3077
|
"+",
|
|
2572
|
-
|
|
3078
|
+
s
|
|
2573
3079
|
] }),
|
|
2574
3080
|
e.personalBestMs && /* @__PURE__ */ n("span", { className: "pvx-dash-combo-pb", children: q(e.personalBestMs) })
|
|
2575
3081
|
] })
|
|
@@ -2577,15 +3083,15 @@ function Xn({ combo: e, onClick: t }) {
|
|
|
2577
3083
|
}
|
|
2578
3084
|
);
|
|
2579
3085
|
}
|
|
2580
|
-
function
|
|
3086
|
+
function Bt({ events: e, isLoading: t, className: r, limit: s = 3 }) {
|
|
2581
3087
|
if (t)
|
|
2582
3088
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2583
3089
|
if (!(e != null && e.length))
|
|
2584
3090
|
return null;
|
|
2585
|
-
const a =
|
|
2586
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
3091
|
+
const a = s ? e.slice(0, s) : e, o = e.length - a.length;
|
|
3092
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
|
|
2587
3093
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2588
|
-
/* @__PURE__ */ n(
|
|
3094
|
+
/* @__PURE__ */ n(It, {}),
|
|
2589
3095
|
"Upcoming Events",
|
|
2590
3096
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2591
3097
|
"(",
|
|
@@ -2594,178 +3100,178 @@ function et({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2594
3100
|
] })
|
|
2595
3101
|
] }) }),
|
|
2596
3102
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-list", children: [
|
|
2597
|
-
a.map((
|
|
3103
|
+
a.map((i) => /* @__PURE__ */ l(
|
|
2598
3104
|
"div",
|
|
2599
3105
|
{
|
|
2600
|
-
className: `pvx-upcoming-item ${
|
|
3106
|
+
className: `pvx-upcoming-item ${i.isNext ? "pvx-upcoming-item--next" : ""}`,
|
|
2601
3107
|
children: [
|
|
2602
3108
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-info", children: [
|
|
2603
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children:
|
|
3109
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children: i.competitionName }),
|
|
2604
3110
|
/* @__PURE__ */ l("span", { className: "pvx-upcoming-round", children: [
|
|
2605
3111
|
"Round ",
|
|
2606
|
-
|
|
3112
|
+
i.roundNumber,
|
|
2607
3113
|
": ",
|
|
2608
|
-
|
|
3114
|
+
i.track
|
|
2609
3115
|
] }),
|
|
2610
|
-
|
|
2611
|
-
|
|
3116
|
+
i.serverPassword && /* @__PURE__ */ n(
|
|
3117
|
+
Ut,
|
|
2612
3118
|
{
|
|
2613
|
-
password:
|
|
2614
|
-
address:
|
|
3119
|
+
password: i.serverPassword,
|
|
3120
|
+
address: i.serverAddress
|
|
2615
3121
|
}
|
|
2616
3122
|
)
|
|
2617
3123
|
] }),
|
|
2618
3124
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-time", children: [
|
|
2619
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(
|
|
3125
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(i.startTime).toLocaleDateString("en-GB", {
|
|
2620
3126
|
day: "numeric",
|
|
2621
3127
|
month: "short",
|
|
2622
3128
|
year: "numeric"
|
|
2623
3129
|
}) }),
|
|
2624
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children:
|
|
2625
|
-
|
|
2626
|
-
!
|
|
3130
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: i.dediStatus === "running" ? "Live now" : i.dediStatus === "provisioning" ? "Starting..." : _t(i.startTime) }),
|
|
3131
|
+
i.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
3132
|
+
!i.dediStatus && i.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2627
3133
|
] })
|
|
2628
3134
|
]
|
|
2629
3135
|
},
|
|
2630
|
-
`${
|
|
3136
|
+
`${i.competitionId}-${i.roundNumber}`
|
|
2631
3137
|
)),
|
|
2632
|
-
|
|
3138
|
+
o > 0 && /* @__PURE__ */ l("div", { className: "pvx-upcoming-remaining", children: [
|
|
2633
3139
|
"+",
|
|
2634
|
-
|
|
3140
|
+
o,
|
|
2635
3141
|
" more event",
|
|
2636
|
-
|
|
3142
|
+
o !== 1 ? "s" : ""
|
|
2637
3143
|
] })
|
|
2638
3144
|
] })
|
|
2639
3145
|
] });
|
|
2640
3146
|
}
|
|
2641
|
-
function
|
|
2642
|
-
const [
|
|
2643
|
-
if (
|
|
3147
|
+
function Ut({ password: e, address: t }) {
|
|
3148
|
+
const [r, s] = E(!1), [a, o] = E(!1), i = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
|
|
3149
|
+
if (i)
|
|
2644
3150
|
try {
|
|
2645
|
-
await navigator.clipboard.writeText(
|
|
3151
|
+
await navigator.clipboard.writeText(i), s(!0), setTimeout(() => s(!1), 2e3);
|
|
2646
3152
|
} catch {
|
|
2647
3153
|
}
|
|
2648
|
-
}, [
|
|
3154
|
+
}, [i]);
|
|
2649
3155
|
return /* @__PURE__ */ l("div", { className: "pvx-server-info", children: [
|
|
2650
|
-
|
|
3156
|
+
i && /* @__PURE__ */ l(
|
|
2651
3157
|
"span",
|
|
2652
3158
|
{
|
|
2653
3159
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2654
3160
|
onClick: d,
|
|
2655
3161
|
title: "Copy join string to clipboard",
|
|
2656
3162
|
children: [
|
|
2657
|
-
/* @__PURE__ */ n(
|
|
3163
|
+
/* @__PURE__ */ n(qt, {}),
|
|
2658
3164
|
" ",
|
|
2659
|
-
|
|
3165
|
+
r ? "Copied!" : "Join"
|
|
2660
3166
|
]
|
|
2661
3167
|
}
|
|
2662
3168
|
),
|
|
2663
|
-
e && /* @__PURE__ */ l(
|
|
3169
|
+
e && /* @__PURE__ */ l(B, { children: [
|
|
2664
3170
|
/* @__PURE__ */ n(
|
|
2665
3171
|
"span",
|
|
2666
3172
|
{
|
|
2667
3173
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2668
|
-
onClick: () =>
|
|
3174
|
+
onClick: () => o((p) => !p),
|
|
2669
3175
|
title: a ? "Hide password" : "Reveal password",
|
|
2670
|
-
children: a ? /* @__PURE__ */ n(
|
|
3176
|
+
children: a ? /* @__PURE__ */ n(jt, {}) : /* @__PURE__ */ n(Wt, {})
|
|
2671
3177
|
}
|
|
2672
3178
|
),
|
|
2673
3179
|
a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
|
|
2674
|
-
/* @__PURE__ */ n(
|
|
3180
|
+
/* @__PURE__ */ n(Ft, {}),
|
|
2675
3181
|
" ",
|
|
2676
3182
|
e
|
|
2677
3183
|
] })
|
|
2678
3184
|
] })
|
|
2679
3185
|
] });
|
|
2680
3186
|
}
|
|
2681
|
-
function
|
|
3187
|
+
function _t(e) {
|
|
2682
3188
|
const t = new Date(e).getTime() - Date.now();
|
|
2683
3189
|
if (t <= 0) return "Now";
|
|
2684
|
-
const
|
|
2685
|
-
if (
|
|
2686
|
-
if (
|
|
2687
|
-
const
|
|
2688
|
-
if (
|
|
2689
|
-
if (
|
|
2690
|
-
if (
|
|
2691
|
-
const a = Math.floor(
|
|
3190
|
+
const r = Math.floor(t / (1e3 * 60 * 60));
|
|
3191
|
+
if (r < 1) return "Less than 1 hour";
|
|
3192
|
+
if (r < 24) return `in ${r}h`;
|
|
3193
|
+
const s = Math.floor(r / 24);
|
|
3194
|
+
if (s === 1) return "Tomorrow";
|
|
3195
|
+
if (s < 7) return `in ${s} days`;
|
|
3196
|
+
if (s < 30) {
|
|
3197
|
+
const a = Math.floor(s / 7);
|
|
2692
3198
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2693
3199
|
}
|
|
2694
|
-
return
|
|
3200
|
+
return pe(e);
|
|
2695
3201
|
}
|
|
2696
|
-
function
|
|
3202
|
+
function It() {
|
|
2697
3203
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2698
3204
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2699
3205
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2700
3206
|
] });
|
|
2701
3207
|
}
|
|
2702
|
-
function
|
|
3208
|
+
function Ft() {
|
|
2703
3209
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2704
3210
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2705
3211
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2706
3212
|
] });
|
|
2707
3213
|
}
|
|
2708
|
-
function
|
|
3214
|
+
function qt() {
|
|
2709
3215
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2710
3216
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2711
3217
|
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2712
3218
|
] });
|
|
2713
3219
|
}
|
|
2714
|
-
function
|
|
3220
|
+
function Wt() {
|
|
2715
3221
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2716
3222
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2717
3223
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2718
3224
|
] });
|
|
2719
3225
|
}
|
|
2720
|
-
function
|
|
3226
|
+
function jt() {
|
|
2721
3227
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2722
3228
|
/* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
2723
3229
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2724
3230
|
] });
|
|
2725
3231
|
}
|
|
2726
|
-
function
|
|
2727
|
-
const
|
|
2728
|
-
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
3232
|
+
function Vt({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: o }) {
|
|
3233
|
+
const i = ue();
|
|
3234
|
+
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${o || ""}`, children: [
|
|
2729
3235
|
/* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
|
|
2730
3236
|
/* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2731
|
-
/* @__PURE__ */ n(
|
|
3237
|
+
/* @__PURE__ */ n(Ot, {}),
|
|
2732
3238
|
"Notifications",
|
|
2733
3239
|
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2734
3240
|
] }),
|
|
2735
|
-
t > 0 &&
|
|
3241
|
+
t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
|
|
2736
3242
|
] }),
|
|
2737
3243
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2738
|
-
|
|
3244
|
+
Kt,
|
|
2739
3245
|
{
|
|
2740
3246
|
notification: d,
|
|
2741
|
-
getUserDisplay:
|
|
2742
|
-
onMarkRead:
|
|
3247
|
+
getUserDisplay: i,
|
|
3248
|
+
onMarkRead: r
|
|
2743
3249
|
},
|
|
2744
3250
|
d.id
|
|
2745
3251
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2746
3252
|
] });
|
|
2747
3253
|
}
|
|
2748
|
-
function
|
|
2749
|
-
const
|
|
2750
|
-
!e.isRead &&
|
|
3254
|
+
function Kt({ notification: e, getUserDisplay: t, onMarkRead: r }) {
|
|
3255
|
+
const s = () => {
|
|
3256
|
+
!e.isRead && r && r(e.id);
|
|
2751
3257
|
};
|
|
2752
3258
|
return /* @__PURE__ */ l(
|
|
2753
3259
|
"button",
|
|
2754
3260
|
{
|
|
2755
3261
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2756
|
-
onClick:
|
|
3262
|
+
onClick: s,
|
|
2757
3263
|
children: [
|
|
2758
|
-
/* @__PURE__ */ n(
|
|
3264
|
+
/* @__PURE__ */ n(Ht, { type: e.type }),
|
|
2759
3265
|
/* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
|
|
2760
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children:
|
|
2761
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children:
|
|
3266
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: an(e, t) }),
|
|
3267
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: pe(e.createdAt) })
|
|
2762
3268
|
] }),
|
|
2763
3269
|
!e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
|
|
2764
3270
|
]
|
|
2765
3271
|
}
|
|
2766
3272
|
);
|
|
2767
3273
|
}
|
|
2768
|
-
function
|
|
3274
|
+
function Ht({ type: e }) {
|
|
2769
3275
|
return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2770
3276
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2771
3277
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2778,61 +3284,61 @@ function dt({ type: e }) {
|
|
|
2778
3284
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2779
3285
|
] }) });
|
|
2780
3286
|
}
|
|
2781
|
-
function
|
|
3287
|
+
function Ot() {
|
|
2782
3288
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2783
3289
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2784
3290
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2785
3291
|
] });
|
|
2786
3292
|
}
|
|
2787
|
-
function
|
|
3293
|
+
function fr({
|
|
2788
3294
|
steamId: e,
|
|
2789
3295
|
avatarUrl: t,
|
|
2790
|
-
memberSince:
|
|
2791
|
-
hideProfile:
|
|
3296
|
+
memberSince: r,
|
|
3297
|
+
hideProfile: s = !1,
|
|
2792
3298
|
onComboSelect: a,
|
|
2793
|
-
onGameRatingSelect:
|
|
2794
|
-
className:
|
|
3299
|
+
onGameRatingSelect: o,
|
|
3300
|
+
className: i = ""
|
|
2795
3301
|
}) {
|
|
2796
|
-
const { data: d, isLoading: p, error: c } =
|
|
2797
|
-
return p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : d ? /* @__PURE__ */ l("div", { className: `pvx-dash ${
|
|
2798
|
-
!
|
|
2799
|
-
|
|
3302
|
+
const { data: d, isLoading: p, error: c } = bt(e), { data: u } = kt(e), { data: v } = wt(e), { data: f, isLoading: h } = Ct(), y = St(), { data: x, isLoading: m } = Lt({ limit: 10 }), b = $t(), g = Tt();
|
|
3303
|
+
return p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : d ? /* @__PURE__ */ l("div", { className: `pvx-dash ${i}`, children: [
|
|
3304
|
+
!s && /* @__PURE__ */ n(
|
|
3305
|
+
Rt,
|
|
2800
3306
|
{
|
|
2801
3307
|
driverName: d.driverName,
|
|
2802
3308
|
avatarUrl: t,
|
|
2803
|
-
memberSince:
|
|
3309
|
+
memberSince: r
|
|
2804
3310
|
}
|
|
2805
3311
|
),
|
|
2806
3312
|
/* @__PURE__ */ n(
|
|
2807
|
-
|
|
3313
|
+
Dt,
|
|
2808
3314
|
{
|
|
2809
3315
|
stats: d,
|
|
2810
3316
|
gameRatings: u,
|
|
2811
|
-
onGameRatingSelect:
|
|
3317
|
+
onGameRatingSelect: o
|
|
2812
3318
|
}
|
|
2813
3319
|
),
|
|
2814
|
-
e && /* @__PURE__ */ n(
|
|
2815
|
-
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${
|
|
2816
|
-
/* @__PURE__ */ n(
|
|
2817
|
-
|
|
2818
|
-
|
|
3320
|
+
e && /* @__PURE__ */ n(Bt, { events: f, isLoading: h }),
|
|
3321
|
+
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${y ? "pvx-dash-row--2col" : ""}`, children: [
|
|
3322
|
+
/* @__PURE__ */ n(At, { combos: v, onComboSelect: a }),
|
|
3323
|
+
y && /* @__PURE__ */ n(
|
|
3324
|
+
Vt,
|
|
2819
3325
|
{
|
|
2820
3326
|
notifications: x == null ? void 0 : x.notifications,
|
|
2821
3327
|
unreadCount: (x == null ? void 0 : x.unreadCount) || 0,
|
|
2822
|
-
onMarkRead: (
|
|
2823
|
-
onMarkAllRead: () =>
|
|
2824
|
-
isLoading:
|
|
3328
|
+
onMarkRead: (k) => b.mutate(k),
|
|
3329
|
+
onMarkAllRead: () => g.mutate(),
|
|
3330
|
+
isLoading: m
|
|
2825
3331
|
}
|
|
2826
3332
|
)
|
|
2827
3333
|
] })
|
|
2828
3334
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2829
3335
|
}
|
|
2830
|
-
function
|
|
2831
|
-
const
|
|
2832
|
-
const
|
|
2833
|
-
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) -
|
|
3336
|
+
function Nr({ records: e, className: t = "" }) {
|
|
3337
|
+
const r = T(() => e != null && e.length ? e.slice().sort((s, a) => {
|
|
3338
|
+
const o = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
|
|
3339
|
+
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - o;
|
|
2834
3340
|
}) : [], [e]);
|
|
2835
|
-
return
|
|
3341
|
+
return r.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
|
|
2836
3342
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2837
3343
|
/* @__PURE__ */ n("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: [
|
|
2838
3344
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
@@ -2845,110 +3351,130 @@ function Ut({ records: e, className: t = "" }) {
|
|
|
2845
3351
|
"Current Records",
|
|
2846
3352
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2847
3353
|
"(",
|
|
2848
|
-
|
|
3354
|
+
r.length,
|
|
2849
3355
|
")"
|
|
2850
3356
|
] })
|
|
2851
3357
|
] }) }),
|
|
2852
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children:
|
|
3358
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
|
|
2853
3359
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
|
|
2854
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children:
|
|
2855
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(
|
|
3360
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: z(s.trackId, s.layout, s.game) }),
|
|
3361
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(s.carId) })
|
|
2856
3362
|
] }),
|
|
2857
3363
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
|
|
2858
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(
|
|
2859
|
-
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2860
|
-
(
|
|
2861
|
-
|
|
3364
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(s.lapTimeMs) }),
|
|
3365
|
+
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s.game || "evo"}`, children: [
|
|
3366
|
+
(s.game || "evo").toUpperCase(),
|
|
3367
|
+
s.gameVersion ? ` ${s.gameVersion}` : ""
|
|
2862
3368
|
] })
|
|
2863
3369
|
] })
|
|
2864
3370
|
] }, a)) })
|
|
2865
3371
|
] }) : null;
|
|
2866
3372
|
}
|
|
2867
3373
|
export {
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
3374
|
+
ir as CarsTable,
|
|
3375
|
+
_ as CompEmptyState,
|
|
3376
|
+
W as CompLoadingState,
|
|
3377
|
+
at as CompetitionCard,
|
|
3378
|
+
dr as CompetitionCards,
|
|
3379
|
+
vr as CompetitionResultsTabs,
|
|
3380
|
+
On as CompletedBadge,
|
|
3381
|
+
Ue as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
3382
|
+
fr as DriverDashboard,
|
|
3383
|
+
Rt as DriverProfile,
|
|
3384
|
+
or as DriversTable,
|
|
3385
|
+
Fn as EnterButton,
|
|
3386
|
+
ur as EntryList,
|
|
3387
|
+
ae as InfoPill,
|
|
3388
|
+
lr as LapHistoryTable,
|
|
3389
|
+
Vt as NotificationsCard,
|
|
3390
|
+
xe as PODIUM_MEDALS,
|
|
3391
|
+
xn as PROMOTION_STATUS_LABELS,
|
|
3392
|
+
Zt as PitVoxPartnerProvider,
|
|
3393
|
+
In as PromotionCard,
|
|
3394
|
+
_n as PromotionCards,
|
|
3395
|
+
qn as PromotionDetail,
|
|
3396
|
+
sr as PromotionExplorer,
|
|
3397
|
+
Ie as PromotionStatusBadge,
|
|
3398
|
+
Fe as PromotionTypeBadge,
|
|
3399
|
+
ut as RacePositionsChart,
|
|
3400
|
+
cr as RankingsTable,
|
|
3401
|
+
At as RecentCombosCard,
|
|
3402
|
+
Nr as RecordsTable,
|
|
3403
|
+
hr as RegisterButton,
|
|
3404
|
+
mr as RegistrationPanel,
|
|
3405
|
+
pr as RoundResults,
|
|
3406
|
+
ye as RoundSessionResults,
|
|
3407
|
+
lt as StandingsTable,
|
|
3408
|
+
Dt as StatsCards,
|
|
3409
|
+
ar as TracksTable,
|
|
3410
|
+
Rn as TypeBadge,
|
|
3411
|
+
Bt as UpcomingEvents,
|
|
3412
|
+
st as WeatherIcon,
|
|
3413
|
+
Te as buildDriverIndexPath,
|
|
3414
|
+
rn as buildLapsPath,
|
|
3415
|
+
de as buildLeaderboardPath,
|
|
3416
|
+
sn as buildRecentLapsPath,
|
|
3417
|
+
M as fetchCdnJson,
|
|
3418
|
+
rr as filterCompetitionsByStatus,
|
|
2904
3419
|
I as formatCarName,
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
3420
|
+
Q as formatDate,
|
|
3421
|
+
Jt as formatDelta,
|
|
3422
|
+
Me as formatFuel,
|
|
2908
3423
|
q as formatLapTime,
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3424
|
+
an as formatNotificationMessage,
|
|
3425
|
+
K as formatPromotionDate,
|
|
3426
|
+
pe as formatRelativeTime,
|
|
3427
|
+
F as formatSectorTime,
|
|
3428
|
+
X as formatSessionLabel,
|
|
3429
|
+
z as formatTrackName,
|
|
3430
|
+
Re as formatTyreCompound,
|
|
3431
|
+
En as getCompetitionPodium,
|
|
3432
|
+
_e as getCompetitionStatus,
|
|
3433
|
+
An as getCompletionDate,
|
|
3434
|
+
J as getPromotionStatus,
|
|
3435
|
+
Dn as isCompetitionComplete,
|
|
3436
|
+
O as isRoundClosed,
|
|
3437
|
+
Un as promotionWindowSummary,
|
|
3438
|
+
nr as useCarLeaderboard,
|
|
3439
|
+
Xt as useCarMetadata,
|
|
3440
|
+
pn as useCompetitionAllRounds,
|
|
3441
|
+
Pe as useCompetitionConfig,
|
|
3442
|
+
Ae as useCompetitionEntryList,
|
|
3443
|
+
un as useCompetitionLeaderboard,
|
|
3444
|
+
dn as useCompetitionRound,
|
|
3445
|
+
mn as useCompetitionRoundLaps,
|
|
3446
|
+
hn as useCompetitionRoundLeaderboard,
|
|
3447
|
+
vn as useCompetitionRoundPositions,
|
|
3448
|
+
De as useCompetitionStandings,
|
|
3449
|
+
tr as useCompetitions,
|
|
3450
|
+
wt as useDriverCombos,
|
|
3451
|
+
cn as useDriverLaps,
|
|
3452
|
+
xr as useDriverRating,
|
|
3453
|
+
ie as useDriverRatings,
|
|
3454
|
+
kt as useDriverRatingsByGame,
|
|
3455
|
+
bt as useDriverStats,
|
|
3456
|
+
bn as useEnterPromotion,
|
|
3457
|
+
on as useLeaderboardIndex,
|
|
3458
|
+
Tt as useMarkAllNotificationsRead,
|
|
3459
|
+
$t as useMarkNotificationRead,
|
|
3460
|
+
Lt as useNotifications,
|
|
3461
|
+
St as useNotificationsEnabled,
|
|
3462
|
+
S as usePitVox,
|
|
3463
|
+
fn as usePromotionConfig,
|
|
3464
|
+
Nn as usePromotionEntryList,
|
|
3465
|
+
yn as usePromotionEntryStatus,
|
|
3466
|
+
kn as usePromotionMode,
|
|
3467
|
+
Cn as usePromotionUrl,
|
|
3468
|
+
gn as usePromotions,
|
|
3469
|
+
er as useRecentLaps,
|
|
3470
|
+
Ee as useRegister,
|
|
3471
|
+
me as useRegistrationMode,
|
|
3472
|
+
he as useRegistrationStatus,
|
|
3473
|
+
ve as useRegistrationUrl,
|
|
3474
|
+
ln as useTrackLeaderboard,
|
|
3475
|
+
gr as useUnreadCount,
|
|
3476
|
+
Ct as useUpcomingEvents,
|
|
3477
|
+
ue as useUserLookup,
|
|
3478
|
+
Be as useWithdraw,
|
|
3479
|
+
wn as useWithdrawPromotionEntry
|
|
2954
3480
|
};
|