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