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