@pitvox/partner-react 0.7.6 → 0.7.8
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 +533 -511
- 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",
|
|
@@ -990,8 +999,19 @@ const Xe = {
|
|
|
990
999
|
}, se = ["🥇", "🥈", "🥉"], en = {
|
|
991
1000
|
championship: "Championship",
|
|
992
1001
|
series: "Series",
|
|
993
|
-
event: "Event"
|
|
994
|
-
|
|
1002
|
+
event: "Event",
|
|
1003
|
+
hotlap: "Hotlap"
|
|
1004
|
+
}, nn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1005
|
+
function oe(e) {
|
|
1006
|
+
const t = nn.indexOf(e);
|
|
1007
|
+
if (t >= 0) return t;
|
|
1008
|
+
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
1009
|
+
return r ? 100 + parseInt(r[1]) : 999;
|
|
1010
|
+
}
|
|
1011
|
+
function tn(e) {
|
|
1012
|
+
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1013
|
+
return t ? `P${t[1]}` : e;
|
|
1014
|
+
}
|
|
995
1015
|
function we({ position: e }) {
|
|
996
1016
|
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
1017
|
}
|
|
@@ -999,41 +1019,41 @@ function ae({ nation: e }) {
|
|
|
999
1019
|
const t = e && Xe[e];
|
|
1000
1020
|
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
1001
1021
|
}
|
|
1002
|
-
function
|
|
1022
|
+
function rn({ sessions: e, activeSession: t, onSelect: r }) {
|
|
1003
1023
|
if (!e || e.length <= 1) return null;
|
|
1004
|
-
const
|
|
1005
|
-
(a, i) => oe
|
|
1024
|
+
const s = [...e].sort(
|
|
1025
|
+
(a, i) => oe(a.type) - oe(i.type)
|
|
1006
1026
|
);
|
|
1007
|
-
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children:
|
|
1027
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
1008
1028
|
"button",
|
|
1009
1029
|
{
|
|
1010
|
-
onClick: () =>
|
|
1030
|
+
onClick: () => r(a.type),
|
|
1011
1031
|
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1012
|
-
children: a.type
|
|
1032
|
+
children: tn(a.type)
|
|
1013
1033
|
},
|
|
1014
1034
|
a.type
|
|
1015
1035
|
)) });
|
|
1016
1036
|
}
|
|
1017
|
-
function
|
|
1037
|
+
function sn({ type: e }) {
|
|
1018
1038
|
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: en[e] || e });
|
|
1019
1039
|
}
|
|
1020
1040
|
function Y({ children: e, variant: t = "default" }) {
|
|
1021
1041
|
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1022
1042
|
}
|
|
1023
|
-
function
|
|
1043
|
+
function an(e) {
|
|
1024
1044
|
if (!e) return "TBD";
|
|
1025
1045
|
const t = new Date(e);
|
|
1026
1046
|
if (isNaN(t)) return "TBD";
|
|
1027
|
-
const
|
|
1028
|
-
return `${
|
|
1029
|
-
}
|
|
1030
|
-
function
|
|
1031
|
-
return e.reduce((t,
|
|
1032
|
-
var
|
|
1033
|
-
return (
|
|
1034
|
-
const o =
|
|
1047
|
+
const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1048
|
+
return `${r} • ${s}`;
|
|
1049
|
+
}
|
|
1050
|
+
function on(e) {
|
|
1051
|
+
return e.reduce((t, r) => {
|
|
1052
|
+
var s;
|
|
1053
|
+
return (s = r.splits) != null && s.length ? t ? t.map((a, i) => {
|
|
1054
|
+
const o = r.splits[i];
|
|
1035
1055
|
return o && o < a ? o : a;
|
|
1036
|
-
}) : [...
|
|
1056
|
+
}) : [...r.splits] : t;
|
|
1037
1057
|
}, null);
|
|
1038
1058
|
}
|
|
1039
1059
|
function E({ message: e = "Loading..." }) {
|
|
@@ -1043,41 +1063,41 @@ function P({ message: e = "No data available." }) {
|
|
|
1043
1063
|
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1044
1064
|
}
|
|
1045
1065
|
const Ce = 3;
|
|
1046
|
-
function
|
|
1066
|
+
function cn(e) {
|
|
1047
1067
|
const t = e == null ? void 0 : e.rounds;
|
|
1048
|
-
return t != null && t.length ? t.every((
|
|
1068
|
+
return t != null && t.length ? t.every((r) => r.isFinalized) : !1;
|
|
1049
1069
|
}
|
|
1050
|
-
function
|
|
1070
|
+
function ln(e) {
|
|
1051
1071
|
const t = e == null ? void 0 : e.rounds;
|
|
1052
1072
|
if (!(t != null && t.length)) return null;
|
|
1053
|
-
let
|
|
1054
|
-
for (const
|
|
1055
|
-
if (!
|
|
1056
|
-
const a = new Date(
|
|
1057
|
-
isNaN(a) || (!
|
|
1073
|
+
let r = null;
|
|
1074
|
+
for (const s of t) {
|
|
1075
|
+
if (!s.startTime) continue;
|
|
1076
|
+
const a = new Date(s.startTime);
|
|
1077
|
+
isNaN(a) || (!r || a > r) && (r = a);
|
|
1058
1078
|
}
|
|
1059
|
-
return
|
|
1079
|
+
return r;
|
|
1060
1080
|
}
|
|
1061
1081
|
function Le(e, t = Ce) {
|
|
1062
|
-
if (!
|
|
1063
|
-
const
|
|
1064
|
-
if (!
|
|
1065
|
-
const
|
|
1066
|
-
return Date.now() -
|
|
1082
|
+
if (!cn(e)) return "active";
|
|
1083
|
+
const r = ln(e);
|
|
1084
|
+
if (!r) return "recently-completed";
|
|
1085
|
+
const s = t * 24 * 60 * 60 * 1e3;
|
|
1086
|
+
return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
|
|
1067
1087
|
}
|
|
1068
|
-
function
|
|
1088
|
+
function pt(e, t, r = Ce) {
|
|
1069
1089
|
if (!(e != null && e.length)) return [];
|
|
1070
|
-
const
|
|
1071
|
-
return e.filter((a) =>
|
|
1090
|
+
const s = new Set(Array.isArray(t) ? t : [t]);
|
|
1091
|
+
return e.filter((a) => s.has(Le(a, r)));
|
|
1072
1092
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const
|
|
1075
|
-
return Array.isArray(
|
|
1093
|
+
function dn(e, t = 3) {
|
|
1094
|
+
const r = e == null ? void 0 : e.standings;
|
|
1095
|
+
return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1076
1096
|
}
|
|
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:
|
|
1097
|
+
function pn({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
|
|
1098
|
+
const { data: a } = ve(e), i = dn(a, t);
|
|
1099
|
+
return /* @__PURE__ */ c("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
|
|
1100
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
|
|
1081
1101
|
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
1102
|
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: se[d] || "" }),
|
|
1083
1103
|
/* @__PURE__ */ n(ae, { nation: o.nation }),
|
|
@@ -1085,12 +1105,12 @@ function ln({ competitionId: e, topN: t = 3, label: s = "Completed", className:
|
|
|
1085
1105
|
] }, o.driverId || d)) })
|
|
1086
1106
|
] });
|
|
1087
1107
|
}
|
|
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(
|
|
1108
|
+
function ut({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
|
|
1109
|
+
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
1110
|
}
|
|
1091
|
-
function
|
|
1111
|
+
function un({ comp: e, onSelect: t, onRegister: r }) {
|
|
1092
1112
|
var h, y, C;
|
|
1093
|
-
const { cdnUrl:
|
|
1113
|
+
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
1114
|
return /* @__PURE__ */ c(
|
|
1095
1115
|
"div",
|
|
1096
1116
|
{
|
|
@@ -1102,12 +1122,12 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1102
1122
|
(w.key === "Enter" || w.key === " ") && (w.preventDefault(), t(e.id));
|
|
1103
1123
|
},
|
|
1104
1124
|
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(
|
|
1125
|
+
/* @__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
1126
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-body", children: [
|
|
1107
1127
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1108
1128
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1109
1129
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
|
|
1110
|
-
/* @__PURE__ */ n(
|
|
1130
|
+
/* @__PURE__ */ n(sn, { type: e.type }),
|
|
1111
1131
|
e.game && /* @__PURE__ */ n(Y, { children: e.game.toUpperCase() }),
|
|
1112
1132
|
e.formatDescription && e.formatDescription.split(", ").map((w, T) => /* @__PURE__ */ n(Y, { variant: "format", children: w }, T))
|
|
1113
1133
|
] }),
|
|
@@ -1121,7 +1141,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1121
1141
|
" ",
|
|
1122
1142
|
g.track || "TBD",
|
|
1123
1143
|
" — ",
|
|
1124
|
-
|
|
1144
|
+
an(g.startTime)
|
|
1125
1145
|
] }) : m > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1126
1146
|
b,
|
|
1127
1147
|
"/",
|
|
@@ -1134,9 +1154,9 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1134
1154
|
m !== 1 ? "s" : ""
|
|
1135
1155
|
] })
|
|
1136
1156
|
] }),
|
|
1137
|
-
v && N && /* @__PURE__ */ n(
|
|
1157
|
+
v && N && /* @__PURE__ */ n(pn, { competitionId: e.id }),
|
|
1138
1158
|
i && !v && /* @__PURE__ */ n(
|
|
1139
|
-
|
|
1159
|
+
mn,
|
|
1140
1160
|
{
|
|
1141
1161
|
competitionId: e.id,
|
|
1142
1162
|
regOpen: p,
|
|
@@ -1144,7 +1164,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1144
1164
|
deadlinePassed: l,
|
|
1145
1165
|
regCount: o,
|
|
1146
1166
|
regMax: d,
|
|
1147
|
-
onRegister:
|
|
1167
|
+
onRegister: r
|
|
1148
1168
|
}
|
|
1149
1169
|
)
|
|
1150
1170
|
] })
|
|
@@ -1152,7 +1172,7 @@ function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1152
1172
|
}
|
|
1153
1173
|
);
|
|
1154
1174
|
}
|
|
1155
|
-
function
|
|
1175
|
+
function mn({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
|
|
1156
1176
|
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
1177
|
return /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
|
|
1158
1178
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${g}`, children: [
|
|
@@ -1189,10 +1209,10 @@ function pn({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1189
1209
|
onClick: (m) => m.stopPropagation(),
|
|
1190
1210
|
children: "Register"
|
|
1191
1211
|
}
|
|
1192
|
-
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children:
|
|
1212
|
+
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
|
|
1193
1213
|
] });
|
|
1194
1214
|
}
|
|
1195
|
-
function
|
|
1215
|
+
function vn() {
|
|
1196
1216
|
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
1217
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1198
1218
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1202,12 +1222,12 @@ function un() {
|
|
|
1202
1222
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1203
1223
|
] });
|
|
1204
1224
|
}
|
|
1205
|
-
function
|
|
1225
|
+
function hn({ competitionId: e, className: t }) {
|
|
1206
1226
|
var d, u;
|
|
1207
|
-
const { data:
|
|
1208
|
-
if (
|
|
1227
|
+
const { data: r, isLoading: s } = ve(e), { data: a, isLoading: i } = me(e);
|
|
1228
|
+
if (s || i)
|
|
1209
1229
|
return /* @__PURE__ */ n(E, { message: "Loading standings..." });
|
|
1210
|
-
if (!((d =
|
|
1230
|
+
if (!((d = r == null ? void 0 : r.standings) != null && d.length))
|
|
1211
1231
|
return /* @__PURE__ */ n(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1212
1232
|
const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((l) => l.isFinalized)) || [];
|
|
1213
1233
|
return /* @__PURE__ */ c("div", { className: `pvx-card ${t || ""}`, children: [
|
|
@@ -1215,10 +1235,10 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1215
1235
|
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
1216
1236
|
/* @__PURE__ */ c("span", { className: "pvx-standings-subtitle", children: [
|
|
1217
1237
|
"After ",
|
|
1218
|
-
|
|
1238
|
+
r.roundsCompleted,
|
|
1219
1239
|
" round",
|
|
1220
|
-
|
|
1221
|
-
|
|
1240
|
+
r.roundsCompleted !== 1 ? "s" : "",
|
|
1241
|
+
r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
|
|
1222
1242
|
] })
|
|
1223
1243
|
] }) }),
|
|
1224
1244
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
@@ -1241,8 +1261,8 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1241
1261
|
l.roundNumber
|
|
1242
1262
|
))
|
|
1243
1263
|
] }) }),
|
|
1244
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1245
|
-
|
|
1264
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((l) => /* @__PURE__ */ n(
|
|
1265
|
+
xn,
|
|
1246
1266
|
{
|
|
1247
1267
|
driver: l,
|
|
1248
1268
|
finalizedRounds: o
|
|
@@ -1252,12 +1272,12 @@ function mn({ competitionId: e, className: t }) {
|
|
|
1252
1272
|
] }) })
|
|
1253
1273
|
] });
|
|
1254
1274
|
}
|
|
1255
|
-
function
|
|
1275
|
+
function xn({ driver: e, finalizedRounds: t }) {
|
|
1256
1276
|
var o, d, u;
|
|
1257
|
-
const
|
|
1277
|
+
const r = e.position <= 3, s = new Map(
|
|
1258
1278
|
((o = e.roundResults) == null ? void 0 : o.map((l) => [l.roundNumber, l])) || []
|
|
1259
1279
|
), 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 ${
|
|
1280
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
|
|
1261
1281
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(we, { position: e.position }) }),
|
|
1262
1282
|
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1263
1283
|
/* @__PURE__ */ n(ae, { nation: e.nation }),
|
|
@@ -1267,7 +1287,7 @@ function vn({ driver: e, finalizedRounds: t }) {
|
|
|
1267
1287
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1268
1288
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1269
1289
|
t.map((l) => {
|
|
1270
|
-
const p =
|
|
1290
|
+
const p = s.get(l.roundNumber), f = p == null ? void 0 : p.dropped;
|
|
1271
1291
|
return /* @__PURE__ */ n(
|
|
1272
1292
|
"td",
|
|
1273
1293
|
{
|
|
@@ -1285,23 +1305,23 @@ function vn({ driver: e, finalizedRounds: t }) {
|
|
|
1285
1305
|
})
|
|
1286
1306
|
] });
|
|
1287
1307
|
}
|
|
1288
|
-
function
|
|
1308
|
+
function mt({ competitionId: e, roundNumber: t, className: r }) {
|
|
1289
1309
|
var u;
|
|
1290
|
-
const { data:
|
|
1310
|
+
const { data: s, isLoading: a } = He(e, t);
|
|
1291
1311
|
if (a)
|
|
1292
1312
|
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1293
|
-
if (!
|
|
1313
|
+
if (!s)
|
|
1294
1314
|
return /* @__PURE__ */ n(P, { message: "No results for this round." });
|
|
1295
|
-
const o = (
|
|
1296
|
-
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${
|
|
1315
|
+
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);
|
|
1316
|
+
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${r || ""}`, children: [
|
|
1297
1317
|
/* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
|
|
1298
1318
|
/* @__PURE__ */ c("div", { children: [
|
|
1299
1319
|
/* @__PURE__ */ c("h4", { className: "pvx-round-results-title", children: [
|
|
1300
1320
|
"Round ",
|
|
1301
|
-
|
|
1302
|
-
|
|
1321
|
+
s.roundNumber,
|
|
1322
|
+
s.track ? `: ${s.track}` : ""
|
|
1303
1323
|
] }),
|
|
1304
|
-
|
|
1324
|
+
s.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
|
|
1305
1325
|
day: "numeric",
|
|
1306
1326
|
month: "long",
|
|
1307
1327
|
year: "numeric"
|
|
@@ -1312,44 +1332,44 @@ function dt({ competitionId: e, roundNumber: t, className: s }) {
|
|
|
1312
1332
|
/* @__PURE__ */ n("span", { children: l.driverName })
|
|
1313
1333
|
] }, l.driverId)) })
|
|
1314
1334
|
] }),
|
|
1315
|
-
/* @__PURE__ */ n(Te, { round:
|
|
1335
|
+
/* @__PURE__ */ n(Te, { round: s, competitionId: e })
|
|
1316
1336
|
] });
|
|
1317
1337
|
}
|
|
1318
|
-
function Te({ round: e, competitionId: t, className:
|
|
1338
|
+
function Te({ round: e, competitionId: t, className: r }) {
|
|
1319
1339
|
var p, f, g, m;
|
|
1320
|
-
const [
|
|
1340
|
+
const [s, a] = D(null), i = (e == null ? void 0 : e.sessions) || [];
|
|
1321
1341
|
if (!i.length)
|
|
1322
1342
|
return /* @__PURE__ */ n(P, { message: "No session data for this round." });
|
|
1323
1343
|
const { data: o } = We(
|
|
1324
1344
|
t,
|
|
1325
1345
|
e == null ? void 0 : e.roundNumber,
|
|
1326
1346
|
{}
|
|
1327
|
-
), d =
|
|
1328
|
-
return /* @__PURE__ */ c("div", { className:
|
|
1347
|
+
), 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;
|
|
1348
|
+
return /* @__PURE__ */ c("div", { className: r || "", children: [
|
|
1329
1349
|
/* @__PURE__ */ n(
|
|
1330
|
-
|
|
1350
|
+
rn,
|
|
1331
1351
|
{
|
|
1332
1352
|
sessions: i,
|
|
1333
1353
|
activeSession: d,
|
|
1334
1354
|
onSelect: a
|
|
1335
1355
|
}
|
|
1336
1356
|
),
|
|
1337
|
-
/* @__PURE__ */ n(
|
|
1357
|
+
/* @__PURE__ */ n(gn, { session: u, sessionLaps: l })
|
|
1338
1358
|
] });
|
|
1339
1359
|
}
|
|
1340
|
-
function
|
|
1360
|
+
function gn({ session: e, sessionLaps: t }) {
|
|
1341
1361
|
var d;
|
|
1342
|
-
const
|
|
1362
|
+
const r = e.type === "RACE", [s, a] = D(null);
|
|
1343
1363
|
if (!((d = e.results) != null && d.length))
|
|
1344
1364
|
return /* @__PURE__ */ n(P, { message: `No results for ${e.type}.` });
|
|
1345
|
-
const i =
|
|
1365
|
+
const i = on(e.results), o = r ? 7 : 4;
|
|
1346
1366
|
return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
1347
1367
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1348
1368
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1349
1369
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1350
1370
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1351
1371
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1352
|
-
|
|
1372
|
+
r && /* @__PURE__ */ c(U, { children: [
|
|
1353
1373
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1354
1374
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1355
1375
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
@@ -1357,12 +1377,12 @@ function hn({ session: e, sessionLaps: t }) {
|
|
|
1357
1377
|
] }) }),
|
|
1358
1378
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((u, l) => {
|
|
1359
1379
|
var g;
|
|
1360
|
-
const p = (g = t == null ? void 0 : t[u.driverId]) == null ? void 0 : g.laps, f =
|
|
1380
|
+
const p = (g = t == null ? void 0 : t[u.driverId]) == null ? void 0 : g.laps, f = s === u.driverId && !!p;
|
|
1361
1381
|
return /* @__PURE__ */ n(
|
|
1362
|
-
|
|
1382
|
+
fn,
|
|
1363
1383
|
{
|
|
1364
1384
|
result: u,
|
|
1365
|
-
isRace:
|
|
1385
|
+
isRace: r,
|
|
1366
1386
|
fastestSplits: i,
|
|
1367
1387
|
rowIndex: l,
|
|
1368
1388
|
hasLapDetail: !!p,
|
|
@@ -1376,7 +1396,7 @@ function hn({ session: e, sessionLaps: t }) {
|
|
|
1376
1396
|
}) })
|
|
1377
1397
|
] }) });
|
|
1378
1398
|
}
|
|
1379
|
-
function
|
|
1399
|
+
function fn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: u }) {
|
|
1380
1400
|
const l = e.position <= 3;
|
|
1381
1401
|
return /* @__PURE__ */ c(U, { children: [
|
|
1382
1402
|
/* @__PURE__ */ c(
|
|
@@ -1398,13 +1418,13 @@ function xn({ result: e, isRace: t, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1398
1418
|
] }),
|
|
1399
1419
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1400
1420
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1401
|
-
|
|
1421
|
+
bn,
|
|
1402
1422
|
{
|
|
1403
1423
|
bestLap: e.bestLapFormatted,
|
|
1404
1424
|
hasBestLap: e.hasBestLap,
|
|
1405
1425
|
splits: e.splits,
|
|
1406
|
-
fastestSplits:
|
|
1407
|
-
showAbove:
|
|
1426
|
+
fastestSplits: r,
|
|
1427
|
+
showAbove: s <= 1
|
|
1408
1428
|
}
|
|
1409
1429
|
) }),
|
|
1410
1430
|
t && /* @__PURE__ */ c(U, { children: [
|
|
@@ -1423,11 +1443,11 @@ function xn({ result: e, isRace: t, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1423
1443
|
]
|
|
1424
1444
|
}
|
|
1425
1445
|
),
|
|
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(
|
|
1446
|
+
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
1447
|
] });
|
|
1428
1448
|
}
|
|
1429
|
-
function
|
|
1430
|
-
const t = Math.min(...e.filter((
|
|
1449
|
+
function Nn({ laps: e }) {
|
|
1450
|
+
const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
|
|
1431
1451
|
return /* @__PURE__ */ c("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1432
1452
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1433
1453
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
@@ -1436,23 +1456,23 @@ function gn({ laps: e }) {
|
|
|
1436
1456
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1437
1457
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1438
1458
|
] }) }),
|
|
1439
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((
|
|
1459
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((r) => {
|
|
1440
1460
|
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
|
-
] },
|
|
1461
|
+
const s = r.valid && r.timeMs === t;
|
|
1462
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
|
|
1463
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
|
|
1464
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
|
|
1465
|
+
(r.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
|
|
1466
|
+
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}`))
|
|
1467
|
+
] }, r.lap);
|
|
1448
1468
|
}) })
|
|
1449
1469
|
] });
|
|
1450
1470
|
}
|
|
1451
|
-
function
|
|
1471
|
+
function bn({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
|
|
1452
1472
|
return e ? /* @__PURE__ */ c("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1453
1473
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1454
|
-
(
|
|
1455
|
-
const d =
|
|
1474
|
+
(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) => {
|
|
1475
|
+
const d = s && i === s[o];
|
|
1456
1476
|
return /* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1457
1477
|
/* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1458
1478
|
"S",
|
|
@@ -1463,11 +1483,11 @@ function fn({ bestLap: e, hasBestLap: t, splits: s, fastestSplits: r, showAbove:
|
|
|
1463
1483
|
}) }) })
|
|
1464
1484
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1465
1485
|
}
|
|
1466
|
-
function
|
|
1467
|
-
const { getSteamId:
|
|
1486
|
+
function vt({ competitionId: e, className: t }) {
|
|
1487
|
+
const { getSteamId: r } = k(), { data: s, isLoading: a } = he(e), i = r();
|
|
1468
1488
|
if (a)
|
|
1469
1489
|
return /* @__PURE__ */ n(E, { message: "Loading drivers..." });
|
|
1470
|
-
const o = (
|
|
1490
|
+
const o = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
|
|
1471
1491
|
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
|
|
1472
1492
|
var l, p;
|
|
1473
1493
|
const u = i && d.steamId === i;
|
|
@@ -1487,21 +1507,21 @@ function pt({ competitionId: e, className: t }) {
|
|
|
1487
1507
|
] }, d.steamId || d.driverId);
|
|
1488
1508
|
}) }) : /* @__PURE__ */ n(P, { message: "No drivers registered yet." });
|
|
1489
1509
|
}
|
|
1490
|
-
function
|
|
1510
|
+
function ht({
|
|
1491
1511
|
competitionId: e,
|
|
1492
1512
|
driverData: t,
|
|
1493
|
-
className:
|
|
1494
|
-
children:
|
|
1513
|
+
className: r,
|
|
1514
|
+
children: s
|
|
1495
1515
|
}) {
|
|
1496
1516
|
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
1517
|
o && u.mutate(t || {});
|
|
1498
1518
|
}, b = () => {
|
|
1499
1519
|
o && l.mutate();
|
|
1500
1520
|
};
|
|
1501
|
-
return typeof
|
|
1521
|
+
return typeof s == "function" ? s({ isRegistered: p, isLoading: f, register: m, withdraw: b, error: g, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
|
|
1502
1522
|
"button",
|
|
1503
1523
|
{
|
|
1504
|
-
className: `pvx-comp-register-btn ${
|
|
1524
|
+
className: `pvx-comp-register-btn ${r || ""}`,
|
|
1505
1525
|
onClick: p ? b : m,
|
|
1506
1526
|
disabled: f,
|
|
1507
1527
|
children: f ? "Loading..." : p ? "Withdraw" : "Register"
|
|
@@ -1512,15 +1532,15 @@ function ut({
|
|
|
1512
1532
|
href: d,
|
|
1513
1533
|
target: "_blank",
|
|
1514
1534
|
rel: "noopener noreferrer",
|
|
1515
|
-
className: `pvx-comp-register-link ${
|
|
1535
|
+
className: `pvx-comp-register-link ${r || ""}`,
|
|
1516
1536
|
children: p ? "View Registration" : "Register on PitVox"
|
|
1517
1537
|
}
|
|
1518
1538
|
);
|
|
1519
1539
|
}
|
|
1520
|
-
function
|
|
1540
|
+
function xt({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
|
|
1521
1541
|
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
|
-
|
|
1542
|
+
return u || p ? /* @__PURE__ */ n(E, { message: "Loading registration..." }) : b ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1543
|
+
kn,
|
|
1524
1544
|
{
|
|
1525
1545
|
competitionId: e,
|
|
1526
1546
|
drivers: x,
|
|
@@ -1528,33 +1548,33 @@ function mt({ competitionId: e, registration: t, onWithdrawSuccess: s, className
|
|
|
1528
1548
|
isPowerMode: i,
|
|
1529
1549
|
registrationUrl: o,
|
|
1530
1550
|
withdrawMutation: g,
|
|
1531
|
-
onWithdrawSuccess:
|
|
1551
|
+
onWithdrawSuccess: r,
|
|
1532
1552
|
registration: v
|
|
1533
1553
|
}
|
|
1534
|
-
) }) : C ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1535
|
-
|
|
1554
|
+
) }) : C ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1555
|
+
yn,
|
|
1536
1556
|
{
|
|
1537
1557
|
competitionId: e,
|
|
1538
1558
|
registerMutation: f,
|
|
1539
1559
|
registration: v
|
|
1540
1560
|
}
|
|
1541
|
-
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1561
|
+
) }) : /* @__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
1562
|
/* @__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(
|
|
1563
|
+
x.length > 0 && /* @__PURE__ */ n(Se, { drivers: x, steamId: m })
|
|
1544
1564
|
] });
|
|
1545
1565
|
}
|
|
1546
|
-
function
|
|
1547
|
-
const [
|
|
1566
|
+
function yn({ competitionId: e, registerMutation: t, registration: r }) {
|
|
1567
|
+
const [s, a] = D(""), [i, o] = D("intermediate"), [d, u] = D(""), l = (m) => {
|
|
1548
1568
|
m.preventDefault(), t.mutate({
|
|
1549
|
-
discordUsername:
|
|
1569
|
+
discordUsername: s || void 0,
|
|
1550
1570
|
experience: i,
|
|
1551
1571
|
comments: d || void 0
|
|
1552
1572
|
});
|
|
1553
|
-
}, p =
|
|
1573
|
+
}, p = r || {}, f = p.currentCount || 0, g = p.maxParticipants;
|
|
1554
1574
|
return /* @__PURE__ */ c("form", { className: "pvx-reg-form", onSubmit: l, children: [
|
|
1555
1575
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1556
1576
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1557
|
-
g && /* @__PURE__ */ n(
|
|
1577
|
+
g && /* @__PURE__ */ n(Re, { count: f, max: g })
|
|
1558
1578
|
] }),
|
|
1559
1579
|
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1560
1580
|
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
@@ -1569,7 +1589,7 @@ function Nn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1569
1589
|
type: "text",
|
|
1570
1590
|
className: "pvx-reg-input",
|
|
1571
1591
|
placeholder: "e.g. username",
|
|
1572
|
-
value:
|
|
1592
|
+
value: s,
|
|
1573
1593
|
onChange: (m) => a(m.target.value)
|
|
1574
1594
|
}
|
|
1575
1595
|
)
|
|
@@ -1619,7 +1639,7 @@ function Nn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1619
1639
|
) })
|
|
1620
1640
|
] });
|
|
1621
1641
|
}
|
|
1622
|
-
function
|
|
1642
|
+
function kn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1623
1643
|
const [u, l] = D(!1), p = () => {
|
|
1624
1644
|
i.mutate(void 0, {
|
|
1625
1645
|
onSuccess: () => {
|
|
@@ -1630,11 +1650,11 @@ function bn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1630
1650
|
return /* @__PURE__ */ c(U, { children: [
|
|
1631
1651
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1632
1652
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1633
|
-
m && /* @__PURE__ */ n(
|
|
1653
|
+
m && /* @__PURE__ */ n(Re, { count: g, max: m })
|
|
1634
1654
|
] }),
|
|
1635
|
-
/* @__PURE__ */ n(
|
|
1655
|
+
/* @__PURE__ */ n(Se, { drivers: t, steamId: r }),
|
|
1636
1656
|
i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1637
|
-
|
|
1657
|
+
s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ c("div", { className: "pvx-reg-confirm", children: [
|
|
1638
1658
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1639
1659
|
/* @__PURE__ */ c("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1640
1660
|
/* @__PURE__ */ n(
|
|
@@ -1668,48 +1688,48 @@ function bn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1668
1688
|
) }) : /* @__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
1689
|
] });
|
|
1670
1690
|
}
|
|
1671
|
-
function
|
|
1691
|
+
function Se({ drivers: e, steamId: t }) {
|
|
1672
1692
|
if (!e.length)
|
|
1673
1693
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1674
|
-
const
|
|
1675
|
-
const i = t &&
|
|
1694
|
+
const r = [...e].sort((s, a) => {
|
|
1695
|
+
const i = t && s.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
|
|
1676
1696
|
return i - o;
|
|
1677
1697
|
});
|
|
1678
|
-
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children:
|
|
1698
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
|
|
1679
1699
|
var i, o;
|
|
1680
|
-
const a = t &&
|
|
1700
|
+
const a = t && s.steamId === t;
|
|
1681
1701
|
return /* @__PURE__ */ c(
|
|
1682
1702
|
"div",
|
|
1683
1703
|
{
|
|
1684
1704
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1685
1705
|
children: [
|
|
1686
|
-
|
|
1706
|
+
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
1707
|
/* @__PURE__ */ c("span", { className: "pvx-reg-driver-name", children: [
|
|
1688
|
-
|
|
1708
|
+
s.displayName,
|
|
1689
1709
|
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1690
1710
|
] })
|
|
1691
1711
|
]
|
|
1692
1712
|
},
|
|
1693
|
-
|
|
1713
|
+
s.steamId || s.driverId
|
|
1694
1714
|
);
|
|
1695
1715
|
}) });
|
|
1696
1716
|
}
|
|
1697
|
-
function
|
|
1698
|
-
const
|
|
1699
|
-
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
1717
|
+
function Re({ count: e, max: t }) {
|
|
1718
|
+
const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
|
|
1719
|
+
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
|
|
1700
1720
|
e,
|
|
1701
1721
|
"/",
|
|
1702
1722
|
t,
|
|
1703
1723
|
" drivers"
|
|
1704
1724
|
] });
|
|
1705
1725
|
}
|
|
1706
|
-
function
|
|
1707
|
-
const { data:
|
|
1726
|
+
function gt({ competitionId: e, className: t }) {
|
|
1727
|
+
const { data: r, isLoading: s } = me(e), a = (r == null ? void 0 : r.type) === "championship", i = L(
|
|
1708
1728
|
() => {
|
|
1709
1729
|
var v;
|
|
1710
|
-
return ((v =
|
|
1730
|
+
return ((v = r == null ? void 0 : r.rounds) == null ? void 0 : v.filter((N) => N.isFinalized)) || [];
|
|
1711
1731
|
},
|
|
1712
|
-
[
|
|
1732
|
+
[r]
|
|
1713
1733
|
), o = L(
|
|
1714
1734
|
() => i.map((v) => v.roundNumber),
|
|
1715
1735
|
[i]
|
|
@@ -1717,9 +1737,9 @@ function vt({ competitionId: e, className: t }) {
|
|
|
1717
1737
|
e,
|
|
1718
1738
|
o
|
|
1719
1739
|
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [p, f] = D(null), g = p || l;
|
|
1720
|
-
if (
|
|
1740
|
+
if (s || u)
|
|
1721
1741
|
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1722
|
-
if (!
|
|
1742
|
+
if (!r)
|
|
1723
1743
|
return /* @__PURE__ */ n(P, { message: "Competition not found." });
|
|
1724
1744
|
if (!i.length)
|
|
1725
1745
|
return /* @__PURE__ */ n(P, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
@@ -1746,12 +1766,12 @@ function vt({ competitionId: e, className: t }) {
|
|
|
1746
1766
|
},
|
|
1747
1767
|
v.id
|
|
1748
1768
|
)) }),
|
|
1749
|
-
g === "standings" ? /* @__PURE__ */ n(
|
|
1769
|
+
g === "standings" ? /* @__PURE__ */ n(hn, { competitionId: e }) : x ? /* @__PURE__ */ n(wn, { round: x }) : /* @__PURE__ */ n(P, { message: "No results for this round." })
|
|
1750
1770
|
] });
|
|
1751
1771
|
}
|
|
1752
|
-
function
|
|
1772
|
+
function wn({ round: e }) {
|
|
1753
1773
|
var a;
|
|
1754
|
-
const
|
|
1774
|
+
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
1775
|
return /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
1756
1776
|
/* @__PURE__ */ c("div", { className: "pvx-card-header--split", children: [
|
|
1757
1777
|
/* @__PURE__ */ c("div", { children: [
|
|
@@ -1766,7 +1786,7 @@ function yn({ round: e }) {
|
|
|
1766
1786
|
year: "numeric"
|
|
1767
1787
|
}) })
|
|
1768
1788
|
] }),
|
|
1769
|
-
(
|
|
1789
|
+
(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
1790
|
/* @__PURE__ */ n("span", { children: se[i.position - 1] }),
|
|
1771
1791
|
/* @__PURE__ */ n("span", { children: i.driverName })
|
|
1772
1792
|
] }, i.driverId)) })
|
|
@@ -1774,64 +1794,64 @@ function yn({ round: e }) {
|
|
|
1774
1794
|
/* @__PURE__ */ n(Te, { round: e })
|
|
1775
1795
|
] });
|
|
1776
1796
|
}
|
|
1777
|
-
function
|
|
1778
|
-
const { cdnUrl: t } = k(),
|
|
1797
|
+
function Cn(e) {
|
|
1798
|
+
const { cdnUrl: t } = k(), r = S({
|
|
1779
1799
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
1780
|
-
queryFn: () =>
|
|
1800
|
+
queryFn: () => R(t, _e(null, e)),
|
|
1781
1801
|
enabled: !!e,
|
|
1782
1802
|
staleTime: 3e4,
|
|
1783
1803
|
refetchInterval: 3e4
|
|
1784
|
-
}),
|
|
1804
|
+
}), s = r.data;
|
|
1785
1805
|
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:
|
|
1806
|
+
isLoading: r.isLoading,
|
|
1807
|
+
error: r.error,
|
|
1808
|
+
data: s ? {
|
|
1809
|
+
driverName: s.driverName || "Driver",
|
|
1810
|
+
lapCount: s.lapCount || 0,
|
|
1811
|
+
trackBreakdown: s.trackBreakdown || [],
|
|
1812
|
+
carBreakdown: s.carBreakdown || [],
|
|
1813
|
+
recordsHeld: s.recordsHeld || 0,
|
|
1814
|
+
currentRecords: s.currentRecords || [],
|
|
1815
|
+
bestRanking: s.bestRanking ?? null,
|
|
1816
|
+
bestRankingTrackId: s.bestRankingTrackId ?? null,
|
|
1817
|
+
bestRankingLayout: s.bestRankingLayout ?? null,
|
|
1818
|
+
bestRankingCarId: s.bestRankingCarId ?? null,
|
|
1819
|
+
generatedAt: s.generatedAt
|
|
1800
1820
|
} : null
|
|
1801
1821
|
};
|
|
1802
1822
|
}
|
|
1803
1823
|
function $e(e = {}) {
|
|
1804
|
-
const { cdnUrl: t, partnerSlug:
|
|
1805
|
-
return
|
|
1806
|
-
queryKey: ["pitvox", "ratings",
|
|
1807
|
-
queryFn: () =>
|
|
1824
|
+
const { cdnUrl: t, partnerSlug: r } = k(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = Z(r, s, a, "ratings.json");
|
|
1825
|
+
return S({
|
|
1826
|
+
queryKey: ["pitvox", "ratings", r, s || null, a || null],
|
|
1827
|
+
queryFn: () => R(t, o),
|
|
1808
1828
|
staleTime: 3e4,
|
|
1809
1829
|
refetchInterval: 3e4,
|
|
1810
1830
|
enabled: i
|
|
1811
1831
|
});
|
|
1812
1832
|
}
|
|
1813
|
-
function
|
|
1814
|
-
var
|
|
1815
|
-
const t = $e(),
|
|
1833
|
+
function Ln(e) {
|
|
1834
|
+
var s;
|
|
1835
|
+
const t = $e(), r = L(() => {
|
|
1816
1836
|
var a;
|
|
1817
1837
|
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
1818
1838
|
(i) => i.identifier === e
|
|
1819
1839
|
) || null;
|
|
1820
|
-
}, [(
|
|
1840
|
+
}, [(s = t.data) == null ? void 0 : s.drivers, e]);
|
|
1821
1841
|
return {
|
|
1822
1842
|
isLoading: t.isLoading,
|
|
1823
1843
|
error: t.error,
|
|
1824
|
-
data:
|
|
1825
|
-
rating:
|
|
1826
|
-
rank:
|
|
1844
|
+
data: r ? {
|
|
1845
|
+
rating: r.rating,
|
|
1846
|
+
rank: r.rank,
|
|
1827
1847
|
totalDrivers: t.data.driverCount || t.data.drivers.length,
|
|
1828
|
-
comboCount:
|
|
1829
|
-
distinctCars:
|
|
1830
|
-
combos:
|
|
1848
|
+
comboCount: r.comboCount || 0,
|
|
1849
|
+
distinctCars: r.distinctCars || 0,
|
|
1850
|
+
combos: r.combos || []
|
|
1831
1851
|
} : null
|
|
1832
1852
|
};
|
|
1833
1853
|
}
|
|
1834
|
-
function
|
|
1854
|
+
function ft(e = {}) {
|
|
1835
1855
|
const t = $e(e);
|
|
1836
1856
|
return {
|
|
1837
1857
|
data: t.data || null,
|
|
@@ -1839,18 +1859,18 @@ function ht(e = {}) {
|
|
|
1839
1859
|
error: t.error
|
|
1840
1860
|
};
|
|
1841
1861
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const { cdnUrl: e, partnerSlug: t, getSteamId:
|
|
1862
|
+
function Tn() {
|
|
1863
|
+
const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = k(), a = r(), { data: i, isLoading: o } = S({
|
|
1844
1864
|
queryKey: ["pitvox", "competitions", t],
|
|
1845
1865
|
queryFn: async () => {
|
|
1846
|
-
const m = await
|
|
1866
|
+
const m = await R(e, "competitions/index.json");
|
|
1847
1867
|
return m != null && m.competitions ? m.competitions.filter((b) => b.partnerSlug === t) : [];
|
|
1848
1868
|
},
|
|
1849
1869
|
staleTime: 6e4
|
|
1850
1870
|
}), d = (i == null ? void 0 : i.map((m) => m.id)) || [], u = ie({
|
|
1851
1871
|
queries: d.map((m) => ({
|
|
1852
1872
|
queryKey: ["pitvox", "competition", t, m, "entrylist"],
|
|
1853
|
-
queryFn: () =>
|
|
1873
|
+
queryFn: () => R(e, `competitions/${t}/${m}/entrylist.json`),
|
|
1854
1874
|
enabled: !!a && d.length > 0,
|
|
1855
1875
|
staleTime: 6e4
|
|
1856
1876
|
}))
|
|
@@ -1875,15 +1895,15 @@ function Cn() {
|
|
|
1875
1895
|
}, [i, a, l, u]), f = ie({
|
|
1876
1896
|
queries: p.map((m) => ({
|
|
1877
1897
|
queryKey: ["pitvox", "serverInfo", m.competitionId, m.roundNumber],
|
|
1878
|
-
queryFn: () =>
|
|
1879
|
-
enabled: !!
|
|
1898
|
+
queryFn: () => s(m.competitionId, m.roundNumber),
|
|
1899
|
+
enabled: !!s && p.length > 0,
|
|
1880
1900
|
staleTime: 5 * 6e4,
|
|
1881
1901
|
// 5 minutes
|
|
1882
1902
|
retry: !1
|
|
1883
1903
|
}))
|
|
1884
1904
|
});
|
|
1885
1905
|
return {
|
|
1886
|
-
data: L(() => p.length ?
|
|
1906
|
+
data: L(() => p.length ? s ? p.map((m, b) => {
|
|
1887
1907
|
var v;
|
|
1888
1908
|
const x = (v = f[b]) == null ? void 0 : v.data;
|
|
1889
1909
|
return x != null && x.success ? {
|
|
@@ -1891,26 +1911,26 @@ function Cn() {
|
|
|
1891
1911
|
serverAddress: x.serverAddress || null,
|
|
1892
1912
|
serverPassword: x.serverPassword || null
|
|
1893
1913
|
} : m;
|
|
1894
|
-
}) : p : [], [p,
|
|
1914
|
+
}) : p : [], [p, s, f]),
|
|
1895
1915
|
isLoading: o || !!a && l
|
|
1896
1916
|
};
|
|
1897
1917
|
}
|
|
1898
|
-
function
|
|
1918
|
+
function Sn() {
|
|
1899
1919
|
const { onFetchNotifications: e } = k();
|
|
1900
1920
|
return !!e;
|
|
1901
1921
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const { onFetchNotifications: t, partnerSlug:
|
|
1904
|
-
return
|
|
1905
|
-
queryKey: ["pitvox", "notifications",
|
|
1906
|
-
queryFn: () => t({ limit:
|
|
1922
|
+
function Rn(e = {}) {
|
|
1923
|
+
const { onFetchNotifications: t, partnerSlug: r } = k(), { limit: s = 20, unreadOnly: a = !1 } = e;
|
|
1924
|
+
return S({
|
|
1925
|
+
queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
|
|
1926
|
+
queryFn: () => t({ limit: s, unreadOnly: a }),
|
|
1907
1927
|
enabled: !!t,
|
|
1908
1928
|
staleTime: 3e4,
|
|
1909
1929
|
refetchInterval: 3e4
|
|
1910
1930
|
});
|
|
1911
1931
|
}
|
|
1912
|
-
function
|
|
1913
|
-
const { onFetchNotifications: e, partnerSlug: t } = k(), { data:
|
|
1932
|
+
function Nt() {
|
|
1933
|
+
const { onFetchNotifications: e, partnerSlug: t } = k(), { data: r, isLoading: s } = S({
|
|
1914
1934
|
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
1915
1935
|
queryFn: () => e({ limit: 1 }),
|
|
1916
1936
|
enabled: !!e,
|
|
@@ -1918,18 +1938,18 @@ function xt() {
|
|
|
1918
1938
|
refetchInterval: 3e4,
|
|
1919
1939
|
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
1920
1940
|
});
|
|
1921
|
-
return { count:
|
|
1941
|
+
return { count: r ?? 0, isLoading: s };
|
|
1922
1942
|
}
|
|
1923
|
-
function
|
|
1924
|
-
const { onMarkNotificationRead: e, partnerSlug: t } = k(),
|
|
1943
|
+
function $n() {
|
|
1944
|
+
const { onMarkNotificationRead: e, partnerSlug: t } = k(), r = _();
|
|
1925
1945
|
return O({
|
|
1926
|
-
mutationFn: (
|
|
1946
|
+
mutationFn: (s) => {
|
|
1927
1947
|
if (!e)
|
|
1928
1948
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
1929
|
-
return e(
|
|
1949
|
+
return e(s);
|
|
1930
1950
|
},
|
|
1931
|
-
onSuccess: (
|
|
1932
|
-
|
|
1951
|
+
onSuccess: (s, a) => {
|
|
1952
|
+
r.setQueriesData(
|
|
1933
1953
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
1934
1954
|
(i) => i != null && i.notifications ? {
|
|
1935
1955
|
...i,
|
|
@@ -1942,8 +1962,8 @@ function Rn() {
|
|
|
1942
1962
|
}
|
|
1943
1963
|
});
|
|
1944
1964
|
}
|
|
1945
|
-
function
|
|
1946
|
-
const { onMarkAllNotificationsRead: e, partnerSlug: t } = k(),
|
|
1965
|
+
function Mn() {
|
|
1966
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: t } = k(), r = _();
|
|
1947
1967
|
return O({
|
|
1948
1968
|
mutationFn: () => {
|
|
1949
1969
|
if (!e)
|
|
@@ -1951,24 +1971,24 @@ function Sn() {
|
|
|
1951
1971
|
return e();
|
|
1952
1972
|
},
|
|
1953
1973
|
onSuccess: () => {
|
|
1954
|
-
|
|
1974
|
+
r.setQueriesData(
|
|
1955
1975
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
1956
|
-
(
|
|
1957
|
-
...
|
|
1976
|
+
(s) => s != null && s.notifications ? {
|
|
1977
|
+
...s,
|
|
1958
1978
|
unreadCount: 0,
|
|
1959
|
-
notifications:
|
|
1979
|
+
notifications: s.notifications.map((a) => ({
|
|
1960
1980
|
...a,
|
|
1961
1981
|
isRead: !0,
|
|
1962
1982
|
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1963
1983
|
}))
|
|
1964
|
-
} :
|
|
1984
|
+
} : s
|
|
1965
1985
|
);
|
|
1966
1986
|
}
|
|
1967
1987
|
});
|
|
1968
1988
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const a =
|
|
1971
|
-
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${
|
|
1989
|
+
function Dn({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
1990
|
+
const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
1991
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
|
|
1972
1992
|
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
1993
|
/* @__PURE__ */ c("div", { className: "pvx-dash-profile-info", children: [
|
|
1974
1994
|
/* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
@@ -1979,7 +1999,7 @@ function $n({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" })
|
|
|
1979
1999
|
] })
|
|
1980
2000
|
] });
|
|
1981
2001
|
}
|
|
1982
|
-
function
|
|
2002
|
+
function In() {
|
|
1983
2003
|
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
2004
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
1985
2005
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -1987,7 +2007,7 @@ function Mn() {
|
|
|
1987
2007
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
1988
2008
|
] });
|
|
1989
2009
|
}
|
|
1990
|
-
function
|
|
2010
|
+
function Bn() {
|
|
1991
2011
|
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
2012
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1993
2013
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -1996,10 +2016,10 @@ function Dn() {
|
|
|
1996
2016
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
1997
2017
|
] });
|
|
1998
2018
|
}
|
|
1999
|
-
function
|
|
2019
|
+
function Pn() {
|
|
2000
2020
|
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
2021
|
}
|
|
2002
|
-
function ce({ icon: e, value: t, label:
|
|
2022
|
+
function ce({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: i }) {
|
|
2003
2023
|
const [o, d] = D(!1), u = Ie(null);
|
|
2004
2024
|
Be(() => {
|
|
2005
2025
|
if (!o) return;
|
|
@@ -2008,7 +2028,7 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2008
2028
|
}
|
|
2009
2029
|
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
2010
2030
|
}, [o]);
|
|
2011
|
-
const l =
|
|
2031
|
+
const l = s != null && s.length ? s.slice().sort((p, f) => f[i] - p[i]) : null;
|
|
2012
2032
|
return /* @__PURE__ */ c(
|
|
2013
2033
|
"div",
|
|
2014
2034
|
{
|
|
@@ -2019,7 +2039,7 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2019
2039
|
e,
|
|
2020
2040
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
2021
2041
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
2022
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children:
|
|
2042
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
|
|
2023
2043
|
] }),
|
|
2024
2044
|
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
2045
|
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: p[a] }),
|
|
@@ -2029,23 +2049,23 @@ function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2029
2049
|
}
|
|
2030
2050
|
);
|
|
2031
2051
|
}
|
|
2032
|
-
function
|
|
2052
|
+
function An({ stats: e, rating: t, className: r = "" }) {
|
|
2033
2053
|
if (!e) return null;
|
|
2034
|
-
const
|
|
2054
|
+
const s = e.trackBreakdown.map((i) => ({
|
|
2035
2055
|
name: q(i.trackId, i.layout),
|
|
2036
2056
|
lapCount: i.lapCount
|
|
2037
2057
|
})), a = e.carBreakdown.map((i) => ({
|
|
2038
2058
|
name: I(i.carId),
|
|
2039
2059
|
lapCount: i.lapCount
|
|
2040
2060
|
}));
|
|
2041
|
-
return /* @__PURE__ */ c("div", { className: `pvx-dash-stats ${
|
|
2061
|
+
return /* @__PURE__ */ c("div", { className: `pvx-dash-stats ${r}`, children: [
|
|
2042
2062
|
/* @__PURE__ */ n(
|
|
2043
2063
|
ce,
|
|
2044
2064
|
{
|
|
2045
|
-
icon: /* @__PURE__ */ n(
|
|
2065
|
+
icon: /* @__PURE__ */ n(In, {}),
|
|
2046
2066
|
value: e.lapCount.toLocaleString(),
|
|
2047
2067
|
label: "Total Laps",
|
|
2048
|
-
items:
|
|
2068
|
+
items: s,
|
|
2049
2069
|
labelKey: "name",
|
|
2050
2070
|
countKey: "lapCount"
|
|
2051
2071
|
}
|
|
@@ -2053,7 +2073,7 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2053
2073
|
/* @__PURE__ */ n(
|
|
2054
2074
|
ce,
|
|
2055
2075
|
{
|
|
2056
|
-
icon: /* @__PURE__ */ n(
|
|
2076
|
+
icon: /* @__PURE__ */ n(Bn, {}),
|
|
2057
2077
|
value: e.carBreakdown.length,
|
|
2058
2078
|
label: "Cars Used",
|
|
2059
2079
|
items: a,
|
|
@@ -2062,7 +2082,7 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2062
2082
|
}
|
|
2063
2083
|
),
|
|
2064
2084
|
t && /* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2065
|
-
/* @__PURE__ */ n(
|
|
2085
|
+
/* @__PURE__ */ n(Pn, {}),
|
|
2066
2086
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
2067
2087
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t.rating.toFixed(1) }),
|
|
2068
2088
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
@@ -2076,12 +2096,12 @@ function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2076
2096
|
] })
|
|
2077
2097
|
] });
|
|
2078
2098
|
}
|
|
2079
|
-
function
|
|
2080
|
-
const
|
|
2081
|
-
const i =
|
|
2099
|
+
function Un({ records: e, className: t = "" }) {
|
|
2100
|
+
const r = L(() => e != null && e.length ? e.slice().sort((s, a) => {
|
|
2101
|
+
const i = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
|
|
2082
2102
|
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
2083
2103
|
}) : [], [e]);
|
|
2084
|
-
return
|
|
2104
|
+
return r.length ? /* @__PURE__ */ c("div", { className: `pvx-card ${t}`, children: [
|
|
2085
2105
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2086
2106
|
/* @__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
2107
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
@@ -2094,34 +2114,34 @@ function Pn({ records: e, className: t = "" }) {
|
|
|
2094
2114
|
"Current Records",
|
|
2095
2115
|
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
2096
2116
|
"(",
|
|
2097
|
-
|
|
2117
|
+
r.length,
|
|
2098
2118
|
")"
|
|
2099
2119
|
] })
|
|
2100
2120
|
] }) }),
|
|
2101
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children:
|
|
2121
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ c("div", { className: "pvx-dash-record-row", children: [
|
|
2102
2122
|
/* @__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(
|
|
2123
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: q(s.trackId, s.layout, s.game) }),
|
|
2124
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(s.carId) })
|
|
2105
2125
|
] }),
|
|
2106
2126
|
/* @__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
|
-
|
|
2127
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: A(s.lapTimeMs) }),
|
|
2128
|
+
/* @__PURE__ */ c("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s.game || "evo"}`, children: [
|
|
2129
|
+
(s.game || "evo").toUpperCase(),
|
|
2130
|
+
s.gameVersion ? ` ${s.gameVersion}` : ""
|
|
2111
2131
|
] })
|
|
2112
2132
|
] })
|
|
2113
2133
|
] }, a)) })
|
|
2114
2134
|
] }) : null;
|
|
2115
2135
|
}
|
|
2116
|
-
function
|
|
2136
|
+
function En({ events: e, isLoading: t, className: r, limit: s = 3 }) {
|
|
2117
2137
|
if (t)
|
|
2118
2138
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2119
2139
|
if (!(e != null && e.length))
|
|
2120
2140
|
return null;
|
|
2121
|
-
const a =
|
|
2122
|
-
return /* @__PURE__ */ c("div", { className: `pvx-card ${
|
|
2141
|
+
const a = s ? e.slice(0, s) : e, i = e.length - a.length;
|
|
2142
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card ${r || ""}`, children: [
|
|
2123
2143
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2124
|
-
/* @__PURE__ */ n(
|
|
2144
|
+
/* @__PURE__ */ n(qn, {}),
|
|
2125
2145
|
"Upcoming Events",
|
|
2126
2146
|
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
2127
2147
|
"(",
|
|
@@ -2144,7 +2164,7 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2144
2164
|
o.track
|
|
2145
2165
|
] }),
|
|
2146
2166
|
o.serverPassword && /* @__PURE__ */ n(
|
|
2147
|
-
|
|
2167
|
+
Fn,
|
|
2148
2168
|
{
|
|
2149
2169
|
password: o.serverPassword,
|
|
2150
2170
|
address: o.serverAddress
|
|
@@ -2157,7 +2177,7 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2157
2177
|
month: "short",
|
|
2158
2178
|
year: "numeric"
|
|
2159
2179
|
}) }),
|
|
2160
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." :
|
|
2180
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : _n(o.startTime) }),
|
|
2161
2181
|
o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
2162
2182
|
!o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2163
2183
|
] })
|
|
@@ -2174,11 +2194,11 @@ function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2174
2194
|
] })
|
|
2175
2195
|
] });
|
|
2176
2196
|
}
|
|
2177
|
-
function
|
|
2178
|
-
const [
|
|
2197
|
+
function Fn({ password: e, address: t }) {
|
|
2198
|
+
const [r, s] = D(!1), [a, i] = D(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
|
|
2179
2199
|
if (o)
|
|
2180
2200
|
try {
|
|
2181
|
-
await navigator.clipboard.writeText(o),
|
|
2201
|
+
await navigator.clipboard.writeText(o), s(!0), setTimeout(() => s(!1), 2e3);
|
|
2182
2202
|
} catch {
|
|
2183
2203
|
}
|
|
2184
2204
|
}, [o]);
|
|
@@ -2190,9 +2210,9 @@ function Un({ password: e, address: t }) {
|
|
|
2190
2210
|
onClick: d,
|
|
2191
2211
|
title: "Copy join string to clipboard",
|
|
2192
2212
|
children: [
|
|
2193
|
-
/* @__PURE__ */ n(
|
|
2213
|
+
/* @__PURE__ */ n(Vn, {}),
|
|
2194
2214
|
" ",
|
|
2195
|
-
|
|
2215
|
+
r ? "Copied!" : "Join"
|
|
2196
2216
|
]
|
|
2197
2217
|
}
|
|
2198
2218
|
),
|
|
@@ -2203,95 +2223,95 @@ function Un({ password: e, address: t }) {
|
|
|
2203
2223
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2204
2224
|
onClick: () => i((u) => !u),
|
|
2205
2225
|
title: a ? "Hide password" : "Reveal password",
|
|
2206
|
-
children: a ? /* @__PURE__ */ n(
|
|
2226
|
+
children: a ? /* @__PURE__ */ n(Hn, {}) : /* @__PURE__ */ n(Kn, {})
|
|
2207
2227
|
}
|
|
2208
2228
|
),
|
|
2209
2229
|
a && /* @__PURE__ */ c("span", { className: "pvx-server-detail", children: [
|
|
2210
|
-
/* @__PURE__ */ n(
|
|
2230
|
+
/* @__PURE__ */ n(jn, {}),
|
|
2211
2231
|
" ",
|
|
2212
2232
|
e
|
|
2213
2233
|
] })
|
|
2214
2234
|
] })
|
|
2215
2235
|
] });
|
|
2216
2236
|
}
|
|
2217
|
-
function
|
|
2237
|
+
function _n(e) {
|
|
2218
2238
|
const t = new Date(e).getTime() - Date.now();
|
|
2219
2239
|
if (t <= 0) return "Now";
|
|
2220
|
-
const
|
|
2221
|
-
if (
|
|
2222
|
-
if (
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
if (
|
|
2226
|
-
if (
|
|
2227
|
-
const a = Math.floor(
|
|
2240
|
+
const r = Math.floor(t / (1e3 * 60 * 60));
|
|
2241
|
+
if (r < 1) return "Less than 1 hour";
|
|
2242
|
+
if (r < 24) return `in ${r}h`;
|
|
2243
|
+
const s = Math.floor(r / 24);
|
|
2244
|
+
if (s === 1) return "Tomorrow";
|
|
2245
|
+
if (s < 7) return `in ${s} days`;
|
|
2246
|
+
if (s < 30) {
|
|
2247
|
+
const a = Math.floor(s / 7);
|
|
2228
2248
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2229
2249
|
}
|
|
2230
2250
|
return le(e);
|
|
2231
2251
|
}
|
|
2232
|
-
function
|
|
2252
|
+
function qn() {
|
|
2233
2253
|
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
2254
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2235
2255
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2236
2256
|
] });
|
|
2237
2257
|
}
|
|
2238
|
-
function
|
|
2258
|
+
function jn() {
|
|
2239
2259
|
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
2260
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2241
2261
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2242
2262
|
] });
|
|
2243
2263
|
}
|
|
2244
|
-
function
|
|
2264
|
+
function Vn() {
|
|
2245
2265
|
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
2266
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2247
2267
|
/* @__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
2268
|
] });
|
|
2249
2269
|
}
|
|
2250
|
-
function
|
|
2270
|
+
function Kn() {
|
|
2251
2271
|
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
2272
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2253
2273
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2254
2274
|
] });
|
|
2255
2275
|
}
|
|
2256
|
-
function
|
|
2276
|
+
function Hn() {
|
|
2257
2277
|
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
2278
|
/* @__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
2279
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2260
2280
|
] });
|
|
2261
2281
|
}
|
|
2262
|
-
function
|
|
2282
|
+
function On({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: i }) {
|
|
2263
2283
|
const o = ue();
|
|
2264
2284
|
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ c("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2265
2285
|
/* @__PURE__ */ c("div", { className: "pvx-card-header", children: [
|
|
2266
2286
|
/* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2267
|
-
/* @__PURE__ */ n(
|
|
2287
|
+
/* @__PURE__ */ n(Gn, {}),
|
|
2268
2288
|
"Notifications",
|
|
2269
2289
|
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2270
2290
|
] }),
|
|
2271
|
-
t > 0 &&
|
|
2291
|
+
t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
|
|
2272
2292
|
] }),
|
|
2273
2293
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2274
|
-
|
|
2294
|
+
Wn,
|
|
2275
2295
|
{
|
|
2276
2296
|
notification: d,
|
|
2277
2297
|
getUserDisplay: o,
|
|
2278
|
-
onMarkRead:
|
|
2298
|
+
onMarkRead: r
|
|
2279
2299
|
},
|
|
2280
2300
|
d.id
|
|
2281
2301
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2282
2302
|
] });
|
|
2283
2303
|
}
|
|
2284
|
-
function
|
|
2285
|
-
const
|
|
2286
|
-
!e.isRead &&
|
|
2304
|
+
function Wn({ notification: e, getUserDisplay: t, onMarkRead: r }) {
|
|
2305
|
+
const s = () => {
|
|
2306
|
+
!e.isRead && r && r(e.id);
|
|
2287
2307
|
};
|
|
2288
2308
|
return /* @__PURE__ */ c(
|
|
2289
2309
|
"button",
|
|
2290
2310
|
{
|
|
2291
2311
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2292
|
-
onClick:
|
|
2312
|
+
onClick: s,
|
|
2293
2313
|
children: [
|
|
2294
|
-
/* @__PURE__ */ n(
|
|
2314
|
+
/* @__PURE__ */ n(zn, { type: e.type }),
|
|
2295
2315
|
/* @__PURE__ */ c("div", { className: "pvx-notif-content", children: [
|
|
2296
2316
|
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: je(e, t) }),
|
|
2297
2317
|
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: le(e.createdAt) })
|
|
@@ -2301,7 +2321,7 @@ function Hn({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
|
2301
2321
|
}
|
|
2302
2322
|
);
|
|
2303
2323
|
}
|
|
2304
|
-
function
|
|
2324
|
+
function zn({ type: e }) {
|
|
2305
2325
|
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
2326
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2307
2327
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2314,29 +2334,29 @@ function On({ type: e }) {
|
|
|
2314
2334
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2315
2335
|
] }) });
|
|
2316
2336
|
}
|
|
2317
|
-
function
|
|
2337
|
+
function Gn() {
|
|
2318
2338
|
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
2339
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2320
2340
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2321
2341
|
] });
|
|
2322
2342
|
}
|
|
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 ${
|
|
2343
|
+
function bt({ steamId: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
2344
|
+
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();
|
|
2345
|
+
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
2346
|
/* @__PURE__ */ n(
|
|
2327
|
-
|
|
2347
|
+
Dn,
|
|
2328
2348
|
{
|
|
2329
2349
|
driverName: a.driverName,
|
|
2330
2350
|
avatarUrl: t,
|
|
2331
|
-
memberSince:
|
|
2351
|
+
memberSince: r
|
|
2332
2352
|
}
|
|
2333
2353
|
),
|
|
2334
|
-
/* @__PURE__ */ n(
|
|
2335
|
-
e && /* @__PURE__ */ n(
|
|
2354
|
+
/* @__PURE__ */ n(An, { stats: a, rating: d }),
|
|
2355
|
+
e && /* @__PURE__ */ n(En, { events: l, isLoading: p }),
|
|
2336
2356
|
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${f ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2337
|
-
/* @__PURE__ */ n(
|
|
2357
|
+
/* @__PURE__ */ n(Un, { records: a.currentRecords }),
|
|
2338
2358
|
f && /* @__PURE__ */ n(
|
|
2339
|
-
|
|
2359
|
+
On,
|
|
2340
2360
|
{
|
|
2341
2361
|
notifications: g == null ? void 0 : g.notifications,
|
|
2342
2362
|
unreadCount: (g == null ? void 0 : g.unreadCount) || 0,
|
|
@@ -2349,81 +2369,83 @@ function gt({ steamId: e, avatarUrl: t, memberSince: s, className: r = "" }) {
|
|
|
2349
2369
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2350
2370
|
}
|
|
2351
2371
|
export {
|
|
2352
|
-
|
|
2372
|
+
ot as CarsTable,
|
|
2353
2373
|
P as CompEmptyState,
|
|
2354
2374
|
E as CompLoadingState,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2375
|
+
un as CompetitionCard,
|
|
2376
|
+
ut as CompetitionCards,
|
|
2377
|
+
gt as CompetitionResultsTabs,
|
|
2378
|
+
pn as CompletedBadge,
|
|
2359
2379
|
Ce as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2380
|
+
bt as DriverDashboard,
|
|
2381
|
+
Dn as DriverProfile,
|
|
2382
|
+
ct as DriversTable,
|
|
2383
|
+
vt as EntryList,
|
|
2364
2384
|
Y as InfoPill,
|
|
2365
|
-
|
|
2366
|
-
|
|
2385
|
+
lt as LapHistoryTable,
|
|
2386
|
+
On as NotificationsCard,
|
|
2367
2387
|
se as PODIUM_MEDALS,
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2388
|
+
Zn as PitVoxPartnerProvider,
|
|
2389
|
+
dt as RankingsTable,
|
|
2390
|
+
Un as RecordsTable,
|
|
2391
|
+
ht as RegisterButton,
|
|
2392
|
+
xt as RegistrationPanel,
|
|
2393
|
+
mt as RoundResults,
|
|
2374
2394
|
Te as RoundSessionResults,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2395
|
+
hn as StandingsTable,
|
|
2396
|
+
An as StatsCards,
|
|
2397
|
+
it as TracksTable,
|
|
2398
|
+
sn as TypeBadge,
|
|
2399
|
+
En as UpcomingEvents,
|
|
2380
2400
|
_e as buildDriverIndexPath,
|
|
2381
2401
|
Fe as buildLapsPath,
|
|
2382
2402
|
Z as buildLeaderboardPath,
|
|
2383
2403
|
qe as buildRecentLapsPath,
|
|
2384
|
-
|
|
2385
|
-
|
|
2404
|
+
R as fetchCdnJson,
|
|
2405
|
+
pt as filterCompetitionsByStatus,
|
|
2386
2406
|
I as formatCarName,
|
|
2387
2407
|
j as formatDate,
|
|
2388
|
-
|
|
2408
|
+
Xn as formatDelta,
|
|
2389
2409
|
pe as formatFuel,
|
|
2390
2410
|
A as formatLapTime,
|
|
2391
2411
|
je as formatNotificationMessage,
|
|
2392
2412
|
le as formatRelativeTime,
|
|
2393
2413
|
B as formatSectorTime,
|
|
2414
|
+
tn as formatSessionLabel,
|
|
2394
2415
|
q as formatTrackName,
|
|
2395
2416
|
de as formatTyreCompound,
|
|
2396
|
-
|
|
2417
|
+
dn as getCompetitionPodium,
|
|
2397
2418
|
Le as getCompetitionStatus,
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2419
|
+
ln as getCompletionDate,
|
|
2420
|
+
cn as isCompetitionComplete,
|
|
2421
|
+
rt as useCarLeaderboard,
|
|
2422
|
+
nt as useCarMetadata,
|
|
2402
2423
|
Oe as useCompetitionAllRounds,
|
|
2403
2424
|
me as useCompetitionConfig,
|
|
2404
2425
|
he as useCompetitionEntryList,
|
|
2426
|
+
at as useCompetitionLeaderboard,
|
|
2405
2427
|
He as useCompetitionRound,
|
|
2406
2428
|
We as useCompetitionRoundLaps,
|
|
2407
2429
|
ve as useCompetitionStandings,
|
|
2408
|
-
|
|
2430
|
+
st as useCompetitions,
|
|
2409
2431
|
Ke as useDriverLaps,
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2432
|
+
Ln as useDriverRating,
|
|
2433
|
+
ft as useDriverRatings,
|
|
2434
|
+
Cn as useDriverStats,
|
|
2435
|
+
et as useLeaderboardIndex,
|
|
2436
|
+
Mn as useMarkAllNotificationsRead,
|
|
2437
|
+
$n as useMarkNotificationRead,
|
|
2438
|
+
Rn as useNotifications,
|
|
2439
|
+
Sn as useNotificationsEnabled,
|
|
2418
2440
|
k as usePitVox,
|
|
2419
|
-
|
|
2441
|
+
tt as useRecentLaps,
|
|
2420
2442
|
xe as useRegister,
|
|
2421
2443
|
ee as useRegistrationMode,
|
|
2422
2444
|
X as useRegistrationStatus,
|
|
2423
2445
|
ne as useRegistrationUrl,
|
|
2424
2446
|
Ve as useTrackLeaderboard,
|
|
2425
|
-
|
|
2426
|
-
|
|
2447
|
+
Nt as useUnreadCount,
|
|
2448
|
+
Tn as useUpcomingEvents,
|
|
2427
2449
|
ue as useUserLookup,
|
|
2428
2450
|
ge as useWithdraw
|
|
2429
2451
|
};
|