fansunited-frontend-components 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BattleOfFans.d.ts +4 -0
- package/BattleOfFans.d.ts.map +1 -0
- package/BattleOfFans.js +1887 -0
- package/Betslip.js +1 -1
- package/ChanceGame.js +1 -1
- package/ClassicQuizPlay.js +1 -1
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +1 -1
- package/CompetitorCard.js +1105 -1154
- package/Discussion.js +1 -1
- package/EitherOrPlay.js +1 -1
- package/EventCard.js +1 -1
- package/EventGamePlay.js +1 -1
- package/Leaderboard.js +1 -1
- package/List.js +1 -1
- package/MatchQuizPlay.js +1 -1
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +1 -1
- package/PickThePair.js +1 -1
- package/PlayerOfTheMatch.js +1 -1
- package/PollVote.js +1 -1
- package/Predictor.js +1 -1
- package/README.md +95 -0
- package/Standings.js +1 -1
- package/TopX.js +1 -1
- package/chunks/{withVersionStamp-KKp-FjR1.js → withVersionStamp-CzdDF1rG.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 +29 -27
- package/package.json +6 -2
package/BattleOfFans.js
ADDED
|
@@ -0,0 +1,1887 @@
|
|
|
1
|
+
import { jsx as a, Fragment as Ot, jsxs as b } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { space as dt, radius as ut, LeadForm as zn, Notification as An, WidgetPortal as Vn } from "fansunited-frontend-core/ui/emotion";
|
|
3
|
+
import dn, { useState as A, useRef as un, useEffect as ht, useMemo as q, useCallback as qt } from "react";
|
|
4
|
+
import { useTranslation as bt } from "react-i18next";
|
|
5
|
+
import { useDisableCache as _n, extractSdkError as vt, getSportsApiCredentials as Hn, hexColor as pn, fetchSearchEntitiesByIds as jn, contrastRatio as gt, standsOut as Ft, cdnAssets as Gn, initialsOf as qn, useIsRtl as Pt, useIntlLocale as mn, useIsMobile as Un, useColors as Yn, stripHtmlTags as Xn } from "fansunited-frontend-core";
|
|
6
|
+
import { a as fn, u as Kn, O as Jn } from "./chunks/OddsSkeleton-DP5Yfqpr.js";
|
|
7
|
+
import { keyframes as rt, css as d } from "@emotion/react";
|
|
8
|
+
import { EmojiEventsIcon as Qn, CheckIcon as Zn, LockOutlinedIcon as te } from "fansunited-frontend-core/ui/icons";
|
|
9
|
+
import "fansunited-sdk-esm/enums";
|
|
10
|
+
import { w as ne } from "./chunks/withVersionStamp-CzdDF1rG.js";
|
|
11
|
+
const s = (t, n = 16) => `${Math.round(t / n * 1e4) / 1e4}em`, i = {
|
|
12
|
+
fontPrimary: "var(--fu-ucrc-font-primary)",
|
|
13
|
+
fontSecondary: "var(--fu-ucrc-font-secondary)",
|
|
14
|
+
surface: "var(--fu-ucrc-surface)",
|
|
15
|
+
/** The neutral inner surface: countdown boxes, the ended pill, the losing side. */
|
|
16
|
+
inner: "var(--fu-ucrc-on-surface)",
|
|
17
|
+
track: "var(--fu-ucrc-surface-variant)",
|
|
18
|
+
text: "var(--fu-ucrc-text-primary)",
|
|
19
|
+
dim: "color-mix(in srgb, var(--fu-ucrc-text-primary) 62%, transparent)",
|
|
20
|
+
border: "var(--fu-ucrc-outline-enabled-border)",
|
|
21
|
+
borderSize: "var(--fu-ucrc-border-size)",
|
|
22
|
+
focus: "var(--fu-ucrc-primary-plain-color)",
|
|
23
|
+
/** The theme's shadow colour (Joy shadow-sm). */
|
|
24
|
+
shadow: "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))",
|
|
25
|
+
trophy: "var(--fu-ucrc-warning-plain-color)",
|
|
26
|
+
trophyOn: "var(--bof-trophy-on)",
|
|
27
|
+
spaceXs: dt("xs"),
|
|
28
|
+
spaceSm: dt("sm"),
|
|
29
|
+
spaceMd: dt("md"),
|
|
30
|
+
spaceLg: dt("lg"),
|
|
31
|
+
radiusSm: ut("sm"),
|
|
32
|
+
radiusMd: ut("md"),
|
|
33
|
+
radiusLg: ut("lg"),
|
|
34
|
+
radiusFull: ut("full"),
|
|
35
|
+
fill: "var(--bof-fill)",
|
|
36
|
+
on: "var(--bof-on)",
|
|
37
|
+
ink: "var(--bof-ink)",
|
|
38
|
+
/** The side colour mixed into the card, at `--bof-tint`. */
|
|
39
|
+
tint: "color-mix(in srgb, var(--bof-fill) var(--bof-tint), var(--fu-ucrc-surface))"
|
|
40
|
+
}, ot = {
|
|
41
|
+
logo: "drop-shadow(0 3px 6px rgba(0,0,0,0.18))",
|
|
42
|
+
winnerLogo: "drop-shadow(0 8px 14px rgba(0,0,0,0.35))",
|
|
43
|
+
winnerHeadshot: "0 10px 22px -10px rgba(0,0,0,0.5)",
|
|
44
|
+
trophy: "0 4px 10px -3px rgba(0,0,0,0.45)"
|
|
45
|
+
}, ee = "@media (prefers-reduced-motion: reduce)", tt = {
|
|
46
|
+
pad: 24,
|
|
47
|
+
arenaBar: 238,
|
|
48
|
+
arenaFill: 324,
|
|
49
|
+
colPad: [24, 24],
|
|
50
|
+
colGap: 12,
|
|
51
|
+
imgSlot: 88,
|
|
52
|
+
img: 80,
|
|
53
|
+
name: [20, 26],
|
|
54
|
+
btnH: 48,
|
|
55
|
+
btnFont: 16,
|
|
56
|
+
pctBar: [34, 40],
|
|
57
|
+
pctFill: [36, 42],
|
|
58
|
+
bar: 12,
|
|
59
|
+
barGap: 4,
|
|
60
|
+
labelsGap: 16,
|
|
61
|
+
caption: [12, 16],
|
|
62
|
+
winWrap: 112,
|
|
63
|
+
winImg: 108,
|
|
64
|
+
rays: 440,
|
|
65
|
+
eyebrow: [13, 18],
|
|
66
|
+
winName: [30, 36],
|
|
67
|
+
winPct: [56, 60],
|
|
68
|
+
loserSlot: 60,
|
|
69
|
+
loserImg: 52,
|
|
70
|
+
loserName: [16, 22],
|
|
71
|
+
loserPct: [28, 34],
|
|
72
|
+
trophy: 40,
|
|
73
|
+
trophyRing: 3,
|
|
74
|
+
slant: 4
|
|
75
|
+
}, nt = {
|
|
76
|
+
pad: 16,
|
|
77
|
+
arenaBar: 196,
|
|
78
|
+
arenaFill: 264,
|
|
79
|
+
colPad: [16, 12],
|
|
80
|
+
colGap: 10,
|
|
81
|
+
imgSlot: 60,
|
|
82
|
+
img: 56,
|
|
83
|
+
name: [15, 20],
|
|
84
|
+
btnH: 44,
|
|
85
|
+
btnFont: 15,
|
|
86
|
+
pctBar: [28, 34],
|
|
87
|
+
pctFill: [28, 34],
|
|
88
|
+
bar: 10,
|
|
89
|
+
barGap: 3,
|
|
90
|
+
labelsGap: 8,
|
|
91
|
+
caption: [11, 14],
|
|
92
|
+
winWrap: 72,
|
|
93
|
+
winImg: 70,
|
|
94
|
+
rays: 250,
|
|
95
|
+
eyebrow: [11, 14],
|
|
96
|
+
winName: [18, 24],
|
|
97
|
+
winPct: [40, 44],
|
|
98
|
+
loserSlot: 44,
|
|
99
|
+
loserImg: 38,
|
|
100
|
+
loserName: [13, 18],
|
|
101
|
+
loserPct: [22, 28],
|
|
102
|
+
trophy: 28,
|
|
103
|
+
trophyRing: 2,
|
|
104
|
+
slant: 3
|
|
105
|
+
}, $t = 76, I = ([t, n]) => ({
|
|
106
|
+
fontSize: s(t),
|
|
107
|
+
lineHeight: n / t
|
|
108
|
+
}), Ct = rt({
|
|
109
|
+
"0%, 100%": { opacity: 1 },
|
|
110
|
+
"50%": { opacity: 0.45 }
|
|
111
|
+
}), Ut = {
|
|
112
|
+
margin: 0,
|
|
113
|
+
fontFamily: i.fontPrimary,
|
|
114
|
+
fontWeight: 700,
|
|
115
|
+
letterSpacing: "-0.01em"
|
|
116
|
+
}, Yt = (t, n) => ({
|
|
117
|
+
root: d({
|
|
118
|
+
fontSize: "1em",
|
|
119
|
+
boxSizing: "border-box",
|
|
120
|
+
width: "100%",
|
|
121
|
+
display: "flex",
|
|
122
|
+
flexDirection: "column",
|
|
123
|
+
overflow: "hidden",
|
|
124
|
+
color: i.text,
|
|
125
|
+
fontFamily: i.fontSecondary,
|
|
126
|
+
backgroundColor: i.surface,
|
|
127
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
128
|
+
borderRadius: i.radiusLg,
|
|
129
|
+
boxShadow: `0 1px 2px 0 ${i.shadow}, 0 2px 4px 0 ${i.shadow}`,
|
|
130
|
+
"--bof-tint": "10%",
|
|
131
|
+
".dark &": { "--bof-tint": "26%" },
|
|
132
|
+
[ee]: {
|
|
133
|
+
"& *, & *::before, & *::after": {
|
|
134
|
+
animation: "none !important",
|
|
135
|
+
transition: "none !important"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
body: d({
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
gap: n ? i.spaceMd : i.spaceLg,
|
|
143
|
+
padding: n ? i.spaceMd : i.spaceLg
|
|
144
|
+
}),
|
|
145
|
+
header: d(
|
|
146
|
+
n ? { display: "flex", flexDirection: "column", gap: s(12) } : {
|
|
147
|
+
display: "flex",
|
|
148
|
+
alignItems: "flex-start",
|
|
149
|
+
justifyContent: "space-between",
|
|
150
|
+
gap: i.spaceLg,
|
|
151
|
+
minHeight: s(90)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
titles: d({
|
|
155
|
+
display: "flex",
|
|
156
|
+
flexDirection: "column",
|
|
157
|
+
gap: s(n ? 2 : 4),
|
|
158
|
+
minWidth: 0
|
|
159
|
+
}),
|
|
160
|
+
// Title and open subtitle can be poll (CMS) text, in any language.
|
|
161
|
+
title: d({
|
|
162
|
+
...Ut,
|
|
163
|
+
unicodeBidi: "plaintext",
|
|
164
|
+
...I(n ? [22, 28] : [28, 34])
|
|
165
|
+
}),
|
|
166
|
+
// Every subtitle sits in one grid cell, so the header is as tall as the longest in every state.
|
|
167
|
+
subtitles: d({ display: "grid" }),
|
|
168
|
+
subtitle: d({
|
|
169
|
+
gridArea: "1 / 1",
|
|
170
|
+
margin: 0,
|
|
171
|
+
color: i.dim,
|
|
172
|
+
unicodeBidi: "plaintext",
|
|
173
|
+
...I(n ? [14, 20] : [15, 22])
|
|
174
|
+
}),
|
|
175
|
+
subtitleHidden: d({
|
|
176
|
+
gridArea: "1 / 1",
|
|
177
|
+
margin: 0,
|
|
178
|
+
visibility: "hidden",
|
|
179
|
+
...I(n ? [14, 20] : [15, 22])
|
|
180
|
+
}),
|
|
181
|
+
// Mobile: the countdown (or the ended note) sits in a bordered box under the title.
|
|
182
|
+
status: d({
|
|
183
|
+
minHeight: s(58),
|
|
184
|
+
boxSizing: "border-box",
|
|
185
|
+
padding: `${s(10)} ${s(14)}`,
|
|
186
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
187
|
+
borderRadius: i.radiusSm,
|
|
188
|
+
display: "flex",
|
|
189
|
+
alignItems: "center",
|
|
190
|
+
justifyContent: "center"
|
|
191
|
+
}),
|
|
192
|
+
pill: d({
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
whiteSpace: "nowrap",
|
|
196
|
+
fontWeight: 500,
|
|
197
|
+
...I([14, 20]),
|
|
198
|
+
...n ? {} : {
|
|
199
|
+
height: s(36, 14),
|
|
200
|
+
padding: `0 ${s(14, 14)}`,
|
|
201
|
+
borderRadius: i.radiusFull,
|
|
202
|
+
backgroundColor: i.inner
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
arenaSkeleton: d({
|
|
206
|
+
borderRadius: i.radiusMd,
|
|
207
|
+
backgroundColor: i.inner,
|
|
208
|
+
animation: `${Ct} 1.5s ease-in-out infinite`
|
|
209
|
+
}),
|
|
210
|
+
resultsSkeleton: d({
|
|
211
|
+
height: s(t.pctBar[1] + (n ? 8 : 10) + t.bar),
|
|
212
|
+
display: "flex",
|
|
213
|
+
flexDirection: "column",
|
|
214
|
+
justifyContent: "flex-end"
|
|
215
|
+
}),
|
|
216
|
+
// Where the odds strip goes while it loads: the strip's own framed padding and top border.
|
|
217
|
+
oddsSlot: d({
|
|
218
|
+
paddingInline: n ? "0.625em" : "0.75em",
|
|
219
|
+
paddingBlock: "0.625em",
|
|
220
|
+
borderBlockStart: `1px solid ${i.border}`
|
|
221
|
+
}),
|
|
222
|
+
barSkeleton: d({
|
|
223
|
+
height: s(t.bar),
|
|
224
|
+
borderRadius: i.radiusFull,
|
|
225
|
+
backgroundColor: i.track,
|
|
226
|
+
animation: `${Ct} 1.5s ease-in-out infinite`
|
|
227
|
+
}),
|
|
228
|
+
titleSkeleton: d({
|
|
229
|
+
width: s(n ? 170 : 220),
|
|
230
|
+
height: s(n ? 28 : 34),
|
|
231
|
+
borderRadius: i.radiusSm,
|
|
232
|
+
backgroundColor: i.inner,
|
|
233
|
+
animation: `${Ct} 1.5s ease-in-out infinite`
|
|
234
|
+
}),
|
|
235
|
+
message: d({
|
|
236
|
+
display: "flex",
|
|
237
|
+
flexDirection: "column",
|
|
238
|
+
alignItems: "center",
|
|
239
|
+
justifyContent: "center",
|
|
240
|
+
gap: s(8),
|
|
241
|
+
textAlign: "center",
|
|
242
|
+
borderRadius: i.radiusMd,
|
|
243
|
+
backgroundColor: i.inner,
|
|
244
|
+
padding: i.spaceLg,
|
|
245
|
+
boxSizing: "border-box"
|
|
246
|
+
}),
|
|
247
|
+
messageTitle: d({ ...Ut, ...I([18, 24]) }),
|
|
248
|
+
messageText: d({ margin: 0, color: i.dim, ...I([14, 20]) }),
|
|
249
|
+
retry: d({
|
|
250
|
+
marginTop: s(8, 15),
|
|
251
|
+
height: s(40, 15),
|
|
252
|
+
padding: `0 ${s(20, 15)}`,
|
|
253
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
254
|
+
borderRadius: i.radiusSm,
|
|
255
|
+
background: i.surface,
|
|
256
|
+
color: i.text,
|
|
257
|
+
font: "inherit",
|
|
258
|
+
fontWeight: 700,
|
|
259
|
+
fontSize: s(15),
|
|
260
|
+
cursor: "pointer",
|
|
261
|
+
"&:focus-visible": {
|
|
262
|
+
outline: `2px solid ${i.focus}`,
|
|
263
|
+
outlineOffset: "2px"
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
}), Xt = (t) => ({
|
|
267
|
+
root: d(
|
|
268
|
+
t ? {
|
|
269
|
+
width: "100%",
|
|
270
|
+
display: "flex",
|
|
271
|
+
alignItems: "center",
|
|
272
|
+
justifyContent: "space-between",
|
|
273
|
+
gap: s(12)
|
|
274
|
+
} : {
|
|
275
|
+
display: "flex",
|
|
276
|
+
flexDirection: "column",
|
|
277
|
+
alignItems: "flex-end",
|
|
278
|
+
gap: s(8)
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
label: d({
|
|
282
|
+
fontWeight: 500,
|
|
283
|
+
...I(t ? [12, 16] : [13, 18]),
|
|
284
|
+
...t ? { maxWidth: s(96, 12) } : {}
|
|
285
|
+
}),
|
|
286
|
+
units: d({
|
|
287
|
+
display: "flex",
|
|
288
|
+
alignItems: "flex-start",
|
|
289
|
+
gap: s(t ? 14 : 8)
|
|
290
|
+
}),
|
|
291
|
+
unit: d({
|
|
292
|
+
display: "flex",
|
|
293
|
+
flexDirection: "column",
|
|
294
|
+
alignItems: "center",
|
|
295
|
+
gap: s(t ? 1 : 6)
|
|
296
|
+
}),
|
|
297
|
+
value: d({
|
|
298
|
+
fontFamily: i.fontPrimary,
|
|
299
|
+
fontWeight: 700,
|
|
300
|
+
fontVariantNumeric: "tabular-nums",
|
|
301
|
+
...t ? I([18, 22]) : {
|
|
302
|
+
fontSize: s(20),
|
|
303
|
+
lineHeight: 1,
|
|
304
|
+
width: s(44, 20),
|
|
305
|
+
height: s(44, 20),
|
|
306
|
+
display: "flex",
|
|
307
|
+
alignItems: "center",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
borderRadius: i.radiusSm,
|
|
310
|
+
backgroundColor: i.inner
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
caption: d({
|
|
314
|
+
textTransform: "uppercase",
|
|
315
|
+
letterSpacing: "0.05em",
|
|
316
|
+
color: i.dim,
|
|
317
|
+
...I(t ? [10, 14] : [11, 14])
|
|
318
|
+
}),
|
|
319
|
+
colon: d({
|
|
320
|
+
height: s(44, 20),
|
|
321
|
+
display: "flex",
|
|
322
|
+
alignItems: "center",
|
|
323
|
+
fontFamily: i.fontPrimary,
|
|
324
|
+
fontWeight: 700,
|
|
325
|
+
fontSize: s(20),
|
|
326
|
+
color: i.dim
|
|
327
|
+
})
|
|
328
|
+
}), y = { d: Yt(tt, !1), m: Yt(nt, !0) }, Y = { d: Xt(!1), m: Xt(!0) }, oe = "battle-of-fans", re = "voting_ends_at", ie = "voting_starts_at", Kt = 5 * 6e4, se = 15e3, Jt = { team: "team", player: "player" }, ae = (t) => {
|
|
329
|
+
var r;
|
|
330
|
+
const n = (((r = t.context) == null ? void 0 : r.tags) ?? []).filter(
|
|
331
|
+
(o) => !!(o != null && o.id) && !!Jt[(o.type ?? "").toLowerCase()]
|
|
332
|
+
), e = t.options ?? [];
|
|
333
|
+
return n.length !== e.length && console.warn(
|
|
334
|
+
`BattleOfFans: poll ${t.id} has ${e.length} options and ${n.length} team/player tags; using the first ${Math.min(n.length, e.length)}.`
|
|
335
|
+
), e.slice(0, n.length).map((o, l) => ({
|
|
336
|
+
optionId: o.id,
|
|
337
|
+
entityId: n[l].id,
|
|
338
|
+
kind: Jt[n[l].type.toLowerCase()],
|
|
339
|
+
title: o.title ?? ""
|
|
340
|
+
}));
|
|
341
|
+
}, le = (t) => t.split("-")[0].toUpperCase(), ce = (t, n) => {
|
|
342
|
+
var o, l;
|
|
343
|
+
if (!t) return null;
|
|
344
|
+
const e = le(n);
|
|
345
|
+
return (((l = (o = t.translations) == null ? void 0 : o.find(
|
|
346
|
+
(u) => {
|
|
347
|
+
var m;
|
|
348
|
+
return ((m = u.language) == null ? void 0 : m.toUpperCase()) === e;
|
|
349
|
+
}
|
|
350
|
+
)) == null ? void 0 : l.name) ?? t.name ?? "").trim() || null;
|
|
351
|
+
}, de = (t, n) => {
|
|
352
|
+
var e, r;
|
|
353
|
+
return ((r = (e = t == null ? void 0 : t.assets) == null ? void 0 : e.find((o) => o.key === (n === "team" ? "LOGO" : "HEADSHOT"))) == null ? void 0 : r.value) ?? null;
|
|
354
|
+
}, hn = (t) => {
|
|
355
|
+
var n, e;
|
|
356
|
+
return ((e = (n = t == null ? void 0 : t.related) == null ? void 0 : n.find((r) => {
|
|
357
|
+
var o;
|
|
358
|
+
return ((o = r.relationship) == null ? void 0 : o.toUpperCase()) === "TEAM";
|
|
359
|
+
})) == null ? void 0 : e.related_id) ?? null;
|
|
360
|
+
}, ue = (t, n) => {
|
|
361
|
+
var r;
|
|
362
|
+
const e = (r = t == null ? void 0 : t.metadata) == null ? void 0 : r.branding;
|
|
363
|
+
return [
|
|
364
|
+
e == null ? void 0 : e.primary_color,
|
|
365
|
+
e == null ? void 0 : e.secondary_color,
|
|
366
|
+
e == null ? void 0 : e.tertiary_color
|
|
367
|
+
].map((o) => n(o)).filter((o) => !!o);
|
|
368
|
+
}, pe = (t, n, e, r) => t.map((o) => {
|
|
369
|
+
const l = n.get(o.entityId), u = o.kind === "player" ? n.get(hn(l) ?? "") : l;
|
|
370
|
+
return {
|
|
371
|
+
...o,
|
|
372
|
+
name: ce(l, e) ?? o.title,
|
|
373
|
+
image: de(l, o.kind),
|
|
374
|
+
brand: ue(u, r)
|
|
375
|
+
};
|
|
376
|
+
}), me = (t) => {
|
|
377
|
+
const n = t.reduce((u, m) => u + Math.max(0, m), 0);
|
|
378
|
+
if (n === 0) return t.map(() => 0);
|
|
379
|
+
const e = t.map((u) => Math.max(0, u) / n * 100), r = e.map(Math.floor);
|
|
380
|
+
let o = 100 - r.reduce((u, m) => u + m, 0);
|
|
381
|
+
const l = e.map((u, m) => ({ i: m, rest: u - Math.floor(u) })).sort((u, m) => m.rest - u.rest || u.i - m.i);
|
|
382
|
+
for (const { i: u } of l) {
|
|
383
|
+
if (o <= 0) break;
|
|
384
|
+
r[u] += 1, o -= 1;
|
|
385
|
+
}
|
|
386
|
+
return r;
|
|
387
|
+
}, fe = (t) => {
|
|
388
|
+
const n = Math.max(...t);
|
|
389
|
+
return n > 0 && t.filter((r) => r === n).length === 1 ? t.indexOf(n) : null;
|
|
390
|
+
}, Qt = (t) => {
|
|
391
|
+
if (!t) return null;
|
|
392
|
+
const n = Date.parse(t);
|
|
393
|
+
return Number.isNaN(n) ? null : n;
|
|
394
|
+
}, Zt = (t, n) => {
|
|
395
|
+
const e = Math.max(0, Math.floor((t - n) / 1e3));
|
|
396
|
+
return {
|
|
397
|
+
days: Math.floor(e / 86400),
|
|
398
|
+
hours: Math.floor(e % 86400 / 3600),
|
|
399
|
+
minutes: Math.floor(e % 3600 / 60),
|
|
400
|
+
seconds: e % 60
|
|
401
|
+
};
|
|
402
|
+
}, he = [401, 403, 404], ge = async (t, n, e, r) => {
|
|
403
|
+
const o = /* @__PURE__ */ new Map(), l = Hn(t);
|
|
404
|
+
if (!l) return o;
|
|
405
|
+
const u = async (c) => {
|
|
406
|
+
if (!c.length) return;
|
|
407
|
+
(await jn(
|
|
408
|
+
l,
|
|
409
|
+
c,
|
|
410
|
+
{
|
|
411
|
+
signal: e,
|
|
412
|
+
disableCache: r,
|
|
413
|
+
partial: !0
|
|
414
|
+
}
|
|
415
|
+
).catch(() => [])).forEach((p) => p.id && o.set(p.id, p));
|
|
416
|
+
};
|
|
417
|
+
await u(n.map((c) => c.entityId));
|
|
418
|
+
const m = n.filter((c) => c.kind === "player").map((c) => hn(o.get(c.entityId))).filter((c) => !!c && !o.has(c));
|
|
419
|
+
return await u(m), o;
|
|
420
|
+
}, be = (t) => {
|
|
421
|
+
var n;
|
|
422
|
+
return t != null && t.id ? ((n = t.optionIds) == null ? void 0 : n[0]) ?? t.optionId ?? null : null;
|
|
423
|
+
}, ye = (t) => {
|
|
424
|
+
var st, H;
|
|
425
|
+
const { entityId: n, sdk: e, language: r, userIsLoggedIn: o } = t, l = _n(), [u, m] = A("loading"), [c, f] = A(null), [p, h] = A(0), [F, B] = A(!1), [X, T] = A(!1), [U, $] = A(null), S = un(t.callbacks);
|
|
426
|
+
S.current = t.callbacks, ht(() => {
|
|
427
|
+
const C = new AbortController();
|
|
428
|
+
let x = !1;
|
|
429
|
+
return m("loading"), T(!1), (async () => {
|
|
430
|
+
let v;
|
|
431
|
+
try {
|
|
432
|
+
v = await e.voting.getPollById(n, l);
|
|
433
|
+
} catch (P) {
|
|
434
|
+
if (x) return;
|
|
435
|
+
m(
|
|
436
|
+
vt(P, e).code === 404 ? "notFound" : "error"
|
|
437
|
+
);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const w = v != null && v.id && (v.type ?? "").toLowerCase() === oe ? ae(v) : [];
|
|
441
|
+
if (w.length < 2) {
|
|
442
|
+
x || m("notFound");
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const D = v.authRequirement === "REGISTERED" && !o ? Promise.resolve(null) : e.voting.getMyPollVote(n).catch((P) => {
|
|
446
|
+
if (he.includes(vt(P, e).code))
|
|
447
|
+
return null;
|
|
448
|
+
throw P;
|
|
449
|
+
});
|
|
450
|
+
try {
|
|
451
|
+
const [P, et] = await Promise.all([
|
|
452
|
+
D,
|
|
453
|
+
ge(e, w, C.signal, l)
|
|
454
|
+
]);
|
|
455
|
+
if (x) return;
|
|
456
|
+
f({
|
|
457
|
+
poll: v,
|
|
458
|
+
refs: w,
|
|
459
|
+
entities: et,
|
|
460
|
+
votedOptionId: be(P)
|
|
461
|
+
}), m("ready");
|
|
462
|
+
} catch {
|
|
463
|
+
x || m("error");
|
|
464
|
+
}
|
|
465
|
+
})(), () => {
|
|
466
|
+
x = !0, C.abort();
|
|
467
|
+
};
|
|
468
|
+
}, [n, e, l, o, p]);
|
|
469
|
+
const it = q(
|
|
470
|
+
() => c ? pe(c.refs, c.entities, r, pn) : [],
|
|
471
|
+
[c, r]
|
|
472
|
+
), E = q(
|
|
473
|
+
() => c ? c.refs.map(
|
|
474
|
+
(C) => {
|
|
475
|
+
var x;
|
|
476
|
+
return ((x = c.poll.options.find((M) => M.id === C.optionId)) == null ? void 0 : x.votes) ?? 0;
|
|
477
|
+
}
|
|
478
|
+
) : [],
|
|
479
|
+
[c]
|
|
480
|
+
), z = qt(
|
|
481
|
+
async (C) => {
|
|
482
|
+
var x, M;
|
|
483
|
+
if (!(!c || F || c.votedOptionId)) {
|
|
484
|
+
B(!0);
|
|
485
|
+
try {
|
|
486
|
+
const v = await e.voting.voteForPoll(n, C);
|
|
487
|
+
f(
|
|
488
|
+
(w) => w && {
|
|
489
|
+
...w,
|
|
490
|
+
votedOptionId: C,
|
|
491
|
+
poll: {
|
|
492
|
+
...w.poll,
|
|
493
|
+
totalVotes: (w.poll.totalVotes ?? 0) + 1,
|
|
494
|
+
options: w.poll.options.map(
|
|
495
|
+
(N) => N.id === C ? { ...N, votes: (N.votes ?? 0) + 1 } : N
|
|
496
|
+
)
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
), (M = (x = S.current) == null ? void 0 : x.onFinish) == null || M.call(x, v);
|
|
500
|
+
} catch (v) {
|
|
501
|
+
const { code: w, message: N } = vt(v, e);
|
|
502
|
+
w === 401 || w === 403 ? T(!0) : $(N);
|
|
503
|
+
} finally {
|
|
504
|
+
B(!1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
[n, e, c, F]
|
|
509
|
+
), L = qt(() => {
|
|
510
|
+
e.voting.getPollById(n, l).then(
|
|
511
|
+
(C) => f(
|
|
512
|
+
(x) => x && (C != null && C.id) ? { ...x, poll: C } : x
|
|
513
|
+
)
|
|
514
|
+
).catch(() => {
|
|
515
|
+
});
|
|
516
|
+
}, [n, e, l]), O = (c == null ? void 0 : c.poll) ?? null;
|
|
517
|
+
return {
|
|
518
|
+
status: u,
|
|
519
|
+
poll: O,
|
|
520
|
+
sides: it,
|
|
521
|
+
votes: E,
|
|
522
|
+
votedOptionId: (c == null ? void 0 : c.votedOptionId) ?? null,
|
|
523
|
+
startMs: Qt((st = O == null ? void 0 : O.customFields) == null ? void 0 : st[ie]),
|
|
524
|
+
endMs: Qt((H = O == null ? void 0 : O.customFields) == null ? void 0 : H[re]),
|
|
525
|
+
signInRequired: X || (O == null ? void 0 : O.authRequirement) === "REGISTERED" && !o,
|
|
526
|
+
submitting: F,
|
|
527
|
+
voteError: U,
|
|
528
|
+
clearVoteError: () => $(null),
|
|
529
|
+
vote: z,
|
|
530
|
+
retry: () => h((C) => C + 1),
|
|
531
|
+
refresh: L
|
|
532
|
+
};
|
|
533
|
+
}, xe = (t) => {
|
|
534
|
+
const { t: n } = bt("common");
|
|
535
|
+
return q(
|
|
536
|
+
() => (e, r) => {
|
|
537
|
+
const o = t == null ? void 0 : t[e];
|
|
538
|
+
return typeof o == "string" && o.trim() ? o : n(`battleOfFans.${e}`, r ?? {});
|
|
539
|
+
},
|
|
540
|
+
[t, n]
|
|
541
|
+
);
|
|
542
|
+
}, ke = (t) => {
|
|
543
|
+
const [n, e] = A(() => Date.now()), r = t !== null && n >= t;
|
|
544
|
+
return ht(() => {
|
|
545
|
+
if (t === null || r) return;
|
|
546
|
+
const o = setInterval(() => e(Date.now()), 1e3);
|
|
547
|
+
return () => clearInterval(o);
|
|
548
|
+
}, [t, r]), n;
|
|
549
|
+
}, tn = (t) => {
|
|
550
|
+
const n = pn(t);
|
|
551
|
+
if (!n) return null;
|
|
552
|
+
const [e, r, o] = [1, 3, 5].map(
|
|
553
|
+
(c) => parseInt(n.slice(c, c + 2), 16) / 255
|
|
554
|
+
), l = Math.max(e, r, o), u = l - Math.min(e, r, o);
|
|
555
|
+
return u < 0.12 ? null : ((l === e ? (r - o) / u % 6 : l === r ? (o - e) / u + 2 : (e - r) / u + 4) * 60 + 360) % 360;
|
|
556
|
+
}, Q = (t, n) => {
|
|
557
|
+
if (!Ft(t, n)) return !0;
|
|
558
|
+
const e = tn(t), r = tn(n);
|
|
559
|
+
if (e === null || r === null) return (gt(t, n) ?? 1) < 2;
|
|
560
|
+
const o = Math.abs(e - r);
|
|
561
|
+
return Math.min(o, 360 - o) < 35;
|
|
562
|
+
}, Se = (t, n) => {
|
|
563
|
+
const e = [n.primary, n.text, ...n.extras], r = t.map(
|
|
564
|
+
(l) => l.filter((u) => Ft(u, n.surface))
|
|
565
|
+
), o = r.map(
|
|
566
|
+
(l, u) => l[0] ?? e[u % e.length]
|
|
567
|
+
);
|
|
568
|
+
for (let l = 1; l < o.length; l += 1) {
|
|
569
|
+
const u = o.slice(0, l);
|
|
570
|
+
if (!u.some((p) => Q(p, o[l]))) continue;
|
|
571
|
+
const m = r[l].slice(1).find((p) => !u.some((h) => Q(h, p)));
|
|
572
|
+
if (m) {
|
|
573
|
+
o[l] = m;
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
let c = !1;
|
|
577
|
+
for (let p = 0; p < l && !c; p += 1) {
|
|
578
|
+
if (!Q(o[p], o[l])) continue;
|
|
579
|
+
const h = r[p].slice(1).find(
|
|
580
|
+
(F) => o.slice(0, l + 1).every((B, X) => X === p || !Q(B, F))
|
|
581
|
+
);
|
|
582
|
+
h && (o[p] = h), c = !o.slice(0, l).some((F) => Q(F, o[l]));
|
|
583
|
+
}
|
|
584
|
+
if (c) continue;
|
|
585
|
+
const f = e.find((p) => !u.some((h) => Q(h, p)));
|
|
586
|
+
f && u.some((p) => !Ft(p, o[l])) && (o[l] = f);
|
|
587
|
+
}
|
|
588
|
+
return o;
|
|
589
|
+
}, gn = (t, n) => {
|
|
590
|
+
if ((gt(n.onPrimary, t) ?? 21) >= 4.5)
|
|
591
|
+
return n.onPrimary;
|
|
592
|
+
const e = [n.onPrimary, n.text, n.surface];
|
|
593
|
+
let r = e[0], o = -1;
|
|
594
|
+
for (const l of e) {
|
|
595
|
+
const u = gt(l, t) ?? -1;
|
|
596
|
+
u > o && (r = l, o = u);
|
|
597
|
+
}
|
|
598
|
+
return r;
|
|
599
|
+
}, Ie = (t, n, e = 3) => (gt(t, n.surface) ?? 21) >= e ? t : n.text, ve = (t, n) => Se(t, n).map((e) => ({
|
|
600
|
+
fill: e,
|
|
601
|
+
on: gn(e, n),
|
|
602
|
+
ink: Ie(e, n)
|
|
603
|
+
})), $e = (t, n, e) => Math.max(n, Math.min(e, t)), Ce = (t, n) => {
|
|
604
|
+
const e = t.length, r = 100 / e;
|
|
605
|
+
if (t.every((c) => c === 0)) return t.map(() => r);
|
|
606
|
+
const o = r * (n || e > 2 ? 0.8 : 0.6), l = t.map((c) => Math.max(c, o)), u = l.reduce((c, f) => c + f, 0) - 100, m = l.reduce((c, f) => c + (f - o), 0);
|
|
607
|
+
return l.map((c) => m > 0 ? c - (c - o) / m * u : r);
|
|
608
|
+
}, we = (t, n, e, r) => {
|
|
609
|
+
const o = t.length, l = e ? $e(t[n], r ? 60 : 56, r ? 68 : 74) : 64, u = 100 - l, c = t.filter((f, p) => p !== n).reduce((f, p) => f + p, 0);
|
|
610
|
+
return t.map((f, p) => p === n ? l : !e || c === 0 ? u / (o - 1) : f / c * u);
|
|
611
|
+
}, We = (t) => {
|
|
612
|
+
const n = [];
|
|
613
|
+
let e = 0;
|
|
614
|
+
for (let r = 0; r < t.length - 1; r += 1)
|
|
615
|
+
e += t[r], n.push(e);
|
|
616
|
+
return n;
|
|
617
|
+
}, Re = (t) => `${Math.round(t * 100) / 100}%`, Fe = (t, n, e, r) => {
|
|
618
|
+
const o = (h) => Re(r ? 100 - h : h), l = n === 0 ? null : t[n - 1], u = n === t.length ? null : t[n], m = o(l === null ? 0 : l + e), c = o(l === null ? 0 : l - e), f = o(u === null ? 100 : u + e), p = o(u === null ? 100 : u - e);
|
|
619
|
+
return `polygon(${m} 0, ${f} 0, ${p} 100%, ${c} 100%)`;
|
|
620
|
+
}, pt = "cubic-bezier(.2,.8,.2,1)", Ee = rt({ from: { clipPath: "var(--bof-from)" } }), Et = rt({ from: { opacity: 0, transform: "translateY(10px)" } }), Oe = rt({ to: { transform: "rotate(360deg)" } }), bn = rt({
|
|
621
|
+
"0%": { transform: "scale(.92)", opacity: 0 },
|
|
622
|
+
"60%": { transform: "scale(1.03)" },
|
|
623
|
+
"100%": { transform: "scale(1)", opacity: 1 }
|
|
624
|
+
}), V = { fontFamily: i.fontPrimary, fontWeight: 700 }, wt = ([t, n]) => ({
|
|
625
|
+
fontSize: `min(${s(t)}, 30cqi)`,
|
|
626
|
+
lineHeight: n / t
|
|
627
|
+
}), nn = (t) => ({
|
|
628
|
+
paddingInlineStart: `calc(${s(t)} + var(--bof-pad-start, 0%))`,
|
|
629
|
+
paddingInlineEnd: `calc(${s(t)} + var(--bof-pad-end, 0%))`
|
|
630
|
+
}), Wt = { overflowWrap: "anywhere", maxWidth: "100%" }, Rt = ([t, n]) => ({
|
|
631
|
+
fontSize: `min(${s(t)}, 18cqi)`,
|
|
632
|
+
lineHeight: n / t
|
|
633
|
+
}), mt = { unicodeBidi: "plaintext" }, ft = {
|
|
634
|
+
display: "-webkit-box",
|
|
635
|
+
WebkitLineClamp: 2,
|
|
636
|
+
WebkitBoxOrient: "vertical",
|
|
637
|
+
overflow: "hidden"
|
|
638
|
+
}, en = (t, n) => ({
|
|
639
|
+
boxSizing: "border-box",
|
|
640
|
+
height: s(t, n),
|
|
641
|
+
padding: `0 min(${s(20, n)}, 6cqi)`,
|
|
642
|
+
border: 0,
|
|
643
|
+
borderRadius: i.radiusSm,
|
|
644
|
+
display: "inline-flex",
|
|
645
|
+
alignItems: "center",
|
|
646
|
+
justifyContent: "center",
|
|
647
|
+
gap: s(8, n),
|
|
648
|
+
fontFamily: i.fontSecondary,
|
|
649
|
+
fontWeight: 700,
|
|
650
|
+
fontSize: s(n),
|
|
651
|
+
lineHeight: 1.2,
|
|
652
|
+
whiteSpace: "nowrap",
|
|
653
|
+
overflow: "hidden",
|
|
654
|
+
textOverflow: "ellipsis",
|
|
655
|
+
"& > span": { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" },
|
|
656
|
+
"&:focus-visible": {
|
|
657
|
+
outline: `2px solid ${i.focus}`,
|
|
658
|
+
outlineOffset: "2px"
|
|
659
|
+
}
|
|
660
|
+
}), yn = (t, n, e) => ({
|
|
661
|
+
vote: d(en(t, n), e, {
|
|
662
|
+
backgroundColor: i.fill,
|
|
663
|
+
color: i.on,
|
|
664
|
+
cursor: "pointer",
|
|
665
|
+
boxShadow: `0 ${s(8, n)} ${s(16, n)} -${s(8, n)} var(--bof-fill)`,
|
|
666
|
+
transition: "transform .15s ease, filter .15s ease",
|
|
667
|
+
"&:hover:not(:disabled)": {
|
|
668
|
+
transform: "translateY(-1px)",
|
|
669
|
+
filter: "brightness(1.08)"
|
|
670
|
+
},
|
|
671
|
+
"&:active:not(:disabled)": { transform: "translateY(0)" },
|
|
672
|
+
"&:disabled": { cursor: "default", opacity: 0.7 }
|
|
673
|
+
}),
|
|
674
|
+
thanks: d(en(t, n), e, {
|
|
675
|
+
padding: `0 ${s(12, n)}`,
|
|
676
|
+
border: `2px solid ${i.ink}`,
|
|
677
|
+
backgroundColor: i.surface,
|
|
678
|
+
color: i.ink,
|
|
679
|
+
animation: `${bn} .35s ease-out`
|
|
680
|
+
}),
|
|
681
|
+
icon: d({ fontSize: "1.25em", flexShrink: 0 })
|
|
682
|
+
}), Pe = (t) => {
|
|
683
|
+
const n = (l) => ({
|
|
684
|
+
display: "block",
|
|
685
|
+
width: `min(${s(l)}, 100%)`,
|
|
686
|
+
height: "auto",
|
|
687
|
+
aspectRatio: "1",
|
|
688
|
+
flexShrink: 0
|
|
689
|
+
}), e = (l, u) => d(n(l), {
|
|
690
|
+
boxSizing: "border-box",
|
|
691
|
+
borderRadius: "50%",
|
|
692
|
+
overflow: "hidden",
|
|
693
|
+
backgroundColor: i.surface,
|
|
694
|
+
border: u,
|
|
695
|
+
"& img": {
|
|
696
|
+
display: "block",
|
|
697
|
+
width: "100%",
|
|
698
|
+
height: "100%",
|
|
699
|
+
objectFit: "cover",
|
|
700
|
+
objectPosition: "top"
|
|
701
|
+
}
|
|
702
|
+
}), r = (l) => d({
|
|
703
|
+
flexShrink: 0,
|
|
704
|
+
width: `min(${s(l, l * 0.36)}, 100%)`,
|
|
705
|
+
aspectRatio: "1",
|
|
706
|
+
boxSizing: "border-box",
|
|
707
|
+
borderRadius: "50%",
|
|
708
|
+
display: "flex",
|
|
709
|
+
alignItems: "center",
|
|
710
|
+
justifyContent: "center",
|
|
711
|
+
fontSize: s(l * 0.36),
|
|
712
|
+
...V,
|
|
713
|
+
color: i.text,
|
|
714
|
+
backgroundColor: i.surface,
|
|
715
|
+
border: `${i.borderSize} solid ${i.border}`
|
|
716
|
+
}), o = (l, u) => d(n(l), { objectFit: "contain", filter: u });
|
|
717
|
+
return {
|
|
718
|
+
side: {
|
|
719
|
+
logo: o(t.img, ot.logo),
|
|
720
|
+
headshot: e(t.img, `${s(t.trophyRing)} solid ${i.fill}`),
|
|
721
|
+
initials: r(t.img)
|
|
722
|
+
},
|
|
723
|
+
winner: {
|
|
724
|
+
logo: o(t.winImg, ot.winnerLogo),
|
|
725
|
+
headshot: d(
|
|
726
|
+
e(t.winImg, `${s(t.trophyRing + 1)} solid ${i.on}`),
|
|
727
|
+
{ boxShadow: ot.winnerHeadshot }
|
|
728
|
+
),
|
|
729
|
+
initials: r(t.winImg)
|
|
730
|
+
},
|
|
731
|
+
loser: {
|
|
732
|
+
logo: o(t.loserImg),
|
|
733
|
+
headshot: e(t.loserImg, `2px solid ${i.fill}`),
|
|
734
|
+
initials: r(t.loserImg)
|
|
735
|
+
},
|
|
736
|
+
row: {
|
|
737
|
+
logo: o(44, ot.logo),
|
|
738
|
+
headshot: e(44, `2px solid ${i.fill}`),
|
|
739
|
+
initials: r(44)
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
}, Te = [
|
|
743
|
+
"top-left",
|
|
744
|
+
"top-right",
|
|
745
|
+
"bottom-left",
|
|
746
|
+
"bottom-right"
|
|
747
|
+
], xn = (t) => {
|
|
748
|
+
const n = {
|
|
749
|
+
position: "absolute",
|
|
750
|
+
width: s(t.trophy),
|
|
751
|
+
height: s(t.trophy),
|
|
752
|
+
boxSizing: "border-box",
|
|
753
|
+
borderRadius: "50%",
|
|
754
|
+
border: `${s(t.trophyRing)} solid ${i.on}`,
|
|
755
|
+
backgroundColor: i.trophy,
|
|
756
|
+
color: i.trophyOn,
|
|
757
|
+
boxShadow: ot.trophy,
|
|
758
|
+
display: "flex",
|
|
759
|
+
alignItems: "center",
|
|
760
|
+
justifyContent: "center",
|
|
761
|
+
fontSize: "1em",
|
|
762
|
+
animation: `${bn} .5s .55s ease-out both`
|
|
763
|
+
}, e = (o, l) => {
|
|
764
|
+
const [u, m] = o.split("-"), c = l ? m === "left" ? "right" : "left" : m;
|
|
765
|
+
return d(n, { [u]: s(-4), [c]: s(-4) });
|
|
766
|
+
}, r = {};
|
|
767
|
+
for (const o of Te)
|
|
768
|
+
r[`${o}|ltr`] = e(o, !1), r[`${o}|rtl`] = e(o, !0);
|
|
769
|
+
return { at: r, icon: d({ fontSize: s(t.trophy * 0.5) }) };
|
|
770
|
+
}, on = (t, n) => {
|
|
771
|
+
const e = (l) => d({
|
|
772
|
+
position: "relative",
|
|
773
|
+
height: s(l),
|
|
774
|
+
display: "flex",
|
|
775
|
+
overflow: "hidden",
|
|
776
|
+
borderRadius: i.radiusMd,
|
|
777
|
+
backgroundColor: i.inner
|
|
778
|
+
}), r = (l) => d({
|
|
779
|
+
position: "relative",
|
|
780
|
+
zIndex: 1,
|
|
781
|
+
minWidth: 0,
|
|
782
|
+
boxSizing: "border-box",
|
|
783
|
+
containerType: "inline-size",
|
|
784
|
+
paddingBlock: s(t.colPad[0]),
|
|
785
|
+
...nn(t.colPad[1]),
|
|
786
|
+
display: "flex",
|
|
787
|
+
flexDirection: "column",
|
|
788
|
+
alignItems: "center",
|
|
789
|
+
justifyContent: "center",
|
|
790
|
+
gap: s(l),
|
|
791
|
+
transition: `flex-basis .6s ${pt}`
|
|
792
|
+
}), o = n ? { width: "100%" } : { minWidth: `min(${s(180, t.btnFont)}, 100%)`, maxWidth: "100%" };
|
|
793
|
+
return {
|
|
794
|
+
bar: e(t.arenaBar),
|
|
795
|
+
fill: d(e(t.arenaFill), {
|
|
796
|
+
"--bof-tint": "14%",
|
|
797
|
+
".dark &": { "--bof-tint": "30%" }
|
|
798
|
+
}),
|
|
799
|
+
layer: d({
|
|
800
|
+
position: "absolute",
|
|
801
|
+
inset: 0,
|
|
802
|
+
backgroundColor: i.tint,
|
|
803
|
+
transition: `clip-path .6s ${pt}, background-color .3s`
|
|
804
|
+
}),
|
|
805
|
+
layerNeutral: d({
|
|
806
|
+
position: "absolute",
|
|
807
|
+
inset: 0,
|
|
808
|
+
backgroundColor: i.inner
|
|
809
|
+
}),
|
|
810
|
+
layerWinner: d({
|
|
811
|
+
position: "absolute",
|
|
812
|
+
inset: 0,
|
|
813
|
+
backgroundColor: i.fill,
|
|
814
|
+
animation: `${Ee} .9s ${pt} both`
|
|
815
|
+
}),
|
|
816
|
+
column: r(t.colGap),
|
|
817
|
+
columnFill: r(10),
|
|
818
|
+
imgSlot: d({
|
|
819
|
+
width: "100%",
|
|
820
|
+
height: s(t.imgSlot),
|
|
821
|
+
display: "flex",
|
|
822
|
+
alignItems: "center",
|
|
823
|
+
justifyContent: "center"
|
|
824
|
+
}),
|
|
825
|
+
nameBox: d(
|
|
826
|
+
n ? {
|
|
827
|
+
minHeight: s(40),
|
|
828
|
+
display: "flex",
|
|
829
|
+
alignItems: "center",
|
|
830
|
+
justifyContent: "center"
|
|
831
|
+
} : {}
|
|
832
|
+
),
|
|
833
|
+
name: d({
|
|
834
|
+
...V,
|
|
835
|
+
...Rt(t.name),
|
|
836
|
+
...mt,
|
|
837
|
+
...ft,
|
|
838
|
+
...Wt,
|
|
839
|
+
textAlign: "center",
|
|
840
|
+
textWrap: "balance"
|
|
841
|
+
}),
|
|
842
|
+
pct: d({
|
|
843
|
+
...V,
|
|
844
|
+
...wt(t.pctFill),
|
|
845
|
+
color: i.ink,
|
|
846
|
+
fontVariantNumeric: "tabular-nums"
|
|
847
|
+
}),
|
|
848
|
+
action: d({
|
|
849
|
+
width: "100%",
|
|
850
|
+
minHeight: s(t.btnH),
|
|
851
|
+
paddingTop: s(n ? 0 : 4),
|
|
852
|
+
display: "flex",
|
|
853
|
+
justifyContent: "center"
|
|
854
|
+
}),
|
|
855
|
+
actionFill: d({
|
|
856
|
+
width: "100%",
|
|
857
|
+
minHeight: s(t.btnH),
|
|
858
|
+
paddingTop: s(n ? 0 : 6),
|
|
859
|
+
display: "flex",
|
|
860
|
+
justifyContent: "center"
|
|
861
|
+
}),
|
|
862
|
+
...yn(t.btnH, t.btnFont, o),
|
|
863
|
+
// Winner panel
|
|
864
|
+
winColumn: d({
|
|
865
|
+
position: "relative",
|
|
866
|
+
zIndex: 1,
|
|
867
|
+
minWidth: 0,
|
|
868
|
+
boxSizing: "border-box",
|
|
869
|
+
containerType: "inline-size",
|
|
870
|
+
paddingBlock: s(n ? 12 : 24),
|
|
871
|
+
...nn(n ? 12 : 24),
|
|
872
|
+
transition: `flex-basis .6s ${pt}`,
|
|
873
|
+
display: "flex",
|
|
874
|
+
alignItems: "center",
|
|
875
|
+
justifyContent: "center"
|
|
876
|
+
}),
|
|
877
|
+
winContent: d({
|
|
878
|
+
maxWidth: "100%",
|
|
879
|
+
display: "flex",
|
|
880
|
+
flexDirection: n ? "column" : "row",
|
|
881
|
+
alignItems: "center",
|
|
882
|
+
gap: s(n ? 8 : 24),
|
|
883
|
+
textAlign: n ? "center" : "start",
|
|
884
|
+
color: i.on,
|
|
885
|
+
minWidth: 0,
|
|
886
|
+
animation: `${Et} .6s .25s ease-out both`
|
|
887
|
+
}),
|
|
888
|
+
winWrap: d({
|
|
889
|
+
position: "relative",
|
|
890
|
+
isolation: "isolate",
|
|
891
|
+
flexShrink: 0,
|
|
892
|
+
width: s(t.winWrap),
|
|
893
|
+
height: s(t.winWrap),
|
|
894
|
+
display: "flex",
|
|
895
|
+
alignItems: "center",
|
|
896
|
+
justifyContent: "center"
|
|
897
|
+
}),
|
|
898
|
+
rays: d({
|
|
899
|
+
position: "absolute",
|
|
900
|
+
inset: s(-(t.rays - t.winWrap) / 2),
|
|
901
|
+
zIndex: -1,
|
|
902
|
+
borderRadius: "50%",
|
|
903
|
+
pointerEvents: "none",
|
|
904
|
+
background: `repeating-conic-gradient(from 0deg, color-mix(in srgb, ${i.on} 12%, transparent) 0deg 9deg, transparent 9deg 18deg), radial-gradient(circle closest-side, color-mix(in srgb, ${i.on} 24%, transparent) 0%, transparent 72%)`,
|
|
905
|
+
maskImage: "radial-gradient(circle closest-side, #000 28%, transparent 100%)",
|
|
906
|
+
animation: `${Oe} 80s linear infinite`
|
|
907
|
+
}),
|
|
908
|
+
winText: d({
|
|
909
|
+
minWidth: 0,
|
|
910
|
+
display: "flex",
|
|
911
|
+
flexDirection: "column",
|
|
912
|
+
gap: s(2)
|
|
913
|
+
}),
|
|
914
|
+
eyebrow: d({
|
|
915
|
+
fontWeight: 700,
|
|
916
|
+
textTransform: "uppercase",
|
|
917
|
+
letterSpacing: "0.14em",
|
|
918
|
+
...I(t.eyebrow)
|
|
919
|
+
}),
|
|
920
|
+
winName: d({
|
|
921
|
+
...V,
|
|
922
|
+
...Rt(t.winName),
|
|
923
|
+
...mt,
|
|
924
|
+
...ft,
|
|
925
|
+
...Wt,
|
|
926
|
+
letterSpacing: "-0.01em",
|
|
927
|
+
textWrap: "balance"
|
|
928
|
+
}),
|
|
929
|
+
winPctRow: d(
|
|
930
|
+
n ? {
|
|
931
|
+
display: "flex",
|
|
932
|
+
flexDirection: "column",
|
|
933
|
+
alignItems: "center",
|
|
934
|
+
paddingTop: s(4)
|
|
935
|
+
} : {
|
|
936
|
+
display: "flex",
|
|
937
|
+
flexWrap: "wrap",
|
|
938
|
+
alignItems: "baseline",
|
|
939
|
+
columnGap: s(10),
|
|
940
|
+
paddingTop: s(4)
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
winPct: d({
|
|
944
|
+
...V,
|
|
945
|
+
...wt(t.winPct),
|
|
946
|
+
fontVariantNumeric: "tabular-nums"
|
|
947
|
+
}),
|
|
948
|
+
ofVotes: d({ fontWeight: 500, ...I([14, 20]) }),
|
|
949
|
+
loserContent: d({
|
|
950
|
+
maxWidth: "100%",
|
|
951
|
+
display: "flex",
|
|
952
|
+
flexDirection: "column",
|
|
953
|
+
alignItems: "center",
|
|
954
|
+
gap: s(6),
|
|
955
|
+
textAlign: "center",
|
|
956
|
+
minWidth: 0,
|
|
957
|
+
animation: `${Et} .6s .4s ease-out both`
|
|
958
|
+
}),
|
|
959
|
+
loserSlot: d({
|
|
960
|
+
width: "100%",
|
|
961
|
+
height: s(t.loserSlot),
|
|
962
|
+
display: "flex",
|
|
963
|
+
alignItems: "center",
|
|
964
|
+
justifyContent: "center",
|
|
965
|
+
filter: "grayscale(1) opacity(0.7)"
|
|
966
|
+
}),
|
|
967
|
+
loserName: d({
|
|
968
|
+
...V,
|
|
969
|
+
...Rt(t.loserName),
|
|
970
|
+
...mt,
|
|
971
|
+
...ft,
|
|
972
|
+
...Wt,
|
|
973
|
+
paddingTop: s(2),
|
|
974
|
+
textWrap: "balance"
|
|
975
|
+
}),
|
|
976
|
+
loserPct: d({
|
|
977
|
+
...V,
|
|
978
|
+
...wt(t.loserPct),
|
|
979
|
+
fontVariantNumeric: "tabular-nums"
|
|
980
|
+
}),
|
|
981
|
+
img: Pe(t),
|
|
982
|
+
trophy: xn(t)
|
|
983
|
+
};
|
|
984
|
+
}, Le = () => ({
|
|
985
|
+
shell: d({
|
|
986
|
+
display: "flex",
|
|
987
|
+
flexDirection: "column",
|
|
988
|
+
overflow: "hidden",
|
|
989
|
+
borderRadius: i.radiusMd,
|
|
990
|
+
backgroundColor: i.inner,
|
|
991
|
+
"--bof-tint": "10%",
|
|
992
|
+
".dark &": { "--bof-tint": "26%" }
|
|
993
|
+
}),
|
|
994
|
+
row: d({
|
|
995
|
+
position: "relative",
|
|
996
|
+
height: s($t),
|
|
997
|
+
boxSizing: "border-box",
|
|
998
|
+
padding: `0 ${s(12)}`,
|
|
999
|
+
display: "flex",
|
|
1000
|
+
alignItems: "center",
|
|
1001
|
+
gap: s(12),
|
|
1002
|
+
backgroundColor: i.tint
|
|
1003
|
+
}),
|
|
1004
|
+
rowNeutral: d({
|
|
1005
|
+
position: "relative",
|
|
1006
|
+
height: s($t),
|
|
1007
|
+
boxSizing: "border-box",
|
|
1008
|
+
padding: `0 ${s(12)}`,
|
|
1009
|
+
display: "flex",
|
|
1010
|
+
alignItems: "center",
|
|
1011
|
+
gap: s(12)
|
|
1012
|
+
}),
|
|
1013
|
+
rowWinner: d({
|
|
1014
|
+
position: "relative",
|
|
1015
|
+
height: s($t),
|
|
1016
|
+
boxSizing: "border-box",
|
|
1017
|
+
padding: `0 ${s(12)}`,
|
|
1018
|
+
display: "flex",
|
|
1019
|
+
alignItems: "center",
|
|
1020
|
+
gap: s(12),
|
|
1021
|
+
backgroundColor: i.fill,
|
|
1022
|
+
color: i.on,
|
|
1023
|
+
animation: `${Et} .6s ease-out both`
|
|
1024
|
+
}),
|
|
1025
|
+
greyed: d({ filter: "grayscale(1) opacity(0.7)", display: "flex" }),
|
|
1026
|
+
imgWrap: d({ position: "relative", display: "flex", flexShrink: 0 }),
|
|
1027
|
+
name: d({
|
|
1028
|
+
...V,
|
|
1029
|
+
...I([15, 20]),
|
|
1030
|
+
...mt,
|
|
1031
|
+
...ft,
|
|
1032
|
+
flex: 1,
|
|
1033
|
+
minWidth: 0
|
|
1034
|
+
}),
|
|
1035
|
+
pct: d({
|
|
1036
|
+
...V,
|
|
1037
|
+
...I([20, 24]),
|
|
1038
|
+
color: i.ink,
|
|
1039
|
+
fontVariantNumeric: "tabular-nums",
|
|
1040
|
+
flexShrink: 0
|
|
1041
|
+
}),
|
|
1042
|
+
pctOn: d({
|
|
1043
|
+
...V,
|
|
1044
|
+
...I([20, 24]),
|
|
1045
|
+
fontVariantNumeric: "tabular-nums",
|
|
1046
|
+
flexShrink: 0
|
|
1047
|
+
}),
|
|
1048
|
+
action: d({ width: s(104), flexShrink: 0, display: "flex" }),
|
|
1049
|
+
...yn(40, 14, { width: "100%" }),
|
|
1050
|
+
trophy: xn({ trophy: 22, trophyRing: 2 })
|
|
1051
|
+
}), g = { d: on(tt, !1), m: on(nt, !0) }, R = Le(), Z = ({ side: t, layout: n, variant: e, language: r }) => {
|
|
1052
|
+
const [o, l] = A(null), u = t.image && o !== t.image ? t.image : null;
|
|
1053
|
+
return t.kind === "player" ? /* @__PURE__ */ a("div", { css: g[n].img[e].headshot, "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
1054
|
+
"img",
|
|
1055
|
+
{
|
|
1056
|
+
src: u ?? Gn.playerPlaceholder,
|
|
1057
|
+
alt: "",
|
|
1058
|
+
loading: "lazy",
|
|
1059
|
+
decoding: "async",
|
|
1060
|
+
onError: () => u && l(u)
|
|
1061
|
+
}
|
|
1062
|
+
) }) : u ? /* @__PURE__ */ a(
|
|
1063
|
+
"img",
|
|
1064
|
+
{
|
|
1065
|
+
css: g[n].img[e].logo,
|
|
1066
|
+
src: u,
|
|
1067
|
+
alt: "",
|
|
1068
|
+
loading: "lazy",
|
|
1069
|
+
decoding: "async",
|
|
1070
|
+
onError: () => l(u)
|
|
1071
|
+
}
|
|
1072
|
+
) : /* @__PURE__ */ a("div", { css: g[n].img[e].initials, "aria-hidden": "true", children: qn(t.name, r) });
|
|
1073
|
+
}, kn = ({ position: t, layout: n, row: e }) => {
|
|
1074
|
+
const r = `${t}|${Pt() ? "rtl" : "ltr"}`;
|
|
1075
|
+
return /* @__PURE__ */ a(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
css: e ? R.trophy.at[r] : g[n].trophy.at[r],
|
|
1079
|
+
"aria-hidden": "true",
|
|
1080
|
+
children: /* @__PURE__ */ a(
|
|
1081
|
+
Qn,
|
|
1082
|
+
{
|
|
1083
|
+
css: e ? R.trophy.icon : g[n].trophy.icon
|
|
1084
|
+
}
|
|
1085
|
+
)
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
1088
|
+
}, Me = (t) => {
|
|
1089
|
+
if (t != null && t.onClick) return t.onClick;
|
|
1090
|
+
const n = t == null ? void 0 : t.url;
|
|
1091
|
+
if (n)
|
|
1092
|
+
return () => {
|
|
1093
|
+
((t == null ? void 0 : t.target) ?? "_self") === "_blank" ? window.open(n, "_blank") : window.location.href = n;
|
|
1094
|
+
};
|
|
1095
|
+
}, Sn = ({
|
|
1096
|
+
state: t,
|
|
1097
|
+
layout: n,
|
|
1098
|
+
row: e,
|
|
1099
|
+
labels: r,
|
|
1100
|
+
signInCTA: o,
|
|
1101
|
+
onVote: l
|
|
1102
|
+
}) => {
|
|
1103
|
+
if (t === "signIn") {
|
|
1104
|
+
if (o != null && o.component) return /* @__PURE__ */ a(Ot, { children: o.component });
|
|
1105
|
+
const u = Me(o);
|
|
1106
|
+
return /* @__PURE__ */ a(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
type: "button",
|
|
1110
|
+
css: e ? R.vote : g[n].vote,
|
|
1111
|
+
disabled: !u,
|
|
1112
|
+
onClick: u,
|
|
1113
|
+
children: /* @__PURE__ */ a("span", { children: (o == null ? void 0 : o.defaultLabel) || r.signIn })
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
return t === "chosen" ? /* @__PURE__ */ b("div", { css: e ? R.thanks : g[n].thanks, role: "status", children: [
|
|
1118
|
+
/* @__PURE__ */ a(Zn, { css: g.d.icon }),
|
|
1119
|
+
/* @__PURE__ */ a("span", { children: r.thankYou })
|
|
1120
|
+
] }) : t === "locked" ? null : /* @__PURE__ */ a(
|
|
1121
|
+
"button",
|
|
1122
|
+
{
|
|
1123
|
+
type: "button",
|
|
1124
|
+
css: e ? R.vote : g[n].vote,
|
|
1125
|
+
"aria-label": r.voteFor,
|
|
1126
|
+
disabled: t === "submitting" || t === "upcoming",
|
|
1127
|
+
onClick: l,
|
|
1128
|
+
children: /* @__PURE__ */ a("span", { children: r.vote })
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
}, _ = (t, n) => ({
|
|
1132
|
+
"--bof-fill": t.fill,
|
|
1133
|
+
"--bof-on": t.on,
|
|
1134
|
+
"--bof-ink": t.ink,
|
|
1135
|
+
...n ? { "--bof-from": n } : {}
|
|
1136
|
+
}), Tt = (t, n) => ({
|
|
1137
|
+
..._(t.colours[n]),
|
|
1138
|
+
flex: `0 0 ${t.widths[n]}%`,
|
|
1139
|
+
"--bof-pad-start": n > 0 ? `${t.slant}%` : "0%",
|
|
1140
|
+
"--bof-pad-end": n < t.sides.length - 1 ? `${t.slant}%` : "0%"
|
|
1141
|
+
}), In = (t, n) => ({
|
|
1142
|
+
vote: t.label("vote"),
|
|
1143
|
+
voteFor: t.label("voteFor", { name: n.name }),
|
|
1144
|
+
thankYou: t.label("thankYou"),
|
|
1145
|
+
signIn: t.label("signIn")
|
|
1146
|
+
}), Ne = ({ view: t }) => /* @__PURE__ */ a("div", { css: R.shell, role: "group", "aria-label": t.splitLabel ?? void 0, children: t.sides.map((n, e) => {
|
|
1147
|
+
const r = t.winner === e, o = t.winner !== null && !r, l = /* @__PURE__ */ a(
|
|
1148
|
+
Z,
|
|
1149
|
+
{
|
|
1150
|
+
side: n,
|
|
1151
|
+
layout: "m",
|
|
1152
|
+
variant: "row",
|
|
1153
|
+
language: t.language
|
|
1154
|
+
}
|
|
1155
|
+
);
|
|
1156
|
+
return /* @__PURE__ */ b(
|
|
1157
|
+
"div",
|
|
1158
|
+
{
|
|
1159
|
+
css: r ? R.rowWinner : t.lit[e] && !o ? R.row : R.rowNeutral,
|
|
1160
|
+
style: _(t.colours[e]),
|
|
1161
|
+
children: [
|
|
1162
|
+
/* @__PURE__ */ b("div", { css: R.imgWrap, children: [
|
|
1163
|
+
o ? /* @__PURE__ */ a("div", { css: R.greyed, children: l }) : l,
|
|
1164
|
+
r && t.showTrophy && /* @__PURE__ */ a(kn, { position: t.trophyPosition, layout: "m", row: !0 })
|
|
1165
|
+
] }),
|
|
1166
|
+
/* @__PURE__ */ a("div", { css: R.name, children: n.name }),
|
|
1167
|
+
t.fill && t.percents[e] !== null && /* @__PURE__ */ a("div", { css: r ? R.pctOn : R.pct, children: t.percents[e] }),
|
|
1168
|
+
!t.ended && /* @__PURE__ */ a("div", { css: R.action, children: /* @__PURE__ */ a(
|
|
1169
|
+
Sn,
|
|
1170
|
+
{
|
|
1171
|
+
state: t.actions[e],
|
|
1172
|
+
layout: "m",
|
|
1173
|
+
row: !0,
|
|
1174
|
+
labels: In(t, n),
|
|
1175
|
+
signInCTA: t.signInCTA,
|
|
1176
|
+
onVote: () => t.onVote(e)
|
|
1177
|
+
}
|
|
1178
|
+
) })
|
|
1179
|
+
]
|
|
1180
|
+
},
|
|
1181
|
+
n.optionId
|
|
1182
|
+
);
|
|
1183
|
+
}) }), De = ({
|
|
1184
|
+
view: t,
|
|
1185
|
+
index: n
|
|
1186
|
+
}) => {
|
|
1187
|
+
const e = t.sides[n];
|
|
1188
|
+
return /* @__PURE__ */ a("div", { css: g[t.layout].winColumn, style: Tt(t, n), children: /* @__PURE__ */ b("div", { css: g[t.layout].winContent, children: [
|
|
1189
|
+
/* @__PURE__ */ b("div", { css: g[t.layout].winWrap, children: [
|
|
1190
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].rays, "aria-hidden": "true" }),
|
|
1191
|
+
/* @__PURE__ */ a(
|
|
1192
|
+
Z,
|
|
1193
|
+
{
|
|
1194
|
+
side: e,
|
|
1195
|
+
layout: t.layout,
|
|
1196
|
+
variant: "winner",
|
|
1197
|
+
language: t.language
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
t.showTrophy && /* @__PURE__ */ a(
|
|
1201
|
+
kn,
|
|
1202
|
+
{
|
|
1203
|
+
position: t.trophyPosition,
|
|
1204
|
+
layout: t.layout,
|
|
1205
|
+
row: !1
|
|
1206
|
+
}
|
|
1207
|
+
)
|
|
1208
|
+
] }),
|
|
1209
|
+
/* @__PURE__ */ b("div", { css: g[t.layout].winText, children: [
|
|
1210
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].eyebrow, children: t.label("winner") }),
|
|
1211
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].winName, children: e.name }),
|
|
1212
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ b("div", { css: g[t.layout].winPctRow, children: [
|
|
1213
|
+
/* @__PURE__ */ a("span", { css: g[t.layout].winPct, children: t.percents[n] }),
|
|
1214
|
+
/* @__PURE__ */ a("span", { css: g[t.layout].ofVotes, children: t.label("ofTheVotes") })
|
|
1215
|
+
] })
|
|
1216
|
+
] })
|
|
1217
|
+
] }) });
|
|
1218
|
+
}, Be = ({
|
|
1219
|
+
view: t,
|
|
1220
|
+
index: n
|
|
1221
|
+
}) => {
|
|
1222
|
+
const e = t.sides[n];
|
|
1223
|
+
return /* @__PURE__ */ a("div", { css: g[t.layout].winColumn, style: Tt(t, n), children: /* @__PURE__ */ b("div", { css: g[t.layout].loserContent, children: [
|
|
1224
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].loserSlot, children: /* @__PURE__ */ a(
|
|
1225
|
+
Z,
|
|
1226
|
+
{
|
|
1227
|
+
side: e,
|
|
1228
|
+
layout: t.layout,
|
|
1229
|
+
variant: "loser",
|
|
1230
|
+
language: t.language
|
|
1231
|
+
}
|
|
1232
|
+
) }),
|
|
1233
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].loserName, children: e.name }),
|
|
1234
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ a("div", { css: g[t.layout].loserPct, children: t.percents[n] })
|
|
1235
|
+
] }) });
|
|
1236
|
+
}, ze = ({
|
|
1237
|
+
view: t,
|
|
1238
|
+
index: n
|
|
1239
|
+
}) => {
|
|
1240
|
+
const e = t.sides[n];
|
|
1241
|
+
return /* @__PURE__ */ b(
|
|
1242
|
+
"div",
|
|
1243
|
+
{
|
|
1244
|
+
css: t.fill ? g[t.layout].columnFill : g[t.layout].column,
|
|
1245
|
+
style: Tt(t, n),
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].imgSlot, children: /* @__PURE__ */ a(
|
|
1248
|
+
Z,
|
|
1249
|
+
{
|
|
1250
|
+
side: e,
|
|
1251
|
+
layout: t.layout,
|
|
1252
|
+
variant: "side",
|
|
1253
|
+
language: t.language
|
|
1254
|
+
}
|
|
1255
|
+
) }),
|
|
1256
|
+
/* @__PURE__ */ a("div", { css: g[t.layout].nameBox, children: /* @__PURE__ */ a("div", { css: g[t.layout].name, children: e.name }) }),
|
|
1257
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ a("div", { css: g[t.layout].pct, children: t.percents[n] }),
|
|
1258
|
+
!t.ended && /* @__PURE__ */ a(
|
|
1259
|
+
"div",
|
|
1260
|
+
{
|
|
1261
|
+
css: t.fill ? g[t.layout].actionFill : g[t.layout].action,
|
|
1262
|
+
children: /* @__PURE__ */ a(
|
|
1263
|
+
Sn,
|
|
1264
|
+
{
|
|
1265
|
+
state: t.actions[n],
|
|
1266
|
+
layout: t.layout,
|
|
1267
|
+
row: !1,
|
|
1268
|
+
labels: In(t, e),
|
|
1269
|
+
signInCTA: t.signInCTA,
|
|
1270
|
+
onVote: () => t.onVote(n)
|
|
1271
|
+
}
|
|
1272
|
+
)
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
]
|
|
1276
|
+
}
|
|
1277
|
+
);
|
|
1278
|
+
}, Ae = ({ view: t }) => {
|
|
1279
|
+
if (t.rows) return /* @__PURE__ */ a(Ne, { view: t });
|
|
1280
|
+
const n = t.winner;
|
|
1281
|
+
return /* @__PURE__ */ b(
|
|
1282
|
+
"div",
|
|
1283
|
+
{
|
|
1284
|
+
css: t.fill ? g[t.layout].fill : g[t.layout].bar,
|
|
1285
|
+
role: "group",
|
|
1286
|
+
"aria-label": t.splitLabel ?? void 0,
|
|
1287
|
+
children: [
|
|
1288
|
+
n !== null ? /* @__PURE__ */ a(
|
|
1289
|
+
"div",
|
|
1290
|
+
{
|
|
1291
|
+
css: g[t.layout].layerWinner,
|
|
1292
|
+
"aria-hidden": "true",
|
|
1293
|
+
style: {
|
|
1294
|
+
..._(t.colours[n], t.evenClips[n]),
|
|
1295
|
+
clipPath: t.clips[n]
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
"winner"
|
|
1299
|
+
) : t.sides.map((e, r) => /* @__PURE__ */ a(
|
|
1300
|
+
"div",
|
|
1301
|
+
{
|
|
1302
|
+
css: t.lit[r] ? g[t.layout].layer : g[t.layout].layerNeutral,
|
|
1303
|
+
"aria-hidden": "true",
|
|
1304
|
+
style: { ..._(t.colours[r]), clipPath: t.clips[r] }
|
|
1305
|
+
},
|
|
1306
|
+
e.optionId
|
|
1307
|
+
)),
|
|
1308
|
+
t.sides.map(
|
|
1309
|
+
(e, r) => n === null ? /* @__PURE__ */ a(ze, { view: t, index: r }, e.optionId) : r === n ? /* @__PURE__ */ a(De, { view: t, index: r }, e.optionId) : /* @__PURE__ */ a(Be, { view: t, index: r }, e.optionId)
|
|
1310
|
+
)
|
|
1311
|
+
]
|
|
1312
|
+
}
|
|
1313
|
+
);
|
|
1314
|
+
}, Ve = ({ layout: t, label: n, caption: e, left: r }) => {
|
|
1315
|
+
const o = mn(), l = q(
|
|
1316
|
+
() => new Intl.NumberFormat(o, {
|
|
1317
|
+
minimumIntegerDigits: 2,
|
|
1318
|
+
useGrouping: !1
|
|
1319
|
+
}),
|
|
1320
|
+
[o]
|
|
1321
|
+
), u = [
|
|
1322
|
+
{ value: r.days, caption: n("days") },
|
|
1323
|
+
{ value: r.hours, caption: n("hours") },
|
|
1324
|
+
{ value: r.minutes, caption: n("minutes") },
|
|
1325
|
+
{ value: r.seconds, caption: n("seconds") }
|
|
1326
|
+
];
|
|
1327
|
+
return /* @__PURE__ */ b("div", { css: Y[t].root, children: [
|
|
1328
|
+
/* @__PURE__ */ a("div", { css: Y[t].label, children: e }),
|
|
1329
|
+
/* @__PURE__ */ a("div", { css: Y[t].units, children: u.map((m, c) => /* @__PURE__ */ b(dn.Fragment, { children: [
|
|
1330
|
+
t === "d" && c > 0 && /* @__PURE__ */ a("div", { css: Y.d.colon, "aria-hidden": "true", children: ":" }),
|
|
1331
|
+
/* @__PURE__ */ b("div", { css: Y[t].unit, children: [
|
|
1332
|
+
/* @__PURE__ */ a("div", { css: Y[t].value, children: l.format(m.value) }),
|
|
1333
|
+
/* @__PURE__ */ a("div", { css: Y[t].caption, children: m.caption })
|
|
1334
|
+
] })
|
|
1335
|
+
] }, c)) })
|
|
1336
|
+
] });
|
|
1337
|
+
}, _e = ({
|
|
1338
|
+
layout: t,
|
|
1339
|
+
label: n,
|
|
1340
|
+
title: e,
|
|
1341
|
+
openSubtitle: r,
|
|
1342
|
+
ended: o,
|
|
1343
|
+
draw: l,
|
|
1344
|
+
upcoming: u,
|
|
1345
|
+
left: m
|
|
1346
|
+
}) => {
|
|
1347
|
+
const c = [
|
|
1348
|
+
{ key: "open", text: r, on: !o },
|
|
1349
|
+
{ key: "ended", text: n("endedSubtitle"), on: o && !l },
|
|
1350
|
+
{ key: "draw", text: n("drawSubtitle"), on: o && l }
|
|
1351
|
+
], f = o ? /* @__PURE__ */ a("div", { css: y[t].pill, children: n("votingEnded") }) : m ? /* @__PURE__ */ a(
|
|
1352
|
+
Ve,
|
|
1353
|
+
{
|
|
1354
|
+
layout: t,
|
|
1355
|
+
label: n,
|
|
1356
|
+
caption: n(u ? "votingStartsIn" : "votingEndsIn"),
|
|
1357
|
+
left: m
|
|
1358
|
+
}
|
|
1359
|
+
) : u ? /* @__PURE__ */ a("div", { css: y[t].pill, children: n("votingStartsSoon") }) : null;
|
|
1360
|
+
return /* @__PURE__ */ b("div", { css: y[t].header, children: [
|
|
1361
|
+
/* @__PURE__ */ b("div", { css: y[t].titles, children: [
|
|
1362
|
+
/* @__PURE__ */ a("h2", { css: y[t].title, children: e }),
|
|
1363
|
+
/* @__PURE__ */ a("div", { css: y[t].subtitles, children: c.map((p) => /* @__PURE__ */ a(
|
|
1364
|
+
"p",
|
|
1365
|
+
{
|
|
1366
|
+
css: p.on ? y[t].subtitle : y[t].subtitleHidden,
|
|
1367
|
+
"aria-hidden": !p.on,
|
|
1368
|
+
children: p.text
|
|
1369
|
+
},
|
|
1370
|
+
p.key
|
|
1371
|
+
)) })
|
|
1372
|
+
] }),
|
|
1373
|
+
t === "m" ? f && /* @__PURE__ */ a("div", { css: y.m.status, children: f }) : f
|
|
1374
|
+
] });
|
|
1375
|
+
}, rn = (t) => ({
|
|
1376
|
+
fontSize: "1em",
|
|
1377
|
+
display: "flex",
|
|
1378
|
+
flexDirection: "column",
|
|
1379
|
+
alignItems: "center",
|
|
1380
|
+
gap: t ? i.spaceMd : i.spaceLg,
|
|
1381
|
+
padding: t ? i.spaceMd : `${s(32)} ${i.spaceLg}`,
|
|
1382
|
+
borderRadius: i.radiusMd
|
|
1383
|
+
}), sn = (t) => d({
|
|
1384
|
+
flexShrink: 0,
|
|
1385
|
+
width: "2px",
|
|
1386
|
+
height: s(32),
|
|
1387
|
+
backgroundColor: i.border,
|
|
1388
|
+
transform: `skewX(${t ? 14 : -14}deg)`
|
|
1389
|
+
}), an = (t) => ({
|
|
1390
|
+
panel: d(rn(t), { backgroundColor: i.inner }),
|
|
1391
|
+
// "after": the panel takes the picked side's tint.
|
|
1392
|
+
panelPicked: d(rn(t), { backgroundColor: i.tint }),
|
|
1393
|
+
intro: d({
|
|
1394
|
+
display: "flex",
|
|
1395
|
+
flexDirection: "column",
|
|
1396
|
+
alignItems: "center",
|
|
1397
|
+
gap: s(t ? 10 : 12),
|
|
1398
|
+
width: "100%",
|
|
1399
|
+
maxWidth: s(560),
|
|
1400
|
+
minWidth: 0,
|
|
1401
|
+
textAlign: "center"
|
|
1402
|
+
}),
|
|
1403
|
+
sides: d({
|
|
1404
|
+
display: "flex",
|
|
1405
|
+
justifyContent: "center",
|
|
1406
|
+
alignItems: "center",
|
|
1407
|
+
flexWrap: "wrap",
|
|
1408
|
+
gap: s(12)
|
|
1409
|
+
}),
|
|
1410
|
+
pick: d({
|
|
1411
|
+
display: "flex",
|
|
1412
|
+
justifyContent: "center",
|
|
1413
|
+
alignItems: "center",
|
|
1414
|
+
gap: s(12),
|
|
1415
|
+
minWidth: 0
|
|
1416
|
+
}),
|
|
1417
|
+
pickName: d({
|
|
1418
|
+
margin: 0,
|
|
1419
|
+
minWidth: 0,
|
|
1420
|
+
overflowWrap: "anywhere",
|
|
1421
|
+
fontFamily: i.fontPrimary,
|
|
1422
|
+
fontWeight: 700,
|
|
1423
|
+
color: i.ink,
|
|
1424
|
+
unicodeBidi: "plaintext",
|
|
1425
|
+
...I(t ? [18, 24] : [20, 26])
|
|
1426
|
+
}),
|
|
1427
|
+
// Lead title and description come from the poll's CMS labels.
|
|
1428
|
+
title: d({
|
|
1429
|
+
margin: 0,
|
|
1430
|
+
fontFamily: i.fontPrimary,
|
|
1431
|
+
fontWeight: 700,
|
|
1432
|
+
letterSpacing: "-0.01em",
|
|
1433
|
+
color: i.text,
|
|
1434
|
+
unicodeBidi: "plaintext",
|
|
1435
|
+
...I(t ? [18, 24] : [22, 28])
|
|
1436
|
+
}),
|
|
1437
|
+
description: d({
|
|
1438
|
+
margin: 0,
|
|
1439
|
+
color: i.dim,
|
|
1440
|
+
unicodeBidi: "plaintext",
|
|
1441
|
+
...I([14, 20])
|
|
1442
|
+
}),
|
|
1443
|
+
form: d({
|
|
1444
|
+
fontSize: "1em",
|
|
1445
|
+
width: "100%",
|
|
1446
|
+
maxWidth: s(480),
|
|
1447
|
+
minWidth: 0,
|
|
1448
|
+
boxSizing: "border-box",
|
|
1449
|
+
padding: t ? i.spaceMd : i.spaceLg,
|
|
1450
|
+
borderRadius: i.radiusSm,
|
|
1451
|
+
backgroundColor: i.surface,
|
|
1452
|
+
border: `${i.borderSize} solid ${i.border}`
|
|
1453
|
+
})
|
|
1454
|
+
}), j = { d: an(!1), m: an(!0) }, He = { ltr: sn(!1), rtl: sn(!0) }, je = (t) => {
|
|
1455
|
+
var h;
|
|
1456
|
+
const { layout: n, poll: e, sides: r, colours: o, picked: l } = t, { t: u } = bt("common"), m = Pt(), c = l !== null ? r[l] : null, f = e.labels, p = c ? /* @__PURE__ */ b("div", { css: j[n].pick, children: [
|
|
1457
|
+
/* @__PURE__ */ a(
|
|
1458
|
+
Z,
|
|
1459
|
+
{
|
|
1460
|
+
side: c,
|
|
1461
|
+
layout: n,
|
|
1462
|
+
variant: "row",
|
|
1463
|
+
language: t.language
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ a("p", { css: j[n].pickName, children: c.name })
|
|
1467
|
+
] }) : /* @__PURE__ */ a("div", { css: j[n].sides, "aria-hidden": "true", children: r.map((F, B) => /* @__PURE__ */ b(dn.Fragment, { children: [
|
|
1468
|
+
B > 0 && /* @__PURE__ */ a("span", { css: He[m ? "rtl" : "ltr"] }),
|
|
1469
|
+
/* @__PURE__ */ a("span", { style: _(o[B]), children: /* @__PURE__ */ a(
|
|
1470
|
+
Z,
|
|
1471
|
+
{
|
|
1472
|
+
side: F,
|
|
1473
|
+
layout: n,
|
|
1474
|
+
variant: "row",
|
|
1475
|
+
language: t.language
|
|
1476
|
+
}
|
|
1477
|
+
) })
|
|
1478
|
+
] }, F.optionId)) });
|
|
1479
|
+
return /* @__PURE__ */ b(
|
|
1480
|
+
"div",
|
|
1481
|
+
{
|
|
1482
|
+
css: c ? j[n].panelPicked : j[n].panel,
|
|
1483
|
+
style: l !== null ? {
|
|
1484
|
+
..._(o[l]),
|
|
1485
|
+
"--fu-ucrc-primary-on-primary": o[l].on
|
|
1486
|
+
} : void 0,
|
|
1487
|
+
children: [
|
|
1488
|
+
/* @__PURE__ */ b("div", { css: j[n].intro, children: [
|
|
1489
|
+
p,
|
|
1490
|
+
/* @__PURE__ */ a("h3", { css: j[n].title, children: (f == null ? void 0 : f.leadTitle) || u("leads.header.title") }),
|
|
1491
|
+
/* @__PURE__ */ a("p", { css: j[n].description, children: (f == null ? void 0 : f.leadDescription) || u("leads.header.description") })
|
|
1492
|
+
] }),
|
|
1493
|
+
/* @__PURE__ */ a("div", { css: j[n].form, children: /* @__PURE__ */ a(
|
|
1494
|
+
zn,
|
|
1495
|
+
{
|
|
1496
|
+
sdk: t.sdk,
|
|
1497
|
+
brandingColors: c ? { primaryColor: o[l].fill } : void 0,
|
|
1498
|
+
brandingUrls: (h = e.branding) == null ? void 0 : h.urls,
|
|
1499
|
+
fields: t.leads.fields,
|
|
1500
|
+
campaignId: t.leads.campaignId,
|
|
1501
|
+
campaignName: t.leads.campaignName,
|
|
1502
|
+
contentType: "poll",
|
|
1503
|
+
contentId: e.id,
|
|
1504
|
+
contentName: e.title,
|
|
1505
|
+
syncWithProfile: t.leads.syncWithProfile,
|
|
1506
|
+
labels: {
|
|
1507
|
+
submitButtonLabel: (f == null ? void 0 : f.leadCta) || u("leads.buttons.submit"),
|
|
1508
|
+
successTitle: (f == null ? void 0 : f.leadSuccessTitle) || u("leads.success.title"),
|
|
1509
|
+
successDescription: (f == null ? void 0 : f.leadSuccessDescription) || u("leads.success.description")
|
|
1510
|
+
},
|
|
1511
|
+
onSuccessCta: {
|
|
1512
|
+
defaultLabel: t.continueLabel,
|
|
1513
|
+
onClick: t.onContinue
|
|
1514
|
+
},
|
|
1515
|
+
isSubmittingParticipation: t.submitting
|
|
1516
|
+
}
|
|
1517
|
+
) })
|
|
1518
|
+
]
|
|
1519
|
+
}
|
|
1520
|
+
);
|
|
1521
|
+
}, ln = (t) => {
|
|
1522
|
+
const n = {
|
|
1523
|
+
flex: 1,
|
|
1524
|
+
fontFamily: i.fontPrimary,
|
|
1525
|
+
fontWeight: 700,
|
|
1526
|
+
fontVariantNumeric: "tabular-nums",
|
|
1527
|
+
...I(t.pctBar)
|
|
1528
|
+
}, e = (l) => d({
|
|
1529
|
+
minWidth: s(t.bar),
|
|
1530
|
+
backgroundColor: i.fill,
|
|
1531
|
+
borderRadius: l,
|
|
1532
|
+
transition: "flex-grow .6s cubic-bezier(.2,.8,.2,1)"
|
|
1533
|
+
}), r = i.radiusFull, o = s(3);
|
|
1534
|
+
return {
|
|
1535
|
+
root: d({
|
|
1536
|
+
display: "flex",
|
|
1537
|
+
flexDirection: "column",
|
|
1538
|
+
gap: s(t.barGap === 4 ? 10 : 8)
|
|
1539
|
+
}),
|
|
1540
|
+
labels: d({
|
|
1541
|
+
display: "flex",
|
|
1542
|
+
alignItems: "center",
|
|
1543
|
+
gap: s(t.labelsGap),
|
|
1544
|
+
minHeight: s(t.pctBar[1])
|
|
1545
|
+
}),
|
|
1546
|
+
pct: d(n, { color: i.ink }),
|
|
1547
|
+
pctEnd: d(n, { color: i.ink, textAlign: "end" }),
|
|
1548
|
+
// 3+ sides: one label per segment, sized like it.
|
|
1549
|
+
cell: d(n, {
|
|
1550
|
+
minWidth: s(t.bar),
|
|
1551
|
+
color: i.ink,
|
|
1552
|
+
overflow: "hidden",
|
|
1553
|
+
whiteSpace: "nowrap"
|
|
1554
|
+
}),
|
|
1555
|
+
caption: d({
|
|
1556
|
+
fontWeight: 500,
|
|
1557
|
+
textTransform: "uppercase",
|
|
1558
|
+
letterSpacing: "0.05em",
|
|
1559
|
+
whiteSpace: "nowrap",
|
|
1560
|
+
color: i.dim,
|
|
1561
|
+
...I(t.caption)
|
|
1562
|
+
}),
|
|
1563
|
+
bar: d({ display: "flex", gap: s(t.barGap), height: s(t.bar) }),
|
|
1564
|
+
segFirst: e(`${r} ${o} ${o} ${r}`),
|
|
1565
|
+
segLast: e(`${o} ${r} ${r} ${o}`),
|
|
1566
|
+
segMid: e(o),
|
|
1567
|
+
lock: d({
|
|
1568
|
+
display: "flex",
|
|
1569
|
+
alignItems: "center",
|
|
1570
|
+
justifyContent: "center",
|
|
1571
|
+
gap: s(8, 14),
|
|
1572
|
+
minHeight: s(t.pctBar[1], 14),
|
|
1573
|
+
fontWeight: 500,
|
|
1574
|
+
color: i.dim,
|
|
1575
|
+
...I([14, 20])
|
|
1576
|
+
}),
|
|
1577
|
+
lockIcon: d({ fontSize: s(18, 14), flexShrink: 0 }),
|
|
1578
|
+
track: d({
|
|
1579
|
+
height: s(t.bar),
|
|
1580
|
+
borderRadius: i.radiusFull,
|
|
1581
|
+
backgroundColor: i.track
|
|
1582
|
+
})
|
|
1583
|
+
};
|
|
1584
|
+
}, W = { d: ln(tt), m: ln(nt) }, Ge = ({
|
|
1585
|
+
layout: t,
|
|
1586
|
+
label: n,
|
|
1587
|
+
colours: e,
|
|
1588
|
+
shares: r,
|
|
1589
|
+
percents: o,
|
|
1590
|
+
ended: l,
|
|
1591
|
+
splitLabel: u
|
|
1592
|
+
}) => {
|
|
1593
|
+
if (o.some((p) => p === null))
|
|
1594
|
+
return /* @__PURE__ */ b("div", { css: W[t].root, children: [
|
|
1595
|
+
/* @__PURE__ */ b("div", { css: W[t].lock, children: [
|
|
1596
|
+
/* @__PURE__ */ a(te, { css: W[t].lockIcon }),
|
|
1597
|
+
/* @__PURE__ */ a("span", { children: n("voteToSeeResults") })
|
|
1598
|
+
] }),
|
|
1599
|
+
/* @__PURE__ */ a("div", { css: W[t].track, "aria-hidden": "true" })
|
|
1600
|
+
] });
|
|
1601
|
+
const m = r.length, c = r.every((p) => p === 0) ? r.map(() => 1) : r, f = m - 1;
|
|
1602
|
+
return /* @__PURE__ */ b("div", { css: W[t].root, children: [
|
|
1603
|
+
m === 2 ? /* @__PURE__ */ b("div", { css: W[t].labels, children: [
|
|
1604
|
+
/* @__PURE__ */ a("div", { css: W[t].pct, style: _(e[0]), children: o[0] }),
|
|
1605
|
+
l && /* @__PURE__ */ a("div", { css: W[t].caption, children: n("finalResult") }),
|
|
1606
|
+
/* @__PURE__ */ a("div", { css: W[t].pctEnd, style: _(e[1]), children: o[1] })
|
|
1607
|
+
] }) : /* @__PURE__ */ a("div", { css: W[t].labels, children: o.map((p, h) => /* @__PURE__ */ a(
|
|
1608
|
+
"div",
|
|
1609
|
+
{
|
|
1610
|
+
css: W[t].cell,
|
|
1611
|
+
style: { ..._(e[h]), flex: `${c[h]} 1 0%` },
|
|
1612
|
+
children: p
|
|
1613
|
+
},
|
|
1614
|
+
h
|
|
1615
|
+
)) }),
|
|
1616
|
+
/* @__PURE__ */ a(
|
|
1617
|
+
"div",
|
|
1618
|
+
{
|
|
1619
|
+
css: W[t].bar,
|
|
1620
|
+
role: "img",
|
|
1621
|
+
"aria-label": u ?? void 0,
|
|
1622
|
+
children: e.map((p, h) => /* @__PURE__ */ a(
|
|
1623
|
+
"div",
|
|
1624
|
+
{
|
|
1625
|
+
css: h === 0 ? W[t].segFirst : h === f ? W[t].segLast : W[t].segMid,
|
|
1626
|
+
style: { ..._(p), flex: `${c[h]} 1 0%` }
|
|
1627
|
+
},
|
|
1628
|
+
h
|
|
1629
|
+
))
|
|
1630
|
+
}
|
|
1631
|
+
)
|
|
1632
|
+
] });
|
|
1633
|
+
}, qe = { d: s(90), m: s(120) }, vn = { d: s(tt.arenaFill), m: s(nt.arenaFill) }, Ue = { d: s(tt.arenaBar), m: s(nt.arenaBar) }, Ye = ({ layout: t, fill: n, odds: e }) => /* @__PURE__ */ b("div", { css: y[t].root, "aria-busy": "true", children: [
|
|
1634
|
+
/* @__PURE__ */ b("div", { css: y[t].body, children: [
|
|
1635
|
+
/* @__PURE__ */ a("div", { css: y[t].header, style: { minHeight: qe[t] }, children: /* @__PURE__ */ a("div", { css: y[t].titleSkeleton }) }),
|
|
1636
|
+
n ? /* @__PURE__ */ a(
|
|
1637
|
+
"div",
|
|
1638
|
+
{
|
|
1639
|
+
css: y[t].arenaSkeleton,
|
|
1640
|
+
style: { height: vn[t] }
|
|
1641
|
+
}
|
|
1642
|
+
) : /* @__PURE__ */ b(Ot, { children: [
|
|
1643
|
+
/* @__PURE__ */ a(
|
|
1644
|
+
"div",
|
|
1645
|
+
{
|
|
1646
|
+
css: y[t].arenaSkeleton,
|
|
1647
|
+
style: { height: Ue[t] }
|
|
1648
|
+
}
|
|
1649
|
+
),
|
|
1650
|
+
/* @__PURE__ */ a("div", { css: y[t].resultsSkeleton, children: /* @__PURE__ */ a("div", { css: y[t].barSkeleton }) })
|
|
1651
|
+
] })
|
|
1652
|
+
] }),
|
|
1653
|
+
e && /* @__PURE__ */ a("div", { css: y[t].oddsSlot, children: /* @__PURE__ */ a(fn, { size: t === "m" ? "dense" : "default" }) })
|
|
1654
|
+
] }), Xe = ({
|
|
1655
|
+
layout: t,
|
|
1656
|
+
label: n,
|
|
1657
|
+
kind: e,
|
|
1658
|
+
onRetry: r
|
|
1659
|
+
}) => {
|
|
1660
|
+
const { t: o } = bt("common"), l = e === "notFound" ? n("notAvailableTitle") : o("common.error.title"), u = e === "notFound" ? n("notAvailableMessage") : o("common.error.message");
|
|
1661
|
+
return /* @__PURE__ */ a("div", { css: y[t].root, children: /* @__PURE__ */ b("div", { css: y[t].body, children: [
|
|
1662
|
+
/* @__PURE__ */ a("div", { css: y[t].header, children: /* @__PURE__ */ a("h2", { css: y[t].title, children: n("title") }) }),
|
|
1663
|
+
/* @__PURE__ */ b(
|
|
1664
|
+
"div",
|
|
1665
|
+
{
|
|
1666
|
+
css: y[t].message,
|
|
1667
|
+
style: { minHeight: vn[t] },
|
|
1668
|
+
role: "alert",
|
|
1669
|
+
children: [
|
|
1670
|
+
/* @__PURE__ */ a("h3", { css: y[t].messageTitle, children: l }),
|
|
1671
|
+
/* @__PURE__ */ a("p", { css: y[t].messageText, children: u }),
|
|
1672
|
+
e === "error" && /* @__PURE__ */ a("button", { type: "button", css: y[t].retry, onClick: r, children: o("common.retry") })
|
|
1673
|
+
]
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] }) });
|
|
1677
|
+
}, cn = (t, n, e) => {
|
|
1678
|
+
const r = We(t);
|
|
1679
|
+
return t.map((o, l) => Fe(r, l, n, e));
|
|
1680
|
+
}, Ke = (t) => {
|
|
1681
|
+
var zt, At, Vt, _t, Ht, jt, Gt;
|
|
1682
|
+
const {
|
|
1683
|
+
sdk: n,
|
|
1684
|
+
language: e,
|
|
1685
|
+
progressDisplay: r = "bar",
|
|
1686
|
+
showResultsBeforeVote: o = !0,
|
|
1687
|
+
showTrophy: l = !0,
|
|
1688
|
+
trophyPosition: u = "bottom-right",
|
|
1689
|
+
showOdds: m = !1,
|
|
1690
|
+
odds: c
|
|
1691
|
+
} = t, { t: f } = bt("common"), p = xe(t.labels), h = Un() ? "m" : "d", F = h === "m" ? nt : tt, B = Pt(), X = mn(), T = Yn(), U = r === "background", $ = ye({
|
|
1692
|
+
entityId: t.entityId,
|
|
1693
|
+
sdk: n,
|
|
1694
|
+
language: e,
|
|
1695
|
+
userIsLoggedIn: t.userIsLoggedIn,
|
|
1696
|
+
callbacks: t.callbacks
|
|
1697
|
+
}), { sides: S, votes: it, poll: E, startMs: z, endMs: L } = $, [O, st] = A(!1), [H, C] = A(null), x = z !== null ? z + Kt : null, M = ke(
|
|
1698
|
+
x !== null && L !== null ? Math.max(x, L) : x ?? L
|
|
1699
|
+
), v = (E == null ? void 0 : E.status) === "INACTIVE" && z !== null && M < z + Kt && (L === null || z < L), w = v && M >= (z ?? 0), N = L !== null && M >= L, D = !!E && !v && (E.status !== "ACTIVE" || N), { refresh: P } = $;
|
|
1700
|
+
ht(() => {
|
|
1701
|
+
if (!w) return;
|
|
1702
|
+
P();
|
|
1703
|
+
const k = setInterval(P, se);
|
|
1704
|
+
return () => clearInterval(k);
|
|
1705
|
+
}, [w, P]);
|
|
1706
|
+
const et = un(!1);
|
|
1707
|
+
ht(() => {
|
|
1708
|
+
E && (N ? et.current && (et.current = !1, P()) : et.current = !0);
|
|
1709
|
+
}, [E, N, P]);
|
|
1710
|
+
const at = q(
|
|
1711
|
+
() => {
|
|
1712
|
+
var k, G;
|
|
1713
|
+
return {
|
|
1714
|
+
surface: T.surface,
|
|
1715
|
+
text: T.textPrimary,
|
|
1716
|
+
primary: T.palette.primary.plainColor,
|
|
1717
|
+
onPrimary: T.palette.primary.onPrimary,
|
|
1718
|
+
extras: [
|
|
1719
|
+
(k = T.palette.success) == null ? void 0 : k.plainColor,
|
|
1720
|
+
(G = T.palette.warning) == null ? void 0 : G.plainColor
|
|
1721
|
+
].filter((Bn) => !!Bn)
|
|
1722
|
+
};
|
|
1723
|
+
},
|
|
1724
|
+
[T]
|
|
1725
|
+
), Lt = q(() => S.map((k) => k.brand), [S]), yt = q(() => ve(Lt, at), [Lt, at]), $n = gn(
|
|
1726
|
+
((zt = T.palette.warning) == null ? void 0 : zt.plainColor) ?? at.primary,
|
|
1727
|
+
at
|
|
1728
|
+
), K = c == null ? void 0 : c.eventId, xt = m && !!K && S.length === 2 && S.every((k) => k.kind === "team"), Cn = m && !!K, { odds: wn, loading: Wn } = Kn(
|
|
1729
|
+
n,
|
|
1730
|
+
xt && K ? [K] : [],
|
|
1731
|
+
{
|
|
1732
|
+
enabled: xt,
|
|
1733
|
+
markets: [(c == null ? void 0 : c.market) ?? "FT_1X2"],
|
|
1734
|
+
sport: "FOOTBALL",
|
|
1735
|
+
pollingIntervalMs: c == null ? void 0 : c.pollingInterval,
|
|
1736
|
+
operators: c == null ? void 0 : c.operators,
|
|
1737
|
+
affiliateId: c == null ? void 0 : c.affiliateId,
|
|
1738
|
+
affiliateIds: c == null ? void 0 : c.affiliateIds
|
|
1739
|
+
}
|
|
1740
|
+
), Mt = K ? wn.get(K) : void 0, Rn = q(
|
|
1741
|
+
() => new Intl.NumberFormat(X, {
|
|
1742
|
+
style: "percent",
|
|
1743
|
+
maximumFractionDigits: 0
|
|
1744
|
+
}),
|
|
1745
|
+
[X]
|
|
1746
|
+
);
|
|
1747
|
+
if ($.status === "loading")
|
|
1748
|
+
return /* @__PURE__ */ a(Ye, { layout: h, fill: U, odds: Cn });
|
|
1749
|
+
if ($.status !== "ready" || !E)
|
|
1750
|
+
return /* @__PURE__ */ a(
|
|
1751
|
+
Xe,
|
|
1752
|
+
{
|
|
1753
|
+
layout: h,
|
|
1754
|
+
label: p,
|
|
1755
|
+
kind: $.status === "notFound" ? "notFound" : "error",
|
|
1756
|
+
onRetry: $.retry
|
|
1757
|
+
}
|
|
1758
|
+
);
|
|
1759
|
+
const lt = me(it), ct = D ? fe(it) : null, Fn = D && ct === null, J = S.findIndex(
|
|
1760
|
+
(k) => k.optionId === $.votedOptionId
|
|
1761
|
+
), kt = D || o || J >= 0, St = lt.map(
|
|
1762
|
+
(k) => kt ? Rn.format(k / 100) : null
|
|
1763
|
+
), En = h === "m" && S.length > 2, Nt = S.map(() => 100 / S.length), Dt = ct !== null ? we(lt, ct, U, h === "m") : U && kt ? Ce(lt, h === "m") : Nt, On = S.map((k, G) => D || J < 0 || J === G), Pn = S.map((k, G) => v ? "upcoming" : J === G ? "chosen" : J >= 0 ? "locked" : $.signInRequired ? "signIn" : $.submitting ? "submitting" : "open"), It = E.authRequirement === "LEAD" && !O && !D && !v && J < 0 ? (At = t.leads) == null ? void 0 : At.position : void 0, Tn = It === "before" || It === "after" && H !== null, Ln = (k) => {
|
|
1764
|
+
It === "after" ? C(k) : $.vote(S[k].optionId);
|
|
1765
|
+
}, Mn = async () => {
|
|
1766
|
+
st(!0), H !== null && (await $.vote(S[H].optionId), C(null));
|
|
1767
|
+
}, Bt = kt ? `${p("voteSplit")}: ${S.map((k, G) => `${k.name} ${St[G]}`).join(", ")}` : null, Nn = S.every((k) => k.kind === "player"), Dn = v ? w || z === null ? null : Zt(z, M) : L !== null && !D ? Zt(L, M) : null;
|
|
1768
|
+
return /* @__PURE__ */ b(
|
|
1769
|
+
"div",
|
|
1770
|
+
{
|
|
1771
|
+
css: y[h].root,
|
|
1772
|
+
style: { "--bof-trophy-on": $n },
|
|
1773
|
+
children: [
|
|
1774
|
+
/* @__PURE__ */ b("div", { css: y[h].body, children: [
|
|
1775
|
+
/* @__PURE__ */ a(
|
|
1776
|
+
_e,
|
|
1777
|
+
{
|
|
1778
|
+
layout: h,
|
|
1779
|
+
label: p,
|
|
1780
|
+
title: ((_t = (Vt = t.labels) == null ? void 0 : Vt.title) == null ? void 0 : _t.trim()) || ((Ht = E.title) == null ? void 0 : Ht.trim()) || p("title"),
|
|
1781
|
+
openSubtitle: ((Gt = (jt = t.labels) == null ? void 0 : jt.subtitle) == null ? void 0 : Gt.trim()) || Xn(E.description ?? null).trim() || p(Nn ? "subtitlePlayers" : "subtitleTeams"),
|
|
1782
|
+
ended: D,
|
|
1783
|
+
draw: Fn,
|
|
1784
|
+
upcoming: v,
|
|
1785
|
+
left: Dn
|
|
1786
|
+
}
|
|
1787
|
+
),
|
|
1788
|
+
Tn && t.leads ? /* @__PURE__ */ a(
|
|
1789
|
+
je,
|
|
1790
|
+
{
|
|
1791
|
+
layout: h,
|
|
1792
|
+
sdk: n,
|
|
1793
|
+
poll: E,
|
|
1794
|
+
leads: t.leads,
|
|
1795
|
+
sides: S,
|
|
1796
|
+
colours: yt,
|
|
1797
|
+
picked: H,
|
|
1798
|
+
language: e,
|
|
1799
|
+
continueLabel: H !== null ? p("voteFor", { name: S[H].name }) : f("poll.buttons.continue"),
|
|
1800
|
+
onContinue: Mn,
|
|
1801
|
+
submitting: $.submitting
|
|
1802
|
+
}
|
|
1803
|
+
) : /* @__PURE__ */ b(Ot, { children: [
|
|
1804
|
+
/* @__PURE__ */ a(
|
|
1805
|
+
Ae,
|
|
1806
|
+
{
|
|
1807
|
+
view: {
|
|
1808
|
+
layout: h,
|
|
1809
|
+
fill: U,
|
|
1810
|
+
rows: En,
|
|
1811
|
+
sides: S,
|
|
1812
|
+
colours: yt,
|
|
1813
|
+
percents: St,
|
|
1814
|
+
ended: D,
|
|
1815
|
+
winner: ct,
|
|
1816
|
+
lit: On,
|
|
1817
|
+
widths: Dt,
|
|
1818
|
+
clips: cn(Dt, F.slant, B),
|
|
1819
|
+
slant: F.slant,
|
|
1820
|
+
evenClips: cn(Nt, F.slant, B),
|
|
1821
|
+
actions: Pn,
|
|
1822
|
+
showTrophy: l,
|
|
1823
|
+
trophyPosition: u,
|
|
1824
|
+
language: e,
|
|
1825
|
+
label: p,
|
|
1826
|
+
splitLabel: Bt,
|
|
1827
|
+
signInCTA: t.signInCTA,
|
|
1828
|
+
onVote: Ln
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
),
|
|
1832
|
+
!U && /* @__PURE__ */ a(
|
|
1833
|
+
Ge,
|
|
1834
|
+
{
|
|
1835
|
+
layout: h,
|
|
1836
|
+
label: p,
|
|
1837
|
+
colours: yt,
|
|
1838
|
+
shares: lt,
|
|
1839
|
+
percents: St,
|
|
1840
|
+
ended: D,
|
|
1841
|
+
splitLabel: Bt
|
|
1842
|
+
}
|
|
1843
|
+
)
|
|
1844
|
+
] })
|
|
1845
|
+
] }),
|
|
1846
|
+
Mt ? /* @__PURE__ */ a(
|
|
1847
|
+
Jn,
|
|
1848
|
+
{
|
|
1849
|
+
odds: Mt,
|
|
1850
|
+
market: (c == null ? void 0 : c.market) ?? "FT_1X2",
|
|
1851
|
+
size: h === "m" ? "dense" : "default",
|
|
1852
|
+
mode: c == null ? void 0 : c.mode,
|
|
1853
|
+
flashInterval: c == null ? void 0 : c.flashInterval
|
|
1854
|
+
}
|
|
1855
|
+
) : xt && Wn && /* @__PURE__ */ a("div", { css: y[h].oddsSlot, children: /* @__PURE__ */ a(fn, { size: h === "m" ? "dense" : "default" }) }),
|
|
1856
|
+
/* @__PURE__ */ a(
|
|
1857
|
+
An,
|
|
1858
|
+
{
|
|
1859
|
+
notification: {
|
|
1860
|
+
open: !!$.voteError,
|
|
1861
|
+
variant: "error",
|
|
1862
|
+
title: f("common.error.title"),
|
|
1863
|
+
message: $.voteError ?? ""
|
|
1864
|
+
},
|
|
1865
|
+
onClose: $.clearVoteError
|
|
1866
|
+
}
|
|
1867
|
+
)
|
|
1868
|
+
]
|
|
1869
|
+
}
|
|
1870
|
+
);
|
|
1871
|
+
}, Je = (t) => {
|
|
1872
|
+
var n;
|
|
1873
|
+
return /* @__PURE__ */ a(
|
|
1874
|
+
Vn,
|
|
1875
|
+
{
|
|
1876
|
+
packageName: "battle-of-fans",
|
|
1877
|
+
language: t.language,
|
|
1878
|
+
themeOptions: t.themeOptions,
|
|
1879
|
+
disableCache: t.disableCache,
|
|
1880
|
+
leadPhoneCountryCode: (n = t.leads) == null ? void 0 : n.phoneCountryCode,
|
|
1881
|
+
children: /* @__PURE__ */ a(Ke, { ...t })
|
|
1882
|
+
}
|
|
1883
|
+
);
|
|
1884
|
+
}, lo = ne(Je);
|
|
1885
|
+
export {
|
|
1886
|
+
lo as BattleOfFans
|
|
1887
|
+
};
|