fansunited-frontend-components 1.1.0 → 1.2.0
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/BattleOfFans.js +512 -469
- package/Betslip.js +1 -1
- package/ChanceGame.js +1 -1
- package/ClassicQuizPlay.js +2 -2
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +1 -1
- package/CompetitorCard.js +1 -1
- package/Discussion.js +1 -1
- package/EitherOrPlay.js +2 -2
- package/EventCard.js +1 -1
- package/EventGamePlay.js +2 -2
- package/Leaderboard.js +1 -1
- package/List.js +4 -4
- package/MatchQuizPlay.js +2 -2
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +2 -2
- package/PickThePair.js +1 -1
- package/PlayerOfTheMatch.js +805 -857
- package/PollVote.js +2 -2
- package/Predictor.js +1 -1
- package/ProfileStats.d.ts +4 -0
- package/ProfileStats.d.ts.map +1 -0
- package/ProfileStats.js +2781 -0
- package/README.md +65 -4
- package/Standings.js +1 -1
- package/TopX.js +1 -1
- package/chunks/index-CLJiQKNv.js +4 -0
- package/chunks/index-D6-V3WrE.js +4 -0
- package/chunks/index-Dt38wFLo.js +4 -0
- package/chunks/index-Ehvd1Qmz.js +4 -0
- package/chunks/index-QtarvzAb.js +4 -0
- package/chunks/index-kffkFNES.js +4 -0
- package/chunks/{main-DdL0UekL.js → main-BnuQygIM.js} +1853 -1783
- package/chunks/main-BpGmqCTf.js +2142 -0
- package/chunks/main-C0PSUCR_.js +3027 -0
- package/chunks/{main-LEE8n2cG.js → main-CfdOHNHz.js} +1268 -1203
- package/chunks/{main-D_QDfmAw.js → main-PpLP-LeG.js} +1797 -1753
- package/chunks/{main-C7X4dM_P.js → main-p1Qbq-Fw.js} +1532 -1483
- package/chunks/{withVersionStamp-Cck3fT4t.js → withVersionStamp-C1gbpK3-.js} +1 -1
- package/components.d.ts +2 -1
- package/components.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +11 -9
- package/package.json +6 -2
- package/chunks/index-BNl8scz6.js +0 -4
- package/chunks/index-CSa2JU4m.js +0 -4
- package/chunks/index-Cd1dg0KI.js +0 -4
- package/chunks/index-Cei2fzi7.js +0 -4
- package/chunks/index-Cxb4wEJU.js +0 -4
- package/chunks/index-w1LGN5dz.js +0 -4
- package/chunks/main-07vzblS8.js +0 -2091
- package/chunks/main-DmBfwyb4.js +0 -2992
package/ProfileStats.js
ADDED
|
@@ -0,0 +1,2781 @@
|
|
|
1
|
+
import { jsx as i, jsxs as d, Fragment as fe } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ShadowTooltip as ae, Notification as Wt, AlertMessage as Ot, Spinner as At, WidgetPortal as Mt } from "fansunited-frontend-core/ui/emotion";
|
|
3
|
+
import Z, { useState as I, useEffect as ce, useMemo as q, useRef as de, useId as he } from "react";
|
|
4
|
+
import { css as a } from "@emotion/react";
|
|
5
|
+
import { useDisableCache as dt, searchEntitiesByQuery as Dt, useColors as Lt, useCurrentThemeMode as Bt, toIntlLocale as Nt, useIsRtl as _t, DirectionalIcon as Ht } from "fansunited-frontend-core";
|
|
6
|
+
import { useTranslation as jt } from "react-i18next";
|
|
7
|
+
import { ChevronRightIcon as Gt, SearchIcon as Qt, CloseIcon as pt, CheckIcon as Ut, AddIcon as ut, StarRoundedIcon as Vt, EditOutlinedIcon as Yt } from "fansunited-frontend-core/ui/icons";
|
|
8
|
+
import { w as Kt } from "./chunks/withVersionStamp-C1gbpK3-.js";
|
|
9
|
+
class mt extends Error {
|
|
10
|
+
}
|
|
11
|
+
const ft = (e) => {
|
|
12
|
+
const t = e == null ? void 0 : e.code;
|
|
13
|
+
return t === 401 || t === 403;
|
|
14
|
+
}, De = (e) => e.status === "fulfilled" ? e.value : null, qt = async (e, t) => {
|
|
15
|
+
const { profileId: n, disableCache: s } = t, c = n ? e.profile.getById(n) : null, l = c ?? e.profile.getOwn(), [f, m, p] = await Promise.allSettled([
|
|
16
|
+
c ? c.getStats(s) : l.getStats(),
|
|
17
|
+
t.interests ? l.showFullInterests() : Promise.resolve(null),
|
|
18
|
+
t.config ? e.loyalty.getConfigV2(s) : Promise.resolve(null)
|
|
19
|
+
]);
|
|
20
|
+
if (f.status === "rejected")
|
|
21
|
+
throw !n && ft(f.reason) ? new mt() : f.reason;
|
|
22
|
+
return {
|
|
23
|
+
stats: f.value,
|
|
24
|
+
// showFullInterests carries each entity's model, though the SDK types it as InterestModel[].
|
|
25
|
+
interests: De(m),
|
|
26
|
+
config: De(p)
|
|
27
|
+
};
|
|
28
|
+
}, pe = (e) => typeof e == "object" && e !== null, D = (e) => typeof e == "string" && e.trim() ? e : null, k = (e) => typeof e == "number" && Number.isFinite(e) ? e : 0, ne = (e, ...t) => t.reduce((n, s) => pe(n) ? n[s] : void 0, e), Te = (e, t) => e.split(/\s+/).filter(Boolean).map((n) => n.charAt(0)).join("").slice(0, t).toUpperCase(), ge = (e, t, n) => {
|
|
29
|
+
const s = D(ne(n, "name")) ?? e, c = t === "player", l = D(ne(n, "assets", c ? "headshot" : "logo")), f = t === "team" ? D(ne(n, "code")) ?? Te(s, 3) : Te(s, t === "player" ? 2 : 3);
|
|
30
|
+
return { id: e, name: s, image: l, headshot: c, code: f.toUpperCase() };
|
|
31
|
+
}, Xt = (e) => {
|
|
32
|
+
var t;
|
|
33
|
+
return (((t = e == null ? void 0 : e.rewards) == null ? void 0 : t.tiers) ?? []).filter((n) => n && n.enabled !== !1).slice().sort((n, s) => k(n.points) - k(s.points));
|
|
34
|
+
}, Jt = (e, t) => {
|
|
35
|
+
const n = Xt(t);
|
|
36
|
+
if (!n.length) return null;
|
|
37
|
+
const s = new Map((e.tiers ?? []).map((p) => [p.id, p.achievedAt])), c = n.findIndex((p) => p.id === e.tier), l = n.findIndex(
|
|
38
|
+
(p) => {
|
|
39
|
+
var u, y;
|
|
40
|
+
return ((u = D(p.label)) == null ? void 0 : u.toLowerCase()) === ((y = D(e.tier)) == null ? void 0 : y.toLowerCase());
|
|
41
|
+
}
|
|
42
|
+
), f = n.reduce((p, u, y) => k(e.points) >= k(u.points) ? y : p, -1), m = c >= 0 ? c : l >= 0 ? l : f;
|
|
43
|
+
return n.map((p, u) => ({
|
|
44
|
+
id: p.id,
|
|
45
|
+
label: D(p.label) ?? p.id,
|
|
46
|
+
points: k(p.points),
|
|
47
|
+
reached: u <= m,
|
|
48
|
+
current: u === m,
|
|
49
|
+
achievedAt: s.get(p.id) ?? null
|
|
50
|
+
}));
|
|
51
|
+
}, Zt = (e, t) => {
|
|
52
|
+
var s, c;
|
|
53
|
+
const n = t == null ? void 0 : t.find((l) => l.current);
|
|
54
|
+
return {
|
|
55
|
+
tierLabel: (n == null ? void 0 : n.label) ?? D(e.tier) ?? "",
|
|
56
|
+
points: k(e.points),
|
|
57
|
+
predictionsMade: k(e.predictionsMade),
|
|
58
|
+
correct: (s = e.predictions) != null && s.single ? k(e.predictions.single.correct) : null,
|
|
59
|
+
overallPercent: typeof ((c = e.successRates) == null ? void 0 : c.overallPercent) == "number" ? Math.round(e.successRates.overallPercent) : null
|
|
60
|
+
};
|
|
61
|
+
}, en = ["team", "player", "competition", "sport"], tn = (e) => e.filter((t) => en.includes(String(t.type).toLowerCase())).map((t) => {
|
|
62
|
+
const n = String(t.type).toLowerCase(), s = t.model, c = n === "sport" || !pe(s) ? null : ge(t.id, n, s), l = D(ne(s, "country", "name")), f = ne(s, "teams"), m = Array.isArray(f) && f.length ? D(ne(f[0], "name")) : null;
|
|
63
|
+
return {
|
|
64
|
+
id: t.id,
|
|
65
|
+
source: String(t.source ?? "").toLowerCase(),
|
|
66
|
+
type: n,
|
|
67
|
+
favourite: t.favourite === !0,
|
|
68
|
+
entity: c,
|
|
69
|
+
place: n === "player" ? m ?? l : l,
|
|
70
|
+
position: n === "player" ? D(ne(s, "position")) : null
|
|
71
|
+
};
|
|
72
|
+
}), ve = (e, t) => Object.entries(e ?? {}).filter(([, n]) => pe(n)).map(([n, s]) => ({
|
|
73
|
+
id: n,
|
|
74
|
+
entity: t ? ge(n, t, s.model) : null,
|
|
75
|
+
market: t ? null : n.toUpperCase(),
|
|
76
|
+
rate: Math.round(k(s.successRatePercent))
|
|
77
|
+
})).sort((n, s) => s.rate - n.rate), nn = (e) => {
|
|
78
|
+
var t, n, s;
|
|
79
|
+
return {
|
|
80
|
+
competitions: ve((t = e.successRates) == null ? void 0 : t.byFootballCompetition, "competition"),
|
|
81
|
+
teams: ve((n = e.successRates) == null ? void 0 : n.byFootballTeam, "team"),
|
|
82
|
+
markets: ve((s = e.successRates) == null ? void 0 : s.byFootballMarket, null)
|
|
83
|
+
};
|
|
84
|
+
}, Le = (e, t) => (e ?? []).map((n) => ({
|
|
85
|
+
id: n.entityId,
|
|
86
|
+
entity: ge(n.entityId, t, n.model),
|
|
87
|
+
home: null,
|
|
88
|
+
away: null,
|
|
89
|
+
made: k(n.predictionsMade),
|
|
90
|
+
correct: k(n.correct),
|
|
91
|
+
points: k(n.points)
|
|
92
|
+
})), on = (e) => {
|
|
93
|
+
var s, c, l;
|
|
94
|
+
const t = (s = e.predictions) == null ? void 0 : s.single;
|
|
95
|
+
if (!t) return null;
|
|
96
|
+
const n = {
|
|
97
|
+
competitions: Le((c = t.breakdown) == null ? void 0 : c.footballCompetitions, "competition"),
|
|
98
|
+
teams: Le((l = t.breakdown) == null ? void 0 : l.footballTeams, "team"),
|
|
99
|
+
// The SDK keeps only competition and team entries today; these tabs stay hidden while empty.
|
|
100
|
+
matches: [],
|
|
101
|
+
players: []
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
points: k(t.points),
|
|
105
|
+
made: k(t.predictionsMade),
|
|
106
|
+
correct: k(t.correct),
|
|
107
|
+
breakdown: n
|
|
108
|
+
};
|
|
109
|
+
}, Be = (e) => pe(e) ? { participations: k(e.participations), points: k(e.points) } : null, rn = [
|
|
110
|
+
"predictor",
|
|
111
|
+
"topX",
|
|
112
|
+
"matchQuiz",
|
|
113
|
+
"games",
|
|
114
|
+
"football",
|
|
115
|
+
"classicQuizzes",
|
|
116
|
+
"eitherOr",
|
|
117
|
+
"discussions",
|
|
118
|
+
"potm",
|
|
119
|
+
"poll"
|
|
120
|
+
], sn = (e, t) => {
|
|
121
|
+
var c, l;
|
|
122
|
+
const n = (c = e.rewards) == null ? void 0 : c.badges;
|
|
123
|
+
if (!n) return [];
|
|
124
|
+
const s = t === "potm" || t === "poll" ? (l = n.voting) == null ? void 0 : l[t] : n[t];
|
|
125
|
+
return Array.isArray(s) ? s : [];
|
|
126
|
+
}, Ne = (e) => {
|
|
127
|
+
const t = e ? Date.parse(e) : NaN;
|
|
128
|
+
return Number.isNaN(t) ? 0 : t;
|
|
129
|
+
}, an = (e, t) => {
|
|
130
|
+
var c;
|
|
131
|
+
if (!((c = t == null ? void 0 : t.rewards) != null && c.badges)) return null;
|
|
132
|
+
const n = new Map((e.badges ?? []).map((l) => [l.id, l.achievedAt]));
|
|
133
|
+
return rn.flatMap(
|
|
134
|
+
(l) => sn(t, l).filter((f) => f && f.enabled !== !1).map((f) => {
|
|
135
|
+
var m;
|
|
136
|
+
return {
|
|
137
|
+
id: f.id,
|
|
138
|
+
category: l,
|
|
139
|
+
label: D(f.label) ?? f.id,
|
|
140
|
+
description: D(f.description) ?? "",
|
|
141
|
+
image: D((m = f.assets) == null ? void 0 : m.mainImageUrl),
|
|
142
|
+
earned: n.has(f.id),
|
|
143
|
+
achievedAt: n.get(f.id) ?? null
|
|
144
|
+
};
|
|
145
|
+
})
|
|
146
|
+
).sort(
|
|
147
|
+
(l, f) => Number(f.earned) - Number(l.earned) || Ne(f.achievedAt) - Ne(l.achievedAt)
|
|
148
|
+
);
|
|
149
|
+
}, ln = (e) => {
|
|
150
|
+
const t = e.discussions;
|
|
151
|
+
return t ? {
|
|
152
|
+
totalPoints: k(t.totalPoints),
|
|
153
|
+
postPoints: k(t.postPoints),
|
|
154
|
+
postsMade: k(t.postsMade),
|
|
155
|
+
reactionPoints: k(t.reactionPoints),
|
|
156
|
+
reactionCount: k(t.reactionCount)
|
|
157
|
+
} : null;
|
|
158
|
+
}, cn = (e) => {
|
|
159
|
+
const t = [];
|
|
160
|
+
return e.classicQuizzes && t.push({
|
|
161
|
+
key: "classicQuiz",
|
|
162
|
+
count: k(e.classicQuizzes.participationCount),
|
|
163
|
+
points: typeof e.classicQuizzes.points == "number" ? e.classicQuizzes.points : null
|
|
164
|
+
}), e.eitherOr && t.push({ key: "eitherOr", count: k(e.eitherOr.participationCount), points: null }), t;
|
|
165
|
+
}, dn = {
|
|
166
|
+
competition: "competitions",
|
|
167
|
+
team: "teams",
|
|
168
|
+
player: "players"
|
|
169
|
+
}, pn = {
|
|
170
|
+
competitions: "competition",
|
|
171
|
+
teams: "team",
|
|
172
|
+
players: "player"
|
|
173
|
+
}, un = (e) => {
|
|
174
|
+
var s, c, l, f;
|
|
175
|
+
const t = e.voting;
|
|
176
|
+
if (!t) return null;
|
|
177
|
+
const n = { competitions: [], teams: [], players: [] };
|
|
178
|
+
return (((s = t.poll) == null ? void 0 : s.breakdown) ?? []).forEach((m) => {
|
|
179
|
+
const p = dn[String((m == null ? void 0 : m.entityType) ?? "").toLowerCase()], u = String((m == null ? void 0 : m.entitySource) ?? "").toLowerCase() === "football";
|
|
180
|
+
!p || !u || !m.entityId || !pe(m.model) || n[p].push({
|
|
181
|
+
id: m.entityId,
|
|
182
|
+
entity: ge(m.entityId, pn[p], m.model),
|
|
183
|
+
votes: k(m.voteCount),
|
|
184
|
+
points: k(m.points)
|
|
185
|
+
});
|
|
186
|
+
}), {
|
|
187
|
+
potmPoints: k((c = t.potm) == null ? void 0 : c.total),
|
|
188
|
+
pollVotes: k((l = t.poll) == null ? void 0 : l.voteCount),
|
|
189
|
+
pollPoints: k((f = t.poll) == null ? void 0 : f.points),
|
|
190
|
+
pollBreakdown: n
|
|
191
|
+
};
|
|
192
|
+
}, mn = ({ stats: e, interests: t, config: n }) => {
|
|
193
|
+
var c, l;
|
|
194
|
+
const s = Jt(e, n);
|
|
195
|
+
return {
|
|
196
|
+
hero: Zt(e, s),
|
|
197
|
+
tiers: s,
|
|
198
|
+
interests: t ? tn(t) : null,
|
|
199
|
+
successRates: nn(e),
|
|
200
|
+
single: on(e),
|
|
201
|
+
topX: Be((c = e.predictions) == null ? void 0 : c.topX),
|
|
202
|
+
matchQuiz: Be((l = e.predictions) == null ? void 0 : l.matchQuiz),
|
|
203
|
+
badges: an(e, n),
|
|
204
|
+
discussions: ln(e),
|
|
205
|
+
miniGames: cn(e),
|
|
206
|
+
voting: un(e)
|
|
207
|
+
};
|
|
208
|
+
}, fn = (e, t) => {
|
|
209
|
+
const {
|
|
210
|
+
profileId: n,
|
|
211
|
+
userIsLoggedIn: s,
|
|
212
|
+
interests: c,
|
|
213
|
+
config: l
|
|
214
|
+
} = t, f = dt(), [m, p] = I(null), [u, y] = I("loading"), [S, h] = I(
|
|
215
|
+
null
|
|
216
|
+
);
|
|
217
|
+
ce(() => {
|
|
218
|
+
if (!e || !n && s === !1) {
|
|
219
|
+
p(null), y("guest");
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
let v = !1;
|
|
223
|
+
return y("loading"), h(null), qt(e, {
|
|
224
|
+
profileId: n,
|
|
225
|
+
interests: c,
|
|
226
|
+
config: l,
|
|
227
|
+
disableCache: f
|
|
228
|
+
}).then(($) => {
|
|
229
|
+
v || (p($), y("ready"));
|
|
230
|
+
}).catch(($) => {
|
|
231
|
+
v || (p(null), y($ instanceof mt ? "guest" : "error"));
|
|
232
|
+
}), () => {
|
|
233
|
+
v = !0;
|
|
234
|
+
};
|
|
235
|
+
}, [
|
|
236
|
+
e,
|
|
237
|
+
n,
|
|
238
|
+
s,
|
|
239
|
+
c,
|
|
240
|
+
l,
|
|
241
|
+
f
|
|
242
|
+
]);
|
|
243
|
+
const g = q(() => m ? mn(m) : null, [m]), z = q(
|
|
244
|
+
() => g && S ? { ...g, interests: S } : g,
|
|
245
|
+
[g, S]
|
|
246
|
+
);
|
|
247
|
+
return { status: u, view: z, setInterests: h };
|
|
248
|
+
}, hn = 10, _e = {
|
|
249
|
+
team: ["team", "national_team"],
|
|
250
|
+
player: ["athlete"],
|
|
251
|
+
competition: ["competition"]
|
|
252
|
+
}, gn = {
|
|
253
|
+
team: "getMappedFootballTeamIds",
|
|
254
|
+
player: "getMappedFootballPlayerIds",
|
|
255
|
+
competition: "getMappedFootballCompetitionIds"
|
|
256
|
+
}, T = (e) => `${e.source}:${e.type}:${e.id}`, ht = (e) => {
|
|
257
|
+
try {
|
|
258
|
+
return e.helpers.getSDKConfiguration();
|
|
259
|
+
} catch {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}, yn = (e) => {
|
|
263
|
+
const t = ht(e);
|
|
264
|
+
return t != null && t.apiKey && (t != null && t.clientId) ? { apiKey: t.apiKey, clientId: t.clientId } : null;
|
|
265
|
+
}, bn = (e) => e.split("-")[0].toUpperCase(), He = (e, t) => {
|
|
266
|
+
var n;
|
|
267
|
+
return ((n = e == null ? void 0 : e.find((s) => {
|
|
268
|
+
var c;
|
|
269
|
+
return ((c = s == null ? void 0 : s.key) == null ? void 0 : c.toUpperCase()) === t;
|
|
270
|
+
})) == null ? void 0 : n.value) || null;
|
|
271
|
+
}, xn = (e, t, n) => {
|
|
272
|
+
var p, u, y;
|
|
273
|
+
if (!e.id) return null;
|
|
274
|
+
const s = bn(n), l = ((u = (p = e.translations) == null ? void 0 : p.find((S) => {
|
|
275
|
+
var h;
|
|
276
|
+
return ((h = S == null ? void 0 : S.language) == null ? void 0 : h.toUpperCase()) === s;
|
|
277
|
+
})) == null ? void 0 : u.name) || e.name || e.id, f = t === "player", m = t === "team" && e.three_letter_code || Te(l, t === "player" ? 2 : 3);
|
|
278
|
+
return {
|
|
279
|
+
id: e.id,
|
|
280
|
+
source: (e.sport || "football").toLowerCase(),
|
|
281
|
+
type: t,
|
|
282
|
+
favourite: !1,
|
|
283
|
+
entity: {
|
|
284
|
+
id: e.id,
|
|
285
|
+
name: l,
|
|
286
|
+
image: He(e.assets, f ? "HEADSHOT" : "LOGO"),
|
|
287
|
+
headshot: f,
|
|
288
|
+
code: m.toUpperCase()
|
|
289
|
+
},
|
|
290
|
+
place: null,
|
|
291
|
+
position: f ? ((y = He(e.additional_information, "POSITION")) == null ? void 0 : y.toLowerCase()) ?? null : null
|
|
292
|
+
};
|
|
293
|
+
}, Sn = async (e, t, n) => {
|
|
294
|
+
var p;
|
|
295
|
+
const s = (p = ht(e)) == null ? void 0 : p.idSchema, c = n.filter((u) => u.source === "football");
|
|
296
|
+
if (!s || s === "native" || !c.length) return n;
|
|
297
|
+
const l = e.idMapping[gn[t]], f = await l(
|
|
298
|
+
c.map((u) => u.id),
|
|
299
|
+
"native",
|
|
300
|
+
s
|
|
301
|
+
), m = /* @__PURE__ */ new Map();
|
|
302
|
+
return ((f == null ? void 0 : f.data) ?? []).forEach((u) => {
|
|
303
|
+
u != null && u.input && u.output && m.set(u.input, u.output);
|
|
304
|
+
}), n.flatMap((u) => {
|
|
305
|
+
if (u.source !== "football") return [u];
|
|
306
|
+
const y = m.get(u.id);
|
|
307
|
+
return y ? [{ ...u, id: y, entity: u.entity && { ...u.entity, id: y } }] : [];
|
|
308
|
+
});
|
|
309
|
+
}, vn = async (e, { query: t, type: n, language: s, cursor: c, signal: l, disableCache: f }) => {
|
|
310
|
+
const m = yn(e);
|
|
311
|
+
if (!m) throw new Error("The SDK has no API key or client id for the Search API");
|
|
312
|
+
const p = c ? _e[n].filter((g) => c[g]) : _e[n], u = await Promise.all(
|
|
313
|
+
p.map(
|
|
314
|
+
(g) => Dt(m, {
|
|
315
|
+
query: t,
|
|
316
|
+
contentType: g,
|
|
317
|
+
page: (c == null ? void 0 : c[g]) ?? 1,
|
|
318
|
+
limit: hn,
|
|
319
|
+
signal: l,
|
|
320
|
+
disableCache: f
|
|
321
|
+
}).then((z) => ({ contentType: g, ...z }))
|
|
322
|
+
)
|
|
323
|
+
), y = /* @__PURE__ */ new Set(), S = u.flatMap((g) => g.data).filter((g) => g.id && !y.has(g.id) && y.add(g.id)).map((g) => xn(g, n, s)).filter((g) => g !== null), h = {};
|
|
324
|
+
return u.forEach((g) => {
|
|
325
|
+
g.hasMore && (h[g.contentType] = g.page + 1);
|
|
326
|
+
}), {
|
|
327
|
+
results: await Sn(e, n, S),
|
|
328
|
+
total: u.reduce((g, z) => g + z.total, 0),
|
|
329
|
+
next: Object.keys(h).length ? h : null
|
|
330
|
+
};
|
|
331
|
+
}, je = (e) => ({
|
|
332
|
+
id: e.id,
|
|
333
|
+
source: e.source,
|
|
334
|
+
type: e.type,
|
|
335
|
+
favourite: e.favourite
|
|
336
|
+
}), Cn = async (e, t, n) => {
|
|
337
|
+
const s = new Map(t.map((p) => [T(p), p])), c = new Map(n.map((p) => [T(p), p])), l = t.filter((p) => !c.has(T(p))), f = n.filter((p) => {
|
|
338
|
+
var u;
|
|
339
|
+
return ((u = s.get(T(p))) == null ? void 0 : u.favourite) !== p.favourite;
|
|
340
|
+
});
|
|
341
|
+
if (!l.length && !f.length) return !1;
|
|
342
|
+
const m = e.profile.getOwn();
|
|
343
|
+
return l.forEach((p) => m.removeInterest(je(p))), f.forEach((p) => m.addInterest(je(p))), await m.update(), !0;
|
|
344
|
+
}, r = (e, t = 16) => `${Math.round(e / t * 1e4) / 1e4}em`, o = {
|
|
345
|
+
card: "var(--fu-ucrc-surface)",
|
|
346
|
+
variant: "var(--fu-ucrc-surface-variant)",
|
|
347
|
+
border: "var(--fu-ucrc-outline-enabled-border)",
|
|
348
|
+
text: "var(--fu-ucrc-text-primary)",
|
|
349
|
+
muted: "var(--fu-ucrc-ps-muted)",
|
|
350
|
+
accent: "var(--fu-ucrc-primary-plain-color)",
|
|
351
|
+
/** Text on an accent tint: the accent pushed away from the tint, per mode. */
|
|
352
|
+
accentFg: "var(--fu-ucrc-ps-accent-fg)",
|
|
353
|
+
success: "var(--fu-ucrc-success-plain-color)",
|
|
354
|
+
danger: "var(--fu-ucrc-danger-plain-color)",
|
|
355
|
+
medalFill: "var(--fu-ucrc-ps-medal-fill)",
|
|
356
|
+
medalEdge: "var(--fu-ucrc-ps-medal-edge)",
|
|
357
|
+
/** White behind logos in dark mode, so dark marks stay visible. */
|
|
358
|
+
logoDisc: "var(--fu-ucrc-ps-logo-disc)",
|
|
359
|
+
logoPad: "var(--fu-ucrc-ps-logo-pad)",
|
|
360
|
+
logoRadius: "var(--fu-ucrc-ps-logo-radius)",
|
|
361
|
+
fontPrimary: "var(--fu-ucrc-font-primary)",
|
|
362
|
+
fontSecondary: "var(--fu-ucrc-font-secondary)"
|
|
363
|
+
}, P = (e, t) => `color-mix(in srgb, ${e} ${t}%, transparent)`, kn = () => {
|
|
364
|
+
const e = Lt(), t = Bt() === "dark", n = e.palette.primary.plainColor, s = e.textSecondary;
|
|
365
|
+
return Z.useMemo(
|
|
366
|
+
() => ({
|
|
367
|
+
"--fu-ucrc-ps-muted": `color-mix(in srgb, ${s} 70%, transparent)`,
|
|
368
|
+
"--fu-ucrc-ps-accent-fg": t ? `color-mix(in srgb, ${n} 45%, #FFFFFF)` : `color-mix(in srgb, ${n} 62%, #0B1220)`,
|
|
369
|
+
"--fu-ucrc-ps-medal-fill": t ? `color-mix(in srgb, ${n} 22%, #14181D)` : `color-mix(in srgb, ${n} 10%, #FFFFFF)`,
|
|
370
|
+
"--fu-ucrc-ps-medal-edge": t ? `color-mix(in srgb, ${n} 70%, #FFFFFF)` : n,
|
|
371
|
+
"--fu-ucrc-ps-logo-disc": t ? "#FFFFFF" : "transparent",
|
|
372
|
+
"--fu-ucrc-ps-logo-pad": t ? r(3) : "0",
|
|
373
|
+
"--fu-ucrc-ps-logo-radius": t ? "50%" : "0"
|
|
374
|
+
}),
|
|
375
|
+
[n, s, t]
|
|
376
|
+
);
|
|
377
|
+
}, Ce = [
|
|
378
|
+
[1e9, "B"],
|
|
379
|
+
[1e6, "M"],
|
|
380
|
+
[1e3, "K"]
|
|
381
|
+
], Fn = " ", wn = (e) => {
|
|
382
|
+
const t = Nt(e), n = new Intl.NumberFormat(t, { useGrouping: !1, maximumFractionDigits: 0 }), s = [0, 1, 2].map(
|
|
383
|
+
(m) => new Intl.NumberFormat(t, { useGrouping: !1, maximumFractionDigits: m })
|
|
384
|
+
), c = new Intl.NumberFormat(t, { maximumFractionDigits: 0 }), l = new Intl.DateTimeFormat(t, {
|
|
385
|
+
day: "numeric",
|
|
386
|
+
month: "short",
|
|
387
|
+
year: "numeric"
|
|
388
|
+
}), f = (m) => Number.isFinite(m) ? m : 0;
|
|
389
|
+
return {
|
|
390
|
+
compact: (m) => {
|
|
391
|
+
const p = f(m), u = Math.abs(p);
|
|
392
|
+
if (u < 1e3) return n.format(p);
|
|
393
|
+
const [y, S] = Ce.find(([z]) => u >= z) ?? Ce[Ce.length - 1], h = u / y < 10 ? 2 : 1, g = Math.round(p / y * 10 ** h) / 10 ** h;
|
|
394
|
+
return `${s[h].format(g)}${S}`;
|
|
395
|
+
},
|
|
396
|
+
full: (m) => c.formatToParts(f(m)).map((p) => p.type === "group" ? Fn : p.value).join(""),
|
|
397
|
+
threshold: (m) => {
|
|
398
|
+
const p = f(m);
|
|
399
|
+
return p >= 1e3 ? `${s[2].format(p / 1e3)}k` : n.format(p);
|
|
400
|
+
},
|
|
401
|
+
date: (m) => {
|
|
402
|
+
if (!m) return "";
|
|
403
|
+
const p = new Date(m);
|
|
404
|
+
return Number.isNaN(p.getTime()) ? "" : l.format(p);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}, le = (e, t) => t > 0 ? Math.round(e / t * 100) : 0, $n = (e, t) => t ? e.replace(
|
|
408
|
+
/\{\{\s*(\w+)\s*\}\}/g,
|
|
409
|
+
(n, s) => s in t ? String(t[s]) : n
|
|
410
|
+
) : e, In = (e) => {
|
|
411
|
+
const { t, i18n: n } = jt("common");
|
|
412
|
+
return q(
|
|
413
|
+
() => ({
|
|
414
|
+
label: (s, c) => {
|
|
415
|
+
const l = e == null ? void 0 : e[s];
|
|
416
|
+
return typeof l == "string" && l.trim() ? $n(l, c) : t(`profileStats.${s}`, c ?? {});
|
|
417
|
+
},
|
|
418
|
+
lookup: (s, c) => n.exists(s, { ns: "common" }) ? t(s, c ?? {}) : null
|
|
419
|
+
}),
|
|
420
|
+
[e, t, n]
|
|
421
|
+
);
|
|
422
|
+
}, gt = [
|
|
423
|
+
"hero",
|
|
424
|
+
"tier-progression",
|
|
425
|
+
"interests",
|
|
426
|
+
"success-rates",
|
|
427
|
+
"single-predictions",
|
|
428
|
+
"prediction-games",
|
|
429
|
+
"badges",
|
|
430
|
+
"discussions",
|
|
431
|
+
"mini-games",
|
|
432
|
+
"voting"
|
|
433
|
+
], Rn = (e) => gt.includes(e), zn = (e) => Array.isArray(e) ? Array.from(new Set(e)).filter(Rn) : gt, Tn = ["hero", "tier-progression", "badges"], Pn = (e) => ({
|
|
434
|
+
interests: e.includes("interests"),
|
|
435
|
+
config: e.some((t) => Tn.includes(t))
|
|
436
|
+
}), yt = Z.createContext(null), En = yt.Provider, F = () => {
|
|
437
|
+
const e = Z.useContext(yt);
|
|
438
|
+
if (!e) throw new Error("useWidget must be used inside WidgetProvider");
|
|
439
|
+
return e;
|
|
440
|
+
}, Wn = { textTransform: "uppercase" }, b = {
|
|
441
|
+
/** Section heading: "Interests", "Badges". */
|
|
442
|
+
title: a({
|
|
443
|
+
margin: 0,
|
|
444
|
+
fontFamily: o.fontPrimary,
|
|
445
|
+
fontWeight: 700,
|
|
446
|
+
fontSize: "1em",
|
|
447
|
+
color: o.text
|
|
448
|
+
}),
|
|
449
|
+
/** The muted tail of a heading: "· 13 followed". */
|
|
450
|
+
titleMeta: a({
|
|
451
|
+
fontFamily: o.fontSecondary,
|
|
452
|
+
fontWeight: 400,
|
|
453
|
+
fontSize: "0.8em",
|
|
454
|
+
color: o.muted
|
|
455
|
+
}),
|
|
456
|
+
/** Uppercase section label: "FAVOURITES · 3", "SINGLE PREDICTIONS". */
|
|
457
|
+
eyebrow: a({
|
|
458
|
+
...Wn,
|
|
459
|
+
fontFamily: o.fontSecondary,
|
|
460
|
+
fontWeight: 500,
|
|
461
|
+
fontSize: "0.7em",
|
|
462
|
+
letterSpacing: r(0.6, 11.2),
|
|
463
|
+
color: o.muted
|
|
464
|
+
}),
|
|
465
|
+
/** Big accent figure with its "pts" unit: section headers. */
|
|
466
|
+
bigPoints: a({
|
|
467
|
+
fontFamily: o.fontPrimary,
|
|
468
|
+
fontWeight: 700,
|
|
469
|
+
fontSize: "1.4em",
|
|
470
|
+
lineHeight: 1.1,
|
|
471
|
+
color: o.accent
|
|
472
|
+
}),
|
|
473
|
+
/** "pts" after a figure, against the figure's size. */
|
|
474
|
+
unit: a({
|
|
475
|
+
fontFamily: o.fontSecondary,
|
|
476
|
+
fontWeight: 400,
|
|
477
|
+
fontSize: "0.5em",
|
|
478
|
+
color: o.muted
|
|
479
|
+
}),
|
|
480
|
+
/** A small figure with its caption under it: "155.7K / made". */
|
|
481
|
+
figure: a({
|
|
482
|
+
display: "block",
|
|
483
|
+
fontFamily: o.fontPrimary,
|
|
484
|
+
fontWeight: 700,
|
|
485
|
+
fontSize: "1em",
|
|
486
|
+
color: o.text
|
|
487
|
+
}),
|
|
488
|
+
figureAccent: a({
|
|
489
|
+
display: "block",
|
|
490
|
+
fontFamily: o.fontPrimary,
|
|
491
|
+
fontWeight: 700,
|
|
492
|
+
fontSize: "1em",
|
|
493
|
+
color: o.accent
|
|
494
|
+
}),
|
|
495
|
+
caption: a({
|
|
496
|
+
fontFamily: o.fontSecondary,
|
|
497
|
+
fontWeight: 400,
|
|
498
|
+
fontSize: "0.68em",
|
|
499
|
+
color: o.muted
|
|
500
|
+
}),
|
|
501
|
+
muted: a({
|
|
502
|
+
fontFamily: o.fontSecondary,
|
|
503
|
+
fontWeight: 400,
|
|
504
|
+
fontSize: "0.72em",
|
|
505
|
+
color: o.muted
|
|
506
|
+
}),
|
|
507
|
+
/** A row's entity name, ellipsised; may be CMS text in another script. */
|
|
508
|
+
rowName: a({
|
|
509
|
+
minWidth: 0,
|
|
510
|
+
fontFamily: o.fontSecondary,
|
|
511
|
+
fontWeight: 500,
|
|
512
|
+
fontSize: "0.85em",
|
|
513
|
+
color: o.text,
|
|
514
|
+
whiteSpace: "nowrap",
|
|
515
|
+
overflow: "hidden",
|
|
516
|
+
textOverflow: "ellipsis",
|
|
517
|
+
unicodeBidi: "plaintext"
|
|
518
|
+
}),
|
|
519
|
+
rowFigure: a({
|
|
520
|
+
flex: "none",
|
|
521
|
+
fontFamily: o.fontPrimary,
|
|
522
|
+
fontWeight: 700,
|
|
523
|
+
fontSize: "0.85em",
|
|
524
|
+
color: o.text
|
|
525
|
+
}),
|
|
526
|
+
rowPoints: a({
|
|
527
|
+
fontFamily: o.fontPrimary,
|
|
528
|
+
fontWeight: 700,
|
|
529
|
+
fontSize: "0.85em",
|
|
530
|
+
color: o.accent
|
|
531
|
+
}),
|
|
532
|
+
rowCaption: a({
|
|
533
|
+
fontFamily: o.fontSecondary,
|
|
534
|
+
fontWeight: 400,
|
|
535
|
+
fontSize: "0.7em",
|
|
536
|
+
color: o.muted
|
|
537
|
+
})
|
|
538
|
+
}, H = {
|
|
539
|
+
card: a({
|
|
540
|
+
fontSize: "1em",
|
|
541
|
+
display: "flex",
|
|
542
|
+
flexDirection: "column",
|
|
543
|
+
gap: r(14),
|
|
544
|
+
padding: r(16),
|
|
545
|
+
backgroundColor: o.card,
|
|
546
|
+
border: `1px solid ${o.border}`,
|
|
547
|
+
borderRadius: r(14),
|
|
548
|
+
minWidth: 0
|
|
549
|
+
}),
|
|
550
|
+
cardTight: a({
|
|
551
|
+
fontSize: "1em",
|
|
552
|
+
display: "flex",
|
|
553
|
+
flexDirection: "column",
|
|
554
|
+
gap: r(12),
|
|
555
|
+
padding: r(16),
|
|
556
|
+
backgroundColor: o.card,
|
|
557
|
+
border: `1px solid ${o.border}`,
|
|
558
|
+
borderRadius: r(14),
|
|
559
|
+
minWidth: 0
|
|
560
|
+
}),
|
|
561
|
+
header: a({
|
|
562
|
+
display: "flex",
|
|
563
|
+
alignItems: "center",
|
|
564
|
+
justifyContent: "space-between",
|
|
565
|
+
flexWrap: "wrap",
|
|
566
|
+
gap: r(8)
|
|
567
|
+
}),
|
|
568
|
+
abbr: a({ cursor: "help" }),
|
|
569
|
+
pill: a({
|
|
570
|
+
flex: "none",
|
|
571
|
+
whiteSpace: "nowrap",
|
|
572
|
+
padding: `${r(3, 10.56)} ${r(9, 10.56)}`,
|
|
573
|
+
borderRadius: "999px",
|
|
574
|
+
backgroundColor: P(o.accent, 14),
|
|
575
|
+
color: o.accentFg,
|
|
576
|
+
fontFamily: o.fontPrimary,
|
|
577
|
+
fontWeight: 700,
|
|
578
|
+
fontSize: "0.66em"
|
|
579
|
+
}),
|
|
580
|
+
pillSmall: a({
|
|
581
|
+
flex: "none",
|
|
582
|
+
whiteSpace: "nowrap",
|
|
583
|
+
padding: `${r(3, 10.24)} ${r(9, 10.24)}`,
|
|
584
|
+
borderRadius: "999px",
|
|
585
|
+
backgroundColor: P(o.accent, 14),
|
|
586
|
+
color: o.accentFg,
|
|
587
|
+
fontFamily: o.fontPrimary,
|
|
588
|
+
fontWeight: 700,
|
|
589
|
+
fontSize: "0.64em"
|
|
590
|
+
}),
|
|
591
|
+
track: a({
|
|
592
|
+
display: "block",
|
|
593
|
+
height: r(7),
|
|
594
|
+
borderRadius: "999px",
|
|
595
|
+
backgroundColor: o.variant,
|
|
596
|
+
overflow: "hidden"
|
|
597
|
+
}),
|
|
598
|
+
trackThin: a({
|
|
599
|
+
display: "block",
|
|
600
|
+
height: r(6),
|
|
601
|
+
borderRadius: "999px",
|
|
602
|
+
backgroundColor: o.variant,
|
|
603
|
+
overflow: "hidden"
|
|
604
|
+
}),
|
|
605
|
+
fill: a({
|
|
606
|
+
display: "block",
|
|
607
|
+
height: "100%",
|
|
608
|
+
width: "var(--ps-width)",
|
|
609
|
+
borderRadius: "999px",
|
|
610
|
+
backgroundColor: "var(--ps-color)"
|
|
611
|
+
}),
|
|
612
|
+
scroll: a({
|
|
613
|
+
overflowY: "auto",
|
|
614
|
+
paddingInlineEnd: r(10),
|
|
615
|
+
"&::-webkit-scrollbar": { width: "6px", height: "6px" },
|
|
616
|
+
"&::-webkit-scrollbar-thumb": { background: o.border, borderRadius: "999px" }
|
|
617
|
+
}),
|
|
618
|
+
srOnly: a({
|
|
619
|
+
position: "absolute",
|
|
620
|
+
width: "1px",
|
|
621
|
+
height: "1px",
|
|
622
|
+
padding: 0,
|
|
623
|
+
margin: "-1px",
|
|
624
|
+
overflow: "hidden",
|
|
625
|
+
clip: "rect(0, 0, 0, 0)",
|
|
626
|
+
whiteSpace: "nowrap",
|
|
627
|
+
border: 0
|
|
628
|
+
})
|
|
629
|
+
}, bt = H.scroll, Oe = H.srOnly, ee = ({ label: e, tight: t, children: n }) => /* @__PURE__ */ i("section", { css: t ? H.cardTight : H.card, "aria-label": e, children: n }), Ae = ({ children: e }) => /* @__PURE__ */ i("div", { css: H.header, children: e }), ye = (e) => {
|
|
630
|
+
const { fmt: t } = F();
|
|
631
|
+
return Math.abs(e) >= 1e3 ? t.full(e) : null;
|
|
632
|
+
}, E = ({ value: e, className: t }) => {
|
|
633
|
+
const { fmt: n } = F(), s = ye(e);
|
|
634
|
+
return /* @__PURE__ */ i(ae, { title: s, children: /* @__PURE__ */ i("span", { css: s ? H.abbr : void 0, className: t, children: n.compact(e) }) });
|
|
635
|
+
}, xt = ({ points: e, small: t }) => {
|
|
636
|
+
const { label: n, fmt: s } = F(), c = ye(e);
|
|
637
|
+
return e > 0 ? /* @__PURE__ */ i(ae, { title: c && n("pointsPill", { points: c }), children: /* @__PURE__ */ i("span", { css: t ? H.pillSmall : H.pill, children: n("pointsPill", { points: s.compact(e) }) }) }) : null;
|
|
638
|
+
}, be = ({
|
|
639
|
+
value: e,
|
|
640
|
+
color: t,
|
|
641
|
+
thin: n
|
|
642
|
+
}) => /* @__PURE__ */ i("span", { css: n ? H.trackThin : H.track, children: /* @__PURE__ */ i(
|
|
643
|
+
"span",
|
|
644
|
+
{
|
|
645
|
+
css: H.fill,
|
|
646
|
+
style: {
|
|
647
|
+
"--ps-width": `${Math.max(0, Math.min(100, e))}%`,
|
|
648
|
+
"--ps-color": t
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
) }), On = "rgba(255, 255, 255, 0.72)", W = {
|
|
652
|
+
root: a({
|
|
653
|
+
fontSize: "1em",
|
|
654
|
+
display: "flex",
|
|
655
|
+
flexDirection: "column",
|
|
656
|
+
gap: r(16),
|
|
657
|
+
padding: `${r(18)} ${r(20)}`,
|
|
658
|
+
borderRadius: r(14),
|
|
659
|
+
// Gradient angles are not mirrored under RTL; the sweep reads the same either way.
|
|
660
|
+
background: `linear-gradient(135deg, ${o.accent} 0%, color-mix(in srgb, ${o.accent} 55%, #0B1220) 100%)`,
|
|
661
|
+
color: "#FFFFFF"
|
|
662
|
+
}),
|
|
663
|
+
top: a({ display: "flex", alignItems: "center", flexWrap: "wrap", gap: r(12) }),
|
|
664
|
+
emblem: a({
|
|
665
|
+
flex: "none",
|
|
666
|
+
width: r(44),
|
|
667
|
+
height: r(44),
|
|
668
|
+
borderRadius: r(12),
|
|
669
|
+
backgroundColor: "rgba(255, 255, 255, 0.14)",
|
|
670
|
+
border: "1.5px solid rgba(255, 255, 255, 0.35)",
|
|
671
|
+
display: "flex",
|
|
672
|
+
alignItems: "center",
|
|
673
|
+
justifyContent: "center"
|
|
674
|
+
}),
|
|
675
|
+
diamond: a({
|
|
676
|
+
width: r(18),
|
|
677
|
+
height: r(18),
|
|
678
|
+
transform: "rotate(45deg)",
|
|
679
|
+
borderRadius: r(3),
|
|
680
|
+
// White, like the hero's text: the card itself is the accent.
|
|
681
|
+
backgroundColor: "#FFFFFF",
|
|
682
|
+
boxShadow: "0 0 12px rgba(255, 255, 255, 0.6)"
|
|
683
|
+
}),
|
|
684
|
+
tier: a({ display: "flex", flexDirection: "column", minWidth: 0 }),
|
|
685
|
+
total: a({ marginInlineStart: "auto", textAlign: "end", display: "flex", flexDirection: "column" }),
|
|
686
|
+
kicker: a({
|
|
687
|
+
color: On,
|
|
688
|
+
fontFamily: o.fontSecondary,
|
|
689
|
+
fontWeight: 500,
|
|
690
|
+
fontSize: "0.7em",
|
|
691
|
+
letterSpacing: r(1, 11.2),
|
|
692
|
+
textTransform: "uppercase"
|
|
693
|
+
}),
|
|
694
|
+
tierName: a({
|
|
695
|
+
fontFamily: o.fontPrimary,
|
|
696
|
+
fontWeight: 700,
|
|
697
|
+
fontSize: "1.4em",
|
|
698
|
+
lineHeight: 1.1,
|
|
699
|
+
unicodeBidi: "plaintext"
|
|
700
|
+
}),
|
|
701
|
+
points: a({ fontFamily: o.fontPrimary, fontWeight: 700, fontSize: "1.6em", lineHeight: 1.1 }),
|
|
702
|
+
tiles: a({ display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: r(10) }),
|
|
703
|
+
tile: a({
|
|
704
|
+
minWidth: 0,
|
|
705
|
+
padding: `${r(10)} ${r(12)}`,
|
|
706
|
+
borderRadius: r(10),
|
|
707
|
+
backgroundColor: "rgba(255, 255, 255, 0.12)"
|
|
708
|
+
}),
|
|
709
|
+
tileValue: a({
|
|
710
|
+
display: "block",
|
|
711
|
+
fontFamily: o.fontPrimary,
|
|
712
|
+
fontWeight: 700,
|
|
713
|
+
fontSize: "1.15em"
|
|
714
|
+
}),
|
|
715
|
+
tileLabel: a({
|
|
716
|
+
color: "rgba(255, 255, 255, 0.75)",
|
|
717
|
+
fontFamily: o.fontSecondary,
|
|
718
|
+
fontWeight: 400,
|
|
719
|
+
fontSize: "0.72em"
|
|
720
|
+
})
|
|
721
|
+
}, An = ({ hero: e }) => {
|
|
722
|
+
const { label: t } = F(), n = [
|
|
723
|
+
{ key: "made", value: /* @__PURE__ */ i(E, { value: e.predictionsMade }), label: t("predictionsMade") }
|
|
724
|
+
];
|
|
725
|
+
return e.correct !== null && n.push({ key: "correct", value: /* @__PURE__ */ i(E, { value: e.correct }), label: t("correctTitle") }), e.overallPercent !== null && n.push({ key: "overall", value: `${e.overallPercent}%`, label: t("overallSuccess") }), /* @__PURE__ */ d("section", { css: W.root, "aria-label": t("currentTier"), children: [
|
|
726
|
+
/* @__PURE__ */ d("div", { css: W.top, children: [
|
|
727
|
+
/* @__PURE__ */ i("span", { css: W.emblem, "aria-hidden": "true", children: /* @__PURE__ */ i("span", { css: W.diamond }) }),
|
|
728
|
+
/* @__PURE__ */ d("div", { css: W.tier, children: [
|
|
729
|
+
/* @__PURE__ */ i("span", { css: W.kicker, children: t("currentTier") }),
|
|
730
|
+
/* @__PURE__ */ i("span", { css: W.tierName, children: e.tierLabel })
|
|
731
|
+
] }),
|
|
732
|
+
/* @__PURE__ */ d("div", { css: W.total, children: [
|
|
733
|
+
/* @__PURE__ */ i("span", { css: W.kicker, children: t("totalPoints") }),
|
|
734
|
+
/* @__PURE__ */ i(E, { value: e.points, css: W.points })
|
|
735
|
+
] })
|
|
736
|
+
] }),
|
|
737
|
+
/* @__PURE__ */ i("div", { css: W.tiles, children: n.map((s) => /* @__PURE__ */ d("div", { css: W.tile, children: [
|
|
738
|
+
/* @__PURE__ */ i("span", { css: W.tileValue, children: s.value }),
|
|
739
|
+
/* @__PURE__ */ i("span", { css: W.tileLabel, children: s.label })
|
|
740
|
+
] }, s.key)) })
|
|
741
|
+
] });
|
|
742
|
+
}, Y = {
|
|
743
|
+
points: a({ fontFamily: o.fontSecondary, fontSize: "0.72em", color: o.muted }),
|
|
744
|
+
pointsShort: a({ fontFamily: o.fontSecondary, fontSize: "0.72em", color: o.muted, cursor: "help" }),
|
|
745
|
+
ladder: a({
|
|
746
|
+
listStyle: "none",
|
|
747
|
+
margin: 0,
|
|
748
|
+
padding: 0,
|
|
749
|
+
display: "grid",
|
|
750
|
+
gridTemplateColumns: "repeat(var(--ps-steps), minmax(0, 1fr))"
|
|
751
|
+
}),
|
|
752
|
+
step: a({
|
|
753
|
+
position: "relative",
|
|
754
|
+
display: "flex",
|
|
755
|
+
flexDirection: "column",
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
gap: r(8),
|
|
758
|
+
padding: `0 ${r(4)}`,
|
|
759
|
+
textAlign: "center",
|
|
760
|
+
minWidth: 0
|
|
761
|
+
}),
|
|
762
|
+
line: a({
|
|
763
|
+
position: "absolute",
|
|
764
|
+
top: r(9),
|
|
765
|
+
insetInlineStart: "var(--ps-line-start)",
|
|
766
|
+
insetInlineEnd: "var(--ps-line-end)",
|
|
767
|
+
height: r(3),
|
|
768
|
+
backgroundColor: "var(--ps-line)"
|
|
769
|
+
}),
|
|
770
|
+
node: a({
|
|
771
|
+
position: "relative",
|
|
772
|
+
width: r(20),
|
|
773
|
+
height: r(20),
|
|
774
|
+
borderRadius: "50%",
|
|
775
|
+
backgroundColor: o.card,
|
|
776
|
+
display: "flex",
|
|
777
|
+
alignItems: "center",
|
|
778
|
+
justifyContent: "center"
|
|
779
|
+
}),
|
|
780
|
+
diamond: a({
|
|
781
|
+
width: r(14),
|
|
782
|
+
height: r(14),
|
|
783
|
+
transform: "rotate(45deg)",
|
|
784
|
+
borderRadius: r(2),
|
|
785
|
+
backgroundColor: "var(--ps-node)",
|
|
786
|
+
boxShadow: "var(--ps-ring)"
|
|
787
|
+
}),
|
|
788
|
+
threshold: a({ fontFamily: o.fontSecondary, fontSize: "0.7em", color: o.muted }),
|
|
789
|
+
thresholdShort: a({ fontFamily: o.fontSecondary, fontSize: "0.7em", color: o.muted, cursor: "help" }),
|
|
790
|
+
date: a({ fontFamily: o.fontSecondary, fontSize: "0.66em", color: o.muted })
|
|
791
|
+
}, Ge = a({
|
|
792
|
+
maxWidth: "100%",
|
|
793
|
+
overflow: "hidden",
|
|
794
|
+
textOverflow: "ellipsis",
|
|
795
|
+
fontFamily: o.fontPrimary,
|
|
796
|
+
fontWeight: 700,
|
|
797
|
+
fontSize: "0.8em",
|
|
798
|
+
unicodeBidi: "plaintext"
|
|
799
|
+
}), Qe = a({
|
|
800
|
+
fontFamily: o.fontSecondary,
|
|
801
|
+
fontWeight: 600,
|
|
802
|
+
fontSize: "0.66em",
|
|
803
|
+
textTransform: "uppercase"
|
|
804
|
+
}), ue = {
|
|
805
|
+
nameReached: a(Ge, { color: o.text }),
|
|
806
|
+
nameLocked: a(Ge, { color: o.muted }),
|
|
807
|
+
reached: a(Qe, { color: o.success }),
|
|
808
|
+
locked: a(Qe, { color: o.muted })
|
|
809
|
+
}, Mn = ({
|
|
810
|
+
tier: e,
|
|
811
|
+
first: t,
|
|
812
|
+
last: n
|
|
813
|
+
}) => {
|
|
814
|
+
const { label: s, fmt: c } = F(), l = ye(e.points);
|
|
815
|
+
return /* @__PURE__ */ d(
|
|
816
|
+
"li",
|
|
817
|
+
{
|
|
818
|
+
css: Y.step,
|
|
819
|
+
style: {
|
|
820
|
+
"--ps-line-start": t ? "50%" : "0",
|
|
821
|
+
"--ps-line-end": n ? "50%" : "0",
|
|
822
|
+
"--ps-line": e.reached ? o.accent : o.border,
|
|
823
|
+
"--ps-node": e.reached ? o.accent : o.variant,
|
|
824
|
+
"--ps-ring": e.current ? `0 0 0 4px ${P(o.accent, 30)}` : "none"
|
|
825
|
+
},
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ i("span", { css: Y.line, "aria-hidden": "true" }),
|
|
828
|
+
/* @__PURE__ */ i("span", { css: Y.node, "aria-hidden": "true", children: /* @__PURE__ */ i("span", { css: Y.diamond }) }),
|
|
829
|
+
/* @__PURE__ */ i("span", { css: e.reached ? ue.nameReached : ue.nameLocked, children: e.label }),
|
|
830
|
+
/* @__PURE__ */ i(ae, { title: l && s("tierThreshold", { points: l }), children: /* @__PURE__ */ i("span", { css: l ? Y.thresholdShort : Y.threshold, children: s("tierThreshold", { points: c.threshold(e.points) }) }) }),
|
|
831
|
+
e.reached ? /* @__PURE__ */ d("span", { css: ue.reached, children: [
|
|
832
|
+
/* @__PURE__ */ i("span", { "aria-hidden": "true", children: "✓" }),
|
|
833
|
+
/* @__PURE__ */ i("span", { css: Oe, children: s(e.current ? "tierCurrent" : "tierReached") })
|
|
834
|
+
] }) : /* @__PURE__ */ i("span", { css: ue.locked, children: s("tierLocked") }),
|
|
835
|
+
/* @__PURE__ */ i("span", { css: Y.date, children: e.reached ? c.date(e.achievedAt) : s("notReachedYet") })
|
|
836
|
+
]
|
|
837
|
+
}
|
|
838
|
+
);
|
|
839
|
+
}, Dn = ({ tiers: e, points: t }) => {
|
|
840
|
+
const { label: n, fmt: s } = F(), c = ye(t);
|
|
841
|
+
return /* @__PURE__ */ d(ee, { label: n("tierProgression"), children: [
|
|
842
|
+
/* @__PURE__ */ d(Ae, { children: [
|
|
843
|
+
/* @__PURE__ */ i("h3", { css: b.title, children: n("tierProgression") }),
|
|
844
|
+
/* @__PURE__ */ i(ae, { title: c && n("pointsValue", { points: c }), children: /* @__PURE__ */ i("span", { css: c ? Y.pointsShort : Y.points, children: n("pointsValue", { points: s.compact(t) }) }) })
|
|
845
|
+
] }),
|
|
846
|
+
/* @__PURE__ */ i(
|
|
847
|
+
"ol",
|
|
848
|
+
{
|
|
849
|
+
css: Y.ladder,
|
|
850
|
+
style: { "--ps-steps": e.length },
|
|
851
|
+
children: e.map((l, f) => /* @__PURE__ */ i(Mn, { tier: l, first: f === 0, last: f === e.length - 1 }, l.id))
|
|
852
|
+
}
|
|
853
|
+
)
|
|
854
|
+
] });
|
|
855
|
+
}, St = (e) => e >= 100 ? o.success : o.accent, Ln = (e, t) => {
|
|
856
|
+
const n = (s) => t === "made" ? s.made : t === "rate" ? le(s.correct, s.made) : s.points;
|
|
857
|
+
return e.slice().sort((s, c) => n(c) - n(s));
|
|
858
|
+
}, Bn = (e) => {
|
|
859
|
+
const t = e.reduce(
|
|
860
|
+
(n, s) => ({
|
|
861
|
+
made: n.made + s.made,
|
|
862
|
+
correct: n.correct + s.correct,
|
|
863
|
+
points: n.points + s.points
|
|
864
|
+
}),
|
|
865
|
+
{ made: 0, correct: 0, points: 0 }
|
|
866
|
+
);
|
|
867
|
+
return { ...t, rate: le(t.correct, t.made) };
|
|
868
|
+
}, vt = (e) => e.some((t) => t.points > 0), Nn = (e) => {
|
|
869
|
+
const t = vt(e), n = (l) => t ? l.points : l.votes, s = e.slice().sort((l, f) => n(f) - n(l)), c = s.length ? n(s[0]) : 0;
|
|
870
|
+
return s.map((l) => ({ ...l, width: c > 0 ? le(n(l), c) : 0 }));
|
|
871
|
+
}, Ct = ["team", "player", "competition", "sport"], ke = 8, _n = (e) => Array.from(new Set(e.map((t) => t.source).filter(Boolean))), Hn = (e, t) => {
|
|
872
|
+
const n = t === "all" ? e : e.filter((s) => s.source === t);
|
|
873
|
+
return {
|
|
874
|
+
total: n.length,
|
|
875
|
+
favourites: n.filter((s) => s.favourite),
|
|
876
|
+
groups: Ct.map((s) => ({
|
|
877
|
+
type: s,
|
|
878
|
+
items: n.filter((c) => c.type === s && !c.favourite)
|
|
879
|
+
})).filter((s) => s.items.length > 0)
|
|
880
|
+
};
|
|
881
|
+
}, jn = {
|
|
882
|
+
predictor: "#1A77D2",
|
|
883
|
+
topX: "#7B2FF7",
|
|
884
|
+
matchQuiz: "#DC6803",
|
|
885
|
+
discussions: "#4CAF50"
|
|
886
|
+
}, Gn = (e) => jn[e] ?? o.accent, Me = {
|
|
887
|
+
margin: 0,
|
|
888
|
+
border: "none",
|
|
889
|
+
background: "transparent",
|
|
890
|
+
cursor: "pointer",
|
|
891
|
+
fontFamily: "inherit"
|
|
892
|
+
}, Ue = {
|
|
893
|
+
...Me,
|
|
894
|
+
padding: `${r(6, 11.52)} ${r(12, 11.52)}`,
|
|
895
|
+
borderRadius: "999px",
|
|
896
|
+
fontFamily: o.fontSecondary,
|
|
897
|
+
fontWeight: 600,
|
|
898
|
+
fontSize: "0.72em",
|
|
899
|
+
whiteSpace: "nowrap",
|
|
900
|
+
transition: "background-color .15s, color .15s"
|
|
901
|
+
}, Ve = {
|
|
902
|
+
...Me,
|
|
903
|
+
padding: `${r(4, 11.52)} ${r(11, 11.52)}`,
|
|
904
|
+
border: `1px solid ${o.border}`,
|
|
905
|
+
borderRadius: "999px",
|
|
906
|
+
fontFamily: o.fontSecondary,
|
|
907
|
+
fontSize: "0.72em",
|
|
908
|
+
transition: "background-color .15s, color .15s"
|
|
909
|
+
}, kt = {
|
|
910
|
+
muted: a({
|
|
911
|
+
fontFamily: o.fontSecondary,
|
|
912
|
+
fontWeight: 400,
|
|
913
|
+
fontSize: "0.72em",
|
|
914
|
+
color: o.muted
|
|
915
|
+
})
|
|
916
|
+
}, N = {
|
|
917
|
+
tabs: a({
|
|
918
|
+
display: "flex",
|
|
919
|
+
flexWrap: "wrap",
|
|
920
|
+
gap: r(4),
|
|
921
|
+
padding: r(3),
|
|
922
|
+
borderRadius: "999px",
|
|
923
|
+
backgroundColor: o.variant
|
|
924
|
+
}),
|
|
925
|
+
tabsStart: a({
|
|
926
|
+
display: "flex",
|
|
927
|
+
flexWrap: "wrap",
|
|
928
|
+
gap: r(4),
|
|
929
|
+
padding: r(3),
|
|
930
|
+
borderRadius: "999px",
|
|
931
|
+
backgroundColor: o.variant,
|
|
932
|
+
alignSelf: "flex-start"
|
|
933
|
+
}),
|
|
934
|
+
tabOn: a({
|
|
935
|
+
...Ue,
|
|
936
|
+
backgroundColor: o.card,
|
|
937
|
+
color: o.accent,
|
|
938
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.15)"
|
|
939
|
+
}),
|
|
940
|
+
tabOff: a({ ...Ue, color: o.muted }),
|
|
941
|
+
chipOn: a({
|
|
942
|
+
...Ve,
|
|
943
|
+
fontWeight: 700,
|
|
944
|
+
backgroundColor: P(o.accent, 12),
|
|
945
|
+
borderColor: o.accent,
|
|
946
|
+
color: o.accentFg
|
|
947
|
+
}),
|
|
948
|
+
chipOff: a({ ...Ve, fontWeight: 500, color: o.muted }),
|
|
949
|
+
sortRow: a({
|
|
950
|
+
display: "flex",
|
|
951
|
+
alignItems: "center",
|
|
952
|
+
justifyContent: "flex-end",
|
|
953
|
+
flexWrap: "wrap",
|
|
954
|
+
gap: r(6)
|
|
955
|
+
}),
|
|
956
|
+
disclosure: a({
|
|
957
|
+
...Me,
|
|
958
|
+
display: "flex",
|
|
959
|
+
alignItems: "center",
|
|
960
|
+
gap: r(8),
|
|
961
|
+
width: "100%",
|
|
962
|
+
padding: 0,
|
|
963
|
+
textAlign: "start",
|
|
964
|
+
color: o.muted
|
|
965
|
+
}),
|
|
966
|
+
disclosureTitle: a({
|
|
967
|
+
flex: 1,
|
|
968
|
+
fontFamily: o.fontPrimary,
|
|
969
|
+
fontWeight: 700,
|
|
970
|
+
fontSize: "0.9em",
|
|
971
|
+
color: o.text
|
|
972
|
+
}),
|
|
973
|
+
chevron: a({ display: "inline-flex", fontSize: "1.1em", transition: "transform .2s" }),
|
|
974
|
+
// rotate() is not mirrored by the RTL plugin: under RTL the icon points left, so it turns the other way.
|
|
975
|
+
chevronOpen: a({
|
|
976
|
+
display: "inline-flex",
|
|
977
|
+
fontSize: "1.1em",
|
|
978
|
+
transition: "transform .2s",
|
|
979
|
+
transform: "rotate(90deg)"
|
|
980
|
+
}),
|
|
981
|
+
chevronOpenRtl: a({
|
|
982
|
+
display: "inline-flex",
|
|
983
|
+
fontSize: "1.1em",
|
|
984
|
+
transition: "transform .2s",
|
|
985
|
+
transform: "rotate(-90deg)"
|
|
986
|
+
})
|
|
987
|
+
}, xe = ({
|
|
988
|
+
options: e,
|
|
989
|
+
value: t,
|
|
990
|
+
onChange: n,
|
|
991
|
+
label: s,
|
|
992
|
+
alignStart: c
|
|
993
|
+
}) => /* @__PURE__ */ i("div", { role: "group", "aria-label": s, css: c ? N.tabsStart : N.tabs, children: e.map((l) => /* @__PURE__ */ i(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
type: "button",
|
|
997
|
+
"aria-pressed": l.key === t,
|
|
998
|
+
css: l.key === t ? N.tabOn : N.tabOff,
|
|
999
|
+
onClick: () => n(l.key),
|
|
1000
|
+
children: l.label
|
|
1001
|
+
},
|
|
1002
|
+
l.key
|
|
1003
|
+
)) }), Qn = ({
|
|
1004
|
+
options: e,
|
|
1005
|
+
value: t,
|
|
1006
|
+
onChange: n
|
|
1007
|
+
}) => {
|
|
1008
|
+
const { label: s } = F(), c = Z.useId();
|
|
1009
|
+
return /* @__PURE__ */ d("div", { role: "group", "aria-labelledby": c, css: N.sortRow, children: [
|
|
1010
|
+
/* @__PURE__ */ i("span", { id: c, css: kt.muted, children: s("sortBy") }),
|
|
1011
|
+
e.map((l) => /* @__PURE__ */ i(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
type: "button",
|
|
1015
|
+
"aria-pressed": l.key === t,
|
|
1016
|
+
css: l.key === t ? N.chipOn : N.chipOff,
|
|
1017
|
+
onClick: () => n(l.key),
|
|
1018
|
+
children: l.label
|
|
1019
|
+
},
|
|
1020
|
+
l.key
|
|
1021
|
+
))
|
|
1022
|
+
] });
|
|
1023
|
+
}, Ft = ({ title: e, open: t, controls: n, onToggle: s }) => {
|
|
1024
|
+
const { label: c } = F(), l = _t();
|
|
1025
|
+
return /* @__PURE__ */ d(
|
|
1026
|
+
"button",
|
|
1027
|
+
{
|
|
1028
|
+
type: "button",
|
|
1029
|
+
"aria-expanded": t,
|
|
1030
|
+
"aria-controls": n,
|
|
1031
|
+
css: N.disclosure,
|
|
1032
|
+
onClick: s,
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ i("span", { css: N.disclosureTitle, children: e }),
|
|
1035
|
+
/* @__PURE__ */ i("span", { css: kt.muted, children: c(t ? "hide" : "show") }),
|
|
1036
|
+
/* @__PURE__ */ i(
|
|
1037
|
+
"span",
|
|
1038
|
+
{
|
|
1039
|
+
"aria-hidden": "true",
|
|
1040
|
+
css: t ? l ? N.chevronOpenRtl : N.chevronOpen : N.chevron,
|
|
1041
|
+
children: /* @__PURE__ */ i(Ht, { children: /* @__PURE__ */ i(Gt, {}) })
|
|
1042
|
+
}
|
|
1043
|
+
)
|
|
1044
|
+
]
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1047
|
+
}, Fe = {
|
|
1048
|
+
boxSizing: "border-box",
|
|
1049
|
+
flex: "none",
|
|
1050
|
+
display: "block",
|
|
1051
|
+
width: "var(--ps-size)",
|
|
1052
|
+
height: "var(--ps-size)"
|
|
1053
|
+
}, we = {
|
|
1054
|
+
logo: a({
|
|
1055
|
+
...Fe,
|
|
1056
|
+
objectFit: "contain",
|
|
1057
|
+
// White disc and padding in dark mode only, so dark marks stay visible.
|
|
1058
|
+
backgroundColor: o.logoDisc,
|
|
1059
|
+
padding: o.logoPad,
|
|
1060
|
+
borderRadius: o.logoRadius
|
|
1061
|
+
}),
|
|
1062
|
+
headshot: a({
|
|
1063
|
+
...Fe,
|
|
1064
|
+
objectFit: "cover",
|
|
1065
|
+
objectPosition: "center top",
|
|
1066
|
+
borderRadius: "50%",
|
|
1067
|
+
backgroundColor: o.variant
|
|
1068
|
+
}),
|
|
1069
|
+
fallback: a({
|
|
1070
|
+
...Fe,
|
|
1071
|
+
borderRadius: "50%",
|
|
1072
|
+
backgroundColor: o.accent,
|
|
1073
|
+
color: "#FFFFFF",
|
|
1074
|
+
display: "flex",
|
|
1075
|
+
alignItems: "center",
|
|
1076
|
+
justifyContent: "center",
|
|
1077
|
+
fontFamily: o.fontPrimary,
|
|
1078
|
+
fontWeight: 700,
|
|
1079
|
+
fontSize: "var(--ps-code-size)",
|
|
1080
|
+
lineHeight: 1
|
|
1081
|
+
})
|
|
1082
|
+
}, Un = (e) => e >= 40 ? 0.7 : e >= 30 ? 0.62 : 0.5, X = ({ entity: e, size: t }) => {
|
|
1083
|
+
const [n, s] = I(null), c = e.image && n !== e.image ? e.image : null;
|
|
1084
|
+
if (!c) {
|
|
1085
|
+
const l = Un(t);
|
|
1086
|
+
return /* @__PURE__ */ i(
|
|
1087
|
+
"span",
|
|
1088
|
+
{
|
|
1089
|
+
"aria-hidden": "true",
|
|
1090
|
+
css: we.fallback,
|
|
1091
|
+
style: {
|
|
1092
|
+
// The box is sized in the code's own em, so it stays `size` px against the card.
|
|
1093
|
+
"--ps-size": `${t / 16 / l}em`,
|
|
1094
|
+
"--ps-code-size": `${l}em`
|
|
1095
|
+
},
|
|
1096
|
+
children: e.code
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
return /* @__PURE__ */ i(
|
|
1101
|
+
"img",
|
|
1102
|
+
{
|
|
1103
|
+
src: c,
|
|
1104
|
+
alt: "",
|
|
1105
|
+
loading: "lazy",
|
|
1106
|
+
css: e.headshot ? we.headshot : we.logo,
|
|
1107
|
+
style: { "--ps-size": `${t / 16}em` },
|
|
1108
|
+
onError: () => s(c)
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
}, Vn = {
|
|
1112
|
+
keeper: "positionKeeper",
|
|
1113
|
+
goalkeeper: "positionKeeper",
|
|
1114
|
+
defender: "positionDefender",
|
|
1115
|
+
midfielder: "positionMidfielder",
|
|
1116
|
+
forward: "positionForward",
|
|
1117
|
+
center: "positionCenter"
|
|
1118
|
+
}, Yn = {
|
|
1119
|
+
football: "sportFootball",
|
|
1120
|
+
basketball: "sportBasketball",
|
|
1121
|
+
tennis: "sportTennis"
|
|
1122
|
+
}, wt = (e, t, n) => {
|
|
1123
|
+
const s = Yn[e.toLowerCase()];
|
|
1124
|
+
return s ? t(s) : e.charAt(0).toLocaleUpperCase(n) + e.slice(1);
|
|
1125
|
+
}, $t = (e, t) => {
|
|
1126
|
+
var s;
|
|
1127
|
+
const n = e.type === "team" ? t("metaTeam") : e.type === "competition" ? t("metaCompetition") : e.type === "sport" ? t("metaSport") : t(Vn[((s = e.position) == null ? void 0 : s.toLowerCase()) ?? ""] ?? "metaPlayer");
|
|
1128
|
+
return e.place ? t("metaWithPlace", { type: n, place: e.place }) : n;
|
|
1129
|
+
}, Se = (e, t, n) => {
|
|
1130
|
+
var s;
|
|
1131
|
+
return ((s = e.entity) == null ? void 0 : s.name) ?? wt(e.source || e.id, t, n);
|
|
1132
|
+
}, $e = {
|
|
1133
|
+
minWidth: 0,
|
|
1134
|
+
whiteSpace: "nowrap",
|
|
1135
|
+
overflow: "hidden",
|
|
1136
|
+
textOverflow: "ellipsis"
|
|
1137
|
+
}, Ye = {
|
|
1138
|
+
boxSizing: "border-box",
|
|
1139
|
+
display: "inline-flex",
|
|
1140
|
+
alignItems: "center",
|
|
1141
|
+
gap: r(7),
|
|
1142
|
+
maxWidth: "100%",
|
|
1143
|
+
minHeight: r(34),
|
|
1144
|
+
border: `1px solid ${o.border}`,
|
|
1145
|
+
borderRadius: "999px",
|
|
1146
|
+
backgroundColor: o.card
|
|
1147
|
+
}, K = {
|
|
1148
|
+
tile: a({
|
|
1149
|
+
position: "relative",
|
|
1150
|
+
minWidth: 0,
|
|
1151
|
+
display: "flex",
|
|
1152
|
+
flexDirection: "column",
|
|
1153
|
+
alignItems: "center",
|
|
1154
|
+
gap: r(8),
|
|
1155
|
+
padding: `${r(14)} ${r(10)} ${r(12)}`,
|
|
1156
|
+
textAlign: "center",
|
|
1157
|
+
borderRadius: r(11),
|
|
1158
|
+
backgroundColor: `color-mix(in srgb, ${o.accent} 8%, ${o.card})`,
|
|
1159
|
+
border: `1px solid ${P(o.accent, 35)}`
|
|
1160
|
+
}),
|
|
1161
|
+
star: a({
|
|
1162
|
+
position: "absolute",
|
|
1163
|
+
top: r(8, 13.6),
|
|
1164
|
+
insetInlineEnd: r(10, 13.6),
|
|
1165
|
+
fontSize: "0.85em",
|
|
1166
|
+
lineHeight: 1,
|
|
1167
|
+
color: o.accentFg
|
|
1168
|
+
}),
|
|
1169
|
+
tileText: a({ width: "100%", minWidth: 0, display: "flex", flexDirection: "column", gap: r(2) }),
|
|
1170
|
+
tileName: a({
|
|
1171
|
+
...$e,
|
|
1172
|
+
fontFamily: o.fontSecondary,
|
|
1173
|
+
fontWeight: 600,
|
|
1174
|
+
fontSize: "0.85em",
|
|
1175
|
+
color: o.text,
|
|
1176
|
+
unicodeBidi: "plaintext"
|
|
1177
|
+
}),
|
|
1178
|
+
tileMeta: a({
|
|
1179
|
+
...$e,
|
|
1180
|
+
fontFamily: o.fontSecondary,
|
|
1181
|
+
fontSize: "0.7em",
|
|
1182
|
+
color: o.muted
|
|
1183
|
+
}),
|
|
1184
|
+
chip: a({ ...Ye, padding: `${r(4)} ${r(12)} ${r(4)} ${r(4)}` }),
|
|
1185
|
+
chipSport: a({ ...Ye, padding: `${r(4)} ${r(13)}` }),
|
|
1186
|
+
chipName: a({
|
|
1187
|
+
...$e,
|
|
1188
|
+
fontFamily: o.fontSecondary,
|
|
1189
|
+
fontWeight: 500,
|
|
1190
|
+
fontSize: "0.8em",
|
|
1191
|
+
color: o.text,
|
|
1192
|
+
unicodeBidi: "plaintext"
|
|
1193
|
+
}),
|
|
1194
|
+
more: a({
|
|
1195
|
+
minHeight: r(34, 12.16),
|
|
1196
|
+
margin: 0,
|
|
1197
|
+
padding: `${r(4, 12.16)} ${r(12, 12.16)}`,
|
|
1198
|
+
border: `1px dashed ${o.border}`,
|
|
1199
|
+
borderRadius: "999px",
|
|
1200
|
+
background: "transparent",
|
|
1201
|
+
cursor: "pointer",
|
|
1202
|
+
color: o.accentFg,
|
|
1203
|
+
fontFamily: o.fontSecondary,
|
|
1204
|
+
fontWeight: 600,
|
|
1205
|
+
fontSize: "0.76em"
|
|
1206
|
+
})
|
|
1207
|
+
}, Kn = ({ interest: e }) => {
|
|
1208
|
+
const { label: t, language: n } = F(), s = Se(e, t, n);
|
|
1209
|
+
return /* @__PURE__ */ d("li", { css: K.tile, children: [
|
|
1210
|
+
/* @__PURE__ */ i("span", { css: K.star, "aria-hidden": "true", children: "★" }),
|
|
1211
|
+
/* @__PURE__ */ i("span", { css: Oe, children: t("favourite") }),
|
|
1212
|
+
e.entity && /* @__PURE__ */ i(X, { entity: e.entity, size: 44 }),
|
|
1213
|
+
/* @__PURE__ */ d("span", { css: K.tileText, children: [
|
|
1214
|
+
/* @__PURE__ */ i("span", { css: K.tileName, children: s }),
|
|
1215
|
+
/* @__PURE__ */ i("span", { css: K.tileMeta, children: $t(e, t) })
|
|
1216
|
+
] })
|
|
1217
|
+
] });
|
|
1218
|
+
}, qn = ({ interest: e }) => {
|
|
1219
|
+
const { label: t, language: n } = F();
|
|
1220
|
+
return /* @__PURE__ */ d("li", { css: e.entity ? K.chip : K.chipSport, children: [
|
|
1221
|
+
e.entity && /* @__PURE__ */ i(X, { entity: e.entity, size: 24 }),
|
|
1222
|
+
/* @__PURE__ */ i("span", { css: K.chipName, children: Se(e, t, n) })
|
|
1223
|
+
] });
|
|
1224
|
+
}, Xn = ({ open: e, hidden: t, controls: n, onToggle: s }) => {
|
|
1225
|
+
const { label: c } = F();
|
|
1226
|
+
return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
1227
|
+
"button",
|
|
1228
|
+
{
|
|
1229
|
+
type: "button",
|
|
1230
|
+
css: K.more,
|
|
1231
|
+
"aria-expanded": e,
|
|
1232
|
+
"aria-controls": n,
|
|
1233
|
+
onClick: s,
|
|
1234
|
+
children: e ? c("showLess") : c("moreCount", { count: t })
|
|
1235
|
+
}
|
|
1236
|
+
) });
|
|
1237
|
+
}, Pe = (e) => e !== "sport", Jn = {
|
|
1238
|
+
team: "addTeam",
|
|
1239
|
+
player: "addPlayer",
|
|
1240
|
+
competition: "addCompetition"
|
|
1241
|
+
}, Ke = {
|
|
1242
|
+
team: "searchTeams",
|
|
1243
|
+
player: "searchPlayers",
|
|
1244
|
+
competition: "searchCompetitions"
|
|
1245
|
+
}, Zn = 2, eo = 300, qe = {
|
|
1246
|
+
minWidth: 0,
|
|
1247
|
+
whiteSpace: "nowrap",
|
|
1248
|
+
overflow: "hidden",
|
|
1249
|
+
textOverflow: "ellipsis"
|
|
1250
|
+
}, Xe = {
|
|
1251
|
+
flex: "none",
|
|
1252
|
+
display: "inline-flex",
|
|
1253
|
+
alignItems: "center",
|
|
1254
|
+
gap: r(4, 12.16),
|
|
1255
|
+
margin: 0,
|
|
1256
|
+
padding: `${r(5, 12.16)} ${r(12, 12.16)}`,
|
|
1257
|
+
border: `1px solid ${o.border}`,
|
|
1258
|
+
borderRadius: "999px",
|
|
1259
|
+
background: "transparent",
|
|
1260
|
+
cursor: "pointer",
|
|
1261
|
+
fontFamily: o.fontSecondary,
|
|
1262
|
+
fontWeight: 600,
|
|
1263
|
+
fontSize: "0.76em",
|
|
1264
|
+
whiteSpace: "nowrap",
|
|
1265
|
+
transition: "background-color .15s, color .15s, border-color .15s"
|
|
1266
|
+
}, O = {
|
|
1267
|
+
panel: a({
|
|
1268
|
+
display: "flex",
|
|
1269
|
+
flexDirection: "column",
|
|
1270
|
+
border: `1px solid ${o.accent}`,
|
|
1271
|
+
borderRadius: r(11),
|
|
1272
|
+
backgroundColor: o.card,
|
|
1273
|
+
overflow: "hidden"
|
|
1274
|
+
}),
|
|
1275
|
+
field: a({
|
|
1276
|
+
display: "flex",
|
|
1277
|
+
alignItems: "center",
|
|
1278
|
+
gap: r(8),
|
|
1279
|
+
padding: `${r(4)} ${r(6)} ${r(4)} ${r(12)}`,
|
|
1280
|
+
borderBottom: `1px solid ${o.border}`,
|
|
1281
|
+
color: o.muted
|
|
1282
|
+
}),
|
|
1283
|
+
input: a({
|
|
1284
|
+
flex: 1,
|
|
1285
|
+
minWidth: 0,
|
|
1286
|
+
margin: 0,
|
|
1287
|
+
padding: `${r(8)} 0`,
|
|
1288
|
+
border: "none",
|
|
1289
|
+
outline: "none",
|
|
1290
|
+
background: "transparent",
|
|
1291
|
+
color: o.text,
|
|
1292
|
+
fontFamily: o.fontSecondary,
|
|
1293
|
+
// 1em of the card's 16px: smaller input text makes iOS zoom the page on focus.
|
|
1294
|
+
fontSize: "1em",
|
|
1295
|
+
"&::placeholder": { color: o.muted },
|
|
1296
|
+
"&::-webkit-search-cancel-button": { display: "none" }
|
|
1297
|
+
}),
|
|
1298
|
+
close: a({
|
|
1299
|
+
flex: "none",
|
|
1300
|
+
display: "inline-flex",
|
|
1301
|
+
alignItems: "center",
|
|
1302
|
+
justifyContent: "center",
|
|
1303
|
+
width: r(32),
|
|
1304
|
+
height: r(32),
|
|
1305
|
+
margin: 0,
|
|
1306
|
+
padding: 0,
|
|
1307
|
+
border: "none",
|
|
1308
|
+
borderRadius: "50%",
|
|
1309
|
+
background: "transparent",
|
|
1310
|
+
cursor: "pointer",
|
|
1311
|
+
color: o.muted,
|
|
1312
|
+
fontSize: "1em",
|
|
1313
|
+
"&:hover": { backgroundColor: o.variant, color: o.text }
|
|
1314
|
+
}),
|
|
1315
|
+
status: a({
|
|
1316
|
+
margin: 0,
|
|
1317
|
+
padding: `${r(10, 12.8)} ${r(14, 12.8)}`,
|
|
1318
|
+
fontFamily: o.fontSecondary,
|
|
1319
|
+
fontSize: "0.8em",
|
|
1320
|
+
color: o.muted,
|
|
1321
|
+
unicodeBidi: "plaintext"
|
|
1322
|
+
}),
|
|
1323
|
+
error: a({
|
|
1324
|
+
margin: 0,
|
|
1325
|
+
padding: `${r(10, 12.8)} ${r(14, 12.8)}`,
|
|
1326
|
+
fontFamily: o.fontSecondary,
|
|
1327
|
+
fontSize: "0.8em",
|
|
1328
|
+
color: o.danger
|
|
1329
|
+
}),
|
|
1330
|
+
results: a({ listStyle: "none", margin: 0, padding: `${r(4)} 0` }),
|
|
1331
|
+
row: a({
|
|
1332
|
+
display: "flex",
|
|
1333
|
+
alignItems: "center",
|
|
1334
|
+
gap: r(10),
|
|
1335
|
+
padding: `${r(6)} ${r(12)}`
|
|
1336
|
+
}),
|
|
1337
|
+
text: a({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: r(1) }),
|
|
1338
|
+
name: a({
|
|
1339
|
+
...qe,
|
|
1340
|
+
fontFamily: o.fontSecondary,
|
|
1341
|
+
fontWeight: 600,
|
|
1342
|
+
fontSize: "0.85em",
|
|
1343
|
+
color: o.text,
|
|
1344
|
+
unicodeBidi: "plaintext"
|
|
1345
|
+
}),
|
|
1346
|
+
meta: a({ ...qe, fontFamily: o.fontSecondary, fontSize: "0.7em", color: o.muted }),
|
|
1347
|
+
follow: a({ ...Xe, color: o.accentFg, "&:hover": { backgroundColor: P(o.accent, 10) } }),
|
|
1348
|
+
following: a({
|
|
1349
|
+
...Xe,
|
|
1350
|
+
backgroundColor: P(o.success, 14),
|
|
1351
|
+
borderColor: P(o.success, 45),
|
|
1352
|
+
color: o.success
|
|
1353
|
+
})
|
|
1354
|
+
}, me = {
|
|
1355
|
+
scroll: a({
|
|
1356
|
+
maxHeight: r(272),
|
|
1357
|
+
overflowY: "auto",
|
|
1358
|
+
overscrollBehavior: "contain"
|
|
1359
|
+
}),
|
|
1360
|
+
footer: a({
|
|
1361
|
+
display: "flex",
|
|
1362
|
+
alignItems: "center",
|
|
1363
|
+
justifyContent: "space-between",
|
|
1364
|
+
flexWrap: "wrap",
|
|
1365
|
+
gap: r(8),
|
|
1366
|
+
padding: `${r(6)} ${r(8)} ${r(6)} ${r(14)}`,
|
|
1367
|
+
borderTop: `1px solid ${o.border}`
|
|
1368
|
+
}),
|
|
1369
|
+
count: a({ fontFamily: o.fontSecondary, fontSize: "0.72em", color: o.muted }),
|
|
1370
|
+
button: a({
|
|
1371
|
+
margin: 0,
|
|
1372
|
+
padding: `${r(6, 12.16)} ${r(12, 12.16)}`,
|
|
1373
|
+
border: "none",
|
|
1374
|
+
borderRadius: "999px",
|
|
1375
|
+
background: "transparent",
|
|
1376
|
+
cursor: "pointer",
|
|
1377
|
+
color: o.accentFg,
|
|
1378
|
+
fontFamily: o.fontSecondary,
|
|
1379
|
+
fontWeight: 600,
|
|
1380
|
+
fontSize: "0.76em",
|
|
1381
|
+
"&:hover:not(:disabled)": { backgroundColor: P(o.accent, 10) },
|
|
1382
|
+
"&:disabled": { cursor: "default", color: o.muted }
|
|
1383
|
+
})
|
|
1384
|
+
}, to = (e, t) => {
|
|
1385
|
+
const n = new Set(e.map(T));
|
|
1386
|
+
return [...e, ...t.filter((s) => !n.has(T(s)))];
|
|
1387
|
+
}, Je = (e, t) => {
|
|
1388
|
+
if (!e) return;
|
|
1389
|
+
const n = Array.from(e.querySelectorAll("button:not(:disabled)"));
|
|
1390
|
+
if (!n.length) return;
|
|
1391
|
+
const s = e.getRootNode().activeElement, c = n.indexOf(s);
|
|
1392
|
+
n[Math.max(0, Math.min(n.length - 1, c + t))].focus();
|
|
1393
|
+
}, no = ({ type: e, editor: t, followed: n, onToggle: s, onClose: c }) => {
|
|
1394
|
+
const { label: l, fmt: f } = F(), [m, p] = I(""), [u, y] = I({ status: "idle" }), S = de(null), h = de(null), g = de(null), z = he(), v = t.search;
|
|
1395
|
+
ce(() => {
|
|
1396
|
+
var B;
|
|
1397
|
+
(B = h.current) == null || B.abort();
|
|
1398
|
+
const x = m.trim();
|
|
1399
|
+
if (x.length < Zn) {
|
|
1400
|
+
y({ status: "idle" });
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
const C = new AbortController();
|
|
1404
|
+
y({ status: "loading" });
|
|
1405
|
+
const L = window.setTimeout(() => {
|
|
1406
|
+
v(x, e, C.signal).then(
|
|
1407
|
+
(A) => y({
|
|
1408
|
+
status: "done",
|
|
1409
|
+
query: x,
|
|
1410
|
+
results: A.results,
|
|
1411
|
+
total: A.total,
|
|
1412
|
+
next: A.next,
|
|
1413
|
+
more: "idle"
|
|
1414
|
+
})
|
|
1415
|
+
).catch(() => {
|
|
1416
|
+
C.signal.aborted || y({ status: "error" });
|
|
1417
|
+
});
|
|
1418
|
+
}, eo);
|
|
1419
|
+
return () => {
|
|
1420
|
+
window.clearTimeout(L), C.abort();
|
|
1421
|
+
};
|
|
1422
|
+
}, [m, e, v]), ce(() => () => {
|
|
1423
|
+
var x;
|
|
1424
|
+
return (x = h.current) == null ? void 0 : x.abort();
|
|
1425
|
+
}, []), ce(() => {
|
|
1426
|
+
var C, L;
|
|
1427
|
+
if (g.current === null || u.status !== "done") return;
|
|
1428
|
+
const x = (C = S.current) == null ? void 0 : C.querySelectorAll("li button");
|
|
1429
|
+
(L = x == null ? void 0 : x[Math.min(g.current, x.length - 1)]) == null || L.focus(), g.current = null;
|
|
1430
|
+
}, [u]);
|
|
1431
|
+
const $ = () => {
|
|
1432
|
+
if (u.status !== "done" || !u.next || u.more === "loading") return;
|
|
1433
|
+
const { query: x, next: C, results: L } = u, B = new AbortController();
|
|
1434
|
+
h.current = B, y({ ...u, more: "loading" }), v(x, e, B.signal, C).then((A) => {
|
|
1435
|
+
g.current = L.length, y(
|
|
1436
|
+
(Q) => Q.status === "done" && Q.query === x ? { ...Q, results: to(Q.results, A.results), next: A.next, more: "idle" } : Q
|
|
1437
|
+
);
|
|
1438
|
+
}).catch(() => {
|
|
1439
|
+
B.signal.aborted || y(
|
|
1440
|
+
(A) => A.status === "done" && A.query === x ? { ...A, more: "error" } : A
|
|
1441
|
+
);
|
|
1442
|
+
});
|
|
1443
|
+
}, j = (x) => {
|
|
1444
|
+
x.key === "Escape" ? (x.stopPropagation(), c()) : x.key === "ArrowDown" ? (x.preventDefault(), Je(S.current, 1)) : x.key === "ArrowUp" && x.target !== x.currentTarget && (x.preventDefault(), Je(S.current, -1));
|
|
1445
|
+
}, G = u.status === "idle" ? l("searchHint") : u.status === "loading" ? l("searching") : u.status === "done" && u.results.length === 0 ? l("noSearchResults", { query: u.query }) : null;
|
|
1446
|
+
return /* @__PURE__ */ d("div", { css: O.panel, role: "search", onKeyDown: j, children: [
|
|
1447
|
+
/* @__PURE__ */ d("div", { css: O.field, children: [
|
|
1448
|
+
/* @__PURE__ */ i(Qt, { size: "1.1em", "aria-hidden": "true" }),
|
|
1449
|
+
/* @__PURE__ */ i(
|
|
1450
|
+
"input",
|
|
1451
|
+
{
|
|
1452
|
+
css: O.input,
|
|
1453
|
+
type: "search",
|
|
1454
|
+
value: m,
|
|
1455
|
+
onChange: (x) => p(x.target.value),
|
|
1456
|
+
placeholder: l(Ke[e]),
|
|
1457
|
+
"aria-label": l(Ke[e]),
|
|
1458
|
+
"aria-describedby": z,
|
|
1459
|
+
autoComplete: "off",
|
|
1460
|
+
autoFocus: !0
|
|
1461
|
+
}
|
|
1462
|
+
),
|
|
1463
|
+
/* @__PURE__ */ i("button", { type: "button", css: O.close, "aria-label": l("closeSearch"), onClick: c, children: /* @__PURE__ */ i(pt, { size: "1.1em", "aria-hidden": "true" }) })
|
|
1464
|
+
] }),
|
|
1465
|
+
/* @__PURE__ */ i("div", { id: z, "aria-live": "polite", children: u.status === "error" ? /* @__PURE__ */ i("p", { css: O.error, children: l("searchFailed") }) : G && /* @__PURE__ */ i("p", { css: O.status, children: G }) }),
|
|
1466
|
+
u.status === "done" && u.results.length > 0 && /* @__PURE__ */ d("div", { ref: S, children: [
|
|
1467
|
+
/* @__PURE__ */ i("div", { css: me.scroll, children: /* @__PURE__ */ i("ul", { css: O.results, children: u.results.map((x) => {
|
|
1468
|
+
var B;
|
|
1469
|
+
const C = n.has(T(x)), L = ((B = x.entity) == null ? void 0 : B.name) ?? x.id;
|
|
1470
|
+
return /* @__PURE__ */ d("li", { css: O.row, children: [
|
|
1471
|
+
x.entity && /* @__PURE__ */ i(X, { entity: x.entity, size: 28 }),
|
|
1472
|
+
/* @__PURE__ */ d("span", { css: O.text, children: [
|
|
1473
|
+
/* @__PURE__ */ i("span", { css: O.name, children: L }),
|
|
1474
|
+
/* @__PURE__ */ i("span", { css: O.meta, children: $t(x, l) })
|
|
1475
|
+
] }),
|
|
1476
|
+
/* @__PURE__ */ d(
|
|
1477
|
+
"button",
|
|
1478
|
+
{
|
|
1479
|
+
type: "button",
|
|
1480
|
+
css: C ? O.following : O.follow,
|
|
1481
|
+
"aria-pressed": C,
|
|
1482
|
+
"aria-label": l("followName", { name: L }),
|
|
1483
|
+
onClick: () => s(x),
|
|
1484
|
+
children: [
|
|
1485
|
+
C && /* @__PURE__ */ i(Ut, { size: "1.1em", "aria-hidden": "true" }),
|
|
1486
|
+
l(C ? "following" : "follow")
|
|
1487
|
+
]
|
|
1488
|
+
}
|
|
1489
|
+
)
|
|
1490
|
+
] }, T(x));
|
|
1491
|
+
}) }) }),
|
|
1492
|
+
/* @__PURE__ */ d("div", { css: me.footer, children: [
|
|
1493
|
+
/* @__PURE__ */ i("span", { css: me.count, "aria-live": "polite", children: l("resultsCount", {
|
|
1494
|
+
shown: f.full(u.results.length),
|
|
1495
|
+
total: f.full(Math.max(u.total, u.results.length))
|
|
1496
|
+
}) }),
|
|
1497
|
+
u.next && /* @__PURE__ */ i(
|
|
1498
|
+
"button",
|
|
1499
|
+
{
|
|
1500
|
+
type: "button",
|
|
1501
|
+
css: me.button,
|
|
1502
|
+
disabled: u.more === "loading",
|
|
1503
|
+
"aria-busy": u.more === "loading",
|
|
1504
|
+
onClick: $,
|
|
1505
|
+
children: l(u.more === "loading" ? "loadingMore" : "loadMoreResults")
|
|
1506
|
+
}
|
|
1507
|
+
)
|
|
1508
|
+
] }),
|
|
1509
|
+
u.more === "error" && /* @__PURE__ */ i("p", { css: O.error, children: l("loadMoreFailed") })
|
|
1510
|
+
] })
|
|
1511
|
+
] });
|
|
1512
|
+
}, Ie = {
|
|
1513
|
+
flex: "none",
|
|
1514
|
+
display: "inline-flex",
|
|
1515
|
+
alignItems: "center",
|
|
1516
|
+
justifyContent: "center",
|
|
1517
|
+
width: r(26),
|
|
1518
|
+
height: r(26),
|
|
1519
|
+
margin: 0,
|
|
1520
|
+
padding: 0,
|
|
1521
|
+
border: "none",
|
|
1522
|
+
borderRadius: "50%",
|
|
1523
|
+
background: "transparent",
|
|
1524
|
+
cursor: "pointer",
|
|
1525
|
+
fontSize: "1em",
|
|
1526
|
+
transition: "background-color .15s, color .15s"
|
|
1527
|
+
}, _ = {
|
|
1528
|
+
block: a({ display: "flex", flexDirection: "column", gap: r(8) }),
|
|
1529
|
+
chips: a({
|
|
1530
|
+
listStyle: "none",
|
|
1531
|
+
margin: 0,
|
|
1532
|
+
padding: 0,
|
|
1533
|
+
display: "flex",
|
|
1534
|
+
flexWrap: "wrap",
|
|
1535
|
+
gap: r(8)
|
|
1536
|
+
}),
|
|
1537
|
+
chip: a({
|
|
1538
|
+
boxSizing: "border-box",
|
|
1539
|
+
display: "inline-flex",
|
|
1540
|
+
alignItems: "center",
|
|
1541
|
+
gap: r(4),
|
|
1542
|
+
maxWidth: "100%",
|
|
1543
|
+
minHeight: r(34),
|
|
1544
|
+
padding: `${r(4)} ${r(4)} ${r(4)} ${r(4)}`,
|
|
1545
|
+
border: `1px solid ${o.border}`,
|
|
1546
|
+
borderRadius: "999px",
|
|
1547
|
+
backgroundColor: o.card
|
|
1548
|
+
}),
|
|
1549
|
+
chipSport: a({
|
|
1550
|
+
boxSizing: "border-box",
|
|
1551
|
+
display: "inline-flex",
|
|
1552
|
+
alignItems: "center",
|
|
1553
|
+
gap: r(4),
|
|
1554
|
+
maxWidth: "100%",
|
|
1555
|
+
minHeight: r(34),
|
|
1556
|
+
padding: `${r(4)} ${r(4)} ${r(4)} ${r(13)}`,
|
|
1557
|
+
border: `1px solid ${o.border}`,
|
|
1558
|
+
borderRadius: "999px",
|
|
1559
|
+
backgroundColor: o.card
|
|
1560
|
+
}),
|
|
1561
|
+
name: a({
|
|
1562
|
+
minWidth: 0,
|
|
1563
|
+
paddingInline: `${r(3, 12.8)} ${r(2, 12.8)}`,
|
|
1564
|
+
whiteSpace: "nowrap",
|
|
1565
|
+
overflow: "hidden",
|
|
1566
|
+
textOverflow: "ellipsis",
|
|
1567
|
+
fontFamily: o.fontSecondary,
|
|
1568
|
+
fontWeight: 500,
|
|
1569
|
+
fontSize: "0.8em",
|
|
1570
|
+
color: o.text,
|
|
1571
|
+
unicodeBidi: "plaintext"
|
|
1572
|
+
}),
|
|
1573
|
+
starOn: a({ ...Ie, color: o.accent, "&:hover": { backgroundColor: P(o.accent, 12) } }),
|
|
1574
|
+
starOff: a({
|
|
1575
|
+
...Ie,
|
|
1576
|
+
color: o.muted,
|
|
1577
|
+
"&:hover": { backgroundColor: P(o.accent, 12), color: o.accent }
|
|
1578
|
+
}),
|
|
1579
|
+
remove: a({
|
|
1580
|
+
...Ie,
|
|
1581
|
+
color: o.muted,
|
|
1582
|
+
"&:hover": { backgroundColor: P(o.danger, 12), color: o.danger }
|
|
1583
|
+
}),
|
|
1584
|
+
add: a({
|
|
1585
|
+
boxSizing: "border-box",
|
|
1586
|
+
display: "inline-flex",
|
|
1587
|
+
alignItems: "center",
|
|
1588
|
+
gap: r(4, 12.16),
|
|
1589
|
+
minHeight: r(34, 12.16),
|
|
1590
|
+
margin: 0,
|
|
1591
|
+
padding: `${r(4, 12.16)} ${r(12, 12.16)} ${r(4, 12.16)} ${r(9, 12.16)}`,
|
|
1592
|
+
border: `1px dashed ${o.accent}`,
|
|
1593
|
+
borderRadius: "999px",
|
|
1594
|
+
background: "transparent",
|
|
1595
|
+
cursor: "pointer",
|
|
1596
|
+
color: o.accentFg,
|
|
1597
|
+
fontFamily: o.fontSecondary,
|
|
1598
|
+
fontWeight: 600,
|
|
1599
|
+
fontSize: "0.76em",
|
|
1600
|
+
"&:hover": { backgroundColor: P(o.accent, 8) }
|
|
1601
|
+
}),
|
|
1602
|
+
undoRow: a({
|
|
1603
|
+
display: "flex",
|
|
1604
|
+
alignItems: "center",
|
|
1605
|
+
flexWrap: "wrap",
|
|
1606
|
+
gap: r(6, 12.8),
|
|
1607
|
+
margin: 0,
|
|
1608
|
+
fontFamily: o.fontSecondary,
|
|
1609
|
+
fontSize: "0.8em",
|
|
1610
|
+
color: o.muted
|
|
1611
|
+
}),
|
|
1612
|
+
undo: a({
|
|
1613
|
+
margin: 0,
|
|
1614
|
+
padding: 0,
|
|
1615
|
+
border: "none",
|
|
1616
|
+
background: "transparent",
|
|
1617
|
+
cursor: "pointer",
|
|
1618
|
+
fontFamily: "inherit",
|
|
1619
|
+
fontSize: "1em",
|
|
1620
|
+
fontWeight: 600,
|
|
1621
|
+
color: o.accentFg,
|
|
1622
|
+
textDecoration: "underline",
|
|
1623
|
+
textUnderlineOffset: "0.15em"
|
|
1624
|
+
})
|
|
1625
|
+
}, oo = {
|
|
1626
|
+
team: "teams",
|
|
1627
|
+
player: "players",
|
|
1628
|
+
competition: "competitions",
|
|
1629
|
+
sport: "sports"
|
|
1630
|
+
}, io = ({ interest: e, onFavourite: t, onRemove: n }) => {
|
|
1631
|
+
const { label: s, language: c } = F(), l = Se(e, s, c);
|
|
1632
|
+
return /* @__PURE__ */ d("li", { css: e.entity ? _.chip : _.chipSport, children: [
|
|
1633
|
+
e.entity && /* @__PURE__ */ i(X, { entity: e.entity, size: 24 }),
|
|
1634
|
+
/* @__PURE__ */ i("span", { css: _.name, children: l }),
|
|
1635
|
+
/* @__PURE__ */ i(
|
|
1636
|
+
"button",
|
|
1637
|
+
{
|
|
1638
|
+
type: "button",
|
|
1639
|
+
css: e.favourite ? _.starOn : _.starOff,
|
|
1640
|
+
"aria-pressed": e.favourite,
|
|
1641
|
+
"aria-label": s("markFavourite", { name: l }),
|
|
1642
|
+
onClick: t,
|
|
1643
|
+
children: /* @__PURE__ */ i(Vt, { size: "1.05em", "aria-hidden": "true" })
|
|
1644
|
+
}
|
|
1645
|
+
),
|
|
1646
|
+
/* @__PURE__ */ i(
|
|
1647
|
+
"button",
|
|
1648
|
+
{
|
|
1649
|
+
type: "button",
|
|
1650
|
+
css: _.remove,
|
|
1651
|
+
"aria-label": s("removeInterest", { name: l }),
|
|
1652
|
+
onClick: n,
|
|
1653
|
+
children: /* @__PURE__ */ i(pt, { size: "1em", "aria-hidden": "true" })
|
|
1654
|
+
}
|
|
1655
|
+
)
|
|
1656
|
+
] });
|
|
1657
|
+
}, ro = ({ type: e, items: t, editor: n, followed: s, searching: c, onSearch: l, onToggle: f, onFavourite: m, onRemove: p }) => {
|
|
1658
|
+
const { label: u } = F(), y = de(null), S = de(c);
|
|
1659
|
+
return ce(() => {
|
|
1660
|
+
var h;
|
|
1661
|
+
S.current && !c && ((h = y.current) == null || h.focus()), S.current = c;
|
|
1662
|
+
}, [c]), /* @__PURE__ */ d("div", { css: _.block, children: [
|
|
1663
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: u("groupCount", { label: u(oo[e]), count: t.length }) }),
|
|
1664
|
+
/* @__PURE__ */ d("ul", { css: _.chips, children: [
|
|
1665
|
+
t.map((h) => /* @__PURE__ */ i(
|
|
1666
|
+
io,
|
|
1667
|
+
{
|
|
1668
|
+
interest: h,
|
|
1669
|
+
onFavourite: () => m(h),
|
|
1670
|
+
onRemove: () => p(h)
|
|
1671
|
+
},
|
|
1672
|
+
T(h)
|
|
1673
|
+
)),
|
|
1674
|
+
Pe(e) && !c && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ d(
|
|
1675
|
+
"button",
|
|
1676
|
+
{
|
|
1677
|
+
type: "button",
|
|
1678
|
+
ref: y,
|
|
1679
|
+
css: _.add,
|
|
1680
|
+
onClick: () => l(e),
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ i(ut, { size: "1.25em", "aria-hidden": "true" }),
|
|
1683
|
+
u(Jn[e])
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1686
|
+
) })
|
|
1687
|
+
] }),
|
|
1688
|
+
Pe(e) && c && /* @__PURE__ */ i(
|
|
1689
|
+
no,
|
|
1690
|
+
{
|
|
1691
|
+
type: e,
|
|
1692
|
+
editor: n,
|
|
1693
|
+
followed: s,
|
|
1694
|
+
onToggle: f,
|
|
1695
|
+
onClose: () => l(null)
|
|
1696
|
+
}
|
|
1697
|
+
)
|
|
1698
|
+
] });
|
|
1699
|
+
}, so = ({ draft: e, editor: t, onChange: n }) => {
|
|
1700
|
+
const { label: s, language: c } = F(), [l, f] = I(null), [m, p] = I(null), u = q(() => new Set(e.map(T)), [e]), y = (v) => {
|
|
1701
|
+
const $ = e.findIndex((j) => T(j) === T(v));
|
|
1702
|
+
$ < 0 || (n(e.filter((j, G) => G !== $)), p({ interest: v, index: $ }));
|
|
1703
|
+
}, S = () => {
|
|
1704
|
+
if (!m) return;
|
|
1705
|
+
const v = e.slice();
|
|
1706
|
+
v.splice(Math.min(m.index, v.length), 0, m.interest), n(v), p(null);
|
|
1707
|
+
}, h = (v) => n(
|
|
1708
|
+
e.map(
|
|
1709
|
+
($) => T($) === T(v) ? { ...$, favourite: !$.favourite } : $
|
|
1710
|
+
)
|
|
1711
|
+
), g = (v) => {
|
|
1712
|
+
u.has(T(v)) ? n(e.filter(($) => T($) !== T(v))) : n([...e, v]);
|
|
1713
|
+
}, z = Ct.map((v) => ({
|
|
1714
|
+
type: v,
|
|
1715
|
+
items: e.filter(($) => $.type === v)
|
|
1716
|
+
})).filter((v) => Pe(v.type) || v.items.length > 0);
|
|
1717
|
+
return /* @__PURE__ */ d(fe, { children: [
|
|
1718
|
+
z.map((v) => /* @__PURE__ */ i(
|
|
1719
|
+
ro,
|
|
1720
|
+
{
|
|
1721
|
+
type: v.type,
|
|
1722
|
+
items: v.items,
|
|
1723
|
+
editor: t,
|
|
1724
|
+
followed: u,
|
|
1725
|
+
searching: l === v.type,
|
|
1726
|
+
onSearch: f,
|
|
1727
|
+
onToggle: g,
|
|
1728
|
+
onFavourite: h,
|
|
1729
|
+
onRemove: y
|
|
1730
|
+
},
|
|
1731
|
+
v.type
|
|
1732
|
+
)),
|
|
1733
|
+
/* @__PURE__ */ i("div", { "aria-live": "polite", children: m && /* @__PURE__ */ d("p", { css: _.undoRow, children: [
|
|
1734
|
+
s("interestRemoved", { name: Se(m.interest, s, c) }),
|
|
1735
|
+
/* @__PURE__ */ i("button", { type: "button", css: _.undo, onClick: S, children: s("undo") })
|
|
1736
|
+
] }) })
|
|
1737
|
+
] });
|
|
1738
|
+
}, Re = {
|
|
1739
|
+
display: "inline-flex",
|
|
1740
|
+
alignItems: "center",
|
|
1741
|
+
margin: 0,
|
|
1742
|
+
border: "none",
|
|
1743
|
+
borderRadius: "999px",
|
|
1744
|
+
background: "transparent",
|
|
1745
|
+
cursor: "pointer",
|
|
1746
|
+
fontFamily: o.fontSecondary,
|
|
1747
|
+
fontWeight: 600,
|
|
1748
|
+
fontSize: "0.76em",
|
|
1749
|
+
whiteSpace: "nowrap",
|
|
1750
|
+
transition: "background-color .15s, color .15s",
|
|
1751
|
+
"&:disabled": { cursor: "default", opacity: 0.6 }
|
|
1752
|
+
}, M = {
|
|
1753
|
+
block: a({ display: "flex", flexDirection: "column", gap: r(8) }),
|
|
1754
|
+
favourites: a({
|
|
1755
|
+
listStyle: "none",
|
|
1756
|
+
margin: 0,
|
|
1757
|
+
padding: 0,
|
|
1758
|
+
display: "grid",
|
|
1759
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(${r(120)}, 1fr))`,
|
|
1760
|
+
gap: r(10)
|
|
1761
|
+
}),
|
|
1762
|
+
chips: a({
|
|
1763
|
+
listStyle: "none",
|
|
1764
|
+
margin: 0,
|
|
1765
|
+
padding: 0,
|
|
1766
|
+
display: "flex",
|
|
1767
|
+
flexWrap: "wrap",
|
|
1768
|
+
gap: r(8)
|
|
1769
|
+
}),
|
|
1770
|
+
empty: a({ margin: 0, fontFamily: o.fontSecondary, fontSize: "0.8em", color: o.muted }),
|
|
1771
|
+
emptyBlock: a({ display: "flex", flexDirection: "column", alignItems: "flex-start", gap: r(10) }),
|
|
1772
|
+
actions: a({ display: "flex", alignItems: "center", flexWrap: "wrap", gap: r(8) }),
|
|
1773
|
+
edit: a({
|
|
1774
|
+
...Re,
|
|
1775
|
+
gap: r(5, 12.16),
|
|
1776
|
+
padding: `${r(6, 12.16)} ${r(12, 12.16)} ${r(6, 12.16)} ${r(10, 12.16)}`,
|
|
1777
|
+
border: `1px solid ${o.border}`,
|
|
1778
|
+
color: o.accentFg,
|
|
1779
|
+
"&:hover": { backgroundColor: P(o.accent, 8) }
|
|
1780
|
+
}),
|
|
1781
|
+
cancel: a({
|
|
1782
|
+
...Re,
|
|
1783
|
+
padding: `${r(6, 12.16)} ${r(10, 12.16)}`,
|
|
1784
|
+
color: o.muted,
|
|
1785
|
+
"&:hover:not(:disabled)": { color: o.text }
|
|
1786
|
+
}),
|
|
1787
|
+
save: a({
|
|
1788
|
+
...Re,
|
|
1789
|
+
padding: `${r(6, 12.16)} ${r(16, 12.16)}`,
|
|
1790
|
+
backgroundColor: o.accent,
|
|
1791
|
+
color: "#fff",
|
|
1792
|
+
"&:hover:not(:disabled)": { backgroundColor: `color-mix(in srgb, ${o.accent} 86%, #000)` }
|
|
1793
|
+
})
|
|
1794
|
+
}, ao = { open: !1, variant: "error", title: "", message: "" }, lo = {
|
|
1795
|
+
team: "teams",
|
|
1796
|
+
player: "players",
|
|
1797
|
+
competition: "competitions",
|
|
1798
|
+
sport: "sports"
|
|
1799
|
+
}, co = ({
|
|
1800
|
+
type: e,
|
|
1801
|
+
items: t
|
|
1802
|
+
}) => {
|
|
1803
|
+
const { label: n } = F(), [s, c] = I(!1), l = he(), f = s ? t : t.slice(0, ke);
|
|
1804
|
+
return /* @__PURE__ */ d("div", { css: M.block, children: [
|
|
1805
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: n("groupCount", { label: n(lo[e]), count: t.length }) }),
|
|
1806
|
+
/* @__PURE__ */ d("ul", { id: l, css: M.chips, children: [
|
|
1807
|
+
f.map((m) => /* @__PURE__ */ i(qn, { interest: m }, `${m.type}:${m.id}`)),
|
|
1808
|
+
t.length > ke && /* @__PURE__ */ i(
|
|
1809
|
+
Xn,
|
|
1810
|
+
{
|
|
1811
|
+
open: s,
|
|
1812
|
+
hidden: t.length - ke,
|
|
1813
|
+
controls: l,
|
|
1814
|
+
onToggle: () => c((m) => !m)
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
] })
|
|
1818
|
+
] });
|
|
1819
|
+
}, po = ({ interests: e, editor: t }) => {
|
|
1820
|
+
const { label: n, language: s } = F(), c = q(() => _n(e), [e]), [l, f] = I("all"), m = c.includes(l) ? l : "all", { total: p, favourites: u, groups: y } = q(
|
|
1821
|
+
() => Hn(e, m),
|
|
1822
|
+
[e, m]
|
|
1823
|
+
), [S, h] = I(null), [g, z] = I(!1), [v, $] = I(ao), j = () => h(e), G = async () => {
|
|
1824
|
+
if (!(!t || !S)) {
|
|
1825
|
+
z(!0);
|
|
1826
|
+
try {
|
|
1827
|
+
await t.save(e, S), h(null);
|
|
1828
|
+
} catch (C) {
|
|
1829
|
+
$({
|
|
1830
|
+
open: !0,
|
|
1831
|
+
variant: "error",
|
|
1832
|
+
title: n("saveFailed"),
|
|
1833
|
+
message: n(ft(C) ? "saveUnauthorized" : "saveFailedMessage")
|
|
1834
|
+
});
|
|
1835
|
+
} finally {
|
|
1836
|
+
z(!1);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}, x = t && S;
|
|
1840
|
+
return /* @__PURE__ */ d(ee, { label: n("interests"), children: [
|
|
1841
|
+
/* @__PURE__ */ i(
|
|
1842
|
+
Wt,
|
|
1843
|
+
{
|
|
1844
|
+
notification: v,
|
|
1845
|
+
onClose: () => $((C) => ({ ...C, open: !1 }))
|
|
1846
|
+
}
|
|
1847
|
+
),
|
|
1848
|
+
/* @__PURE__ */ d(Ae, { children: [
|
|
1849
|
+
/* @__PURE__ */ d("h3", { css: b.title, children: [
|
|
1850
|
+
n("interests"),
|
|
1851
|
+
" ",
|
|
1852
|
+
/* @__PURE__ */ i("span", { css: b.titleMeta, children: n("followedCount", { count: x ? S.length : p }) })
|
|
1853
|
+
] }),
|
|
1854
|
+
x ? /* @__PURE__ */ d("span", { css: M.actions, children: [
|
|
1855
|
+
/* @__PURE__ */ i("button", { type: "button", css: M.cancel, disabled: g, onClick: () => h(null), children: n("cancelEdit") }),
|
|
1856
|
+
/* @__PURE__ */ i(
|
|
1857
|
+
"button",
|
|
1858
|
+
{
|
|
1859
|
+
type: "button",
|
|
1860
|
+
css: M.save,
|
|
1861
|
+
disabled: g,
|
|
1862
|
+
"aria-busy": g,
|
|
1863
|
+
onClick: G,
|
|
1864
|
+
children: n(g ? "savingInterests" : "saveInterests")
|
|
1865
|
+
}
|
|
1866
|
+
)
|
|
1867
|
+
] }) : (c.length > 1 || t && e.length > 0) && /* @__PURE__ */ d("span", { css: M.actions, children: [
|
|
1868
|
+
c.length > 1 && /* @__PURE__ */ i(
|
|
1869
|
+
xe,
|
|
1870
|
+
{
|
|
1871
|
+
label: n("sportFilter"),
|
|
1872
|
+
value: m,
|
|
1873
|
+
onChange: f,
|
|
1874
|
+
options: [
|
|
1875
|
+
{ key: "all", label: n("allSports") },
|
|
1876
|
+
...c.map((C) => ({
|
|
1877
|
+
key: C,
|
|
1878
|
+
label: wt(C, n, s)
|
|
1879
|
+
}))
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
),
|
|
1883
|
+
t && e.length > 0 && /* @__PURE__ */ d(
|
|
1884
|
+
"button",
|
|
1885
|
+
{
|
|
1886
|
+
type: "button",
|
|
1887
|
+
css: M.edit,
|
|
1888
|
+
"aria-label": n("editInterestsLabel"),
|
|
1889
|
+
onClick: j,
|
|
1890
|
+
children: [
|
|
1891
|
+
/* @__PURE__ */ i(Yt, { size: "1.2em", "aria-hidden": "true" }),
|
|
1892
|
+
n("editInterests")
|
|
1893
|
+
]
|
|
1894
|
+
}
|
|
1895
|
+
)
|
|
1896
|
+
] })
|
|
1897
|
+
] }),
|
|
1898
|
+
x ? /* @__PURE__ */ i(so, { draft: S, editor: t, onChange: h }) : /* @__PURE__ */ d(fe, { children: [
|
|
1899
|
+
p === 0 && (t ? /* @__PURE__ */ d("div", { css: M.emptyBlock, children: [
|
|
1900
|
+
/* @__PURE__ */ i("p", { css: M.empty, children: n("addInterestsHint") }),
|
|
1901
|
+
/* @__PURE__ */ d("button", { type: "button", css: M.edit, onClick: j, children: [
|
|
1902
|
+
/* @__PURE__ */ i(ut, { size: "1.2em", "aria-hidden": "true" }),
|
|
1903
|
+
n("addInterests")
|
|
1904
|
+
] })
|
|
1905
|
+
] }) : /* @__PURE__ */ i("p", { css: M.empty, children: n("noInterests") })),
|
|
1906
|
+
u.length > 0 && /* @__PURE__ */ d("div", { css: M.block, children: [
|
|
1907
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: n("groupCount", { label: n("favourites"), count: u.length }) }),
|
|
1908
|
+
/* @__PURE__ */ i("ul", { css: M.favourites, children: u.map((C) => /* @__PURE__ */ i(Kn, { interest: C }, `${C.type}:${C.id}`)) })
|
|
1909
|
+
] }),
|
|
1910
|
+
y.map((C) => (
|
|
1911
|
+
// Keyed by sport too, so "+N more" closes when the filter changes.
|
|
1912
|
+
/* @__PURE__ */ i(co, { type: C.type, items: C.items }, `${m}:${C.type}`)
|
|
1913
|
+
))
|
|
1914
|
+
] })
|
|
1915
|
+
] });
|
|
1916
|
+
}, uo = /* @__PURE__ */ new Set([
|
|
1917
|
+
"FT_1X2",
|
|
1918
|
+
"HT_1X2",
|
|
1919
|
+
"DOUBLE_CHANCE",
|
|
1920
|
+
"BOTH_TEAMS_SCORE",
|
|
1921
|
+
"CORRECT_SCORE",
|
|
1922
|
+
"CORRECT_SCORE_ADVANCED",
|
|
1923
|
+
"CORRECT_SCORE_HT",
|
|
1924
|
+
"HT_FT",
|
|
1925
|
+
"CORNERS_MATCH",
|
|
1926
|
+
"RED_CARD_MATCH",
|
|
1927
|
+
"PENALTY_MATCH",
|
|
1928
|
+
"PLAYER_SCORE",
|
|
1929
|
+
"PLAYER_SCORE_FIRST_GOAL",
|
|
1930
|
+
"PLAYER_SCORE_TWICE",
|
|
1931
|
+
"PLAYER_SCORE_HATTRICK",
|
|
1932
|
+
"PLAYER_YELLOW_CARD",
|
|
1933
|
+
"PLAYER_RED_CARD"
|
|
1934
|
+
]), It = /^OVER_(GOALS|CORNERS)_(\d+)_(\d+)$/, mo = /* @__PURE__ */ new Set(["BOTH_TEAMS_SCORE"]), fo = /\s*\([^)]*\)\s*$/, ho = (e, t) => {
|
|
1935
|
+
const n = t(`betslip.markets.${e}`);
|
|
1936
|
+
if (n) return mo.has(e) && n.replace(fo, "") || n;
|
|
1937
|
+
const s = It.exec(e);
|
|
1938
|
+
if (s) {
|
|
1939
|
+
const c = s[1] === "GOALS" ? "betslip.markets.overGoals" : "betslip.markets.overCorners", l = t(c, { line: `${s[2]}.${s[3]}` });
|
|
1940
|
+
if (l) return l;
|
|
1941
|
+
}
|
|
1942
|
+
return e.toLowerCase().split("_").map((c) => c.charAt(0).toUpperCase() + c.slice(1)).join(" ");
|
|
1943
|
+
}, go = (e, t) => {
|
|
1944
|
+
if (uo.has(e)) return t(`market${e}`);
|
|
1945
|
+
const n = It.exec(e);
|
|
1946
|
+
if (!n) return null;
|
|
1947
|
+
const s = Number(n[2]) + 1;
|
|
1948
|
+
return t(n[1] === "GOALS" ? "marketOverGoals" : "marketOverCorners", { count: s });
|
|
1949
|
+
}, se = {
|
|
1950
|
+
list: a(bt, {
|
|
1951
|
+
listStyle: "none",
|
|
1952
|
+
margin: 0,
|
|
1953
|
+
paddingBlock: 0,
|
|
1954
|
+
paddingInlineStart: 0,
|
|
1955
|
+
display: "flex",
|
|
1956
|
+
flexDirection: "column",
|
|
1957
|
+
gap: r(11),
|
|
1958
|
+
maxHeight: r(300)
|
|
1959
|
+
}),
|
|
1960
|
+
markets: a({
|
|
1961
|
+
listStyle: "none",
|
|
1962
|
+
margin: 0,
|
|
1963
|
+
padding: 0,
|
|
1964
|
+
display: "flex",
|
|
1965
|
+
flexDirection: "column",
|
|
1966
|
+
gap: r(11)
|
|
1967
|
+
}),
|
|
1968
|
+
row: a({ display: "flex", alignItems: "center", gap: r(12) }),
|
|
1969
|
+
body: a({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: r(5) }),
|
|
1970
|
+
line: a({ display: "flex", alignItems: "center", justifyContent: "space-between", gap: r(8) })
|
|
1971
|
+
}, Ze = ({ name: e, rate: t }) => /* @__PURE__ */ d(fe, { children: [
|
|
1972
|
+
/* @__PURE__ */ d("span", { css: se.line, children: [
|
|
1973
|
+
/* @__PURE__ */ i("span", { css: b.rowName, children: e }),
|
|
1974
|
+
/* @__PURE__ */ d("span", { css: b.rowFigure, children: [
|
|
1975
|
+
t,
|
|
1976
|
+
"%"
|
|
1977
|
+
] })
|
|
1978
|
+
] }),
|
|
1979
|
+
/* @__PURE__ */ i(be, { value: t, color: St(t) })
|
|
1980
|
+
] }), yo = ["competitions", "teams", "markets"], bo = ({ rates: e }) => {
|
|
1981
|
+
const { label: t, lookup: n } = F(), s = yo.filter((p) => e[p].length > 0), [c, l] = I("competitions");
|
|
1982
|
+
if (!s.length) return null;
|
|
1983
|
+
const f = s.includes(c) ? c : s[0], m = s.map((p) => ({ key: p, label: t(p) }));
|
|
1984
|
+
return /* @__PURE__ */ d(ee, { label: t("successRates"), children: [
|
|
1985
|
+
/* @__PURE__ */ d(Ae, { children: [
|
|
1986
|
+
/* @__PURE__ */ i("h3", { css: b.title, children: t("successRates") }),
|
|
1987
|
+
/* @__PURE__ */ i(xe, { label: t("successRates"), options: m, value: f, onChange: l })
|
|
1988
|
+
] }),
|
|
1989
|
+
f === "markets" ? /* @__PURE__ */ i("ul", { css: se.markets, children: e.markets.map((p) => {
|
|
1990
|
+
const u = p.market ?? p.id, y = go(u, t);
|
|
1991
|
+
return /* @__PURE__ */ d("li", { css: se.body, children: [
|
|
1992
|
+
/* @__PURE__ */ i(Ze, { name: ho(u, n), rate: p.rate }),
|
|
1993
|
+
y && /* @__PURE__ */ i("span", { css: b.muted, children: y })
|
|
1994
|
+
] }, p.id);
|
|
1995
|
+
}) }) : /* @__PURE__ */ i("ul", { css: se.list, children: e[f].map((p) => {
|
|
1996
|
+
var u;
|
|
1997
|
+
return /* @__PURE__ */ d("li", { css: se.row, children: [
|
|
1998
|
+
p.entity && /* @__PURE__ */ i(X, { entity: p.entity, size: 32 }),
|
|
1999
|
+
/* @__PURE__ */ i("span", { css: se.body, children: /* @__PURE__ */ i(Ze, { name: ((u = p.entity) == null ? void 0 : u.name) ?? p.id, rate: p.rate }) })
|
|
2000
|
+
] }, p.id);
|
|
2001
|
+
}) })
|
|
2002
|
+
] });
|
|
2003
|
+
}, R = {
|
|
2004
|
+
root: a({
|
|
2005
|
+
display: "flex",
|
|
2006
|
+
flexDirection: "column",
|
|
2007
|
+
gap: r(14),
|
|
2008
|
+
paddingTop: r(13),
|
|
2009
|
+
borderTop: `1px solid ${o.border}`
|
|
2010
|
+
}),
|
|
2011
|
+
// The class's display would otherwise beat the `hidden` attribute.
|
|
2012
|
+
panel: a({ display: "flex", flexDirection: "column", gap: r(14), "&[hidden]": { display: "none" } }),
|
|
2013
|
+
controls: a({ display: "flex", flexDirection: "column", gap: r(10) }),
|
|
2014
|
+
list: a(bt, {
|
|
2015
|
+
listStyle: "none",
|
|
2016
|
+
margin: 0,
|
|
2017
|
+
paddingBlock: 0,
|
|
2018
|
+
paddingInlineStart: 0,
|
|
2019
|
+
display: "flex",
|
|
2020
|
+
flexDirection: "column",
|
|
2021
|
+
gap: r(13),
|
|
2022
|
+
maxHeight: r(320)
|
|
2023
|
+
}),
|
|
2024
|
+
row: a({ display: "flex", alignItems: "center", gap: r(12) }),
|
|
2025
|
+
body: a({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: r(5) }),
|
|
2026
|
+
line: a({ display: "flex", alignItems: "center", justifyContent: "space-between", gap: r(8) }),
|
|
2027
|
+
match: a({ display: "flex", alignItems: "center", gap: r(6), minWidth: 0 }),
|
|
2028
|
+
team: a({
|
|
2029
|
+
minWidth: 0,
|
|
2030
|
+
flex: "0 1 auto",
|
|
2031
|
+
fontFamily: o.fontSecondary,
|
|
2032
|
+
fontWeight: 500,
|
|
2033
|
+
fontSize: "0.82em",
|
|
2034
|
+
color: o.text,
|
|
2035
|
+
whiteSpace: "nowrap",
|
|
2036
|
+
overflow: "hidden",
|
|
2037
|
+
textOverflow: "ellipsis",
|
|
2038
|
+
unicodeBidi: "plaintext"
|
|
2039
|
+
}),
|
|
2040
|
+
dash: a({ flex: "none", fontFamily: o.fontSecondary, fontSize: "0.7em", color: o.muted }),
|
|
2041
|
+
figures: a({ flex: "none", display: "flex", alignItems: "baseline", gap: r(8) }),
|
|
2042
|
+
rate: a({
|
|
2043
|
+
width: r(38, 13.6),
|
|
2044
|
+
textAlign: "end",
|
|
2045
|
+
fontFamily: o.fontPrimary,
|
|
2046
|
+
fontWeight: 700,
|
|
2047
|
+
fontSize: "0.85em",
|
|
2048
|
+
color: o.text
|
|
2049
|
+
}),
|
|
2050
|
+
caption: a({
|
|
2051
|
+
fontFamily: o.fontSecondary,
|
|
2052
|
+
fontSize: "0.7em",
|
|
2053
|
+
color: o.muted,
|
|
2054
|
+
cursor: "help"
|
|
2055
|
+
}),
|
|
2056
|
+
totals: a({
|
|
2057
|
+
display: "flex",
|
|
2058
|
+
gap: r(10),
|
|
2059
|
+
paddingTop: r(12),
|
|
2060
|
+
borderTop: `1px solid ${o.border}`
|
|
2061
|
+
}),
|
|
2062
|
+
total: a({ flex: 1, minWidth: 0 })
|
|
2063
|
+
}, xo = ["competitions", "teams", "matches", "players"], So = ({ home: e, away: t }) => /* @__PURE__ */ d("span", { css: R.match, children: [
|
|
2064
|
+
/* @__PURE__ */ i("span", { css: R.team, children: e.name }),
|
|
2065
|
+
/* @__PURE__ */ i(X, { entity: e, size: 22 }),
|
|
2066
|
+
/* @__PURE__ */ i("span", { css: R.dash, "aria-hidden": "true", children: "–" }),
|
|
2067
|
+
/* @__PURE__ */ i(X, { entity: t, size: 22 }),
|
|
2068
|
+
/* @__PURE__ */ i("span", { css: R.team, children: t.name })
|
|
2069
|
+
] }), vo = ({ row: e }) => {
|
|
2070
|
+
var l;
|
|
2071
|
+
const { label: t, fmt: n } = F(), s = le(e.correct, e.made), c = !e.entity && e.home && e.away;
|
|
2072
|
+
return /* @__PURE__ */ d("li", { css: R.row, children: [
|
|
2073
|
+
e.entity && /* @__PURE__ */ i(X, { entity: e.entity, size: 32 }),
|
|
2074
|
+
/* @__PURE__ */ d("span", { css: R.body, children: [
|
|
2075
|
+
/* @__PURE__ */ d("span", { css: R.line, children: [
|
|
2076
|
+
c && e.home && e.away ? /* @__PURE__ */ i(So, { home: e.home, away: e.away }) : /* @__PURE__ */ i("span", { css: b.rowName, children: ((l = e.entity) == null ? void 0 : l.name) ?? e.id }),
|
|
2077
|
+
/* @__PURE__ */ d("span", { css: R.figures, children: [
|
|
2078
|
+
/* @__PURE__ */ i(E, { value: e.points, css: b.rowPoints }),
|
|
2079
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("pts") }),
|
|
2080
|
+
/* @__PURE__ */ d("span", { css: R.rate, children: [
|
|
2081
|
+
s,
|
|
2082
|
+
"%"
|
|
2083
|
+
] })
|
|
2084
|
+
] })
|
|
2085
|
+
] }),
|
|
2086
|
+
/* @__PURE__ */ i(be, { value: s, color: St(s) }),
|
|
2087
|
+
/* @__PURE__ */ i(
|
|
2088
|
+
ae,
|
|
2089
|
+
{
|
|
2090
|
+
title: Math.max(Math.abs(e.correct), Math.abs(e.made)) >= 1e3 && t("correctOfMade", { correct: n.full(e.correct), made: n.full(e.made) }),
|
|
2091
|
+
children: /* @__PURE__ */ i("span", { css: R.caption, children: t("correctOfMade", { correct: n.compact(e.correct), made: n.compact(e.made) }) })
|
|
2092
|
+
}
|
|
2093
|
+
)
|
|
2094
|
+
] })
|
|
2095
|
+
] });
|
|
2096
|
+
}, Co = ({
|
|
2097
|
+
breakdown: e
|
|
2098
|
+
}) => {
|
|
2099
|
+
const { label: t } = F(), [n, s] = I(!0), [c, l] = I("competitions"), [f, m] = I("points"), p = he(), u = xo.filter((g) => e[g].length > 0), y = u.includes(c) ? c : u[0], S = q(() => y ? Ln(e[y], f) : [], [e, y, f]), h = q(() => Bn(S), [S]);
|
|
2100
|
+
return y ? /* @__PURE__ */ d("div", { css: R.root, children: [
|
|
2101
|
+
/* @__PURE__ */ i(
|
|
2102
|
+
Ft,
|
|
2103
|
+
{
|
|
2104
|
+
title: t("breakdownByEntity"),
|
|
2105
|
+
open: n,
|
|
2106
|
+
controls: p,
|
|
2107
|
+
onToggle: () => s((g) => !g)
|
|
2108
|
+
}
|
|
2109
|
+
),
|
|
2110
|
+
/* @__PURE__ */ d("div", { id: p, css: R.panel, hidden: !n, children: [
|
|
2111
|
+
/* @__PURE__ */ d("div", { css: R.controls, children: [
|
|
2112
|
+
/* @__PURE__ */ i(
|
|
2113
|
+
xe,
|
|
2114
|
+
{
|
|
2115
|
+
alignStart: !0,
|
|
2116
|
+
label: t("breakdownByEntity"),
|
|
2117
|
+
value: y,
|
|
2118
|
+
onChange: l,
|
|
2119
|
+
options: u.map((g) => ({ key: g, label: t(g) }))
|
|
2120
|
+
}
|
|
2121
|
+
),
|
|
2122
|
+
/* @__PURE__ */ i(
|
|
2123
|
+
Qn,
|
|
2124
|
+
{
|
|
2125
|
+
value: f,
|
|
2126
|
+
onChange: m,
|
|
2127
|
+
options: [
|
|
2128
|
+
{ key: "made", label: t("sortMade") },
|
|
2129
|
+
{ key: "rate", label: t("sortRate") },
|
|
2130
|
+
{ key: "points", label: t("sortPoints") }
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
)
|
|
2134
|
+
] }),
|
|
2135
|
+
/* @__PURE__ */ i("ul", { css: R.list, children: S.map((g) => /* @__PURE__ */ i(vo, { row: g }, g.id)) }),
|
|
2136
|
+
/* @__PURE__ */ d("div", { css: R.totals, children: [
|
|
2137
|
+
/* @__PURE__ */ d("div", { css: R.total, children: [
|
|
2138
|
+
/* @__PURE__ */ i(E, { value: h.made, css: b.figure }),
|
|
2139
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("made") })
|
|
2140
|
+
] }),
|
|
2141
|
+
/* @__PURE__ */ d("div", { css: R.total, children: [
|
|
2142
|
+
/* @__PURE__ */ i(E, { value: h.correct, css: b.figure }),
|
|
2143
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("correct") })
|
|
2144
|
+
] }),
|
|
2145
|
+
/* @__PURE__ */ d("div", { css: R.total, children: [
|
|
2146
|
+
/* @__PURE__ */ d("span", { css: b.figure, children: [
|
|
2147
|
+
h.rate,
|
|
2148
|
+
"%"
|
|
2149
|
+
] }),
|
|
2150
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("accuracy") })
|
|
2151
|
+
] }),
|
|
2152
|
+
/* @__PURE__ */ d("div", { css: R.total, children: [
|
|
2153
|
+
/* @__PURE__ */ i(E, { value: h.points, css: b.figureAccent }),
|
|
2154
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("points") })
|
|
2155
|
+
] })
|
|
2156
|
+
] })
|
|
2157
|
+
] })
|
|
2158
|
+
] }) : null;
|
|
2159
|
+
}, ze = {
|
|
2160
|
+
header: a({
|
|
2161
|
+
display: "flex",
|
|
2162
|
+
alignItems: "flex-end",
|
|
2163
|
+
justifyContent: "space-between",
|
|
2164
|
+
flexWrap: "wrap",
|
|
2165
|
+
gap: r(12)
|
|
2166
|
+
}),
|
|
2167
|
+
lead: a({ display: "flex", flexDirection: "column", gap: r(2) }),
|
|
2168
|
+
figures: a({ display: "flex", alignItems: "flex-end", gap: r(18) })
|
|
2169
|
+
}, ko = ({ single: e, showBreakdown: t }) => {
|
|
2170
|
+
const { label: n } = F();
|
|
2171
|
+
return /* @__PURE__ */ d(ee, { label: n("singlePredictions"), children: [
|
|
2172
|
+
/* @__PURE__ */ d("div", { css: ze.header, children: [
|
|
2173
|
+
/* @__PURE__ */ d("div", { css: ze.lead, children: [
|
|
2174
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: n("singlePredictions") }),
|
|
2175
|
+
/* @__PURE__ */ d("span", { css: b.bigPoints, children: [
|
|
2176
|
+
/* @__PURE__ */ i(E, { value: e.points }),
|
|
2177
|
+
" ",
|
|
2178
|
+
/* @__PURE__ */ i("span", { css: b.unit, children: n("pts") })
|
|
2179
|
+
] })
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ d("div", { css: ze.figures, children: [
|
|
2182
|
+
/* @__PURE__ */ d("div", { children: [
|
|
2183
|
+
/* @__PURE__ */ i(E, { value: e.made, css: b.figure }),
|
|
2184
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: n("made") })
|
|
2185
|
+
] }),
|
|
2186
|
+
/* @__PURE__ */ d("div", { children: [
|
|
2187
|
+
/* @__PURE__ */ i(E, { value: e.correct, css: b.figure }),
|
|
2188
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: n("correct") })
|
|
2189
|
+
] }),
|
|
2190
|
+
/* @__PURE__ */ d("div", { children: [
|
|
2191
|
+
/* @__PURE__ */ d("span", { css: b.figure, children: [
|
|
2192
|
+
le(e.correct, e.made),
|
|
2193
|
+
"%"
|
|
2194
|
+
] }),
|
|
2195
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: n("accuracy") })
|
|
2196
|
+
] })
|
|
2197
|
+
] })
|
|
2198
|
+
] }),
|
|
2199
|
+
t && /* @__PURE__ */ i(Co, { breakdown: e.breakdown })
|
|
2200
|
+
] });
|
|
2201
|
+
}, Ee = {
|
|
2202
|
+
// One tile takes the full row; two share it.
|
|
2203
|
+
row: a({ display: "flex", gap: r(12) }),
|
|
2204
|
+
tile: a({
|
|
2205
|
+
fontSize: "1em",
|
|
2206
|
+
flex: "1 1 0",
|
|
2207
|
+
minWidth: 0,
|
|
2208
|
+
display: "flex",
|
|
2209
|
+
flexDirection: "column",
|
|
2210
|
+
gap: r(2),
|
|
2211
|
+
padding: r(14),
|
|
2212
|
+
backgroundColor: o.card,
|
|
2213
|
+
border: `1px solid ${o.border}`,
|
|
2214
|
+
borderRadius: r(12)
|
|
2215
|
+
}),
|
|
2216
|
+
points: a({ fontFamily: o.fontPrimary, fontWeight: 700, fontSize: "1.25em", color: o.accent })
|
|
2217
|
+
}, et = ({ title: e, game: t }) => {
|
|
2218
|
+
const { label: n, fmt: s } = F();
|
|
2219
|
+
return /* @__PURE__ */ d("section", { css: Ee.tile, "aria-label": n(e), children: [
|
|
2220
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: n(e) }),
|
|
2221
|
+
/* @__PURE__ */ d("span", { css: Ee.points, children: [
|
|
2222
|
+
/* @__PURE__ */ i(E, { value: t.points }),
|
|
2223
|
+
" ",
|
|
2224
|
+
/* @__PURE__ */ i("span", { css: b.unit, children: n("pts") })
|
|
2225
|
+
] }),
|
|
2226
|
+
/* @__PURE__ */ i("span", { css: b.muted, children: n("playedCount", { count: s.compact(t.participations) }) })
|
|
2227
|
+
] });
|
|
2228
|
+
}, Fo = ({
|
|
2229
|
+
topX: e,
|
|
2230
|
+
matchQuiz: t
|
|
2231
|
+
}) => /* @__PURE__ */ d("div", { css: Ee.row, children: [
|
|
2232
|
+
e && /* @__PURE__ */ i(et, { title: "topX", game: e }),
|
|
2233
|
+
t && /* @__PURE__ */ i(et, { title: "matchQuiz", game: t })
|
|
2234
|
+
] }), wo = {
|
|
2235
|
+
predictor: "categoryPredictor",
|
|
2236
|
+
topX: "categoryTopX",
|
|
2237
|
+
matchQuiz: "categoryMatchQuiz",
|
|
2238
|
+
games: "categoryGames",
|
|
2239
|
+
football: "categoryFootball",
|
|
2240
|
+
classicQuizzes: "categoryClassicQuizzes",
|
|
2241
|
+
eitherOr: "categoryEitherOr",
|
|
2242
|
+
discussions: "categoryDiscussions",
|
|
2243
|
+
potm: "categoryPotm",
|
|
2244
|
+
poll: "categoryPoll"
|
|
2245
|
+
}, Rt = (e) => {
|
|
2246
|
+
const { label: t, fmt: n } = F(), s = t(wo[e.category]);
|
|
2247
|
+
return {
|
|
2248
|
+
category: s,
|
|
2249
|
+
name: t("badgeName", { category: s, name: e.label }),
|
|
2250
|
+
date: e.earned ? e.achievedAt ? t("earnedOn", { date: n.date(e.achievedAt) }) : "" : t("notEarnedYet")
|
|
2251
|
+
};
|
|
2252
|
+
}, zt = ({ size: e }) => /* @__PURE__ */ d(
|
|
2253
|
+
"svg",
|
|
2254
|
+
{
|
|
2255
|
+
"aria-hidden": "true",
|
|
2256
|
+
focusable: "false",
|
|
2257
|
+
viewBox: "0 0 24 24",
|
|
2258
|
+
width: e,
|
|
2259
|
+
height: e,
|
|
2260
|
+
fill: "none",
|
|
2261
|
+
stroke: "currentColor",
|
|
2262
|
+
strokeWidth: 2,
|
|
2263
|
+
strokeLinecap: "round",
|
|
2264
|
+
strokeLinejoin: "round",
|
|
2265
|
+
children: [
|
|
2266
|
+
/* @__PURE__ */ i("circle", { cx: "12", cy: "9", r: "6" }),
|
|
2267
|
+
/* @__PURE__ */ i("path", { d: "M8.5 14.2 7 22l5-2.8 5 2.8-1.5-7.8" })
|
|
2268
|
+
]
|
|
2269
|
+
}
|
|
2270
|
+
), tt = {
|
|
2271
|
+
flex: "none",
|
|
2272
|
+
display: "block",
|
|
2273
|
+
width: "var(--ps-size)",
|
|
2274
|
+
height: "var(--ps-size)",
|
|
2275
|
+
objectFit: "contain"
|
|
2276
|
+
}, nt = {
|
|
2277
|
+
earned: a(tt),
|
|
2278
|
+
// Greyed out until earned.
|
|
2279
|
+
locked: a(tt, { filter: "grayscale(1)", opacity: 0.55 })
|
|
2280
|
+
}, Tt = ({ badge: e, size: t, fallback: n }) => {
|
|
2281
|
+
const [s, c] = I(null);
|
|
2282
|
+
if (!e.image || s === e.image) return /* @__PURE__ */ i(fe, { children: n });
|
|
2283
|
+
const l = e.image;
|
|
2284
|
+
return /* @__PURE__ */ i(
|
|
2285
|
+
"img",
|
|
2286
|
+
{
|
|
2287
|
+
src: l,
|
|
2288
|
+
alt: "",
|
|
2289
|
+
loading: "lazy",
|
|
2290
|
+
css: e.earned ? nt.earned : nt.locked,
|
|
2291
|
+
style: { "--ps-size": `${t / 16}em` },
|
|
2292
|
+
onError: () => c(l)
|
|
2293
|
+
}
|
|
2294
|
+
);
|
|
2295
|
+
}, ot = {
|
|
2296
|
+
display: "flex",
|
|
2297
|
+
alignItems: "flex-start",
|
|
2298
|
+
gap: r(11),
|
|
2299
|
+
padding: r(12),
|
|
2300
|
+
borderRadius: r(11),
|
|
2301
|
+
minWidth: 0
|
|
2302
|
+
}, it = {
|
|
2303
|
+
flex: "none",
|
|
2304
|
+
boxSizing: "border-box",
|
|
2305
|
+
width: r(34),
|
|
2306
|
+
height: r(34),
|
|
2307
|
+
borderRadius: "50%",
|
|
2308
|
+
display: "flex",
|
|
2309
|
+
alignItems: "center",
|
|
2310
|
+
justifyContent: "center"
|
|
2311
|
+
}, J = {
|
|
2312
|
+
earned: a({ ...ot, backgroundColor: o.card, border: `1px solid ${o.border}` }),
|
|
2313
|
+
locked: a({ ...ot, backgroundColor: o.variant, border: `1px dashed ${o.border}` }),
|
|
2314
|
+
// Earned: white on the category colour. Locked: a muted, dashed, empty-looking slot.
|
|
2315
|
+
glyphEarned: a({ ...it, backgroundColor: "var(--ps-category)", color: "#FFFFFF" }),
|
|
2316
|
+
glyphLocked: a({ ...it, color: o.muted, border: `1.5px dashed ${o.muted}` }),
|
|
2317
|
+
body: a({ minWidth: 0, display: "flex", flexDirection: "column", gap: r(3) }),
|
|
2318
|
+
name: a({
|
|
2319
|
+
margin: 0,
|
|
2320
|
+
fontFamily: o.fontSecondary,
|
|
2321
|
+
fontWeight: 600,
|
|
2322
|
+
fontSize: "0.82em",
|
|
2323
|
+
lineHeight: 1.2,
|
|
2324
|
+
color: o.text,
|
|
2325
|
+
unicodeBidi: "plaintext"
|
|
2326
|
+
}),
|
|
2327
|
+
description: a({
|
|
2328
|
+
margin: 0,
|
|
2329
|
+
fontFamily: o.fontSecondary,
|
|
2330
|
+
fontSize: "0.72em",
|
|
2331
|
+
lineHeight: 1.45,
|
|
2332
|
+
color: o.muted,
|
|
2333
|
+
textWrap: "pretty",
|
|
2334
|
+
unicodeBidi: "plaintext"
|
|
2335
|
+
}),
|
|
2336
|
+
date: a({ fontFamily: o.fontSecondary, fontSize: "0.66em", color: o.muted })
|
|
2337
|
+
}, $o = ({ badge: e }) => {
|
|
2338
|
+
const { name: t, date: n } = Rt(e);
|
|
2339
|
+
return /* @__PURE__ */ d("li", { css: e.earned ? J.earned : J.locked, children: [
|
|
2340
|
+
/* @__PURE__ */ i(
|
|
2341
|
+
Tt,
|
|
2342
|
+
{
|
|
2343
|
+
badge: e,
|
|
2344
|
+
size: 34,
|
|
2345
|
+
fallback: /* @__PURE__ */ i(
|
|
2346
|
+
"span",
|
|
2347
|
+
{
|
|
2348
|
+
"aria-hidden": "true",
|
|
2349
|
+
css: e.earned ? J.glyphEarned : J.glyphLocked,
|
|
2350
|
+
style: { "--ps-category": Gn(e.category) },
|
|
2351
|
+
children: /* @__PURE__ */ i(zt, { size: r(18) })
|
|
2352
|
+
}
|
|
2353
|
+
)
|
|
2354
|
+
}
|
|
2355
|
+
),
|
|
2356
|
+
/* @__PURE__ */ d("div", { css: J.body, children: [
|
|
2357
|
+
/* @__PURE__ */ i("p", { css: J.name, children: t }),
|
|
2358
|
+
e.description && /* @__PURE__ */ i("p", { css: J.description, children: e.description }),
|
|
2359
|
+
n && /* @__PURE__ */ i("span", { css: J.date, children: n })
|
|
2360
|
+
] })
|
|
2361
|
+
] });
|
|
2362
|
+
}, rt = {
|
|
2363
|
+
boxSizing: "border-box",
|
|
2364
|
+
width: r(112),
|
|
2365
|
+
height: r(112),
|
|
2366
|
+
borderRadius: "50%",
|
|
2367
|
+
display: "flex",
|
|
2368
|
+
alignItems: "center",
|
|
2369
|
+
justifyContent: "center",
|
|
2370
|
+
borderWidth: "2.5px",
|
|
2371
|
+
borderStyle: "solid"
|
|
2372
|
+
}, st = {
|
|
2373
|
+
boxSizing: "border-box",
|
|
2374
|
+
width: r(94),
|
|
2375
|
+
height: r(94),
|
|
2376
|
+
borderRadius: "50%",
|
|
2377
|
+
border: "1px solid",
|
|
2378
|
+
display: "flex",
|
|
2379
|
+
flexDirection: "column",
|
|
2380
|
+
alignItems: "center",
|
|
2381
|
+
justifyContent: "center",
|
|
2382
|
+
gap: r(3),
|
|
2383
|
+
padding: r(7),
|
|
2384
|
+
textAlign: "center"
|
|
2385
|
+
}, U = {
|
|
2386
|
+
item: a({
|
|
2387
|
+
minWidth: 0,
|
|
2388
|
+
display: "flex",
|
|
2389
|
+
flexDirection: "column",
|
|
2390
|
+
alignItems: "center",
|
|
2391
|
+
gap: r(7)
|
|
2392
|
+
}),
|
|
2393
|
+
anchor: a({ display: "block", borderRadius: "50%" }),
|
|
2394
|
+
sealEarned: a({ ...rt, backgroundColor: o.medalFill, borderColor: o.medalEdge }),
|
|
2395
|
+
sealLocked: a({ ...rt, backgroundColor: o.variant, borderColor: o.border }),
|
|
2396
|
+
ringEarned: a({ ...st, borderColor: P(o.medalEdge, 45), color: o.accentFg }),
|
|
2397
|
+
ringLocked: a({ ...st, borderColor: o.border, color: o.muted }),
|
|
2398
|
+
icon: a({ display: "flex" }),
|
|
2399
|
+
name: a({
|
|
2400
|
+
maxWidth: "100%",
|
|
2401
|
+
overflowWrap: "anywhere",
|
|
2402
|
+
fontFamily: o.fontPrimary,
|
|
2403
|
+
fontWeight: 700,
|
|
2404
|
+
fontSize: "0.82em",
|
|
2405
|
+
lineHeight: 1.05,
|
|
2406
|
+
textTransform: "uppercase",
|
|
2407
|
+
unicodeBidi: "plaintext"
|
|
2408
|
+
}),
|
|
2409
|
+
category: a({
|
|
2410
|
+
maxWidth: "100%",
|
|
2411
|
+
overflowWrap: "anywhere",
|
|
2412
|
+
fontFamily: o.fontSecondary,
|
|
2413
|
+
fontWeight: 600,
|
|
2414
|
+
fontSize: "0.66em",
|
|
2415
|
+
letterSpacing: r(0.5, 10.56),
|
|
2416
|
+
textTransform: "uppercase"
|
|
2417
|
+
}),
|
|
2418
|
+
date: a({
|
|
2419
|
+
fontFamily: o.fontSecondary,
|
|
2420
|
+
fontSize: "0.62em",
|
|
2421
|
+
color: o.muted,
|
|
2422
|
+
textAlign: "center"
|
|
2423
|
+
})
|
|
2424
|
+
}, Io = ({ badge: e }) => {
|
|
2425
|
+
const { category: t, name: n, date: s } = Rt(e);
|
|
2426
|
+
return /* @__PURE__ */ d("li", { css: U.item, children: [
|
|
2427
|
+
/* @__PURE__ */ i(ae, { title: e.description, maxWidthEm: 12, children: /* @__PURE__ */ i("span", { css: U.anchor, children: /* @__PURE__ */ i(
|
|
2428
|
+
Tt,
|
|
2429
|
+
{
|
|
2430
|
+
badge: e,
|
|
2431
|
+
size: 112,
|
|
2432
|
+
fallback: /* @__PURE__ */ i("span", { "aria-hidden": "true", css: e.earned ? U.sealEarned : U.sealLocked, children: /* @__PURE__ */ d("span", { css: e.earned ? U.ringEarned : U.ringLocked, children: [
|
|
2433
|
+
/* @__PURE__ */ i("span", { css: U.icon, children: /* @__PURE__ */ i(zt, { size: r(20) }) }),
|
|
2434
|
+
/* @__PURE__ */ i("span", { css: U.name, children: e.label }),
|
|
2435
|
+
/* @__PURE__ */ i("span", { css: U.category, children: t })
|
|
2436
|
+
] }) })
|
|
2437
|
+
}
|
|
2438
|
+
) }) }),
|
|
2439
|
+
/* @__PURE__ */ d("span", { css: Oe, children: [
|
|
2440
|
+
n,
|
|
2441
|
+
e.description ? `. ${e.description}` : ""
|
|
2442
|
+
] }),
|
|
2443
|
+
s && /* @__PURE__ */ i("span", { css: U.date, children: s })
|
|
2444
|
+
] });
|
|
2445
|
+
}, at = { listStyle: "none", margin: 0, padding: 0, display: "grid" }, lt = {
|
|
2446
|
+
cards: a({
|
|
2447
|
+
...at,
|
|
2448
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(min(${r(260)}, 100%), 1fr))`,
|
|
2449
|
+
gap: r(10)
|
|
2450
|
+
}),
|
|
2451
|
+
medallions: a({
|
|
2452
|
+
...at,
|
|
2453
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${r(128)}, 1fr))`,
|
|
2454
|
+
gap: `${r(18)} ${r(12)}`
|
|
2455
|
+
})
|
|
2456
|
+
}, Ro = ({
|
|
2457
|
+
badges: e,
|
|
2458
|
+
layout: t
|
|
2459
|
+
}) => {
|
|
2460
|
+
const { label: n } = F(), s = e.filter((l) => l.earned).length, c = t === "medallions";
|
|
2461
|
+
return /* @__PURE__ */ d(ee, { label: n("badges"), children: [
|
|
2462
|
+
/* @__PURE__ */ d("h3", { css: b.title, children: [
|
|
2463
|
+
n("badges"),
|
|
2464
|
+
" ",
|
|
2465
|
+
/* @__PURE__ */ i("span", { css: b.titleMeta, children: n("badgesEarned", { earned: s, total: e.length }) })
|
|
2466
|
+
] }),
|
|
2467
|
+
/* @__PURE__ */ i("ul", { css: c ? lt.medallions : lt.cards, children: e.map(
|
|
2468
|
+
(l) => c ? /* @__PURE__ */ i(Io, { badge: l }, `${l.category}:${l.id}`) : /* @__PURE__ */ i($o, { badge: l }, `${l.category}:${l.id}`)
|
|
2469
|
+
) })
|
|
2470
|
+
] });
|
|
2471
|
+
}, V = {
|
|
2472
|
+
lead: a({ display: "flex", flexDirection: "column", gap: r(2) }),
|
|
2473
|
+
tiles: a({ display: "grid", gridTemplateColumns: "repeat(2, minmax(0, 1fr))", gap: r(12) }),
|
|
2474
|
+
tile: a({
|
|
2475
|
+
minWidth: 0,
|
|
2476
|
+
display: "flex",
|
|
2477
|
+
flexDirection: "column",
|
|
2478
|
+
gap: r(11),
|
|
2479
|
+
padding: r(14),
|
|
2480
|
+
border: `1px solid ${o.border}`,
|
|
2481
|
+
borderRadius: r(12)
|
|
2482
|
+
}),
|
|
2483
|
+
head: a({ display: "flex", alignItems: "center", justifyContent: "space-between", gap: r(8) }),
|
|
2484
|
+
label: a({
|
|
2485
|
+
margin: 0,
|
|
2486
|
+
fontFamily: o.fontSecondary,
|
|
2487
|
+
fontWeight: 600,
|
|
2488
|
+
fontSize: "0.68em",
|
|
2489
|
+
letterSpacing: r(0.5, 10.88),
|
|
2490
|
+
textTransform: "uppercase",
|
|
2491
|
+
color: o.muted
|
|
2492
|
+
}),
|
|
2493
|
+
value: a({ display: "flex", alignItems: "baseline", flexWrap: "wrap", gap: r(7) }),
|
|
2494
|
+
count: a({ fontFamily: o.fontPrimary, fontWeight: 700, fontSize: "1.6em", lineHeight: 1, color: o.text }),
|
|
2495
|
+
unit: a({ fontFamily: o.fontSecondary, fontSize: "0.74em", color: o.muted }),
|
|
2496
|
+
share: a({ display: "flex", flexDirection: "column", gap: r(5) }),
|
|
2497
|
+
shareLabel: a({ fontFamily: o.fontSecondary, fontSize: "0.66em", color: o.muted })
|
|
2498
|
+
}, ct = ({ title: e, count: t, unit: n, points: s, total: c }) => {
|
|
2499
|
+
const { label: l } = F(), f = le(s, c);
|
|
2500
|
+
return /* @__PURE__ */ d("div", { css: V.tile, children: [
|
|
2501
|
+
/* @__PURE__ */ d("div", { css: V.head, children: [
|
|
2502
|
+
/* @__PURE__ */ i("h4", { css: V.label, children: e }),
|
|
2503
|
+
/* @__PURE__ */ i(xt, { points: s })
|
|
2504
|
+
] }),
|
|
2505
|
+
/* @__PURE__ */ d("div", { css: V.value, children: [
|
|
2506
|
+
/* @__PURE__ */ i(E, { value: t, css: V.count }),
|
|
2507
|
+
/* @__PURE__ */ i("span", { css: V.unit, children: n })
|
|
2508
|
+
] }),
|
|
2509
|
+
s > 0 && /* @__PURE__ */ d("div", { css: V.share, children: [
|
|
2510
|
+
/* @__PURE__ */ i(be, { value: f, color: o.accent, thin: !0 }),
|
|
2511
|
+
/* @__PURE__ */ i("span", { css: V.shareLabel, children: l("shareOfPoints", { percent: f }) })
|
|
2512
|
+
] })
|
|
2513
|
+
] });
|
|
2514
|
+
}, zo = ({ discussions: e }) => {
|
|
2515
|
+
const { label: t } = F(), n = e.totalPoints;
|
|
2516
|
+
return /* @__PURE__ */ d(ee, { label: t("discussions"), children: [
|
|
2517
|
+
/* @__PURE__ */ d("div", { css: V.lead, children: [
|
|
2518
|
+
/* @__PURE__ */ i("span", { css: b.eyebrow, children: t("discussions") }),
|
|
2519
|
+
/* @__PURE__ */ d("span", { css: b.bigPoints, children: [
|
|
2520
|
+
/* @__PURE__ */ i(E, { value: n }),
|
|
2521
|
+
" ",
|
|
2522
|
+
/* @__PURE__ */ i("span", { css: b.unit, children: t("totalPts") })
|
|
2523
|
+
] })
|
|
2524
|
+
] }),
|
|
2525
|
+
/* @__PURE__ */ d("div", { css: V.tiles, children: [
|
|
2526
|
+
/* @__PURE__ */ i(
|
|
2527
|
+
ct,
|
|
2528
|
+
{
|
|
2529
|
+
title: t("posts"),
|
|
2530
|
+
count: e.postsMade,
|
|
2531
|
+
unit: t("postsMade"),
|
|
2532
|
+
points: e.postPoints,
|
|
2533
|
+
total: n
|
|
2534
|
+
}
|
|
2535
|
+
),
|
|
2536
|
+
/* @__PURE__ */ i(
|
|
2537
|
+
ct,
|
|
2538
|
+
{
|
|
2539
|
+
title: t("reactions"),
|
|
2540
|
+
count: e.reactionCount,
|
|
2541
|
+
unit: t("received"),
|
|
2542
|
+
points: e.reactionPoints,
|
|
2543
|
+
total: n
|
|
2544
|
+
}
|
|
2545
|
+
)
|
|
2546
|
+
] })
|
|
2547
|
+
] });
|
|
2548
|
+
}, Pt = a({ display: "flex", gap: r(10) }), re = {
|
|
2549
|
+
tile: a({
|
|
2550
|
+
flex: "1 1 0",
|
|
2551
|
+
minWidth: 0,
|
|
2552
|
+
display: "flex",
|
|
2553
|
+
flexDirection: "column",
|
|
2554
|
+
gap: r(9),
|
|
2555
|
+
padding: r(13),
|
|
2556
|
+
border: `1px solid ${o.border}`,
|
|
2557
|
+
borderRadius: r(12)
|
|
2558
|
+
}),
|
|
2559
|
+
head: a({
|
|
2560
|
+
display: "flex",
|
|
2561
|
+
alignItems: "center",
|
|
2562
|
+
justifyContent: "space-between",
|
|
2563
|
+
gap: r(6),
|
|
2564
|
+
minHeight: r(22)
|
|
2565
|
+
}),
|
|
2566
|
+
label: a({
|
|
2567
|
+
margin: 0,
|
|
2568
|
+
fontFamily: o.fontSecondary,
|
|
2569
|
+
fontWeight: 600,
|
|
2570
|
+
fontSize: "0.66em",
|
|
2571
|
+
letterSpacing: r(0.5, 10.56),
|
|
2572
|
+
textTransform: "uppercase",
|
|
2573
|
+
color: o.muted
|
|
2574
|
+
}),
|
|
2575
|
+
value: a({ display: "flex", alignItems: "baseline", gap: r(6) }),
|
|
2576
|
+
count: a({ fontFamily: o.fontPrimary, fontWeight: 700, fontSize: "1.5em", lineHeight: 1, color: o.text }),
|
|
2577
|
+
unit: a({ fontFamily: o.fontSecondary, fontSize: "0.72em", color: o.muted })
|
|
2578
|
+
}, We = ({ title: e, count: t, unit: n, points: s }) => /* @__PURE__ */ d("div", { css: re.tile, children: [
|
|
2579
|
+
/* @__PURE__ */ d("div", { css: re.head, children: [
|
|
2580
|
+
/* @__PURE__ */ i("h4", { css: re.label, children: e }),
|
|
2581
|
+
s !== null && /* @__PURE__ */ i(xt, { points: s, small: !0 })
|
|
2582
|
+
] }),
|
|
2583
|
+
/* @__PURE__ */ d("div", { css: re.value, children: [
|
|
2584
|
+
/* @__PURE__ */ i(E, { value: t, css: re.count }),
|
|
2585
|
+
/* @__PURE__ */ i("span", { css: re.unit, children: n })
|
|
2586
|
+
] })
|
|
2587
|
+
] }), To = ({ games: e }) => {
|
|
2588
|
+
const { label: t } = F();
|
|
2589
|
+
return /* @__PURE__ */ d(ee, { tight: !0, label: t("miniGames"), children: [
|
|
2590
|
+
/* @__PURE__ */ i("h3", { css: b.title, children: t("miniGames") }),
|
|
2591
|
+
/* @__PURE__ */ i("div", { css: Pt, children: e.map((n) => /* @__PURE__ */ i(
|
|
2592
|
+
We,
|
|
2593
|
+
{
|
|
2594
|
+
title: t(n.key),
|
|
2595
|
+
count: n.count,
|
|
2596
|
+
unit: t("played"),
|
|
2597
|
+
points: n.points
|
|
2598
|
+
},
|
|
2599
|
+
n.key
|
|
2600
|
+
)) })
|
|
2601
|
+
] });
|
|
2602
|
+
}, te = {
|
|
2603
|
+
breakdown: a({
|
|
2604
|
+
display: "flex",
|
|
2605
|
+
flexDirection: "column",
|
|
2606
|
+
gap: r(13),
|
|
2607
|
+
paddingTop: r(13),
|
|
2608
|
+
borderTop: `1px solid ${o.border}`
|
|
2609
|
+
}),
|
|
2610
|
+
panel: a({ display: "flex", flexDirection: "column", gap: r(13), "&[hidden]": { display: "none" } }),
|
|
2611
|
+
list: a({
|
|
2612
|
+
listStyle: "none",
|
|
2613
|
+
margin: 0,
|
|
2614
|
+
padding: 0,
|
|
2615
|
+
display: "flex",
|
|
2616
|
+
flexDirection: "column",
|
|
2617
|
+
gap: r(12)
|
|
2618
|
+
}),
|
|
2619
|
+
row: a({ display: "flex", alignItems: "center", gap: r(12) }),
|
|
2620
|
+
body: a({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: r(5) }),
|
|
2621
|
+
line: a({ display: "flex", alignItems: "center", justifyContent: "space-between", gap: r(8) }),
|
|
2622
|
+
figures: a({ flex: "none", display: "flex", alignItems: "baseline", gap: r(8) })
|
|
2623
|
+
}, Po = ["competitions", "teams", "players"], Eo = ({ breakdown: e }) => {
|
|
2624
|
+
const { label: t, fmt: n } = F(), [s, c] = I(!1), [l, f] = I("competitions"), m = he(), p = Po.filter((h) => e[h].length > 0), u = p.includes(l) ? l : p[0], y = q(() => u ? Nn(e[u]) : [], [e, u]), S = vt(y);
|
|
2625
|
+
return u ? /* @__PURE__ */ d("div", { css: te.breakdown, children: [
|
|
2626
|
+
/* @__PURE__ */ i(
|
|
2627
|
+
Ft,
|
|
2628
|
+
{
|
|
2629
|
+
title: t("pollsBreakdown"),
|
|
2630
|
+
open: s,
|
|
2631
|
+
controls: m,
|
|
2632
|
+
onToggle: () => c((h) => !h)
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ d("div", { id: m, css: te.panel, hidden: !s, children: [
|
|
2636
|
+
/* @__PURE__ */ i(
|
|
2637
|
+
xe,
|
|
2638
|
+
{
|
|
2639
|
+
alignStart: !0,
|
|
2640
|
+
label: t("pollsBreakdown"),
|
|
2641
|
+
value: u,
|
|
2642
|
+
onChange: f,
|
|
2643
|
+
options: p.map((h) => ({ key: h, label: t(h) }))
|
|
2644
|
+
}
|
|
2645
|
+
),
|
|
2646
|
+
/* @__PURE__ */ i("ul", { css: te.list, children: y.map((h) => /* @__PURE__ */ d("li", { css: te.row, children: [
|
|
2647
|
+
/* @__PURE__ */ i(X, { entity: h.entity, size: 30 }),
|
|
2648
|
+
/* @__PURE__ */ d("span", { css: te.body, children: [
|
|
2649
|
+
/* @__PURE__ */ d("span", { css: te.line, children: [
|
|
2650
|
+
/* @__PURE__ */ i("span", { css: b.rowName, children: h.entity.name }),
|
|
2651
|
+
S && /* @__PURE__ */ d("span", { css: te.figures, children: [
|
|
2652
|
+
/* @__PURE__ */ i(E, { value: h.points, css: b.rowPoints }),
|
|
2653
|
+
/* @__PURE__ */ i("span", { css: b.caption, children: t("pts") })
|
|
2654
|
+
] })
|
|
2655
|
+
] }),
|
|
2656
|
+
/* @__PURE__ */ i(be, { value: h.width, color: o.accent }),
|
|
2657
|
+
/* @__PURE__ */ i("span", { css: b.rowCaption, children: t("votesCount", { count: n.compact(h.votes) }) })
|
|
2658
|
+
] })
|
|
2659
|
+
] }, h.id)) })
|
|
2660
|
+
] })
|
|
2661
|
+
] }) : null;
|
|
2662
|
+
}, Wo = ({
|
|
2663
|
+
voting: e,
|
|
2664
|
+
showPollBreakdown: t
|
|
2665
|
+
}) => {
|
|
2666
|
+
const { label: n } = F();
|
|
2667
|
+
return /* @__PURE__ */ d(ee, { tight: !0, label: n("voting"), children: [
|
|
2668
|
+
/* @__PURE__ */ i("h3", { css: b.title, children: n("voting") }),
|
|
2669
|
+
/* @__PURE__ */ d("div", { css: Pt, children: [
|
|
2670
|
+
/* @__PURE__ */ i(
|
|
2671
|
+
We,
|
|
2672
|
+
{
|
|
2673
|
+
title: n("playerOfTheMatch"),
|
|
2674
|
+
count: e.potmPoints,
|
|
2675
|
+
unit: n("points"),
|
|
2676
|
+
points: null
|
|
2677
|
+
}
|
|
2678
|
+
),
|
|
2679
|
+
/* @__PURE__ */ i(
|
|
2680
|
+
We,
|
|
2681
|
+
{
|
|
2682
|
+
title: n("polls"),
|
|
2683
|
+
count: e.pollVotes,
|
|
2684
|
+
unit: n("votes"),
|
|
2685
|
+
points: e.pollPoints
|
|
2686
|
+
}
|
|
2687
|
+
)
|
|
2688
|
+
] }),
|
|
2689
|
+
t && /* @__PURE__ */ i(Eo, { breakdown: e.pollBreakdown })
|
|
2690
|
+
] });
|
|
2691
|
+
}, Oo = {
|
|
2692
|
+
// A hidden or empty section renders nothing, so the gap closes up with it.
|
|
2693
|
+
root: a({
|
|
2694
|
+
fontSize: "1em",
|
|
2695
|
+
fontFamily: o.fontSecondary,
|
|
2696
|
+
color: o.text,
|
|
2697
|
+
lineHeight: "normal",
|
|
2698
|
+
display: "flex",
|
|
2699
|
+
flexDirection: "column",
|
|
2700
|
+
gap: r(16),
|
|
2701
|
+
minWidth: 0
|
|
2702
|
+
})
|
|
2703
|
+
}, Ao = (e) => {
|
|
2704
|
+
const {
|
|
2705
|
+
sdk: t,
|
|
2706
|
+
language: n,
|
|
2707
|
+
profileId: s,
|
|
2708
|
+
userIsLoggedIn: c,
|
|
2709
|
+
sections: l,
|
|
2710
|
+
allowInterestEditing: f = !0,
|
|
2711
|
+
showBreakdown: m = !0,
|
|
2712
|
+
showPollBreakdown: p = !0,
|
|
2713
|
+
badgeLayout: u = "cards",
|
|
2714
|
+
labels: y
|
|
2715
|
+
} = e, S = kn(), { label: h, lookup: g } = In(y), z = Z.useMemo(() => wn(n), [n]), v = Z.useMemo(() => ({ language: n, label: h, lookup: g, fmt: z }), [n, h, g, z]), $ = zn(l), j = Pn($), { status: G, view: x, setInterests: C } = fn(t, {
|
|
2716
|
+
profileId: s || void 0,
|
|
2717
|
+
userIsLoggedIn: c,
|
|
2718
|
+
interests: j.interests,
|
|
2719
|
+
config: j.config
|
|
2720
|
+
}), L = !s && f, B = dt(), A = Z.useMemo(
|
|
2721
|
+
() => L ? {
|
|
2722
|
+
search: (w, oe, ie, Et) => vn(t, { query: w, type: oe, language: n, cursor: Et, signal: ie, disableCache: B }),
|
|
2723
|
+
save: async (w, oe) => {
|
|
2724
|
+
await Cn(t, w, oe), C(oe);
|
|
2725
|
+
}
|
|
2726
|
+
} : null,
|
|
2727
|
+
[L, t, n, B, C]
|
|
2728
|
+
);
|
|
2729
|
+
if (G === "guest") return null;
|
|
2730
|
+
let Q;
|
|
2731
|
+
if (G === "loading") Q = /* @__PURE__ */ i(At, { marginBlock: "5em" });
|
|
2732
|
+
else if (G === "error" || !x)
|
|
2733
|
+
Q = /* @__PURE__ */ i(
|
|
2734
|
+
Ot,
|
|
2735
|
+
{
|
|
2736
|
+
variant: "error",
|
|
2737
|
+
title: h("loadFailed"),
|
|
2738
|
+
message: h("loadFailedDescription")
|
|
2739
|
+
}
|
|
2740
|
+
);
|
|
2741
|
+
else {
|
|
2742
|
+
const w = x, oe = (ie) => {
|
|
2743
|
+
switch (ie) {
|
|
2744
|
+
case "hero":
|
|
2745
|
+
return /* @__PURE__ */ i(An, { hero: w.hero });
|
|
2746
|
+
case "tier-progression":
|
|
2747
|
+
return w.tiers && /* @__PURE__ */ i(Dn, { tiers: w.tiers, points: w.hero.points });
|
|
2748
|
+
case "interests":
|
|
2749
|
+
return w.interests && /* @__PURE__ */ i(po, { interests: w.interests, editor: A });
|
|
2750
|
+
case "success-rates":
|
|
2751
|
+
return /* @__PURE__ */ i(bo, { rates: w.successRates });
|
|
2752
|
+
case "single-predictions":
|
|
2753
|
+
return w.single && /* @__PURE__ */ i(ko, { single: w.single, showBreakdown: m });
|
|
2754
|
+
case "prediction-games":
|
|
2755
|
+
return (w.topX || w.matchQuiz) && /* @__PURE__ */ i(Fo, { topX: w.topX, matchQuiz: w.matchQuiz });
|
|
2756
|
+
case "badges":
|
|
2757
|
+
return w.badges && w.badges.length > 0 && /* @__PURE__ */ i(Ro, { badges: w.badges, layout: u });
|
|
2758
|
+
case "discussions":
|
|
2759
|
+
return w.discussions && /* @__PURE__ */ i(zo, { discussions: w.discussions });
|
|
2760
|
+
case "mini-games":
|
|
2761
|
+
return w.miniGames.length > 0 && /* @__PURE__ */ i(To, { games: w.miniGames });
|
|
2762
|
+
case "voting":
|
|
2763
|
+
return w.voting && /* @__PURE__ */ i(Wo, { voting: w.voting, showPollBreakdown: p });
|
|
2764
|
+
}
|
|
2765
|
+
};
|
|
2766
|
+
Q = /* @__PURE__ */ i(En, { value: v, children: $.map((ie) => /* @__PURE__ */ i(Z.Fragment, { children: oe(ie) }, ie)) });
|
|
2767
|
+
}
|
|
2768
|
+
return /* @__PURE__ */ i("div", { css: Oo.root, style: S, children: Q });
|
|
2769
|
+
}, Mo = (e) => /* @__PURE__ */ i(
|
|
2770
|
+
Mt,
|
|
2771
|
+
{
|
|
2772
|
+
packageName: "profile-stats",
|
|
2773
|
+
language: e.language,
|
|
2774
|
+
themeOptions: e.themeOptions,
|
|
2775
|
+
disableCache: e.disableCache,
|
|
2776
|
+
children: /* @__PURE__ */ i(Ao, { ...e })
|
|
2777
|
+
}
|
|
2778
|
+
), Qo = Kt(Mo);
|
|
2779
|
+
export {
|
|
2780
|
+
Qo as ProfileStats
|
|
2781
|
+
};
|