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