@pitvox/partner-react 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +531 -510
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as n, jsxs as c, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as Me, useMemo as L, useContext as De, useState as D, useCallback as H, useRef as Ie, useEffect as Be } from "react";
|
|
3
|
-
import { useQueryClient as _, QueryClient as Pe, QueryClientProvider as Ae, useQuery as
|
|
3
|
+
import { useQueryClient as _, QueryClient as Pe, QueryClientProvider as Ae, useQuery as S, useMutation as O, useQueries as ie } from "@tanstack/react-query";
|
|
4
4
|
const J = Me(null), Ue = "https://cdn.pitvox.com", Ee = "https://pitvox.com";
|
|
5
5
|
let Q = null;
|
|
6
|
-
function
|
|
6
|
+
function Zn({
|
|
7
7
|
partnerSlug: e = null,
|
|
8
8
|
cdnUrl: t = Ue,
|
|
9
|
-
pitvoxUrl:
|
|
10
|
-
getSteamId:
|
|
9
|
+
pitvoxUrl: r = Ee,
|
|
10
|
+
getSteamId: s,
|
|
11
11
|
onRegister: a,
|
|
12
12
|
onWithdraw: i,
|
|
13
13
|
onFetchNotifications: o,
|
|
@@ -19,15 +19,15 @@ function Yn({
|
|
|
19
19
|
const f = L(() => ({
|
|
20
20
|
partnerSlug: e,
|
|
21
21
|
cdnUrl: t.replace(/\/$/, ""),
|
|
22
|
-
pitvoxUrl:
|
|
23
|
-
getSteamId:
|
|
22
|
+
pitvoxUrl: r.replace(/\/$/, ""),
|
|
23
|
+
getSteamId: s || (() => null),
|
|
24
24
|
onRegister: a || null,
|
|
25
25
|
onWithdraw: i || null,
|
|
26
26
|
onFetchNotifications: o || null,
|
|
27
27
|
onMarkNotificationRead: d || null,
|
|
28
28
|
onMarkAllNotificationsRead: u || null,
|
|
29
29
|
onFetchServerPassword: l || null
|
|
30
|
-
}), [e, t,
|
|
30
|
+
}), [e, t, r, s, a, i, o, d, u, l]);
|
|
31
31
|
let g = !1;
|
|
32
32
|
try {
|
|
33
33
|
_(), g = !0;
|
|
@@ -46,21 +46,21 @@ function k() {
|
|
|
46
46
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
47
|
return e;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
throw new Error(`CDN fetch failed: ${
|
|
49
|
+
async function R(e, t) {
|
|
50
|
+
const r = await fetch(`${e}/${t}`);
|
|
51
|
+
if (!r.ok) {
|
|
52
|
+
if (r.status === 404 || r.status === 403) return null;
|
|
53
|
+
throw new Error(`CDN fetch failed: ${r.status}`);
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return r.json();
|
|
56
56
|
}
|
|
57
|
-
function Z(e, t,
|
|
57
|
+
function Z(e, t, r, ...s) {
|
|
58
58
|
const a = ["leaderboards"];
|
|
59
|
-
return e && a.push(`partners/${e}`), t && a.push(t),
|
|
59
|
+
return e && a.push(`partners/${e}`), t && a.push(t), r && a.push(`v/${r}`), [...a, ...s].join("/");
|
|
60
60
|
}
|
|
61
|
-
function Fe(e, t,
|
|
62
|
-
const a =
|
|
63
|
-
return e ? `laps/partners/${e}/${t}/${
|
|
61
|
+
function Fe(e, t, r, s) {
|
|
62
|
+
const a = s || "default";
|
|
63
|
+
return e ? `laps/partners/${e}/${t}/${r}/${a}.json` : `laps/${t}/${r}/${a}.json`;
|
|
64
64
|
}
|
|
65
65
|
function _e(e, t) {
|
|
66
66
|
return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
|
|
@@ -70,8 +70,8 @@ function qe(e) {
|
|
|
70
70
|
}
|
|
71
71
|
function A(e) {
|
|
72
72
|
if (!e && e !== 0) return "-";
|
|
73
|
-
const t = Math.floor(e / 1e3),
|
|
74
|
-
return `${
|
|
73
|
+
const t = Math.floor(e / 1e3), r = Math.floor(t / 60), s = t % 60, a = e % 1e3;
|
|
74
|
+
return `${r}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
|
|
75
75
|
}
|
|
76
76
|
function B(e) {
|
|
77
77
|
return !e && e !== 0 ? "-" : e >= 6e4 ? A(e) : (e / 1e3).toFixed(3);
|
|
@@ -79,14 +79,14 @@ function B(e) {
|
|
|
79
79
|
function I(e) {
|
|
80
80
|
if (!e) return "";
|
|
81
81
|
let t = e;
|
|
82
|
-
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((
|
|
82
|
+
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
|
|
83
83
|
}
|
|
84
|
-
function q(e, t,
|
|
84
|
+
function q(e, t, r) {
|
|
85
85
|
if (!e) return "";
|
|
86
|
-
const
|
|
87
|
-
if (!t || t === "default" || a) return
|
|
86
|
+
const s = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = r === "acc" || !r && (t == null ? void 0 : t.toLowerCase()) === "track config";
|
|
87
|
+
if (!t || t === "default" || a) return s;
|
|
88
88
|
const i = t.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
|
|
89
|
-
return `${
|
|
89
|
+
return `${s} ${i}`;
|
|
90
90
|
}
|
|
91
91
|
function j(e) {
|
|
92
92
|
if (!e) return "-";
|
|
@@ -102,21 +102,21 @@ function j(e) {
|
|
|
102
102
|
}
|
|
103
103
|
function le(e) {
|
|
104
104
|
if (!e) return "";
|
|
105
|
-
const t = Date.now() - new Date(e).getTime(),
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const a = Math.floor(
|
|
105
|
+
const t = Date.now() - new Date(e).getTime(), r = Math.floor(t / 1e3);
|
|
106
|
+
if (r < 60) return "Just now";
|
|
107
|
+
const s = Math.floor(r / 60);
|
|
108
|
+
if (s < 60) return `${s}m ago`;
|
|
109
|
+
const a = Math.floor(s / 60);
|
|
110
110
|
if (a < 24) return `${a}h ago`;
|
|
111
111
|
const i = Math.floor(a / 24);
|
|
112
112
|
return i < 30 ? `${i}d ago` : j(e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Xn(e) {
|
|
115
115
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
116
|
}
|
|
117
117
|
function je(e, t) {
|
|
118
|
-
const { type:
|
|
119
|
-
return
|
|
118
|
+
const { type: r, title: s, trackId: a, trackLayout: i, carId: o, game: d, data: u } = e, l = typeof u == "string" ? JSON.parse(u) : u, p = a ? q(a, i, d) : null, f = o ? I(o) : null, g = [p, f].filter(Boolean).join(" — ");
|
|
119
|
+
return r === "RECORD_BEATEN" && g ? `${l != null && l.beatenBySteamId && t ? t(l.beatenBySteamId).displayName : "Someone"} beat your record on ${g}` : r === "RECORD_SET" && g ? `You set a new record on ${g}` : s || "New notification";
|
|
120
120
|
}
|
|
121
121
|
function de(e) {
|
|
122
122
|
return e ? {
|
|
@@ -137,18 +137,18 @@ function pe(e) {
|
|
|
137
137
|
const t = Number(e);
|
|
138
138
|
return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function et(e = {}) {
|
|
141
141
|
var u, l, p, f, g, m;
|
|
142
|
-
const { cdnUrl: t, partnerSlug:
|
|
143
|
-
queryKey: ["pitvox", "leaderboards",
|
|
144
|
-
queryFn: () =>
|
|
142
|
+
const { cdnUrl: t, partnerSlug: r } = k(), { game: s, gameVersion: a } = e, i = Z(r, null, null, "index.json"), o = S({
|
|
143
|
+
queryKey: ["pitvox", "leaderboards", r, "index"],
|
|
144
|
+
queryFn: () => R(t, i),
|
|
145
145
|
staleTime: 3e4,
|
|
146
146
|
refetchInterval: 3e4
|
|
147
147
|
}), d = L(() => {
|
|
148
148
|
var x;
|
|
149
149
|
if (!((x = o.data) != null && x.tracks)) return [];
|
|
150
150
|
let b = o.data.tracks;
|
|
151
|
-
return
|
|
151
|
+
return s && (b = b.filter((v) => v.game === s)), a && (b = b.filter((v) => v.gameVersion === a)), b.map((v) => ({
|
|
152
152
|
id: v.trackId,
|
|
153
153
|
layout: v.layout,
|
|
154
154
|
game: v.game,
|
|
@@ -165,7 +165,7 @@ function Zn(e = {}) {
|
|
|
165
165
|
} : null,
|
|
166
166
|
recordByTag: v.recordByTag || null
|
|
167
167
|
}));
|
|
168
|
-
}, [(u = o.data) == null ? void 0 : u.tracks,
|
|
168
|
+
}, [(u = o.data) == null ? void 0 : u.tracks, s, a]);
|
|
169
169
|
return {
|
|
170
170
|
...o,
|
|
171
171
|
data: d,
|
|
@@ -176,10 +176,10 @@ function Zn(e = {}) {
|
|
|
176
176
|
versions: ((m = o.data) == null ? void 0 : m.versions) || {}
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function Ve(e, t,
|
|
180
|
-
const { cdnUrl:
|
|
179
|
+
function Ve(e, t, r = {}) {
|
|
180
|
+
const { cdnUrl: s, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = r, u = t || "default", l = Z(a, o, d, `tracks/${e}/${u}.json`), { data: p, isLoading: f, error: g } = S({
|
|
181
181
|
queryKey: ["pitvox", "leaderboards", a, "track", e, u, o, d],
|
|
182
|
-
queryFn: () =>
|
|
182
|
+
queryFn: () => R(s, l),
|
|
183
183
|
enabled: !!e,
|
|
184
184
|
staleTime: 3e4,
|
|
185
185
|
refetchInterval: 3e4
|
|
@@ -201,18 +201,18 @@ function Ve(e, t, s = {}) {
|
|
|
201
201
|
return b.filter((x) => x.carId === i).sort((x, v) => x.lapTimeMs - v.lapTimeMs);
|
|
202
202
|
}, [p == null ? void 0 : p.entries, i, o]), isLoading: f, error: g };
|
|
203
203
|
}
|
|
204
|
-
function Ke(e, t,
|
|
204
|
+
function Ke(e, t, r, s, a = {}) {
|
|
205
205
|
var x, v;
|
|
206
|
-
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: u, gameVersion: l } = a, p = e && t ? Fe(o, e, t,
|
|
207
|
-
queryKey: ["pitvox", "laps", o, e, t,
|
|
208
|
-
queryFn: () =>
|
|
206
|
+
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: u, gameVersion: l } = a, p = e && t ? Fe(o, e, t, r) : null, g = S({
|
|
207
|
+
queryKey: ["pitvox", "laps", o, e, t, r || "default"],
|
|
208
|
+
queryFn: () => R(i, p),
|
|
209
209
|
enabled: !!e && !!t,
|
|
210
210
|
staleTime: 3e4,
|
|
211
211
|
refetchInterval: 3e4
|
|
212
212
|
}), m = L(() => {
|
|
213
213
|
var N;
|
|
214
|
-
return (N = g.data) != null && N.laps ? g.data.laps.filter((h) => !(h.carId !==
|
|
215
|
-
}, [(x = g.data) == null ? void 0 : x.laps,
|
|
214
|
+
return (N = g.data) != null && N.laps ? g.data.laps.filter((h) => !(h.carId !== s || u && h.game !== u || l && h.gameVersion !== l || !d && !h.isValid)).sort((h, y) => h.lapTimeMs - y.lapTimeMs) : [];
|
|
215
|
+
}, [(x = g.data) == null ? void 0 : x.laps, s, u, l, d]), b = L(() => {
|
|
216
216
|
const N = m.filter(($) => $.isValid && $.sector1Ms && $.sector2Ms && $.sector3Ms);
|
|
217
217
|
if (N.length < 2) return null;
|
|
218
218
|
const h = Math.min(...N.map(($) => $.sector1Ms)), y = Math.min(...N.map(($) => $.sector2Ms)), C = Math.min(...N.map(($) => $.sector3Ms)), w = h + y + C, T = Math.min(...N.map(($) => $.lapTimeMs));
|
|
@@ -226,25 +226,25 @@ function Ke(e, t, s, r, a = {}) {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
function ue() {
|
|
229
|
-
const { cdnUrl: e } = k(), { data: t } =
|
|
229
|
+
const { cdnUrl: e } = k(), { data: t } = S({
|
|
230
230
|
queryKey: ["pitvox", "users", "index"],
|
|
231
|
-
queryFn: () =>
|
|
231
|
+
queryFn: () => R(e, "users/index.json"),
|
|
232
232
|
staleTime: 5 * 6e4,
|
|
233
233
|
gcTime: 30 * 6e4
|
|
234
|
-
}),
|
|
235
|
-
return (
|
|
236
|
-
const i = s
|
|
234
|
+
}), r = (t == null ? void 0 : t.users) || {};
|
|
235
|
+
return (s, a) => {
|
|
236
|
+
const i = r[s];
|
|
237
237
|
return {
|
|
238
|
-
displayName: (i == null ? void 0 : i.displayName) || a ||
|
|
238
|
+
displayName: (i == null ? void 0 : i.displayName) || a || s || "Unknown",
|
|
239
239
|
avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
|
|
240
240
|
affiliations: (i == null ? void 0 : i.affiliations) || []
|
|
241
241
|
};
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
const { cdnUrl: e } = k(), { data: t } =
|
|
244
|
+
function nt() {
|
|
245
|
+
const { cdnUrl: e } = k(), { data: t } = S({
|
|
246
246
|
queryKey: ["pitvox", "cars", "evo"],
|
|
247
|
-
queryFn: () =>
|
|
247
|
+
queryFn: () => R(e, "cars/evo.json"),
|
|
248
248
|
staleTime: 5 * 6e4,
|
|
249
249
|
gcTime: 30 * 6e4
|
|
250
250
|
});
|
|
@@ -253,100 +253,109 @@ function Xn() {
|
|
|
253
253
|
cars: (t == null ? void 0 : t.cars) || {}
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function tt() {
|
|
257
257
|
var a, i;
|
|
258
|
-
const { cdnUrl: e, partnerSlug: t } = k(),
|
|
258
|
+
const { cdnUrl: e, partnerSlug: t } = k(), r = qe(t), s = S({
|
|
259
259
|
queryKey: ["pitvox", "recentLaps", t],
|
|
260
|
-
queryFn: () =>
|
|
260
|
+
queryFn: () => R(e, r),
|
|
261
261
|
staleTime: 3e4,
|
|
262
262
|
refetchInterval: 3e4,
|
|
263
263
|
gcTime: 10 * 6e4
|
|
264
264
|
});
|
|
265
265
|
return {
|
|
266
|
-
groups: ((a =
|
|
267
|
-
generatedAt: ((i =
|
|
268
|
-
isLoading:
|
|
266
|
+
groups: ((a = s.data) == null ? void 0 : a.groups) || [],
|
|
267
|
+
generatedAt: ((i = s.data) == null ? void 0 : i.generatedAt) || null,
|
|
268
|
+
isLoading: s.isLoading
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function rt(e, t) {
|
|
272
272
|
return Ve(e, null, { carId: t });
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function st() {
|
|
275
275
|
const { cdnUrl: e, partnerSlug: t } = k();
|
|
276
|
-
return
|
|
276
|
+
return S({
|
|
277
277
|
queryKey: ["pitvox", "competitions", t],
|
|
278
278
|
queryFn: async () => {
|
|
279
|
-
const
|
|
280
|
-
return
|
|
279
|
+
const r = await R(e, "competitions/index.json");
|
|
280
|
+
return r != null && r.competitions ? t ? r.competitions.filter((s) => s.partnerSlug === t) : r.competitions : [];
|
|
281
281
|
},
|
|
282
282
|
staleTime: 6e4
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
function me(e, t = {}) {
|
|
286
|
-
const
|
|
287
|
-
return
|
|
288
|
-
queryKey: ["pitvox", "competition",
|
|
289
|
-
queryFn: () =>
|
|
290
|
-
enabled: !!
|
|
286
|
+
const r = k(), s = t.partnerSlug || r.partnerSlug;
|
|
287
|
+
return S({
|
|
288
|
+
queryKey: ["pitvox", "competition", s, e, "config"],
|
|
289
|
+
queryFn: () => R(r.cdnUrl, `competitions/${s}/${e}/config.json`),
|
|
290
|
+
enabled: !!s && !!e,
|
|
291
291
|
staleTime: 6e4
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
function ve(e, t = {}) {
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
queryKey: ["pitvox", "competition",
|
|
298
|
-
queryFn: () =>
|
|
299
|
-
enabled: !!
|
|
295
|
+
const r = k(), s = t.partnerSlug || r.partnerSlug;
|
|
296
|
+
return S({
|
|
297
|
+
queryKey: ["pitvox", "competition", s, e, "standings"],
|
|
298
|
+
queryFn: () => R(r.cdnUrl, `competitions/${s}/${e}/standings.json`),
|
|
299
|
+
enabled: !!s && !!e,
|
|
300
300
|
staleTime: 6e4
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
function He(e, t,
|
|
304
|
-
const
|
|
305
|
-
return
|
|
303
|
+
function He(e, t, r = {}) {
|
|
304
|
+
const s = k(), a = r.partnerSlug || s.partnerSlug;
|
|
305
|
+
return S({
|
|
306
306
|
queryKey: ["pitvox", "competition", a, e, "round", t],
|
|
307
|
-
queryFn: () =>
|
|
307
|
+
queryFn: () => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
|
|
308
308
|
enabled: !!a && !!e && t != null,
|
|
309
309
|
staleTime: 6e4
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
|
-
function Oe(e, t = [],
|
|
313
|
-
const
|
|
314
|
-
return
|
|
312
|
+
function Oe(e, t = [], r = {}) {
|
|
313
|
+
const s = k(), a = r.partnerSlug || s.partnerSlug;
|
|
314
|
+
return S({
|
|
315
315
|
queryKey: ["pitvox", "competition", a, e, "allRounds", t],
|
|
316
316
|
queryFn: async () => (await Promise.all(
|
|
317
317
|
t.map(
|
|
318
|
-
(o) =>
|
|
318
|
+
(o) => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
|
|
319
319
|
)
|
|
320
320
|
)).filter(Boolean),
|
|
321
321
|
enabled: !!a && !!e && t.length > 0,
|
|
322
322
|
staleTime: 6e4
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
const r = k(),
|
|
327
|
-
return
|
|
325
|
+
function at(e, t = {}) {
|
|
326
|
+
const r = k(), s = t.partnerSlug || r.partnerSlug;
|
|
327
|
+
return S({
|
|
328
|
+
queryKey: ["pitvox", "competition", s, e, "leaderboard"],
|
|
329
|
+
queryFn: () => R(r.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
|
|
330
|
+
enabled: !!s && !!e,
|
|
331
|
+
staleTime: 6e4
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function We(e, t, r = {}) {
|
|
335
|
+
const s = k(), a = r.partnerSlug || s.partnerSlug;
|
|
336
|
+
return S({
|
|
328
337
|
queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
|
|
329
|
-
queryFn: () =>
|
|
338
|
+
queryFn: () => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
|
|
330
339
|
enabled: !!a && !!e && t != null,
|
|
331
340
|
staleTime: 6e4
|
|
332
341
|
});
|
|
333
342
|
}
|
|
334
343
|
function he(e, t = {}) {
|
|
335
|
-
const
|
|
336
|
-
return
|
|
337
|
-
queryKey: ["pitvox", "competition",
|
|
338
|
-
queryFn: () =>
|
|
339
|
-
enabled: !!
|
|
344
|
+
const r = k(), s = t.partnerSlug || r.partnerSlug;
|
|
345
|
+
return S({
|
|
346
|
+
queryKey: ["pitvox", "competition", s, e, "entrylist"],
|
|
347
|
+
queryFn: () => R(r.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
|
|
348
|
+
enabled: !!s && !!e,
|
|
340
349
|
staleTime: 6e4
|
|
341
350
|
});
|
|
342
351
|
}
|
|
343
352
|
function X(e) {
|
|
344
|
-
const { cdnUrl: t, partnerSlug:
|
|
345
|
-
return
|
|
346
|
-
queryKey: ["pitvox", "registration",
|
|
353
|
+
const { cdnUrl: t, partnerSlug: r, getSteamId: s } = k(), a = s();
|
|
354
|
+
return S({
|
|
355
|
+
queryKey: ["pitvox", "registration", r, e, a],
|
|
347
356
|
queryFn: async () => {
|
|
348
357
|
var u;
|
|
349
|
-
const i = await fetch(`${t}/competitions/${
|
|
358
|
+
const i = await fetch(`${t}/competitions/${r}/${e}/entrylist.json`);
|
|
350
359
|
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
351
360
|
const o = await i.json();
|
|
352
361
|
return { isRegistered: !!a && ((u = o.drivers) == null ? void 0 : u.some((l) => l.steamId === a)), entryList: o };
|
|
@@ -356,7 +365,7 @@ function X(e) {
|
|
|
356
365
|
});
|
|
357
366
|
}
|
|
358
367
|
function xe(e) {
|
|
359
|
-
const { onRegister: t, partnerSlug:
|
|
368
|
+
const { onRegister: t, partnerSlug: r, getSteamId: s } = k(), a = _(), i = ue();
|
|
360
369
|
return O({
|
|
361
370
|
mutationFn: (o) => {
|
|
362
371
|
if (!t)
|
|
@@ -366,9 +375,9 @@ function xe(e) {
|
|
|
366
375
|
return t(e, o);
|
|
367
376
|
},
|
|
368
377
|
onSuccess: () => {
|
|
369
|
-
const o =
|
|
378
|
+
const o = s();
|
|
370
379
|
if (a.setQueriesData(
|
|
371
|
-
{ queryKey: ["pitvox", "registration",
|
|
380
|
+
{ queryKey: ["pitvox", "registration", r, e] },
|
|
372
381
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
373
382
|
), o) {
|
|
374
383
|
const d = i(o), u = {
|
|
@@ -377,7 +386,7 @@ function xe(e) {
|
|
|
377
386
|
avatarUrl: d.avatarUrl
|
|
378
387
|
};
|
|
379
388
|
a.setQueriesData(
|
|
380
|
-
{ queryKey: ["pitvox", "competition",
|
|
389
|
+
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
381
390
|
(l) => {
|
|
382
391
|
var f;
|
|
383
392
|
return l ? ((f = l.drivers) == null ? void 0 : f.some((g) => g.steamId === o)) ? l : { ...l, drivers: [...l.drivers || [], u] } : { drivers: [u] };
|
|
@@ -388,36 +397,36 @@ function xe(e) {
|
|
|
388
397
|
});
|
|
389
398
|
}
|
|
390
399
|
function ge(e) {
|
|
391
|
-
const { onWithdraw: t, partnerSlug:
|
|
400
|
+
const { onWithdraw: t, partnerSlug: r, getSteamId: s } = k(), a = _();
|
|
392
401
|
return O({
|
|
393
402
|
mutationFn: (i) => {
|
|
394
403
|
if (!t)
|
|
395
404
|
throw new Error(
|
|
396
405
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
397
406
|
);
|
|
398
|
-
const o = i ||
|
|
407
|
+
const o = i || s();
|
|
399
408
|
if (!o) throw new Error("No Steam ID available");
|
|
400
409
|
return t(e, o);
|
|
401
410
|
},
|
|
402
411
|
onSuccess: () => {
|
|
403
|
-
const i =
|
|
412
|
+
const i = s();
|
|
404
413
|
a.setQueriesData(
|
|
405
|
-
{ queryKey: ["pitvox", "registration",
|
|
414
|
+
{ queryKey: ["pitvox", "registration", r, e] },
|
|
406
415
|
(o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
407
416
|
), i && a.setQueriesData(
|
|
408
|
-
{ queryKey: ["pitvox", "competition",
|
|
417
|
+
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
409
418
|
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
|
|
410
419
|
);
|
|
411
420
|
}
|
|
412
421
|
});
|
|
413
422
|
}
|
|
414
423
|
function ee() {
|
|
415
|
-
const { onRegister: e, onWithdraw: t } = k(),
|
|
416
|
-
return { isPowerMode:
|
|
424
|
+
const { onRegister: e, onWithdraw: t } = k(), r = !!(e && t);
|
|
425
|
+
return { isPowerMode: r, isBasicMode: !r };
|
|
417
426
|
}
|
|
418
427
|
function ne(e) {
|
|
419
|
-
const { pitvoxUrl: t, partnerSlug:
|
|
420
|
-
return `${t}/p/${
|
|
428
|
+
const { pitvoxUrl: t, partnerSlug: r } = k();
|
|
429
|
+
return `${t}/p/${r}/competitions/${e}/register`;
|
|
421
430
|
}
|
|
422
431
|
const ze = {
|
|
423
432
|
formula: "Formula",
|
|
@@ -451,35 +460,35 @@ function Ge(e) {
|
|
|
451
460
|
}
|
|
452
461
|
function Ne(e, t) {
|
|
453
462
|
if (t.size === 0) return !0;
|
|
454
|
-
const
|
|
455
|
-
for (const
|
|
456
|
-
const a = Ge(
|
|
457
|
-
|
|
463
|
+
const r = {};
|
|
464
|
+
for (const s of t) {
|
|
465
|
+
const a = Ge(s);
|
|
466
|
+
r[a] || (r[a] = []), r[a].push(s);
|
|
458
467
|
}
|
|
459
|
-
for (const
|
|
460
|
-
if (!
|
|
468
|
+
for (const s of Object.values(r))
|
|
469
|
+
if (!s.some((a) => e.includes(a))) return !1;
|
|
461
470
|
return !0;
|
|
462
471
|
}
|
|
463
472
|
function be(e, t) {
|
|
464
|
-
const [
|
|
473
|
+
const [r, s] = D(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : r, o = H((u) => {
|
|
465
474
|
const l = new Set(i);
|
|
466
|
-
l.has(u) ? l.delete(u) : l.add(u), a && t ? t(l) :
|
|
475
|
+
l.has(u) ? l.delete(u) : l.add(u), a && t ? t(l) : s(l);
|
|
467
476
|
}, [i, a, t]), d = H(() => {
|
|
468
|
-
a && t ? t(/* @__PURE__ */ new Set()) :
|
|
477
|
+
a && t ? t(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
|
|
469
478
|
}, [a, t]);
|
|
470
479
|
return { activeTags: i, toggle: o, clear: d };
|
|
471
480
|
}
|
|
472
481
|
function W(e) {
|
|
473
|
-
const [t,
|
|
474
|
-
|
|
482
|
+
const [t, r] = D(e), s = H((a) => {
|
|
483
|
+
r(
|
|
475
484
|
(i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
476
485
|
);
|
|
477
486
|
}, []);
|
|
478
|
-
return [t,
|
|
487
|
+
return [t, s];
|
|
479
488
|
}
|
|
480
|
-
function z(e, t,
|
|
481
|
-
return [...e].sort((
|
|
482
|
-
const i = s
|
|
489
|
+
function z(e, t, r) {
|
|
490
|
+
return [...e].sort((s, a) => {
|
|
491
|
+
const i = r(s, t.key), o = r(a, t.key);
|
|
483
492
|
if (i == null && o == null) return 0;
|
|
484
493
|
if (i == null) return 1;
|
|
485
494
|
if (o == null) return -1;
|
|
@@ -488,47 +497,47 @@ function z(e, t, s) {
|
|
|
488
497
|
});
|
|
489
498
|
}
|
|
490
499
|
function ye(e, t = !1) {
|
|
491
|
-
const
|
|
492
|
-
return
|
|
493
|
-
s1: Math.min(...
|
|
494
|
-
s2: Math.min(...
|
|
495
|
-
s3: Math.min(...
|
|
500
|
+
const r = t ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
|
|
501
|
+
return r != null && r.length ? {
|
|
502
|
+
s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
|
|
503
|
+
s2: Math.min(...r.map((s) => s.sector2Ms).filter(Boolean)),
|
|
504
|
+
s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
|
|
496
505
|
} : null;
|
|
497
506
|
}
|
|
498
507
|
function Qe({ active: e, dir: t }) {
|
|
499
508
|
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" }) });
|
|
500
509
|
}
|
|
501
|
-
function M({ label: e, sortKey: t, config:
|
|
510
|
+
function M({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
|
|
502
511
|
return /* @__PURE__ */ n(
|
|
503
512
|
"th",
|
|
504
513
|
{
|
|
505
514
|
className: `pvx-th pvx-th--sortable ${a}`,
|
|
506
|
-
onClick: () =>
|
|
515
|
+
onClick: () => s(t),
|
|
507
516
|
children: /* @__PURE__ */ c("span", { className: "pvx-th-inner", children: [
|
|
508
517
|
e,
|
|
509
|
-
/* @__PURE__ */ n(Qe, { active:
|
|
518
|
+
/* @__PURE__ */ n(Qe, { active: r.key === t, dir: r.dir })
|
|
510
519
|
] })
|
|
511
520
|
}
|
|
512
521
|
);
|
|
513
522
|
}
|
|
514
523
|
function G({ userId: e, getUserDisplay: t }) {
|
|
515
|
-
const { displayName:
|
|
524
|
+
const { displayName: r, avatarUrl: s } = t(e);
|
|
516
525
|
return /* @__PURE__ */ c("span", { className: "pvx-driver", children: [
|
|
517
|
-
|
|
518
|
-
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children:
|
|
526
|
+
s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
527
|
+
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children: r })
|
|
519
528
|
] });
|
|
520
529
|
}
|
|
521
530
|
function te({ rank: e, podium: t = !1 }) {
|
|
522
531
|
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 });
|
|
523
532
|
}
|
|
524
|
-
function ke({ availableTags: e, activeTags: t, onToggle:
|
|
533
|
+
function ke({ availableTags: e, activeTags: t, onToggle: r, onClear: s }) {
|
|
525
534
|
if (!e || e.length < 2) return null;
|
|
526
535
|
const a = fe.map((i) => ({ id: i.id, tags: i.tags.filter((o) => e.includes(o)) })).filter((i) => i.tags.length > 0);
|
|
527
536
|
return /* @__PURE__ */ c("div", { className: "pvx-tag-bar", children: [
|
|
528
537
|
/* @__PURE__ */ n(
|
|
529
538
|
"button",
|
|
530
539
|
{
|
|
531
|
-
onClick:
|
|
540
|
+
onClick: s,
|
|
532
541
|
className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
|
|
533
542
|
children: "All"
|
|
534
543
|
}
|
|
@@ -538,7 +547,7 @@ function ke({ availableTags: e, activeTags: t, onToggle: s, onClear: r }) {
|
|
|
538
547
|
i.tags.map((d) => /* @__PURE__ */ n(
|
|
539
548
|
"button",
|
|
540
549
|
{
|
|
541
|
-
onClick: () =>
|
|
550
|
+
onClick: () => r(d),
|
|
542
551
|
className: `pvx-tag ${t.has(d) ? "pvx-tag--active" : ""}`,
|
|
543
552
|
children: ze[d] || d
|
|
544
553
|
},
|
|
@@ -548,11 +557,11 @@ function ke({ availableTags: e, activeTags: t, onToggle: s, onClear: r }) {
|
|
|
548
557
|
] });
|
|
549
558
|
}
|
|
550
559
|
function re({ segments: e }) {
|
|
551
|
-
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t,
|
|
552
|
-
const
|
|
560
|
+
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, r) => {
|
|
561
|
+
const s = r === e.length - 1;
|
|
553
562
|
return /* @__PURE__ */ c("li", { className: "pvx-breadcrumb-item", children: [
|
|
554
|
-
|
|
555
|
-
!
|
|
563
|
+
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" }) }),
|
|
564
|
+
!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 })
|
|
556
565
|
] }, t.key);
|
|
557
566
|
}) }) });
|
|
558
567
|
}
|
|
@@ -571,15 +580,15 @@ function Ye() {
|
|
|
571
580
|
function Je() {
|
|
572
581
|
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" }) });
|
|
573
582
|
}
|
|
574
|
-
function
|
|
583
|
+
function it({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
575
584
|
const [d, u] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle: p, clear: f } = be(i, o), g = L(() => {
|
|
576
585
|
var v;
|
|
577
|
-
if (!((v =
|
|
586
|
+
if (!((v = r == null ? void 0 : r.tags) != null && v.length)) return [];
|
|
578
587
|
const x = /* @__PURE__ */ new Set();
|
|
579
588
|
for (const N of e || [])
|
|
580
589
|
N.recordByTag && Object.keys(N.recordByTag).forEach((h) => x.add(h));
|
|
581
|
-
return
|
|
582
|
-
}, [e,
|
|
590
|
+
return r.tags.filter((N) => x.has(N));
|
|
591
|
+
}, [e, r]), m = L(() => e ? l.size === 0 ? e : e.map((x) => {
|
|
583
592
|
var h, y;
|
|
584
593
|
if (!x.recordByTag) return null;
|
|
585
594
|
let v = null;
|
|
@@ -587,7 +596,7 @@ function rt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
587
596
|
for (const C of Object.values(x.recordByTag)) {
|
|
588
597
|
if (N.has(C.carId)) continue;
|
|
589
598
|
N.add(C.carId);
|
|
590
|
-
const w = ((y = (h =
|
|
599
|
+
const w = ((y = (h = r == null ? void 0 : r.cars) == null ? void 0 : h[C.carId]) == null ? void 0 : y.tags) || ["sports_car"];
|
|
591
600
|
Ne(w, l) && (!v || C.lapTimeMs < v.lapTimeMs) && (v = C);
|
|
592
601
|
}
|
|
593
602
|
return v ? {
|
|
@@ -600,7 +609,7 @@ function rt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
600
609
|
timestamp: v.recordedAt
|
|
601
610
|
}
|
|
602
611
|
} : null;
|
|
603
|
-
}).filter(Boolean) : [], [e, l,
|
|
612
|
+
}).filter(Boolean) : [], [e, l, r]), b = L(() => z(m, d, (x, v) => {
|
|
604
613
|
var N, h;
|
|
605
614
|
switch (v) {
|
|
606
615
|
case "displayName":
|
|
@@ -638,7 +647,7 @@ function rt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
638
647
|
onClick: () => a(x.id, x.layout),
|
|
639
648
|
children: [
|
|
640
649
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
641
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: (v = x.record) != null && v.visibleId ? /* @__PURE__ */ n(G, { userId: x.record.visibleId, getUserDisplay:
|
|
650
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (v = x.record) != null && v.visibleId ? /* @__PURE__ */ n(G, { userId: x.record.visibleId, getUserDisplay: s }) : "-" }),
|
|
642
651
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
|
|
643
652
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? A(x.record.lapTimeMs) : "-" }),
|
|
644
653
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
@@ -652,19 +661,19 @@ function rt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
652
661
|
] }) })
|
|
653
662
|
] }) : /* @__PURE__ */ n(V, { message: "No lap times recorded yet." });
|
|
654
663
|
}
|
|
655
|
-
function
|
|
664
|
+
function ot({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: u }) {
|
|
656
665
|
const [l, p] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: f, toggle: g, clear: m } = be(d, u), b = L(() => {
|
|
657
666
|
var y, C, w;
|
|
658
|
-
if (!e || !((y =
|
|
667
|
+
if (!e || !((y = s == null ? void 0 : s.tags) != null && y.length)) return [];
|
|
659
668
|
const h = /* @__PURE__ */ new Set();
|
|
660
669
|
for (const T of e)
|
|
661
|
-
(((w = (C =
|
|
662
|
-
return
|
|
663
|
-
}, [e,
|
|
670
|
+
(((w = (C = s.cars) == null ? void 0 : C[T.carId]) == null ? void 0 : w.tags) || ["sports_car"]).forEach((F) => h.add(F));
|
|
671
|
+
return s.tags.filter((T) => h.has(T));
|
|
672
|
+
}, [e, s]), x = L(() => e ? f.size === 0 ? e : e.filter((h) => {
|
|
664
673
|
var C, w;
|
|
665
|
-
const y = ((w = (C =
|
|
674
|
+
const y = ((w = (C = s == null ? void 0 : s.cars) == null ? void 0 : C[h.carId]) == null ? void 0 : w.tags) || ["sports_car"];
|
|
666
675
|
return Ne(y, f);
|
|
667
|
-
}) : [], [e, f,
|
|
676
|
+
}) : [], [e, f, s]), v = L(() => z(x, l, (h, y) => {
|
|
668
677
|
switch (y) {
|
|
669
678
|
case "carId":
|
|
670
679
|
return I(h.carId);
|
|
@@ -676,7 +685,7 @@ function st({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay
|
|
|
676
685
|
}
|
|
677
686
|
}), [x, l]), N = [
|
|
678
687
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
679
|
-
{ key: "track", label:
|
|
688
|
+
{ key: "track", label: r.displayName }
|
|
680
689
|
];
|
|
681
690
|
return t ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
682
691
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(re, { segments: N }) }),
|
|
@@ -709,7 +718,7 @@ function st({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay
|
|
|
709
718
|
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this track yet." })
|
|
710
719
|
] });
|
|
711
720
|
}
|
|
712
|
-
function
|
|
721
|
+
function ct({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
713
722
|
const [u, l] = W({ key: "lapTimeMs", dir: "asc" }), p = L(() => ye(e), [e]), f = L(() => z(e || [], u, (m, b) => {
|
|
714
723
|
switch (b) {
|
|
715
724
|
case "userId":
|
|
@@ -722,8 +731,8 @@ function at({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, o
|
|
|
722
731
|
}
|
|
723
732
|
}), [e, u, a]), g = [
|
|
724
733
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
725
|
-
{ key: "track", label:
|
|
726
|
-
{ key: "car", label: I(
|
|
734
|
+
{ key: "track", label: r.displayName, onClick: () => o("track") },
|
|
735
|
+
{ key: "car", label: I(s) }
|
|
727
736
|
];
|
|
728
737
|
return t ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
729
738
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(re, { segments: g }) }),
|
|
@@ -766,14 +775,14 @@ function at({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, o
|
|
|
766
775
|
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this car yet." })
|
|
767
776
|
] });
|
|
768
777
|
}
|
|
769
|
-
function
|
|
770
|
-
const { data: l, driverName: p, theoreticalBest: f, isLoading: g } = Ke(e, t.id, t.layout,
|
|
778
|
+
function lt({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: u }) {
|
|
779
|
+
const { data: l, driverName: p, theoreticalBest: f, isLoading: g } = Ke(e, t.id, t.layout, r, { showInvalid: i, game: s, gameVersion: a }), { displayName: m, avatarUrl: b } = o(e, p), x = L(() => ye(l, !0), [l]), v = L(() => {
|
|
771
780
|
const h = (l == null ? void 0 : l.filter((y) => y.isValid)) || [];
|
|
772
781
|
return h.length ? Math.min(...h.map((y) => y.lapTimeMs)) : null;
|
|
773
782
|
}, [l]), N = [
|
|
774
783
|
{ key: "tracks", label: "Tracks", onClick: () => u("tracks") },
|
|
775
784
|
{ key: "track", label: t.displayName, onClick: () => u("track") },
|
|
776
|
-
{ key: "car", label: I(
|
|
785
|
+
{ key: "car", label: I(r), onClick: () => u("car") },
|
|
777
786
|
{ key: "driver", label: m }
|
|
778
787
|
];
|
|
779
788
|
return g ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
@@ -840,7 +849,7 @@ function it({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvali
|
|
|
840
849
|
] }) }) : /* @__PURE__ */ n(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
841
850
|
] });
|
|
842
851
|
}
|
|
843
|
-
function
|
|
852
|
+
function dt({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion: a, onComboSelect: i }) {
|
|
844
853
|
const [o, d] = W({ key: "rank", dir: "asc" }), [u, l] = D(null), p = L(() => e ? z(e, o, (g, m) => {
|
|
845
854
|
switch (m) {
|
|
846
855
|
case "rating":
|
|
@@ -888,11 +897,11 @@ function ot({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
888
897
|
Ze,
|
|
889
898
|
{
|
|
890
899
|
driver: g,
|
|
891
|
-
getUserDisplay:
|
|
900
|
+
getUserDisplay: r,
|
|
892
901
|
isExpanded: m,
|
|
893
902
|
onToggle: () => l(m ? null : g.identifier),
|
|
894
903
|
colCount: f,
|
|
895
|
-
game:
|
|
904
|
+
game: s,
|
|
896
905
|
gameVersion: a,
|
|
897
906
|
onComboSelect: i
|
|
898
907
|
},
|
|
@@ -902,14 +911,14 @@ function ot({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
902
911
|
] }) })
|
|
903
912
|
] });
|
|
904
913
|
}
|
|
905
|
-
function Ze({ driver: e, getUserDisplay: t, isExpanded:
|
|
914
|
+
function Ze({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
|
|
906
915
|
const u = e.identifier;
|
|
907
916
|
return /* @__PURE__ */ c(U, { children: [
|
|
908
917
|
/* @__PURE__ */ c(
|
|
909
918
|
"tr",
|
|
910
919
|
{
|
|
911
920
|
className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
912
|
-
onClick:
|
|
921
|
+
onClick: s,
|
|
913
922
|
children: [
|
|
914
923
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(te, { rank: e.rank, podium: !0 }) }),
|
|
915
924
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(G, { userId: u, getUserDisplay: t }) }),
|
|
@@ -917,12 +926,12 @@ function Ze({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
917
926
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
918
927
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ c("span", { className: "pvx-rankings-combo-count", children: [
|
|
919
928
|
e.comboCount,
|
|
920
|
-
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${
|
|
929
|
+
/* @__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" }) })
|
|
921
930
|
] }) })
|
|
922
931
|
]
|
|
923
932
|
}
|
|
924
933
|
),
|
|
925
|
-
|
|
934
|
+
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((l, p) => {
|
|
926
935
|
const f = l.layout ? `${l.trackId}|${l.layout}` : l.trackId, g = d ? () => d({ track: f, car: l.carId, highlight: u, game: i, gameVersion: o }) : void 0;
|
|
927
936
|
return /* @__PURE__ */ c(
|
|
928
937
|
"div",
|
|
@@ -991,7 +1000,17 @@ const Xe = {
|
|
|
991
1000
|
championship: "Championship",
|
|
992
1001
|
series: "Series",
|
|
993
1002
|
event: "Event"
|
|
994
|
-
},
|
|
1003
|
+
}, nn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1004
|
+
function oe(e) {
|
|
1005
|
+
const t = nn.indexOf(e);
|
|
1006
|
+
if (t >= 0) return t;
|
|
1007
|
+
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
1008
|
+
return r ? 100 + parseInt(r[1]) : 999;
|
|
1009
|
+
}
|
|
1010
|
+
function tn(e) {
|
|
1011
|
+
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1012
|
+
return t ? `P${t[1]}` : e;
|
|
1013
|
+
}
|
|
995
1014
|
function we({ position: e }) {
|
|
996
1015
|
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 });
|
|
997
1016
|
}
|
|
@@ -999,41 +1018,41 @@ function ae({ nation: e }) {
|
|
|
999
1018
|
const t = e && Xe[e];
|
|
1000
1019
|
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
1001
1020
|
}
|
|
1002
|
-
function
|
|
1021
|
+
function rn({ sessions: e, activeSession: t, onSelect: r }) {
|
|
1003
1022
|
if (!e || e.length <= 1) return null;
|
|
1004
|
-
const
|
|
1005
|
-
(a, i) => oe
|
|
1023
|
+
const s = [...e].sort(
|
|
1024
|
+
(a, i) => oe(a.type) - oe(i.type)
|
|
1006
1025
|
);
|
|
1007
|
-
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children:
|
|
1026
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
1008
1027
|
"button",
|
|
1009
1028
|
{
|
|
1010
|
-
onClick: () =>
|
|
1029
|
+
onClick: () => r(a.type),
|
|
1011
1030
|
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1012
|
-
children: a.type
|
|
1031
|
+
children: tn(a.type)
|
|
1013
1032
|
},
|
|
1014
1033
|
a.type
|
|
1015
1034
|
)) });
|
|
1016
1035
|
}
|
|
1017
|
-
function
|
|
1036
|
+
function sn({ type: e }) {
|
|
1018
1037
|
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: en[e] || e });
|
|
1019
1038
|
}
|
|
1020
1039
|
function Y({ children: e, variant: t = "default" }) {
|
|
1021
1040
|
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1022
1041
|
}
|
|
1023
|
-
function
|
|
1042
|
+
function an(e) {
|
|
1024
1043
|
if (!e) return "TBD";
|
|
1025
1044
|
const t = new Date(e);
|
|
1026
1045
|
if (isNaN(t)) return "TBD";
|
|
1027
|
-
const
|
|
1028
|
-
return `${
|
|
1029
|
-
}
|
|
1030
|
-
function
|
|
1031
|
-
return e.reduce((t,
|
|
1032
|
-
var
|
|
1033
|
-
return (
|
|
1034
|
-
const o =
|
|
1046
|
+
const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1047
|
+
return `${r} • ${s}`;
|
|
1048
|
+
}
|
|
1049
|
+
function on(e) {
|
|
1050
|
+
return e.reduce((t, r) => {
|
|
1051
|
+
var s;
|
|
1052
|
+
return (s = r.splits) != null && s.length ? t ? t.map((a, i) => {
|
|
1053
|
+
const o = r.splits[i];
|
|
1035
1054
|
return o && o < a ? o : a;
|
|
1036
|
-
}) : [...
|
|
1055
|
+
}) : [...r.splits] : t;
|
|
1037
1056
|
}, null);
|
|
1038
1057
|
}
|
|
1039
1058
|
function E({ message: e = "Loading..." }) {
|
|
@@ -1043,41 +1062,41 @@ function P({ message: e = "No data available." }) {
|
|
|
1043
1062
|
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1044
1063
|
}
|
|
1045
1064
|
const Ce = 3;
|
|
1046
|
-
function
|
|
1065
|
+
function cn(e) {
|
|
1047
1066
|
const t = e == null ? void 0 : e.rounds;
|
|
1048
|
-
return t != null && t.length ? t.every((
|
|
1067
|
+
return t != null && t.length ? t.every((r) => r.isFinalized) : !1;
|
|
1049
1068
|
}
|
|
1050
|
-
function
|
|
1069
|
+
function ln(e) {
|
|
1051
1070
|
const t = e == null ? void 0 : e.rounds;
|
|
1052
1071
|
if (!(t != null && t.length)) return null;
|
|
1053
|
-
let
|
|
1054
|
-
for (const
|
|
1055
|
-
if (!
|
|
1056
|
-
const a = new Date(
|
|
1057
|
-
isNaN(a) || (!
|
|
1072
|
+
let r = null;
|
|
1073
|
+
for (const s of t) {
|
|
1074
|
+
if (!s.startTime) continue;
|
|
1075
|
+
const a = new Date(s.startTime);
|
|
1076
|
+
isNaN(a) || (!r || a > r) && (r = a);
|
|
1058
1077
|
}
|
|
1059
|
-
return
|
|
1078
|
+
return r;
|
|
1060
1079
|
}
|
|
1061
1080
|
function Le(e, t = Ce) {
|
|
1062
|
-
if (!
|
|
1063
|
-
const
|
|
1064
|
-
if (!
|
|
1065
|
-
const
|
|
1066
|
-
return Date.now() -
|
|
1081
|
+
if (!cn(e)) return "active";
|
|
1082
|
+
const r = ln(e);
|
|
1083
|
+
if (!r) return "recently-completed";
|
|
1084
|
+
const s = t * 24 * 60 * 60 * 1e3;
|
|
1085
|
+
return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
|
|
1067
1086
|
}
|
|
1068
|
-
function
|
|
1087
|
+
function pt(e, t, r = Ce) {
|
|
1069
1088
|
if (!(e != null && e.length)) return [];
|
|
1070
|
-
const
|
|
1071
|
-
return e.filter((a) =>
|
|
1089
|
+
const s = new Set(Array.isArray(t) ? t : [t]);
|
|
1090
|
+
return e.filter((a) => s.has(Le(a, r)));
|
|
1072
1091
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const
|
|
1075
|
-
return Array.isArray(
|
|
1092
|
+
function dn(e, t = 3) {
|
|
1093
|
+
const r = e == null ? void 0 : e.standings;
|
|
1094
|
+
return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1076
1095
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const { data: a } = ve(e), i =
|
|
1079
|
-
return /* @__PURE__ */ c("div", { className: `pvx-comp-completed-badge ${
|
|
1080
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children:
|
|
1096
|
+
function pn({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
|
|
1097
|
+
const { data: a } = ve(e), i = dn(a, t);
|
|
1098
|
+
return /* @__PURE__ */ c("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
|
|
1099
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
|
|
1081
1100
|
i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ c("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1082
1101
|
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: se[d] || "" }),
|
|
1083
1102
|
/* @__PURE__ */ n(ae, { nation: o.nation }),
|
|
@@ -1085,12 +1104,12 @@ function ln({ competitionId: e, topN: t = 3, label: s = "Completed", className:
|
|
|
1085
1104
|
] }, o.driverId || d)) })
|
|
1086
1105
|
] });
|
|
1087
1106
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return t ? /* @__PURE__ */ n(E, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(
|
|
1107
|
+
function ut({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
|
|
1108
|
+
return t ? /* @__PURE__ */ n(E, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(un, { comp: i, onSelect: r, onRegister: s || r }, i.id)) }) : /* @__PURE__ */ n(P, { message: "No competitions available." });
|
|
1090
1109
|
}
|
|
1091
|
-
function
|
|
1110
|
+
function un({ comp: e, onSelect: t, onRegister: r }) {
|
|
1092
1111
|
var h, y, C;
|
|
1093
|
-
const { cdnUrl:
|
|
1112
|
+
const { cdnUrl: s } = k(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, u = d && o >= d, l = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), p = (i == null ? void 0 : i.isOpen) && !l && !u, f = /* @__PURE__ */ new Date(), g = (h = e.rounds) == null ? void 0 : h.find((w) => w.startTime && new Date(w.startTime) >= f), m = ((y = e.rounds) == null ? void 0 : y.length) || 0, b = ((C = e.rounds) == null ? void 0 : C.filter((w) => w.isFinalized).length) || 0, x = Le(e), v = x === "recently-completed" || x === "archived", N = e.type === "championship";
|
|
1094
1113
|
return /* @__PURE__ */ c(
|
|
1095
1114
|
"div",
|
|
1096
1115
|
{
|
|
@@ -1102,12 +1121,12 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1102
1121
|
(w.key === "Enter" || w.key === " ") && (w.preventDefault(), t(e.id));
|
|
1103
1122
|
},
|
|
1104
1123
|
children: [
|
|
1105
|
-
/* @__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(
|
|
1124
|
+
/* @__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(vn, {}) }) }),
|
|
1106
1125
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-body", children: [
|
|
1107
1126
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1108
1127
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1109
1128
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
|
|
1110
|
-
/* @__PURE__ */ n(
|
|
1129
|
+
/* @__PURE__ */ n(sn, { type: e.type }),
|
|
1111
1130
|
e.game && /* @__PURE__ */ n(Y, { children: e.game.toUpperCase() }),
|
|
1112
1131
|
e.formatDescription && e.formatDescription.split(", ").map((w, T) => /* @__PURE__ */ n(Y, { variant: "format", children: w }, T))
|
|
1113
1132
|
] }),
|
|
@@ -1121,7 +1140,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1121
1140
|
" ",
|
|
1122
1141
|
g.track || "TBD",
|
|
1123
1142
|
" — ",
|
|
1124
|
-
|
|
1143
|
+
an(g.startTime)
|
|
1125
1144
|
] }) : m > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1126
1145
|
b,
|
|
1127
1146
|
"/",
|
|
@@ -1134,9 +1153,9 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1134
1153
|
m !== 1 ? "s" : ""
|
|
1135
1154
|
] })
|
|
1136
1155
|
] }),
|
|
1137
|
-
v && N && /* @__PURE__ */ n(
|
|
1156
|
+
v && N && /* @__PURE__ */ n(pn, { competitionId: e.id }),
|
|
1138
1157
|
i && !v && /* @__PURE__ */ n(
|
|
1139
|
-
|
|
1158
|
+
mn,
|
|
1140
1159
|
{
|
|
1141
1160
|
competitionId: e.id,
|
|
1142
1161
|
regOpen: p,
|
|
@@ -1144,7 +1163,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1144
1163
|
deadlinePassed: l,
|
|
1145
1164
|
regCount: o,
|
|
1146
1165
|
regMax: d,
|
|
1147
|
-
onRegister:
|
|
1166
|
+
onRegister: r
|
|
1148
1167
|
}
|
|
1149
1168
|
)
|
|
1150
1169
|
] })
|
|
@@ -1152,7 +1171,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1152
1171
|
}
|
|
1153
1172
|
);
|
|
1154
1173
|
}
|
|
1155
|
-
function
|
|
1174
|
+
function mn({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
|
|
1156
1175
|
const { isPowerMode: d } = ee(), u = ne(e), { data: l } = X(e), p = (l == null ? void 0 : l.isRegistered) || !1, f = i ? a / i * 100 : 0, g = f >= 100 ? "full" : f >= 75 ? "warning" : "ok";
|
|
1157
1176
|
return /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
|
|
1158
1177
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${g}`, children: [
|
|
@@ -1189,10 +1208,10 @@ function pn({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1189
1208
|
onClick: (m) => m.stopPropagation(),
|
|
1190
1209
|
children: "Register"
|
|
1191
1210
|
}
|
|
1192
|
-
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children:
|
|
1211
|
+
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
|
|
1193
1212
|
] });
|
|
1194
1213
|
}
|
|
1195
|
-
function
|
|
1214
|
+
function vn() {
|
|
1196
1215
|
return /* @__PURE__ */ c("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1197
1216
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1198
1217
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1202,12 +1221,12 @@ function un() {
|
|
|
1202
1221
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1203
1222
|
] });
|
|
1204
1223
|
}
|
|
1205
|
-
function
|
|
1224
|
+
function hn({ competitionId: e, className: t }) {
|
|
1206
1225
|
var d, u;
|
|
1207
|
-
const { data:
|
|
1208
|
-
if (
|
|
1226
|
+
const { data: r, isLoading: s } = ve(e), { data: a, isLoading: i } = me(e);
|
|
1227
|
+
if (s || i)
|
|
1209
1228
|
return /* @__PURE__ */ n(E, { message: "Loading standings..." });
|
|
1210
|
-
if (!((d =
|
|
1229
|
+
if (!((d = r == null ? void 0 : r.standings) != null && d.length))
|
|
1211
1230
|
return /* @__PURE__ */ n(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1212
1231
|
const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((l) => l.isFinalized)) || [];
|
|
1213
1232
|
return /* @__PURE__ */ c("div", { className: `pvx-card ${t || ""}`, children: [
|
|
@@ -1215,10 +1234,10 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1215
1234
|
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
1216
1235
|
/* @__PURE__ */ c("span", { className: "pvx-standings-subtitle", children: [
|
|
1217
1236
|
"After ",
|
|
1218
|
-
|
|
1237
|
+
r.roundsCompleted,
|
|
1219
1238
|
" round",
|
|
1220
|
-
|
|
1221
|
-
|
|
1239
|
+
r.roundsCompleted !== 1 ? "s" : "",
|
|
1240
|
+
r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
|
|
1222
1241
|
] })
|
|
1223
1242
|
] }) }),
|
|
1224
1243
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
@@ -1241,8 +1260,8 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1241
1260
|
l.roundNumber
|
|
1242
1261
|
))
|
|
1243
1262
|
] }) }),
|
|
1244
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1245
|
-
|
|
1263
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((l) => /* @__PURE__ */ n(
|
|
1264
|
+
xn,
|
|
1246
1265
|
{
|
|
1247
1266
|
driver: l,
|
|
1248
1267
|
finalizedRounds: o
|
|
@@ -1252,12 +1271,12 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1252
1271
|
] }) })
|
|
1253
1272
|
] });
|
|
1254
1273
|
}
|
|
1255
|
-
function
|
|
1274
|
+
function xn({ driver: e, finalizedRounds: t }) {
|
|
1256
1275
|
var o, d, u;
|
|
1257
|
-
const
|
|
1276
|
+
const r = e.position <= 3, s = new Map(
|
|
1258
1277
|
((o = e.roundResults) == null ? void 0 : o.map((l) => [l.roundNumber, l])) || []
|
|
1259
1278
|
), a = ((d = e.roundResults) == null ? void 0 : d.filter((l) => l.position === 1).length) || 0, i = ((u = e.roundResults) == null ? void 0 : u.filter((l) => l.position <= 3).length) || 0;
|
|
1260
|
-
return /* @__PURE__ */ c("tr", { className: `pvx-row ${
|
|
1279
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
|
|
1261
1280
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(we, { position: e.position }) }),
|
|
1262
1281
|
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1263
1282
|
/* @__PURE__ */ n(ae, { nation: e.nation }),
|
|
@@ -1267,7 +1286,7 @@ function vn({ driver: e, finalizedRounds: t }) {
|
|
|
1267
1286
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1268
1287
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1269
1288
|
t.map((l) => {
|
|
1270
|
-
const p =
|
|
1289
|
+
const p = s.get(l.roundNumber), f = p == null ? void 0 : p.dropped;
|
|
1271
1290
|
return /* @__PURE__ */ n(
|
|
1272
1291
|
"td",
|
|
1273
1292
|
{
|
|
@@ -1285,23 +1304,23 @@ function vn({ driver: e, finalizedRounds: t }) {
|
|
|
1285
1304
|
})
|
|
1286
1305
|
] });
|
|
1287
1306
|
}
|
|
1288
|
-
function
|
|
1307
|
+
function mt({ competitionId: e, roundNumber: t, className: r }) {
|
|
1289
1308
|
var u;
|
|
1290
|
-
const { data:
|
|
1309
|
+
const { data: s, isLoading: a } = He(e, t);
|
|
1291
1310
|
if (a)
|
|
1292
1311
|
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1293
|
-
if (!
|
|
1312
|
+
if (!s)
|
|
1294
1313
|
return /* @__PURE__ */ n(P, { message: "No results for this round." });
|
|
1295
|
-
const o = (
|
|
1296
|
-
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${
|
|
1314
|
+
const o = (s.sessions || []).find((l) => l.type === "RACE"), d = (u = o == null ? void 0 : o.results) == null ? void 0 : u.filter((l) => l.position <= 3).sort((l, p) => l.position - p.position);
|
|
1315
|
+
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${r || ""}`, children: [
|
|
1297
1316
|
/* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
|
|
1298
1317
|
/* @__PURE__ */ c("div", { children: [
|
|
1299
1318
|
/* @__PURE__ */ c("h4", { className: "pvx-round-results-title", children: [
|
|
1300
1319
|
"Round ",
|
|
1301
|
-
|
|
1302
|
-
|
|
1320
|
+
s.roundNumber,
|
|
1321
|
+
s.track ? `: ${s.track}` : ""
|
|
1303
1322
|
] }),
|
|
1304
|
-
|
|
1323
|
+
s.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
|
|
1305
1324
|
day: "numeric",
|
|
1306
1325
|
month: "long",
|
|
1307
1326
|
year: "numeric"
|
|
@@ -1312,44 +1331,44 @@ function dt({ competitionId: e, roundNumber: t, className: s }) {
|
|
|
1312
1331
|
/* @__PURE__ */ n("span", { children: l.driverName })
|
|
1313
1332
|
] }, l.driverId)) })
|
|
1314
1333
|
] }),
|
|
1315
|
-
/* @__PURE__ */ n(Te, { round:
|
|
1334
|
+
/* @__PURE__ */ n(Te, { round: s, competitionId: e })
|
|
1316
1335
|
] });
|
|
1317
1336
|
}
|
|
1318
|
-
function Te({ round: e, competitionId: t, className:
|
|
1337
|
+
function Te({ round: e, competitionId: t, className: r }) {
|
|
1319
1338
|
var p, f, g, m;
|
|
1320
|
-
const [
|
|
1339
|
+
const [s, a] = D(null), i = (e == null ? void 0 : e.sessions) || [];
|
|
1321
1340
|
if (!i.length)
|
|
1322
1341
|
return /* @__PURE__ */ n(P, { message: "No session data for this round." });
|
|
1323
1342
|
const { data: o } = We(
|
|
1324
1343
|
t,
|
|
1325
1344
|
e == null ? void 0 : e.roundNumber,
|
|
1326
1345
|
{}
|
|
1327
|
-
), d =
|
|
1328
|
-
return /* @__PURE__ */ c("div", { className:
|
|
1346
|
+
), d = s || ((p = i.find((b) => b.type === "RACE")) == null ? void 0 : p.type) || ((f = i[0]) == null ? void 0 : f.type), u = i.find((b) => b.type === d) || i[0], l = ((m = (g = o == null ? void 0 : o.sessions) == null ? void 0 : g.find((b) => b.type === d)) == null ? void 0 : m.drivers) || null;
|
|
1347
|
+
return /* @__PURE__ */ c("div", { className: r || "", children: [
|
|
1329
1348
|
/* @__PURE__ */ n(
|
|
1330
|
-
|
|
1349
|
+
rn,
|
|
1331
1350
|
{
|
|
1332
1351
|
sessions: i,
|
|
1333
1352
|
activeSession: d,
|
|
1334
1353
|
onSelect: a
|
|
1335
1354
|
}
|
|
1336
1355
|
),
|
|
1337
|
-
/* @__PURE__ */ n(
|
|
1356
|
+
/* @__PURE__ */ n(gn, { session: u, sessionLaps: l })
|
|
1338
1357
|
] });
|
|
1339
1358
|
}
|
|
1340
|
-
function
|
|
1359
|
+
function gn({ session: e, sessionLaps: t }) {
|
|
1341
1360
|
var d;
|
|
1342
|
-
const
|
|
1361
|
+
const r = e.type === "RACE", [s, a] = D(null);
|
|
1343
1362
|
if (!((d = e.results) != null && d.length))
|
|
1344
1363
|
return /* @__PURE__ */ n(P, { message: `No results for ${e.type}.` });
|
|
1345
|
-
const i =
|
|
1364
|
+
const i = on(e.results), o = r ? 7 : 4;
|
|
1346
1365
|
return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
1347
1366
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1348
1367
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1349
1368
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1350
1369
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1351
1370
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1352
|
-
|
|
1371
|
+
r && /* @__PURE__ */ c(U, { children: [
|
|
1353
1372
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1354
1373
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1355
1374
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
@@ -1357,12 +1376,12 @@ function hn({ session: e, sessionLaps: t }) {
|
|
|
1357
1376
|
] }) }),
|
|
1358
1377
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((u, l) => {
|
|
1359
1378
|
var g;
|
|
1360
|
-
const p = (g = t == null ? void 0 : t[u.driverId]) == null ? void 0 : g.laps, f =
|
|
1379
|
+
const p = (g = t == null ? void 0 : t[u.driverId]) == null ? void 0 : g.laps, f = s === u.driverId && !!p;
|
|
1361
1380
|
return /* @__PURE__ */ n(
|
|
1362
|
-
|
|
1381
|
+
fn,
|
|
1363
1382
|
{
|
|
1364
1383
|
result: u,
|
|
1365
|
-
isRace:
|
|
1384
|
+
isRace: r,
|
|
1366
1385
|
fastestSplits: i,
|
|
1367
1386
|
rowIndex: l,
|
|
1368
1387
|
hasLapDetail: !!p,
|
|
@@ -1376,7 +1395,7 @@ function hn({ session: e, sessionLaps: t }) {
|
|
|
1376
1395
|
}) })
|
|
1377
1396
|
] }) });
|
|
1378
1397
|
}
|
|
1379
|
-
function
|
|
1398
|
+
function fn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: u }) {
|
|
1380
1399
|
const l = e.position <= 3;
|
|
1381
1400
|
return /* @__PURE__ */ c(U, { children: [
|
|
1382
1401
|
/* @__PURE__ */ c(
|
|
@@ -1398,13 +1417,13 @@ function xn({ result: e, isRace: t, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1398
1417
|
] }),
|
|
1399
1418
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1400
1419
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1401
|
-
|
|
1420
|
+
bn,
|
|
1402
1421
|
{
|
|
1403
1422
|
bestLap: e.bestLapFormatted,
|
|
1404
1423
|
hasBestLap: e.hasBestLap,
|
|
1405
1424
|
splits: e.splits,
|
|
1406
|
-
fastestSplits:
|
|
1407
|
-
showAbove:
|
|
1425
|
+
fastestSplits: r,
|
|
1426
|
+
showAbove: s <= 1
|
|
1408
1427
|
}
|
|
1409
1428
|
) }),
|
|
1410
1429
|
t && /* @__PURE__ */ c(U, { children: [
|
|
@@ -1423,11 +1442,11 @@ function xn({ result: e, isRace: t, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1423
1442
|
]
|
|
1424
1443
|
}
|
|
1425
1444
|
),
|
|
1426
|
-
i && d && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: u, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(
|
|
1445
|
+
i && d && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: u, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(Nn, { laps: d }) }) })
|
|
1427
1446
|
] });
|
|
1428
1447
|
}
|
|
1429
|
-
function
|
|
1430
|
-
const t = Math.min(...e.filter((
|
|
1448
|
+
function Nn({ laps: e }) {
|
|
1449
|
+
const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
|
|
1431
1450
|
return /* @__PURE__ */ c("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1432
1451
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1433
1452
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
@@ -1436,23 +1455,23 @@ function gn({ laps: e }) {
|
|
|
1436
1455
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1437
1456
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1438
1457
|
] }) }),
|
|
1439
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((
|
|
1458
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((r) => {
|
|
1440
1459
|
var a;
|
|
1441
|
-
const
|
|
1442
|
-
return /* @__PURE__ */ c("tr", { className: `pvx-row ${
|
|
1443
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children:
|
|
1444
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children:
|
|
1445
|
-
(
|
|
1446
|
-
Array.from({ length: Math.max(0, 3 - (((a =
|
|
1447
|
-
] },
|
|
1460
|
+
const s = r.valid && r.timeMs === t;
|
|
1461
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
|
|
1462
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
|
|
1463
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
|
|
1464
|
+
(r.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
|
|
1465
|
+
Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
|
|
1466
|
+
] }, r.lap);
|
|
1448
1467
|
}) })
|
|
1449
1468
|
] });
|
|
1450
1469
|
}
|
|
1451
|
-
function
|
|
1470
|
+
function bn({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
|
|
1452
1471
|
return e ? /* @__PURE__ */ c("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1453
1472
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1454
|
-
(
|
|
1455
|
-
const d =
|
|
1473
|
+
(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((i, o) => {
|
|
1474
|
+
const d = s && i === s[o];
|
|
1456
1475
|
return /* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1457
1476
|
/* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1458
1477
|
"S",
|
|
@@ -1463,11 +1482,11 @@ function fn({ bestLap: e, hasBestLap: t, splits: s, fastestSplits: r, showAbove:
|
|
|
1463
1482
|
}) }) })
|
|
1464
1483
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1465
1484
|
}
|
|
1466
|
-
function
|
|
1467
|
-
const { getSteamId:
|
|
1485
|
+
function vt({ competitionId: e, className: t }) {
|
|
1486
|
+
const { getSteamId: r } = k(), { data: s, isLoading: a } = he(e), i = r();
|
|
1468
1487
|
if (a)
|
|
1469
1488
|
return /* @__PURE__ */ n(E, { message: "Loading drivers..." });
|
|
1470
|
-
const o = (
|
|
1489
|
+
const o = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
|
|
1471
1490
|
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
|
|
1472
1491
|
var l, p;
|
|
1473
1492
|
const u = i && d.steamId === i;
|
|
@@ -1487,21 +1506,21 @@ function pt({ competitionId: e, className: t }) {
|
|
|
1487
1506
|
] }, d.steamId || d.driverId);
|
|
1488
1507
|
}) }) : /* @__PURE__ */ n(P, { message: "No drivers registered yet." });
|
|
1489
1508
|
}
|
|
1490
|
-
function
|
|
1509
|
+
function ht({
|
|
1491
1510
|
competitionId: e,
|
|
1492
1511
|
driverData: t,
|
|
1493
|
-
className:
|
|
1494
|
-
children:
|
|
1512
|
+
className: r,
|
|
1513
|
+
children: s
|
|
1495
1514
|
}) {
|
|
1496
1515
|
const { data: a, isLoading: i } = X(e), { isPowerMode: o } = ee(), d = ne(e), u = xe(e), l = ge(e), p = (a == null ? void 0 : a.isRegistered) || !1, f = i || u.isPending || l.isPending, g = u.error || l.error || null, m = () => {
|
|
1497
1516
|
o && u.mutate(t || {});
|
|
1498
1517
|
}, b = () => {
|
|
1499
1518
|
o && l.mutate();
|
|
1500
1519
|
};
|
|
1501
|
-
return typeof
|
|
1520
|
+
return typeof s == "function" ? s({ isRegistered: p, isLoading: f, register: m, withdraw: b, error: g, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
|
|
1502
1521
|
"button",
|
|
1503
1522
|
{
|
|
1504
|
-
className: `pvx-comp-register-btn ${
|
|
1523
|
+
className: `pvx-comp-register-btn ${r || ""}`,
|
|
1505
1524
|
onClick: p ? b : m,
|
|
1506
1525
|
disabled: f,
|
|
1507
1526
|
children: f ? "Loading..." : p ? "Withdraw" : "Register"
|
|
@@ -1512,15 +1531,15 @@ function ut({
|
|
|
1512
1531
|
href: d,
|
|
1513
1532
|
target: "_blank",
|
|
1514
1533
|
rel: "noopener noreferrer",
|
|
1515
|
-
className: `pvx-comp-register-link ${
|
|
1534
|
+
className: `pvx-comp-register-link ${r || ""}`,
|
|
1516
1535
|
children: p ? "View Registration" : "Register on PitVox"
|
|
1517
1536
|
}
|
|
1518
1537
|
);
|
|
1519
1538
|
}
|
|
1520
|
-
function
|
|
1539
|
+
function xt({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
|
|
1521
1540
|
const { getSteamId: a } = k(), { isPowerMode: i } = ee(), o = ne(e), { data: d, isLoading: u } = X(e), { data: l, isLoading: p } = he(e), f = xe(e), g = ge(e), m = a(), b = (d == null ? void 0 : d.isRegistered) || !1, x = (l == null ? void 0 : l.drivers) || (l == null ? void 0 : l.entries) || [], v = t || {}, N = x.length || v.currentCount || 0, h = v.maxParticipants && N >= v.maxParticipants, y = v.deadline && new Date(v.deadline) < /* @__PURE__ */ new Date(), C = v.isOpen && !y && !h;
|
|
1522
|
-
return u || p ? /* @__PURE__ */ n(E, { message: "Loading registration..." }) : b ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1523
|
-
|
|
1541
|
+
return u || p ? /* @__PURE__ */ n(E, { message: "Loading registration..." }) : b ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1542
|
+
kn,
|
|
1524
1543
|
{
|
|
1525
1544
|
competitionId: e,
|
|
1526
1545
|
drivers: x,
|
|
@@ -1528,33 +1547,33 @@ function mt({ competitionId: e, registration: t, onWithdrawSuccess: s, className
|
|
|
1528
1547
|
isPowerMode: i,
|
|
1529
1548
|
registrationUrl: o,
|
|
1530
1549
|
withdrawMutation: g,
|
|
1531
|
-
onWithdrawSuccess:
|
|
1550
|
+
onWithdrawSuccess: r,
|
|
1532
1551
|
registration: v
|
|
1533
1552
|
}
|
|
1534
|
-
) }) : C ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1535
|
-
|
|
1553
|
+
) }) : C ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1554
|
+
yn,
|
|
1536
1555
|
{
|
|
1537
1556
|
competitionId: e,
|
|
1538
1557
|
registerMutation: f,
|
|
1539
1558
|
registration: v
|
|
1540
1559
|
}
|
|
1541
|
-
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1560
|
+
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: i ? /* @__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: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ c("div", { className: `pvx-reg-panel ${s || ""}`, children: [
|
|
1542
1561
|
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1543
|
-
x.length > 0 && /* @__PURE__ */ n(
|
|
1562
|
+
x.length > 0 && /* @__PURE__ */ n(Se, { drivers: x, steamId: m })
|
|
1544
1563
|
] });
|
|
1545
1564
|
}
|
|
1546
|
-
function
|
|
1547
|
-
const [
|
|
1565
|
+
function yn({ competitionId: e, registerMutation: t, registration: r }) {
|
|
1566
|
+
const [s, a] = D(""), [i, o] = D("intermediate"), [d, u] = D(""), l = (m) => {
|
|
1548
1567
|
m.preventDefault(), t.mutate({
|
|
1549
|
-
discordUsername:
|
|
1568
|
+
discordUsername: s || void 0,
|
|
1550
1569
|
experience: i,
|
|
1551
1570
|
comments: d || void 0
|
|
1552
1571
|
});
|
|
1553
|
-
}, p =
|
|
1572
|
+
}, p = r || {}, f = p.currentCount || 0, g = p.maxParticipants;
|
|
1554
1573
|
return /* @__PURE__ */ c("form", { className: "pvx-reg-form", onSubmit: l, children: [
|
|
1555
1574
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1556
1575
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1557
|
-
g && /* @__PURE__ */ n(
|
|
1576
|
+
g && /* @__PURE__ */ n(Re, { count: f, max: g })
|
|
1558
1577
|
] }),
|
|
1559
1578
|
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1560
1579
|
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
@@ -1569,7 +1588,7 @@ function Nn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1569
1588
|
type: "text",
|
|
1570
1589
|
className: "pvx-reg-input",
|
|
1571
1590
|
placeholder: "e.g. username",
|
|
1572
|
-
value:
|
|
1591
|
+
value: s,
|
|
1573
1592
|
onChange: (m) => a(m.target.value)
|
|
1574
1593
|
}
|
|
1575
1594
|
)
|
|
@@ -1619,7 +1638,7 @@ function Nn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1619
1638
|
) })
|
|
1620
1639
|
] });
|
|
1621
1640
|
}
|
|
1622
|
-
function
|
|
1641
|
+
function kn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1623
1642
|
const [u, l] = D(!1), p = () => {
|
|
1624
1643
|
i.mutate(void 0, {
|
|
1625
1644
|
onSuccess: () => {
|
|
@@ -1630,11 +1649,11 @@ function bn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1630
1649
|
return /* @__PURE__ */ c(U, { children: [
|
|
1631
1650
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1632
1651
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1633
|
-
m && /* @__PURE__ */ n(
|
|
1652
|
+
m && /* @__PURE__ */ n(Re, { count: g, max: m })
|
|
1634
1653
|
] }),
|
|
1635
|
-
/* @__PURE__ */ n(
|
|
1654
|
+
/* @__PURE__ */ n(Se, { drivers: t, steamId: r }),
|
|
1636
1655
|
i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1637
|
-
|
|
1656
|
+
s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ c("div", { className: "pvx-reg-confirm", children: [
|
|
1638
1657
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1639
1658
|
/* @__PURE__ */ c("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1640
1659
|
/* @__PURE__ */ n(
|
|
@@ -1668,48 +1687,48 @@ function bn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1668
1687
|
) }) : /* @__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" }) })
|
|
1669
1688
|
] });
|
|
1670
1689
|
}
|
|
1671
|
-
function
|
|
1690
|
+
function Se({ drivers: e, steamId: t }) {
|
|
1672
1691
|
if (!e.length)
|
|
1673
1692
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1674
|
-
const
|
|
1675
|
-
const i = t &&
|
|
1693
|
+
const r = [...e].sort((s, a) => {
|
|
1694
|
+
const i = t && s.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
|
|
1676
1695
|
return i - o;
|
|
1677
1696
|
});
|
|
1678
|
-
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children:
|
|
1697
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
|
|
1679
1698
|
var i, o;
|
|
1680
|
-
const a = t &&
|
|
1699
|
+
const a = t && s.steamId === t;
|
|
1681
1700
|
return /* @__PURE__ */ c(
|
|
1682
1701
|
"div",
|
|
1683
1702
|
{
|
|
1684
1703
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1685
1704
|
children: [
|
|
1686
|
-
|
|
1705
|
+
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: ((o = (i = s.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
|
|
1687
1706
|
/* @__PURE__ */ c("span", { className: "pvx-reg-driver-name", children: [
|
|
1688
|
-
|
|
1707
|
+
s.displayName,
|
|
1689
1708
|
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1690
1709
|
] })
|
|
1691
1710
|
]
|
|
1692
1711
|
},
|
|
1693
|
-
|
|
1712
|
+
s.steamId || s.driverId
|
|
1694
1713
|
);
|
|
1695
1714
|
}) });
|
|
1696
1715
|
}
|
|
1697
|
-
function
|
|
1698
|
-
const
|
|
1699
|
-
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
1716
|
+
function Re({ count: e, max: t }) {
|
|
1717
|
+
const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
|
|
1718
|
+
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
|
|
1700
1719
|
e,
|
|
1701
1720
|
"/",
|
|
1702
1721
|
t,
|
|
1703
1722
|
" drivers"
|
|
1704
1723
|
] });
|
|
1705
1724
|
}
|
|
1706
|
-
function
|
|
1707
|
-
const { data:
|
|
1725
|
+
function gt({ competitionId: e, className: t }) {
|
|
1726
|
+
const { data: r, isLoading: s } = me(e), a = (r == null ? void 0 : r.type) === "championship", i = L(
|
|
1708
1727
|
() => {
|
|
1709
1728
|
var v;
|
|
1710
|
-
return ((v =
|
|
1729
|
+
return ((v = r == null ? void 0 : r.rounds) == null ? void 0 : v.filter((N) => N.isFinalized)) || [];
|
|
1711
1730
|
},
|
|
1712
|
-
[
|
|
1731
|
+
[r]
|
|
1713
1732
|
), o = L(
|
|
1714
1733
|
() => i.map((v) => v.roundNumber),
|
|
1715
1734
|
[i]
|
|
@@ -1717,9 +1736,9 @@ function vt({ competitionId: e, className: t }) {
|
|
|
1717
1736
|
e,
|
|
1718
1737
|
o
|
|
1719
1738
|
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [p, f] = D(null), g = p || l;
|
|
1720
|
-
if (
|
|
1739
|
+
if (s || u)
|
|
1721
1740
|
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1722
|
-
if (!
|
|
1741
|
+
if (!r)
|
|
1723
1742
|
return /* @__PURE__ */ n(P, { message: "Competition not found." });
|
|
1724
1743
|
if (!i.length)
|
|
1725
1744
|
return /* @__PURE__ */ n(P, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
@@ -1746,12 +1765,12 @@ function vt({ competitionId: e, className: t }) {
|
|
|
1746
1765
|
},
|
|
1747
1766
|
v.id
|
|
1748
1767
|
)) }),
|
|
1749
|
-
g === "standings" ? /* @__PURE__ */ n(
|
|
1768
|
+
g === "standings" ? /* @__PURE__ */ n(hn, { competitionId: e }) : x ? /* @__PURE__ */ n(wn, { round: x }) : /* @__PURE__ */ n(P, { message: "No results for this round." })
|
|
1750
1769
|
] });
|
|
1751
1770
|
}
|
|
1752
|
-
function
|
|
1771
|
+
function wn({ round: e }) {
|
|
1753
1772
|
var a;
|
|
1754
|
-
const
|
|
1773
|
+
const r = (e.sessions || []).find((i) => i.type === "RACE"), s = (a = r == null ? void 0 : r.results) == null ? void 0 : a.filter((i) => i.position <= 3).sort((i, o) => i.position - o.position);
|
|
1755
1774
|
return /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
1756
1775
|
/* @__PURE__ */ c("div", { className: "pvx-card-header--split", children: [
|
|
1757
1776
|
/* @__PURE__ */ c("div", { children: [
|
|
@@ -1766,7 +1785,7 @@ function yn({ round: e }) {
|
|
|
1766
1785
|
year: "numeric"
|
|
1767
1786
|
}) })
|
|
1768
1787
|
] }),
|
|
1769
|
-
(
|
|
1788
|
+
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: s.map((i) => /* @__PURE__ */ c("span", { className: "pvx-round-podium-item", children: [
|
|
1770
1789
|
/* @__PURE__ */ n("span", { children: se[i.position - 1] }),
|
|
1771
1790
|
/* @__PURE__ */ n("span", { children: i.driverName })
|
|
1772
1791
|
] }, i.driverId)) })
|
|
@@ -1774,64 +1793,64 @@ function yn({ round: e }) {
|
|
|
1774
1793
|
/* @__PURE__ */ n(Te, { round: e })
|
|
1775
1794
|
] });
|
|
1776
1795
|
}
|
|
1777
|
-
function
|
|
1778
|
-
const { cdnUrl: t } = k(),
|
|
1796
|
+
function Cn(e) {
|
|
1797
|
+
const { cdnUrl: t } = k(), r = S({
|
|
1779
1798
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
1780
|
-
queryFn: () =>
|
|
1799
|
+
queryFn: () => R(t, _e(null, e)),
|
|
1781
1800
|
enabled: !!e,
|
|
1782
1801
|
staleTime: 3e4,
|
|
1783
1802
|
refetchInterval: 3e4
|
|
1784
|
-
}),
|
|
1803
|
+
}), s = r.data;
|
|
1785
1804
|
return {
|
|
1786
|
-
isLoading:
|
|
1787
|
-
error:
|
|
1788
|
-
data:
|
|
1789
|
-
driverName:
|
|
1790
|
-
lapCount:
|
|
1791
|
-
trackBreakdown:
|
|
1792
|
-
carBreakdown:
|
|
1793
|
-
recordsHeld:
|
|
1794
|
-
currentRecords:
|
|
1795
|
-
bestRanking:
|
|
1796
|
-
bestRankingTrackId:
|
|
1797
|
-
bestRankingLayout:
|
|
1798
|
-
bestRankingCarId:
|
|
1799
|
-
generatedAt:
|
|
1805
|
+
isLoading: r.isLoading,
|
|
1806
|
+
error: r.error,
|
|
1807
|
+
data: s ? {
|
|
1808
|
+
driverName: s.driverName || "Driver",
|
|
1809
|
+
lapCount: s.lapCount || 0,
|
|
1810
|
+
trackBreakdown: s.trackBreakdown || [],
|
|
1811
|
+
carBreakdown: s.carBreakdown || [],
|
|
1812
|
+
recordsHeld: s.recordsHeld || 0,
|
|
1813
|
+
currentRecords: s.currentRecords || [],
|
|
1814
|
+
bestRanking: s.bestRanking ?? null,
|
|
1815
|
+
bestRankingTrackId: s.bestRankingTrackId ?? null,
|
|
1816
|
+
bestRankingLayout: s.bestRankingLayout ?? null,
|
|
1817
|
+
bestRankingCarId: s.bestRankingCarId ?? null,
|
|
1818
|
+
generatedAt: s.generatedAt
|
|
1800
1819
|
} : null
|
|
1801
1820
|
};
|
|
1802
1821
|
}
|
|
1803
1822
|
function $e(e = {}) {
|
|
1804
|
-
const { cdnUrl: t, partnerSlug:
|
|
1805
|
-
return
|
|
1806
|
-
queryKey: ["pitvox", "ratings",
|
|
1807
|
-
queryFn: () =>
|
|
1823
|
+
const { cdnUrl: t, partnerSlug: r } = k(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = Z(r, s, a, "ratings.json");
|
|
1824
|
+
return S({
|
|
1825
|
+
queryKey: ["pitvox", "ratings", r, s || null, a || null],
|
|
1826
|
+
queryFn: () => R(t, o),
|
|
1808
1827
|
staleTime: 3e4,
|
|
1809
1828
|
refetchInterval: 3e4,
|
|
1810
1829
|
enabled: i
|
|
1811
1830
|
});
|
|
1812
1831
|
}
|
|
1813
|
-
function
|
|
1814
|
-
var
|
|
1815
|
-
const t = $e(),
|
|
1832
|
+
function Ln(e) {
|
|
1833
|
+
var s;
|
|
1834
|
+
const t = $e(), r = L(() => {
|
|
1816
1835
|
var a;
|
|
1817
1836
|
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
1818
1837
|
(i) => i.identifier === e
|
|
1819
1838
|
) || null;
|
|
1820
|
-
}, [(
|
|
1839
|
+
}, [(s = t.data) == null ? void 0 : s.drivers, e]);
|
|
1821
1840
|
return {
|
|
1822
1841
|
isLoading: t.isLoading,
|
|
1823
1842
|
error: t.error,
|
|
1824
|
-
data:
|
|
1825
|
-
rating:
|
|
1826
|
-
rank:
|
|
1843
|
+
data: r ? {
|
|
1844
|
+
rating: r.rating,
|
|
1845
|
+
rank: r.rank,
|
|
1827
1846
|
totalDrivers: t.data.driverCount || t.data.drivers.length,
|
|
1828
|
-
comboCount:
|
|
1829
|
-
distinctCars:
|
|
1830
|
-
combos:
|
|
1847
|
+
comboCount: r.comboCount || 0,
|
|
1848
|
+
distinctCars: r.distinctCars || 0,
|
|
1849
|
+
combos: r.combos || []
|
|
1831
1850
|
} : null
|
|
1832
1851
|
};
|
|
1833
1852
|
}
|
|
1834
|
-
function
|
|
1853
|
+
function ft(e = {}) {
|
|
1835
1854
|
const t = $e(e);
|
|
1836
1855
|
return {
|
|
1837
1856
|
data: t.data || null,
|
|
@@ -1839,18 +1858,18 @@ function ht(e = {}) {
|
|
|
1839
1858
|
error: t.error
|
|
1840
1859
|
};
|
|
1841
1860
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const { cdnUrl: e, partnerSlug: t, getSteamId:
|
|
1861
|
+
function Tn() {
|
|
1862
|
+
const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = k(), a = r(), { data: i, isLoading: o } = S({
|
|
1844
1863
|
queryKey: ["pitvox", "competitions", t],
|
|
1845
1864
|
queryFn: async () => {
|
|
1846
|
-
const m = await
|
|
1865
|
+
const m = await R(e, "competitions/index.json");
|
|
1847
1866
|
return m != null && m.competitions ? m.competitions.filter((b) => b.partnerSlug === t) : [];
|
|
1848
1867
|
},
|
|
1849
1868
|
staleTime: 6e4
|
|
1850
1869
|
}), d = (i == null ? void 0 : i.map((m) => m.id)) || [], u = ie({
|
|
1851
1870
|
queries: d.map((m) => ({
|
|
1852
1871
|
queryKey: ["pitvox", "competition", t, m, "entrylist"],
|
|
1853
|
-
queryFn: () =>
|
|
1872
|
+
queryFn: () => R(e, `competitions/${t}/${m}/entrylist.json`),
|
|
1854
1873
|
enabled: !!a && d.length > 0,
|
|
1855
1874
|
staleTime: 6e4
|
|
1856
1875
|
}))
|
|
@@ -1875,15 +1894,15 @@ function Cn() {
|
|
|
1875
1894
|
}, [i, a, l, u]), f = ie({
|
|
1876
1895
|
queries: p.map((m) => ({
|
|
1877
1896
|
queryKey: ["pitvox", "serverInfo", m.competitionId, m.roundNumber],
|
|
1878
|
-
queryFn: () =>
|
|
1879
|
-
enabled: !!
|
|
1897
|
+
queryFn: () => s(m.competitionId, m.roundNumber),
|
|
1898
|
+
enabled: !!s && p.length > 0,
|
|
1880
1899
|
staleTime: 5 * 6e4,
|
|
1881
1900
|
// 5 minutes
|
|
1882
1901
|
retry: !1
|
|
1883
1902
|
}))
|
|
1884
1903
|
});
|
|
1885
1904
|
return {
|
|
1886
|
-
data: L(() => p.length ?
|
|
1905
|
+
data: L(() => p.length ? s ? p.map((m, b) => {
|
|
1887
1906
|
var v;
|
|
1888
1907
|
const x = (v = f[b]) == null ? void 0 : v.data;
|
|
1889
1908
|
return x != null && x.success ? {
|
|
@@ -1891,26 +1910,26 @@ function Cn() {
|
|
|
1891
1910
|
serverAddress: x.serverAddress || null,
|
|
1892
1911
|
serverPassword: x.serverPassword || null
|
|
1893
1912
|
} : m;
|
|
1894
|
-
}) : p : [], [p,
|
|
1913
|
+
}) : p : [], [p, s, f]),
|
|
1895
1914
|
isLoading: o || !!a && l
|
|
1896
1915
|
};
|
|
1897
1916
|
}
|
|
1898
|
-
function
|
|
1917
|
+
function Sn() {
|
|
1899
1918
|
const { onFetchNotifications: e } = k();
|
|
1900
1919
|
return !!e;
|
|
1901
1920
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const { onFetchNotifications: t, partnerSlug:
|
|
1904
|
-
return
|
|
1905
|
-
queryKey: ["pitvox", "notifications",
|
|
1906
|
-
queryFn: () => t({ limit:
|
|
1921
|
+
function Rn(e = {}) {
|
|
1922
|
+
const { onFetchNotifications: t, partnerSlug: r } = k(), { limit: s = 20, unreadOnly: a = !1 } = e;
|
|
1923
|
+
return S({
|
|
1924
|
+
queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
|
|
1925
|
+
queryFn: () => t({ limit: s, unreadOnly: a }),
|
|
1907
1926
|
enabled: !!t,
|
|
1908
1927
|
staleTime: 3e4,
|
|
1909
1928
|
refetchInterval: 3e4
|
|
1910
1929
|
});
|
|
1911
1930
|
}
|
|
1912
|
-
function
|
|
1913
|
-
const { onFetchNotifications: e, partnerSlug: t } = k(), { data:
|
|
1931
|
+
function Nt() {
|
|
1932
|
+
const { onFetchNotifications: e, partnerSlug: t } = k(), { data: r, isLoading: s } = S({
|
|
1914
1933
|
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
1915
1934
|
queryFn: () => e({ limit: 1 }),
|
|
1916
1935
|
enabled: !!e,
|
|
@@ -1918,18 +1937,18 @@ function xt() {
|
|
|
1918
1937
|
refetchInterval: 3e4,
|
|
1919
1938
|
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
1920
1939
|
});
|
|
1921
|
-
return { count:
|
|
1940
|
+
return { count: r ?? 0, isLoading: s };
|
|
1922
1941
|
}
|
|
1923
|
-
function
|
|
1924
|
-
const { onMarkNotificationRead: e, partnerSlug: t } = k(),
|
|
1942
|
+
function $n() {
|
|
1943
|
+
const { onMarkNotificationRead: e, partnerSlug: t } = k(), r = _();
|
|
1925
1944
|
return O({
|
|
1926
|
-
mutationFn: (
|
|
1945
|
+
mutationFn: (s) => {
|
|
1927
1946
|
if (!e)
|
|
1928
1947
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
1929
|
-
return e(
|
|
1948
|
+
return e(s);
|
|
1930
1949
|
},
|
|
1931
|
-
onSuccess: (
|
|
1932
|
-
|
|
1950
|
+
onSuccess: (s, a) => {
|
|
1951
|
+
r.setQueriesData(
|
|
1933
1952
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
1934
1953
|
(i) => i != null && i.notifications ? {
|
|
1935
1954
|
...i,
|
|
@@ -1942,8 +1961,8 @@ function Rn() {
|
|
|
1942
1961
|
}
|
|
1943
1962
|
});
|
|
1944
1963
|
}
|
|
1945
|
-
function
|
|
1946
|
-
const { onMarkAllNotificationsRead: e, partnerSlug: t } = k(),
|
|
1964
|
+
function Mn() {
|
|
1965
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: t } = k(), r = _();
|
|
1947
1966
|
return O({
|
|
1948
1967
|
mutationFn: () => {
|
|
1949
1968
|
if (!e)
|
|
@@ -1951,24 +1970,24 @@ function Sn() {
|
|
|
1951
1970
|
return e();
|
|
1952
1971
|
},
|
|
1953
1972
|
onSuccess: () => {
|
|
1954
|
-
|
|
1973
|
+
r.setQueriesData(
|
|
1955
1974
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
1956
|
-
(
|
|
1957
|
-
...
|
|
1975
|
+
(s) => s != null && s.notifications ? {
|
|
1976
|
+
...s,
|
|
1958
1977
|
unreadCount: 0,
|
|
1959
|
-
notifications:
|
|
1978
|
+
notifications: s.notifications.map((a) => ({
|
|
1960
1979
|
...a,
|
|
1961
1980
|
isRead: !0,
|
|
1962
1981
|
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1963
1982
|
}))
|
|
1964
|
-
} :
|
|
1983
|
+
} : s
|
|
1965
1984
|
);
|
|
1966
1985
|
}
|
|
1967
1986
|
});
|
|
1968
1987
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const a =
|
|
1971
|
-
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${
|
|
1988
|
+
function Dn({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
1989
|
+
const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
1990
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
|
|
1972
1991
|
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() }),
|
|
1973
1992
|
/* @__PURE__ */ c("div", { className: "pvx-dash-profile-info", children: [
|
|
1974
1993
|
/* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
@@ -1979,7 +1998,7 @@ function $n({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" })
|
|
|
1979
1998
|
] })
|
|
1980
1999
|
] });
|
|
1981
2000
|
}
|
|
1982
|
-
function
|
|
2001
|
+
function In() {
|
|
1983
2002
|
return /* @__PURE__ */ c("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1984
2003
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
1985
2004
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -1987,7 +2006,7 @@ function Mn() {
|
|
|
1987
2006
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
1988
2007
|
] });
|
|
1989
2008
|
}
|
|
1990
|
-
function
|
|
2009
|
+
function Bn() {
|
|
1991
2010
|
return /* @__PURE__ */ c("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1992
2011
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1993
2012
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -1996,10 +2015,10 @@ function Dn() {
|
|
|
1996
2015
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
1997
2016
|
] });
|
|
1998
2017
|
}
|
|
1999
|
-
function
|
|
2018
|
+
function Pn() {
|
|
2000
2019
|
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" }) });
|
|
2001
2020
|
}
|
|
2002
|
-
function ce({ icon: e, value: t, label:
|
|
2021
|
+
function ce({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: i }) {
|
|
2003
2022
|
const [o, d] = D(!1), u = Ie(null);
|
|
2004
2023
|
Be(() => {
|
|
2005
2024
|
if (!o) return;
|
|
@@ -2008,7 +2027,7 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2008
2027
|
}
|
|
2009
2028
|
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
2010
2029
|
}, [o]);
|
|
2011
|
-
const l =
|
|
2030
|
+
const l = s != null && s.length ? s.slice().sort((p, f) => f[i] - p[i]) : null;
|
|
2012
2031
|
return /* @__PURE__ */ c(
|
|
2013
2032
|
"div",
|
|
2014
2033
|
{
|
|
@@ -2019,7 +2038,7 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2019
2038
|
e,
|
|
2020
2039
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
2021
2040
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
2022
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children:
|
|
2041
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
|
|
2023
2042
|
] }),
|
|
2024
2043
|
l && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: l.map((p, f) => /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2025
2044
|
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: p[a] }),
|
|
@@ -2029,23 +2048,23 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2029
2048
|
}
|
|
2030
2049
|
);
|
|
2031
2050
|
}
|
|
2032
|
-
function
|
|
2051
|
+
function An({ stats: e, rating: t, className: r = "" }) {
|
|
2033
2052
|
if (!e) return null;
|
|
2034
|
-
const
|
|
2053
|
+
const s = e.trackBreakdown.map((i) => ({
|
|
2035
2054
|
name: q(i.trackId, i.layout),
|
|
2036
2055
|
lapCount: i.lapCount
|
|
2037
2056
|
})), a = e.carBreakdown.map((i) => ({
|
|
2038
2057
|
name: I(i.carId),
|
|
2039
2058
|
lapCount: i.lapCount
|
|
2040
2059
|
}));
|
|
2041
|
-
return /* @__PURE__ */ c("div", { className: `pvx-dash-stats ${
|
|
2060
|
+
return /* @__PURE__ */ c("div", { className: `pvx-dash-stats ${r}`, children: [
|
|
2042
2061
|
/* @__PURE__ */ n(
|
|
2043
2062
|
ce,
|
|
2044
2063
|
{
|
|
2045
|
-
icon: /* @__PURE__ */ n(
|
|
2064
|
+
icon: /* @__PURE__ */ n(In, {}),
|
|
2046
2065
|
value: e.lapCount.toLocaleString(),
|
|
2047
2066
|
label: "Total Laps",
|
|
2048
|
-
items:
|
|
2067
|
+
items: s,
|
|
2049
2068
|
labelKey: "name",
|
|
2050
2069
|
countKey: "lapCount"
|
|
2051
2070
|
}
|
|
@@ -2053,7 +2072,7 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2053
2072
|
/* @__PURE__ */ n(
|
|
2054
2073
|
ce,
|
|
2055
2074
|
{
|
|
2056
|
-
icon: /* @__PURE__ */ n(
|
|
2075
|
+
icon: /* @__PURE__ */ n(Bn, {}),
|
|
2057
2076
|
value: e.carBreakdown.length,
|
|
2058
2077
|
label: "Cars Used",
|
|
2059
2078
|
items: a,
|
|
@@ -2062,7 +2081,7 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2062
2081
|
}
|
|
2063
2082
|
),
|
|
2064
2083
|
t && /* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2065
|
-
/* @__PURE__ */ n(
|
|
2084
|
+
/* @__PURE__ */ n(Pn, {}),
|
|
2066
2085
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
2067
2086
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t.rating.toFixed(1) }),
|
|
2068
2087
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
@@ -2076,12 +2095,12 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2076
2095
|
] })
|
|
2077
2096
|
] });
|
|
2078
2097
|
}
|
|
2079
|
-
function
|
|
2080
|
-
const
|
|
2081
|
-
const i =
|
|
2098
|
+
function Un({ records: e, className: t = "" }) {
|
|
2099
|
+
const r = L(() => e != null && e.length ? e.slice().sort((s, a) => {
|
|
2100
|
+
const i = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
|
|
2082
2101
|
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
2083
2102
|
}) : [], [e]);
|
|
2084
|
-
return
|
|
2103
|
+
return r.length ? /* @__PURE__ */ c("div", { className: `pvx-card ${t}`, children: [
|
|
2085
2104
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2086
2105
|
/* @__PURE__ */ n("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2087
2106
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
@@ -2094,34 +2113,34 @@ function Pn({ records: e, className: t = "" }) {
|
|
|
2094
2113
|
"Current Records",
|
|
2095
2114
|
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
2096
2115
|
"(",
|
|
2097
|
-
|
|
2116
|
+
r.length,
|
|
2098
2117
|
")"
|
|
2099
2118
|
] })
|
|
2100
2119
|
] }) }),
|
|
2101
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children:
|
|
2120
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ c("div", { className: "pvx-dash-record-row", children: [
|
|
2102
2121
|
/* @__PURE__ */ c("div", { className: "pvx-dash-record-info", children: [
|
|
2103
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: q(
|
|
2104
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(
|
|
2122
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: q(s.trackId, s.layout, s.game) }),
|
|
2123
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(s.carId) })
|
|
2105
2124
|
] }),
|
|
2106
2125
|
/* @__PURE__ */ c("div", { className: "pvx-dash-record-time", children: [
|
|
2107
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: A(
|
|
2108
|
-
/* @__PURE__ */ c("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2109
|
-
(
|
|
2110
|
-
|
|
2126
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: A(s.lapTimeMs) }),
|
|
2127
|
+
/* @__PURE__ */ c("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s.game || "evo"}`, children: [
|
|
2128
|
+
(s.game || "evo").toUpperCase(),
|
|
2129
|
+
s.gameVersion ? ` ${s.gameVersion}` : ""
|
|
2111
2130
|
] })
|
|
2112
2131
|
] })
|
|
2113
2132
|
] }, a)) })
|
|
2114
2133
|
] }) : null;
|
|
2115
2134
|
}
|
|
2116
|
-
function
|
|
2135
|
+
function En({ events: e, isLoading: t, className: r, limit: s = 3 }) {
|
|
2117
2136
|
if (t)
|
|
2118
2137
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2119
2138
|
if (!(e != null && e.length))
|
|
2120
2139
|
return null;
|
|
2121
|
-
const a =
|
|
2122
|
-
return /* @__PURE__ */ c("div", { className: `pvx-card ${
|
|
2140
|
+
const a = s ? e.slice(0, s) : e, i = e.length - a.length;
|
|
2141
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card ${r || ""}`, children: [
|
|
2123
2142
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2124
|
-
/* @__PURE__ */ n(
|
|
2143
|
+
/* @__PURE__ */ n(qn, {}),
|
|
2125
2144
|
"Upcoming Events",
|
|
2126
2145
|
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
2127
2146
|
"(",
|
|
@@ -2144,7 +2163,7 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2144
2163
|
o.track
|
|
2145
2164
|
] }),
|
|
2146
2165
|
o.serverPassword && /* @__PURE__ */ n(
|
|
2147
|
-
|
|
2166
|
+
Fn,
|
|
2148
2167
|
{
|
|
2149
2168
|
password: o.serverPassword,
|
|
2150
2169
|
address: o.serverAddress
|
|
@@ -2157,7 +2176,7 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2157
2176
|
month: "short",
|
|
2158
2177
|
year: "numeric"
|
|
2159
2178
|
}) }),
|
|
2160
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." :
|
|
2179
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : _n(o.startTime) }),
|
|
2161
2180
|
o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
2162
2181
|
!o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2163
2182
|
] })
|
|
@@ -2174,11 +2193,11 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2174
2193
|
] })
|
|
2175
2194
|
] });
|
|
2176
2195
|
}
|
|
2177
|
-
function
|
|
2178
|
-
const [
|
|
2196
|
+
function Fn({ password: e, address: t }) {
|
|
2197
|
+
const [r, s] = D(!1), [a, i] = D(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
|
|
2179
2198
|
if (o)
|
|
2180
2199
|
try {
|
|
2181
|
-
await navigator.clipboard.writeText(o),
|
|
2200
|
+
await navigator.clipboard.writeText(o), s(!0), setTimeout(() => s(!1), 2e3);
|
|
2182
2201
|
} catch {
|
|
2183
2202
|
}
|
|
2184
2203
|
}, [o]);
|
|
@@ -2190,9 +2209,9 @@ function Un({ password: e, address: t }) {
|
|
|
2190
2209
|
onClick: d,
|
|
2191
2210
|
title: "Copy join string to clipboard",
|
|
2192
2211
|
children: [
|
|
2193
|
-
/* @__PURE__ */ n(
|
|
2212
|
+
/* @__PURE__ */ n(Vn, {}),
|
|
2194
2213
|
" ",
|
|
2195
|
-
|
|
2214
|
+
r ? "Copied!" : "Join"
|
|
2196
2215
|
]
|
|
2197
2216
|
}
|
|
2198
2217
|
),
|
|
@@ -2203,95 +2222,95 @@ function Un({ password: e, address: t }) {
|
|
|
2203
2222
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2204
2223
|
onClick: () => i((u) => !u),
|
|
2205
2224
|
title: a ? "Hide password" : "Reveal password",
|
|
2206
|
-
children: a ? /* @__PURE__ */ n(
|
|
2225
|
+
children: a ? /* @__PURE__ */ n(Hn, {}) : /* @__PURE__ */ n(Kn, {})
|
|
2207
2226
|
}
|
|
2208
2227
|
),
|
|
2209
2228
|
a && /* @__PURE__ */ c("span", { className: "pvx-server-detail", children: [
|
|
2210
|
-
/* @__PURE__ */ n(
|
|
2229
|
+
/* @__PURE__ */ n(jn, {}),
|
|
2211
2230
|
" ",
|
|
2212
2231
|
e
|
|
2213
2232
|
] })
|
|
2214
2233
|
] })
|
|
2215
2234
|
] });
|
|
2216
2235
|
}
|
|
2217
|
-
function
|
|
2236
|
+
function _n(e) {
|
|
2218
2237
|
const t = new Date(e).getTime() - Date.now();
|
|
2219
2238
|
if (t <= 0) return "Now";
|
|
2220
|
-
const
|
|
2221
|
-
if (
|
|
2222
|
-
if (
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
if (
|
|
2226
|
-
if (
|
|
2227
|
-
const a = Math.floor(
|
|
2239
|
+
const r = Math.floor(t / (1e3 * 60 * 60));
|
|
2240
|
+
if (r < 1) return "Less than 1 hour";
|
|
2241
|
+
if (r < 24) return `in ${r}h`;
|
|
2242
|
+
const s = Math.floor(r / 24);
|
|
2243
|
+
if (s === 1) return "Tomorrow";
|
|
2244
|
+
if (s < 7) return `in ${s} days`;
|
|
2245
|
+
if (s < 30) {
|
|
2246
|
+
const a = Math.floor(s / 7);
|
|
2228
2247
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2229
2248
|
}
|
|
2230
2249
|
return le(e);
|
|
2231
2250
|
}
|
|
2232
|
-
function
|
|
2251
|
+
function qn() {
|
|
2233
2252
|
return /* @__PURE__ */ c("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2234
2253
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2235
2254
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2236
2255
|
] });
|
|
2237
2256
|
}
|
|
2238
|
-
function
|
|
2257
|
+
function jn() {
|
|
2239
2258
|
return /* @__PURE__ */ c("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: [
|
|
2240
2259
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2241
2260
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2242
2261
|
] });
|
|
2243
2262
|
}
|
|
2244
|
-
function
|
|
2263
|
+
function Vn() {
|
|
2245
2264
|
return /* @__PURE__ */ c("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: [
|
|
2246
2265
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2247
2266
|
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2248
2267
|
] });
|
|
2249
2268
|
}
|
|
2250
|
-
function
|
|
2269
|
+
function Kn() {
|
|
2251
2270
|
return /* @__PURE__ */ c("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: [
|
|
2252
2271
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2253
2272
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2254
2273
|
] });
|
|
2255
2274
|
}
|
|
2256
|
-
function
|
|
2275
|
+
function Hn() {
|
|
2257
2276
|
return /* @__PURE__ */ c("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: [
|
|
2258
2277
|
/* @__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" }),
|
|
2259
2278
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2260
2279
|
] });
|
|
2261
2280
|
}
|
|
2262
|
-
function
|
|
2281
|
+
function On({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: i }) {
|
|
2263
2282
|
const o = ue();
|
|
2264
2283
|
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ c("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2265
2284
|
/* @__PURE__ */ c("div", { className: "pvx-card-header", children: [
|
|
2266
2285
|
/* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2267
|
-
/* @__PURE__ */ n(
|
|
2286
|
+
/* @__PURE__ */ n(Gn, {}),
|
|
2268
2287
|
"Notifications",
|
|
2269
2288
|
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2270
2289
|
] }),
|
|
2271
|
-
t > 0 &&
|
|
2290
|
+
t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
|
|
2272
2291
|
] }),
|
|
2273
2292
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2274
|
-
|
|
2293
|
+
Wn,
|
|
2275
2294
|
{
|
|
2276
2295
|
notification: d,
|
|
2277
2296
|
getUserDisplay: o,
|
|
2278
|
-
onMarkRead:
|
|
2297
|
+
onMarkRead: r
|
|
2279
2298
|
},
|
|
2280
2299
|
d.id
|
|
2281
2300
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2282
2301
|
] });
|
|
2283
2302
|
}
|
|
2284
|
-
function
|
|
2285
|
-
const
|
|
2286
|
-
!e.isRead &&
|
|
2303
|
+
function Wn({ notification: e, getUserDisplay: t, onMarkRead: r }) {
|
|
2304
|
+
const s = () => {
|
|
2305
|
+
!e.isRead && r && r(e.id);
|
|
2287
2306
|
};
|
|
2288
2307
|
return /* @__PURE__ */ c(
|
|
2289
2308
|
"button",
|
|
2290
2309
|
{
|
|
2291
2310
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2292
|
-
onClick:
|
|
2311
|
+
onClick: s,
|
|
2293
2312
|
children: [
|
|
2294
|
-
/* @__PURE__ */ n(
|
|
2313
|
+
/* @__PURE__ */ n(zn, { type: e.type }),
|
|
2295
2314
|
/* @__PURE__ */ c("div", { className: "pvx-notif-content", children: [
|
|
2296
2315
|
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: je(e, t) }),
|
|
2297
2316
|
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: le(e.createdAt) })
|
|
@@ -2301,7 +2320,7 @@ function Hn({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
|
2301
2320
|
}
|
|
2302
2321
|
);
|
|
2303
2322
|
}
|
|
2304
|
-
function
|
|
2323
|
+
function zn({ type: e }) {
|
|
2305
2324
|
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__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2306
2325
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2307
2326
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2314,29 +2333,29 @@ function On({ type: e }) {
|
|
|
2314
2333
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2315
2334
|
] }) });
|
|
2316
2335
|
}
|
|
2317
|
-
function
|
|
2336
|
+
function Gn() {
|
|
2318
2337
|
return /* @__PURE__ */ c("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2319
2338
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2320
2339
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2321
2340
|
] });
|
|
2322
2341
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const { data: a, isLoading: i, error: o } =
|
|
2325
|
-
return i || u ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ c("div", { className: `pvx-dash ${
|
|
2342
|
+
function bt({ steamId: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
2343
|
+
const { data: a, isLoading: i, error: o } = Cn(e), { data: d, isLoading: u } = Ln(e), { data: l, isLoading: p } = Tn(), f = Sn(), { data: g, isLoading: m } = Rn({ limit: 10 }), b = $n(), x = Mn();
|
|
2344
|
+
return i || u ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ c("div", { className: `pvx-dash ${s}`, children: [
|
|
2326
2345
|
/* @__PURE__ */ n(
|
|
2327
|
-
|
|
2346
|
+
Dn,
|
|
2328
2347
|
{
|
|
2329
2348
|
driverName: a.driverName,
|
|
2330
2349
|
avatarUrl: t,
|
|
2331
|
-
memberSince:
|
|
2350
|
+
memberSince: r
|
|
2332
2351
|
}
|
|
2333
2352
|
),
|
|
2334
|
-
/* @__PURE__ */ n(
|
|
2335
|
-
e && /* @__PURE__ */ n(
|
|
2353
|
+
/* @__PURE__ */ n(An, { stats: a, rating: d }),
|
|
2354
|
+
e && /* @__PURE__ */ n(En, { events: l, isLoading: p }),
|
|
2336
2355
|
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${f ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2337
|
-
/* @__PURE__ */ n(
|
|
2356
|
+
/* @__PURE__ */ n(Un, { records: a.currentRecords }),
|
|
2338
2357
|
f && /* @__PURE__ */ n(
|
|
2339
|
-
|
|
2358
|
+
On,
|
|
2340
2359
|
{
|
|
2341
2360
|
notifications: g == null ? void 0 : g.notifications,
|
|
2342
2361
|
unreadCount: (g == null ? void 0 : g.unreadCount) || 0,
|
|
@@ -2349,81 +2368,83 @@ function gt({ steamId: e, avatarUrl: t, memberSince: s, className: r = "" }) {
|
|
|
2349
2368
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2350
2369
|
}
|
|
2351
2370
|
export {
|
|
2352
|
-
|
|
2371
|
+
ot as CarsTable,
|
|
2353
2372
|
P as CompEmptyState,
|
|
2354
2373
|
E as CompLoadingState,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2374
|
+
un as CompetitionCard,
|
|
2375
|
+
ut as CompetitionCards,
|
|
2376
|
+
gt as CompetitionResultsTabs,
|
|
2377
|
+
pn as CompletedBadge,
|
|
2359
2378
|
Ce as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2379
|
+
bt as DriverDashboard,
|
|
2380
|
+
Dn as DriverProfile,
|
|
2381
|
+
ct as DriversTable,
|
|
2382
|
+
vt as EntryList,
|
|
2364
2383
|
Y as InfoPill,
|
|
2365
|
-
|
|
2366
|
-
|
|
2384
|
+
lt as LapHistoryTable,
|
|
2385
|
+
On as NotificationsCard,
|
|
2367
2386
|
se as PODIUM_MEDALS,
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2387
|
+
Zn as PitVoxPartnerProvider,
|
|
2388
|
+
dt as RankingsTable,
|
|
2389
|
+
Un as RecordsTable,
|
|
2390
|
+
ht as RegisterButton,
|
|
2391
|
+
xt as RegistrationPanel,
|
|
2392
|
+
mt as RoundResults,
|
|
2374
2393
|
Te as RoundSessionResults,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2394
|
+
hn as StandingsTable,
|
|
2395
|
+
An as StatsCards,
|
|
2396
|
+
it as TracksTable,
|
|
2397
|
+
sn as TypeBadge,
|
|
2398
|
+
En as UpcomingEvents,
|
|
2380
2399
|
_e as buildDriverIndexPath,
|
|
2381
2400
|
Fe as buildLapsPath,
|
|
2382
2401
|
Z as buildLeaderboardPath,
|
|
2383
2402
|
qe as buildRecentLapsPath,
|
|
2384
|
-
|
|
2385
|
-
|
|
2403
|
+
R as fetchCdnJson,
|
|
2404
|
+
pt as filterCompetitionsByStatus,
|
|
2386
2405
|
I as formatCarName,
|
|
2387
2406
|
j as formatDate,
|
|
2388
|
-
|
|
2407
|
+
Xn as formatDelta,
|
|
2389
2408
|
pe as formatFuel,
|
|
2390
2409
|
A as formatLapTime,
|
|
2391
2410
|
je as formatNotificationMessage,
|
|
2392
2411
|
le as formatRelativeTime,
|
|
2393
2412
|
B as formatSectorTime,
|
|
2413
|
+
tn as formatSessionLabel,
|
|
2394
2414
|
q as formatTrackName,
|
|
2395
2415
|
de as formatTyreCompound,
|
|
2396
|
-
|
|
2416
|
+
dn as getCompetitionPodium,
|
|
2397
2417
|
Le as getCompetitionStatus,
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2418
|
+
ln as getCompletionDate,
|
|
2419
|
+
cn as isCompetitionComplete,
|
|
2420
|
+
rt as useCarLeaderboard,
|
|
2421
|
+
nt as useCarMetadata,
|
|
2402
2422
|
Oe as useCompetitionAllRounds,
|
|
2403
2423
|
me as useCompetitionConfig,
|
|
2404
2424
|
he as useCompetitionEntryList,
|
|
2425
|
+
at as useCompetitionLeaderboard,
|
|
2405
2426
|
He as useCompetitionRound,
|
|
2406
2427
|
We as useCompetitionRoundLaps,
|
|
2407
2428
|
ve as useCompetitionStandings,
|
|
2408
|
-
|
|
2429
|
+
st as useCompetitions,
|
|
2409
2430
|
Ke as useDriverLaps,
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2431
|
+
Ln as useDriverRating,
|
|
2432
|
+
ft as useDriverRatings,
|
|
2433
|
+
Cn as useDriverStats,
|
|
2434
|
+
et as useLeaderboardIndex,
|
|
2435
|
+
Mn as useMarkAllNotificationsRead,
|
|
2436
|
+
$n as useMarkNotificationRead,
|
|
2437
|
+
Rn as useNotifications,
|
|
2438
|
+
Sn as useNotificationsEnabled,
|
|
2418
2439
|
k as usePitVox,
|
|
2419
|
-
|
|
2440
|
+
tt as useRecentLaps,
|
|
2420
2441
|
xe as useRegister,
|
|
2421
2442
|
ee as useRegistrationMode,
|
|
2422
2443
|
X as useRegistrationStatus,
|
|
2423
2444
|
ne as useRegistrationUrl,
|
|
2424
2445
|
Ve as useTrackLeaderboard,
|
|
2425
|
-
|
|
2426
|
-
|
|
2446
|
+
Nt as useUnreadCount,
|
|
2447
|
+
Tn as useUpcomingEvents,
|
|
2427
2448
|
ue as useUserLookup,
|
|
2428
2449
|
ge as useWithdraw
|
|
2429
2450
|
};
|