@pitvox/partner-react 0.7.13 → 0.7.14
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 +1134 -1137
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
const Z =
|
|
1
|
+
import { jsx as n, jsxs as l, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as S, useContext as Be, useState as D, useCallback as H, useRef as Ae, useEffect as Ue } from "react";
|
|
3
|
+
import { useQueryClient as q, QueryClient as Fe, QueryClientProvider as Ee, useQuery as T, useMutation as W, useQueries as ce } from "@tanstack/react-query";
|
|
4
|
+
const Z = Pe(null), qe = "https://cdn.pitvox.com", je = "https://pitvox.com";
|
|
5
5
|
let Y = null;
|
|
6
|
-
function
|
|
6
|
+
function tt({
|
|
7
7
|
partnerSlug: e = null,
|
|
8
|
-
cdnUrl:
|
|
9
|
-
pitvoxUrl:
|
|
10
|
-
getSteamId:
|
|
8
|
+
cdnUrl: r = qe,
|
|
9
|
+
pitvoxUrl: t = je,
|
|
10
|
+
getSteamId: s,
|
|
11
11
|
onRegister: a,
|
|
12
12
|
onWithdraw: i,
|
|
13
13
|
onFetchNotifications: o,
|
|
@@ -18,77 +18,77 @@ function rn({
|
|
|
18
18
|
}) {
|
|
19
19
|
const g = S(() => ({
|
|
20
20
|
partnerSlug: e,
|
|
21
|
-
cdnUrl:
|
|
22
|
-
pitvoxUrl:
|
|
23
|
-
getSteamId:
|
|
21
|
+
cdnUrl: r.replace(/\/$/, ""),
|
|
22
|
+
pitvoxUrl: t.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: p || null,
|
|
29
29
|
onFetchServerPassword: c || null
|
|
30
|
-
}), [e,
|
|
30
|
+
}), [e, r, t, s, a, i, o, d, p, c]);
|
|
31
31
|
let f = !1;
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
q(), f = !0;
|
|
34
34
|
} catch {
|
|
35
35
|
f = !1;
|
|
36
36
|
}
|
|
37
|
-
return f ? /* @__PURE__ */
|
|
37
|
+
return f ? /* @__PURE__ */ n(Z.Provider, { value: g, children: u }) : (Y || (Y = new Fe({
|
|
38
38
|
defaultOptions: {
|
|
39
39
|
queries: { staleTime: 6e4 }
|
|
40
40
|
}
|
|
41
|
-
})), /* @__PURE__ */
|
|
41
|
+
})), /* @__PURE__ */ n(Ee, { client: Y, children: /* @__PURE__ */ n(Z.Provider, { value: g, children: u }) }));
|
|
42
42
|
}
|
|
43
43
|
function C() {
|
|
44
|
-
const e =
|
|
44
|
+
const e = Be(Z);
|
|
45
45
|
if (!e)
|
|
46
46
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
47
|
return e;
|
|
48
48
|
}
|
|
49
|
-
async function R(e,
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
throw new Error(`CDN fetch failed: ${
|
|
49
|
+
async function R(e, r) {
|
|
50
|
+
const t = await fetch(`${e}/${r}`);
|
|
51
|
+
if (!t.ok) {
|
|
52
|
+
if (t.status === 404 || t.status === 403) return null;
|
|
53
|
+
throw new Error(`CDN fetch failed: ${t.status}`);
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return t.json();
|
|
56
56
|
}
|
|
57
|
-
function X(e,
|
|
57
|
+
function X(e, r, t, ...s) {
|
|
58
58
|
const a = ["leaderboards"];
|
|
59
|
-
return e && a.push(`partners/${e}`),
|
|
59
|
+
return e && a.push(`partners/${e}`), r && a.push(r), t && a.push(`v/${t}`), [...a, ...s].join("/");
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const a =
|
|
63
|
-
return e ? `laps/partners/${e}/${
|
|
61
|
+
function _e(e, r, t, s) {
|
|
62
|
+
const a = s || "default";
|
|
63
|
+
return e ? `laps/partners/${e}/${r}/${t}/${a}.json` : `laps/${r}/${t}/${a}.json`;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return e ? `laps/partners/${e}/${
|
|
65
|
+
function Ve(e, r) {
|
|
66
|
+
return e ? `laps/partners/${e}/${r}/index.json` : `laps/${r}/index.json`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Ke(e) {
|
|
69
69
|
return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
|
|
70
70
|
}
|
|
71
71
|
function U(e) {
|
|
72
72
|
if (!e && e !== 0) return "-";
|
|
73
|
-
const
|
|
74
|
-
return `${
|
|
73
|
+
const r = Math.floor(e / 1e3), t = Math.floor(r / 60), s = r % 60, a = e % 1e3;
|
|
74
|
+
return `${t}:${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 ? U(e) : (e / 1e3).toFixed(3);
|
|
78
78
|
}
|
|
79
79
|
function I(e) {
|
|
80
80
|
if (!e) return "";
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let r = e;
|
|
82
|
+
return r.startsWith("ks_") && (r = r.slice(3)), r.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function j(e, r, t) {
|
|
85
85
|
if (!e) return "";
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
const i =
|
|
89
|
-
return `${
|
|
86
|
+
const s = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = t === "acc" || !t && (r == null ? void 0 : r.toLowerCase()) === "track config";
|
|
87
|
+
if (!r || r === "default" || a) return s;
|
|
88
|
+
const i = r.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
|
|
89
|
+
return `${s} ${i}`;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function _(e) {
|
|
92
92
|
if (!e) return "-";
|
|
93
93
|
try {
|
|
94
94
|
return new Date(e).toLocaleDateString("en-GB", {
|
|
@@ -102,21 +102,21 @@ function j(e) {
|
|
|
102
102
|
}
|
|
103
103
|
function ue(e) {
|
|
104
104
|
if (!e) return "";
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const a = Math.floor(
|
|
105
|
+
const r = Date.now() - new Date(e).getTime(), t = Math.floor(r / 1e3);
|
|
106
|
+
if (t < 60) return "Just now";
|
|
107
|
+
const s = Math.floor(t / 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
|
-
return i < 30 ? `${i}d ago` :
|
|
112
|
+
return i < 30 ? `${i}d ago` : _(e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function rt(e) {
|
|
115
115
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const { type:
|
|
119
|
-
return
|
|
117
|
+
function He(e, r) {
|
|
118
|
+
const { type: t, title: s, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? j(a, i, d) : null, g = o ? I(o) : null, f = [u, g].filter(Boolean).join(" — ");
|
|
119
|
+
return t === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && r ? r(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : t === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
|
|
120
120
|
}
|
|
121
121
|
function me(e) {
|
|
122
122
|
return e ? {
|
|
@@ -132,40 +132,40 @@ function me(e) {
|
|
|
132
132
|
S: "Soft"
|
|
133
133
|
}[e] || e : "Unknown";
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ve(e) {
|
|
136
136
|
if (!e) return "-";
|
|
137
|
-
const
|
|
138
|
-
return isNaN(
|
|
137
|
+
const r = Number(e);
|
|
138
|
+
return isNaN(r) ? "-" : r % 1 ? `${r.toFixed(1)}L` : `${r}L`;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function st(e = {}) {
|
|
141
141
|
var p, c, u, g, f, m;
|
|
142
|
-
const { cdnUrl:
|
|
143
|
-
queryKey: ["pitvox", "leaderboards",
|
|
144
|
-
queryFn: () => R(
|
|
142
|
+
const { cdnUrl: r, partnerSlug: t } = C(), { game: s, gameVersion: a } = e, i = X(t, null, null, "index.json"), o = T({
|
|
143
|
+
queryKey: ["pitvox", "leaderboards", t, "index"],
|
|
144
|
+
queryFn: () => R(r, i),
|
|
145
145
|
staleTime: 3e4,
|
|
146
146
|
refetchInterval: 3e4
|
|
147
147
|
}), d = S(() => {
|
|
148
148
|
var x;
|
|
149
149
|
if (!((x = o.data) != null && x.tracks)) return [];
|
|
150
150
|
let y = o.data.tracks;
|
|
151
|
-
return
|
|
152
|
-
id:
|
|
153
|
-
layout:
|
|
154
|
-
game:
|
|
155
|
-
gameVersion:
|
|
156
|
-
displayName:
|
|
157
|
-
driverCount:
|
|
158
|
-
carCount:
|
|
159
|
-
record:
|
|
160
|
-
visibleId:
|
|
161
|
-
carId:
|
|
162
|
-
carDisplayName: I(
|
|
163
|
-
lapTimeMs:
|
|
164
|
-
timestamp:
|
|
151
|
+
return s && (y = y.filter((h) => h.game === s)), a && (y = y.filter((h) => h.gameVersion === a)), y.map((h) => ({
|
|
152
|
+
id: h.trackId,
|
|
153
|
+
layout: h.layout,
|
|
154
|
+
game: h.game,
|
|
155
|
+
gameVersion: h.gameVersion,
|
|
156
|
+
displayName: j(h.trackId, h.layout, h.game),
|
|
157
|
+
driverCount: h.driverCount || 0,
|
|
158
|
+
carCount: h.carCount || 0,
|
|
159
|
+
record: h.recordHolder ? {
|
|
160
|
+
visibleId: h.recordHolder.steamId || h.recordHolder.userId,
|
|
161
|
+
carId: h.recordHolder.carId,
|
|
162
|
+
carDisplayName: I(h.recordHolder.carId),
|
|
163
|
+
lapTimeMs: h.recordHolder.lapTimeMs,
|
|
164
|
+
timestamp: h.recordHolder.recordedAt
|
|
165
165
|
} : null,
|
|
166
|
-
recordByTag:
|
|
166
|
+
recordByTag: h.recordByTag || null
|
|
167
167
|
}));
|
|
168
|
-
}, [(p = o.data) == null ? void 0 : p.tracks,
|
|
168
|
+
}, [(p = o.data) == null ? void 0 : p.tracks, s, a]);
|
|
169
169
|
return {
|
|
170
170
|
...o,
|
|
171
171
|
data: d,
|
|
@@ -176,10 +176,10 @@ function an(e = {}) {
|
|
|
176
176
|
versions: ((m = o.data) == null ? void 0 : m.versions) || {}
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function We(e,
|
|
180
|
-
const { cdnUrl:
|
|
179
|
+
function We(e, r, t = {}) {
|
|
180
|
+
const { cdnUrl: s, partnerSlug: a } = C(), { carId: i, game: o, gameVersion: d } = t, p = r || "default", c = X(a, o, d, `tracks/${e}/${p}.json`), { data: u, isLoading: g, error: f } = T({
|
|
181
181
|
queryKey: ["pitvox", "leaderboards", a, "track", e, p, o, d],
|
|
182
|
-
queryFn: () => R(
|
|
182
|
+
queryFn: () => R(s, c),
|
|
183
183
|
enabled: !!e,
|
|
184
184
|
staleTime: 3e4,
|
|
185
185
|
refetchInterval: 3e4
|
|
@@ -188,174 +188,176 @@ function We(e, n, s = {}) {
|
|
|
188
188
|
if (!(u != null && u.entries)) return [];
|
|
189
189
|
let y = u.entries;
|
|
190
190
|
if (o && (y = y.filter((x) => x.game === o)), !i) {
|
|
191
|
-
const x = /* @__PURE__ */ new Map(),
|
|
191
|
+
const x = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
192
192
|
for (const N of y) {
|
|
193
|
-
const
|
|
194
|
-
|
|
193
|
+
const v = N.steamId || N.userId;
|
|
194
|
+
h.has(N.carId) || h.set(N.carId, /* @__PURE__ */ new Set()), h.get(N.carId).add(v), (!x.has(N.carId) || N.lapTimeMs < x.get(N.carId).lapTimeMs) && x.set(N.carId, N);
|
|
195
195
|
}
|
|
196
196
|
return Array.from(x.values()).map((N) => {
|
|
197
|
-
var
|
|
198
|
-
return { ...N, driverCount: ((
|
|
199
|
-
}).sort((N,
|
|
197
|
+
var v;
|
|
198
|
+
return { ...N, driverCount: ((v = h.get(N.carId)) == null ? void 0 : v.size) || 0 };
|
|
199
|
+
}).sort((N, v) => N.lapTimeMs - v.lapTimeMs);
|
|
200
200
|
}
|
|
201
|
-
return y.filter((x) => x.carId === i).sort((x,
|
|
201
|
+
return y.filter((x) => x.carId === i).sort((x, h) => x.lapTimeMs - h.lapTimeMs);
|
|
202
202
|
}, [u == null ? void 0 : u.entries, i, o]), isLoading: g, error: f };
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
var x,
|
|
206
|
-
const { cdnUrl: i, partnerSlug: o } = C(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e &&
|
|
207
|
-
queryKey: ["pitvox", "laps", o, e,
|
|
204
|
+
function Oe(e, r, t, s, a = {}) {
|
|
205
|
+
var x, h;
|
|
206
|
+
const { cdnUrl: i, partnerSlug: o } = C(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && r ? _e(o, e, r, t) : null, f = T({
|
|
207
|
+
queryKey: ["pitvox", "laps", o, e, r, t || "default"],
|
|
208
208
|
queryFn: () => R(i, u),
|
|
209
|
-
enabled: !!e && !!
|
|
209
|
+
enabled: !!e && !!r,
|
|
210
210
|
staleTime: 3e4,
|
|
211
211
|
refetchInterval: 3e4
|
|
212
212
|
}), m = S(() => {
|
|
213
213
|
var N;
|
|
214
|
-
return (N = f.data) != null && N.laps ? f.data.laps.filter((
|
|
215
|
-
}, [(x = f.data) == null ? void 0 : x.laps,
|
|
216
|
-
const N = m.filter((
|
|
214
|
+
return (N = f.data) != null && N.laps ? f.data.laps.filter((v) => !(v.carId !== s || p && v.game !== p || c && v.gameVersion !== c || !d && !v.isValid)).sort((v, k) => v.lapTimeMs - k.lapTimeMs) : [];
|
|
215
|
+
}, [(x = f.data) == null ? void 0 : x.laps, s, p, c, d]), y = S(() => {
|
|
216
|
+
const N = m.filter((w) => w.isValid && w.sector1Ms && w.sector2Ms && w.sector3Ms);
|
|
217
217
|
if (N.length < 2) return null;
|
|
218
|
-
const
|
|
219
|
-
return L >= M ? null : { lapTimeMs: L, sector1Ms:
|
|
218
|
+
const v = Math.min(...N.map((w) => w.sector1Ms)), k = Math.min(...N.map((w) => w.sector2Ms)), b = Math.min(...N.map((w) => w.sector3Ms)), L = v + k + b, M = Math.min(...N.map((w) => w.lapTimeMs));
|
|
219
|
+
return L >= M ? null : { lapTimeMs: L, sector1Ms: v, sector2Ms: k, sector3Ms: b };
|
|
220
220
|
}, [m]);
|
|
221
221
|
return {
|
|
222
222
|
...f,
|
|
223
223
|
data: m,
|
|
224
|
-
driverName: ((
|
|
224
|
+
driverName: ((h = f.data) == null ? void 0 : h.driverName) || "Driver",
|
|
225
225
|
theoreticalBest: y
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const { cdnUrl: e } = C(), { data:
|
|
228
|
+
function he() {
|
|
229
|
+
const { cdnUrl: e } = C(), { data: r } = T({
|
|
230
230
|
queryKey: ["pitvox", "users", "index"],
|
|
231
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
|
+
}), t = (r == null ? void 0 : r.users) || {};
|
|
235
|
+
return (s, a) => {
|
|
236
|
+
const i = t[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:
|
|
246
|
-
queryKey: ["pitvox", "cars",
|
|
247
|
-
queryFn: () => R(
|
|
244
|
+
function at(e = "evo") {
|
|
245
|
+
const { cdnUrl: r } = C(), { data: t } = T({
|
|
246
|
+
queryKey: ["pitvox", "cars", e],
|
|
247
|
+
queryFn: () => R(r, `cars/${e}.json`),
|
|
248
248
|
staleTime: 5 * 6e4,
|
|
249
249
|
gcTime: 30 * 6e4
|
|
250
250
|
});
|
|
251
251
|
return {
|
|
252
|
-
tags: (
|
|
253
|
-
cars: (
|
|
252
|
+
tags: (t == null ? void 0 : t.tags) || [],
|
|
253
|
+
cars: (t == null ? void 0 : t.cars) || {},
|
|
254
|
+
categories: (t == null ? void 0 : t.categories) || [],
|
|
255
|
+
tagLabels: (t == null ? void 0 : t.tagLabels) || {}
|
|
254
256
|
};
|
|
255
257
|
}
|
|
256
|
-
function
|
|
258
|
+
function it() {
|
|
257
259
|
var a, i;
|
|
258
|
-
const { cdnUrl: e, partnerSlug:
|
|
259
|
-
queryKey: ["pitvox", "recentLaps",
|
|
260
|
-
queryFn: () => R(e,
|
|
260
|
+
const { cdnUrl: e, partnerSlug: r } = C(), t = Ke(r), s = T({
|
|
261
|
+
queryKey: ["pitvox", "recentLaps", r],
|
|
262
|
+
queryFn: () => R(e, t),
|
|
261
263
|
staleTime: 3e4,
|
|
262
264
|
refetchInterval: 3e4,
|
|
263
265
|
gcTime: 10 * 6e4
|
|
264
266
|
});
|
|
265
267
|
return {
|
|
266
|
-
groups: ((a =
|
|
267
|
-
generatedAt: ((i =
|
|
268
|
-
isLoading:
|
|
268
|
+
groups: ((a = s.data) == null ? void 0 : a.groups) || [],
|
|
269
|
+
generatedAt: ((i = s.data) == null ? void 0 : i.generatedAt) || null,
|
|
270
|
+
isLoading: s.isLoading
|
|
269
271
|
};
|
|
270
272
|
}
|
|
271
|
-
function
|
|
272
|
-
return We(e, null, { carId:
|
|
273
|
+
function ot(e, r) {
|
|
274
|
+
return We(e, null, { carId: r });
|
|
273
275
|
}
|
|
274
|
-
function
|
|
275
|
-
const { cdnUrl: e, partnerSlug:
|
|
276
|
+
function lt() {
|
|
277
|
+
const { cdnUrl: e, partnerSlug: r } = C();
|
|
276
278
|
return T({
|
|
277
|
-
queryKey: ["pitvox", "competitions",
|
|
279
|
+
queryKey: ["pitvox", "competitions", r],
|
|
278
280
|
queryFn: async () => {
|
|
279
|
-
const
|
|
280
|
-
return
|
|
281
|
+
const t = await R(e, "competitions/index.json");
|
|
282
|
+
return t != null && t.competitions ? r ? t.competitions.filter((s) => s.partnerSlug === r) : t.competitions : [];
|
|
281
283
|
},
|
|
282
284
|
staleTime: 6e4
|
|
283
285
|
});
|
|
284
286
|
}
|
|
285
|
-
function xe(e,
|
|
286
|
-
const
|
|
287
|
+
function xe(e, r = {}) {
|
|
288
|
+
const t = C(), s = r.partnerSlug || t.partnerSlug;
|
|
287
289
|
return T({
|
|
288
|
-
queryKey: ["pitvox", "competition",
|
|
289
|
-
queryFn: () => R(
|
|
290
|
-
enabled: !!
|
|
290
|
+
queryKey: ["pitvox", "competition", s, e, "config"],
|
|
291
|
+
queryFn: () => R(t.cdnUrl, `competitions/${s}/${e}/config.json`),
|
|
292
|
+
enabled: !!s && !!e,
|
|
291
293
|
staleTime: 6e4
|
|
292
294
|
});
|
|
293
295
|
}
|
|
294
|
-
function ge(e,
|
|
295
|
-
const
|
|
296
|
+
function ge(e, r = {}) {
|
|
297
|
+
const t = C(), s = r.partnerSlug || t.partnerSlug;
|
|
296
298
|
return T({
|
|
297
|
-
queryKey: ["pitvox", "competition",
|
|
298
|
-
queryFn: () => R(
|
|
299
|
-
enabled: !!
|
|
299
|
+
queryKey: ["pitvox", "competition", s, e, "standings"],
|
|
300
|
+
queryFn: () => R(t.cdnUrl, `competitions/${s}/${e}/standings.json`),
|
|
301
|
+
enabled: !!s && !!e,
|
|
300
302
|
staleTime: 6e4
|
|
301
303
|
});
|
|
302
304
|
}
|
|
303
|
-
function
|
|
304
|
-
const
|
|
305
|
+
function ze(e, r, t = {}) {
|
|
306
|
+
const s = C(), a = t.partnerSlug || s.partnerSlug;
|
|
305
307
|
return T({
|
|
306
|
-
queryKey: ["pitvox", "competition", a, e, "round",
|
|
307
|
-
queryFn: () => R(
|
|
308
|
-
enabled: !!a && !!e &&
|
|
308
|
+
queryKey: ["pitvox", "competition", a, e, "round", r],
|
|
309
|
+
queryFn: () => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${r}.json`),
|
|
310
|
+
enabled: !!a && !!e && r != null,
|
|
309
311
|
staleTime: 6e4
|
|
310
312
|
});
|
|
311
313
|
}
|
|
312
|
-
function Qe(e,
|
|
313
|
-
const
|
|
314
|
+
function Qe(e, r = [], t = {}) {
|
|
315
|
+
const s = C(), a = t.partnerSlug || s.partnerSlug;
|
|
314
316
|
return T({
|
|
315
|
-
queryKey: ["pitvox", "competition", a, e, "allRounds",
|
|
317
|
+
queryKey: ["pitvox", "competition", a, e, "allRounds", r],
|
|
316
318
|
queryFn: async () => (await Promise.all(
|
|
317
|
-
|
|
318
|
-
(o) => R(
|
|
319
|
+
r.map(
|
|
320
|
+
(o) => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
|
|
319
321
|
)
|
|
320
322
|
)).filter(Boolean),
|
|
321
|
-
enabled: !!a && !!e &&
|
|
323
|
+
enabled: !!a && !!e && r.length > 0,
|
|
322
324
|
staleTime: 6e4
|
|
323
325
|
});
|
|
324
326
|
}
|
|
325
|
-
function
|
|
326
|
-
const
|
|
327
|
+
function Ge(e, r = {}) {
|
|
328
|
+
const t = C(), s = r.partnerSlug || t.partnerSlug;
|
|
327
329
|
return T({
|
|
328
|
-
queryKey: ["pitvox", "competition",
|
|
329
|
-
queryFn: () => R(
|
|
330
|
-
enabled: !!
|
|
330
|
+
queryKey: ["pitvox", "competition", s, e, "leaderboard"],
|
|
331
|
+
queryFn: () => R(t.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
|
|
332
|
+
enabled: !!s && !!e,
|
|
331
333
|
staleTime: 6e4
|
|
332
334
|
});
|
|
333
335
|
}
|
|
334
|
-
function
|
|
335
|
-
const
|
|
336
|
+
function Ye(e, r, t = {}) {
|
|
337
|
+
const s = C(), a = t.partnerSlug || s.partnerSlug;
|
|
336
338
|
return T({
|
|
337
|
-
queryKey: ["pitvox", "competition", a, e, "round",
|
|
338
|
-
queryFn: () => R(
|
|
339
|
-
enabled: !!a && !!e &&
|
|
339
|
+
queryKey: ["pitvox", "competition", a, e, "round", r, "laps"],
|
|
340
|
+
queryFn: () => R(s.cdnUrl, `competitions/${a}/${e}/rounds/${r}/laps.json`).catch(() => null),
|
|
341
|
+
enabled: !!a && !!e && r != null,
|
|
340
342
|
staleTime: 6e4
|
|
341
343
|
});
|
|
342
344
|
}
|
|
343
|
-
function fe(e,
|
|
344
|
-
const
|
|
345
|
+
function fe(e, r = {}) {
|
|
346
|
+
const t = C(), s = r.partnerSlug || t.partnerSlug;
|
|
345
347
|
return T({
|
|
346
|
-
queryKey: ["pitvox", "competition",
|
|
347
|
-
queryFn: () => R(
|
|
348
|
-
enabled: !!
|
|
348
|
+
queryKey: ["pitvox", "competition", s, e, "entrylist"],
|
|
349
|
+
queryFn: () => R(t.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
|
|
350
|
+
enabled: !!s && !!e,
|
|
349
351
|
staleTime: 6e4
|
|
350
352
|
});
|
|
351
353
|
}
|
|
352
354
|
function ee(e) {
|
|
353
|
-
const { cdnUrl:
|
|
355
|
+
const { cdnUrl: r, partnerSlug: t, getSteamId: s } = C(), a = s();
|
|
354
356
|
return T({
|
|
355
|
-
queryKey: ["pitvox", "registration",
|
|
357
|
+
queryKey: ["pitvox", "registration", t, e, a],
|
|
356
358
|
queryFn: async () => {
|
|
357
359
|
var p;
|
|
358
|
-
const i = await fetch(`${
|
|
360
|
+
const i = await fetch(`${r}/competitions/${t}/${e}/entrylist.json`);
|
|
359
361
|
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
360
362
|
const o = await i.json();
|
|
361
363
|
return { isRegistered: !!a && ((p = o.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: o };
|
|
@@ -365,19 +367,19 @@ function ee(e) {
|
|
|
365
367
|
});
|
|
366
368
|
}
|
|
367
369
|
function Ne(e) {
|
|
368
|
-
const { onRegister:
|
|
369
|
-
return
|
|
370
|
+
const { onRegister: r, partnerSlug: t, getSteamId: s } = C(), a = q(), i = he();
|
|
371
|
+
return W({
|
|
370
372
|
mutationFn: (o) => {
|
|
371
|
-
if (!
|
|
373
|
+
if (!r)
|
|
372
374
|
throw new Error(
|
|
373
375
|
"No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
|
|
374
376
|
);
|
|
375
|
-
return
|
|
377
|
+
return r(e, o);
|
|
376
378
|
},
|
|
377
379
|
onSuccess: () => {
|
|
378
|
-
const o =
|
|
380
|
+
const o = s();
|
|
379
381
|
if (a.setQueriesData(
|
|
380
|
-
{ queryKey: ["pitvox", "registration",
|
|
382
|
+
{ queryKey: ["pitvox", "registration", t, e] },
|
|
381
383
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
382
384
|
), o) {
|
|
383
385
|
const d = i(o), p = {
|
|
@@ -386,7 +388,7 @@ function Ne(e) {
|
|
|
386
388
|
avatarUrl: d.avatarUrl
|
|
387
389
|
};
|
|
388
390
|
a.setQueriesData(
|
|
389
|
-
{ queryKey: ["pitvox", "competition",
|
|
391
|
+
{ queryKey: ["pitvox", "competition", t, e, "entrylist"] },
|
|
390
392
|
(c) => {
|
|
391
393
|
var g;
|
|
392
394
|
return c ? ((g = c.drivers) == null ? void 0 : g.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
|
|
@@ -397,221 +399,196 @@ function Ne(e) {
|
|
|
397
399
|
});
|
|
398
400
|
}
|
|
399
401
|
function be(e) {
|
|
400
|
-
const { onWithdraw:
|
|
401
|
-
return
|
|
402
|
+
const { onWithdraw: r, partnerSlug: t, getSteamId: s } = C(), a = q();
|
|
403
|
+
return W({
|
|
402
404
|
mutationFn: (i) => {
|
|
403
|
-
if (!
|
|
405
|
+
if (!r)
|
|
404
406
|
throw new Error(
|
|
405
407
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
406
408
|
);
|
|
407
|
-
const o = i ||
|
|
409
|
+
const o = i || s();
|
|
408
410
|
if (!o) throw new Error("No Steam ID available");
|
|
409
|
-
return
|
|
411
|
+
return r(e, o);
|
|
410
412
|
},
|
|
411
413
|
onSuccess: () => {
|
|
412
|
-
const i =
|
|
414
|
+
const i = s();
|
|
413
415
|
a.setQueriesData(
|
|
414
|
-
{ queryKey: ["pitvox", "registration",
|
|
416
|
+
{ queryKey: ["pitvox", "registration", t, e] },
|
|
415
417
|
(o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
416
418
|
), i && a.setQueriesData(
|
|
417
|
-
{ queryKey: ["pitvox", "competition",
|
|
419
|
+
{ queryKey: ["pitvox", "competition", t, e, "entrylist"] },
|
|
418
420
|
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
|
|
419
421
|
);
|
|
420
422
|
}
|
|
421
423
|
});
|
|
422
424
|
}
|
|
423
|
-
function
|
|
424
|
-
const { onRegister: e, onWithdraw:
|
|
425
|
-
return { isPowerMode:
|
|
426
|
-
}
|
|
427
|
-
function
|
|
428
|
-
const { pitvoxUrl:
|
|
429
|
-
return `${
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
gt2: "GT2",
|
|
435
|
-
gt4: "GT4",
|
|
436
|
-
cup: "Cup",
|
|
437
|
-
prototype: "Prototype",
|
|
438
|
-
rally: "Rally",
|
|
439
|
-
hypercar: "Hypercar",
|
|
440
|
-
supercar: "Supercar",
|
|
441
|
-
sports_car: "Sports Car",
|
|
442
|
-
hot_hatch: "Hot Hatch",
|
|
443
|
-
lightweight: "Lightweight",
|
|
444
|
-
"1960s": "1960s",
|
|
445
|
-
"1970s": "1970s",
|
|
446
|
-
"1980s": "1980s",
|
|
447
|
-
"1990s": "1990s",
|
|
448
|
-
"2000s": "2000s",
|
|
449
|
-
"2010s": "2010s",
|
|
450
|
-
"2020s": "2020s"
|
|
451
|
-
}, ye = [
|
|
452
|
-
{ id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
|
|
453
|
-
{ id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
|
|
454
|
-
{ id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
|
|
455
|
-
];
|
|
456
|
-
function Xe(e) {
|
|
457
|
-
for (const n of ye)
|
|
458
|
-
if (n.tags.includes(e)) return n.id;
|
|
425
|
+
function ne() {
|
|
426
|
+
const { onRegister: e, onWithdraw: r } = C(), t = !!(e && r);
|
|
427
|
+
return { isPowerMode: t, isBasicMode: !t };
|
|
428
|
+
}
|
|
429
|
+
function te(e) {
|
|
430
|
+
const { pitvoxUrl: r, partnerSlug: t } = C();
|
|
431
|
+
return `${r}/p/${t}/competitions/${e}/register`;
|
|
432
|
+
}
|
|
433
|
+
function Je(e, r) {
|
|
434
|
+
for (const t of r)
|
|
435
|
+
if (t.tags.includes(e)) return t.id;
|
|
459
436
|
return "other";
|
|
460
437
|
}
|
|
461
|
-
function
|
|
462
|
-
if (
|
|
438
|
+
function ye(e, r, t = []) {
|
|
439
|
+
if (r.size === 0) return !0;
|
|
463
440
|
const s = {};
|
|
464
|
-
for (const
|
|
465
|
-
const
|
|
466
|
-
s[
|
|
441
|
+
for (const a of r) {
|
|
442
|
+
const i = Je(a, t);
|
|
443
|
+
s[i] || (s[i] = []), s[i].push(a);
|
|
467
444
|
}
|
|
468
|
-
for (const
|
|
469
|
-
if (!
|
|
445
|
+
for (const a of Object.values(s))
|
|
446
|
+
if (!a.some((i) => e.includes(i))) return !1;
|
|
470
447
|
return !0;
|
|
471
448
|
}
|
|
472
|
-
function ke(e,
|
|
473
|
-
const [
|
|
449
|
+
function ke(e, r) {
|
|
450
|
+
const [t, s] = D(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : t, o = H((p) => {
|
|
474
451
|
const c = new Set(i);
|
|
475
|
-
c.has(p) ? c.delete(p) : c.add(p), a &&
|
|
476
|
-
}, [i, a,
|
|
477
|
-
a &&
|
|
478
|
-
}, [a,
|
|
452
|
+
c.has(p) ? c.delete(p) : c.add(p), a && r ? r(c) : s(c);
|
|
453
|
+
}, [i, a, r]), d = H(() => {
|
|
454
|
+
a && r ? r(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
|
|
455
|
+
}, [a, r]);
|
|
479
456
|
return { activeTags: i, toggle: o, clear: d };
|
|
480
457
|
}
|
|
481
|
-
function
|
|
482
|
-
const [
|
|
483
|
-
|
|
458
|
+
function O(e) {
|
|
459
|
+
const [r, t] = D(e), s = H((a) => {
|
|
460
|
+
t(
|
|
484
461
|
(i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
485
462
|
);
|
|
486
463
|
}, []);
|
|
487
|
-
return [
|
|
464
|
+
return [r, s];
|
|
488
465
|
}
|
|
489
|
-
function z(e,
|
|
490
|
-
return [...e].sort((
|
|
491
|
-
const i = s
|
|
466
|
+
function z(e, r, t) {
|
|
467
|
+
return [...e].sort((s, a) => {
|
|
468
|
+
const i = t(s, r.key), o = t(a, r.key);
|
|
492
469
|
if (i == null && o == null) return 0;
|
|
493
470
|
if (i == null) return 1;
|
|
494
471
|
if (o == null) return -1;
|
|
495
472
|
const d = typeof i == "string" ? i.localeCompare(o) : i - o;
|
|
496
|
-
return
|
|
473
|
+
return r.dir === "desc" ? -d : d;
|
|
497
474
|
});
|
|
498
475
|
}
|
|
499
|
-
function
|
|
500
|
-
const
|
|
501
|
-
return
|
|
502
|
-
s1: Math.min(...
|
|
503
|
-
s2: Math.min(...
|
|
504
|
-
s3: Math.min(...
|
|
476
|
+
function we(e, r = !1) {
|
|
477
|
+
const t = r ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
|
|
478
|
+
return t != null && t.length ? {
|
|
479
|
+
s1: Math.min(...t.map((s) => s.sector1Ms).filter(Boolean)),
|
|
480
|
+
s2: Math.min(...t.map((s) => s.sector2Ms).filter(Boolean)),
|
|
481
|
+
s3: Math.min(...t.map((s) => s.sector3Ms).filter(Boolean))
|
|
505
482
|
} : null;
|
|
506
483
|
}
|
|
507
|
-
function
|
|
508
|
-
return e ?
|
|
484
|
+
function Ze({ active: e, dir: r }) {
|
|
485
|
+
return e ? r === "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" }) });
|
|
509
486
|
}
|
|
510
|
-
function $({ label: e, sortKey:
|
|
511
|
-
return /* @__PURE__ */
|
|
487
|
+
function $({ label: e, sortKey: r, config: t, onSort: s, className: a = "" }) {
|
|
488
|
+
return /* @__PURE__ */ n(
|
|
512
489
|
"th",
|
|
513
490
|
{
|
|
514
491
|
className: `pvx-th pvx-th--sortable ${a}`,
|
|
515
|
-
onClick: () => r
|
|
492
|
+
onClick: () => s(r),
|
|
516
493
|
children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
|
|
517
494
|
e,
|
|
518
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ n(Ze, { active: t.key === r, dir: t.dir })
|
|
519
496
|
] })
|
|
520
497
|
}
|
|
521
498
|
);
|
|
522
499
|
}
|
|
523
|
-
function
|
|
524
|
-
const { displayName:
|
|
500
|
+
function Q({ userId: e, getUserDisplay: r }) {
|
|
501
|
+
const { displayName: t, avatarUrl: s } = r(e);
|
|
525
502
|
return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
|
|
526
|
-
|
|
527
|
-
/* @__PURE__ */
|
|
503
|
+
s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
504
|
+
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children: t })
|
|
528
505
|
] });
|
|
529
506
|
}
|
|
530
|
-
function re({ rank: e, podium:
|
|
531
|
-
return /* @__PURE__ */
|
|
507
|
+
function re({ rank: e, podium: r = !1 }) {
|
|
508
|
+
return /* @__PURE__ */ n("span", { className: r ? 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 });
|
|
532
509
|
}
|
|
533
|
-
function
|
|
510
|
+
function Ce({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categories: a = [], tagLabels: i = {} }) {
|
|
534
511
|
if (!e || e.length < 2) return null;
|
|
535
|
-
const
|
|
512
|
+
const o = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
|
|
536
513
|
return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
|
|
537
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ n(
|
|
538
515
|
"button",
|
|
539
516
|
{
|
|
540
|
-
onClick:
|
|
541
|
-
className: `pvx-tag ${
|
|
517
|
+
onClick: s,
|
|
518
|
+
className: `pvx-tag ${r.size === 0 ? "pvx-tag--active" : ""}`,
|
|
542
519
|
children: "All"
|
|
543
520
|
}
|
|
544
521
|
),
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
522
|
+
o.map((d, p) => /* @__PURE__ */ l("span", { className: "contents", children: [
|
|
523
|
+
p > 0 && /* @__PURE__ */ n("span", { className: "pvx-tag-separator" }),
|
|
524
|
+
d.tags.map((c) => /* @__PURE__ */ n(
|
|
548
525
|
"button",
|
|
549
526
|
{
|
|
550
|
-
onClick: () =>
|
|
551
|
-
className: `pvx-tag ${
|
|
552
|
-
children:
|
|
527
|
+
onClick: () => t(c),
|
|
528
|
+
className: `pvx-tag ${r.has(c) ? "pvx-tag--active" : ""}`,
|
|
529
|
+
children: i[c] || c
|
|
553
530
|
},
|
|
554
|
-
|
|
531
|
+
c
|
|
555
532
|
))
|
|
556
|
-
] },
|
|
533
|
+
] }, d.id))
|
|
557
534
|
] });
|
|
558
535
|
}
|
|
559
536
|
function se({ segments: e }) {
|
|
560
|
-
return /* @__PURE__ */
|
|
561
|
-
const
|
|
537
|
+
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((r, t) => {
|
|
538
|
+
const s = t === e.length - 1;
|
|
562
539
|
return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
|
|
563
|
-
|
|
564
|
-
!
|
|
565
|
-
] },
|
|
540
|
+
t > 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" }) }),
|
|
541
|
+
!s && r.onClick ? /* @__PURE__ */ n("button", { onClick: r.onClick, className: "pvx-breadcrumb-link", children: r.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: r.label })
|
|
542
|
+
] }, r.key);
|
|
566
543
|
}) }) });
|
|
567
544
|
}
|
|
568
545
|
function V({ message: e }) {
|
|
569
546
|
return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ n("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-4.5A3.375 3.375 0 0013.125 10.875h-2.25A3.375 3.375 0 007.5 14.25v4.5" }) }),
|
|
548
|
+
/* @__PURE__ */ n("p", { children: e })
|
|
572
549
|
] });
|
|
573
550
|
}
|
|
574
551
|
function K() {
|
|
575
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
|
|
576
553
|
}
|
|
577
|
-
function
|
|
578
|
-
return /* @__PURE__ */
|
|
554
|
+
function Xe() {
|
|
555
|
+
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
579
556
|
}
|
|
580
|
-
function
|
|
581
|
-
return /* @__PURE__ */
|
|
557
|
+
function en() {
|
|
558
|
+
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" }) });
|
|
582
559
|
}
|
|
583
|
-
function
|
|
584
|
-
const [d, p] =
|
|
585
|
-
var
|
|
586
|
-
if (!((
|
|
560
|
+
function ct({ tracks: e, isLoading: r, carMetadata: t, getUserDisplay: s, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
561
|
+
const [d, p] = O({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: g } = ke(i, o), f = S(() => {
|
|
562
|
+
var h;
|
|
563
|
+
if (!((h = t == null ? void 0 : t.tags) != null && h.length)) return [];
|
|
587
564
|
const x = /* @__PURE__ */ new Set();
|
|
588
565
|
for (const N of e || [])
|
|
589
|
-
N.recordByTag && Object.keys(N.recordByTag).forEach((
|
|
590
|
-
return
|
|
591
|
-
}, [e,
|
|
592
|
-
var
|
|
566
|
+
N.recordByTag && Object.keys(N.recordByTag).forEach((v) => x.add(v));
|
|
567
|
+
return t.tags.filter((N) => x.has(N));
|
|
568
|
+
}, [e, t]), m = S(() => e ? c.size === 0 ? e : e.map((x) => {
|
|
569
|
+
var v, k;
|
|
593
570
|
if (!x.recordByTag) return null;
|
|
594
|
-
let
|
|
571
|
+
let h = null;
|
|
595
572
|
const N = /* @__PURE__ */ new Set();
|
|
596
573
|
for (const b of Object.values(x.recordByTag)) {
|
|
597
574
|
if (N.has(b.carId)) continue;
|
|
598
575
|
N.add(b.carId);
|
|
599
|
-
const L = ((
|
|
600
|
-
|
|
576
|
+
const L = ((k = (v = t == null ? void 0 : t.cars) == null ? void 0 : v[b.carId]) == null ? void 0 : k.tags) || [];
|
|
577
|
+
ye(L, c, t == null ? void 0 : t.categories) && (!h || b.lapTimeMs < h.lapTimeMs) && (h = b);
|
|
601
578
|
}
|
|
602
|
-
return
|
|
579
|
+
return h ? {
|
|
603
580
|
...x,
|
|
604
581
|
record: {
|
|
605
|
-
visibleId:
|
|
606
|
-
carId:
|
|
607
|
-
carDisplayName: I(
|
|
608
|
-
lapTimeMs:
|
|
609
|
-
timestamp:
|
|
582
|
+
visibleId: h.steamId || h.identifier,
|
|
583
|
+
carId: h.carId,
|
|
584
|
+
carDisplayName: I(h.carId),
|
|
585
|
+
lapTimeMs: h.lapTimeMs,
|
|
586
|
+
timestamp: h.recordedAt
|
|
610
587
|
}
|
|
611
588
|
} : null;
|
|
612
|
-
}).filter(Boolean) : [], [e, c,
|
|
613
|
-
var N,
|
|
614
|
-
switch (
|
|
589
|
+
}).filter(Boolean) : [], [e, c, t]), y = S(() => z(m, d, (x, h) => {
|
|
590
|
+
var N, v;
|
|
591
|
+
switch (h) {
|
|
615
592
|
case "displayName":
|
|
616
593
|
return x.displayName;
|
|
617
594
|
case "record.lapTimeMs":
|
|
@@ -622,104 +599,124 @@ function pn({ tracks: e, isLoading: n, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
622
599
|
return x.carCount || 0;
|
|
623
600
|
case "record.timestamp":
|
|
624
601
|
default:
|
|
625
|
-
return (
|
|
602
|
+
return (v = x.record) != null && v.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
626
603
|
}
|
|
627
604
|
}), [m, d]);
|
|
628
|
-
return
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
605
|
+
return r ? /* @__PURE__ */ n(K, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
606
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
607
|
+
/* @__PURE__ */ n(
|
|
608
|
+
Ce,
|
|
609
|
+
{
|
|
610
|
+
availableTags: f,
|
|
611
|
+
activeTags: c,
|
|
612
|
+
onToggle: u,
|
|
613
|
+
onClear: g,
|
|
614
|
+
categories: t == null ? void 0 : t.categories,
|
|
615
|
+
tagLabels: t == null ? void 0 : t.tagLabels
|
|
616
|
+
}
|
|
617
|
+
),
|
|
618
|
+
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
619
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
620
|
+
/* @__PURE__ */ n($, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
|
|
621
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
622
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
623
|
+
/* @__PURE__ */ n($, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
|
|
624
|
+
/* @__PURE__ */ n($, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
|
|
625
|
+
/* @__PURE__ */ n($, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
|
|
626
|
+
/* @__PURE__ */ n($, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
|
|
640
627
|
] }) }),
|
|
641
|
-
/* @__PURE__ */
|
|
642
|
-
var
|
|
628
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: y.map((x) => {
|
|
629
|
+
var h, N, v;
|
|
643
630
|
return /* @__PURE__ */ l(
|
|
644
631
|
"tr",
|
|
645
632
|
{
|
|
646
633
|
className: "pvx-row pvx-row--clickable",
|
|
647
634
|
onClick: () => a(x.id, x.layout),
|
|
648
635
|
children: [
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
637
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (h = x.record) != null && h.visibleId ? /* @__PURE__ */ n(Q, { userId: x.record.visibleId, getUserDisplay: s }) : "-" }),
|
|
638
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
|
|
639
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? U(x.record.lapTimeMs) : "-" }),
|
|
640
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
641
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
|
|
642
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (v = x.record) != null && v.timestamp ? _(x.record.timestamp) : "-" })
|
|
656
643
|
]
|
|
657
644
|
},
|
|
658
645
|
`${x.id}|${x.layout || ""}`
|
|
659
646
|
);
|
|
660
647
|
}) })
|
|
661
648
|
] }) })
|
|
662
|
-
] }) : /* @__PURE__ */
|
|
649
|
+
] }) : /* @__PURE__ */ n(V, { message: "No lap times recorded yet." });
|
|
663
650
|
}
|
|
664
|
-
function
|
|
665
|
-
const [c, u] =
|
|
666
|
-
var
|
|
667
|
-
if (!e || !((
|
|
668
|
-
const
|
|
651
|
+
function dt({ entries: e, isLoading: r, track: t, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
|
|
652
|
+
const [c, u] = O({ key: "lapTimeMs", dir: "asc" }), { activeTags: g, toggle: f, clear: m } = ke(d, p), y = S(() => {
|
|
653
|
+
var k, b, L;
|
|
654
|
+
if (!e || !((k = s == null ? void 0 : s.tags) != null && k.length)) return [];
|
|
655
|
+
const v = /* @__PURE__ */ new Set();
|
|
669
656
|
for (const M of e)
|
|
670
|
-
(((L = (b =
|
|
671
|
-
return
|
|
672
|
-
}, [e,
|
|
657
|
+
(((L = (b = s.cars) == null ? void 0 : b[M.carId]) == null ? void 0 : L.tags) || []).forEach((A) => v.add(A));
|
|
658
|
+
return s.tags.filter((M) => v.has(M));
|
|
659
|
+
}, [e, s]), x = S(() => e ? g.size === 0 ? e : e.filter((v) => {
|
|
673
660
|
var b, L;
|
|
674
|
-
const
|
|
675
|
-
return
|
|
676
|
-
}) : [], [e, g,
|
|
677
|
-
switch (
|
|
661
|
+
const k = ((L = (b = s == null ? void 0 : s.cars) == null ? void 0 : b[v.carId]) == null ? void 0 : L.tags) || [];
|
|
662
|
+
return ye(k, g, s == null ? void 0 : s.categories);
|
|
663
|
+
}) : [], [e, g, s]), h = S(() => z(x, c, (v, k) => {
|
|
664
|
+
switch (k) {
|
|
678
665
|
case "carId":
|
|
679
|
-
return I(
|
|
666
|
+
return I(v.carId);
|
|
680
667
|
case "driverCount":
|
|
681
|
-
return
|
|
668
|
+
return v.driverCount || 0;
|
|
682
669
|
case "lapTimeMs":
|
|
683
670
|
default:
|
|
684
|
-
return
|
|
671
|
+
return v.lapTimeMs;
|
|
685
672
|
}
|
|
686
673
|
}), [x, c]), N = [
|
|
687
674
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
688
|
-
{ key: "track", label:
|
|
675
|
+
{ key: "track", label: t.displayName }
|
|
689
676
|
];
|
|
690
|
-
return
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
677
|
+
return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
678
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(se, { segments: N }) }),
|
|
679
|
+
/* @__PURE__ */ n(
|
|
680
|
+
Ce,
|
|
681
|
+
{
|
|
682
|
+
availableTags: y,
|
|
683
|
+
activeTags: g,
|
|
684
|
+
onToggle: f,
|
|
685
|
+
onClear: m,
|
|
686
|
+
categories: s == null ? void 0 : s.categories,
|
|
687
|
+
tagLabels: s == null ? void 0 : s.tagLabels
|
|
688
|
+
}
|
|
689
|
+
),
|
|
690
|
+
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
691
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
692
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
693
|
+
/* @__PURE__ */ n($, { label: "Car", sortKey: "carId", config: c, onSort: u }),
|
|
694
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
695
|
+
/* @__PURE__ */ n($, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
|
|
696
|
+
/* @__PURE__ */ n($, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
|
|
697
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
701
698
|
] }) }),
|
|
702
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: h.map((v, k) => /* @__PURE__ */ l(
|
|
703
700
|
"tr",
|
|
704
701
|
{
|
|
705
702
|
className: "pvx-row pvx-row--clickable",
|
|
706
|
-
onClick: () => i(
|
|
703
|
+
onClick: () => i(v.carId),
|
|
707
704
|
children: [
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(re, { rank: k + 1, podium: !0 }) }),
|
|
706
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: I(v.carId) }),
|
|
707
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(Q, { userId: v.steamId || v.userId, getUserDisplay: a }) }),
|
|
708
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(v.lapTimeMs) }),
|
|
709
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: v.driverCount || "-" }),
|
|
710
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: v.recordedAt ? _(v.recordedAt) : "-" })
|
|
714
711
|
]
|
|
715
712
|
},
|
|
716
|
-
|
|
713
|
+
v.carId
|
|
717
714
|
)) })
|
|
718
|
-
] }) }) : /* @__PURE__ */
|
|
715
|
+
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this track yet." })
|
|
719
716
|
] });
|
|
720
717
|
}
|
|
721
|
-
function
|
|
722
|
-
const [p, c] =
|
|
718
|
+
function pt({ entries: e, isLoading: r, track: t, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
719
|
+
const [p, c] = O({ key: "lapTimeMs", dir: "asc" }), u = S(() => we(e), [e]), g = S(() => z(e || [], p, (m, y) => {
|
|
723
720
|
switch (y) {
|
|
724
721
|
case "userId":
|
|
725
722
|
return a(m.steamId || m.userId).displayName;
|
|
@@ -731,68 +728,68 @@ function mn({ entries: e, isLoading: n, track: s, carId: r, getUserDisplay: a, o
|
|
|
731
728
|
}
|
|
732
729
|
}), [e, p, a]), f = [
|
|
733
730
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
734
|
-
{ key: "track", label:
|
|
735
|
-
{ key: "car", label: I(
|
|
731
|
+
{ key: "track", label: t.displayName, onClick: () => o("track") },
|
|
732
|
+
{ key: "car", label: I(s) }
|
|
736
733
|
];
|
|
737
|
-
return
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
e != null && e.length ? /* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
734
|
+
return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
735
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(se, { segments: f }) }),
|
|
736
|
+
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
737
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
738
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
739
|
+
/* @__PURE__ */ n($, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
|
|
740
|
+
/* @__PURE__ */ n($, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
|
|
741
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
742
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
743
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
744
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
745
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
746
|
+
/* @__PURE__ */ n($, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
|
|
747
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
751
748
|
] }) }),
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
const x = y + 1,
|
|
749
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: g.map((m, y) => {
|
|
750
|
+
const x = y + 1, h = m.steamId || m.userId, N = u && m.sector1Ms === u.s1, v = u && m.sector2Ms === u.s2, k = u && m.sector3Ms === u.s3;
|
|
754
751
|
return /* @__PURE__ */ l(
|
|
755
752
|
"tr",
|
|
756
753
|
{
|
|
757
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
758
|
-
onClick: () => i(
|
|
754
|
+
className: `pvx-row pvx-row--clickable ${d && h === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
755
|
+
onClick: () => i(h),
|
|
759
756
|
children: [
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(re, { rank: x, podium: !0 }) }),
|
|
758
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(Q, { userId: h, getUserDisplay: a }) }),
|
|
759
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(m.lapTimeMs) }),
|
|
760
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: B(m.sector1Ms) }),
|
|
761
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${v ? "pvx-td--best-sector" : ""}`, children: B(m.sector2Ms) }),
|
|
762
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: B(m.sector3Ms) }),
|
|
763
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: me(m.tyreCompound), children: m.tyreCompound || "-" }),
|
|
764
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: ve(m.startingFuelL) }),
|
|
765
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.lapCount || "-" }),
|
|
766
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: m.recordedAt ? _(m.recordedAt) : "-" })
|
|
770
767
|
]
|
|
771
768
|
},
|
|
772
|
-
|
|
769
|
+
h
|
|
773
770
|
);
|
|
774
771
|
}) })
|
|
775
|
-
] }) }) : /* @__PURE__ */
|
|
772
|
+
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this car yet." })
|
|
776
773
|
] });
|
|
777
774
|
}
|
|
778
|
-
function
|
|
779
|
-
const { data: c, driverName: u, theoreticalBest: g, isLoading: f } =
|
|
780
|
-
const
|
|
781
|
-
return
|
|
775
|
+
function ut({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
|
|
776
|
+
const { data: c, driverName: u, theoreticalBest: g, isLoading: f } = Oe(e, r.id, r.layout, t, { showInvalid: i, game: s, gameVersion: a }), { displayName: m, avatarUrl: y } = o(e, u), x = S(() => we(c, !0), [c]), h = S(() => {
|
|
777
|
+
const v = (c == null ? void 0 : c.filter((k) => k.isValid)) || [];
|
|
778
|
+
return v.length ? Math.min(...v.map((k) => k.lapTimeMs)) : null;
|
|
782
779
|
}, [c]), N = [
|
|
783
780
|
{ key: "tracks", label: "Tracks", onClick: () => p("tracks") },
|
|
784
|
-
{ key: "track", label:
|
|
785
|
-
{ key: "car", label: I(
|
|
781
|
+
{ key: "track", label: r.displayName, onClick: () => p("track") },
|
|
782
|
+
{ key: "car", label: I(t), onClick: () => p("car") },
|
|
786
783
|
{ key: "driver", label: m }
|
|
787
784
|
];
|
|
788
|
-
return f ? /* @__PURE__ */
|
|
785
|
+
return f ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
789
786
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
790
787
|
/* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
y ? /* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ n(se, { segments: N }),
|
|
789
|
+
y ? /* @__PURE__ */ n("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
793
790
|
] }),
|
|
794
791
|
/* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
|
|
795
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ n(
|
|
796
793
|
"input",
|
|
797
794
|
{
|
|
798
795
|
type: "checkbox",
|
|
@@ -801,12 +798,12 @@ function hn({ userId: e, track: n, carId: s, game: r, gameVersion: a, showInvali
|
|
|
801
798
|
className: "pvx-checkbox"
|
|
802
799
|
}
|
|
803
800
|
),
|
|
804
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ n("span", { children: "Show invalid laps" })
|
|
805
802
|
] })
|
|
806
803
|
] }),
|
|
807
804
|
g && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
|
|
806
|
+
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: U(g.lapTimeMs) }),
|
|
810
807
|
/* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
|
|
811
808
|
"(",
|
|
812
809
|
B(g.sector1Ms),
|
|
@@ -817,40 +814,40 @@ function hn({ userId: e, track: n, carId: s, game: r, gameVersion: a, showInvali
|
|
|
817
814
|
")"
|
|
818
815
|
] })
|
|
819
816
|
] }),
|
|
820
|
-
c != null && c.length ? /* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
817
|
+
c != null && c.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
818
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
819
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
820
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
|
|
821
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Lap Time" }),
|
|
822
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
823
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
824
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
825
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
|
|
826
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
827
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
828
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
832
829
|
] }) }),
|
|
833
|
-
/* @__PURE__ */
|
|
834
|
-
const b =
|
|
830
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((v, k) => {
|
|
831
|
+
const b = v.isValid && v.lapTimeMs === h, L = x && v.isValid && v.sector1Ms === x.s1, M = x && v.isValid && v.sector2Ms === x.s2, w = x && v.isValid && v.sector3Ms === x.s3;
|
|
835
832
|
let A = "pvx-row";
|
|
836
|
-
return
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
] },
|
|
833
|
+
return v.isValid || (A += " pvx-row--invalid"), b && (A += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: A, children: [
|
|
834
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${b ? "pvx-rank--gold" : ""}`, children: k + 1 }) }),
|
|
835
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: v.lapNumber || "-" }),
|
|
836
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(v.lapTimeMs) }),
|
|
837
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: B(v.sector1Ms) }),
|
|
838
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${M ? "pvx-td--best-sector" : ""}`, children: B(v.sector2Ms) }),
|
|
839
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: B(v.sector3Ms) }),
|
|
840
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", title: v.isValid ? void 0 : v.invalidReason || "Invalid", children: v.isValid ? /* @__PURE__ */ n(Xe, {}) : /* @__PURE__ */ n(en, {}) }),
|
|
841
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: me(v.tyreCompound), children: v.tyreCompound || "-" }),
|
|
842
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: ve(v.startingFuelL) }),
|
|
843
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: _(v.timestamp) })
|
|
844
|
+
] }, v.id);
|
|
848
845
|
}) })
|
|
849
|
-
] }) }) : /* @__PURE__ */
|
|
846
|
+
] }) }) : /* @__PURE__ */ n(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
850
847
|
] });
|
|
851
848
|
}
|
|
852
|
-
function
|
|
853
|
-
const [o, d] =
|
|
849
|
+
function mt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion: a, onComboSelect: i }) {
|
|
850
|
+
const [o, d] = O({ key: "rank", dir: "asc" }), [p, c] = D(null), u = S(() => e ? z(e, o, (f, m) => {
|
|
854
851
|
switch (m) {
|
|
855
852
|
case "rating":
|
|
856
853
|
return f.rating;
|
|
@@ -863,45 +860,45 @@ function vn({ drivers: e, isLoading: n, getUserDisplay: s, game: r, gameVersion:
|
|
|
863
860
|
return f.rank;
|
|
864
861
|
}
|
|
865
862
|
}) : [], [e, o]);
|
|
866
|
-
if (
|
|
863
|
+
if (r) return /* @__PURE__ */ n(K, {});
|
|
867
864
|
if (!(e != null && e.length))
|
|
868
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(V, { message: "Not enough data for rankings yet." }) });
|
|
869
866
|
const g = 5;
|
|
870
867
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
871
868
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
872
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
|
|
873
870
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-info-trigger", children: [
|
|
874
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ n("svg", { className: "pvx-rankings-info-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) }),
|
|
875
872
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-info-tooltip", children: [
|
|
876
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-info-title", children: "How ratings work" }),
|
|
877
874
|
/* @__PURE__ */ l("ul", { className: "pvx-rankings-info-list", children: [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ n("li", { children: "For each car/track combo with 3+ drivers, you're ranked by lap time and given a percentile (100 = fastest, 0 = slowest)" }),
|
|
876
|
+
/* @__PURE__ */ n("li", { children: "Your rating is a weighted average across all your combos — bigger fields count more" }),
|
|
877
|
+
/* @__PURE__ */ n("li", { children: "A confidence adjustment rewards car diversity: the more different cars you drive competitively, the closer your rating reflects your true score" }),
|
|
878
|
+
/* @__PURE__ */ n("li", { children: "Minimum 2 qualifying combos required" })
|
|
882
879
|
] })
|
|
883
880
|
] })
|
|
884
881
|
] })
|
|
885
882
|
] }),
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
/* @__PURE__ */
|
|
888
|
-
/* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
884
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
885
|
+
/* @__PURE__ */ n($, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
|
|
886
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
887
|
+
/* @__PURE__ */ n($, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
|
|
888
|
+
/* @__PURE__ */ n($, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
889
|
+
/* @__PURE__ */ n($, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
|
|
893
890
|
] }) }),
|
|
894
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
|
|
895
892
|
const m = p === f.identifier;
|
|
896
|
-
return /* @__PURE__ */
|
|
897
|
-
|
|
893
|
+
return /* @__PURE__ */ n(
|
|
894
|
+
nn,
|
|
898
895
|
{
|
|
899
896
|
driver: f,
|
|
900
|
-
getUserDisplay:
|
|
897
|
+
getUserDisplay: t,
|
|
901
898
|
isExpanded: m,
|
|
902
899
|
onToggle: () => c(m ? null : f.identifier),
|
|
903
900
|
colCount: g,
|
|
904
|
-
game:
|
|
901
|
+
game: s,
|
|
905
902
|
gameVersion: a,
|
|
906
903
|
onComboSelect: i
|
|
907
904
|
},
|
|
@@ -911,27 +908,27 @@ function vn({ drivers: e, isLoading: n, getUserDisplay: s, game: r, gameVersion:
|
|
|
911
908
|
] }) })
|
|
912
909
|
] });
|
|
913
910
|
}
|
|
914
|
-
function
|
|
911
|
+
function nn({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
|
|
915
912
|
const p = e.identifier;
|
|
916
913
|
return /* @__PURE__ */ l(F, { children: [
|
|
917
914
|
/* @__PURE__ */ l(
|
|
918
915
|
"tr",
|
|
919
916
|
{
|
|
920
917
|
className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
921
|
-
onClick:
|
|
918
|
+
onClick: s,
|
|
922
919
|
children: [
|
|
923
|
-
/* @__PURE__ */
|
|
924
|
-
/* @__PURE__ */
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(re, { rank: e.rank, podium: !0 }) }),
|
|
921
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(Q, { userId: p, getUserDisplay: r }) }),
|
|
922
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
|
|
923
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
924
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
|
|
928
925
|
e.comboCount,
|
|
929
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${t ? "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" }) })
|
|
930
927
|
] }) })
|
|
931
928
|
]
|
|
932
929
|
}
|
|
933
930
|
),
|
|
934
|
-
|
|
931
|
+
t && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
|
|
935
932
|
const g = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: g, car: c.carId, highlight: p, game: i, gameVersion: o }) : void 0;
|
|
936
933
|
return /* @__PURE__ */ l(
|
|
937
934
|
"div",
|
|
@@ -941,11 +938,11 @@ function rt({ driver: e, getUserDisplay: n, isExpanded: s, onToggle: r, colCount
|
|
|
941
938
|
role: f ? "button" : void 0,
|
|
942
939
|
children: [
|
|
943
940
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: j(c.trackId, c.layout, i) }),
|
|
942
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
|
|
946
943
|
] }),
|
|
947
944
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
|
|
948
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-time", children: U(c.lapTimeMs) }),
|
|
949
946
|
/* @__PURE__ */ l("p", { className: `pvx-rankings-combo-pct ${c.percentile >= 75 ? "pvx-rankings-combo-pct--high" : c.percentile >= 50 ? "pvx-rankings-combo-pct--mid" : c.percentile >= 25 ? "pvx-rankings-combo-pct--low" : "pvx-rankings-combo-pct--bottom"}`, children: [
|
|
950
947
|
c.percentile.toFixed(0),
|
|
951
948
|
"%",
|
|
@@ -965,7 +962,7 @@ function rt({ driver: e, getUserDisplay: n, isExpanded: s, onToggle: r, colCount
|
|
|
965
962
|
}) }) }) })
|
|
966
963
|
] });
|
|
967
964
|
}
|
|
968
|
-
const
|
|
965
|
+
const tn = {
|
|
969
966
|
GBR: "🇬🇧",
|
|
970
967
|
DEU: "🇩🇪",
|
|
971
968
|
NLD: "🇳🇱",
|
|
@@ -996,150 +993,150 @@ const st = {
|
|
|
996
993
|
RUS: "🇷🇺",
|
|
997
994
|
TUR: "🇹🇷",
|
|
998
995
|
KOR: "🇰🇷"
|
|
999
|
-
}, ae = ["🥇", "🥈", "🥉"],
|
|
996
|
+
}, ae = ["🥇", "🥈", "🥉"], rn = {
|
|
1000
997
|
championship: "Championship",
|
|
1001
998
|
series: "Series",
|
|
1002
999
|
event: "Event",
|
|
1003
1000
|
hotlap: "Hotlap"
|
|
1004
|
-
},
|
|
1001
|
+
}, sn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1005
1002
|
function de(e) {
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
return
|
|
1003
|
+
const r = sn.indexOf(e);
|
|
1004
|
+
if (r >= 0) return r;
|
|
1005
|
+
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1006
|
+
return t ? 100 + parseInt(t[1]) : 999;
|
|
1010
1007
|
}
|
|
1011
1008
|
function ie(e) {
|
|
1012
|
-
const
|
|
1013
|
-
return
|
|
1009
|
+
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
1010
|
+
return r ? `P${r[1]}` : e;
|
|
1014
1011
|
}
|
|
1015
1012
|
function oe({ position: e }) {
|
|
1016
|
-
return /* @__PURE__ */
|
|
1013
|
+
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 });
|
|
1017
1014
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const
|
|
1020
|
-
return
|
|
1015
|
+
function G({ nation: e }) {
|
|
1016
|
+
const r = e && tn[e];
|
|
1017
|
+
return r ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: r }) : null;
|
|
1021
1018
|
}
|
|
1022
|
-
function
|
|
1019
|
+
function an({ sessions: e, activeSession: r, onSelect: t }) {
|
|
1023
1020
|
if (!e || e.length <= 1) return null;
|
|
1024
|
-
const
|
|
1021
|
+
const s = [...e].sort(
|
|
1025
1022
|
(a, i) => de(a.type) - de(i.type)
|
|
1026
1023
|
);
|
|
1027
|
-
return /* @__PURE__ */
|
|
1024
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
1028
1025
|
"button",
|
|
1029
1026
|
{
|
|
1030
|
-
onClick: () =>
|
|
1031
|
-
className: `pvx-session-tab ${
|
|
1027
|
+
onClick: () => t(a.type),
|
|
1028
|
+
className: `pvx-session-tab ${r === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1032
1029
|
children: ie(a.type)
|
|
1033
1030
|
},
|
|
1034
1031
|
a.type
|
|
1035
1032
|
)) });
|
|
1036
1033
|
}
|
|
1037
|
-
function
|
|
1038
|
-
return /* @__PURE__ */
|
|
1034
|
+
function on({ type: e }) {
|
|
1035
|
+
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: rn[e] || e });
|
|
1039
1036
|
}
|
|
1040
|
-
function J({ children: e, variant:
|
|
1041
|
-
return /* @__PURE__ */
|
|
1037
|
+
function J({ children: e, variant: r = "default" }) {
|
|
1038
|
+
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${r !== "default" ? `pvx-info-pill--${r}` : ""}`, children: e });
|
|
1042
1039
|
}
|
|
1043
|
-
function
|
|
1040
|
+
function ln(e) {
|
|
1044
1041
|
if (!e) return "TBD";
|
|
1045
|
-
const
|
|
1046
|
-
if (isNaN(
|
|
1047
|
-
const
|
|
1048
|
-
return `${
|
|
1049
|
-
}
|
|
1050
|
-
function
|
|
1051
|
-
return e.reduce((
|
|
1052
|
-
var
|
|
1053
|
-
return (
|
|
1054
|
-
const o =
|
|
1042
|
+
const r = new Date(e);
|
|
1043
|
+
if (isNaN(r)) return "TBD";
|
|
1044
|
+
const t = r.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = r.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1045
|
+
return `${t} • ${s}`;
|
|
1046
|
+
}
|
|
1047
|
+
function cn(e) {
|
|
1048
|
+
return e.reduce((r, t) => {
|
|
1049
|
+
var s;
|
|
1050
|
+
return (s = t.splits) != null && s.length ? r ? r.map((a, i) => {
|
|
1051
|
+
const o = t.splits[i];
|
|
1055
1052
|
return o && o < a ? o : a;
|
|
1056
|
-
}) : [...
|
|
1053
|
+
}) : [...t.splits] : r;
|
|
1057
1054
|
}, null);
|
|
1058
1055
|
}
|
|
1059
1056
|
function E({ message: e = "Loading..." }) {
|
|
1060
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
|
|
1061
1058
|
}
|
|
1062
1059
|
function P({ message: e = "No data available." }) {
|
|
1063
|
-
return /* @__PURE__ */
|
|
1064
|
-
}
|
|
1065
|
-
const
|
|
1066
|
-
function
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1069
|
-
}
|
|
1070
|
-
function
|
|
1071
|
-
const
|
|
1072
|
-
if (!(
|
|
1073
|
-
let
|
|
1074
|
-
for (const
|
|
1075
|
-
if (!
|
|
1076
|
-
const a = new Date(
|
|
1077
|
-
isNaN(a) || (!
|
|
1060
|
+
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1061
|
+
}
|
|
1062
|
+
const Le = 3;
|
|
1063
|
+
function dn(e) {
|
|
1064
|
+
const r = e == null ? void 0 : e.rounds;
|
|
1065
|
+
return r != null && r.length ? e.type === "hotlap" ? r.every((t) => t.isFinalized && t.dediStatus === "completed") : r.every((t) => t.isFinalized) : !1;
|
|
1066
|
+
}
|
|
1067
|
+
function pn(e) {
|
|
1068
|
+
const r = e == null ? void 0 : e.rounds;
|
|
1069
|
+
if (!(r != null && r.length)) return null;
|
|
1070
|
+
let t = null;
|
|
1071
|
+
for (const s of r) {
|
|
1072
|
+
if (!s.startTime) continue;
|
|
1073
|
+
const a = new Date(s.startTime);
|
|
1074
|
+
isNaN(a) || (!t || a > t) && (t = a);
|
|
1078
1075
|
}
|
|
1079
|
-
return
|
|
1076
|
+
return t;
|
|
1080
1077
|
}
|
|
1081
|
-
function
|
|
1082
|
-
if (!
|
|
1083
|
-
const
|
|
1084
|
-
if (!
|
|
1085
|
-
const
|
|
1086
|
-
return Date.now() -
|
|
1078
|
+
function Se(e, r = Le) {
|
|
1079
|
+
if (!dn(e)) return "active";
|
|
1080
|
+
const t = pn(e);
|
|
1081
|
+
if (!t) return "recently-completed";
|
|
1082
|
+
const s = r * 24 * 60 * 60 * 1e3;
|
|
1083
|
+
return Date.now() - t.getTime() <= s ? "recently-completed" : "archived";
|
|
1087
1084
|
}
|
|
1088
|
-
function
|
|
1085
|
+
function vt(e, r, t = Le) {
|
|
1089
1086
|
if (!(e != null && e.length)) return [];
|
|
1090
|
-
const
|
|
1091
|
-
return e.filter((a) =>
|
|
1092
|
-
}
|
|
1093
|
-
function
|
|
1094
|
-
const
|
|
1095
|
-
return Array.isArray(
|
|
1096
|
-
}
|
|
1097
|
-
function
|
|
1098
|
-
const { data: a } = ge(e), i =
|
|
1099
|
-
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
i.length > 0 && /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1087
|
+
const s = new Set(Array.isArray(r) ? r : [r]);
|
|
1088
|
+
return e.filter((a) => s.has(Se(a, t)));
|
|
1089
|
+
}
|
|
1090
|
+
function un(e, r = 3) {
|
|
1091
|
+
const t = e == null ? void 0 : e.standings;
|
|
1092
|
+
return Array.isArray(t) ? [...t].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, r) : [];
|
|
1093
|
+
}
|
|
1094
|
+
function mn({ competitionId: e, topN: r = 3, label: t = "Completed", className: s }) {
|
|
1095
|
+
const { data: a } = ge(e), i = un(a, r);
|
|
1096
|
+
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
|
|
1097
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: t }),
|
|
1098
|
+
i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1099
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: ae[d] || "" }),
|
|
1100
|
+
/* @__PURE__ */ n(G, { nation: o.nation }),
|
|
1101
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
|
|
1105
1102
|
] }, o.driverId || d)) })
|
|
1106
1103
|
] });
|
|
1107
1104
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1105
|
+
function ht({ competitions: e, isLoading: r, onSelect: t, onRegister: s, className: a }) {
|
|
1106
|
+
return r ? /* @__PURE__ */ n(E, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(vn, { comp: i, onSelect: t, onRegister: s || t }, i.id)) }) : /* @__PURE__ */ n(P, { message: "No competitions available." });
|
|
1110
1107
|
}
|
|
1111
|
-
function
|
|
1112
|
-
var
|
|
1113
|
-
const { cdnUrl:
|
|
1108
|
+
function vn({ comp: e, onSelect: r, onRegister: t }) {
|
|
1109
|
+
var v, k, b;
|
|
1110
|
+
const { cdnUrl: s } = C(), 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, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), u = (i == null ? void 0 : i.isOpen) && !c && !p, g = /* @__PURE__ */ new Date(), f = (v = e.rounds) == null ? void 0 : v.find((L) => L.startTime && new Date(L.startTime) >= g), m = ((k = e.rounds) == null ? void 0 : k.length) || 0, y = ((b = e.rounds) == null ? void 0 : b.filter((L) => L.isFinalized).length) || 0, x = Se(e), h = x === "recently-completed" || x === "archived", N = e.type === "championship";
|
|
1114
1111
|
return /* @__PURE__ */ l(
|
|
1115
1112
|
"div",
|
|
1116
1113
|
{
|
|
1117
1114
|
className: "pvx-comp-card",
|
|
1118
|
-
onClick: () =>
|
|
1115
|
+
onClick: () => r(e.id),
|
|
1119
1116
|
role: "button",
|
|
1120
1117
|
tabIndex: 0,
|
|
1121
1118
|
onKeyDown: (L) => {
|
|
1122
|
-
(L.key === "Enter" || L.key === " ") && (L.preventDefault(),
|
|
1119
|
+
(L.key === "Enter" || L.key === " ") && (L.preventDefault(), r(e.id));
|
|
1123
1120
|
},
|
|
1124
1121
|
children: [
|
|
1125
|
-
/* @__PURE__ */
|
|
1122
|
+
/* @__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(xn, {}) }) }),
|
|
1126
1123
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
e.description && /* @__PURE__ */
|
|
1124
|
+
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1125
|
+
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1129
1126
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
e.game && /* @__PURE__ */
|
|
1132
|
-
e.formatDescription && e.formatDescription.split(", ").map((L, M) => /* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ n(on, { type: e.type }),
|
|
1128
|
+
e.game && /* @__PURE__ */ n(J, { children: e.game.toUpperCase() }),
|
|
1129
|
+
e.formatDescription && e.formatDescription.split(", ").map((L, M) => /* @__PURE__ */ n(J, { variant: "format", children: L }, M))
|
|
1133
1130
|
] }),
|
|
1134
|
-
e.carsDescription && /* @__PURE__ */
|
|
1131
|
+
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((L, M) => /* @__PURE__ */ n(J, { children: L }, M)) }),
|
|
1135
1132
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
|
|
1136
1133
|
f ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1137
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
1138
1135
|
" ",
|
|
1139
1136
|
e.type !== "hotlap" && `R${f.roundNumber} `,
|
|
1140
1137
|
f.track || "TBD",
|
|
1141
1138
|
" · ",
|
|
1142
|
-
|
|
1139
|
+
ln(f.startTime)
|
|
1143
1140
|
] }) : m > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1144
1141
|
y,
|
|
1145
1142
|
"/",
|
|
@@ -1152,9 +1149,9 @@ function vt({ comp: e, onSelect: n, onRegister: s }) {
|
|
|
1152
1149
|
m !== 1 ? "s" : ""
|
|
1153
1150
|
] })
|
|
1154
1151
|
] }),
|
|
1155
|
-
|
|
1156
|
-
i && !
|
|
1157
|
-
|
|
1152
|
+
h && N && /* @__PURE__ */ n(mn, { competitionId: e.id }),
|
|
1153
|
+
i && !h && /* @__PURE__ */ n(
|
|
1154
|
+
hn,
|
|
1158
1155
|
{
|
|
1159
1156
|
competitionId: e.id,
|
|
1160
1157
|
regOpen: u,
|
|
@@ -1162,7 +1159,7 @@ function vt({ comp: e, onSelect: n, onRegister: s }) {
|
|
|
1162
1159
|
deadlinePassed: c,
|
|
1163
1160
|
regCount: o,
|
|
1164
1161
|
regMax: d,
|
|
1165
|
-
onRegister:
|
|
1162
|
+
onRegister: t
|
|
1166
1163
|
}
|
|
1167
1164
|
)
|
|
1168
1165
|
] })
|
|
@@ -1170,16 +1167,16 @@ function vt({ comp: e, onSelect: n, onRegister: s }) {
|
|
|
1170
1167
|
}
|
|
1171
1168
|
);
|
|
1172
1169
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const { isPowerMode: d } =
|
|
1170
|
+
function hn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
|
|
1171
|
+
const { isPowerMode: d } = ne(), p = te(e), { data: c } = ee(e), u = (c == null ? void 0 : c.isRegistered) || !1, g = i ? a / i * 100 : 0, f = g >= 100 ? "full" : g >= 75 ? "warning" : "ok";
|
|
1175
1172
|
return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
|
|
1176
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
|
|
1177
1174
|
a,
|
|
1178
1175
|
"/",
|
|
1179
1176
|
i || "∞",
|
|
1180
1177
|
" drivers"
|
|
1181
1178
|
] }) }),
|
|
1182
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
|
|
1183
1180
|
"button",
|
|
1184
1181
|
{
|
|
1185
1182
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
@@ -1188,7 +1185,7 @@ function xt({ competitionId: e, regOpen: n, isFull: s, deadlinePassed: r, regCou
|
|
|
1188
1185
|
},
|
|
1189
1186
|
children: "✓ Registered"
|
|
1190
1187
|
}
|
|
1191
|
-
) :
|
|
1188
|
+
) : r ? d ? /* @__PURE__ */ n(
|
|
1192
1189
|
"button",
|
|
1193
1190
|
{
|
|
1194
1191
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
@@ -1197,7 +1194,7 @@ function xt({ competitionId: e, regOpen: n, isFull: s, deadlinePassed: r, regCou
|
|
|
1197
1194
|
},
|
|
1198
1195
|
children: "Register"
|
|
1199
1196
|
}
|
|
1200
|
-
) : /* @__PURE__ */
|
|
1197
|
+
) : /* @__PURE__ */ n(
|
|
1201
1198
|
"a",
|
|
1202
1199
|
{
|
|
1203
1200
|
href: p,
|
|
@@ -1207,45 +1204,45 @@ function xt({ competitionId: e, regOpen: n, isFull: s, deadlinePassed: r, regCou
|
|
|
1207
1204
|
onClick: (m) => m.stopPropagation(),
|
|
1208
1205
|
children: "Register"
|
|
1209
1206
|
}
|
|
1210
|
-
) : /* @__PURE__ */
|
|
1207
|
+
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: t ? "Full" : "Closed" }) })
|
|
1211
1208
|
] });
|
|
1212
1209
|
}
|
|
1213
|
-
function
|
|
1210
|
+
function xn() {
|
|
1214
1211
|
return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1215
|
-
/* @__PURE__ */
|
|
1216
|
-
/* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1213
|
+
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
1214
|
+
/* @__PURE__ */ n("path", { d: "M4 22h16" }),
|
|
1215
|
+
/* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
|
|
1216
|
+
/* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
|
|
1217
|
+
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1221
1218
|
] });
|
|
1222
1219
|
}
|
|
1223
|
-
function
|
|
1220
|
+
function gn({ competitionId: e, className: r }) {
|
|
1224
1221
|
var d, p;
|
|
1225
|
-
const { data:
|
|
1226
|
-
if (
|
|
1227
|
-
return /* @__PURE__ */
|
|
1228
|
-
if (!((d =
|
|
1229
|
-
return /* @__PURE__ */
|
|
1222
|
+
const { data: t, isLoading: s } = ge(e), { data: a, isLoading: i } = xe(e);
|
|
1223
|
+
if (s || i)
|
|
1224
|
+
return /* @__PURE__ */ n(E, { message: "Loading standings..." });
|
|
1225
|
+
if (!((d = t == null ? void 0 : t.standings) != null && d.length))
|
|
1226
|
+
return /* @__PURE__ */ n(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1230
1227
|
const o = ((p = a == null ? void 0 : a.rounds) == null ? void 0 : p.filter((c) => c.isFinalized)) || [];
|
|
1231
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
|
|
1229
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
1230
|
+
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
1234
1231
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
1235
1232
|
"After ",
|
|
1236
|
-
|
|
1233
|
+
t.roundsCompleted,
|
|
1237
1234
|
" round",
|
|
1238
|
-
|
|
1239
|
-
|
|
1235
|
+
t.roundsCompleted !== 1 ? "s" : "",
|
|
1236
|
+
t.countingRounds > 0 && ` (best ${t.countingRounds} count)`
|
|
1240
1237
|
] })
|
|
1241
1238
|
] }) }),
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1239
|
+
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
1240
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1241
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1242
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1243
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
|
|
1244
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
|
|
1245
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" }),
|
|
1249
1246
|
o.map((c) => /* @__PURE__ */ l(
|
|
1250
1247
|
"th",
|
|
1251
1248
|
{
|
|
@@ -1259,8 +1256,8 @@ function ft({ competitionId: e, className: n }) {
|
|
|
1259
1256
|
c.roundNumber
|
|
1260
1257
|
))
|
|
1261
1258
|
] }) }),
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
|
|
1259
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: t.standings.map((c) => /* @__PURE__ */ n(
|
|
1260
|
+
fn,
|
|
1264
1261
|
{
|
|
1265
1262
|
driver: c,
|
|
1266
1263
|
finalizedRounds: o
|
|
@@ -1270,23 +1267,23 @@ function ft({ competitionId: e, className: n }) {
|
|
|
1270
1267
|
] }) })
|
|
1271
1268
|
] });
|
|
1272
1269
|
}
|
|
1273
|
-
function
|
|
1270
|
+
function fn({ driver: e, finalizedRounds: r }) {
|
|
1274
1271
|
var o, d, p;
|
|
1275
|
-
const
|
|
1272
|
+
const t = e.position <= 3, s = new Map(
|
|
1276
1273
|
((o = e.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
|
|
1277
1274
|
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
|
|
1278
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1279
|
-
/* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${t ? "pvx-row--podium" : ""}`, children: [
|
|
1276
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(oe, { position: e.position }) }),
|
|
1280
1277
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1281
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ n(G, { nation: e.nation }),
|
|
1282
1279
|
e.driverName
|
|
1283
1280
|
] }),
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
|
|
1288
|
-
const u =
|
|
1289
|
-
return /* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1282
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1283
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1284
|
+
r.map((c) => {
|
|
1285
|
+
const u = s.get(c.roundNumber), g = u == null ? void 0 : u.dropped;
|
|
1286
|
+
return /* @__PURE__ */ n(
|
|
1290
1287
|
"td",
|
|
1291
1288
|
{
|
|
1292
1289
|
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!g && (u == null ? void 0 : u.position) === 1 ? "pvx-standings-cell--p1" : !g && (u == null ? void 0 : u.position) === 2 ? "pvx-standings-cell--p2" : !g && (u == null ? void 0 : u.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
|
|
@@ -1295,92 +1292,92 @@ function Nt({ driver: e, finalizedRounds: n }) {
|
|
|
1295
1292
|
"P",
|
|
1296
1293
|
u.position
|
|
1297
1294
|
] }),
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
] }) : /* @__PURE__ */
|
|
1295
|
+
/* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: u.points })
|
|
1296
|
+
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" })
|
|
1300
1297
|
},
|
|
1301
1298
|
c.roundNumber
|
|
1302
1299
|
);
|
|
1303
1300
|
})
|
|
1304
1301
|
] });
|
|
1305
1302
|
}
|
|
1306
|
-
function
|
|
1303
|
+
function xt({ competitionId: e, roundNumber: r, className: t }) {
|
|
1307
1304
|
var p;
|
|
1308
|
-
const { data:
|
|
1305
|
+
const { data: s, isLoading: a } = ze(e, r);
|
|
1309
1306
|
if (a)
|
|
1310
|
-
return /* @__PURE__ */
|
|
1311
|
-
if (!
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
const o = (
|
|
1314
|
-
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${
|
|
1307
|
+
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1308
|
+
if (!s)
|
|
1309
|
+
return /* @__PURE__ */ n(P, { message: "No results for this round." });
|
|
1310
|
+
const o = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
|
|
1311
|
+
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${t || ""}`, children: [
|
|
1315
1312
|
/* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
|
|
1316
1313
|
/* @__PURE__ */ l("div", { children: [
|
|
1317
1314
|
/* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
|
|
1318
1315
|
"Round ",
|
|
1319
|
-
|
|
1320
|
-
|
|
1316
|
+
s.roundNumber,
|
|
1317
|
+
s.track ? `: ${s.track}` : ""
|
|
1321
1318
|
] }),
|
|
1322
|
-
|
|
1319
|
+
s.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
|
|
1323
1320
|
day: "numeric",
|
|
1324
1321
|
month: "long",
|
|
1325
1322
|
year: "numeric"
|
|
1326
1323
|
}) })
|
|
1327
1324
|
] }),
|
|
1328
|
-
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1325
|
+
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1326
|
+
/* @__PURE__ */ n("span", { children: ae[c.position - 1] }),
|
|
1327
|
+
/* @__PURE__ */ n("span", { children: c.driverName })
|
|
1331
1328
|
] }, c.driverId)) })
|
|
1332
1329
|
] }),
|
|
1333
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ n(le, { round: s, competitionId: e })
|
|
1334
1331
|
] });
|
|
1335
1332
|
}
|
|
1336
|
-
function le({ round: e, competitionId:
|
|
1333
|
+
function le({ round: e, competitionId: r, className: t }) {
|
|
1337
1334
|
var u, g, f, m;
|
|
1338
|
-
const [
|
|
1335
|
+
const [s, a] = D(null), i = (e == null ? void 0 : e.sessions) || [];
|
|
1339
1336
|
if (!i.length)
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
const { data: o } =
|
|
1342
|
-
|
|
1337
|
+
return /* @__PURE__ */ n(P, { message: "No session data for this round." });
|
|
1338
|
+
const { data: o } = Ye(
|
|
1339
|
+
r,
|
|
1343
1340
|
e == null ? void 0 : e.roundNumber,
|
|
1344
1341
|
{}
|
|
1345
|
-
), d =
|
|
1346
|
-
return /* @__PURE__ */ l("div", { className:
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
|
|
1342
|
+
), d = s || ((u = i.find((y) => y.type === "RACE")) == null ? void 0 : u.type) || ((g = i[0]) == null ? void 0 : g.type), p = i.find((y) => y.type === d) || i[0], c = ((m = (f = o == null ? void 0 : o.sessions) == null ? void 0 : f.find((y) => y.type === d)) == null ? void 0 : m.drivers) || null;
|
|
1343
|
+
return /* @__PURE__ */ l("div", { className: t || "", children: [
|
|
1344
|
+
/* @__PURE__ */ n(
|
|
1345
|
+
an,
|
|
1349
1346
|
{
|
|
1350
1347
|
sessions: i,
|
|
1351
1348
|
activeSession: d,
|
|
1352
1349
|
onSelect: a
|
|
1353
1350
|
}
|
|
1354
1351
|
),
|
|
1355
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ n(Nn, { session: p, sessionLaps: c })
|
|
1356
1353
|
] });
|
|
1357
1354
|
}
|
|
1358
|
-
function
|
|
1355
|
+
function Nn({ session: e, sessionLaps: r }) {
|
|
1359
1356
|
var d;
|
|
1360
|
-
const
|
|
1357
|
+
const t = e.type === "RACE", [s, a] = D(null);
|
|
1361
1358
|
if (!((d = e.results) != null && d.length))
|
|
1362
|
-
return /* @__PURE__ */
|
|
1363
|
-
const i =
|
|
1364
|
-
return /* @__PURE__ */
|
|
1365
|
-
/* @__PURE__ */
|
|
1366
|
-
/* @__PURE__ */
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1359
|
+
return /* @__PURE__ */ n(P, { message: `No results for ${e.type}.` });
|
|
1360
|
+
const i = cn(e.results), o = t ? 7 : 4;
|
|
1361
|
+
return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
1362
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1363
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1364
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1365
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1366
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1367
|
+
t && /* @__PURE__ */ l(F, { children: [
|
|
1368
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1369
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1370
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1374
1371
|
] })
|
|
1375
1372
|
] }) }),
|
|
1376
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((p, c) => {
|
|
1377
1374
|
var f;
|
|
1378
|
-
const u = (f =
|
|
1379
|
-
return /* @__PURE__ */
|
|
1380
|
-
|
|
1375
|
+
const u = (f = r == null ? void 0 : r[p.driverId]) == null ? void 0 : f.laps, g = s === p.driverId && !!u;
|
|
1376
|
+
return /* @__PURE__ */ n(
|
|
1377
|
+
bn,
|
|
1381
1378
|
{
|
|
1382
1379
|
result: p,
|
|
1383
|
-
isRace:
|
|
1380
|
+
isRace: t,
|
|
1384
1381
|
fastestSplits: i,
|
|
1385
1382
|
rowIndex: c,
|
|
1386
1383
|
hasLapDetail: !!u,
|
|
@@ -1394,7 +1391,7 @@ function bt({ session: e, sessionLaps: n }) {
|
|
|
1394
1391
|
}) })
|
|
1395
1392
|
] }) });
|
|
1396
1393
|
}
|
|
1397
|
-
function
|
|
1394
|
+
function bn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: p }) {
|
|
1398
1395
|
const c = e.position <= 3;
|
|
1399
1396
|
return /* @__PURE__ */ l(F, { children: [
|
|
1400
1397
|
/* @__PURE__ */ l(
|
|
@@ -1404,32 +1401,32 @@ function yt({ result: e, isRace: n, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1404
1401
|
onClick: a ? o : void 0,
|
|
1405
1402
|
style: a ? { cursor: "pointer" } : void 0,
|
|
1406
1403
|
children: [
|
|
1407
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(oe, { position: e.position }) }),
|
|
1408
1405
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ n(G, { nation: e.nation }),
|
|
1410
1407
|
e.driverName,
|
|
1411
1408
|
e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
|
|
1412
1409
|
"#",
|
|
1413
1410
|
e.carNumber
|
|
1414
1411
|
] }),
|
|
1415
|
-
e.penalty && /* @__PURE__ */
|
|
1412
|
+
e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
|
|
1416
1413
|
] }),
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
|
|
1414
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1415
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1416
|
+
kn,
|
|
1420
1417
|
{
|
|
1421
1418
|
bestLap: e.bestLapFormatted,
|
|
1422
1419
|
hasBestLap: e.hasBestLap,
|
|
1423
1420
|
splits: e.splits,
|
|
1424
|
-
fastestSplits:
|
|
1425
|
-
showAbove:
|
|
1421
|
+
fastestSplits: t,
|
|
1422
|
+
showAbove: s <= 1
|
|
1426
1423
|
}
|
|
1427
1424
|
) }),
|
|
1428
|
-
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */
|
|
1425
|
+
r && /* @__PURE__ */ l(F, { children: [
|
|
1426
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
|
|
1427
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
|
|
1431
1428
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
|
|
1432
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ n("span", { className: "pvx-session-points", children: e.points }),
|
|
1433
1430
|
e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ l("span", { className: "pvx-points-override", children: [
|
|
1434
1431
|
"(",
|
|
1435
1432
|
e.pointsOverride > 0 ? "+" : "",
|
|
@@ -1441,104 +1438,104 @@ function yt({ result: e, isRace: n, fastestSplits: s, rowIndex: r, hasLapDetail:
|
|
|
1441
1438
|
]
|
|
1442
1439
|
}
|
|
1443
1440
|
),
|
|
1444
|
-
i && d && /* @__PURE__ */
|
|
1441
|
+
i && d && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: p, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(yn, { laps: d }) }) })
|
|
1445
1442
|
] });
|
|
1446
1443
|
}
|
|
1447
|
-
function
|
|
1448
|
-
const
|
|
1444
|
+
function yn({ laps: e }) {
|
|
1445
|
+
const r = Math.min(...e.filter((t) => t.valid && t.timeMs > 0).map((t) => t.timeMs));
|
|
1449
1446
|
return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1450
|
-
/* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1448
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
1449
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Time" }),
|
|
1450
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
1451
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1452
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1456
1453
|
] }) }),
|
|
1457
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((t) => {
|
|
1458
1455
|
var a;
|
|
1459
|
-
const
|
|
1460
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
(
|
|
1464
|
-
Array.from({ length: Math.max(0, 3 - (((a =
|
|
1465
|
-
] },
|
|
1456
|
+
const s = t.valid && t.timeMs === r;
|
|
1457
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${t.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
|
|
1458
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: t.lap }),
|
|
1459
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: t.time }),
|
|
1460
|
+
(t.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
|
|
1461
|
+
Array.from({ length: Math.max(0, 3 - (((a = t.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
|
|
1462
|
+
] }, t.lap);
|
|
1466
1463
|
}) })
|
|
1467
1464
|
] });
|
|
1468
1465
|
}
|
|
1469
|
-
function
|
|
1470
|
-
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
-
(
|
|
1473
|
-
const d =
|
|
1466
|
+
function kn({ bestLap: e, hasBestLap: r, splits: t, fastestSplits: s, showAbove: a }) {
|
|
1467
|
+
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${r ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1468
|
+
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1469
|
+
(t == null ? void 0 : t.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: t.map((i, o) => {
|
|
1470
|
+
const d = s && i === s[o];
|
|
1474
1471
|
return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1475
1472
|
/* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1476
1473
|
"S",
|
|
1477
1474
|
o + 1
|
|
1478
1475
|
] }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1476
|
+
/* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children: i })
|
|
1480
1477
|
] }, o);
|
|
1481
1478
|
}) }) })
|
|
1482
|
-
] }) : /* @__PURE__ */
|
|
1479
|
+
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1483
1480
|
}
|
|
1484
|
-
function
|
|
1485
|
-
const { getSteamId:
|
|
1481
|
+
function gt({ competitionId: e, className: r }) {
|
|
1482
|
+
const { getSteamId: t } = C(), { data: s, isLoading: a } = fe(e), i = t();
|
|
1486
1483
|
if (a)
|
|
1487
|
-
return /* @__PURE__ */
|
|
1488
|
-
const o = (
|
|
1489
|
-
return o.length ? /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ n(E, { message: "Loading drivers..." });
|
|
1485
|
+
const o = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
|
|
1486
|
+
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${r || ""}`, children: o.map((d) => {
|
|
1490
1487
|
var c, u;
|
|
1491
1488
|
const p = i && d.steamId === i;
|
|
1492
1489
|
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
|
|
1493
|
-
d.avatarUrl ? /* @__PURE__ */
|
|
1490
|
+
d.avatarUrl ? /* @__PURE__ */ n(
|
|
1494
1491
|
"img",
|
|
1495
1492
|
{
|
|
1496
1493
|
src: d.avatarUrl,
|
|
1497
1494
|
alt: "",
|
|
1498
1495
|
className: "pvx-entry-avatar"
|
|
1499
1496
|
}
|
|
1500
|
-
) : /* @__PURE__ */
|
|
1497
|
+
) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((u = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : u.toUpperCase()) || "?" }),
|
|
1501
1498
|
/* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
|
|
1502
1499
|
d.displayName,
|
|
1503
|
-
p && /* @__PURE__ */
|
|
1500
|
+
p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1504
1501
|
] })
|
|
1505
1502
|
] }, d.steamId || d.driverId);
|
|
1506
|
-
}) }) : /* @__PURE__ */
|
|
1503
|
+
}) }) : /* @__PURE__ */ n(P, { message: "No drivers registered yet." });
|
|
1507
1504
|
}
|
|
1508
|
-
function
|
|
1505
|
+
function ft({
|
|
1509
1506
|
competitionId: e,
|
|
1510
|
-
driverData:
|
|
1511
|
-
className:
|
|
1512
|
-
children:
|
|
1507
|
+
driverData: r,
|
|
1508
|
+
className: t,
|
|
1509
|
+
children: s
|
|
1513
1510
|
}) {
|
|
1514
|
-
const { data: a, isLoading: i } = ee(e), { isPowerMode: o } =
|
|
1515
|
-
o && p.mutate(
|
|
1511
|
+
const { data: a, isLoading: i } = ee(e), { isPowerMode: o } = ne(), d = te(e), p = Ne(e), c = be(e), u = (a == null ? void 0 : a.isRegistered) || !1, g = i || p.isPending || c.isPending, f = p.error || c.error || null, m = () => {
|
|
1512
|
+
o && p.mutate(r || {});
|
|
1516
1513
|
}, y = () => {
|
|
1517
1514
|
o && c.mutate();
|
|
1518
1515
|
};
|
|
1519
|
-
return typeof
|
|
1516
|
+
return typeof s == "function" ? s({ isRegistered: u, isLoading: g, register: m, withdraw: y, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
|
|
1520
1517
|
"button",
|
|
1521
1518
|
{
|
|
1522
|
-
className: `pvx-comp-register-btn ${
|
|
1519
|
+
className: `pvx-comp-register-btn ${t || ""}`,
|
|
1523
1520
|
onClick: u ? y : m,
|
|
1524
1521
|
disabled: g,
|
|
1525
1522
|
children: g ? "Loading..." : u ? "Withdraw" : "Register"
|
|
1526
1523
|
}
|
|
1527
|
-
) : /* @__PURE__ */
|
|
1524
|
+
) : /* @__PURE__ */ n(
|
|
1528
1525
|
"a",
|
|
1529
1526
|
{
|
|
1530
1527
|
href: d,
|
|
1531
1528
|
target: "_blank",
|
|
1532
1529
|
rel: "noopener noreferrer",
|
|
1533
|
-
className: `pvx-comp-register-link ${
|
|
1530
|
+
className: `pvx-comp-register-link ${t || ""}`,
|
|
1534
1531
|
children: u ? "View Registration" : "Register on PitVox"
|
|
1535
1532
|
}
|
|
1536
1533
|
);
|
|
1537
1534
|
}
|
|
1538
|
-
function
|
|
1539
|
-
const { getSteamId: a } = C(), { isPowerMode: i } =
|
|
1540
|
-
return p || u ? /* @__PURE__ */
|
|
1541
|
-
|
|
1535
|
+
function Nt({ competitionId: e, registration: r, onWithdrawSuccess: t, className: s }) {
|
|
1536
|
+
const { getSteamId: a } = C(), { isPowerMode: i } = ne(), o = te(e), { data: d, isLoading: p } = ee(e), { data: c, isLoading: u } = fe(e), g = Ne(e), f = be(e), m = a(), y = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], h = r || {}, N = x.length || h.currentCount || 0, v = h.maxParticipants && N >= h.maxParticipants, k = h.deadline && new Date(h.deadline) < /* @__PURE__ */ new Date(), b = h.isOpen && !k && !v;
|
|
1537
|
+
return p || u ? /* @__PURE__ */ n(E, { message: "Loading registration..." }) : y ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1538
|
+
Cn,
|
|
1542
1539
|
{
|
|
1543
1540
|
competitionId: e,
|
|
1544
1541
|
drivers: x,
|
|
@@ -1546,54 +1543,54 @@ function yn({ competitionId: e, registration: n, onWithdrawSuccess: s, className
|
|
|
1546
1543
|
isPowerMode: i,
|
|
1547
1544
|
registrationUrl: o,
|
|
1548
1545
|
withdrawMutation: f,
|
|
1549
|
-
onWithdrawSuccess:
|
|
1550
|
-
registration:
|
|
1546
|
+
onWithdrawSuccess: t,
|
|
1547
|
+
registration: h
|
|
1551
1548
|
}
|
|
1552
|
-
) }) : b ? m ? i ? /* @__PURE__ */
|
|
1553
|
-
|
|
1549
|
+
) }) : b ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
1550
|
+
wn,
|
|
1554
1551
|
{
|
|
1555
1552
|
competitionId: e,
|
|
1556
1553
|
registerMutation: g,
|
|
1557
|
-
registration:
|
|
1554
|
+
registration: h
|
|
1558
1555
|
}
|
|
1559
|
-
) }) : /* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
x.length > 0 && /* @__PURE__ */
|
|
1556
|
+
) }) : /* @__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__ */ l("div", { className: `pvx-reg-panel ${s || ""}`, children: [
|
|
1557
|
+
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: v ? "Registration is full." : k ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1558
|
+
x.length > 0 && /* @__PURE__ */ n(Te, { drivers: x, steamId: m })
|
|
1562
1559
|
] });
|
|
1563
1560
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const [
|
|
1566
|
-
m.preventDefault(),
|
|
1567
|
-
discordUsername:
|
|
1561
|
+
function wn({ competitionId: e, registerMutation: r, registration: t }) {
|
|
1562
|
+
const [s, a] = D(""), [i, o] = D("intermediate"), [d, p] = D(""), c = (m) => {
|
|
1563
|
+
m.preventDefault(), r.mutate({
|
|
1564
|
+
discordUsername: s || void 0,
|
|
1568
1565
|
experience: i,
|
|
1569
1566
|
comments: d || void 0
|
|
1570
1567
|
});
|
|
1571
|
-
}, u =
|
|
1568
|
+
}, u = t || {}, g = u.currentCount || 0, f = u.maxParticipants;
|
|
1572
1569
|
return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
|
|
1573
1570
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
f && /* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1572
|
+
f && /* @__PURE__ */ n(Re, { count: g, max: f })
|
|
1576
1573
|
] }),
|
|
1577
|
-
|
|
1574
|
+
r.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: r.error.message || "Registration failed" }),
|
|
1578
1575
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
1579
1576
|
/* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${e}`, children: [
|
|
1580
1577
|
"Discord Username ",
|
|
1581
|
-
/* @__PURE__ */
|
|
1578
|
+
/* @__PURE__ */ n("span", { className: "pvx-reg-optional", children: "(optional)" })
|
|
1582
1579
|
] }),
|
|
1583
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ n(
|
|
1584
1581
|
"input",
|
|
1585
1582
|
{
|
|
1586
1583
|
id: `pvx-discord-${e}`,
|
|
1587
1584
|
type: "text",
|
|
1588
1585
|
className: "pvx-reg-input",
|
|
1589
1586
|
placeholder: "e.g. username",
|
|
1590
|
-
value:
|
|
1587
|
+
value: s,
|
|
1591
1588
|
onChange: (m) => a(m.target.value)
|
|
1592
1589
|
}
|
|
1593
1590
|
)
|
|
1594
1591
|
] }),
|
|
1595
1592
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
1596
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ n("label", { className: "pvx-reg-label", htmlFor: `pvx-exp-${e}`, children: "Experience Level" }),
|
|
1597
1594
|
/* @__PURE__ */ l(
|
|
1598
1595
|
"select",
|
|
1599
1596
|
{
|
|
@@ -1602,9 +1599,9 @@ function Ct({ competitionId: e, registerMutation: n, registration: s }) {
|
|
|
1602
1599
|
value: i,
|
|
1603
1600
|
onChange: (m) => o(m.target.value),
|
|
1604
1601
|
children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
|
|
1603
|
+
/* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
|
|
1604
|
+
/* @__PURE__ */ n("option", { value: "advanced", children: "Advanced" })
|
|
1608
1605
|
]
|
|
1609
1606
|
}
|
|
1610
1607
|
)
|
|
@@ -1612,9 +1609,9 @@ function Ct({ competitionId: e, registerMutation: n, registration: s }) {
|
|
|
1612
1609
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
1613
1610
|
/* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-comments-${e}`, children: [
|
|
1614
1611
|
"Comments ",
|
|
1615
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ n("span", { className: "pvx-reg-optional", children: "(optional)" })
|
|
1616
1613
|
] }),
|
|
1617
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ n(
|
|
1618
1615
|
"textarea",
|
|
1619
1616
|
{
|
|
1620
1617
|
id: `pvx-comments-${e}`,
|
|
@@ -1626,36 +1623,36 @@ function Ct({ competitionId: e, registerMutation: n, registration: s }) {
|
|
|
1626
1623
|
}
|
|
1627
1624
|
)
|
|
1628
1625
|
] }),
|
|
1629
|
-
/* @__PURE__ */
|
|
1626
|
+
/* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n(
|
|
1630
1627
|
"button",
|
|
1631
1628
|
{
|
|
1632
1629
|
type: "submit",
|
|
1633
1630
|
className: "pvx-comp-register-btn",
|
|
1634
|
-
disabled:
|
|
1635
|
-
children:
|
|
1631
|
+
disabled: r.isPending,
|
|
1632
|
+
children: r.isPending ? "Registering..." : "Register"
|
|
1636
1633
|
}
|
|
1637
1634
|
) })
|
|
1638
1635
|
] });
|
|
1639
1636
|
}
|
|
1640
|
-
function
|
|
1637
|
+
function Cn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1641
1638
|
const [p, c] = D(!1), u = () => {
|
|
1642
1639
|
i.mutate(void 0, {
|
|
1643
1640
|
onSuccess: () => {
|
|
1644
1641
|
c(!1), o && o();
|
|
1645
1642
|
}
|
|
1646
1643
|
});
|
|
1647
|
-
}, g = d || {}, f =
|
|
1644
|
+
}, g = d || {}, f = r.length || g.currentCount || 0, m = g.maxParticipants;
|
|
1648
1645
|
return /* @__PURE__ */ l(F, { children: [
|
|
1649
1646
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1650
|
-
/* @__PURE__ */
|
|
1651
|
-
m && /* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1648
|
+
m && /* @__PURE__ */ n(Re, { count: f, max: m })
|
|
1652
1649
|
] }),
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
i.error && /* @__PURE__ */
|
|
1655
|
-
|
|
1656
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ n(Te, { drivers: r, steamId: t }),
|
|
1651
|
+
i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1652
|
+
s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
|
|
1653
|
+
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1657
1654
|
/* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1658
|
-
/* @__PURE__ */
|
|
1655
|
+
/* @__PURE__ */ n(
|
|
1659
1656
|
"button",
|
|
1660
1657
|
{
|
|
1661
1658
|
type: "button",
|
|
@@ -1664,7 +1661,7 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
|
|
|
1664
1661
|
children: "Cancel"
|
|
1665
1662
|
}
|
|
1666
1663
|
),
|
|
1667
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ n(
|
|
1668
1665
|
"button",
|
|
1669
1666
|
{
|
|
1670
1667
|
type: "button",
|
|
@@ -1675,7 +1672,7 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
|
|
|
1675
1672
|
}
|
|
1676
1673
|
)
|
|
1677
1674
|
] })
|
|
1678
|
-
] }) : /* @__PURE__ */
|
|
1675
|
+
] }) : /* @__PURE__ */ n(
|
|
1679
1676
|
"button",
|
|
1680
1677
|
{
|
|
1681
1678
|
type: "button",
|
|
@@ -1683,104 +1680,104 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
|
|
|
1683
1680
|
onClick: () => c(!0),
|
|
1684
1681
|
children: "Unregister"
|
|
1685
1682
|
}
|
|
1686
|
-
) }) : /* @__PURE__ */
|
|
1683
|
+
) }) : /* @__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" }) })
|
|
1687
1684
|
] });
|
|
1688
1685
|
}
|
|
1689
|
-
function
|
|
1686
|
+
function Te({ drivers: e, steamId: r }) {
|
|
1690
1687
|
if (!e.length)
|
|
1691
|
-
return /* @__PURE__ */
|
|
1692
|
-
const
|
|
1693
|
-
const i =
|
|
1688
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1689
|
+
const t = [...e].sort((s, a) => {
|
|
1690
|
+
const i = r && s.steamId === r ? -1 : 0, o = r && a.steamId === r ? -1 : 0;
|
|
1694
1691
|
return i - o;
|
|
1695
1692
|
});
|
|
1696
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: t.map((s) => {
|
|
1697
1694
|
var i, o;
|
|
1698
|
-
const a =
|
|
1695
|
+
const a = r && s.steamId === r;
|
|
1699
1696
|
return /* @__PURE__ */ l(
|
|
1700
1697
|
"div",
|
|
1701
1698
|
{
|
|
1702
1699
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1703
1700
|
children: [
|
|
1704
|
-
|
|
1701
|
+
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()) || "?" }),
|
|
1705
1702
|
/* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
|
|
1706
|
-
|
|
1707
|
-
a && /* @__PURE__ */
|
|
1703
|
+
s.displayName,
|
|
1704
|
+
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1708
1705
|
] })
|
|
1709
1706
|
]
|
|
1710
1707
|
},
|
|
1711
|
-
|
|
1708
|
+
s.steamId || s.driverId
|
|
1712
1709
|
);
|
|
1713
1710
|
}) });
|
|
1714
1711
|
}
|
|
1715
|
-
function
|
|
1716
|
-
const
|
|
1717
|
-
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
1712
|
+
function Re({ count: e, max: r }) {
|
|
1713
|
+
const t = r ? e / r * 100 : 0, s = t >= 100 ? "full" : t >= 75 ? "warning" : "ok";
|
|
1714
|
+
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
|
|
1718
1715
|
e,
|
|
1719
1716
|
"/",
|
|
1720
|
-
|
|
1717
|
+
r,
|
|
1721
1718
|
" drivers"
|
|
1722
1719
|
] });
|
|
1723
1720
|
}
|
|
1724
|
-
function
|
|
1725
|
-
const { data:
|
|
1721
|
+
function bt({ competitionId: e, className: r }) {
|
|
1722
|
+
const { data: t, isLoading: s } = xe(e), a = (t == null ? void 0 : t.type) === "championship", i = (t == null ? void 0 : t.type) === "hotlap", { data: o } = Ge(i ? e : null), d = S(
|
|
1726
1723
|
() => {
|
|
1727
1724
|
var b;
|
|
1728
|
-
return ((b =
|
|
1725
|
+
return ((b = t == null ? void 0 : t.rounds) == null ? void 0 : b.filter((L) => L.isFinalized)) || [];
|
|
1729
1726
|
},
|
|
1730
|
-
[
|
|
1727
|
+
[t]
|
|
1731
1728
|
), p = S(
|
|
1732
1729
|
() => d.map((b) => b.roundNumber),
|
|
1733
1730
|
[d]
|
|
1734
1731
|
), { data: c = [], isLoading: u } = Qe(
|
|
1735
1732
|
e,
|
|
1736
1733
|
p
|
|
1737
|
-
), g = i && c.length > 0 ? c[0] : null, f = (g == null ? void 0 : g.sessions) || [], m = i ? "leaderboard" : a ? "standings" : p.length > 0 ? `round-${p[p.length - 1]}` : null, [y, x] = D(null),
|
|
1738
|
-
if (
|
|
1739
|
-
return /* @__PURE__ */
|
|
1740
|
-
if (!
|
|
1741
|
-
return /* @__PURE__ */
|
|
1734
|
+
), g = i && c.length > 0 ? c[0] : null, f = (g == null ? void 0 : g.sessions) || [], m = i ? "leaderboard" : a ? "standings" : p.length > 0 ? `round-${p[p.length - 1]}` : null, [y, x] = D(null), h = y || m;
|
|
1735
|
+
if (s || u)
|
|
1736
|
+
return /* @__PURE__ */ n(E, { message: "Loading results..." });
|
|
1737
|
+
if (!t)
|
|
1738
|
+
return /* @__PURE__ */ n(P, { message: "Competition not found." });
|
|
1742
1739
|
if (!d.length)
|
|
1743
|
-
return /* @__PURE__ */
|
|
1744
|
-
const N = new Map(c.map((b) => [`round-${b.roundNumber}`, b])),
|
|
1745
|
-
if (a &&
|
|
1746
|
-
|
|
1740
|
+
return /* @__PURE__ */ n(P, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
1741
|
+
const N = new Map(c.map((b) => [`round-${b.roundNumber}`, b])), v = [];
|
|
1742
|
+
if (a && v.push({ id: "standings", label: "Standings" }), i) {
|
|
1743
|
+
v.push({ id: "leaderboard", label: "Leaderboard" });
|
|
1747
1744
|
for (const b of f)
|
|
1748
|
-
|
|
1745
|
+
v.push({ id: `session-${b.type}`, label: ie(b.type) });
|
|
1749
1746
|
} else
|
|
1750
1747
|
for (const b of d)
|
|
1751
|
-
|
|
1748
|
+
v.push({
|
|
1752
1749
|
id: `round-${b.roundNumber}`,
|
|
1753
1750
|
label: `R${b.roundNumber}`,
|
|
1754
1751
|
track: null
|
|
1755
1752
|
});
|
|
1756
|
-
const
|
|
1757
|
-
return /* @__PURE__ */ l("div", { className:
|
|
1758
|
-
/* @__PURE__ */
|
|
1753
|
+
const k = N.get(h);
|
|
1754
|
+
return /* @__PURE__ */ l("div", { className: r || "", children: [
|
|
1755
|
+
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: v.map((b) => /* @__PURE__ */ l(
|
|
1759
1756
|
"button",
|
|
1760
1757
|
{
|
|
1761
|
-
className: `pvx-results-tab ${
|
|
1758
|
+
className: `pvx-results-tab ${h === b.id ? "pvx-results-tab--active" : ""}`,
|
|
1762
1759
|
onClick: () => x(b.id),
|
|
1763
1760
|
title: b.track || void 0,
|
|
1764
1761
|
children: [
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
b.track && /* @__PURE__ */
|
|
1762
|
+
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: b.label }),
|
|
1763
|
+
b.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: b.track })
|
|
1767
1764
|
]
|
|
1768
1765
|
},
|
|
1769
1766
|
b.id
|
|
1770
1767
|
)) }),
|
|
1771
|
-
|
|
1772
|
-
|
|
1768
|
+
h === "standings" ? /* @__PURE__ */ n(gn, { competitionId: e }) : h === "leaderboard" ? /* @__PURE__ */ n(Sn, { leaderboard: o, config: t }) : h != null && h.startsWith("session-") ? /* @__PURE__ */ n(
|
|
1769
|
+
Tn,
|
|
1773
1770
|
{
|
|
1774
|
-
session: f.find((b) => `session-${b.type}` ===
|
|
1771
|
+
session: f.find((b) => `session-${b.type}` === h),
|
|
1775
1772
|
round: g,
|
|
1776
1773
|
competitionId: e
|
|
1777
1774
|
}
|
|
1778
|
-
) :
|
|
1775
|
+
) : k ? /* @__PURE__ */ n(Ln, { round: k, competitionId: e }) : /* @__PURE__ */ n(P, { message: "No results for this round." })
|
|
1779
1776
|
] });
|
|
1780
1777
|
}
|
|
1781
|
-
function
|
|
1778
|
+
function Ln({ round: e, competitionId: r }) {
|
|
1782
1779
|
var i;
|
|
1783
|
-
const
|
|
1780
|
+
const s = (e.sessions || []).find((o) => o.type === "RACE"), a = (i = s == null ? void 0 : s.results) == null ? void 0 : i.filter((o) => o.position <= 3).sort((o, d) => o.position - d.position);
|
|
1784
1781
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1785
1782
|
/* @__PURE__ */ l("div", { className: "pvx-card-header--split", children: [
|
|
1786
1783
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -1789,25 +1786,25 @@ function St({ round: e, competitionId: n }) {
|
|
|
1789
1786
|
e.roundNumber,
|
|
1790
1787
|
e.track ? `: ${e.track}` : ""
|
|
1791
1788
|
] }),
|
|
1792
|
-
e.startTime && /* @__PURE__ */
|
|
1789
|
+
e.startTime && /* @__PURE__ */ n("span", { className: "pvx-standings-subtitle", children: new Date(e.startTime).toLocaleDateString("en-GB", {
|
|
1793
1790
|
day: "numeric",
|
|
1794
1791
|
month: "long",
|
|
1795
1792
|
year: "numeric"
|
|
1796
1793
|
}) })
|
|
1797
1794
|
] }),
|
|
1798
|
-
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1795
|
+
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((o) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1796
|
+
/* @__PURE__ */ n("span", { children: ae[o.position - 1] }),
|
|
1797
|
+
/* @__PURE__ */ n("span", { children: o.driverName })
|
|
1801
1798
|
] }, o.driverId)) })
|
|
1802
1799
|
] }),
|
|
1803
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ n(le, { round: e, competitionId: r })
|
|
1804
1801
|
] });
|
|
1805
1802
|
}
|
|
1806
|
-
function
|
|
1807
|
-
var
|
|
1808
|
-
return (
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
/* @__PURE__ */
|
|
1803
|
+
function Sn({ leaderboard: e, config: r }) {
|
|
1804
|
+
var t;
|
|
1805
|
+
return (t = e == null ? void 0 : e.drivers) != null && t.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1806
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
|
|
1807
|
+
/* @__PURE__ */ n("h4", { className: "pvx-card-title", children: e.track || (r == null ? void 0 : r.name) || "Hotlap Leaderboard" }),
|
|
1811
1808
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
1812
1809
|
e.sessionsCompleted,
|
|
1813
1810
|
" session",
|
|
@@ -1815,211 +1812,211 @@ function Tt({ leaderboard: e, config: n }) {
|
|
|
1815
1812
|
" completed"
|
|
1816
1813
|
] })
|
|
1817
1814
|
] }) }),
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1815
|
+
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
1816
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1817
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1818
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1819
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1820
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1821
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1822
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Sessions" }),
|
|
1823
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
|
|
1827
1824
|
] }) }),
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
const a =
|
|
1830
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1831
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((s) => {
|
|
1826
|
+
const a = s.position === 1 ? "" : `+${((s.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
|
|
1827
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${s.position <= 3 ? "pvx-row--podium" : ""}`, children: [
|
|
1828
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(oe, { position: s.position }) }),
|
|
1832
1829
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
-
|
|
1830
|
+
/* @__PURE__ */ n(G, { nation: s.nation }),
|
|
1831
|
+
s.driverName
|
|
1835
1832
|
] }),
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
] },
|
|
1833
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(s.carId) }),
|
|
1834
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: s.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: s.bestLapFormatted }) }),
|
|
1835
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.totalLaps }),
|
|
1836
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.sessionsParticipated }),
|
|
1837
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: a })
|
|
1838
|
+
] }, s.driverId);
|
|
1842
1839
|
}) })
|
|
1843
1840
|
] }) })
|
|
1844
|
-
] }) : /* @__PURE__ */
|
|
1841
|
+
] }) : /* @__PURE__ */ n(P, { message: "No lap times recorded yet." });
|
|
1845
1842
|
}
|
|
1846
|
-
function
|
|
1843
|
+
function Tn({ session: e, round: r, competitionId: t }) {
|
|
1847
1844
|
return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: ie(e.type) }) }),
|
|
1846
|
+
/* @__PURE__ */ n(
|
|
1850
1847
|
le,
|
|
1851
1848
|
{
|
|
1852
|
-
round: { ...
|
|
1853
|
-
competitionId:
|
|
1849
|
+
round: { ...r, sessions: [e] },
|
|
1850
|
+
competitionId: t
|
|
1854
1851
|
}
|
|
1855
1852
|
)
|
|
1856
|
-
] }) : /* @__PURE__ */
|
|
1853
|
+
] }) : /* @__PURE__ */ n(P, { message: "Session data not available." });
|
|
1857
1854
|
}
|
|
1858
|
-
function
|
|
1859
|
-
const { cdnUrl:
|
|
1855
|
+
function Rn(e) {
|
|
1856
|
+
const { cdnUrl: r } = C(), t = T({
|
|
1860
1857
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
1861
|
-
queryFn: () => R(
|
|
1858
|
+
queryFn: () => R(r, Ve(null, e)),
|
|
1862
1859
|
enabled: !!e,
|
|
1863
1860
|
staleTime: 3e4,
|
|
1864
1861
|
refetchInterval: 3e4
|
|
1865
|
-
}),
|
|
1862
|
+
}), s = t.data;
|
|
1866
1863
|
return {
|
|
1867
|
-
isLoading:
|
|
1868
|
-
error:
|
|
1869
|
-
data:
|
|
1870
|
-
driverName:
|
|
1871
|
-
lapCount:
|
|
1872
|
-
trackBreakdown:
|
|
1873
|
-
carBreakdown:
|
|
1874
|
-
recordsHeld:
|
|
1875
|
-
currentRecords:
|
|
1876
|
-
bestRanking:
|
|
1877
|
-
bestRankingTrackId:
|
|
1878
|
-
bestRankingLayout:
|
|
1879
|
-
bestRankingCarId:
|
|
1880
|
-
generatedAt:
|
|
1864
|
+
isLoading: t.isLoading,
|
|
1865
|
+
error: t.error,
|
|
1866
|
+
data: s ? {
|
|
1867
|
+
driverName: s.driverName || "Driver",
|
|
1868
|
+
lapCount: s.lapCount || 0,
|
|
1869
|
+
trackBreakdown: s.trackBreakdown || [],
|
|
1870
|
+
carBreakdown: s.carBreakdown || [],
|
|
1871
|
+
recordsHeld: s.recordsHeld || 0,
|
|
1872
|
+
currentRecords: s.currentRecords || [],
|
|
1873
|
+
bestRanking: s.bestRanking ?? null,
|
|
1874
|
+
bestRankingTrackId: s.bestRankingTrackId ?? null,
|
|
1875
|
+
bestRankingLayout: s.bestRankingLayout ?? null,
|
|
1876
|
+
bestRankingCarId: s.bestRankingCarId ?? null,
|
|
1877
|
+
generatedAt: s.generatedAt
|
|
1881
1878
|
} : null
|
|
1882
1879
|
};
|
|
1883
1880
|
}
|
|
1884
|
-
function
|
|
1885
|
-
const { cdnUrl:
|
|
1881
|
+
function $e(e = {}) {
|
|
1882
|
+
const { cdnUrl: r, partnerSlug: t } = C(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = X(t, s, a, "ratings.json");
|
|
1886
1883
|
return T({
|
|
1887
|
-
queryKey: ["pitvox", "ratings",
|
|
1888
|
-
queryFn: () => R(
|
|
1884
|
+
queryKey: ["pitvox", "ratings", t, s || null, a || null],
|
|
1885
|
+
queryFn: () => R(r, o),
|
|
1889
1886
|
staleTime: 3e4,
|
|
1890
1887
|
refetchInterval: 3e4,
|
|
1891
1888
|
enabled: i
|
|
1892
1889
|
});
|
|
1893
1890
|
}
|
|
1894
|
-
function
|
|
1895
|
-
var
|
|
1896
|
-
const
|
|
1891
|
+
function $n(e) {
|
|
1892
|
+
var s;
|
|
1893
|
+
const r = $e(), t = S(() => {
|
|
1897
1894
|
var a;
|
|
1898
|
-
return !((a =
|
|
1895
|
+
return !((a = r.data) != null && a.drivers) || !e ? null : r.data.drivers.find(
|
|
1899
1896
|
(i) => i.identifier === e
|
|
1900
1897
|
) || null;
|
|
1901
|
-
}, [(
|
|
1898
|
+
}, [(s = r.data) == null ? void 0 : s.drivers, e]);
|
|
1902
1899
|
return {
|
|
1903
|
-
isLoading:
|
|
1904
|
-
error:
|
|
1905
|
-
data:
|
|
1906
|
-
rating:
|
|
1907
|
-
rank:
|
|
1908
|
-
totalDrivers:
|
|
1909
|
-
comboCount:
|
|
1910
|
-
distinctCars:
|
|
1911
|
-
combos:
|
|
1900
|
+
isLoading: r.isLoading,
|
|
1901
|
+
error: r.error,
|
|
1902
|
+
data: t ? {
|
|
1903
|
+
rating: t.rating,
|
|
1904
|
+
rank: t.rank,
|
|
1905
|
+
totalDrivers: r.data.driverCount || r.data.drivers.length,
|
|
1906
|
+
comboCount: t.comboCount || 0,
|
|
1907
|
+
distinctCars: t.distinctCars || 0,
|
|
1908
|
+
combos: t.combos || []
|
|
1912
1909
|
} : null
|
|
1913
1910
|
};
|
|
1914
1911
|
}
|
|
1915
|
-
function
|
|
1916
|
-
const
|
|
1912
|
+
function yt(e = {}) {
|
|
1913
|
+
const r = $e(e);
|
|
1917
1914
|
return {
|
|
1918
|
-
data:
|
|
1919
|
-
isLoading:
|
|
1920
|
-
error:
|
|
1915
|
+
data: r.data || null,
|
|
1916
|
+
isLoading: r.isLoading,
|
|
1917
|
+
error: r.error
|
|
1921
1918
|
};
|
|
1922
1919
|
}
|
|
1923
|
-
function
|
|
1924
|
-
const { cdnUrl: e, partnerSlug:
|
|
1925
|
-
queryKey: ["pitvox", "competitions",
|
|
1920
|
+
function Mn() {
|
|
1921
|
+
const { cdnUrl: e, partnerSlug: r, getSteamId: t, onFetchServerPassword: s } = C(), a = t(), { data: i, isLoading: o } = T({
|
|
1922
|
+
queryKey: ["pitvox", "competitions", r],
|
|
1926
1923
|
queryFn: async () => {
|
|
1927
1924
|
const m = await R(e, "competitions/index.json");
|
|
1928
|
-
return m != null && m.competitions ? m.competitions.filter((y) => y.partnerSlug ===
|
|
1925
|
+
return m != null && m.competitions ? m.competitions.filter((y) => y.partnerSlug === r) : [];
|
|
1929
1926
|
},
|
|
1930
1927
|
staleTime: 6e4
|
|
1931
1928
|
}), d = (i == null ? void 0 : i.map((m) => m.id)) || [], p = ce({
|
|
1932
1929
|
queries: d.map((m) => ({
|
|
1933
|
-
queryKey: ["pitvox", "competition",
|
|
1934
|
-
queryFn: () => R(e, `competitions/${
|
|
1930
|
+
queryKey: ["pitvox", "competition", r, m, "entrylist"],
|
|
1931
|
+
queryFn: () => R(e, `competitions/${r}/${m}/entrylist.json`),
|
|
1935
1932
|
enabled: !!a && d.length > 0,
|
|
1936
1933
|
staleTime: 6e4
|
|
1937
1934
|
}))
|
|
1938
1935
|
}), c = p.some((m) => m.isLoading), u = S(() => {
|
|
1939
|
-
var x,
|
|
1936
|
+
var x, h;
|
|
1940
1937
|
if (!i || !a || c) return [];
|
|
1941
1938
|
const m = /* @__PURE__ */ new Date(), y = [];
|
|
1942
1939
|
for (let N = 0; N < i.length; N++) {
|
|
1943
|
-
const
|
|
1944
|
-
if (!((
|
|
1945
|
-
const L =
|
|
1946
|
-
for (const
|
|
1947
|
-
if (
|
|
1948
|
-
const A =
|
|
1949
|
-
!A && !
|
|
1950
|
-
competitionId:
|
|
1951
|
-
competitionName:
|
|
1952
|
-
roundNumber:
|
|
1953
|
-
track:
|
|
1954
|
-
startTime:
|
|
1955
|
-
dediStatus:
|
|
1956
|
-
dediServerAddress:
|
|
1940
|
+
const v = i[N], k = (x = p[N]) == null ? void 0 : x.data;
|
|
1941
|
+
if (!((h = k == null ? void 0 : k.drivers) == null ? void 0 : h.some((w) => w.steamId === a))) continue;
|
|
1942
|
+
const L = v.type === "hotlap", M = v.rounds || [];
|
|
1943
|
+
for (const w of M) {
|
|
1944
|
+
if (w.isFinalized && (!L || w.dediStatus === "completed")) continue;
|
|
1945
|
+
const A = w.dediStatus === "running" || w.dediStatus === "provisioning", Me = w.dediStatus === "scheduled", De = w.startTime && new Date(w.startTime) > m, Ie = A || Me || w.dediServerAddress;
|
|
1946
|
+
!A && !De && !Ie || y.push({
|
|
1947
|
+
competitionId: v.id,
|
|
1948
|
+
competitionName: v.name,
|
|
1949
|
+
roundNumber: w.roundNumber,
|
|
1950
|
+
track: w.track || "TBD",
|
|
1951
|
+
startTime: w.startTime,
|
|
1952
|
+
dediStatus: w.dediStatus || null,
|
|
1953
|
+
dediServerAddress: w.dediServerAddress || null
|
|
1957
1954
|
});
|
|
1958
1955
|
}
|
|
1959
1956
|
}
|
|
1960
|
-
return y.sort((N,
|
|
1961
|
-
const
|
|
1962
|
-
return
|
|
1957
|
+
return y.sort((N, v) => {
|
|
1958
|
+
const k = N.dediStatus === "running" || N.dediStatus === "provisioning", b = v.dediStatus === "running" || v.dediStatus === "provisioning";
|
|
1959
|
+
return k && !b ? -1 : !k && b ? 1 : new Date(N.startTime) - new Date(v.startTime);
|
|
1963
1960
|
}), y.length > 0 && (y[0].isNext = !0), y;
|
|
1964
1961
|
}, [i, a, c, p]), g = ce({
|
|
1965
1962
|
queries: u.map((m) => ({
|
|
1966
1963
|
queryKey: ["pitvox", "serverInfo", m.competitionId, m.roundNumber],
|
|
1967
|
-
queryFn: () =>
|
|
1968
|
-
enabled: !!
|
|
1964
|
+
queryFn: () => s(m.competitionId, m.roundNumber),
|
|
1965
|
+
enabled: !!s && u.length > 0,
|
|
1969
1966
|
staleTime: 5 * 6e4,
|
|
1970
1967
|
// 5 minutes
|
|
1971
1968
|
retry: !1
|
|
1972
1969
|
}))
|
|
1973
1970
|
});
|
|
1974
1971
|
return {
|
|
1975
|
-
data: S(() => u.length ?
|
|
1976
|
-
var
|
|
1977
|
-
const x = (
|
|
1972
|
+
data: S(() => u.length ? s ? u.map((m, y) => {
|
|
1973
|
+
var h;
|
|
1974
|
+
const x = (h = g[y]) == null ? void 0 : h.data;
|
|
1978
1975
|
return x != null && x.success ? {
|
|
1979
1976
|
...m,
|
|
1980
1977
|
serverAddress: x.serverAddress || null,
|
|
1981
1978
|
serverPassword: x.serverPassword || null
|
|
1982
1979
|
} : m;
|
|
1983
|
-
}) : u : [], [u,
|
|
1980
|
+
}) : u : [], [u, s, g]),
|
|
1984
1981
|
isLoading: o || !!a && c
|
|
1985
1982
|
};
|
|
1986
1983
|
}
|
|
1987
|
-
function
|
|
1984
|
+
function Dn() {
|
|
1988
1985
|
const { onFetchNotifications: e } = C();
|
|
1989
1986
|
return !!e;
|
|
1990
1987
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const { onFetchNotifications:
|
|
1988
|
+
function In(e = {}) {
|
|
1989
|
+
const { onFetchNotifications: r, partnerSlug: t } = C(), { limit: s = 20, unreadOnly: a = !1 } = e;
|
|
1993
1990
|
return T({
|
|
1994
|
-
queryKey: ["pitvox", "notifications",
|
|
1995
|
-
queryFn: () =>
|
|
1996
|
-
enabled: !!
|
|
1991
|
+
queryKey: ["pitvox", "notifications", t, { limit: s, unreadOnly: a }],
|
|
1992
|
+
queryFn: () => r({ limit: s, unreadOnly: a }),
|
|
1993
|
+
enabled: !!r,
|
|
1997
1994
|
staleTime: 3e4,
|
|
1998
1995
|
refetchInterval: 3e4
|
|
1999
1996
|
});
|
|
2000
1997
|
}
|
|
2001
|
-
function
|
|
2002
|
-
const { onFetchNotifications: e, partnerSlug:
|
|
2003
|
-
queryKey: ["pitvox", "notifications",
|
|
1998
|
+
function kt() {
|
|
1999
|
+
const { onFetchNotifications: e, partnerSlug: r } = C(), { data: t, isLoading: s } = T({
|
|
2000
|
+
queryKey: ["pitvox", "notifications", r, { limit: 1, unreadOnly: !1 }],
|
|
2004
2001
|
queryFn: () => e({ limit: 1 }),
|
|
2005
2002
|
enabled: !!e,
|
|
2006
2003
|
staleTime: 3e4,
|
|
2007
2004
|
refetchInterval: 3e4,
|
|
2008
2005
|
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
2009
2006
|
});
|
|
2010
|
-
return { count:
|
|
2007
|
+
return { count: t ?? 0, isLoading: s };
|
|
2011
2008
|
}
|
|
2012
|
-
function
|
|
2013
|
-
const { onMarkNotificationRead: e, partnerSlug:
|
|
2014
|
-
return
|
|
2015
|
-
mutationFn: (
|
|
2009
|
+
function Pn() {
|
|
2010
|
+
const { onMarkNotificationRead: e, partnerSlug: r } = C(), t = q();
|
|
2011
|
+
return W({
|
|
2012
|
+
mutationFn: (s) => {
|
|
2016
2013
|
if (!e)
|
|
2017
2014
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
2018
|
-
return e(
|
|
2015
|
+
return e(s);
|
|
2019
2016
|
},
|
|
2020
|
-
onSuccess: (
|
|
2021
|
-
|
|
2022
|
-
{ queryKey: ["pitvox", "notifications",
|
|
2017
|
+
onSuccess: (s, a) => {
|
|
2018
|
+
t.setQueriesData(
|
|
2019
|
+
{ queryKey: ["pitvox", "notifications", r] },
|
|
2023
2020
|
(i) => i != null && i.notifications ? {
|
|
2024
2021
|
...i,
|
|
2025
2022
|
unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
|
|
@@ -2031,36 +2028,36 @@ function Bt() {
|
|
|
2031
2028
|
}
|
|
2032
2029
|
});
|
|
2033
2030
|
}
|
|
2034
|
-
function
|
|
2035
|
-
const { onMarkAllNotificationsRead: e, partnerSlug:
|
|
2036
|
-
return
|
|
2031
|
+
function Bn() {
|
|
2032
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: r } = C(), t = q();
|
|
2033
|
+
return W({
|
|
2037
2034
|
mutationFn: () => {
|
|
2038
2035
|
if (!e)
|
|
2039
2036
|
throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
|
|
2040
2037
|
return e();
|
|
2041
2038
|
},
|
|
2042
2039
|
onSuccess: () => {
|
|
2043
|
-
|
|
2044
|
-
{ queryKey: ["pitvox", "notifications",
|
|
2045
|
-
(
|
|
2046
|
-
...
|
|
2040
|
+
t.setQueriesData(
|
|
2041
|
+
{ queryKey: ["pitvox", "notifications", r] },
|
|
2042
|
+
(s) => s != null && s.notifications ? {
|
|
2043
|
+
...s,
|
|
2047
2044
|
unreadCount: 0,
|
|
2048
|
-
notifications:
|
|
2045
|
+
notifications: s.notifications.map((a) => ({
|
|
2049
2046
|
...a,
|
|
2050
2047
|
isRead: !0,
|
|
2051
2048
|
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
2052
2049
|
}))
|
|
2053
|
-
} :
|
|
2050
|
+
} : s
|
|
2054
2051
|
);
|
|
2055
2052
|
}
|
|
2056
2053
|
});
|
|
2057
2054
|
}
|
|
2058
|
-
function
|
|
2059
|
-
const a =
|
|
2060
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${
|
|
2061
|
-
|
|
2055
|
+
function An({ driverName: e, avatarUrl: r, memberSince: t, className: s = "" }) {
|
|
2056
|
+
const a = t ? new Date(t).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
2057
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
|
|
2058
|
+
r ? /* @__PURE__ */ n("img", { src: r, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
|
|
2062
2059
|
/* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
|
|
2063
|
-
/* @__PURE__ */
|
|
2060
|
+
/* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
2064
2061
|
a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
|
|
2065
2062
|
"Racing since ",
|
|
2066
2063
|
a
|
|
@@ -2068,36 +2065,36 @@ function Ut({ driverName: e, avatarUrl: n, memberSince: s, className: r = "" })
|
|
|
2068
2065
|
] })
|
|
2069
2066
|
] });
|
|
2070
2067
|
}
|
|
2071
|
-
function
|
|
2068
|
+
function Un() {
|
|
2072
2069
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2071
|
+
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
2072
|
+
/* @__PURE__ */ n("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
2073
|
+
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2077
2074
|
] });
|
|
2078
2075
|
}
|
|
2079
|
-
function
|
|
2076
|
+
function Fn() {
|
|
2080
2077
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2078
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2079
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
2080
|
+
/* @__PURE__ */ n("path", { d: "M12 14v4" }),
|
|
2081
|
+
/* @__PURE__ */ n("path", { d: "M10.5 12.5l-4 2.5" }),
|
|
2082
|
+
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
2086
2083
|
] });
|
|
2087
2084
|
}
|
|
2088
|
-
function
|
|
2089
|
-
return /* @__PURE__ */
|
|
2085
|
+
function En() {
|
|
2086
|
+
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" }) });
|
|
2090
2087
|
}
|
|
2091
|
-
function pe({ icon: e, value:
|
|
2092
|
-
const [o, d] = D(!1), p =
|
|
2093
|
-
|
|
2088
|
+
function pe({ icon: e, value: r, label: t, items: s, labelKey: a, countKey: i }) {
|
|
2089
|
+
const [o, d] = D(!1), p = Ae(null);
|
|
2090
|
+
Ue(() => {
|
|
2094
2091
|
if (!o) return;
|
|
2095
2092
|
function u(g) {
|
|
2096
2093
|
p.current && !p.current.contains(g.target) && d(!1);
|
|
2097
2094
|
}
|
|
2098
2095
|
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
2099
2096
|
}, [o]);
|
|
2100
|
-
const c =
|
|
2097
|
+
const c = s != null && s.length ? s.slice().sort((u, g) => g[i] - u[i]) : null;
|
|
2101
2098
|
return /* @__PURE__ */ l(
|
|
2102
2099
|
"div",
|
|
2103
2100
|
{
|
|
@@ -2107,42 +2104,42 @@ function pe({ icon: e, value: n, label: s, items: r, labelKey: a, countKey: i })
|
|
|
2107
2104
|
children: [
|
|
2108
2105
|
e,
|
|
2109
2106
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: r }),
|
|
2108
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: t })
|
|
2112
2109
|
] }),
|
|
2113
|
-
c && /* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2115
|
-
/* @__PURE__ */
|
|
2110
|
+
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, g) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2111
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
|
|
2112
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[i] })
|
|
2116
2113
|
] }, g)) })
|
|
2117
2114
|
]
|
|
2118
2115
|
}
|
|
2119
2116
|
);
|
|
2120
2117
|
}
|
|
2121
|
-
function
|
|
2118
|
+
function qn({ stats: e, rating: r, className: t = "" }) {
|
|
2122
2119
|
if (!e) return null;
|
|
2123
|
-
const
|
|
2124
|
-
name:
|
|
2120
|
+
const s = e.trackBreakdown.map((i) => ({
|
|
2121
|
+
name: j(i.trackId, i.layout),
|
|
2125
2122
|
lapCount: i.lapCount
|
|
2126
2123
|
})), a = e.carBreakdown.map((i) => ({
|
|
2127
2124
|
name: I(i.carId),
|
|
2128
2125
|
lapCount: i.lapCount
|
|
2129
2126
|
}));
|
|
2130
|
-
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${
|
|
2131
|
-
/* @__PURE__ */
|
|
2127
|
+
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${t}`, children: [
|
|
2128
|
+
/* @__PURE__ */ n(
|
|
2132
2129
|
pe,
|
|
2133
2130
|
{
|
|
2134
|
-
icon: /* @__PURE__ */
|
|
2131
|
+
icon: /* @__PURE__ */ n(Un, {}),
|
|
2135
2132
|
value: e.lapCount.toLocaleString(),
|
|
2136
2133
|
label: "Total Laps",
|
|
2137
|
-
items:
|
|
2134
|
+
items: s,
|
|
2138
2135
|
labelKey: "name",
|
|
2139
2136
|
countKey: "lapCount"
|
|
2140
2137
|
}
|
|
2141
2138
|
),
|
|
2142
|
-
/* @__PURE__ */
|
|
2139
|
+
/* @__PURE__ */ n(
|
|
2143
2140
|
pe,
|
|
2144
2141
|
{
|
|
2145
|
-
icon: /* @__PURE__ */
|
|
2142
|
+
icon: /* @__PURE__ */ n(Fn, {}),
|
|
2146
2143
|
value: e.carBreakdown.length,
|
|
2147
2144
|
label: "Cars Used",
|
|
2148
2145
|
items: a,
|
|
@@ -2150,67 +2147,67 @@ function qt({ stats: e, rating: n, className: s = "" }) {
|
|
|
2150
2147
|
countKey: "lapCount"
|
|
2151
2148
|
}
|
|
2152
2149
|
),
|
|
2153
|
-
|
|
2154
|
-
/* @__PURE__ */
|
|
2150
|
+
r && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2151
|
+
/* @__PURE__ */ n(En, {}),
|
|
2155
2152
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: r.rating.toFixed(1) }),
|
|
2154
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2158
2155
|
/* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
|
|
2159
2156
|
"#",
|
|
2160
|
-
|
|
2157
|
+
r.rank,
|
|
2161
2158
|
" of ",
|
|
2162
|
-
|
|
2159
|
+
r.totalDrivers
|
|
2163
2160
|
] })
|
|
2164
2161
|
] })
|
|
2165
2162
|
] })
|
|
2166
2163
|
] });
|
|
2167
2164
|
}
|
|
2168
|
-
function
|
|
2169
|
-
const
|
|
2170
|
-
const i =
|
|
2165
|
+
function jn({ records: e, className: r = "" }) {
|
|
2166
|
+
const t = S(() => e != null && e.length ? e.slice().sort((s, a) => {
|
|
2167
|
+
const i = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
|
|
2171
2168
|
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
2172
2169
|
}) : [], [e]);
|
|
2173
|
-
return
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2170
|
+
return t.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
|
|
2171
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2172
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2173
|
+
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
2174
|
+
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
|
|
2175
|
+
/* @__PURE__ */ n("path", { d: "M4 22h16" }),
|
|
2176
|
+
/* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
|
|
2177
|
+
/* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
|
|
2178
|
+
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
|
|
2182
2179
|
] }) }),
|
|
2183
2180
|
"Current Records",
|
|
2184
2181
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2185
2182
|
"(",
|
|
2186
|
-
|
|
2183
|
+
t.length,
|
|
2187
2184
|
")"
|
|
2188
2185
|
] })
|
|
2189
2186
|
] }) }),
|
|
2190
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: t.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
|
|
2191
2188
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: j(s.trackId, s.layout, s.game) }),
|
|
2190
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(s.carId) })
|
|
2194
2191
|
] }),
|
|
2195
2192
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2198
|
-
(
|
|
2199
|
-
|
|
2193
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: U(s.lapTimeMs) }),
|
|
2194
|
+
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s.game || "evo"}`, children: [
|
|
2195
|
+
(s.game || "evo").toUpperCase(),
|
|
2196
|
+
s.gameVersion ? ` ${s.gameVersion}` : ""
|
|
2200
2197
|
] })
|
|
2201
2198
|
] })
|
|
2202
2199
|
] }, a)) })
|
|
2203
2200
|
] }) : null;
|
|
2204
2201
|
}
|
|
2205
|
-
function
|
|
2206
|
-
if (
|
|
2207
|
-
return /* @__PURE__ */
|
|
2202
|
+
function _n({ events: e, isLoading: r, className: t, limit: s = 3 }) {
|
|
2203
|
+
if (r)
|
|
2204
|
+
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2208
2205
|
if (!(e != null && e.length))
|
|
2209
2206
|
return null;
|
|
2210
|
-
const a =
|
|
2211
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2207
|
+
const a = s ? e.slice(0, s) : e, i = e.length - a.length;
|
|
2208
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
|
|
2209
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2210
|
+
/* @__PURE__ */ n(Hn, {}),
|
|
2214
2211
|
"Upcoming Events",
|
|
2215
2212
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2216
2213
|
"(",
|
|
@@ -2225,15 +2222,15 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
|
|
|
2225
2222
|
className: `pvx-upcoming-item ${o.isNext ? "pvx-upcoming-item--next" : ""}`,
|
|
2226
2223
|
children: [
|
|
2227
2224
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-info", children: [
|
|
2228
|
-
/* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children: o.competitionName }),
|
|
2229
2226
|
/* @__PURE__ */ l("span", { className: "pvx-upcoming-round", children: [
|
|
2230
2227
|
"Round ",
|
|
2231
2228
|
o.roundNumber,
|
|
2232
2229
|
": ",
|
|
2233
2230
|
o.track
|
|
2234
2231
|
] }),
|
|
2235
|
-
o.serverPassword && /* @__PURE__ */
|
|
2236
|
-
|
|
2232
|
+
o.serverPassword && /* @__PURE__ */ n(
|
|
2233
|
+
Vn,
|
|
2237
2234
|
{
|
|
2238
2235
|
password: o.serverPassword,
|
|
2239
2236
|
address: o.serverAddress
|
|
@@ -2241,14 +2238,14 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
|
|
|
2241
2238
|
)
|
|
2242
2239
|
] }),
|
|
2243
2240
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-time", children: [
|
|
2244
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(o.startTime).toLocaleDateString("en-GB", {
|
|
2245
2242
|
day: "numeric",
|
|
2246
2243
|
month: "short",
|
|
2247
2244
|
year: "numeric"
|
|
2248
2245
|
}) }),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
o.dediStatus === "running" && /* @__PURE__ */
|
|
2251
|
-
!o.dediStatus && o.isNext && /* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : Kn(o.startTime) }),
|
|
2247
|
+
o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
2248
|
+
!o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2252
2249
|
] })
|
|
2253
2250
|
]
|
|
2254
2251
|
},
|
|
@@ -2263,11 +2260,11 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
|
|
|
2263
2260
|
] })
|
|
2264
2261
|
] });
|
|
2265
2262
|
}
|
|
2266
|
-
function
|
|
2267
|
-
const [
|
|
2263
|
+
function Vn({ password: e, address: r }) {
|
|
2264
|
+
const [t, s] = D(!1), [a, i] = D(!1), o = r ? e ? `join:${r}|${e}` : `join:${r}` : null, d = H(async () => {
|
|
2268
2265
|
if (o)
|
|
2269
2266
|
try {
|
|
2270
|
-
await navigator.clipboard.writeText(o),
|
|
2267
|
+
await navigator.clipboard.writeText(o), s(!0), setTimeout(() => s(!1), 2e3);
|
|
2271
2268
|
} catch {
|
|
2272
2269
|
}
|
|
2273
2270
|
}, [o]);
|
|
@@ -2279,242 +2276,242 @@ function Kt({ password: e, address: n }) {
|
|
|
2279
2276
|
onClick: d,
|
|
2280
2277
|
title: "Copy join string to clipboard",
|
|
2281
2278
|
children: [
|
|
2282
|
-
/* @__PURE__ */
|
|
2279
|
+
/* @__PURE__ */ n(On, {}),
|
|
2283
2280
|
" ",
|
|
2284
|
-
|
|
2281
|
+
t ? "Copied!" : "Join"
|
|
2285
2282
|
]
|
|
2286
2283
|
}
|
|
2287
2284
|
),
|
|
2288
2285
|
e && /* @__PURE__ */ l(F, { children: [
|
|
2289
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ n(
|
|
2290
2287
|
"span",
|
|
2291
2288
|
{
|
|
2292
2289
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2293
2290
|
onClick: () => i((p) => !p),
|
|
2294
2291
|
title: a ? "Hide password" : "Reveal password",
|
|
2295
|
-
children: a ? /* @__PURE__ */
|
|
2292
|
+
children: a ? /* @__PURE__ */ n(Qn, {}) : /* @__PURE__ */ n(zn, {})
|
|
2296
2293
|
}
|
|
2297
2294
|
),
|
|
2298
2295
|
a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2296
|
+
/* @__PURE__ */ n(Wn, {}),
|
|
2300
2297
|
" ",
|
|
2301
2298
|
e
|
|
2302
2299
|
] })
|
|
2303
2300
|
] })
|
|
2304
2301
|
] });
|
|
2305
2302
|
}
|
|
2306
|
-
function
|
|
2307
|
-
const
|
|
2308
|
-
if (
|
|
2309
|
-
const
|
|
2310
|
-
if (
|
|
2311
|
-
if (
|
|
2312
|
-
const
|
|
2313
|
-
if (
|
|
2314
|
-
if (
|
|
2315
|
-
if (
|
|
2316
|
-
const a = Math.floor(
|
|
2303
|
+
function Kn(e) {
|
|
2304
|
+
const r = new Date(e).getTime() - Date.now();
|
|
2305
|
+
if (r <= 0) return "Now";
|
|
2306
|
+
const t = Math.floor(r / (1e3 * 60 * 60));
|
|
2307
|
+
if (t < 1) return "Less than 1 hour";
|
|
2308
|
+
if (t < 24) return `in ${t}h`;
|
|
2309
|
+
const s = Math.floor(t / 24);
|
|
2310
|
+
if (s === 1) return "Tomorrow";
|
|
2311
|
+
if (s < 7) return `in ${s} days`;
|
|
2312
|
+
if (s < 30) {
|
|
2313
|
+
const a = Math.floor(s / 7);
|
|
2317
2314
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2318
2315
|
}
|
|
2319
2316
|
return ue(e);
|
|
2320
2317
|
}
|
|
2321
|
-
function
|
|
2318
|
+
function Hn() {
|
|
2322
2319
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2320
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2321
|
+
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2325
2322
|
] });
|
|
2326
2323
|
}
|
|
2327
|
-
function
|
|
2324
|
+
function Wn() {
|
|
2328
2325
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2327
|
+
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2331
2328
|
] });
|
|
2332
2329
|
}
|
|
2333
|
-
function
|
|
2330
|
+
function On() {
|
|
2334
2331
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2332
|
+
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2333
|
+
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2337
2334
|
] });
|
|
2338
2335
|
}
|
|
2339
|
-
function
|
|
2336
|
+
function zn() {
|
|
2340
2337
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2341
|
-
/* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2338
|
+
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2339
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2343
2340
|
] });
|
|
2344
2341
|
}
|
|
2345
|
-
function
|
|
2342
|
+
function Qn() {
|
|
2346
2343
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2344
|
+
/* @__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" }),
|
|
2345
|
+
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2349
2346
|
] });
|
|
2350
2347
|
}
|
|
2351
|
-
function
|
|
2352
|
-
const o =
|
|
2353
|
-
return a ? /* @__PURE__ */
|
|
2348
|
+
function Gn({ notifications: e, unreadCount: r = 0, onMarkRead: t, onMarkAllRead: s, isLoading: a, className: i }) {
|
|
2349
|
+
const o = he();
|
|
2350
|
+
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2354
2351
|
/* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
|
|
2355
2352
|
/* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2356
|
-
/* @__PURE__ */
|
|
2353
|
+
/* @__PURE__ */ n(Zn, {}),
|
|
2357
2354
|
"Notifications",
|
|
2358
|
-
|
|
2355
|
+
r > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: r > 99 ? "99+" : r })
|
|
2359
2356
|
] }),
|
|
2360
|
-
|
|
2357
|
+
r > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
|
|
2361
2358
|
] }),
|
|
2362
|
-
e != null && e.length ? /* @__PURE__ */
|
|
2363
|
-
|
|
2359
|
+
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2360
|
+
Yn,
|
|
2364
2361
|
{
|
|
2365
2362
|
notification: d,
|
|
2366
2363
|
getUserDisplay: o,
|
|
2367
|
-
onMarkRead:
|
|
2364
|
+
onMarkRead: t
|
|
2368
2365
|
},
|
|
2369
2366
|
d.id
|
|
2370
|
-
)) }) : /* @__PURE__ */
|
|
2367
|
+
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2371
2368
|
] });
|
|
2372
2369
|
}
|
|
2373
|
-
function
|
|
2374
|
-
const
|
|
2375
|
-
!e.isRead &&
|
|
2370
|
+
function Yn({ notification: e, getUserDisplay: r, onMarkRead: t }) {
|
|
2371
|
+
const s = () => {
|
|
2372
|
+
!e.isRead && t && t(e.id);
|
|
2376
2373
|
};
|
|
2377
2374
|
return /* @__PURE__ */ l(
|
|
2378
2375
|
"button",
|
|
2379
2376
|
{
|
|
2380
2377
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2381
|
-
onClick:
|
|
2378
|
+
onClick: s,
|
|
2382
2379
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ n(Jn, { type: e.type }),
|
|
2384
2381
|
/* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2382
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: He(e, r) }),
|
|
2383
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: ue(e.createdAt) })
|
|
2387
2384
|
] }),
|
|
2388
|
-
!e.isRead && /* @__PURE__ */
|
|
2385
|
+
!e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
|
|
2389
2386
|
]
|
|
2390
2387
|
}
|
|
2391
2388
|
);
|
|
2392
2389
|
}
|
|
2393
|
-
function
|
|
2394
|
-
return e === "RECORD_BEATEN" ? /* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
] }) }) : /* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2390
|
+
function Jn({ type: e }) {
|
|
2391
|
+
return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2392
|
+
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2393
|
+
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
2394
|
+
] }) }) : /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--record", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2395
|
+
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
2396
|
+
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
2397
|
+
/* @__PURE__ */ n("path", { d: "M4 22h16" }),
|
|
2398
|
+
/* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
|
|
2399
|
+
/* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
|
|
2400
|
+
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2404
2401
|
] }) });
|
|
2405
2402
|
}
|
|
2406
|
-
function
|
|
2403
|
+
function Zn() {
|
|
2407
2404
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2405
|
+
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2406
|
+
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2410
2407
|
] });
|
|
2411
2408
|
}
|
|
2412
|
-
function
|
|
2413
|
-
const { data: a, isLoading: i, error: o } =
|
|
2414
|
-
return i || p ? /* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
|
|
2409
|
+
function wt({ steamId: e, avatarUrl: r, memberSince: t, className: s = "" }) {
|
|
2410
|
+
const { data: a, isLoading: i, error: o } = Rn(e), { data: d, isLoading: p } = $n(e), { data: c, isLoading: u } = Mn(), g = Dn(), { data: f, isLoading: m } = In({ limit: 10 }), y = Pn(), x = Bn();
|
|
2411
|
+
return i || p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ l("div", { className: `pvx-dash ${s}`, children: [
|
|
2412
|
+
/* @__PURE__ */ n(
|
|
2413
|
+
An,
|
|
2417
2414
|
{
|
|
2418
2415
|
driverName: a.driverName,
|
|
2419
|
-
avatarUrl:
|
|
2420
|
-
memberSince:
|
|
2416
|
+
avatarUrl: r,
|
|
2417
|
+
memberSince: t
|
|
2421
2418
|
}
|
|
2422
2419
|
),
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
e && /* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ n(qn, { stats: a, rating: d }),
|
|
2421
|
+
e && /* @__PURE__ */ n(_n, { events: c, isLoading: u }),
|
|
2425
2422
|
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${g ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
g && /* @__PURE__ */
|
|
2428
|
-
|
|
2423
|
+
/* @__PURE__ */ n(jn, { records: a.currentRecords }),
|
|
2424
|
+
g && /* @__PURE__ */ n(
|
|
2425
|
+
Gn,
|
|
2429
2426
|
{
|
|
2430
2427
|
notifications: f == null ? void 0 : f.notifications,
|
|
2431
2428
|
unreadCount: (f == null ? void 0 : f.unreadCount) || 0,
|
|
2432
|
-
onMarkRead: (
|
|
2429
|
+
onMarkRead: (h) => y.mutate(h),
|
|
2433
2430
|
onMarkAllRead: () => x.mutate(),
|
|
2434
2431
|
isLoading: m
|
|
2435
2432
|
}
|
|
2436
2433
|
)
|
|
2437
2434
|
] })
|
|
2438
|
-
] }) : /* @__PURE__ */
|
|
2435
|
+
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2439
2436
|
}
|
|
2440
2437
|
export {
|
|
2441
|
-
|
|
2438
|
+
dt as CarsTable,
|
|
2442
2439
|
P as CompEmptyState,
|
|
2443
2440
|
E as CompLoadingState,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2441
|
+
vn as CompetitionCard,
|
|
2442
|
+
ht as CompetitionCards,
|
|
2443
|
+
bt as CompetitionResultsTabs,
|
|
2444
|
+
mn as CompletedBadge,
|
|
2445
|
+
Le as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
2446
|
+
wt as DriverDashboard,
|
|
2447
|
+
An as DriverProfile,
|
|
2448
|
+
pt as DriversTable,
|
|
2449
|
+
gt as EntryList,
|
|
2453
2450
|
J as InfoPill,
|
|
2454
|
-
|
|
2455
|
-
|
|
2451
|
+
ut as LapHistoryTable,
|
|
2452
|
+
Gn as NotificationsCard,
|
|
2456
2453
|
ae as PODIUM_MEDALS,
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2454
|
+
tt as PitVoxPartnerProvider,
|
|
2455
|
+
mt as RankingsTable,
|
|
2456
|
+
jn as RecordsTable,
|
|
2457
|
+
ft as RegisterButton,
|
|
2458
|
+
Nt as RegistrationPanel,
|
|
2459
|
+
xt as RoundResults,
|
|
2463
2460
|
le as RoundSessionResults,
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2461
|
+
gn as StandingsTable,
|
|
2462
|
+
qn as StatsCards,
|
|
2463
|
+
ct as TracksTable,
|
|
2464
|
+
on as TypeBadge,
|
|
2465
|
+
_n as UpcomingEvents,
|
|
2466
|
+
Ve as buildDriverIndexPath,
|
|
2467
|
+
_e as buildLapsPath,
|
|
2471
2468
|
X as buildLeaderboardPath,
|
|
2472
|
-
|
|
2469
|
+
Ke as buildRecentLapsPath,
|
|
2473
2470
|
R as fetchCdnJson,
|
|
2474
|
-
|
|
2471
|
+
vt as filterCompetitionsByStatus,
|
|
2475
2472
|
I as formatCarName,
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2473
|
+
_ as formatDate,
|
|
2474
|
+
rt as formatDelta,
|
|
2475
|
+
ve as formatFuel,
|
|
2479
2476
|
U as formatLapTime,
|
|
2480
|
-
|
|
2477
|
+
He as formatNotificationMessage,
|
|
2481
2478
|
ue as formatRelativeTime,
|
|
2482
2479
|
B as formatSectorTime,
|
|
2483
2480
|
ie as formatSessionLabel,
|
|
2484
|
-
|
|
2481
|
+
j as formatTrackName,
|
|
2485
2482
|
me as formatTyreCompound,
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2483
|
+
un as getCompetitionPodium,
|
|
2484
|
+
Se as getCompetitionStatus,
|
|
2485
|
+
pn as getCompletionDate,
|
|
2486
|
+
dn as isCompetitionComplete,
|
|
2487
|
+
ot as useCarLeaderboard,
|
|
2488
|
+
at as useCarMetadata,
|
|
2492
2489
|
Qe as useCompetitionAllRounds,
|
|
2493
2490
|
xe as useCompetitionConfig,
|
|
2494
2491
|
fe as useCompetitionEntryList,
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2492
|
+
Ge as useCompetitionLeaderboard,
|
|
2493
|
+
ze as useCompetitionRound,
|
|
2494
|
+
Ye as useCompetitionRoundLaps,
|
|
2498
2495
|
ge as useCompetitionStandings,
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2496
|
+
lt as useCompetitions,
|
|
2497
|
+
Oe as useDriverLaps,
|
|
2498
|
+
$n as useDriverRating,
|
|
2499
|
+
yt as useDriverRatings,
|
|
2500
|
+
Rn as useDriverStats,
|
|
2501
|
+
st as useLeaderboardIndex,
|
|
2502
|
+
Bn as useMarkAllNotificationsRead,
|
|
2503
|
+
Pn as useMarkNotificationRead,
|
|
2504
|
+
In as useNotifications,
|
|
2505
|
+
Dn as useNotificationsEnabled,
|
|
2509
2506
|
C as usePitVox,
|
|
2510
|
-
|
|
2507
|
+
it as useRecentLaps,
|
|
2511
2508
|
Ne as useRegister,
|
|
2512
|
-
|
|
2509
|
+
ne as useRegistrationMode,
|
|
2513
2510
|
ee as useRegistrationStatus,
|
|
2514
|
-
|
|
2511
|
+
te as useRegistrationUrl,
|
|
2515
2512
|
We as useTrackLeaderboard,
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2513
|
+
kt as useUnreadCount,
|
|
2514
|
+
Mn as useUpcomingEvents,
|
|
2515
|
+
he as useUserLookup,
|
|
2519
2516
|
be as useWithdraw
|
|
2520
2517
|
};
|