fansunited-frontend-components 0.0.99 → 1.0.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.
Files changed (62) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +496 -505
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +405 -1163
  5. package/CompetitionStatistics.js +2 -2
  6. package/CompetitorCard.js +445 -425
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +648 -593
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +142 -132
  12. package/List.js +675 -713
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +1 -1
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +925 -1824
  17. package/PlayerOfTheMatch.js +2106 -2223
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +4209 -18629
  20. package/Standings.js +497 -486
  21. package/TopX.js +3223 -16958
  22. package/chunks/{ChanceGameEmbedVariant-DM9eLG5s.js → ChanceGameEmbedVariant-z8XYzgDW.js} +1 -1
  23. package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
  24. package/chunks/index-BNl8scz6.js +4 -0
  25. package/chunks/index-CSa2JU4m.js +4 -0
  26. package/chunks/index-CVRI82Gb.js +4 -0
  27. package/chunks/index-Cd1dg0KI.js +4 -0
  28. package/chunks/index-Cei2fzi7.js +4 -0
  29. package/chunks/index-Cxb4wEJU.js +4 -0
  30. package/chunks/index-w1LGN5dz.js +4 -0
  31. package/chunks/main-07vzblS8.js +2091 -0
  32. package/chunks/main-C7X4dM_P.js +4827 -0
  33. package/chunks/main-D_QDfmAw.js +6417 -0
  34. package/chunks/{main-CzfWaEQP.js → main-DdL0UekL.js} +1931 -2025
  35. package/chunks/main-DmBfwyb4.js +2992 -0
  36. package/chunks/main-LEE8n2cG.js +3117 -0
  37. package/chunks/{main-DxvBjXsd.js → main-P2WNvBZE.js} +473 -444
  38. package/chunks/{main-DiBlJBNb.js → main-gV165E-A.js} +629 -657
  39. package/chunks/predictionsHelpers-fwXaMadu.js +10063 -0
  40. package/chunks/{withVersionStamp-BsLyhvNA.js → withVersionStamp-CPDfSE5H.js} +1 -1
  41. package/package.json +2 -6
  42. package/withVersionStamp.d.ts.map +1 -1
  43. package/chunks/CheckCircle-I1FktW5Y.js +0 -13
  44. package/chunks/Person-CXRqyF4E.js +0 -11
  45. package/chunks/PickOneOfX-DET4ZhjV.js +0 -3117
  46. package/chunks/Search-CIXthh0D.js +0 -17
  47. package/chunks/TimerOutlined-D-WA_vpE.js +0 -8
  48. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +0 -136
  49. package/chunks/chevrons-right-HWKW2c4I.js +0 -45
  50. package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
  51. package/chunks/index-BENM3N_w.js +0 -4
  52. package/chunks/index-BRxAV693.js +0 -4
  53. package/chunks/index-BXYTsvIX.js +0 -4
  54. package/chunks/index-C0ilols1.js +0 -4
  55. package/chunks/index-D7VhczXH.js +0 -4
  56. package/chunks/index-DKwvdw9t.js +0 -4
  57. package/chunks/index-DZN-AITW.js +0 -4
  58. package/chunks/main-B2sDRFF4.js +0 -2184
  59. package/chunks/main-DFNl3g_U.js +0 -4910
  60. package/chunks/main-DLwnvntz.js +0 -4020
  61. package/chunks/main-S8_NDSiY.js +0 -3209
  62. package/chunks/main-lBgr8Liq.js +0 -6571
@@ -1,4910 +0,0 @@
1
- import { jsx as t, jsxs as f, Fragment as X } from "@emotion/react/jsx-runtime";
2
- import { useDisableCache as Ln, isMobile as ie, getBrandingClickUrl as Io, useInternalTheme as Ie, DirectionalIcon as _t, useConstantContext as zn, isExtraSmall as dt, bidiIsolate as st, ConstantsContext as Go, useColors as Re, useImageVariant as _e, WidgetTemplate as me, hexToRgb as it, isLarge as lo, defaultBgVertical as at, defaultBg as ct, useIsRtl as To, useSpacingScale as Ro, useBorderSize as Do, useImageBackgroundGradient as Jt, extractBrandingModelProperties as Qt, stripHtmlTags as Pt, usePhysicalImagePosition as Eo, sanitizeBackgroundUrl as $o, useConsents as Ao, getRelatedInfoPageId as Lo, ChanceGameEmbed as Kn, extractSdkError as zo } from "fansunited-frontend-core";
3
- import lt, { useState as U, useEffect as je, useRef as Oe, useId as Fn, useLayoutEffect as Pn, createContext as Fo, useCallback as en, useMemo as ot } from "react";
4
- import { C as Jn } from "./ChanceGameEmbedVariant-DM9eLG5s.js";
5
- import { EventGameModel as Bo, EventGamePredictionRequestBody as Mo } from "fansunited-sdk-esm/models";
6
- import { JOY_BODY_FONT as $e, joyButton as Pe, Modal as Ho, ButtonSpinner as tn, joyBody as ce, StandardSkeleton as so, ConsentPanel as ut, ConsentCta as nn, AdditionalCTA as Yt, SplitScoreStateSkeleton as Oo, Spinner as uo, DataTable as Uo, Avatar as Qn, joyHeading as In, Rules as Xt, NotFound as Wo, StandardApiErrorSkeleton as Vo, SplitApiErrorSkeleton as No, OverlayApiErrorSkeleton as jo, OverlaySkeleton as qo, SplitSkeleton as _o, StandardLeadAfterCollection as Yo, SplitLeadAfterCollection as Xo, OverlayLeadAfterCollection as Zo, OverlayScoreStateSkeleton as Ko, Notification as Et, WidgetPortal as Jo } from "fansunited-frontend-core/ui/emotion";
7
- import { css as n, keyframes as Bn } from "@emotion/react";
8
- import { useTranslation as oe } from "react-i18next";
9
- import { EventGameOutcomeTypeEnum as F } from "fansunited-sdk-esm/enums";
10
- import { KeyboardArrowLeftIcon as Qo, KeyboardArrowRightIcon as er, SvgIcon as fo, UnfoldIcon as tr, CloseIcon as nr, CheckCircleIcon as ir, WarningIcon as or, InfoIcon as rr, PersonIcon as ar } from "fansunited-frontend-core/ui/icons";
11
- import { createPortal as cr } from "react-dom";
12
- import { ChevronLeft as lr, ChevronRight as sr } from "fansunited-frontend-core/ui/icons/lucide";
13
- const dr = (e, i, r) => {
14
- const [o, a] = U(null), [u, s] = U(null), d = Ln(), l = async () => {
15
- try {
16
- const c = await i.eventGame.getGameById(e, d);
17
- if (a(c), r && c.fixtures) {
18
- const y = c.fixtures.map(
19
- (g) => ({
20
- id: g.id,
21
- points: g.points || 0
22
- })
23
- );
24
- s(y);
25
- } else
26
- s([]);
27
- } catch (c) {
28
- console.warn(c), a(new Bo()), s([]);
29
- }
30
- };
31
- return je(() => (l(), () => {
32
- a(null), s(null);
33
- }), [e, i, r, d]), { game: o, points: u };
34
- }, ur = (e, i) => {
35
- const [r, o] = U(void 0), [a, u] = U(!1), [s, d] = U(!1), [l, c] = U(""), y = Ln(), g = async () => {
36
- var h, v, p;
37
- let x = "";
38
- try {
39
- x = (await i.profile.getOwn().getInfo()).id;
40
- } catch (b) {
41
- if (i.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
42
- const w = b;
43
- if (w.error.code === 401 || w.error.code === 403) {
44
- u(!0), o(null);
45
- return;
46
- }
47
- d(!0), c(w.error.message), o(null);
48
- return;
49
- }
50
- const I = b;
51
- if (I.data.error.code === 401 || I.data.error.code === 403) {
52
- u(!0), o(null);
53
- return;
54
- }
55
- d(!0), c(I.data.error.message), o(null);
56
- return;
57
- }
58
- try {
59
- const b = await i.eventGame.getGamePredictionsForUser(
60
- e,
61
- x,
62
- void 0,
63
- y
64
- );
65
- if (b.data.length === 0) {
66
- o(null);
67
- return;
68
- }
69
- o(b.data[0]);
70
- } catch (b) {
71
- o(null), u(!1), d(!0), c(((v = (h = b == null ? void 0 : b.data) == null ? void 0 : h.error) == null ? void 0 : v.message) || ((p = b == null ? void 0 : b.error) == null ? void 0 : p.message) || "");
72
- }
73
- };
74
- return je(() => (g(), () => {
75
- o(void 0), u(!1), d(!1), c("");
76
- }), [e, i, y]), {
77
- myPrediction: r,
78
- setMyPrediction: o,
79
- isUnauthorized: a,
80
- isApiError: s,
81
- apiErrorMessage: l,
82
- setIsUnauthorized: u,
83
- setIsApiError: d,
84
- setApiErrorMessage: c
85
- };
86
- }, ei = {
87
- display: "flex",
88
- width: "100%",
89
- borderRadius: "var(--fu-ucrc-radius-md)",
90
- border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-eg-card-border, var(--fu-ucrc-secondary-container))",
91
- overflow: "hidden",
92
- background: "var(--fu-ucrc-surface)",
93
- minHeight: "250px"
94
- }, ti = {
95
- row: n({ ...ei, flexDirection: "row" }),
96
- column: n({ ...ei, flexDirection: "column" })
97
- }, Fe = ({ children: e, brandingBorderColor: i }) => {
98
- const r = ie();
99
- return /* @__PURE__ */ t(
100
- "div",
101
- {
102
- css: r ? ti.column : ti.row,
103
- style: i ? { "--fu-ucrc-eg-card-border": i } : void 0,
104
- children: e
105
- }
106
- );
107
- }, an = { minWidth: "180px", display: "flex", gap: "8px", alignItems: "center", fontSize: "1em" }, ni = { display: "flex", alignItems: "center", justifyContent: "center" }, $t = {
108
- centeredColumn: n({ ...an, flexDirection: "column", zIndex: 1 }),
109
- centeredRow: n({ ...an, flexDirection: "row", zIndex: 1 }),
110
- inline: n({ ...an, zIndex: 10 }),
111
- label: n({
112
- margin: 0,
113
- fontWeight: 400,
114
- lineHeight: "166%",
115
- letterSpacing: "0.4px",
116
- fontSize: "1em",
117
- // Joy body-sm painted text.tertiary when no colour was passed.
118
- color: "var(--fu-ucrc-eg-presented-by, var(--fu-ucrc-joy-text-tertiary))",
119
- textAlign: "right",
120
- fontFamily: "var(--fu-ucrc-font-secondary)"
121
- }),
122
- logo: n(ni),
123
- clickableLogo: n({ ...ni, cursor: "pointer" })
124
- }, pe = (e) => {
125
- const i = ie(), r = Io(e.primaryUrl, e.secondaryUrl, "logo");
126
- if (!e.brandingLogo) return null;
127
- const o = /* @__PURE__ */ t("img", { src: e.brandingLogo, alt: "branding-logo", style: { maxHeight: "50px", maxWidth: "100px" } }), a = r ? /* @__PURE__ */ t("div", { css: $t.clickableLogo, onClick: () => window.open(r, "_blank", "noopener,noreferrer"), children: o }) : /* @__PURE__ */ t("div", { css: $t.logo, children: o }), u = e.isCentered || i ? e.flexDirection === "row" ? "centeredRow" : "centeredColumn" : "inline";
128
- return /* @__PURE__ */ f(
129
- "div",
130
- {
131
- css: $t[u],
132
- style: e.textColor ? { "--fu-ucrc-eg-presented-by": e.textColor } : void 0,
133
- children: [
134
- e.label && /* @__PURE__ */ t("p", { css: $t.label, children: e.label }),
135
- a
136
- ]
137
- }
138
- );
139
- }, ee = (e) => `var(--fu-ucrc-space-${e})`, qe = (e) => `var(--fu-ucrc-radius-${e})`, G = {
140
- fontPrimary: "var(--fu-ucrc-font-primary)",
141
- fontSecondary: "var(--fu-ucrc-font-secondary)",
142
- fontBody: "var(--fu-ucrc-font-body)",
143
- text: "var(--fu-ucrc-text-primary)",
144
- textSecondary: "var(--fu-ucrc-text-secondary)",
145
- textIcon: "var(--fu-ucrc-joy-text-icon)",
146
- softBg: "var(--fu-ucrc-neutral-soft-bg)",
147
- border: "var(--fu-ucrc-neutral-outlined-border)",
148
- hoverBg: "var(--fu-ucrc-neutral-plain-hover-bg)",
149
- primary: "var(--fu-ucrc-primary-plain-color)",
150
- onPrimary: "var(--fu-ucrc-primary-on-primary)",
151
- focus: "var(--fu-ucrc-focus-visible)",
152
- shadow: "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))"
153
- }, Mn = `var(--fu-ucrc-shadow-ring), 0px 1px 2px 0px ${G.shadow}`, de = {
154
- surface: "var(--fu-ucrc-eg-l-surface)",
155
- popup: "var(--fu-ucrc-eg-l-popup)",
156
- border: "var(--fu-ucrc-eg-l-border)",
157
- color: "var(--fu-ucrc-eg-l-color)",
158
- hoverBg: "var(--fu-ucrc-eg-l-hover-bg)",
159
- activeBg: "var(--fu-ucrc-eg-l-active-bg)",
160
- text: "var(--fu-ucrc-eg-l-text)"
161
- }, fr = () => {
162
- const e = Ie().colorSchemes.light, i = e.palette;
163
- return {
164
- "--fu-ucrc-eg-l-surface": i.background.surface,
165
- "--fu-ucrc-eg-l-popup": i.background.popup,
166
- "--fu-ucrc-eg-l-border": i.neutral.outlinedBorder,
167
- "--fu-ucrc-eg-l-color": i.neutral.outlinedColor,
168
- "--fu-ucrc-eg-l-hover-bg": i.neutral.outlinedHoverBg,
169
- "--fu-ucrc-eg-l-active-bg": i.neutral.plainActiveBg,
170
- "--fu-ucrc-eg-l-text": e.textColor
171
- };
172
- }, It = { margin: 0, lineHeight: 1.5 }, mr = { margin: 0, lineHeight: 1.33334, letterSpacing: "-0.025em" }, gr = (e) => ({
173
- width: e ? "48px" : "64px",
174
- height: e ? "48px" : "64px",
175
- backgroundColor: G.softBg,
176
- display: "flex",
177
- alignItems: "center",
178
- justifyContent: "center",
179
- overflow: "hidden",
180
- padding: ee(e ? "xs" : "sm"),
181
- // A spacing token, as before.
182
- borderRadius: ee("sm"),
183
- boxShadow: "0 5px 15px 0 rgba(49, 84, 139, .1)",
184
- flexShrink: 0,
185
- transition: "all 0.2s ease-in-out",
186
- "&:hover": { backgroundColor: G.hoverBg }
187
- }), hr = (e) => ({ backgroundColor: e, "&:hover": { backgroundColor: e } }), Zt = "var(--fu-ucrc-eg-step-icon)", xr = (e) => n({
188
- boxSizing: "border-box",
189
- position: "relative",
190
- display: "inline-flex",
191
- alignItems: "center",
192
- justifyContent: "center",
193
- minWidth: e,
194
- minHeight: e,
195
- margin: 0,
196
- paddingBlock: 0,
197
- paddingInline: "2px",
198
- border: "none",
199
- borderColor: G.border,
200
- borderRadius: qe("sm"),
201
- backgroundColor: "transparent",
202
- color: Zt,
203
- font: "inherit",
204
- lineHeight: "normal",
205
- cursor: "pointer",
206
- WebkitTapHighlightColor: "transparent",
207
- "&:focus-visible": { outline: `2px solid ${G.focus}`, outlineOffset: "2px" },
208
- "&:hover": { backgroundColor: G.hoverBg, color: Zt },
209
- "&:active": { backgroundColor: "var(--fu-ucrc-neutral-plain-active-bg)" },
210
- "&:disabled": {
211
- pointerEvents: "none",
212
- cursor: "default",
213
- color: "var(--fu-ucrc-neutral-plain-disabled-color)"
214
- }
215
- }), ii = (e, i, r) => n({
216
- boxSizing: "border-box",
217
- display: "flex",
218
- position: "relative",
219
- minWidth: `calc(${i}em / ${e})`,
220
- maxWidth: `calc(${r}em / ${e})`,
221
- minHeight: `calc(2.25em / ${e})`,
222
- paddingBlock: ee("xs"),
223
- paddingInline: ee("sm"),
224
- border: "none",
225
- borderRadius: qe("sm"),
226
- outline: "none",
227
- backgroundColor: G.softBg,
228
- color: G.text,
229
- fontFamily: G.fontPrimary,
230
- fontWeight: 600,
231
- fontSize: `${e}em`,
232
- lineHeight: 1.5,
233
- textAlign: "center",
234
- boxShadow: Mn,
235
- cursor: "text",
236
- "&:focus-within": { outline: `2px solid ${G.primary}`, outlineOffset: "2px" }
237
- }), vr = (e) => n({
238
- flex: 1,
239
- minWidth: 0,
240
- margin: 0,
241
- padding: 0,
242
- border: "none",
243
- outline: 0,
244
- color: "inherit",
245
- backgroundColor: "transparent",
246
- fontFamily: G.fontPrimary,
247
- fontSize: `${e}em`,
248
- fontStyle: "inherit",
249
- fontWeight: 600,
250
- lineHeight: "inherit",
251
- textAlign: "center",
252
- textOverflow: "ellipsis",
253
- "&::placeholder": { color: "inherit", opacity: 0.64 }
254
- }), oi = (e) => ({
255
- root: n({
256
- display: "flex",
257
- alignItems: "center",
258
- justifyContent: "center",
259
- gap: ee(e ? "md" : "lg"),
260
- paddingTop: ee(e ? "xs" : "sm")
261
- }),
262
- button: xr(e ? "28px" : "32px"),
263
- field: e ? ii(1.5, 3.5, 5) : ii(2, 4.5, 6),
264
- input: vr(e ? 0.75 : 1)
265
- }), mt = { mobile: oi(!0), desktop: oi(!1) }, pr = {
266
- row: n({ display: "flex", flexDirection: "row", alignItems: "center", gap: ee("sm") })
267
- }, yr = (e) => {
268
- const r = ie() ? "mobile" : "desktop", o = Ie(), [a, u] = U(e.prediction), s = Oe(null), d = e.minValue !== void 0 ? e.minValue : -1 / 0, l = e.maxValue !== void 0 ? e.maxValue : 1 / 0, c = {
269
- "--fu-ucrc-eg-step-icon": o.mode === "dark" || e.isOverlayVariant ? "#FFFFFF" : G.text
270
- }, y = (x) => {
271
- const h = x ? Math.min(a + 1, l) : Math.max(a - 1, d);
272
- s.current && (s.current.value = String(h)), u(h), e.onChange(h);
273
- }, g = (x) => {
274
- const h = x.target.value;
275
- if (h === "" || !/^\d+$/.test(h))
276
- return;
277
- const v = parseInt(h, 10);
278
- u(v), e.onChange(v);
279
- };
280
- return /* @__PURE__ */ t("div", { css: mt[r].root, style: c, children: /* @__PURE__ */ f("div", { css: pr.row, children: [
281
- /* @__PURE__ */ t(
282
- "button",
283
- {
284
- type: "button",
285
- css: mt[r].button,
286
- onClick: () => y(!1),
287
- disabled: a <= d,
288
- children: /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ t(Qo, { size: "1.25em", color: Zt }) })
289
- }
290
- ),
291
- /* @__PURE__ */ t(
292
- "div",
293
- {
294
- css: mt[r].field,
295
- onClick: (x) => {
296
- var h;
297
- x.target !== s.current && ((h = s.current) == null || h.focus());
298
- },
299
- children: /* @__PURE__ */ t("input", { ref: s, dir: "ltr", css: mt[r].input, value: a, onChange: g })
300
- }
301
- ),
302
- /* @__PURE__ */ t(
303
- "button",
304
- {
305
- type: "button",
306
- css: mt[r].button,
307
- onClick: () => y(!0),
308
- disabled: a >= l,
309
- children: /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ t(er, { size: "1.25em", color: Zt }) })
310
- }
311
- )
312
- ] }) });
313
- };
314
- /** @license Material Icons - Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0). Copyright Google LLC. */
315
- const mo = lt.forwardRef((e, i) => /* @__PURE__ */ t(fo, { ref: i, "data-testid": "HelpOutlineIcon", ...e, children: /* @__PURE__ */ t("path", { d: "M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4" }) }));
316
- mo.displayName = "HelpOutlineIcon";
317
- const go = 10, br = 100, Cr = n({
318
- position: "absolute",
319
- margin: 0,
320
- maxWidth: "280px",
321
- padding: ee("xs"),
322
- border: `1px solid ${G.border}`,
323
- borderRadius: qe("sm"),
324
- backgroundColor: G.softBg,
325
- color: G.text,
326
- fontFamily: G.fontBody,
327
- fontSize: "0.875em",
328
- lineHeight: 1.5,
329
- wordWrap: "break-word",
330
- boxShadow: `var(--fu-ucrc-shadow-ring), 0px 1px 2px 0px ${G.shadow}, 0px 2px 4px 0px ${G.shadow}`,
331
- // Bridges the gap, so the pointer can move from the anchor onto the tooltip.
332
- "&::before": {
333
- content: '""',
334
- display: "block",
335
- position: "absolute",
336
- width: "100%",
337
- height: `${go}px`,
338
- bottom: 0,
339
- transform: "translateY(100%)"
340
- }
341
- }), Sr = (e, i) => {
342
- const r = e.getBoundingClientRect(), o = i.getBoundingClientRect(), a = i.offsetParent, u = a == null ? void 0 : a.getBoundingClientRect(), s = ((u == null ? void 0 : u.left) ?? 0) + ((a == null ? void 0 : a.clientLeft) ?? 0), d = s + ((a == null ? void 0 : a.clientWidth) ?? document.documentElement.clientWidth), l = ((u == null ? void 0 : u.top) ?? 0) + ((a == null ? void 0 : a.clientTop) ?? 0) + ((a == null ? void 0 : a.clientHeight) ?? window.innerHeight);
343
- let c = 0, y = document.documentElement.clientWidth;
344
- for (let C = i.parentNode; C; C = C instanceof ShadowRoot ? C.host : C.parentNode) {
345
- if (!(C instanceof HTMLElement) || !/(auto|scroll|hidden|clip)/.test(getComputedStyle(C).overflowX)) continue;
346
- const I = C.getBoundingClientRect();
347
- c = Math.max(c, I.left + C.clientLeft), y = Math.min(y, I.left + C.clientLeft + C.clientWidth);
348
- }
349
- const g = r.left, x = r.right - o.width, h = (C) => C >= c && C + o.width <= y, v = h(g) || !h(x);
350
- let p = v ? g : x;
351
- p = Math.max(c, Math.min(p, y - o.width)), p = Math.max(r.left - o.width, Math.min(p, r.right));
352
- const b = r.top - go;
353
- return {
354
- side: v ? "left" : "right",
355
- x: v ? Math.round(p - s) : -Math.round(d - (p + o.width)),
356
- y: -Math.round(l - b)
357
- };
358
- }, ri = ({ title: e, children: i, open: r, onClose: o }) => {
359
- const a = Fn(), u = Oe(null), s = Oe(null), d = Oe(void 0), [l, c] = U(!1), [y, g] = U(null), x = r ?? l;
360
- je(() => () => clearTimeout(d.current), []), Pn(() => {
361
- if (!x) {
362
- g(null);
363
- return;
364
- }
365
- const C = () => {
366
- u.current && s.current && g(Sr(u.current, s.current));
367
- };
368
- C();
369
- const I = typeof ResizeObserver > "u" ? null : new ResizeObserver(C);
370
- return s.current && (I == null || I.observe(s.current)), window.addEventListener("resize", C), () => {
371
- I == null || I.disconnect(), window.removeEventListener("resize", C);
372
- };
373
- }, [x]), je(() => {
374
- if (!x) return;
375
- const C = (I) => {
376
- I.key === "Escape" && (o ? o() : c(!1));
377
- };
378
- return document.addEventListener("keydown", C), () => document.removeEventListener("keydown", C);
379
- }, [x, o]);
380
- const h = () => {
381
- clearTimeout(d.current), d.current = setTimeout(() => c(!0), br);
382
- }, v = () => {
383
- clearTimeout(d.current), d.current = setTimeout(() => c(!1), 0);
384
- }, p = () => clearTimeout(d.current), b = r === void 0;
385
- return /* @__PURE__ */ f(X, { children: [
386
- lt.cloneElement(i, {
387
- ref: u,
388
- "aria-describedby": x ? a : void 0,
389
- ...b ? { onMouseEnter: h, onMouseLeave: v } : null
390
- }),
391
- x && /* @__PURE__ */ t(
392
- "div",
393
- {
394
- ref: s,
395
- id: a,
396
- role: "tooltip",
397
- css: Cr,
398
- style: y ? { [y.side]: 0, bottom: 0, transform: `translate(${y.x}px, ${y.y}px)` } : { left: 0, bottom: 0, visibility: "hidden" },
399
- onMouseEnter: b ? p : void 0,
400
- onMouseLeave: b ? v : void 0,
401
- children: e
402
- }
403
- )
404
- ] });
405
- }, Hn = Fo({
406
- points: []
407
- }), cn = ({ points: e, children: i }) => /* @__PURE__ */ t(
408
- Hn.Provider,
409
- {
410
- value: {
411
- points: e
412
- },
413
- children: i
414
- }
415
- ), gt = {
416
- badge: n({
417
- display: "flex",
418
- alignItems: "center",
419
- justifyContent: "center",
420
- gap: ee("xs"),
421
- minWidth: "56px",
422
- padding: `${ee("xs")} ${ee("sm")}`,
423
- border: `1px solid ${G.border}`,
424
- borderRadius: qe("md"),
425
- backgroundColor: G.softBg,
426
- color: G.text,
427
- cursor: "default",
428
- transition: "all 0.2s ease-in-out",
429
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
430
- zIndex: 10,
431
- "&:hover": {
432
- backgroundColor: G.hoverBg,
433
- transform: "scale(1.05)",
434
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.2)"
435
- }
436
- }),
437
- points: n(It, { fontFamily: G.fontPrimary, fontWeight: 700, fontSize: "0.875em", lineHeight: 1, color: G.text }),
438
- pts: n(It, {
439
- display: "block",
440
- fontFamily: G.fontSecondary,
441
- fontWeight: 500,
442
- fontSize: "0.75em",
443
- lineHeight: 1,
444
- color: G.textSecondary,
445
- opacity: 0.9
446
- }),
447
- // Joy's md plain IconButton under the sx.
448
- help: n({
449
- boxSizing: "border-box",
450
- position: "relative",
451
- display: "flex",
452
- alignItems: "center",
453
- justifyContent: "center",
454
- width: "32px",
455
- height: "32px",
456
- minWidth: "32px",
457
- minHeight: "32px",
458
- margin: 0,
459
- padding: 0,
460
- border: "none",
461
- borderRadius: "50%",
462
- backgroundColor: "transparent",
463
- color: G.text,
464
- font: "inherit",
465
- lineHeight: "normal",
466
- cursor: "pointer",
467
- transition: "all 0.2s ease-in-out",
468
- zIndex: 10,
469
- WebkitTapHighlightColor: "transparent",
470
- "&:focus-visible": { outline: `2px solid ${G.focus}`, outlineOffset: "2px" },
471
- "@media (hover: hover)": { "&:hover": { color: "var(--fu-ucrc-neutral-plain-hover-color)" } },
472
- "&:active": { backgroundColor: "var(--fu-ucrc-neutral-plain-active-bg)" },
473
- "&:hover": { backgroundColor: "transparent", transform: "scale(1.1)" }
474
- }),
475
- text: n(It, { fontFamily: G.fontSecondary, fontSize: "0.875em", lineHeight: 1.3, color: G.text })
476
- }, kr = (e) => {
477
- const { t: i } = oe(), r = ie(), [o, a] = U(!1), { points: u } = zn(Hn), s = u.find((l) => l.id === e.fixtureId);
478
- if (!s)
479
- return null;
480
- const d = /* @__PURE__ */ t("p", { css: gt.text, children: i("eventGame.points.earnPointsForCorrect", { points: s.points }) });
481
- return r || e.isSplitVariant ? /* @__PURE__ */ t(ri, { title: d, open: o, onClose: () => a(!1), children: /* @__PURE__ */ t("button", { type: "button", css: gt.help, onClick: () => a(!o), children: /* @__PURE__ */ t(mo, { size: "1em", color: G.text }) }) }) : /* @__PURE__ */ t(ri, { title: d, children: /* @__PURE__ */ f("div", { css: gt.badge, children: [
482
- /* @__PURE__ */ t("p", { css: gt.points, children: s.points }),
483
- /* @__PURE__ */ t("span", { css: gt.pts, children: i("eventGame.points.pts") })
484
- ] }) });
485
- }, At = (e, i) => n(mr, {
486
- fontFamily: G.fontPrimary,
487
- fontWeight: 600,
488
- fontSize: e ? "1.125em" : "1.25em",
489
- lineHeight: 1.2,
490
- color: G.text,
491
- textAlign: i ? "left" : "center"
492
- }), wr = {
493
- desktop: { center: At(!1, !1), left: At(!1, !0) },
494
- mobile: { center: At(!0, !1), left: At(!0, !0) }
495
- }, Lt = {
496
- root: n({ display: "flex", flexDirection: "column", alignItems: "center" }),
497
- header: n({
498
- display: "flex",
499
- alignItems: "center",
500
- justifyContent: "space-between",
501
- width: "100%",
502
- gap: ee("sm")
503
- }),
504
- spacer: n({ flex: 1 }),
505
- end: n({ flex: 1, display: "flex", justifyContent: "flex-end" })
506
- }, On = (e) => {
507
- const i = ie(), r = dt(), { points: o } = zn(Hn), a = e.useExtraSmallLayout !== void 0 ? e.useExtraSmallLayout : r;
508
- return /* @__PURE__ */ f("div", { css: Lt.root, children: [
509
- /* @__PURE__ */ f("div", { css: Lt.header, children: [
510
- a ? null : /* @__PURE__ */ t("div", { css: Lt.spacer }),
511
- /* @__PURE__ */ t("h3", { css: wr[i ? "mobile" : "desktop"][a ? "left" : "center"], children: e.question }),
512
- /* @__PURE__ */ t("div", { css: Lt.end, children: e.showPoints !== !1 && o.length > 0 && /* @__PURE__ */ t(
513
- kr,
514
- {
515
- fixtureId: e.fixtureId,
516
- brandingPrimaryColor: e.brandingPrimaryColor,
517
- isSplitVariant: e.isSplitVariant
518
- }
519
- ) })
520
- ] }),
521
- e.children
522
- ] });
523
- }, ai = (e) => n(It, {
524
- fontFamily: G.fontSecondary,
525
- fontSize: e ? "0.875em" : "0.9375em",
526
- color: G.textSecondary,
527
- textAlign: "center",
528
- marginTop: ee("xs"),
529
- marginBottom: ee("xs")
530
- }), Pr = { mobile: ai(!0), desktop: ai(!1) }, on = (e) => {
531
- var u, s;
532
- const { t: i } = oe(), r = ie(), a = (() => {
533
- if (!e.validOutcomes) return null;
534
- const { min: d, max: l } = e.validOutcomes, c = d != null, y = l != null;
535
- return c && y ? i("eventGame.fixtures.numberRangeDescription", { min: st(d), max: st(l) }) : c ? i("eventGame.fixtures.numberMinDescription", { min: st(d) }) : y ? i("eventGame.fixtures.numberMaxDescription", { max: st(l) }) : null;
536
- })();
537
- return /* @__PURE__ */ f(
538
- On,
539
- {
540
- question: e.question,
541
- fixtureId: e.fixtureId,
542
- brandingPrimaryColor: e.brandingPrimaryColor,
543
- isSplitVariant: e.isSplitVariant,
544
- useExtraSmallLayout: e.useExtraSmallLayout,
545
- showPoints: e.showPoints,
546
- children: [
547
- a && /* @__PURE__ */ t("p", { css: Pr[r ? "mobile" : "desktop"], children: a }),
548
- /* @__PURE__ */ t(
549
- yr,
550
- {
551
- onChange: e.onChange,
552
- prediction: e.prediction,
553
- minValue: ((u = e.validOutcomes) == null ? void 0 : u.min) ?? void 0,
554
- maxValue: ((s = e.validOutcomes) == null ? void 0 : s.max) ?? void 0,
555
- isOverlayVariant: e.isOverlayVariant
556
- }
557
- )
558
- ]
559
- }
560
- );
561
- }, ci = (e) => {
562
- const i = { ...gr(e), color: G.textSecondary, cursor: "pointer" }, r = (o) => n(i, hr(o), { color: "white" });
563
- return {
564
- root: n({
565
- display: "flex",
566
- alignItems: "center",
567
- justifyContent: "center",
568
- gap: ee(e ? "xl" : "2xl"),
569
- paddingTop: ee(e ? "md" : "lg")
570
- }),
571
- icon: n(i),
572
- yes: r("var(--fu-ucrc-success-plain-color)"),
573
- no: r("var(--fu-ucrc-danger-plain-color)"),
574
- label: n(It, {
575
- fontFamily: G.fontSecondary,
576
- color: G.text,
577
- fontSize: e ? "0.875em" : "1em",
578
- fontWeight: 600,
579
- textAlign: "center"
580
- })
581
- };
582
- }, ht = { mobile: ci(!0), desktop: ci(!1) }, Ir = {
583
- option: n({ display: "flex", flexDirection: "column", alignItems: "center", gap: ee("sm") })
584
- }, Gr = "M7 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V13C2 12.4696 2.21071 11.9609 2.58579 11.5858C2.96086 11.2107 3.46957 11 4 11H7M14 9V5C14 4.20435 13.6839 3.44129 13.1213 2.87868C12.5587 2.31607 11.7956 2 11 2L7 11V22H18.28C18.7623 22.0055 19.2304 21.8364 19.5979 21.524C19.9654 21.2116 20.2077 20.7769 20.28 20.3L21.66 11.3C21.7035 11.0134 21.6842 10.7207 21.6033 10.4423C21.5225 10.1638 21.3821 9.90629 21.1919 9.68751C21.0016 9.46873 20.7661 9.29393 20.5016 9.17522C20.2371 9.0565 19.9499 8.99672 19.66 9H14Z", Tr = "M17 2H20C20.5304 2 21.0391 2.21071 21.4142 2.58579C21.7893 2.96086 22 3.46957 22 4V11C22 11.5304 21.7893 12.0391 21.4142 12.4142C21.0391 12.7893 20.5304 13 20 13H17M10 15V19C10 19.7956 10.3161 20.5587 10.8787 21.1213C11.4413 21.6839 12.2044 22 13 22L17 13V2H5.72C5.23766 1.99448 4.76962 2.16361 4.40206 2.47596C4.03451 2.78831 3.79232 3.22305 3.72 3.7L2.34 12.7C2.29648 12.9866 2.31583 13.2793 2.39668 13.5577C2.47753 13.8362 2.61793 14.0937 2.80816 14.3125C2.99839 14.5313 3.23394 14.7061 3.49843 14.8248C3.76291 14.9435 4.05011 15.0033 4.34 15H10Z", Rr = (e) => {
585
- const { t: i } = oe(), r = ie(), o = r ? "mobile" : "desktop", [a, u] = U(e.prediction), s = (l) => {
586
- u(l), e.onSelectionChange(l);
587
- }, d = (l, c, y) => {
588
- const g = a === l;
589
- return /* @__PURE__ */ f("div", { css: Ir.option, children: [
590
- /* @__PURE__ */ t(
591
- "div",
592
- {
593
- css: g ? l ? ht[o].yes : ht[o].no : ht[o].icon,
594
- onClick: () => s(l),
595
- children: /* @__PURE__ */ t(
596
- "svg",
597
- {
598
- width: r ? "20" : "24",
599
- height: r ? "20" : "24",
600
- viewBox: "0 0 24 24",
601
- fill: "none",
602
- xmlns: "http://www.w3.org/2000/svg",
603
- children: /* @__PURE__ */ t("path", { d: c, stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
604
- }
605
- )
606
- }
607
- ),
608
- /* @__PURE__ */ t("p", { css: ht[o].label, children: y })
609
- ] });
610
- };
611
- return /* @__PURE__ */ f("div", { css: ht[o].root, children: [
612
- d(!0, Gr, i("eventGame.fixtures.yes")),
613
- d(!1, Tr, i("eventGame.fixtures.no"))
614
- ] });
615
- }, rn = (e) => /* @__PURE__ */ t(
616
- On,
617
- {
618
- question: e.question,
619
- fixtureId: e.fixtureId,
620
- brandingPrimaryColor: e.brandingPrimaryColor,
621
- isSplitVariant: e.isSplitVariant,
622
- useExtraSmallLayout: e.useExtraSmallLayout,
623
- showPoints: e.showPoints,
624
- children: /* @__PURE__ */ t(Rr, { onSelectionChange: e.onSelectionChange, prediction: e.prediction })
625
- }
626
- ), li = 4, si = (e) => {
627
- const i = (o) => `calc(${o}em / ${e})`, r = {
628
- display: "flex",
629
- alignItems: "center",
630
- marginInlineStart: i(0.5),
631
- marginInlineEnd: i(-0.1875)
632
- };
633
- return {
634
- root: n({
635
- boxSizing: "border-box",
636
- display: "flex",
637
- position: "relative",
638
- alignItems: "center",
639
- minWidth: 0,
640
- minHeight: i(2.25),
641
- paddingBlock: `calc(${0.25 / e}em - 1px)`,
642
- paddingInline: i(0.75),
643
- border: `1px solid ${de.border}`,
644
- borderRadius: qe("md"),
645
- backgroundColor: de.surface,
646
- color: de.color,
647
- fontFamily: G.fontSecondary,
648
- fontSize: `${e}em`,
649
- lineHeight: 1.5,
650
- boxShadow: Mn,
651
- cursor: "pointer",
652
- "&:hover": { backgroundColor: de.hoverBg }
653
- }),
654
- indicator: n(r, { color: G.textIcon }),
655
- indicatorOpen: n(r),
656
- list: n({
657
- position: "absolute",
658
- zIndex: 1300,
659
- boxSizing: "border-box",
660
- display: "flex",
661
- flexDirection: "column",
662
- minWidth: "max-content",
663
- maxHeight: e === 1 ? "300px" : "200px",
664
- overflow: "auto",
665
- outline: 0,
666
- margin: 0,
667
- paddingBlock: "0.375em",
668
- paddingInline: 0,
669
- listStyle: "none",
670
- fontFamily: $e,
671
- fontSize: "1em",
672
- lineHeight: 1.5,
673
- color: "var(--fu-ucrc-neutral-outlined-color)",
674
- backgroundColor: de.popup,
675
- border: `1px solid ${de.border}`,
676
- borderRadius: qe("sm"),
677
- boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
678
- }),
679
- option: n({
680
- boxSizing: "border-box",
681
- position: "relative",
682
- display: "flex",
683
- alignItems: "center",
684
- alignSelf: "stretch",
685
- flex: "none",
686
- minInlineSize: 0,
687
- gap: i(0.625),
688
- minBlockSize: i(2.25),
689
- paddingBlock: i(0.25),
690
- paddingInline: i(0.75),
691
- border: "1px solid transparent",
692
- fontFamily: G.fontSecondary,
693
- fontSize: `${e}em`,
694
- lineHeight: "inherit",
695
- color: de.color,
696
- backgroundColor: de.popup,
697
- cursor: "pointer",
698
- WebkitTapHighlightColor: "transparent",
699
- "&:hover": { backgroundColor: de.hoverBg },
700
- "&[aria-selected='true']": { backgroundColor: de.activeBg },
701
- "&[aria-selected='true']:hover": { backgroundColor: de.hoverBg },
702
- // Joy's offset var was unresolved, so its 2px fallback drew the ring outside the option.
703
- "&:focus-visible": { outline: `2px solid ${G.focus}`, outlineOffset: "2px", zIndex: 1 }
704
- })
705
- };
706
- }, xt = { mobile: si(0.875), desktop: si(1) }, di = {
707
- display: "flex",
708
- alignItems: "center",
709
- alignSelf: "stretch",
710
- flex: 1,
711
- margin: 0,
712
- padding: 0,
713
- border: 0,
714
- outline: 0,
715
- background: "none",
716
- color: "inherit",
717
- fontFamily: "inherit",
718
- fontSize: "inherit",
719
- lineHeight: "normal",
720
- whiteSpace: "nowrap",
721
- overflow: "hidden",
722
- cursor: "pointer",
723
- // Covers the whole field, so a press anywhere on it (the indicator too) opens the list.
724
- "&::before": { content: '""', display: "block", position: "absolute", inset: "-1px" }
725
- }, ui = {
726
- button: n(di),
727
- placeholder: n(di, { opacity: 0.64 })
728
- }, fi = (e) => {
729
- const i = window.devicePixelRatio || 1;
730
- return Math.round(e * i) / i;
731
- }, Dr = (e, i) => {
732
- const r = e.getBoundingClientRect(), o = i.offsetParent, u = !o || o === document.body || o === document.documentElement ? null : o.getBoundingClientRect(), s = u ? u.left + o.clientLeft - o.scrollLeft : -window.scrollX, d = u ? u.top + o.clientTop - o.scrollTop : -window.scrollY, l = i.offsetHeight, c = document.documentElement.clientHeight, y = r.bottom + li, g = r.top - li - l, x = y + l > c && g >= 0 ? g : y, h = document.documentElement.clientWidth - Math.max(r.width, i.offsetWidth), v = Math.max(0, Math.min(r.left, h));
733
- return { x: fi(v - s), y: fi(x - d), width: r.width };
734
- }, Er = (e) => {
735
- const { options: i, value: r } = e, o = Fn(), a = e.mobile ? "mobile" : "desktop", { shadowRootElement: u } = zn(Go), s = Oe(null), d = Oe(null), l = Oe(null), [c, y] = U(!1), [g, x] = U(-1), [h, v] = U(null), p = Oe({ text: "", at: 0 }), b = r === null ? -1 : i.indexOf(r), C = i.length - 1, I = (S = "start") => {
736
- x(b >= 0 ? b : S === "start" ? 0 : C), y(!0);
737
- }, w = (S) => {
738
- var R;
739
- y(!1), x(-1), S && ((R = d.current) == null || R.focus());
740
- }, T = (S) => {
741
- S >= 0 && e.onChange(i[S]), w(!0);
742
- };
743
- Pn(() => {
744
- if (!c) {
745
- v(null);
746
- return;
747
- }
748
- const S = () => {
749
- s.current && l.current && v(Dr(s.current, l.current));
750
- };
751
- return S(), window.addEventListener("resize", S), window.addEventListener("scroll", S, !0), () => {
752
- window.removeEventListener("resize", S), window.removeEventListener("scroll", S, !0);
753
- };
754
- }, [c]), Pn(() => {
755
- const S = l.current, R = S == null ? void 0 : S.children[g];
756
- if (!c || !h || !S || !R) return;
757
- R.focus({ preventScroll: !0 });
758
- const A = S.getBoundingClientRect(), L = R.getBoundingClientRect();
759
- L.top < A.top ? S.scrollTop -= A.top - L.top : L.bottom > A.bottom && (S.scrollTop += L.bottom - A.bottom);
760
- }, [c, h !== null, g]), je(() => {
761
- c || (p.current = { text: "", at: 0 });
762
- }, [c]);
763
- const W = (S) => {
764
- const R = {
765
- ArrowDown: () => g >= C ? 0 : g + 1,
766
- ArrowUp: () => g <= 0 ? C : g - 1,
767
- Home: () => 0,
768
- End: () => C,
769
- PageDown: () => Math.min(g + 5, C),
770
- PageUp: () => Math.max(g - 5, 0)
771
- };
772
- if (R[S.key])
773
- S.preventDefault(), x(R[S.key]());
774
- else if (S.key === "Enter" || S.key === " ")
775
- S.preventDefault(), T(g);
776
- else if (S.key === "Escape")
777
- S.preventDefault(), w(!0);
778
- else if (S.key.length === 1 && !S.ctrlKey && !S.metaKey && !S.altKey) {
779
- const A = Date.now(), L = (A - p.current.at < 500 ? p.current.text : "") + S.key.toLowerCase();
780
- p.current = { text: L, at: A };
781
- const le = L.length > 1 ? g : g + 1;
782
- for (let se = 0; se < i.length; se++) {
783
- const ge = (le + se) % i.length;
784
- if (i[ge].toLowerCase().startsWith(L)) {
785
- x(ge);
786
- break;
787
- }
788
- }
789
- }
790
- }, V = `${o}listbox`;
791
- return /* @__PURE__ */ f("div", { ref: s, css: xt[a].root, children: [
792
- /* @__PURE__ */ t(
793
- "button",
794
- {
795
- ref: d,
796
- type: "button",
797
- role: "combobox",
798
- "aria-expanded": c,
799
- "aria-controls": V,
800
- css: b < 0 ? ui.placeholder : ui.button,
801
- onClick: () => c ? w(!0) : I(),
802
- onKeyDown: (S) => {
803
- c || S.key !== "ArrowDown" && S.key !== "ArrowUp" || (S.preventDefault(), I(S.key === "ArrowDown" ? "start" : "end"));
804
- },
805
- children: b >= 0 ? i[b] : e.placeholder
806
- }
807
- ),
808
- /* @__PURE__ */ t("span", { css: c ? xt[a].indicatorOpen : xt[a].indicator, children: /* @__PURE__ */ t(tr, {}) }),
809
- c && cr(
810
- /* @__PURE__ */ t(
811
- "ul",
812
- {
813
- ref: l,
814
- id: V,
815
- role: "listbox",
816
- css: xt[a].list,
817
- style: {
818
- ...e.vars,
819
- left: 0,
820
- top: 0,
821
- ...h ? { width: `${h.width}px`, transform: `translate(${h.x}px, ${h.y}px)` } : { visibility: "hidden" }
822
- },
823
- onKeyDown: W,
824
- onBlur: (S) => {
825
- var A;
826
- const R = S.relatedTarget;
827
- R && ((A = l.current) != null && A.contains(R) || R === d.current) || w(!1);
828
- },
829
- children: i.map((S, R) => /* @__PURE__ */ t(
830
- "li",
831
- {
832
- role: "option",
833
- "aria-selected": R === b,
834
- tabIndex: R === g ? 0 : -1,
835
- css: xt[a].option,
836
- onClick: () => T(R),
837
- children: S
838
- },
839
- R
840
- ))
841
- }
842
- ),
843
- u ?? document.body
844
- )
845
- ] });
846
- }, $r = (e) => {
847
- const i = (o) => `calc(${o}em / ${e})`, r = {
848
- WebkitBoxShadow: `0 0 0 1000px ${de.surface} inset !important`,
849
- WebkitTextFillColor: `${de.color} !important`
850
- };
851
- return {
852
- root: n({
853
- boxSizing: "border-box",
854
- display: "flex",
855
- position: "relative",
856
- minWidth: 0,
857
- minHeight: i(2.25),
858
- paddingInline: i(0.75),
859
- border: `1px solid ${de.border}`,
860
- borderRadius: qe("md"),
861
- outline: "none",
862
- backgroundColor: de.surface,
863
- color: de.color,
864
- fontFamily: G.fontSecondary,
865
- fontSize: `${e}em`,
866
- lineHeight: 1.5,
867
- boxShadow: Mn,
868
- cursor: "text",
869
- "&:hover": { backgroundColor: de.hoverBg },
870
- "&:focus-within": { backgroundColor: de.surface, outline: `2px solid ${G.primary}`, outlineOffset: "2px" },
871
- "& input:-webkit-autofill": { ...r, caretColor: de.color, borderRadius: qe("md") },
872
- "& input:-webkit-autofill:hover, & input:-webkit-autofill:focus, & input:-webkit-autofill:active": r,
873
- "& input:autofill": { backgroundColor: `${de.surface} !important`, color: `${de.color} !important` }
874
- }),
875
- input: n({
876
- flex: 1,
877
- minWidth: 0,
878
- margin: 0,
879
- padding: 0,
880
- border: "none",
881
- outline: 0,
882
- color: "inherit",
883
- backgroundColor: "transparent",
884
- font: "inherit",
885
- textOverflow: "ellipsis",
886
- "&::placeholder": { color: "inherit", opacity: 0.64 },
887
- "&:-webkit-autofill": { paddingInline: i(0.75), marginInline: i(-0.75) }
888
- })
889
- };
890
- }, mi = {
891
- borderRadius: qe("sm"),
892
- flex: 1,
893
- padding: ee("xs"),
894
- gap: ee("xs"),
895
- backgroundColor: "#FFFFFF",
896
- boxShadow: "none",
897
- cursor: "pointer",
898
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
899
- transform: "scale(1)",
900
- display: "flex",
901
- flexDirection: "column",
902
- "--fu-ucrc-eg-option-text": de.text,
903
- "&:hover": { transform: "scale(1.02)" },
904
- "&:active": { transform: "scale(0.98)" }
905
- }, gi = (e) => {
906
- const i = { width: "100%", maxWidth: e ? "100%" : "500px" };
907
- return {
908
- root: n({
909
- display: "flex",
910
- alignItems: "center",
911
- justifyContent: "center",
912
- width: "100%",
913
- paddingTop: ee(e ? "md" : "lg")
914
- }),
915
- box: n(i),
916
- // Rows of two, and the row layout, stack on mobile.
917
- pair: n({ display: "flex", flexDirection: e ? "column" : "row", gap: "16px" }),
918
- row: n({ display: "flex", flexWrap: "wrap", flexDirection: e ? "column" : "row", gap: "16px" }),
919
- field: $r(e ? 0.875 : 1)
920
- };
921
- }, Ke = { mobile: gi(!0), desktop: gi(!1) }, vt = {
922
- column: n({ display: "flex", flexDirection: "column", gap: "16px" }),
923
- card: n(mi),
924
- picked: n(mi, {
925
- backgroundColor: G.primary,
926
- boxShadow: `inset 0 0 0 var(--fu-ucrc-border-size) ${G.primary}`,
927
- "--fu-ucrc-eg-option-text": G.onPrimary
928
- }),
929
- label: n({
930
- margin: 0,
931
- marginBlock: "auto",
932
- fontFamily: G.fontPrimary,
933
- fontWeight: 500,
934
- fontSize: "0.935em",
935
- lineHeight: "16px",
936
- letterSpacing: "0.46px",
937
- textAlign: "center",
938
- color: "var(--fu-ucrc-eg-option-text)",
939
- paddingInline: ee("2xs")
940
- })
941
- }, Ar = (e) => {
942
- const { t: i } = oe(), r = ie(), o = r ? "mobile" : "desktop", a = fr(), [u, s] = U(e.prediction || ""), d = (h) => {
943
- s(h), e.onTextChange(h);
944
- }, c = e.validOutcomes ? typeof e.validOutcomes == "object" && "options" in e.validOutcomes ? e.validOutcomes.options : Array.isArray(e.validOutcomes) ? e.validOutcomes : null : null, y = c && c.length > 0, g = (h, v) => /* @__PURE__ */ t("div", { css: u === h ? vt.picked : vt.card, onClick: () => d(h), children: /* @__PURE__ */ t("p", { css: vt.label, children: h }) }, v), x = () => {
945
- if (!c || !e.optionsLayout) return null;
946
- if (e.optionsLayout === "twoByTwo") {
947
- const h = [];
948
- for (let v = 0; v < c.length; v += 2) h.push(c.slice(v, v + 2));
949
- return /* @__PURE__ */ t("div", { css: vt.column, children: h.map((v, p) => /* @__PURE__ */ t("div", { css: Ke[o].pair, children: v.map(g) }, `row-${p}`)) });
950
- }
951
- return e.optionsLayout === "column" ? /* @__PURE__ */ t("div", { css: vt.column, children: c.map(g) }) : /* @__PURE__ */ t("div", { css: Ke[o].row, children: c.map(g) });
952
- };
953
- return /* @__PURE__ */ t("div", { css: Ke[o].root, style: a, children: y ? /* @__PURE__ */ t("div", { css: Ke[o].box, children: e.optionsLayout ? x() : /* @__PURE__ */ t(
954
- Er,
955
- {
956
- options: c,
957
- value: u || null,
958
- onChange: d,
959
- placeholder: i("eventGame.fixtures.textSelectPlaceholder"),
960
- mobile: r,
961
- vars: a
962
- }
963
- ) }) : /* @__PURE__ */ t("div", { css: Ke[o].box, children: /* @__PURE__ */ t(
964
- "div",
965
- {
966
- css: Ke[o].field.root,
967
- onClick: (h) => {
968
- const v = h.currentTarget.firstElementChild;
969
- h.target !== v && (v == null || v.focus());
970
- },
971
- children: /* @__PURE__ */ t(
972
- "input",
973
- {
974
- css: Ke[o].field.input,
975
- value: u,
976
- onChange: (h) => d(h.target.value),
977
- placeholder: i("eventGame.fixtures.textInputPlaceholder")
978
- }
979
- )
980
- }
981
- ) }) });
982
- }, Ze = (e) => /* @__PURE__ */ t(
983
- On,
984
- {
985
- question: e.question,
986
- fixtureId: e.fixtureId,
987
- brandingPrimaryColor: e.brandingPrimaryColor,
988
- isSplitVariant: e.isSplitVariant,
989
- useExtraSmallLayout: e.useExtraSmallLayout,
990
- showPoints: e.showPoints,
991
- children: /* @__PURE__ */ t(
992
- Ar,
993
- {
994
- onTextChange: e.onTextChange,
995
- prediction: e.prediction,
996
- validOutcomes: e.validOutcomes,
997
- optionsLayout: e.optionsLayout
998
- }
999
- )
1000
- }
1001
- ), Lr = "var(--fu-ucrc-primary-plain-color)", zr = "var(--fu-ucrc-primary-outlined-border)", Gn = "var(--fu-ucrc-outline-enabled-border)", hi = {
1002
- width: "32px",
1003
- height: "32px",
1004
- borderRadius: "var(--fu-ucrc-radius-full)",
1005
- borderWidth: "1px",
1006
- borderStyle: "solid",
1007
- display: "flex",
1008
- alignItems: "center",
1009
- justifyContent: "center",
1010
- transition: "background-color 0.3s ease"
1011
- }, We = {
1012
- root: n({
1013
- display: "flex",
1014
- alignItems: "center",
1015
- justifyContent: "center",
1016
- paddingBlock: "var(--fu-ucrc-space-xs)",
1017
- width: "100%",
1018
- zIndex: 1
1019
- }),
1020
- mobile: n({ display: "flex", alignItems: "center", justifyContent: "center", width: "100%" }),
1021
- mobileLine: n({ flex: 1, height: "3px", backgroundColor: Gn, borderRadius: "1px" }),
1022
- mobileCircle: n({ ...hi, marginInline: "12px" }),
1023
- circle: n({ ...hi, position: "relative" }),
1024
- // Px, as before.
1025
- number: n({ margin: 0, fontFamily: $e, fontSize: "14px", fontWeight: 600, lineHeight: 1 }),
1026
- line: n({ width: "32px", height: "3px", transition: "background-color 0.3s ease", borderRadius: "2px" })
1027
- }, Un = (e) => {
1028
- const i = ie(), r = e.brandingPrimaryColor || Lr, o = e.brandingPrimaryColor || zr, a = () => /* @__PURE__ */ f("div", { css: We.mobile, children: [
1029
- /* @__PURE__ */ t("div", { css: We.mobileLine }),
1030
- /* @__PURE__ */ t("div", { css: We.mobileCircle, style: { backgroundColor: r, borderColor: o }, children: /* @__PURE__ */ t("p", { css: We.number, style: { color: "#FFFFFF" }, children: e.currentStep }) }),
1031
- /* @__PURE__ */ t("div", { css: We.mobileLine })
1032
- ] }), u = () => {
1033
- const s = e.totalSteps || e.eventGame.fixtures.length, d = [];
1034
- for (let l = 0; l < s; l++) {
1035
- const c = l + 1, [y, g, x] = c < e.currentStep ? [r, o, "#FFFFFF"] : c === e.currentStep ? [r, o, "var(--fu-ucrc-primary-on-primary)"] : ["var(--fu-ucrc-neutral-soft-bg)", Gn, "var(--fu-ucrc-text-color)"];
1036
- d.push(
1037
- /* @__PURE__ */ t("div", { css: We.circle, style: { backgroundColor: y, borderColor: g }, children: /* @__PURE__ */ t("p", { css: We.number, style: { color: x }, children: c }) }, `step-${c}`)
1038
- ), l < s - 1 && d.push(
1039
- /* @__PURE__ */ t(
1040
- "div",
1041
- {
1042
- css: We.line,
1043
- style: { backgroundColor: c < e.currentStep ? r : Gn }
1044
- },
1045
- `line-${c}`
1046
- )
1047
- );
1048
- }
1049
- return d;
1050
- };
1051
- return /* @__PURE__ */ t("div", { css: We.root, children: i || e.isSplitVariant ? a() : u() });
1052
- }, ln = "var(--fu-ucrc-font-primary)", xi = (e) => ({
1053
- root: n({
1054
- display: "flex",
1055
- flexDirection: "column",
1056
- alignItems: "center",
1057
- gap: "var(--fu-ucrc-space-sm)",
1058
- paddingTop: e ? 0 : "var(--fu-ucrc-space-md)",
1059
- paddingInline: "var(--fu-ucrc-space-md)",
1060
- zIndex: 1
1061
- }),
1062
- title: n({
1063
- margin: 0,
1064
- fontFamily: ln,
1065
- fontWeight: 500,
1066
- fontSize: e ? "1.125em" : "1.25em",
1067
- lineHeight: 1.2,
1068
- color: "var(--fu-ucrc-text-primary)",
1069
- textAlign: "center"
1070
- }),
1071
- row: n({
1072
- display: "flex",
1073
- alignItems: "center",
1074
- justifyContent: "center",
1075
- gap: e ? "var(--fu-ucrc-space-xs)" : "var(--fu-ucrc-space-sm)"
1076
- }),
1077
- unit: n({
1078
- display: "flex",
1079
- alignItems: "center",
1080
- justifyContent: "center",
1081
- gap: "var(--fu-ucrc-space-2xs)",
1082
- backgroundColor: "var(--fu-ucrc-neutral-soft-bg)",
1083
- borderRadius: "var(--fu-ucrc-radius-sm)",
1084
- minWidth: e ? "var(--fu-ucrc-space-2xl)" : "var(--fu-ucrc-space-3xl)",
1085
- paddingInline: e ? "var(--fu-ucrc-space-2xs)" : "var(--fu-ucrc-space-xs)",
1086
- paddingBlock: e ? "var(--fu-ucrc-space-3xs)" : "var(--fu-ucrc-space-2xs)"
1087
- }),
1088
- value: n({
1089
- margin: 0,
1090
- lineHeight: 1.5,
1091
- fontFamily: ln,
1092
- fontWeight: 500,
1093
- fontSize: e ? "1em" : "1.5em",
1094
- color: "var(--fu-ucrc-text-primary)"
1095
- }),
1096
- label: n({
1097
- margin: 0,
1098
- lineHeight: 1.5,
1099
- fontFamily: "var(--fu-ucrc-font-secondary)",
1100
- fontWeight: 400,
1101
- fontSize: e ? "0.625em" : "0.75em",
1102
- color: "var(--fu-ucrc-text-secondary)"
1103
- }),
1104
- separator: n({
1105
- margin: 0,
1106
- lineHeight: 1.5,
1107
- fontFamily: ln,
1108
- fontWeight: 400,
1109
- fontSize: e ? "1em" : "1.25em",
1110
- color: "var(--fu-ucrc-text-secondary)",
1111
- display: "flex",
1112
- alignItems: "center",
1113
- justifyContent: "center",
1114
- width: "auto",
1115
- flexShrink: 0
1116
- })
1117
- }), Je = { regular: xi(!1), compact: xi(!0) }, Wn = (e) => {
1118
- const { t: i } = oe(), o = ie() || e.isSplitVariant ? "compact" : "regular", [a, u] = U({
1119
- days: 0,
1120
- hours: 0,
1121
- minutes: 0,
1122
- seconds: 0,
1123
- total: 0
1124
- }), s = en(() => {
1125
- const c = (/* @__PURE__ */ new Date()).getTime(), g = new Date(e.predictionsCutoffTime).getTime() - c;
1126
- if (g <= 0)
1127
- return { days: 0, hours: 0, minutes: 0, seconds: 0, total: 0 };
1128
- const x = Math.floor(g / (1e3 * 60 * 60 * 24)), h = Math.floor(g % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)), v = Math.floor(g % (1e3 * 60 * 60) / (1e3 * 60)), p = Math.floor(g % (1e3 * 60) / 1e3);
1129
- return { days: x, hours: h, minutes: v, seconds: p, total: g };
1130
- }, [e.predictionsCutoffTime]);
1131
- if (je(() => {
1132
- const c = () => u(s());
1133
- c();
1134
- const y = setInterval(c, 1e3);
1135
- return () => clearInterval(y);
1136
- }, [s]), a.total <= 0)
1137
- return null;
1138
- const d = (c, y) => /* @__PURE__ */ f("div", { css: Je[o].unit, children: [
1139
- /* @__PURE__ */ t("p", { css: Je[o].value, children: c.toString().padStart(2, "0") }),
1140
- /* @__PURE__ */ t("p", { css: Je[o].label, children: y })
1141
- ] }), l = /* @__PURE__ */ t("p", { css: Je[o].separator, children: ":" });
1142
- return /* @__PURE__ */ f("div", { css: Je[o].root, children: [
1143
- /* @__PURE__ */ t("p", { css: Je[o].title, children: i("eventGame.countdown.participationTimeLeft") }),
1144
- /* @__PURE__ */ f("div", { css: Je[o].row, children: [
1145
- a.days > 0 && /* @__PURE__ */ f(X, { children: [
1146
- d(a.days, i("eventGame.countdown.daysShort")),
1147
- l
1148
- ] }),
1149
- (a.days > 0 || a.hours > 0) && /* @__PURE__ */ f(X, { children: [
1150
- d(a.hours, i("eventGame.countdown.hoursShort")),
1151
- l
1152
- ] }),
1153
- d(a.minutes, i("eventGame.countdown.minutesShort")),
1154
- l,
1155
- d(a.seconds, i("eventGame.countdown.secondsShort"))
1156
- ] })
1157
- ] });
1158
- }, sn = "1px solid var(--fu-ucrc-outline-enabled-border)", dn = "var(--fu-ucrc-neutral-outlined-border)", zt = "var(--fu-ucrc-radius-md)", Ft = "var(--fu-ucrc-text-primary)", Fr = "0.375em 0.5em", vi = {
1159
- display: "flex",
1160
- alignItems: "center",
1161
- flexWrap: "wrap"
1162
- }, Be = {
1163
- container: n({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-sm)", width: "100%" }),
1164
- title: n({
1165
- margin: 0,
1166
- marginBottom: "var(--fu-ucrc-space-sm)",
1167
- fontFamily: "var(--fu-ucrc-font-primary)",
1168
- fontWeight: 600,
1169
- fontSize: "1em",
1170
- lineHeight: "1.25em",
1171
- color: Ft,
1172
- textAlign: "center"
1173
- }),
1174
- // Joy Sheet: plain neutral on background.surface.
1175
- tableContainer: n({
1176
- position: "relative",
1177
- overflowX: "auto",
1178
- borderRadius: zt,
1179
- border: sn,
1180
- backgroundColor: "var(--fu-ucrc-bg-surface)",
1181
- color: "var(--fu-ucrc-neutral-plain-color)",
1182
- fontFamily: $e,
1183
- fontSize: "1em",
1184
- lineHeight: 1.5
1185
- }),
1186
- // Joy Table: outlined, size sm, borderAxis bothBetween, no row hover.
1187
- table: n({
1188
- boxSizing: "border-box",
1189
- tableLayout: "fixed",
1190
- width: "100%",
1191
- borderSpacing: 0,
1192
- borderCollapse: "separate",
1193
- border: `1px solid ${dn}`,
1194
- borderRadius: zt,
1195
- fontFamily: $e,
1196
- fontSize: "1em",
1197
- fontWeight: 500,
1198
- lineHeight: 1.5,
1199
- color: "var(--fu-ucrc-neutral-outlined-color)",
1200
- backgroundColor: "var(--fu-ucrc-surface-variant)",
1201
- cursor: "default",
1202
- "& th, & td": { height: "32px", padding: Fr, borderColor: dn, verticalAlign: "middle" },
1203
- "& th": {
1204
- textAlign: "start",
1205
- overflow: "hidden",
1206
- textOverflow: "ellipsis",
1207
- whiteSpace: "nowrap",
1208
- backgroundColor: "var(--fu-ucrc-surface-variant)",
1209
- fontFamily: "var(--fu-ucrc-font-primary)",
1210
- fontWeight: 600,
1211
- color: Ft,
1212
- borderBottom: `2px solid ${dn}`
1213
- },
1214
- "& th:first-of-type": { borderTopLeftRadius: zt, fontSize: "0.75em" },
1215
- "& th:last-of-type": { borderTopRightRadius: zt },
1216
- "& tr > :not(:first-of-type)": { borderLeftWidth: "1px", borderLeftStyle: "solid" },
1217
- "& td": { borderBottom: sn },
1218
- "& tr:last-child > td": { borderBottom: "none" },
1219
- // Second column: the edit buttons.
1220
- "& tr > :last-of-type": { textAlign: "center", width: "30px" },
1221
- "& td:first-of-type": { width: "calc(100% - 30px)" }
1222
- }),
1223
- predictionContent: n({ ...vi, gap: "var(--fu-ucrc-space-sm)" }),
1224
- predictionContentCompact: n({ ...vi, gap: "var(--fu-ucrc-space-2xs)" }),
1225
- questionText: n({
1226
- margin: 0,
1227
- marginBottom: "2px",
1228
- fontFamily: "var(--fu-ucrc-font-secondary)",
1229
- fontWeight: 400,
1230
- fontSize: "1em",
1231
- lineHeight: "1em",
1232
- color: "var(--fu-ucrc-text-secondary)"
1233
- }),
1234
- predictionBox: n({
1235
- display: "flex",
1236
- alignItems: "center",
1237
- gap: "var(--fu-ucrc-space-xs)",
1238
- fontSize: "0.75em",
1239
- padding: "2px 6px",
1240
- minHeight: "20px",
1241
- borderRadius: "var(--fu-ucrc-radius-sm)",
1242
- border: sn,
1243
- backgroundColor: "var(--fu-ucrc-neutral-soft-bg)",
1244
- width: "fit-content"
1245
- }),
1246
- // A Typography inside the table: the box's font size and the table's line-height.
1247
- selectionText: n({
1248
- margin: 0,
1249
- fontFamily: "var(--fu-ucrc-font-primary)",
1250
- fontWeight: 500,
1251
- color: Ft
1252
- }),
1253
- // Joy IconButton plain sm; Joy's own hover colour wins over the sx one, the svg keeps its own.
1254
- editIconButton: n({
1255
- boxSizing: "border-box",
1256
- display: "inline-flex",
1257
- alignItems: "center",
1258
- justifyContent: "center",
1259
- position: "relative",
1260
- margin: 0,
1261
- padding: "4px",
1262
- minHeight: "24px",
1263
- minWidth: "24px",
1264
- fontFamily: $e,
1265
- fontSize: "inherit",
1266
- fontWeight: "inherit",
1267
- color: Ft,
1268
- backgroundColor: "transparent",
1269
- border: "none",
1270
- borderRadius: "var(--fu-ucrc-radius-sm)",
1271
- cursor: "pointer",
1272
- transition: "all 0.2s ease",
1273
- WebkitTapHighlightColor: "transparent",
1274
- "@media (hover: hover)": {
1275
- "&:hover": { color: "var(--fu-ucrc-neutral-plain-hover-color)" }
1276
- },
1277
- "&:hover": { backgroundColor: "var(--fu-ucrc-eg-edit-hover)" },
1278
- "&:focus-visible": { outline: "2px solid var(--fu-ucrc-focus-visible)", outlineOffset: "2px" }
1279
- })
1280
- };
1281
- /** @license Material Icons - Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0). Copyright Google LLC. */
1282
- const ho = lt.forwardRef((e, i) => /* @__PURE__ */ t(fo, { ref: i, "data-testid": "EditIcon", ...e, children: /* @__PURE__ */ t("path", { d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z" }) }));
1283
- ho.displayName = "EditIcon";
1284
- const pi = "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))", Tt = "1.25em", yi = {
1285
- position: "absolute",
1286
- top: "50%",
1287
- left: "50%",
1288
- transform: "translate(-50%, -50%)",
1289
- boxSizing: "border-box",
1290
- display: "flex",
1291
- flexDirection: "column",
1292
- gap: "0.75em 1em",
1293
- width: "100%",
1294
- minWidth: `min(calc(100vw - 2 * ${Tt}), 300px)`,
1295
- overflow: "auto",
1296
- border: "1px solid var(--fu-ucrc-neutral-outlined-border)",
1297
- borderRadius: "var(--fu-ucrc-radius-md)",
1298
- outline: 0,
1299
- boxShadow: `var(--fu-ucrc-shadow-ring), 0px 2px 8px -2px ${pi}, 0px 6px 12px -2px ${pi}`,
1300
- backgroundColor: "var(--fu-ucrc-surface)",
1301
- color: "var(--fu-ucrc-neutral-outlined-color)",
1302
- fontFamily: $e,
1303
- fontSize: "1em",
1304
- fontWeight: 400,
1305
- lineHeight: 1.5
1306
- }, Br = `max(calc(var(--fu-ucrc-radius-md) - 1px - ${Tt}), min(calc(${Tt} / 2), calc((var(--fu-ucrc-radius-md) - 1px) / 2)))`, bi = {
1307
- ...Pe,
1308
- padding: "0.375em 1em",
1309
- borderRadius: Br,
1310
- fontFamily: $e
1311
- }, Qe = {
1312
- dialog: n({ ...yi, maxWidth: "600px", maxHeight: "80vh", padding: "24px" }),
1313
- mobileDialog: n({ ...yi, maxWidth: "90vw", maxHeight: "90vh", padding: "16px" }),
1314
- // Joy IconButton with the widget's overrides; the icon keeps Joy's text.icon grey.
1315
- closeButton: n({
1316
- position: "absolute",
1317
- top: "var(--fu-ucrc-space-sm)",
1318
- right: "var(--fu-ucrc-space-sm)",
1319
- zIndex: 1e3,
1320
- boxSizing: "border-box",
1321
- display: "flex",
1322
- alignItems: "center",
1323
- justifyContent: "center",
1324
- width: "32px",
1325
- height: "32px",
1326
- minWidth: "32px",
1327
- minHeight: "32px",
1328
- margin: 0,
1329
- padding: 0,
1330
- border: "none",
1331
- borderRadius: "50%",
1332
- backgroundColor: "transparent",
1333
- color: "var(--fu-ucrc-text-secondary)",
1334
- fontFamily: $e,
1335
- fontSize: "inherit",
1336
- fontWeight: "inherit",
1337
- cursor: "pointer",
1338
- transition: "all 0.2s ease-in-out",
1339
- WebkitTapHighlightColor: "transparent",
1340
- "--fu-ucrc-eg-close-icon": "var(--fu-ucrc-joy-text-icon)",
1341
- "&:hover": {
1342
- backgroundColor: "var(--fu-ucrc-eg-close-hover)",
1343
- color: "var(--fu-ucrc-text-primary)",
1344
- transform: "scale(1.05)",
1345
- "--fu-ucrc-eg-close-icon": "currentColor"
1346
- },
1347
- "&:focus-visible": {
1348
- outline: "2px solid var(--fu-ucrc-focus-visible)",
1349
- outlineOffset: "2px",
1350
- "--fu-ucrc-eg-close-icon": "currentColor"
1351
- }
1352
- }),
1353
- // Joy DialogContent with the sx gap and bottom padding: the fixtures inherit its tertiary colour and body font.
1354
- content: n({
1355
- display: "flex",
1356
- flexDirection: "column",
1357
- flex: "9999 1 0%",
1358
- zIndex: 1,
1359
- gap: "var(--fu-ucrc-space-md)",
1360
- paddingBottom: "var(--fu-ucrc-space-lg)",
1361
- overflow: "auto",
1362
- color: "var(--fu-ucrc-joy-text-tertiary)"
1363
- }),
1364
- actions: n({
1365
- display: "flex",
1366
- alignItems: "center",
1367
- flexDirection: "row-reverse",
1368
- zIndex: 1,
1369
- gap: `calc(0.625 * ${Tt})`,
1370
- paddingTop: `calc(0.75 * ${Tt})`
1371
- }),
1372
- saveButton: n({
1373
- ...bi,
1374
- color: "#FFF",
1375
- backgroundColor: "var(--fu-ucrc-eg-save-bg)",
1376
- "&:active": { backgroundColor: "var(--fu-ucrc-primary-solid-active-bg)" },
1377
- "&:hover": { backgroundColor: "var(--fu-ucrc-eg-save-bg)", opacity: 0.8 },
1378
- "&:disabled": {
1379
- ...Pe["&:disabled"],
1380
- color: "transparent",
1381
- backgroundColor: "var(--fu-ucrc-neutral-soft-bg)"
1382
- }
1383
- }),
1384
- closeActionButton: n({
1385
- ...bi,
1386
- border: "1px solid var(--fu-ucrc-secondary-container)",
1387
- color: "var(--fu-ucrc-secondary-container)",
1388
- backgroundColor: "transparent",
1389
- "&:hover": {
1390
- borderColor: "var(--fu-ucrc-text-primary)",
1391
- color: "var(--fu-ucrc-text-primary)",
1392
- backgroundColor: "var(--fu-ucrc-surface-variant)"
1393
- },
1394
- "&:disabled": {
1395
- ...Pe["&:disabled"],
1396
- borderColor: "var(--fu-ucrc-secondary-container)",
1397
- color: "var(--fu-ucrc-secondary-container)",
1398
- opacity: 0.5
1399
- }
1400
- })
1401
- }, Vn = (e) => {
1402
- const i = (/* @__PURE__ */ new Date()).getTime(), r = new Date(e).getTime();
1403
- return i > r;
1404
- }, Dt = (e, i) => {
1405
- let r = e;
1406
- return (i == null ? void 0 : i.min) !== null && (i == null ? void 0 : i.min) !== void 0 && (r = Math.max(r, i.min)), (i == null ? void 0 : i.max) !== null && (i == null ? void 0 : i.max) !== void 0 && (r = Math.min(r, i.max)), r;
1407
- }, Mr = (e) => {
1408
- const { t: i } = oe(), r = Re(), o = ie(), [a, u] = U(!1), s = {
1409
- "--fu-ucrc-eg-save-bg": e.brandingPrimaryColor || "var(--fu-ucrc-primary-plain-color)",
1410
- "--fu-ucrc-eg-close-hover": `${r.textSecondary}15`
1411
- }, d = e.prediction.fixtures.find(
1412
- (g) => g.id === e.fixture.id
1413
- ), l = (g) => {
1414
- const x = { ...e.prediction }, h = x.fixtures.findIndex(
1415
- (v) => v.id === e.fixture.id
1416
- );
1417
- h !== -1 && (x.fixtures[h] = {
1418
- ...x.fixtures[h],
1419
- prediction: g
1420
- }), e.onPredictionUpdate(x);
1421
- }, c = async () => {
1422
- if (u(!0), e.fixture.outcomeType === F.NUMBER) {
1423
- const g = e.fixture.validOutcomes;
1424
- if (d && typeof d.prediction == "number") {
1425
- const x = Dt(
1426
- d.prediction,
1427
- g
1428
- );
1429
- x !== d.prediction && l(x);
1430
- }
1431
- }
1432
- try {
1433
- await e.play(), e.onPlayResult && e.onPlayResult({ success: !0 }), e.onClose();
1434
- } catch (g) {
1435
- console.error("Failed to save prediction:", g), e.onPlayResult && e.onPlayResult({ success: !1, error: g }), e.view !== "score" && e.onClose();
1436
- } finally {
1437
- u(!1);
1438
- }
1439
- }, y = () => {
1440
- const g = e.fixture.outcomeType;
1441
- if (g === F.NUMBER) {
1442
- const x = d == null ? void 0 : d.prediction, h = e.fixture.validOutcomes;
1443
- return /* @__PURE__ */ t(
1444
- on,
1445
- {
1446
- fixtureId: e.fixture.id,
1447
- prediction: x,
1448
- onChange: (v) => {
1449
- l(v);
1450
- },
1451
- question: e.fixture.question,
1452
- validOutcomes: h || null,
1453
- showPoints: !1,
1454
- isOverlayVariant: e.isOverlayVariant
1455
- }
1456
- );
1457
- }
1458
- if (g === F.BOOLEAN) {
1459
- const x = d == null ? void 0 : d.prediction;
1460
- return /* @__PURE__ */ t(
1461
- rn,
1462
- {
1463
- fixtureId: e.fixture.id,
1464
- onSelectionChange: (h) => {
1465
- l(h);
1466
- },
1467
- prediction: x,
1468
- question: e.fixture.question,
1469
- showPoints: !1
1470
- }
1471
- );
1472
- }
1473
- if (g === F.FREE_INPUT) {
1474
- const x = d == null ? void 0 : d.prediction;
1475
- return /* @__PURE__ */ t(
1476
- Ze,
1477
- {
1478
- fixtureId: e.fixture.id,
1479
- question: e.fixture.question,
1480
- prediction: x || null,
1481
- validOutcomes: null,
1482
- onTextChange: (h) => {
1483
- l(h);
1484
- },
1485
- showPoints: !1
1486
- }
1487
- );
1488
- }
1489
- if (g === F.ENUM) {
1490
- const x = d == null ? void 0 : d.prediction;
1491
- return /* @__PURE__ */ t(
1492
- Ze,
1493
- {
1494
- fixtureId: e.fixture.id,
1495
- question: e.fixture.question,
1496
- prediction: x || null,
1497
- validOutcomes: e.fixture.validOutcomes,
1498
- onTextChange: (h) => {
1499
- l(h);
1500
- },
1501
- showPoints: !1
1502
- }
1503
- );
1504
- }
1505
- return null;
1506
- };
1507
- return /* @__PURE__ */ t(Ho, { open: e.isOpen, onClose: e.onClose, children: /* @__PURE__ */ f("div", { role: "dialog", "aria-modal": "true", tabIndex: -1, css: o ? Qe.mobileDialog : Qe.dialog, style: s, children: [
1508
- /* @__PURE__ */ t("button", { type: "button", css: Qe.closeButton, onClick: e.onClose, children: /* @__PURE__ */ t(nr, { size: "1.25em", color: "var(--fu-ucrc-eg-close-icon)" }) }),
1509
- /* @__PURE__ */ t("div", { css: Qe.content, children: y() }),
1510
- e.view === "score" && /* @__PURE__ */ f("div", { css: Qe.actions, children: [
1511
- /* @__PURE__ */ f("button", { type: "button", css: Qe.saveButton, onClick: c, disabled: a, children: [
1512
- a && /* @__PURE__ */ t(tn, { size: 20, thickness: 2 }),
1513
- i("eventGame.buttons.save")
1514
- ] }),
1515
- /* @__PURE__ */ t("button", { type: "button", css: Qe.closeActionButton, onClick: e.onClose, disabled: a, children: i("eventGame.buttons.close") })
1516
- ] })
1517
- ] }) });
1518
- }, ft = (e) => {
1519
- const { t: i } = oe(), r = Re(), o = ie(), [a, u] = U(!1), [s, d] = U(null), l = (x) => {
1520
- d(e.fixtures[x]), u(!0);
1521
- }, c = () => {
1522
- if (e.view === "play" && s && s.outcomeType === F.NUMBER) {
1523
- const x = s.validOutcomes, h = e.prediction.fixtures.find((v) => v.id === s.id);
1524
- if (h && typeof h.prediction == "number") {
1525
- const v = Dt(h.prediction, x);
1526
- if (v !== h.prediction) {
1527
- const p = { ...e.prediction }, b = p.fixtures.findIndex((C) => C.id === s.id);
1528
- b !== -1 && (p.fixtures[b] = {
1529
- ...p.fixtures[b],
1530
- prediction: v
1531
- }, e.onPredictionUpdate(p));
1532
- }
1533
- }
1534
- }
1535
- u(!1), d(null);
1536
- }, y = (x) => {
1537
- e.onPredictionUpdate(x);
1538
- }, g = (x) => {
1539
- var p;
1540
- const h = (p = e.prediction.fixtures) == null ? void 0 : p.find((b) => b.id === x.id);
1541
- if (!h) return null;
1542
- const v = x.outcomeType === F.BOOLEAN ? h.prediction === !0 ? i("eventGame.fixtures.yes") : i("eventGame.fixtures.no") : h.prediction;
1543
- return /* @__PURE__ */ t("div", { css: Be.predictionBox, children: /* @__PURE__ */ t("p", { css: Be.selectionText, children: v }) });
1544
- };
1545
- return /* @__PURE__ */ f("div", { css: Be.container, children: [
1546
- /* @__PURE__ */ t("p", { css: Be.title, children: i("eventGame.summary.title") }),
1547
- /* @__PURE__ */ t(
1548
- "div",
1549
- {
1550
- css: Be.tableContainer,
1551
- style: { "--fu-ucrc-eg-edit-hover": `${r.textPrimary}15` },
1552
- children: /* @__PURE__ */ f("table", { css: Be.table, children: [
1553
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ f("tr", { children: [
1554
- /* @__PURE__ */ t("th", { children: i("eventGame.summary.prediction") }),
1555
- /* @__PURE__ */ t("th", {})
1556
- ] }) }),
1557
- /* @__PURE__ */ t("tbody", { children: e.fixtures.map((x, h) => /* @__PURE__ */ f("tr", { children: [
1558
- /* @__PURE__ */ t("td", { children: /* @__PURE__ */ f("div", { css: o || e.isSplitVariant ? Be.predictionContentCompact : Be.predictionContent, children: [
1559
- /* @__PURE__ */ t("p", { css: Be.questionText, children: x.question }),
1560
- g(x)
1561
- ] }) }),
1562
- /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("button", { type: "button", css: Be.editIconButton, onClick: () => l(h), children: /* @__PURE__ */ t(ho, { size: "1em", color: "var(--fu-ucrc-text-primary)" }) }) })
1563
- ] }, `${x.id}-${h}`)) })
1564
- ] })
1565
- }
1566
- ),
1567
- s && /* @__PURE__ */ t(
1568
- Mr,
1569
- {
1570
- isOpen: a,
1571
- onClose: c,
1572
- fixture: s,
1573
- prediction: e.prediction,
1574
- onPredictionUpdate: y,
1575
- play: e.play,
1576
- view: e.view,
1577
- isOverlayVariant: e.isOverlayVariant,
1578
- onPlayResult: e.onPlayResult,
1579
- brandingPrimaryColor: e.brandingPrimaryColor
1580
- }
1581
- )
1582
- ] });
1583
- }, be = (e) => `var(--fu-ucrc-space-${e})`, Rt = (e) => `var(--fu-ucrc-egs-${e})`, Hr = Rt("text"), Or = Rt("secondary"), xo = Rt("primary"), Tn = "var(--fu-ucrc-primary-on-primary)", Ci = "var(--fu-ucrc-danger-plain-color)", Rn = "var(--fu-ucrc-font-primary)", et = { display: "flex", flexDirection: "column" }, Bt = { display: "flex", alignItems: "center", gap: be("lg") }, Ur = Bn({
1584
- "0%": { opacity: 1, transform: "scale(1)" },
1585
- "50%": { opacity: 0.7, transform: "scale(1.1)" },
1586
- "100%": { opacity: 1, transform: "scale(1)" }
1587
- }), vo = {
1588
- ...Pe,
1589
- alignSelf: "center",
1590
- paddingBlock: "10px",
1591
- paddingInline: "16px",
1592
- borderRadius: "var(--fu-ucrc-radius-xl)",
1593
- fontSize: "0.9375em",
1594
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
1595
- transform: "scale(1)",
1596
- "&:active": { transform: "scale(0.98)" }
1597
- }, Si = {
1598
- ...ce,
1599
- fontFamily: Rn,
1600
- fontWeight: 500,
1601
- fontSize: "0.9375em",
1602
- lineHeight: "24px",
1603
- letterSpacing: "0.46px",
1604
- textTransform: "uppercase",
1605
- gap: "8px",
1606
- display: "flex",
1607
- alignItems: "center"
1608
- }, ki = {
1609
- ...vo,
1610
- backgroundColor: xo,
1611
- color: Tn,
1612
- "&:hover": { transform: "scale(1.02)" },
1613
- // Joy's loading state disabled the button.
1614
- "&:disabled": { ...Pe["&:disabled"], opacity: "12%" }
1615
- }, O = {
1616
- area: n({ ...et, padding: be("md") }),
1617
- areaMobile: n({ ...et, padding: be("sm") }),
1618
- question: n({ ...et, gap: be("md") }),
1619
- questionXs: n({ ...et, gap: be("lg") }),
1620
- content: n({
1621
- ...et,
1622
- borderRadius: "var(--fu-ucrc-radius-md)",
1623
- padding: be("md"),
1624
- gap: be("md"),
1625
- backgroundColor: Rt("content-bg"),
1626
- backdropFilter: "blur(4px)",
1627
- position: "relative",
1628
- zIndex: 2
1629
- }),
1630
- pagination: n({ ...et, alignItems: "center", gap: be("md") }),
1631
- navigation: n({ display: "flex", gap: be("md"), justifyContent: "center", alignItems: "center" }),
1632
- back: n({
1633
- ...vo,
1634
- border: `1px solid ${xo}`,
1635
- backgroundColor: "transparent",
1636
- color: Tn,
1637
- "&:hover": { backgroundColor: Rt("back-hover"), transform: "scale(1.02)" }
1638
- }),
1639
- // No colour in the old sx: Joy's body-md paints text.secondary.
1640
- backLabel: n({ ...Si, color: "var(--fu-ucrc-joy-text-secondary)" }),
1641
- next: n({ ...ki, cursor: "pointer", opacity: "1" }),
1642
- // Until a pick is made Next stays enabled, but is a dimmed no-op.
1643
- nextIdle: n({ ...ki, cursor: "not-allowed", opacity: "0.5" }),
1644
- nextLabel: n({ ...Si, color: Tn }),
1645
- gameState: n({
1646
- ...et,
1647
- alignItems: "center",
1648
- justifyContent: "center",
1649
- textAlign: "center",
1650
- padding: `${be("xs")} ${be("sm")}`,
1651
- gap: be("3xs")
1652
- }),
1653
- stateTitle: n({
1654
- ...ce,
1655
- fontFamily: Rn,
1656
- fontSize: "1.5em",
1657
- fontWeight: 700,
1658
- color: Hr,
1659
- lineHeight: 1.3
1660
- }),
1661
- stateDescription: n({
1662
- ...ce,
1663
- fontFamily: Rn,
1664
- fontSize: "1.25em",
1665
- letterSpacing: "0.15px",
1666
- fontWeight: 400,
1667
- color: Or,
1668
- lineHeight: 1.4,
1669
- opacity: "60%"
1670
- }),
1671
- liveRow: n({ display: "flex", alignItems: "center", gap: be("xs"), marginTop: be("xs") }),
1672
- liveDot: n({
1673
- width: "12px",
1674
- height: "12px",
1675
- borderRadius: "50%",
1676
- backgroundColor: Ci,
1677
- animation: `${Ur} 2s infinite`
1678
- }),
1679
- liveText: n({
1680
- ...ce,
1681
- fontFamily: "var(--fu-ucrc-font-secondary)",
1682
- fontSize: "0.875em",
1683
- color: Ci,
1684
- fontWeight: 600,
1685
- textTransform: "uppercase",
1686
- letterSpacing: "0.5px"
1687
- }),
1688
- closedHeader: n({
1689
- display: "flex",
1690
- alignItems: "center",
1691
- justifyContent: "center",
1692
- gap: be("sm"),
1693
- flexWrap: "wrap"
1694
- })
1695
- }, un = {
1696
- row: {
1697
- logo: n({ ...Bt, flexDirection: "row", justifyContent: "space-between" }),
1698
- end: n({ ...Bt, flexDirection: "row", justifyContent: "flex-end" })
1699
- },
1700
- xs: {
1701
- logo: n({ ...Bt, flexDirection: "column", justifyContent: "space-between" }),
1702
- end: n({ ...Bt, flexDirection: "column", justifyContent: "flex-end" })
1703
- }
1704
- }, Wr = (e) => {
1705
- var fe, De, Ge, ve, k, q, Z;
1706
- const [i, r] = lt.useState(1), { t: o } = oe(), a = ie(), u = dt(), s = Re(), d = ((fe = e.eventGame.branding) == null ? void 0 : fe.colors) || null, l = a ? ((Ge = (De = e.eventGame.branding) == null ? void 0 : De.images) == null ? void 0 : Ge.mobileLogo) || ((k = (ve = e.eventGame.branding) == null ? void 0 : ve.images) == null ? void 0 : k.mainLogo) || "" : ((Z = (q = e.eventGame.branding) == null ? void 0 : q.images) == null ? void 0 : Z.mainLogo) || "", c = e.imagePosition || "left", y = _e(
1707
- {
1708
- images: e.eventGame.images,
1709
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
1710
- },
1711
- me.STANDARD
1712
- ), g = u || a && !!y, x = (d == null ? void 0 : d.contentColor) || s.textColor, h = (d == null ? void 0 : d.secondaryColor) || s.textColor, v = it((d == null ? void 0 : d.backgroundColor) || s.surfaceVariant || ""), p = (d == null ? void 0 : d.primaryColor) || s.palette.primary.plainColor, b = {
1713
- "--fu-ucrc-egs-text": x,
1714
- "--fu-ucrc-egs-secondary": h,
1715
- "--fu-ucrc-egs-primary": p,
1716
- "--fu-ucrc-egs-content-bg": `rgba(${v ? v.replace(/[^\d,]/g, "") : ""}, 0.5)`,
1717
- "--fu-ucrc-egs-back-hover": `${p}10`
1718
- }, C = g ? "xs" : "row", I = (m, P) => {
1719
- var D, B, M, K;
1720
- return /* @__PURE__ */ t(
1721
- pe,
1722
- {
1723
- brandingLogo: l,
1724
- textColor: m,
1725
- label: null,
1726
- flexDirection: P,
1727
- primaryUrl: (B = (D = e.eventGame.branding) == null ? void 0 : D.urls) == null ? void 0 : B.primaryUrl,
1728
- secondaryUrl: (K = (M = e.eventGame.branding) == null ? void 0 : M.urls) == null ? void 0 : K.secondaryUrl
1729
- }
1730
- );
1731
- }, w = en(
1732
- (m, P) => {
1733
- e.setPrediction((D) => {
1734
- const B = { ...D }, M = B.fixtures.find(
1735
- (K) => K.id === m
1736
- );
1737
- return M && (M.prediction = P), B;
1738
- });
1739
- },
1740
- [e.setPrediction]
1741
- ), T = e.eventGame.fixtures.length + 1, W = e.eventGame.status === "OPEN" && Vn(e.eventGame.predictionsCutoff || ""), V = () => {
1742
- var P, D;
1743
- const m = e.eventGame.fixtures[i - 1];
1744
- if (m && m.outcomeType === F.NUMBER) {
1745
- const B = m.validOutcomes, M = (D = (P = e.prediction) == null ? void 0 : P.fixtures) == null ? void 0 : D.find(
1746
- (K) => K.id === m.id
1747
- );
1748
- if (M && typeof M.prediction == "number") {
1749
- const K = Dt(
1750
- M.prediction,
1751
- B
1752
- );
1753
- K !== M.prediction && w(m.id, K);
1754
- }
1755
- }
1756
- i < T ? r(i + 1) : e.play();
1757
- }, S = (m) => {
1758
- r(m + 1);
1759
- }, R = () => {
1760
- var D, B;
1761
- if (i === T) return !0;
1762
- const m = e.eventGame.fixtures[i - 1];
1763
- if (!m) return !1;
1764
- const P = (B = (D = e.prediction) == null ? void 0 : D.fixtures) == null ? void 0 : B.find(
1765
- (M) => M.id === m.id
1766
- );
1767
- return P ? P.prediction !== null : !1;
1768
- }, A = () => {
1769
- i > 1 && r(i - 1);
1770
- }, L = (m) => /* @__PURE__ */ t("div", { css: a ? O.areaMobile : O.area, style: b, children: /* @__PURE__ */ f("div", { css: g ? O.questionXs : O.question, children: [
1771
- /* @__PURE__ */ t("div", { css: O.content, children: /* @__PURE__ */ t("div", { css: O.gameState, children: m }) }),
1772
- /* @__PURE__ */ t("div", { css: un[C].logo, children: I(x) })
1773
- ] }) }), le = () => L(
1774
- /* @__PURE__ */ f(X, { children: [
1775
- /* @__PURE__ */ t("p", { css: O.stateTitle, children: o("eventGame.states.pending.title") }),
1776
- /* @__PURE__ */ t("p", { css: O.stateDescription, children: o("eventGame.states.pending.description") })
1777
- ] })
1778
- ), se = () => L(
1779
- /* @__PURE__ */ f(X, { children: [
1780
- /* @__PURE__ */ f("div", { css: O.liveRow, children: [
1781
- /* @__PURE__ */ t("div", { css: O.liveDot }),
1782
- /* @__PURE__ */ t("p", { css: O.liveText, children: o("eventGame.states.live.indicator") })
1783
- ] }),
1784
- /* @__PURE__ */ t("p", { css: O.stateDescription, children: o("eventGame.states.live.description") })
1785
- ] })
1786
- ), ge = () => L(
1787
- /* @__PURE__ */ f(X, { children: [
1788
- /* @__PURE__ */ t("div", { css: O.closedHeader, children: /* @__PURE__ */ t("p", { css: O.stateTitle, children: o("eventGame.states.closed.title") }) }),
1789
- /* @__PURE__ */ t("p", { css: O.stateDescription, children: o("eventGame.states.closed.description") })
1790
- ] })
1791
- ), ue = () => /* @__PURE__ */ f("div", { css: O.gameState, children: [
1792
- /* @__PURE__ */ t("p", { css: O.stateTitle, children: o("eventGame.states.open.title") }),
1793
- /* @__PURE__ */ t("p", { css: O.stateDescription, children: o("eventGame.states.open.description") })
1794
- ] }), ye = () => {
1795
- const m = R();
1796
- return /* @__PURE__ */ f(X, { children: [
1797
- e.showCountdown && e.eventGame.status === "OPEN" && /* @__PURE__ */ t(
1798
- Wn,
1799
- {
1800
- predictionsCutoffTime: e.eventGame.predictionsCutoff || ""
1801
- }
1802
- ),
1803
- /* @__PURE__ */ t("div", { css: a ? O.areaMobile : O.area, style: b, children: /* @__PURE__ */ f("div", { css: g ? O.questionXs : O.question, children: [
1804
- !W && /* @__PURE__ */ t("div", { css: O.pagination, children: /* @__PURE__ */ t(
1805
- Un,
1806
- {
1807
- eventGame: e.eventGame,
1808
- currentStep: i,
1809
- totalSteps: T
1810
- }
1811
- ) }),
1812
- i === T ? /* @__PURE__ */ t(
1813
- ft,
1814
- {
1815
- fixtures: e.eventGame.fixtures,
1816
- prediction: e.prediction,
1817
- onEditPrediction: S,
1818
- onPredictionUpdate: e.setPrediction,
1819
- view: "play",
1820
- play: async () => e.play(),
1821
- brandingPrimaryColor: d == null ? void 0 : d.primaryColor
1822
- }
1823
- ) : /* @__PURE__ */ t("div", { css: O.content, children: te() }),
1824
- /* @__PURE__ */ f("div", { css: un[C][l ? "logo" : "end"], children: [
1825
- !g && I(x, "row"),
1826
- /* @__PURE__ */ f("div", { css: O.navigation, children: [
1827
- i > 1 && i < T && /* @__PURE__ */ t("button", { type: "button", css: O.back, onClick: A, children: /* @__PURE__ */ t("p", { css: O.backLabel, children: o("eventGame.buttons.back") }) }),
1828
- !W && /* @__PURE__ */ f(
1829
- "button",
1830
- {
1831
- type: "button",
1832
- css: m ? O.next : O.nextIdle,
1833
- onClick: m ? V : void 0,
1834
- disabled: e.isPlaying,
1835
- children: [
1836
- /* @__PURE__ */ t("p", { css: O.nextLabel, children: i === T ? e.hasAfterConsents ? o("eventGame.buttons.continue") : o("eventGame.buttons.play") : o("eventGame.buttons.next") }),
1837
- e.isPlaying && /* @__PURE__ */ t(tn, { size: 20, thickness: 3 })
1838
- ]
1839
- }
1840
- )
1841
- ] }),
1842
- g && I(x)
1843
- ] })
1844
- ] }) })
1845
- ] });
1846
- }, N = () => {
1847
- switch (e.eventGame.status) {
1848
- case "PENDING":
1849
- return le();
1850
- case "LIVE":
1851
- return se();
1852
- case "CLOSED":
1853
- return ge();
1854
- default:
1855
- return ye();
1856
- }
1857
- }, E = ot(() => e.eventGame.fixtures[i - 1], [e.eventGame.fixtures, i]), te = () => {
1858
- var P, D, B, M, K, Te, $, J;
1859
- const m = E;
1860
- if (W)
1861
- return ue();
1862
- if (m)
1863
- switch (m.outcomeType) {
1864
- case F.BOOLEAN:
1865
- const ne = (D = (P = e.prediction) == null ? void 0 : P.fixtures) == null ? void 0 : D.find(
1866
- (_) => _.id === m.id
1867
- );
1868
- return /* @__PURE__ */ t(
1869
- rn,
1870
- {
1871
- prediction: typeof (ne == null ? void 0 : ne.prediction) == "boolean" ? ne.prediction : null,
1872
- onSelectionChange: (_) => w(m.id, _),
1873
- useExtraSmallLayout: g,
1874
- question: m.question,
1875
- fixtureId: m.id
1876
- },
1877
- `${m.outcomeType}-${m.id}`
1878
- );
1879
- case F.NUMBER:
1880
- const re = (M = (B = e.prediction) == null ? void 0 : B.fixtures) == null ? void 0 : M.find(
1881
- (_) => _.id === m.id
1882
- ), Y = m.validOutcomes;
1883
- return /* @__PURE__ */ t(
1884
- on,
1885
- {
1886
- prediction: typeof (re == null ? void 0 : re.prediction) == "number" ? re.prediction : 0,
1887
- onChange: (_) => w(m.id, _),
1888
- useExtraSmallLayout: g,
1889
- question: m.question,
1890
- validOutcomes: Y,
1891
- fixtureId: m.id
1892
- },
1893
- `${m.outcomeType}-${m.id}`
1894
- );
1895
- case F.FREE_INPUT:
1896
- const Se = (Te = (K = e.prediction) == null ? void 0 : K.fixtures) == null ? void 0 : Te.find(
1897
- (_) => _.id === m.id
1898
- );
1899
- return /* @__PURE__ */ t(
1900
- Ze,
1901
- {
1902
- question: m.question,
1903
- prediction: typeof (Se == null ? void 0 : Se.prediction) == "string" ? Se.prediction : null,
1904
- validOutcomes: null,
1905
- onTextChange: (_) => w(m.id, _),
1906
- useExtraSmallLayout: g,
1907
- fixtureId: m.id
1908
- },
1909
- `${m.outcomeType}-${m.id}`
1910
- );
1911
- case F.ENUM:
1912
- const Ue = (J = ($ = e.prediction) == null ? void 0 : $.fixtures) == null ? void 0 : J.find(
1913
- (_) => _.id === m.id
1914
- );
1915
- return /* @__PURE__ */ t(
1916
- Ze,
1917
- {
1918
- question: m.question,
1919
- prediction: typeof (Ue == null ? void 0 : Ue.prediction) == "string" ? Ue.prediction : null,
1920
- validOutcomes: m.validOutcomes,
1921
- onTextChange: (_) => w(m.id, _),
1922
- useExtraSmallLayout: g,
1923
- fixtureId: m.id,
1924
- optionsLayout: e.optionsLayout
1925
- },
1926
- `${m.id}-${i}`
1927
- );
1928
- default:
1929
- return /* @__PURE__ */ t(X, {});
1930
- }
1931
- }, he = () => {
1932
- var m, P, D;
1933
- return /* @__PURE__ */ t("div", { css: a ? O.areaMobile : O.area, style: b, children: /* @__PURE__ */ f("div", { css: g ? O.questionXs : O.question, children: [
1934
- /* @__PURE__ */ t("div", { css: O.content, children: /* @__PURE__ */ t(
1935
- ut,
1936
- {
1937
- consents: e.consents,
1938
- primaryColor: p,
1939
- textColor: x,
1940
- brandingUrls: (m = e.eventGame.branding) == null ? void 0 : m.urls,
1941
- align: "center"
1942
- }
1943
- ) }),
1944
- /* @__PURE__ */ f("div", { css: un[C][l ? "logo" : "end"], children: [
1945
- l && I(x),
1946
- /* @__PURE__ */ t("div", { css: O.navigation, children: /* @__PURE__ */ t(
1947
- nn,
1948
- {
1949
- onClick: e.startPredicting,
1950
- label: ((D = (P = e.consents) == null ? void 0 : P.labels) == null ? void 0 : D.ctaLabel) || o("eventGame.buttons.start"),
1951
- isSubmitting: e.isSubmitting,
1952
- primaryColor: p,
1953
- showArrow: !1
1954
- }
1955
- ) })
1956
- ] })
1957
- ] }) });
1958
- };
1959
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ t(
1960
- so,
1961
- {
1962
- entity: { ...e.eventGame, labels: null },
1963
- headline: o("eventGame.headline"),
1964
- finalImage: y,
1965
- imagePosition: c,
1966
- rulesDisplay: e.rulesDisplay,
1967
- children: e.applyConsentGate ? he() : N()
1968
- }
1969
- ) });
1970
- }, Vr = { success: "success", error: "danger", info: "primary" }, Dn = { margin: 0, fontFamily: "var(--fu-ucrc-font-secondary)", lineHeight: 1.5 }, wi = (e, i) => n({
1971
- display: "flex",
1972
- alignItems: "center",
1973
- gap: i ? "calc(8em / 12)" : "calc(8em / 14)",
1974
- padding: i ? "1em" : "calc(12em / 14)",
1975
- fontSize: i ? "0.75em" : "0.875em",
1976
- fontFamily: "var(--fu-ucrc-font-body)",
1977
- lineHeight: 1.5,
1978
- borderRadius: "var(--fu-ucrc-radius-sm)",
1979
- color: `var(--fu-ucrc-${e}-soft-color)`,
1980
- backgroundColor: `var(--fu-ucrc-${e}-soft-bg)`,
1981
- "--Icon-fontSize": i ? "1em" : "1.25em"
1982
- }), Nr = (e) => n({ ...Dn, fontSize: "0.875em", fontWeight: 700, color: `rgb(var(--fu-ucrc-${e}-main-channel))` }), fn = Object.fromEntries(
1983
- Object.entries(Vr).map(([e, i]) => [
1984
- e,
1985
- { root: wi(i, !1), mobileRoot: wi(i, !0), title: Nr(i) }
1986
- ])
1987
- ), Mt = {
1988
- icon: n({ display: "flex", flexShrink: 0 }),
1989
- body: n({ display: "flex", flexDirection: "column", fontSize: "1.5em" }),
1990
- message: n({ ...Dn, fontSize: "0.675em", color: "var(--fu-ucrc-joy-text-tertiary)" }),
1991
- // Joy body-xs: weight 500.
1992
- description: n({ ...Dn, fontSize: "0.6em", fontWeight: 500, color: "var(--fu-ucrc-joy-text-tertiary)" })
1993
- }, Nn = ({ variant: e, title: i, message: r, description: o }) => {
1994
- const a = Ie(), u = ie(), s = e === "success" ? /* @__PURE__ */ t(ir, {}) : e === "error" ? /* @__PURE__ */ t(or, { color: a.colorSchemes.light.palette.danger.plainColor }) : /* @__PURE__ */ t(rr, {});
1995
- return /* @__PURE__ */ f("div", { role: "alert", css: u ? fn[e].mobileRoot : fn[e].root, children: [
1996
- /* @__PURE__ */ t("span", { css: Mt.icon, children: s }),
1997
- /* @__PURE__ */ f("div", { css: Mt.body, children: [
1998
- i && /* @__PURE__ */ t("p", { css: fn[e].title, children: i }),
1999
- r && /* @__PURE__ */ t("p", { css: Mt.message, children: r }),
2000
- o && /* @__PURE__ */ t("p", { css: Mt.description, children: o })
2001
- ] })
2002
- ] });
2003
- }, Ce = (e) => `var(--fu-ucrc-space-${e})`, pt = { display: "flex", flexDirection: "column" }, Pi = { display: "flex", justifyContent: "center", alignItems: "center" }, Ht = { display: "flex", flexDirection: "row", alignItems: "center", gap: Ce("md") }, Ii = {
2004
- ...Pe,
2005
- ...Pi,
2006
- flexDirection: "row",
2007
- gap: "8px",
2008
- borderRadius: "var(--fu-ucrc-radius-xl)",
2009
- border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-secondary-container)",
2010
- backgroundColor: "var(--fu-ucrc-secondary-container)",
2011
- // Joy's solidColor (common.white) is not in the theme snapshot.
2012
- color: "var(--fu-ucrc-primary-solid-color, #fff)",
2013
- "&:hover": { opacity: 0.9 },
2014
- "& > div": { ...Pi, gap: "8px" }
2015
- }, Gi = {
2016
- ...ce,
2017
- color: "var(--fu-ucrc-egs-ss-secondary)",
2018
- fontFamily: "var(--fu-ucrc-font-primary)",
2019
- fontStyle: "normal",
2020
- fontWeight: 500,
2021
- lineHeight: "22px",
2022
- letterSpacing: "0.46px",
2023
- textTransform: "uppercase"
2024
- }, Ee = {
2025
- area: n({ ...pt, padding: Ce("md") }),
2026
- areaMobile: n({ ...pt, padding: Ce("sm") }),
2027
- question: n({ ...pt, gap: Ce("md") }),
2028
- questionMobile: n({ ...pt, gap: Ce("lg") }),
2029
- content: n({ ...pt, borderRadius: "var(--fu-ucrc-radius-md)", gap: Ce("md") }),
2030
- chanceGame: n({ padding: Ce("md") }),
2031
- footer: n({ ...Ht, paddingInline: Ce("md"), justifyContent: "flex-start" }),
2032
- footerMobile: n({ ...Ht, paddingInline: Ce("sm"), justifyContent: "flex-start" }),
2033
- footerSpread: n({ ...Ht, paddingInline: Ce("md"), justifyContent: "space-between" }),
2034
- footerSpreadMobile: n({ ...Ht, paddingInline: Ce("sm"), justifyContent: "space-between" }),
2035
- additionalCta: n({
2036
- ...Ii,
2037
- paddingBlock: Ce("sm"),
2038
- paddingInline: Ce("md"),
2039
- "& p": { ...Gi, fontSize: "0.8125em" }
2040
- }),
2041
- additionalCtaMobile: n({
2042
- ...Ii,
2043
- paddingBlock: Ce("xs"),
2044
- paddingInline: Ce("sm"),
2045
- "& p": { ...Gi, fontSize: "0.75em" }
2046
- })
2047
- }, jr = (e) => {
2048
- var p, b, C, I, w, T, W;
2049
- const i = Re(), r = ie(), o = _e(
2050
- {
2051
- images: e.eventGame.images,
2052
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
2053
- },
2054
- me.STANDARD
2055
- ), { t: a } = oe(), u = r ? ((b = (p = e.eventGame.branding) == null ? void 0 : p.images) == null ? void 0 : b.mobileLogo) || ((I = (C = e.eventGame.branding) == null ? void 0 : C.images) == null ? void 0 : I.mainLogo) || "" : ((T = (w = e.eventGame.branding) == null ? void 0 : w.images) == null ? void 0 : T.mainLogo) || "", s = ((W = e.eventGame.branding) == null ? void 0 : W.colors) || null, d = e.imagePosition || "left", l = e.eventGame.status === "OPEN", c = (V) => {
2056
- console.log(`Edit prediction for fixture at index: ${V}`);
2057
- }, y = (s == null ? void 0 : s.contentColor) || i.textColor, x = { "--fu-ucrc-egs-ss-secondary": (s == null ? void 0 : s.secondaryColor) || i.textSecondary }, h = !!u && !!e.additionalCTA, v = () => /* @__PURE__ */ f(X, { children: [
2058
- e.isUnauthorized ? /* @__PURE__ */ t(
2059
- Nn,
2060
- {
2061
- variant: "error",
2062
- title: a("common.authentication.accessRequired"),
2063
- message: a("common.authentication.invalidOrMissingAuth")
2064
- }
2065
- ) : /* @__PURE__ */ t("div", { css: r ? Ee.areaMobile : Ee.area, children: /* @__PURE__ */ t("div", { css: r ? Ee.questionMobile : Ee.question, children: /* @__PURE__ */ t("div", { css: Ee.content, children: l ? /* @__PURE__ */ t(
2066
- ft,
2067
- {
2068
- fixtures: e.eventGame.fixtures,
2069
- prediction: e.prediction,
2070
- onEditPrediction: c,
2071
- onPredictionUpdate: e.onPredictionUpdate,
2072
- play: e.play,
2073
- view: "score",
2074
- onPlayResult: e.onPlayResult,
2075
- brandingPrimaryColor: s == null ? void 0 : s.primaryColor
2076
- }
2077
- ) : null }) }) }),
2078
- e.chanceGameContent && /* @__PURE__ */ t("div", { css: Ee.chanceGame, children: e.chanceGameContent }),
2079
- (u || e.additionalCTA) && /* @__PURE__ */ f(
2080
- "div",
2081
- {
2082
- css: r ? h ? Ee.footerSpreadMobile : Ee.footerMobile : h ? Ee.footerSpread : Ee.footer,
2083
- style: x,
2084
- children: [
2085
- /* @__PURE__ */ t(
2086
- pe,
2087
- {
2088
- brandingLogo: u,
2089
- textColor: y,
2090
- label: null
2091
- }
2092
- ),
2093
- /* @__PURE__ */ t(
2094
- Yt,
2095
- {
2096
- additionalCTA: e.additionalCTA,
2097
- css: r ? Ee.additionalCtaMobile : Ee.additionalCta
2098
- }
2099
- )
2100
- ]
2101
- }
2102
- )
2103
- ] });
2104
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (s == null ? void 0 : s.borderColor) || null, children: /* @__PURE__ */ t(
2105
- so,
2106
- {
2107
- entity: { ...e.eventGame, labels: null },
2108
- headline: a("eventGame.headline"),
2109
- finalImage: o,
2110
- imagePosition: d,
2111
- rulesDisplay: e.rulesDisplay,
2112
- children: v()
2113
- }
2114
- ) });
2115
- }, Ne = (e) => `var(--fu-ucrc-space-${e})`, Ti = "var(--fu-ucrc-secondary-container)", Ri = (e) => n(Pe, {
2116
- display: "flex",
2117
- paddingBlock: Ne(e ? "xs" : "sm"),
2118
- paddingInline: Ne(e ? "sm" : "md"),
2119
- flexDirection: "row",
2120
- justifyContent: "center",
2121
- alignItems: "center",
2122
- gap: "8px",
2123
- borderRadius: "var(--fu-ucrc-radius-xl)",
2124
- backgroundColor: Ti,
2125
- border: `var(--fu-ucrc-border-size) solid ${Ti}`,
2126
- color: "#fff",
2127
- "&:hover": { opacity: 0.9 },
2128
- fontSize: e ? "0.75em" : "0.8125em",
2129
- textTransform: "uppercase",
2130
- "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
2131
- "& p": {
2132
- margin: 0,
2133
- color: "var(--fu-ucrc-eg-split-secondary)",
2134
- fontFamily: "var(--fu-ucrc-font-primary)",
2135
- fontSize: `calc(1em / ${e ? 0.75 : 0.8125})`,
2136
- fontStyle: "normal",
2137
- fontWeight: 500,
2138
- lineHeight: "22px",
2139
- letterSpacing: "0.46px",
2140
- textTransform: "uppercase"
2141
- }
2142
- }), Di = { display: "flex", justifyContent: "center", alignItems: "center" }, Ei = { display: "flex", flexDirection: "column", justifyContent: "center" }, tt = {
2143
- questionAreaContent: n({
2144
- padding: Ne("lg"),
2145
- display: "flex",
2146
- flexDirection: "column",
2147
- justifyContent: "center",
2148
- gap: Ne("lg"),
2149
- flex: 1,
2150
- height: "100%"
2151
- }),
2152
- // Translucent panel, from the branding background.
2153
- panel: n({
2154
- padding: Ne("lg"),
2155
- gap: Ne("lg"),
2156
- display: "flex",
2157
- flexDirection: "column",
2158
- backdropFilter: "blur(4px)",
2159
- backgroundColor: "var(--fu-ucrc-eg-split-bg)",
2160
- borderRadius: "var(--fu-ucrc-radius-sm)",
2161
- position: "relative",
2162
- overflow: "visible"
2163
- }),
2164
- ctaWrapper: {
2165
- mobile: n(Di, { padding: Ne("sm") }),
2166
- desktop: n(Di, { padding: Ne("md") })
2167
- },
2168
- additional: { mobile: Ri(!0), desktop: Ri(!1) },
2169
- alertArea: {
2170
- stacked: n(Ei, { flex: 1, width: "100%", minWidth: "100%", maxWidth: "100%" }),
2171
- side: n(Ei, { flex: "0 0 50%", width: "50%", minWidth: "50%", maxWidth: "50%" })
2172
- },
2173
- alertWrapper: n({ padding: Ne("lg") })
2174
- }, qr = (e) => {
2175
- var C, I, w, T, W, V, S, R, A, L, le, se, ge, ue, ye;
2176
- const { t: i } = oe(), r = Re(), o = ie(), a = lo(), u = Ie(), s = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : o ? at : ct, d = _e(
2177
- {
2178
- images: e.eventGame.images,
2179
- imagePlaceholder: s
2180
- },
2181
- me.SPLIT
2182
- ), l = o ? ((I = (C = e.eventGame.branding) == null ? void 0 : C.images) == null ? void 0 : I.mobileLogo) || ((T = (w = e.eventGame.branding) == null ? void 0 : w.images) == null ? void 0 : T.mainLogo) || "" : ((V = (W = e.eventGame.branding) == null ? void 0 : W.images) == null ? void 0 : V.mainLogo) || "", c = ((S = e.eventGame.branding) == null ? void 0 : S.colors) || null, y = (c == null ? void 0 : c.backgroundColor) || r.surfaceVariant, g = (c == null ? void 0 : c.contentColor) || r.textColor, x = {
2183
- "--fu-ucrc-eg-split-bg": `rgba(${y ? it(y || "").replace(/[^\d,]/g, "") : ""}, 0.5)`,
2184
- "--fu-ucrc-eg-split-secondary": (c == null ? void 0 : c.secondaryColor) || r.textSecondary
2185
- }, h = e.eventGame.status === "OPEN" && e.prediction && e.onPredictionUpdate, v = (N) => {
2186
- console.log(`Edit prediction for fixture at index: ${N}`);
2187
- }, p = a ? null : /* @__PURE__ */ t(
2188
- pe,
2189
- {
2190
- brandingLogo: l,
2191
- textColor: (c == null ? void 0 : c.contentColor) || u.colorSchemes.dark.textColor,
2192
- label: null,
2193
- primaryUrl: (A = (R = e.eventGame.branding) == null ? void 0 : R.urls) == null ? void 0 : A.primaryUrl,
2194
- secondaryUrl: (le = (L = e.eventGame.branding) == null ? void 0 : L.urls) == null ? void 0 : le.secondaryUrl
2195
- }
2196
- ), b = o ? "mobile" : "desktop";
2197
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (c == null ? void 0 : c.borderColor) || null, children: /* @__PURE__ */ t(
2198
- Oo,
2199
- {
2200
- entity: { ...e.eventGame, labels: null },
2201
- headline: i("eventGame.headline"),
2202
- finalImage: d,
2203
- brandingContent: p,
2204
- isTabulated: !1,
2205
- alwaysShowImage: !0,
2206
- rulesDisplay: e.rulesDisplay,
2207
- children: e.isUnauthorized ? /* @__PURE__ */ t("div", { css: o ? tt.alertArea.stacked : tt.alertArea.side, children: /* @__PURE__ */ t("div", { css: tt.alertWrapper, children: /* @__PURE__ */ t(
2208
- Nn,
2209
- {
2210
- variant: "error",
2211
- title: i("common.authentication.accessRequired"),
2212
- message: i("common.authentication.invalidOrMissingAuth")
2213
- }
2214
- ) }) }) : /* @__PURE__ */ f("div", { css: tt.questionAreaContent, style: x, children: [
2215
- /* @__PURE__ */ t("div", { css: tt.panel, children: h ? /* @__PURE__ */ t(
2216
- ft,
2217
- {
2218
- fixtures: e.eventGame.fixtures,
2219
- prediction: e.prediction,
2220
- onEditPrediction: v,
2221
- onPredictionUpdate: e.onPredictionUpdate,
2222
- play: e.play,
2223
- view: "score",
2224
- isSplitVariant: !0,
2225
- onPlayResult: e.onPlayResult,
2226
- brandingPrimaryColor: c == null ? void 0 : c.primaryColor
2227
- }
2228
- ) : null }),
2229
- e.additionalCTA && /* @__PURE__ */ t("div", { css: tt.ctaWrapper[b], children: /* @__PURE__ */ t(Yt, { additionalCTA: e.additionalCTA, css: tt.additional[b] }) }),
2230
- e.chanceGameContent,
2231
- a && /* @__PURE__ */ t(
2232
- pe,
2233
- {
2234
- brandingLogo: l,
2235
- textColor: g,
2236
- label: null,
2237
- primaryUrl: (ge = (se = e.eventGame.branding) == null ? void 0 : se.urls) == null ? void 0 : ge.primaryUrl,
2238
- secondaryUrl: (ye = (ue = e.eventGame.branding) == null ? void 0 : ue.urls) == null ? void 0 : ye.secondaryUrl
2239
- }
2240
- )
2241
- ] })
2242
- }
2243
- ) });
2244
- }, _r = "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_929_1048'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_929_1048)'%3e%3cpath%20d='M12%2020.6254L5.20005%2016.9254V11.1254L1.36255%209.01289L12%203.21289L22.65%209.01464V16.7504H20.775V10.0504L18.8%2011.1254V16.9254L12%2020.6254ZM12%2012.6754L18.75%209.01289L12%205.36289L5.26255%209.01289L12%2012.6754ZM12%2018.4879L16.925%2015.8296V12.1129L12%2014.8254L7.07505%2012.1129V15.8296L12%2018.4879Z'%20fill='%23212121'/%3e%3c/g%3e%3c/svg%3e", Yr = "data:image/svg+xml,%3csvg%20width='25'%20height='24'%20viewBox='0%200%2025%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_929_504'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='25'%20height='24'%3e%3crect%20x='0.5'%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_929_504)'%3e%3cpath%20d='M9.6875%206H11.5625V4.125H9.6875V6ZM13.4375%206V4.125H15.3125V6H13.4375ZM9.6875%2013.5V11.625H11.5625V13.5H9.6875ZM17.1875%209.75V7.875H19.0625V9.75H17.1875ZM17.1875%2013.5V11.625H19.0625V13.5H17.1875ZM13.4375%2013.5V11.625H15.3125V13.5H13.4375ZM17.1875%206V4.125H19.0625V6H17.1875ZM11.5625%207.875V6H13.4375V7.875H11.5625ZM5.9375%2019.825V4.125H7.8125V6H9.6875V7.875H7.8125V9.75H9.6875V11.625H7.8125V19.825H5.9375ZM15.3125%2011.625V9.75H17.1875V11.625H15.3125ZM11.5625%2011.625V9.75H13.4375V11.625H11.5625ZM9.6875%209.75V7.875H11.5625V9.75H9.6875ZM13.4375%209.75V7.875H15.3125V9.75H13.4375ZM15.3125%207.875V6H17.1875V7.875H15.3125Z'%20fill='%23212121'/%3e%3c/g%3e%3c/svg%3e", mn = (e) => typeof e == "number" ? `${e * 8}px` : e, Xr = (e = {}) => {
2245
- const i = {};
2246
- e.display !== void 0 && (i.display = e.display), e.flexDirection !== void 0 && (i.flexDirection = e.flexDirection);
2247
- const r = e.pt ?? e.py ?? e.p, o = e.pb ?? e.py ?? e.p, a = e.px ?? e.p;
2248
- return r !== void 0 && (i.paddingTop = mn(r)), o !== void 0 && (i.paddingBottom = mn(o)), a !== void 0 && (i.paddingInline = mn(a)), i;
2249
- }, ze = (e) => `var(--fu-ucrc-eg-fgw-${e})`, wt = ze("text-primary"), $i = ze("text-secondary"), po = ze("outline"), yo = ze("chip-bg"), Vt = "var(--fu-ucrc-font-primary)", En = "var(--fu-ucrc-font-secondary)", Nt = "var(--fu-ucrc-radius-md)", Le = (e) => `var(--fu-ucrc-space-${e})`, Ai = {
2250
- boxSizing: "border-box",
2251
- position: "relative",
2252
- display: "flex",
2253
- flexDirection: "column",
2254
- justifyContent: "center",
2255
- alignItems: "center",
2256
- alignSelf: "stretch",
2257
- flex: "1 1 0%",
2258
- gap: "6px",
2259
- minWidth: 0,
2260
- minHeight: "36px",
2261
- margin: 0,
2262
- padding: "4px 16px",
2263
- font: "inherit",
2264
- textAlign: "initial",
2265
- textDecoration: "none",
2266
- color: "var(--fu-ucrc-neutral-plain-color)",
2267
- backgroundColor: "transparent",
2268
- border: "1px solid transparent",
2269
- borderBottomColor: ze("tab-line"),
2270
- borderRadius: 0,
2271
- opacity: 0.6,
2272
- cursor: "pointer",
2273
- WebkitTapHighlightColor: "transparent",
2274
- "&:focus-visible": { outline: "2px solid var(--fu-ucrc-focus-visible)", outlineOffset: "2px", zIndex: 1 }
2275
- }, Li = {
2276
- display: "flex",
2277
- width: "24px",
2278
- height: "24px",
2279
- justifyContent: "center",
2280
- alignItems: "center"
2281
- }, gn = { ...ce, fontFamily: En, fontSize: "1em", fontStyle: "normal", lineHeight: "20px", letterSpacing: "0.15px" }, zi = {
2282
- display: "flex",
2283
- alignItems: "center",
2284
- gap: Le("xs"),
2285
- padding: "2px 6px",
2286
- minHeight: "20px",
2287
- borderRadius: Nt,
2288
- border: `1px solid ${po}`,
2289
- backgroundColor: yo,
2290
- width: "fit-content"
2291
- }, Fi = { ...ce, fontFamily: Vt, fontWeight: 500, color: wt }, z = {
2292
- root: n({ width: "100%" }),
2293
- // Joy's Tabs: body font, 1.5 line height and the neutral colour the panels inherit.
2294
- tabs: n({
2295
- position: "relative",
2296
- display: "flex",
2297
- flexDirection: "column",
2298
- width: "100%",
2299
- fontFamily: $e,
2300
- fontSize: "1em",
2301
- lineHeight: 1.5,
2302
- color: "var(--fu-ucrc-neutral-plain-color)",
2303
- borderRadius: Nt,
2304
- backgroundColor: "transparent"
2305
- }),
2306
- list: n({
2307
- position: "relative",
2308
- zIndex: 1,
2309
- boxSizing: "border-box",
2310
- display: "flex",
2311
- flexDirection: "row",
2312
- margin: 0,
2313
- padding: "0 0 1px",
2314
- // Joy's divider: the neutral channel at 20% (16% in dark mode).
2315
- boxShadow: "inset 0 -1px rgba(var(--fu-ucrc-neutral-main-channel) / 0.2)",
2316
- ".dark &": { boxShadow: "inset 0 -1px rgba(var(--fu-ucrc-neutral-main-channel) / 0.16)" }
2317
- }),
2318
- // Joy's unselected hover rule out-ranks a plain :hover; the old sx matched it.
2319
- tabOff: n(Ai, {
2320
- "&:hover": { backgroundColor: ze("tint"), color: "var(--fu-ucrc-neutral-plain-hover-color)" },
2321
- "&:active": { backgroundColor: "var(--fu-ucrc-neutral-plain-active-bg)" }
2322
- }),
2323
- tabOn: n(Ai, {
2324
- backgroundColor: ze("tint"),
2325
- borderBottom: `3px solid ${ze("primary")}`,
2326
- opacity: 1,
2327
- marginBottom: "-1px"
2328
- }),
2329
- tabInner: n({
2330
- display: "flex",
2331
- padding: "12px 16px",
2332
- justifyContent: "center",
2333
- alignItems: "center",
2334
- gap: "8px",
2335
- width: "100%"
2336
- }),
2337
- tabIcon: n(Li),
2338
- tabIconInverted: n(Li, { filter: "brightness(0) invert(1)" }),
2339
- tabLabel: n({
2340
- ...ce,
2341
- color: $i,
2342
- fontFamily: Vt,
2343
- fontSize: "1em",
2344
- fontStyle: "normal",
2345
- fontWeight: 500,
2346
- lineHeight: "24px",
2347
- letterSpacing: "0.4px",
2348
- textTransform: "uppercase"
2349
- }),
2350
- // Joy's TabPanel: 16px padding, hidden with display none unless the sx set a display.
2351
- panel: n({
2352
- flexGrow: 1,
2353
- padding: "16px",
2354
- fontFamily: $e,
2355
- lineHeight: 1.5,
2356
- color: "var(--fu-ucrc-neutral-plain-color)"
2357
- }),
2358
- panelHidden: n({
2359
- display: "none",
2360
- flexGrow: 1,
2361
- padding: "16px",
2362
- fontFamily: $e,
2363
- lineHeight: 1.5,
2364
- color: "var(--fu-ucrc-neutral-plain-color)"
2365
- }),
2366
- list2: n({
2367
- display: "flex",
2368
- flexDirection: "column",
2369
- justifyContent: "center",
2370
- alignItems: "center",
2371
- gap: "16px",
2372
- alignSelf: "stretch"
2373
- }),
2374
- card: n({
2375
- borderRadius: Nt,
2376
- padding: Le("md"),
2377
- display: "flex",
2378
- flexDirection: "column",
2379
- alignItems: "center",
2380
- alignSelf: "stretch",
2381
- gap: Le("md"),
2382
- backdropFilter: "blur(4px)",
2383
- position: "relative",
2384
- "&::before": {
2385
- content: '""',
2386
- position: "absolute",
2387
- top: 0,
2388
- left: 0,
2389
- right: 0,
2390
- bottom: 0,
2391
- backgroundColor: ze("content-bg"),
2392
- opacity: 0.5,
2393
- borderRadius: "inherit",
2394
- zIndex: 0,
2395
- backdropFilter: "blur(4px)"
2396
- },
2397
- "& > *": { position: "relative", zIndex: 1 }
2398
- }),
2399
- single: n({ display: "flex", flexDirection: "column", alignItems: "flex-start", gap: "12px", alignSelf: "stretch" }),
2400
- fixtureRow: n({ display: "flex", justifyContent: "space-between", alignItems: "center", alignSelf: "stretch" }),
2401
- fixtureTitle: n({
2402
- ...ce,
2403
- color: wt,
2404
- fontFamily: Vt,
2405
- fontSize: "1.25em",
2406
- fontStyle: "normal",
2407
- fontWeight: 500,
2408
- lineHeight: "120%",
2409
- letterSpacing: "0.15px",
2410
- flex: 1
2411
- }),
2412
- pointsBadge: n({
2413
- display: "flex",
2414
- alignItems: "center",
2415
- gap: Le("xs"),
2416
- padding: `${Le("xs")} ${Le("sm")}`,
2417
- borderRadius: Nt,
2418
- backgroundColor: yo
2419
- }),
2420
- pointsText: n({ ...ce, color: wt, fontFamily: En, fontSize: "0.875em", fontWeight: 600 }),
2421
- block: n({ alignSelf: "stretch", display: "flex", flexDirection: "column", gap: Le("xs") }),
2422
- row: n({ display: "flex", alignItems: "center", gap: Le("xs") }),
2423
- yourRight: n(gn, { color: ze("correct"), fontWeight: 700 }),
2424
- yourWrong: n(gn, { color: ze("wrong"), fontWeight: 600 }),
2425
- plainLabel: n(gn, { color: wt, fontWeight: 600 }),
2426
- divider: n({ width: "100%", height: "1px", backgroundColor: po }),
2427
- earnedRow: n({ display: "flex", justifyContent: "flex-start", alignItems: "center", alignSelf: "stretch" }),
2428
- chipPrediction: n(zi, { fontSize: "0.875em" }),
2429
- chipResult: n(zi, { fontSize: "0.75em" }),
2430
- chipText: n(Fi, { fontSize: "0.875em" }),
2431
- chipTextXs: n(Fi, { fontSize: "0.75em" }),
2432
- empty: n({
2433
- display: "flex",
2434
- flexDirection: "column",
2435
- justifyContent: "center",
2436
- alignItems: "center",
2437
- gap: Le("lg"),
2438
- alignSelf: "stretch",
2439
- minHeight: "200px",
2440
- textAlign: "center",
2441
- paddingBlock: Le("xl")
2442
- }),
2443
- emptyInner: n({ display: "flex", flexDirection: "column", gap: Le("xs"), alignItems: "center" }),
2444
- emptyTitle: n({
2445
- ...ce,
2446
- color: wt,
2447
- fontFamily: Vt,
2448
- fontSize: "1.25em",
2449
- fontWeight: 600,
2450
- lineHeight: "1.2"
2451
- }),
2452
- emptyDescription: n({
2453
- ...ce,
2454
- color: $i,
2455
- fontFamily: En,
2456
- fontSize: "1em",
2457
- fontWeight: 400,
2458
- lineHeight: "1.4"
2459
- })
2460
- }, jn = ({
2461
- prediction: e,
2462
- game: i,
2463
- resultsTabPanelSxProps: r,
2464
- isOverlayVariant: o,
2465
- children: a,
2466
- brandingColors: u
2467
- }) => {
2468
- const [s, d] = U(0), [l, c] = U(0), y = Oe([]), g = Fn(), x = To(), h = Ie(), v = Re(), { t: p } = oe(), b = ie(), C = dt(), I = h.colorSchemes.dark, w = o ? I : v, T = u != null && u.backgroundColor || o ? I.surfaceVariant : v.surfaceVariant, W = {
2469
- "--fu-ucrc-eg-fgw-text-primary": w.textPrimary,
2470
- "--fu-ucrc-eg-fgw-text-secondary": w.textSecondary,
2471
- "--fu-ucrc-eg-fgw-tab-line": w.secondaryContainer,
2472
- "--fu-ucrc-eg-fgw-content-bg": T,
2473
- "--fu-ucrc-eg-fgw-outline": w.outlineEnabledBorder,
2474
- "--fu-ucrc-eg-fgw-chip-bg": w.palette.neutral.softBg,
2475
- "--fu-ucrc-eg-fgw-primary": (u == null ? void 0 : u.primaryColor) || w.textPrimary,
2476
- "--fu-ucrc-eg-fgw-tint": o ? "#FAFAFA14" : "#2121210A",
2477
- "--fu-ucrc-eg-fgw-correct": w.palette.success.plainColor,
2478
- "--fu-ucrc-eg-fgw-wrong": w.palette.danger.plainColor
2479
- }, V = (N, E) => E === F.BOOLEAN ? p(N === !0 ? "eventGame.fixtures.yes" : "eventGame.fixtures.no") : E === F.NUMBER || E === F.ENUM || E === F.FREE_INPUT ? N : null, S = (N, E) => {
2480
- const te = V(N, E);
2481
- return te === null ? null : /* @__PURE__ */ t("div", { css: z.chipPrediction, children: /* @__PURE__ */ t("p", { css: z.chipText, children: te }) });
2482
- }, R = (N, E) => {
2483
- const te = V(N, E);
2484
- return te === null ? null : /* @__PURE__ */ t("div", { css: z.chipResult, children: /* @__PURE__ */ t("p", { css: C ? z.chipTextXs : z.chipText, children: te }) });
2485
- }, A = (N) => {
2486
- var Ge;
2487
- const E = i.fixtures.find((ve) => ve.id === N), te = (Ge = e == null ? void 0 : e.fixtures) == null ? void 0 : Ge.find((ve) => ve.id === N);
2488
- if (!E || !te) return null;
2489
- const he = te.correct === !0, fe = te.points, De = fe != null;
2490
- return /* @__PURE__ */ t("div", { css: z.card, children: /* @__PURE__ */ f("div", { css: z.single, children: [
2491
- /* @__PURE__ */ f("div", { css: z.fixtureRow, children: [
2492
- /* @__PURE__ */ t("p", { css: z.fixtureTitle, children: E.question }),
2493
- !C && De && /* @__PURE__ */ t("div", { css: z.pointsBadge, children: /* @__PURE__ */ f("p", { css: z.pointsText, children: [
2494
- st(fe),
2495
- " ",
2496
- p("eventGame.points.pts")
2497
- ] }) })
2498
- ] }),
2499
- /* @__PURE__ */ f("div", { css: z.block, children: [
2500
- /* @__PURE__ */ f("div", { css: z.row, children: [
2501
- /* @__PURE__ */ t("p", { css: he ? z.yourRight : z.yourWrong, children: p("eventGame.yourPrediction") }),
2502
- S(te.prediction, E.outcomeType)
2503
- ] }),
2504
- !he && E.outcome !== null && E.outcome !== void 0 && /* @__PURE__ */ f("div", { css: z.row, children: [
2505
- /* @__PURE__ */ t("p", { css: z.plainLabel, children: p("eventGame.correctPrediction") }),
2506
- R(E.outcome, E.outcomeType)
2507
- ] })
2508
- ] }),
2509
- C && De && fe > 0 && /* @__PURE__ */ f(X, { children: [
2510
- /* @__PURE__ */ t("div", { css: z.divider }),
2511
- /* @__PURE__ */ t("div", { css: z.earnedRow, children: /* @__PURE__ */ f("p", { css: z.plainLabel, children: [
2512
- p("eventGame.earnedPoints"),
2513
- ": ",
2514
- fe
2515
- ] }) })
2516
- ] })
2517
- ] }) }, `user-prediction-${N}`);
2518
- }, L = (N) => {
2519
- var te;
2520
- const E = (N + 2) % 2;
2521
- c(E), (te = y.current[E]) == null || te.focus();
2522
- }, le = (N) => {
2523
- const E = x ? "ArrowLeft" : "ArrowRight", te = x ? "ArrowRight" : "ArrowLeft", he = { [E]: l + 1, [te]: l - 1, Home: 0, End: 1 }[N.key];
2524
- he !== void 0 && (N.preventDefault(), L(he));
2525
- }, se = o || h.mode == "dark", ge = [
2526
- { icon: Yr, alt: "results-icon", label: p("eventGame.leaderboard.title") },
2527
- { icon: _r, alt: "predictions-icon", label: p("eventGame.predictions") }
2528
- ], ue = {
2529
- ...Xr(r),
2530
- fontSize: C ? "0.625em" : b ? "0.75em" : "1em",
2531
- // Read by LeaderboardComponent to keep Joy's rem-sized table.
2532
- "--fu-ucrc-eg-panel-scale": C ? 0.625 : b ? 0.75 : 1
2533
- }, ye = {
2534
- overflowY: "auto",
2535
- maxHeight: b ? "auto" : "450px",
2536
- fontSize: C ? "0.75em" : "1em"
2537
- };
2538
- return /* @__PURE__ */ t("div", { css: z.root, style: W, children: /* @__PURE__ */ f("div", { css: z.tabs, children: [
2539
- /* @__PURE__ */ t(
2540
- "div",
2541
- {
2542
- role: "tablist",
2543
- "aria-orientation": "horizontal",
2544
- css: z.list,
2545
- style: { fontSize: b ? "0.75em" : "1em" },
2546
- onKeyDown: le,
2547
- children: ge.map((N, E) => /* @__PURE__ */ t(
2548
- "button",
2549
- {
2550
- ref: (te) => {
2551
- y.current[E] = te;
2552
- },
2553
- type: "button",
2554
- role: "tab",
2555
- id: `${g}-tab-${E}`,
2556
- "aria-selected": E === s,
2557
- "aria-controls": `${g}-panel-${E}`,
2558
- tabIndex: E === l ? 0 : -1,
2559
- css: E === s ? z.tabOn : z.tabOff,
2560
- onFocus: () => c(E),
2561
- onClick: () => {
2562
- d(E), L(E);
2563
- },
2564
- children: /* @__PURE__ */ f("div", { css: z.tabInner, children: [
2565
- /* @__PURE__ */ t("img", { src: N.icon, alt: N.alt, css: se ? z.tabIconInverted : z.tabIcon }),
2566
- /* @__PURE__ */ t("p", { css: z.tabLabel, children: N.label })
2567
- ] })
2568
- },
2569
- E
2570
- ))
2571
- }
2572
- ),
2573
- /* @__PURE__ */ t(
2574
- "div",
2575
- {
2576
- role: "tabpanel",
2577
- id: `${g}-panel-0`,
2578
- "aria-labelledby": `${g}-tab-0`,
2579
- hidden: s !== 0,
2580
- css: s === 0 ? z.panel : z.panelHidden,
2581
- style: ue,
2582
- children: s === 0 && a
2583
- }
2584
- ),
2585
- /* @__PURE__ */ t(
2586
- "div",
2587
- {
2588
- role: "tabpanel",
2589
- id: `${g}-panel-1`,
2590
- "aria-labelledby": `${g}-tab-1`,
2591
- hidden: s !== 1,
2592
- css: s === 1 ? z.panel : z.panelHidden,
2593
- style: ye,
2594
- children: s === 1 && /* @__PURE__ */ t("div", { css: z.list2, children: e != null && e.fixtures && e.fixtures.length > 0 ? i.fixtures.map((N) => A(N.id)) : /* @__PURE__ */ t("div", { css: z.empty, children: /* @__PURE__ */ f("div", { css: z.emptyInner, children: [
2595
- /* @__PURE__ */ t("p", { css: z.emptyTitle, children: p("eventGame.noPredictions.title") }),
2596
- /* @__PURE__ */ t("p", { css: z.emptyDescription, children: p("eventGame.noPredictions.description") })
2597
- ] }) }) })
2598
- }
2599
- )
2600
- ] }) });
2601
- }, Zr = "calc(6em / 10.5) calc(8em / 10.5)", hn = "0.5em calc(8em / 12)", Kr = "var(--fu-ucrc-eg-lb-primary)", Kt = "var(--fu-ucrc-text-color)", bo = "var(--fu-ucrc-eg-lb-on-primary)", Jr = "var(--fu-ucrc-eg-lb-head-bg)", qn = "var(--fu-ucrc-font-primary)", Co = "var(--fu-ucrc-outline-enabled-border)", xn = { ...ce, fontFamily: qn, fontSize: "0.875em", color: Kt }, ke = {
2602
- container: n({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-md)" }),
2603
- // Joy h4.
2604
- title: n({
2605
- margin: 0,
2606
- lineHeight: 1.5,
2607
- letterSpacing: "-0.025em",
2608
- fontFamily: qn,
2609
- fontWeight: 700,
2610
- fontSize: "1.25em",
2611
- color: Kt,
2612
- textAlign: "center",
2613
- marginBottom: "var(--fu-ucrc-space-sm)"
2614
- }),
2615
- // Joy's Sheet was 1rem: undo FinishedGameWrapper's panel shrink so the table keeps its size.
2616
- tableContainer: n({
2617
- position: "relative",
2618
- fontFamily: $e,
2619
- fontSize: "calc(1em / var(--fu-ucrc-eg-panel-scale, 1))",
2620
- lineHeight: 1.5,
2621
- color: "var(--fu-ucrc-neutral-plain-color)",
2622
- backgroundColor: "var(--fu-ucrc-bg-surface)",
2623
- overflowX: "auto",
2624
- borderRadius: "var(--fu-ucrc-radius-md)",
2625
- border: `1px solid ${Co}`
2626
- }),
2627
- nameCell: n({ display: "flex", alignItems: "center", gap: "var(--fu-ucrc-space-sm)" }),
2628
- avatar: n({
2629
- position: "relative",
2630
- width: "32px",
2631
- height: "32px",
2632
- fontSize: "0.875em",
2633
- fontWeight: 600,
2634
- userSelect: "none",
2635
- backgroundColor: Kr,
2636
- color: bo
2637
- }),
2638
- position: n({ ...xn, fontWeight: 600 }),
2639
- name: n({ ...xn, fontWeight: 500, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }),
2640
- points: n({ ...xn, fontWeight: 600 }),
2641
- empty: n({
2642
- ...ce,
2643
- fontFamily: "var(--fu-ucrc-font-secondary)",
2644
- fontSize: "1.25em",
2645
- color: Kt,
2646
- textAlign: "center",
2647
- marginBlock: "var(--fu-ucrc-space-md)"
2648
- })
2649
- }, vn = {
2650
- backgroundColor: Jr,
2651
- color: Kt,
2652
- fontFamily: qn,
2653
- fontWeight: 600,
2654
- fontSize: "0.875em",
2655
- textAlign: "center",
2656
- padding: Zr,
2657
- borderBottomColor: Co
2658
- }, Ve = {
2659
- headPosition: { ...vn, width: "10%" },
2660
- headName: { ...vn, textAlign: "left", width: "80%" },
2661
- headPoints: { ...vn, width: "10%" },
2662
- position: { padding: hn, width: "10%", textAlign: "center" },
2663
- name: { padding: hn, width: "80%" },
2664
- points: { padding: hn, width: "10%", textAlign: "center" }
2665
- }, Qr = {
2666
- backgroundColor: "var(--fu-ucrc-surface-variant)",
2667
- cursor: "default",
2668
- fontWeight: 500,
2669
- color: "var(--fu-ucrc-neutral-outlined-color)"
2670
- }, Bi = (e) => e === null ? null : st(e), Mi = /* @__PURE__ */ t(ar, { size: "1em", color: bo }), _n = ({
2671
- leaderboard: e,
2672
- userRanking: i,
2673
- showHeading: r,
2674
- isSplitVariant: o,
2675
- loading: a = !1
2676
- }) => {
2677
- const { t: u } = oe(), s = Ie(), d = Re(), l = dt(), c = d.palette.primary.plainColor, y = ot(
2678
- () => ({
2679
- "--fu-ucrc-eg-lb-primary": c,
2680
- "--fu-ucrc-eg-lb-on-primary": s.colorSchemes.light.palette.primary.onPrimary,
2681
- "--fu-ucrc-eg-lb-head-bg": `rgba(${it(d.surfaceVariant)}, 0.8)`
2682
- }),
2683
- [c, d, s]
2684
- ), g = ot(() => ({ backgroundColor: `rgba(${it(c)}, 0.1)` }), [c]);
2685
- if (a || !e)
2686
- return /* @__PURE__ */ t(uo, { marginBlock: "80px" });
2687
- if (e.length === 0)
2688
- return /* @__PURE__ */ t("p", { css: ke.empty, children: u("eventGame.leaderboard.noLeaderboardAvailable") });
2689
- const x = i == null ? void 0 : i.position, h = x && e.some((v) => v.position === x);
2690
- return /* @__PURE__ */ f("div", { css: ke.container, style: y, children: [
2691
- r && /* @__PURE__ */ t("h4", { css: ke.title, children: u("eventGame.leaderboard.title") }),
2692
- /* @__PURE__ */ t("div", { css: ke.tableContainer, children: /* @__PURE__ */ f(Uo, { style: Qr, children: [
2693
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ f("tr", { children: [
2694
- /* @__PURE__ */ t("th", { style: Ve.headPosition, children: l || o ? "" : u("eventGame.leaderboard.position") }),
2695
- /* @__PURE__ */ t("th", { style: Ve.headName, children: u("eventGame.leaderboard.name") }),
2696
- /* @__PURE__ */ t("th", { style: Ve.headPoints, children: l || o ? "🎯" : u("eventGame.leaderboard.points") })
2697
- ] }) }),
2698
- /* @__PURE__ */ f("tbody", { children: [
2699
- i && !h && /* @__PURE__ */ f("tr", { style: g, children: [
2700
- /* @__PURE__ */ t("td", { style: Ve.position, children: /* @__PURE__ */ f("p", { css: ke.position, children: [
2701
- "#",
2702
- i.position
2703
- ] }) }),
2704
- /* @__PURE__ */ t("td", { style: Ve.name, children: /* @__PURE__ */ f("div", { css: ke.nameCell, children: [
2705
- /* @__PURE__ */ t(Qn, { css: ke.avatar, children: Mi }),
2706
- /* @__PURE__ */ t("p", { css: ke.name, children: u("eventGame.leaderboard.you") })
2707
- ] }) }),
2708
- /* @__PURE__ */ t("td", { style: Ve.points, children: /* @__PURE__ */ t("p", { css: ke.points, children: Bi(i.totalPoints) }) })
2709
- ] }),
2710
- e.map((v) => {
2711
- var b, C, I, w;
2712
- const p = x === v.position;
2713
- return /* @__PURE__ */ f("tr", { style: p ? g : void 0, children: [
2714
- /* @__PURE__ */ t("td", { style: Ve.position, children: /* @__PURE__ */ f("p", { css: ke.position, children: [
2715
- "#",
2716
- v.position
2717
- ] }) }),
2718
- /* @__PURE__ */ t("td", { style: Ve.name, children: /* @__PURE__ */ f("div", { css: ke.nameCell, children: [
2719
- /* @__PURE__ */ t(Qn, { src: ((b = v.profileModel) == null ? void 0 : b.avatar) || void 0, css: ke.avatar, children: (C = v.profileModel) != null && C.avatar ? null : Mi }),
2720
- /* @__PURE__ */ t("p", { css: ke.name, children: p ? u("eventGame.leaderboard.you") : ((I = v.profileModel) == null ? void 0 : I.nickname) || ((w = v.profileModel) == null ? void 0 : w.name) })
2721
- ] }) }),
2722
- /* @__PURE__ */ t("td", { style: Ve.points, children: /* @__PURE__ */ t("p", { css: ke.points, children: Bi(v.totalPoints) }) })
2723
- ] }, v.profileId);
2724
- })
2725
- ] })
2726
- ] }) })
2727
- ] });
2728
- }, yt = (e) => `var(--fu-ucrc-neutral-${e})`, bt = (e) => `var(--fu-ucrc-eg-pg-${e})`, Hi = {
2729
- boxSizing: "border-box",
2730
- position: "relative",
2731
- display: "inline-flex",
2732
- alignItems: "center",
2733
- justifyContent: "center",
2734
- minWidth: "32px",
2735
- minHeight: "32px",
2736
- margin: 0,
2737
- padding: "0 4px",
2738
- border: "none",
2739
- borderRadius: "8px",
2740
- font: "inherit",
2741
- fontWeight: 400,
2742
- lineHeight: "normal",
2743
- textDecoration: "none",
2744
- cursor: "pointer",
2745
- WebkitTapHighlightColor: "transparent",
2746
- backgroundColor: "transparent",
2747
- color: yt("plain-color"),
2748
- "&:focus-visible": { outline: "2px solid var(--fu-ucrc-focus-visible)", outlineOffset: "2px" },
2749
- "@media (hover: hover)": {
2750
- "&:hover": { backgroundColor: yt("plain-hover-bg"), color: yt("plain-hover-color") }
2751
- },
2752
- "&:active": { backgroundColor: yt("plain-active-bg") },
2753
- "&:disabled": { pointerEvents: "none", cursor: "default", color: yt("plain-disabled-color") }
2754
- }, ea = {
2755
- color: bt("text"),
2756
- "&:hover": { backgroundColor: bt("solid-bg"), color: bt("text") },
2757
- "&:active": { backgroundColor: bt("active-bg") },
2758
- "&:disabled": { backgroundColor: "transparent", color: bt("disabled"), opacity: 0.5 }
2759
- }, Ct = {
2760
- root: n({ display: "flex", gap: "4px", alignItems: "center" }),
2761
- plain: n(Hi),
2762
- overlay: n(Hi, ea)
2763
- }, Yn = ({
2764
- hasNextPage: e,
2765
- hasPreviousPage: i,
2766
- onNextPage: r,
2767
- onPreviousPage: o,
2768
- isOverlayVariant: a = !1,
2769
- justifyContent: u = "flex-start"
2770
- }) => {
2771
- const d = Ie().colorSchemes.dark, l = {
2772
- justifyContent: u,
2773
- ...a && {
2774
- "--fu-ucrc-eg-pg-text": d.textColor,
2775
- "--fu-ucrc-eg-pg-disabled": d.textDisabled,
2776
- "--fu-ucrc-eg-pg-solid-bg": d.palette.neutral.solidBg,
2777
- "--fu-ucrc-eg-pg-active-bg": d.palette.neutral.plainActiveBg
2778
- }
2779
- };
2780
- return /* @__PURE__ */ f("div", { css: Ct.root, style: l, children: [
2781
- /* @__PURE__ */ t("button", { type: "button", css: a ? Ct.overlay : Ct.plain, onClick: o, disabled: !i, children: /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ t(lr, { size: 20 }) }) }),
2782
- /* @__PURE__ */ t("button", { type: "button", css: a ? Ct.overlay : Ct.plain, onClick: r, disabled: !e, children: /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ t(sr, { size: 20 }) }) })
2783
- ] });
2784
- }, Xn = (e, i) => {
2785
- const [r, o] = U(
2786
- null
2787
- ), a = Ln(), [u, s] = U(!1), [d, l] = U(!1), [c, y] = U(
2788
- null
2789
- ), [g, x] = U([]), [h, v] = U(null), [p, b] = U(!1), C = async (T = null, W) => {
2790
- try {
2791
- b(!0);
2792
- const V = {
2793
- limit: 10,
2794
- ...T && { startAfter: T }
2795
- }, S = await i.eventGame.getRankings(e, V, a);
2796
- if (S.data.length === 0) {
2797
- o([]), v(null);
2798
- return;
2799
- }
2800
- const R = W !== void 0 ? W : g;
2801
- o(S.data), v({
2802
- itemsPerPage: S.meta.pagination.itemsPerPage,
2803
- nextPageStartsAfter: S.meta.pagination.nextPageStartsAfter,
2804
- hasNextPage: S.meta.pagination.nextPageStartsAfter !== null,
2805
- hasPreviousPage: R.length > 0
2806
- });
2807
- } catch {
2808
- l(!0);
2809
- } finally {
2810
- b(!1);
2811
- }
2812
- }, I = () => {
2813
- if (h != null && h.nextPageStartsAfter) {
2814
- const T = [
2815
- ...g,
2816
- c
2817
- ];
2818
- x(T), y(h.nextPageStartsAfter), C(h.nextPageStartsAfter, T);
2819
- }
2820
- }, w = () => {
2821
- if (g.length > 0) {
2822
- const T = [...g], W = T.pop() || null;
2823
- x(T), y(W), C(W, T);
2824
- }
2825
- };
2826
- return je(() => (C(), () => {
2827
- o(null), s(!1), l(!1), v(null), y(null), x([]);
2828
- }), [e, i, a]), {
2829
- rankings: r,
2830
- pagination: h,
2831
- loading: p,
2832
- isUnauthorized: u,
2833
- isApiError: d,
2834
- setRankings: o,
2835
- setIsUnauthorized: s,
2836
- setIsApiError: l,
2837
- goToNextPage: I,
2838
- goToPreviousPage: w
2839
- };
2840
- }, Xe = (e) => `var(--fu-ucrc-space-${e})`, So = "var(--fu-ucrc-eg-ofg-secondary)", Oi = {
2841
- display: "flex",
2842
- flexDirection: "column",
2843
- justifyContent: "space-between",
2844
- gap: "40px",
2845
- border: "var(--fu-ucrc-eg-ofg-border)",
2846
- overflow: "hidden",
2847
- backgroundImage: "var(--fu-ucrc-eg-ofg-image)",
2848
- backgroundPosition: "center",
2849
- backgroundSize: "cover",
2850
- position: "relative",
2851
- borderRadius: "var(--fu-ucrc-radius-md)",
2852
- minHeight: "250px",
2853
- "&::before": {
2854
- content: '""',
2855
- position: "absolute",
2856
- background: "var(--fu-ucrc-eg-ofg-gradient)",
2857
- top: 0,
2858
- left: 0,
2859
- right: 0,
2860
- bottom: 0,
2861
- borderRadius: "inherit",
2862
- zIndex: 0
2863
- }
2864
- }, Ui = { display: "flex", alignItems: "center", gap: Xe("3xs") }, Wi = {
2865
- ...ce,
2866
- fontWeight: 500,
2867
- lineHeight: "166%",
2868
- letterSpacing: "1px",
2869
- color: So,
2870
- opacity: "70%",
2871
- textTransform: "uppercase",
2872
- fontFamily: "var(--fu-ucrc-font-secondary)",
2873
- fontSize: "0.75em"
2874
- }, Vi = {
2875
- ...In,
2876
- fontWeight: 700,
2877
- lineHeight: "133%",
2878
- letterSpacing: "0px",
2879
- fontSize: "1.5em",
2880
- color: "var(--fu-ucrc-eg-ofg-title)",
2881
- fontFamily: "var(--fu-ucrc-font-primary)"
2882
- }, Ni = {
2883
- ...ce,
2884
- fontWeight: 400,
2885
- lineHeight: "140%",
2886
- letterSpacing: "0.15px",
2887
- fontSize: "1.25em",
2888
- color: So,
2889
- opacity: "70%",
2890
- fontFamily: "var(--fu-ucrc-font-primary)"
2891
- }, xe = {
2892
- card: n(Oi, { padding: Xe("xl") }),
2893
- // The tab panel pads this one.
2894
- cardWithDetails: n(Oi),
2895
- main: n({ display: "flex", flexDirection: "column", gap: Xe("md") }),
2896
- headlineSection: n({ display: "flex", justifyContent: "space-between", flex: "1 0 0", alignSelf: "stretch" }),
2897
- headlineContent: n({
2898
- display: "flex",
2899
- flexDirection: "column",
2900
- alignItems: "flex-start",
2901
- flex: "1 0 0",
2902
- gap: Xe("md")
2903
- }),
2904
- headlineInner: n({ zIndex: 10 }),
2905
- kickerRow: n(Ui, { justifyContent: "flex-start" }),
2906
- kickerRowMobile: n(Ui, { justifyContent: "center" }),
2907
- kicker: n(Wi, { textAlign: "left" }),
2908
- kickerMobile: n(Wi, { textAlign: "center" }),
2909
- texts: n({ display: "flex", flexDirection: "column", gap: Xe("3xs") }),
2910
- title: n(Vi, { textAlign: "left" }),
2911
- titleMobile: n(Vi, { textAlign: "center" }),
2912
- description: n(Ni, { textAlign: "left" }),
2913
- descriptionMobile: n(Ni, { textAlign: "center" }),
2914
- section: n({ display: "flex", flexDirection: "column", gap: Xe("md") }),
2915
- // A blurred panel over the artwork; the tint is already half transparent, then halved again.
2916
- backdrop: n({
2917
- borderRadius: "var(--fu-ucrc-radius-md)",
2918
- padding: Xe("md"),
2919
- display: "flex",
2920
- flexDirection: "column",
2921
- gap: Xe("md"),
2922
- backdropFilter: "blur(4px)",
2923
- position: "relative",
2924
- "&::before": {
2925
- content: '""',
2926
- position: "absolute",
2927
- top: 0,
2928
- left: 0,
2929
- right: 0,
2930
- bottom: 0,
2931
- backgroundColor: "var(--fu-ucrc-eg-ofg-bg)",
2932
- opacity: 0.5,
2933
- borderRadius: "inherit",
2934
- zIndex: 0
2935
- },
2936
- "& > *": { position: "relative", zIndex: 1 }
2937
- })
2938
- }, ta = (e) => {
2939
- const i = Ro(), r = Ie(), o = Re(), a = Do().size, { t: u } = oe(), s = ie(), d = Jt(
2940
- me.OVERLAY
2941
- ), { brandingImage: l, brandingColors: c, brandingLogo: y } = Qt(e.game.branding || null), g = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : s ? at : ct, x = _e(
2942
- { images: e.game.images, imagePlaceholder: g },
2943
- me.OVERLAY
2944
- ), v = {
2945
- "--fu-ucrc-eg-ofg-image": `url("${l || x}")`,
2946
- "--fu-ucrc-eg-ofg-gradient": d,
2947
- "--fu-ucrc-eg-ofg-border": c != null && c.borderColor ? `${a} solid ${c.borderColor}` : "none",
2948
- "--fu-ucrc-eg-ofg-secondary": (c == null ? void 0 : c.secondaryColor) || o.textColor,
2949
- "--fu-ucrc-eg-ofg-title": r.colorSchemes.dark.textColor,
2950
- "--fu-ucrc-eg-ofg-bg": `rgba(${it((c == null ? void 0 : c.backgroundColor) || o.surfaceVariant)}, 0.5)`
2951
- }, { rankings: p, pagination: b, loading: C, goToNextPage: I, goToPreviousPage: w } = Xn(e.game.id, e.sdk), T = () => /* @__PURE__ */ f("div", { css: xe.main, children: [
2952
- /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t("div", { css: xe.headlineSection, children: /* @__PURE__ */ t("div", { css: xe.headlineContent, children: /* @__PURE__ */ f("div", { css: xe.headlineInner, children: [
2953
- /* @__PURE__ */ f("div", { css: s ? xe.kickerRowMobile : xe.kickerRow, children: [
2954
- /* @__PURE__ */ t("p", { css: s ? xe.kickerMobile : xe.kicker, children: u("eventGame.headline") }),
2955
- /* @__PURE__ */ t(
2956
- Xt,
2957
- {
2958
- rules: e.game.rules || "",
2959
- rulesDisplay: e.rulesDisplay,
2960
- isOverlayVariant: !0
2961
- }
2962
- )
2963
- ] }),
2964
- /* @__PURE__ */ f("div", { css: xe.texts, children: [
2965
- /* @__PURE__ */ t("h4", { css: s ? xe.titleMobile : xe.title, children: e.game.title }),
2966
- e.game.description && /* @__PURE__ */ t("p", { css: s ? xe.descriptionMobile : xe.description, children: Pt(e.game.description) })
2967
- ] })
2968
- ] }) }) }) }),
2969
- /* @__PURE__ */ f("div", { css: xe.section, children: [
2970
- /* @__PURE__ */ f("div", { css: xe.backdrop, children: [
2971
- /* @__PURE__ */ t(
2972
- _n,
2973
- {
2974
- leaderboard: p,
2975
- userRanking: e.prediction,
2976
- showHeading: !e.showPredictionDetails,
2977
- isSplitVariant: !1,
2978
- loading: C
2979
- }
2980
- ),
2981
- b && (b.hasNextPage || b.hasPreviousPage) && /* @__PURE__ */ t(
2982
- Yn,
2983
- {
2984
- hasNextPage: b.hasNextPage,
2985
- hasPreviousPage: b.hasPreviousPage,
2986
- onNextPage: I,
2987
- onPreviousPage: w,
2988
- isOverlayVariant: !0,
2989
- justifyContent: "flex-end"
2990
- }
2991
- )
2992
- ] }),
2993
- /* @__PURE__ */ t(
2994
- pe,
2995
- {
2996
- brandingLogo: y,
2997
- textColor: r.colorSchemes.dark.textColor,
2998
- label: null
2999
- }
3000
- )
3001
- ] })
3002
- ] });
3003
- return e.showPredictionDetails ? /* @__PURE__ */ t("div", { css: xe.cardWithDetails, style: v, children: /* @__PURE__ */ t(
3004
- jn,
3005
- {
3006
- prediction: e.prediction,
3007
- game: e.game,
3008
- isOverlayVariant: !0,
3009
- brandingColors: c,
3010
- resultsTabPanelSxProps: {
3011
- py: i.lg,
3012
- px: i.xl
3013
- },
3014
- children: T()
3015
- }
3016
- ) }) : /* @__PURE__ */ t("div", { css: xe.card, style: v, children: T() });
3017
- }, na = () => {
3018
- const { t: e } = oe();
3019
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: null, children: /* @__PURE__ */ t(Wo, { title: e("eventGame.eventGameNotFound"), message: e("eventGame.eventGameNotFoundDescription") }) });
3020
- }, ia = (e) => {
3021
- var u, s, d, l, c, y, g;
3022
- const { t: i } = oe(), r = ie(), o = ((u = e.eventGame.branding) == null ? void 0 : u.colors) || null, a = r ? ((d = (s = e.eventGame.branding) == null ? void 0 : s.images) == null ? void 0 : d.mobileLogo) || ((c = (l = e.eventGame.branding) == null ? void 0 : l.images) == null ? void 0 : c.mainLogo) || "" : ((g = (y = e.eventGame.branding) == null ? void 0 : y.images) == null ? void 0 : g.mainLogo) || "";
3023
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (o == null ? void 0 : o.borderColor) || null, children: /* @__PURE__ */ t(
3024
- Vo,
3025
- {
3026
- entity: { ...e.eventGame, labels: null },
3027
- headline: i("eventGame.headline"),
3028
- tryAgainButtonText: i("eventGame.buttons.tryAgain"),
3029
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3030
- imagePosition: e.imagePosition || "left",
3031
- isApiError: e.isApiError,
3032
- apiErrorMessage: e.apiErrorMessage,
3033
- toggleTryAgain: e.toggleTryAgain,
3034
- renderPresentedBy: (x) => /* @__PURE__ */ t(
3035
- pe,
3036
- {
3037
- brandingLogo: a,
3038
- textColor: x,
3039
- label: null
3040
- }
3041
- )
3042
- }
3043
- ) });
3044
- }, oa = (e) => {
3045
- var u, s, d, l, c, y, g;
3046
- const { t: i } = oe(), r = ie(), o = ((u = e.eventGame.branding) == null ? void 0 : u.colors) || null, a = r ? ((d = (s = e.eventGame.branding) == null ? void 0 : s.images) == null ? void 0 : d.mobileLogo) || ((c = (l = e.eventGame.branding) == null ? void 0 : l.images) == null ? void 0 : c.mainLogo) || "" : ((g = (y = e.eventGame.branding) == null ? void 0 : y.images) == null ? void 0 : g.mainLogo) || "";
3047
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (o == null ? void 0 : o.borderColor) || null, children: /* @__PURE__ */ t(
3048
- No,
3049
- {
3050
- entity: { ...e.eventGame, labels: null },
3051
- headline: i("eventGame.headline"),
3052
- tryAgainButtonText: i("eventGame.buttons.tryAgain"),
3053
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3054
- isApiError: e.isApiError,
3055
- apiErrorMessage: e.apiErrorMessage,
3056
- toggleTryAgain: e.toggleTryAgain,
3057
- renderPresentedBy: (x) => /* @__PURE__ */ t(
3058
- pe,
3059
- {
3060
- brandingLogo: a,
3061
- textColor: x,
3062
- label: null
3063
- }
3064
- )
3065
- }
3066
- ) });
3067
- }, ra = (e) => {
3068
- const { t: i } = oe(), r = ie(), { brandingLogo: o } = Qt(
3069
- e.eventGame.branding || null
3070
- ), a = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : r ? at : ct;
3071
- return /* @__PURE__ */ t(
3072
- jo,
3073
- {
3074
- entity: { ...e.eventGame, labels: null },
3075
- headline: i("eventGame.headline"),
3076
- tryAgainButtonText: i("eventGame.buttons.tryAgain"),
3077
- defaultImagePlaceholderUrl: a,
3078
- isApiError: e.isApiError,
3079
- toggleTryAgain: e.toggleTryAgain,
3080
- apiErrorMessage: e.apiErrorMessage,
3081
- renderPresentedBy: (u) => /* @__PURE__ */ t(
3082
- pe,
3083
- {
3084
- brandingLogo: o,
3085
- textColor: u,
3086
- label: null
3087
- }
3088
- )
3089
- }
3090
- );
3091
- }, ae = (e) => `var(--fu-ucrc-space-${e})`, rt = (e) => `var(--fu-ucrc-egs-fg-${e})`, ji = rt("text"), Ot = rt("secondary"), aa = rt("image-text"), qi = rt("image-secondary"), Me = { display: "flex", flexDirection: "column" }, pn = {
3092
- ...ce,
3093
- fontWeight: 500,
3094
- lineHeight: "166%",
3095
- letterSpacing: "1px",
3096
- fontSize: "0.75em",
3097
- textTransform: "uppercase",
3098
- fontFamily: "var(--fu-ucrc-font-secondary)"
3099
- }, yn = {
3100
- fontWeight: 700,
3101
- lineHeight: "133%",
3102
- fontSize: "1.5em",
3103
- fontFamily: "var(--fu-ucrc-font-primary)"
3104
- }, bn = {
3105
- ...ce,
3106
- fontWeight: 400,
3107
- lineHeight: "140%",
3108
- letterSpacing: "0.15px",
3109
- fontSize: "1.25em",
3110
- fontFamily: "var(--fu-ucrc-font-primary)"
3111
- }, _i = {
3112
- flex: "0.3",
3113
- overflow: "hidden",
3114
- height: "auto",
3115
- position: "relative",
3116
- minHeight: "auto",
3117
- backgroundImage: rt("image"),
3118
- backgroundSize: "cover",
3119
- backgroundPosition: "center center",
3120
- backgroundRepeat: "no-repeat",
3121
- alignItems: "center",
3122
- justifyContent: "center"
3123
- }, Cn = { ...Me, flex: "1" }, St = { display: "flex", alignItems: "center", gap: ae("sm") }, Yi = { display: "flex", alignItems: "center", gap: ae("3xs") }, H = {
3124
- main: n({ ...Cn, padding: ae("md"), gap: ae("md") }),
3125
- mainImage: n({ ...Cn, flex: "0.7", padding: ae("md"), gap: ae("md") }),
3126
- mainMobile: n({ ...Cn, padding: ae("sm"), gap: ae("sm") }),
3127
- desktopHeadline: n({
3128
- display: "flex",
3129
- flexDirection: "column",
3130
- justifyContent: "space-between",
3131
- gap: ae("2xl"),
3132
- textAlign: "center"
3133
- }),
3134
- desktopHeadlineInner: n({ ...Me, alignItems: "center" }),
3135
- kickerRowDesktop: n(Yi),
3136
- kickerRow: n({ ...Yi, justifyContent: "center" }),
3137
- texts: n({ ...Me, gap: ae("3xs") }),
3138
- kickerDesktop: n({ ...pn, color: Ot, opacity: "60%" }),
3139
- titleDesktop: n({ ...In, ...yn, letterSpacing: "0px", color: ji }),
3140
- descriptionDesktop: n({ ...bn, color: Ot, opacity: "60%" }),
3141
- kicker: n({ ...pn, color: Ot, opacity: "60%", textAlign: "center" }),
3142
- title: n({ ...In, ...yn, letterSpacing: "0px", color: ji, textAlign: "center" }),
3143
- description: n({ ...bn, color: Ot, opacity: "60%", textAlign: "center" }),
3144
- kickerOnImage: n({ ...pn, color: qi, opacity: "70%", textAlign: "center" }),
3145
- titleOnImage: n({ ...ce, ...yn, letterSpacing: "0.15px", color: aa, textAlign: "center" }),
3146
- descriptionOnImage: n({ ...bn, color: qi, opacity: "70%", textAlign: "center" }),
3147
- mobileWithImage: n({
3148
- display: "flex",
3149
- flexDirection: "column",
3150
- justifyContent: "space-between",
3151
- gap: "10px",
3152
- backgroundImage: rt("image"),
3153
- backgroundSize: "cover",
3154
- backgroundPosition: "center",
3155
- borderTopLeftRadius: "5px",
3156
- borderTopRightRadius: "5px",
3157
- position: "relative",
3158
- minHeight: "210px",
3159
- overflow: "hidden",
3160
- height: "auto",
3161
- "&::before": {
3162
- content: '""',
3163
- position: "absolute",
3164
- width: "100%",
3165
- height: "100%",
3166
- background: rt("gradient"),
3167
- borderTopLeftRadius: "5px",
3168
- borderTopRightRadius: "5px"
3169
- }
3170
- }),
3171
- mobileWithImageContent: n({
3172
- ...Me,
3173
- zIndex: 1,
3174
- height: "100%",
3175
- padding: ae("xl"),
3176
- gap: ae("2xl"),
3177
- justifyContent: "space-between"
3178
- }),
3179
- mobileWithoutImage: n({
3180
- ...Me,
3181
- flex: "0.5",
3182
- justifyContent: "space-between",
3183
- padding: ae("sm"),
3184
- gap: ae("2xl")
3185
- }),
3186
- image: n({ ..._i, display: "block" }),
3187
- // Rendered but hidden on mobile, like the Joy original.
3188
- imageHidden: n({ ..._i, display: "none" }),
3189
- imageSafeArea: n({ position: "relative", zIndex: 2, width: "165px", height: "100%" }),
3190
- area: n({ ...Me, paddingTop: ae("md"), paddingInline: ae("md") }),
3191
- areaMobile: n({ ...Me, paddingTop: ae("sm"), paddingInline: ae("sm") }),
3192
- question: n({ ...Me, gap: ae("md") }),
3193
- questionMobile: n({ ...Me, gap: ae("lg") }),
3194
- content: n({ ...Me, borderRadius: "var(--fu-ucrc-radius-md)", gap: ae("md") }),
3195
- presentedBy: n({ ...St, flexDirection: "row", paddingInline: ae("md") }),
3196
- presentedByMobile: n({ ...St, flexDirection: "row", paddingInline: ae("sm") }),
3197
- presentedByXs: n({ ...St, flexDirection: "column-reverse", paddingInline: ae("sm") }),
3198
- // Physical margin: Joy's `ml` flipped under RTL as well.
3199
- pagination: n({ ...St, justifyContent: "flex-end", marginLeft: "auto" }),
3200
- paginationXs: n({ ...St, justifyContent: "center", marginLeft: "0" }),
3201
- wrapperRow: n({ display: "flex", flexDirection: "row", width: "100%" }),
3202
- wrapperColumn: n({ display: "flex", flexDirection: "column", width: "100%" })
3203
- }, ca = (e) => {
3204
- var S, R, A, L;
3205
- const i = Ie(), r = Re(), o = _e(
3206
- {
3207
- images: e.eventGame.images,
3208
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
3209
- },
3210
- me.STANDARD
3211
- ), { t: a } = oe(), u = ie(), s = dt(), d = e.imagePosition || "left", l = u ? ((S = e.eventGame.branding) == null ? void 0 : S.images.mobileLogo) || ((R = e.eventGame.branding) == null ? void 0 : R.images.mainLogo) || "" : ((A = e.eventGame.branding) == null ? void 0 : A.images.mainLogo) || "", c = ((L = e.eventGame.branding) == null ? void 0 : L.colors) || null, y = (c == null ? void 0 : c.contentColor) || r.textColor, g = i.colorSchemes.dark.textColor, x = Jt(
3212
- me.STANDARD
3213
- ), h = {
3214
- "--fu-ucrc-egs-fg-text": y,
3215
- "--fu-ucrc-egs-fg-secondary": (c == null ? void 0 : c.secondaryColor) || r.textColor,
3216
- "--fu-ucrc-egs-fg-image-text": (c == null ? void 0 : c.contentColor) || g,
3217
- "--fu-ucrc-egs-fg-image-secondary": (c == null ? void 0 : c.secondaryColor) || g,
3218
- "--fu-ucrc-egs-fg-image": `url("${o}")`,
3219
- "--fu-ucrc-egs-fg-gradient": x
3220
- }, { rankings: v, pagination: p, loading: b, goToNextPage: C, goToPreviousPage: I } = Xn(e.eventGame.id, e.sdk), w = Eo(d), T = /* @__PURE__ */ t("div", { css: u ? H.imageHidden : H.image, style: h, children: /* @__PURE__ */ t("div", { css: H.imageSafeArea }) }), W = () => /* @__PURE__ */ f(
3221
- "div",
3222
- {
3223
- css: u ? H.mainMobile : o ? H.mainImage : H.main,
3224
- style: h,
3225
- children: [
3226
- !u && /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t("div", { css: H.desktopHeadline, children: /* @__PURE__ */ f("div", { css: H.desktopHeadlineInner, children: [
3227
- /* @__PURE__ */ f("div", { css: H.kickerRowDesktop, children: [
3228
- /* @__PURE__ */ t("p", { css: H.kickerDesktop, children: a("eventGame.headline") }),
3229
- /* @__PURE__ */ t(
3230
- Xt,
3231
- {
3232
- rules: e.eventGame.rules || "",
3233
- rulesDisplay: e.rulesDisplay,
3234
- isOverlayVariant: !1
3235
- }
3236
- )
3237
- ] }),
3238
- /* @__PURE__ */ f("div", { css: H.texts, children: [
3239
- /* @__PURE__ */ t("h4", { css: H.titleDesktop, children: e.eventGame.title }),
3240
- /* @__PURE__ */ t("p", { css: H.descriptionDesktop, children: Pt(e.eventGame.description) })
3241
- ] })
3242
- ] }) }) }),
3243
- /* @__PURE__ */ t("div", { css: u ? H.areaMobile : H.area, children: /* @__PURE__ */ t("div", { css: u ? H.questionMobile : H.question, children: /* @__PURE__ */ t("div", { css: H.content, children: /* @__PURE__ */ t(
3244
- _n,
3245
- {
3246
- leaderboard: v,
3247
- userRanking: e.prediction,
3248
- showHeading: !e.showPredictionDetails,
3249
- loading: b
3250
- }
3251
- ) }) }) }),
3252
- (l || (p == null ? void 0 : p.hasNextPage) || (p == null ? void 0 : p.hasPreviousPage)) && /* @__PURE__ */ f(
3253
- "div",
3254
- {
3255
- css: s ? H.presentedByXs : u ? H.presentedByMobile : H.presentedBy,
3256
- children: [
3257
- /* @__PURE__ */ t(
3258
- pe,
3259
- {
3260
- brandingLogo: l,
3261
- textColor: y,
3262
- label: null
3263
- }
3264
- ),
3265
- /* @__PURE__ */ t("div", { css: s ? H.paginationXs : H.pagination, children: /* @__PURE__ */ t(
3266
- Yn,
3267
- {
3268
- hasNextPage: (p == null ? void 0 : p.hasNextPage) || !1,
3269
- hasPreviousPage: (p == null ? void 0 : p.hasPreviousPage) || !1,
3270
- onNextPage: C,
3271
- onPreviousPage: I,
3272
- isOverlayVariant: !1,
3273
- justifyContent: "flex-start"
3274
- }
3275
- ) })
3276
- ]
3277
- }
3278
- )
3279
- ]
3280
- }
3281
- ), V = () => {
3282
- if (!u) return null;
3283
- const le = (se) => /* @__PURE__ */ f("div", { css: H.kickerRow, children: [
3284
- /* @__PURE__ */ t("p", { css: se ? H.kickerOnImage : H.kicker, children: a("eventGame.headline") }),
3285
- /* @__PURE__ */ t(
3286
- Xt,
3287
- {
3288
- rules: e.eventGame.rules || "",
3289
- rulesDisplay: e.rulesDisplay,
3290
- isOverlayVariant: !1
3291
- }
3292
- )
3293
- ] });
3294
- return o ? /* @__PURE__ */ t("div", { css: H.mobileWithImage, style: h, children: /* @__PURE__ */ t("div", { css: H.mobileWithImageContent, children: /* @__PURE__ */ f("div", { children: [
3295
- le(!0),
3296
- /* @__PURE__ */ f("div", { css: H.texts, children: [
3297
- /* @__PURE__ */ t("p", { css: H.titleOnImage, children: e.eventGame.title }),
3298
- /* @__PURE__ */ t("p", { css: H.descriptionOnImage, children: Pt(e.eventGame.description) })
3299
- ] })
3300
- ] }) }) }) : /* @__PURE__ */ t("div", { css: H.mobileWithoutImage, style: h, children: /* @__PURE__ */ f("div", { children: [
3301
- le(!1),
3302
- /* @__PURE__ */ f("div", { css: H.texts, children: [
3303
- /* @__PURE__ */ t("h4", { css: H.title, children: e.eventGame.title }),
3304
- /* @__PURE__ */ t("p", { css: H.description, children: Pt(e.eventGame.description) })
3305
- ] })
3306
- ] }) });
3307
- };
3308
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (c == null ? void 0 : c.borderColor) || null, children: e.showPredictionDetails ? /* @__PURE__ */ t(
3309
- jn,
3310
- {
3311
- prediction: e.prediction,
3312
- game: e.eventGame,
3313
- brandingColors: c,
3314
- resultsTabPanelSxProps: {
3315
- display: "flex",
3316
- flexDirection: u ? "column" : "row",
3317
- px: 0,
3318
- pb: 0,
3319
- pt: 0
3320
- },
3321
- children: /* @__PURE__ */ f("div", { css: u ? H.wrapperColumn : H.wrapperRow, children: [
3322
- o && w === "left" && T,
3323
- W(),
3324
- o && w === "right" && T
3325
- ] })
3326
- }
3327
- ) : /* @__PURE__ */ f(X, { children: [
3328
- V(),
3329
- o && w === "left" && T,
3330
- W(),
3331
- o && w === "right" && T
3332
- ] }) });
3333
- }, He = (e) => `var(--fu-ucrc-space-${e})`, jt = "var(--fu-ucrc-font-primary)", Xi = "var(--fu-ucrc-eg-ovl-text)", ko = "var(--fu-ucrc-eg-ovl-primary)", Zn = "var(--fu-ucrc-eg-ovl-on-primary)", Zi = "var(--fu-ucrc-eg-ovl-danger)", la = Bn({
3334
- "0%": { transform: "scale(0.95)", boxShadow: "0 0 0 0 var(--fu-ucrc-eg-ovl-glow)" },
3335
- "70%": { transform: "scale(1)", boxShadow: "0 0 0 10px var(--fu-ucrc-eg-ovl-glow-out)" },
3336
- "100%": { transform: "scale(0.95)", boxShadow: "0 0 0 0 var(--fu-ucrc-eg-ovl-glow-out)" }
3337
- }), Ut = { display: "flex", alignItems: "center", gap: He("lg") }, Sn = {
3338
- paddingBlock: "10px",
3339
- paddingInline: "16px",
3340
- borderRadius: "var(--fu-ucrc-eg-ovl-radius-xl)",
3341
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
3342
- transform: "scale(1)",
3343
- alignSelf: "center",
3344
- fontSize: "0.9375em",
3345
- "&:hover": { transform: "scale(1.02)" },
3346
- "&:active": { transform: "scale(0.98)" }
3347
- }, sa = {
3348
- ...ce,
3349
- fontFamily: jt,
3350
- fontWeight: 500,
3351
- fontSize: "0.9375em",
3352
- lineHeight: "24px",
3353
- letterSpacing: "0.46px",
3354
- textTransform: "uppercase",
3355
- color: Zn,
3356
- gap: "8px",
3357
- display: "flex",
3358
- alignItems: "center"
3359
- }, Ki = {
3360
- backgroundColor: ko,
3361
- color: Zn,
3362
- "&:disabled": { opacity: "12%" }
3363
- }, j = {
3364
- // No box of its own: only carries the per-instance vars.
3365
- scope: n({ display: "contents" }),
3366
- // A blurred panel over the artwork, tinted by the content background at half opacity.
3367
- backdrop: n({
3368
- borderRadius: "var(--fu-ucrc-radius-md)",
3369
- padding: He("md"),
3370
- display: "flex",
3371
- flexDirection: "column",
3372
- gap: He("md"),
3373
- backdropFilter: "blur(4px)",
3374
- position: "relative",
3375
- "&::before": {
3376
- content: '""',
3377
- position: "absolute",
3378
- top: 0,
3379
- left: 0,
3380
- right: 0,
3381
- bottom: 0,
3382
- backgroundColor: "var(--fu-ucrc-eg-ovl-content-bg)",
3383
- opacity: 0.5,
3384
- borderRadius: "inherit",
3385
- zIndex: 0
3386
- },
3387
- "& > *": { position: "relative", zIndex: 1 },
3388
- zIndex: 2
3389
- }),
3390
- gameState: n({
3391
- display: "flex",
3392
- flexDirection: "column",
3393
- alignItems: "center",
3394
- justifyContent: "center",
3395
- textAlign: "center",
3396
- padding: `${He("xs")} ${He("sm")}`,
3397
- gap: He("3xs")
3398
- }),
3399
- stateTitle: n(ce, { fontFamily: jt, fontSize: "1.5em", fontWeight: 700, color: Xi, lineHeight: 1.3 }),
3400
- stateDescription: n(ce, {
3401
- fontFamily: jt,
3402
- fontSize: "1.25em",
3403
- letterSpacing: "0.15px",
3404
- fontWeight: 400,
3405
- color: Xi,
3406
- lineHeight: 1.4,
3407
- opacity: "60%"
3408
- }),
3409
- liveRow: n({ display: "flex", alignItems: "center", gap: He("xs"), marginTop: He("xs") }),
3410
- liveDot: n({
3411
- width: "12px",
3412
- height: "12px",
3413
- borderRadius: "50%",
3414
- backgroundColor: Zi,
3415
- animation: `${la} 2s infinite`
3416
- }),
3417
- liveText: n(ce, {
3418
- fontFamily: jt,
3419
- fontSize: "0.875em",
3420
- color: Zi,
3421
- fontWeight: 600,
3422
- textTransform: "uppercase",
3423
- letterSpacing: "0.5px"
3424
- }),
3425
- closedHeader: n({
3426
- display: "flex",
3427
- alignItems: "center",
3428
- justifyContent: "center",
3429
- gap: He("sm"),
3430
- flexWrap: "wrap"
3431
- }),
3432
- // Without a sponsor logo the buttons sit at the end; extra small stacks the row.
3433
- footer: {
3434
- logo: {
3435
- row: n(Ut, { flexDirection: "row", justifyContent: "space-between" }),
3436
- column: n(Ut, { flexDirection: "column", justifyContent: "space-between" })
3437
- },
3438
- end: {
3439
- row: n(Ut, { flexDirection: "row", justifyContent: "flex-end" }),
3440
- column: n(Ut, { flexDirection: "column", justifyContent: "flex-end" })
3441
- }
3442
- },
3443
- nav: n({ display: "flex", gap: He("md"), justifyContent: "center", alignItems: "center" }),
3444
- // Bordered in the brand colour, but labelled in on-primary.
3445
- back: n(Pe, Sn, {
3446
- border: `1px solid ${ko}`,
3447
- backgroundColor: "transparent",
3448
- color: Zn,
3449
- "&:hover": { backgroundColor: "var(--fu-ucrc-eg-ovl-hover-bg)" }
3450
- }),
3451
- next: n(Pe, Sn, Ki),
3452
- // Until a pick is made Next stays enabled, but dimmed and inert.
3453
- nextIdle: n(Pe, Sn, Ki, { opacity: 0.5, cursor: "not-allowed" }),
3454
- navLabel: n(sa)
3455
- }, da = (e) => {
3456
- const [i, r] = lt.useState(1), o = Ie(), { t: a } = oe(), u = ie(), s = dt(), { brandingImage: d, brandingColors: l, brandingLogo: c } = Qt(e.eventGame.branding || null), y = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : u ? at : ct, g = _e(
3457
- { images: e.eventGame.images, imagePlaceholder: y },
3458
- me.OVERLAY
3459
- ), x = d || g, h = o.colorSchemes.dark, v = o.colorSchemes.light, p = (l == null ? void 0 : l.primaryColor) || v.palette.primary.plainColor, b = v.palette.primary.onPrimary, C = v.palette.danger.plainColor || "#d32f2f", I = (l == null ? void 0 : l.contentColor) || h.textColor, w = {
3460
- "--fu-ucrc-eg-ovl-content-bg": (l == null ? void 0 : l.backgroundColor) || h.surfaceVariant,
3461
- "--fu-ucrc-eg-ovl-primary": p,
3462
- "--fu-ucrc-eg-ovl-on-primary": b,
3463
- "--fu-ucrc-eg-ovl-radius-xl": o.customRadius.light.xl,
3464
- "--fu-ucrc-eg-ovl-hover-bg": `${p}10`,
3465
- "--fu-ucrc-eg-ovl-text": I,
3466
- "--fu-ucrc-eg-ovl-danger": C,
3467
- "--fu-ucrc-eg-ovl-glow": `${C}40`,
3468
- "--fu-ucrc-eg-ovl-glow-out": `${C}00`
3469
- }, T = { "--fu-ucrc-primary-on-primary": b }, W = () => {
3470
- var k, q, Z, m;
3471
- return /* @__PURE__ */ t(
3472
- pe,
3473
- {
3474
- brandingLogo: c,
3475
- textColor: h.textColor,
3476
- label: null,
3477
- primaryUrl: (q = (k = e.eventGame.branding) == null ? void 0 : k.urls) == null ? void 0 : q.primaryUrl,
3478
- secondaryUrl: (m = (Z = e.eventGame.branding) == null ? void 0 : Z.urls) == null ? void 0 : m.secondaryUrl
3479
- }
3480
- );
3481
- }, V = c ? "logo" : "end", S = s ? "column" : "row", R = en(
3482
- (k, q) => {
3483
- e.setPrediction((Z) => {
3484
- const m = { ...Z }, P = m.fixtures.find((D) => D.id === k);
3485
- return P && (P.prediction = q), m;
3486
- });
3487
- },
3488
- [e.setPrediction]
3489
- ), A = e.eventGame.fixtures.length + 1, L = e.eventGame.status === "OPEN" && Vn(e.eventGame.predictionsCutoff || ""), le = () => {
3490
- var q, Z;
3491
- const k = e.eventGame.fixtures[i - 1];
3492
- if (k && k.outcomeType === F.NUMBER) {
3493
- const m = k.validOutcomes, P = (Z = (q = e.prediction) == null ? void 0 : q.fixtures) == null ? void 0 : Z.find(
3494
- (D) => D.id === k.id
3495
- );
3496
- if (P && typeof P.prediction == "number") {
3497
- const D = Dt(
3498
- P.prediction,
3499
- m
3500
- );
3501
- D !== P.prediction && R(k.id, D);
3502
- }
3503
- }
3504
- i < A ? r(i + 1) : e.play();
3505
- }, se = () => {
3506
- var Z, m;
3507
- if (i === A) return !0;
3508
- const k = e.eventGame.fixtures[i - 1];
3509
- if (!k) return !1;
3510
- const q = (m = (Z = e.prediction) == null ? void 0 : Z.fixtures) == null ? void 0 : m.find(
3511
- (P) => P.id === k.id
3512
- );
3513
- if (!q) return !1;
3514
- switch (k.outcomeType) {
3515
- case F.BOOLEAN:
3516
- return typeof q.prediction == "boolean";
3517
- case F.NUMBER:
3518
- return typeof q.prediction == "number";
3519
- case F.FREE_INPUT:
3520
- case F.ENUM:
3521
- return typeof q.prediction == "string" && q.prediction.trim().length > 0;
3522
- default:
3523
- return !1;
3524
- }
3525
- }, ge = () => {
3526
- i > 1 && r(i - 1);
3527
- }, ue = (k) => {
3528
- r(k + 1);
3529
- }, ye = () => /* @__PURE__ */ t("div", { css: j.backdrop, children: /* @__PURE__ */ f("div", { css: j.gameState, children: [
3530
- /* @__PURE__ */ t("h5", { css: j.stateTitle, children: a("eventGame.states.pending.title") }),
3531
- /* @__PURE__ */ t("p", { css: j.stateDescription, children: a("eventGame.states.pending.description") })
3532
- ] }) }), N = () => /* @__PURE__ */ t("div", { css: j.backdrop, children: /* @__PURE__ */ f("div", { css: j.gameState, children: [
3533
- /* @__PURE__ */ f("div", { css: j.liveRow, children: [
3534
- /* @__PURE__ */ t("div", { css: j.liveDot }),
3535
- /* @__PURE__ */ t("h5", { css: j.liveText, children: a("eventGame.states.live.indicator") })
3536
- ] }),
3537
- /* @__PURE__ */ t("p", { css: j.stateDescription, children: a("eventGame.states.live.description") })
3538
- ] }) }), E = () => /* @__PURE__ */ t("div", { css: j.backdrop, children: /* @__PURE__ */ f("div", { css: j.gameState, children: [
3539
- /* @__PURE__ */ t("div", { css: j.closedHeader, children: /* @__PURE__ */ t("h5", { css: j.stateTitle, children: a("eventGame.states.closed.title") }) }),
3540
- /* @__PURE__ */ t("p", { css: j.stateDescription, children: a("eventGame.states.closed.description") })
3541
- ] }) }), te = () => /* @__PURE__ */ f("div", { css: j.gameState, children: [
3542
- /* @__PURE__ */ t("h5", { css: j.stateTitle, children: a("eventGame.states.open.title") }),
3543
- /* @__PURE__ */ t("p", { css: j.stateDescription, children: a("eventGame.states.open.description") })
3544
- ] }), he = ot(() => e.eventGame.fixtures[i - 1], [e.eventGame.fixtures, i]), fe = () => {
3545
- var q, Z, m, P, D, B, M, K;
3546
- const k = he;
3547
- if (L)
3548
- return te();
3549
- if (k)
3550
- switch (k.outcomeType) {
3551
- case F.BOOLEAN:
3552
- const Te = (Z = (q = e.prediction) == null ? void 0 : q.fixtures) == null ? void 0 : Z.find(
3553
- (Y) => Y.id === k.id
3554
- );
3555
- return /* @__PURE__ */ t(
3556
- rn,
3557
- {
3558
- prediction: typeof (Te == null ? void 0 : Te.prediction) == "boolean" ? Te.prediction : null,
3559
- onSelectionChange: (Y) => {
3560
- R(k.id, Y);
3561
- },
3562
- question: k.question,
3563
- fixtureId: k.id
3564
- },
3565
- `${k.outcomeType}-${i}-${k.id}`
3566
- );
3567
- case F.NUMBER:
3568
- const $ = (P = (m = e.prediction) == null ? void 0 : m.fixtures) == null ? void 0 : P.find(
3569
- (Y) => Y.id === k.id
3570
- ), J = k.validOutcomes;
3571
- return /* @__PURE__ */ t(
3572
- on,
3573
- {
3574
- prediction: typeof ($ == null ? void 0 : $.prediction) == "number" ? $.prediction : 0,
3575
- onChange: (Y) => {
3576
- R(k.id, Y);
3577
- },
3578
- question: k.question,
3579
- validOutcomes: J || null,
3580
- fixtureId: k.id,
3581
- isOverlayVariant: !0
3582
- },
3583
- `${k.outcomeType}-${i}-${k.id}`
3584
- );
3585
- case F.FREE_INPUT:
3586
- const ne = (B = (D = e.prediction) == null ? void 0 : D.fixtures) == null ? void 0 : B.find(
3587
- (Y) => Y.id === k.id
3588
- );
3589
- return /* @__PURE__ */ t(
3590
- Ze,
3591
- {
3592
- question: k.question,
3593
- prediction: typeof (ne == null ? void 0 : ne.prediction) == "string" ? ne.prediction : null,
3594
- validOutcomes: null,
3595
- onTextChange: (Y) => {
3596
- R(k.id, Y);
3597
- },
3598
- fixtureId: k.id
3599
- },
3600
- `${k.outcomeType}-${i}-${k.id}`
3601
- );
3602
- case F.ENUM:
3603
- const re = (K = (M = e.prediction) == null ? void 0 : M.fixtures) == null ? void 0 : K.find(
3604
- (Y) => Y.id === k.id
3605
- );
3606
- return /* @__PURE__ */ t(
3607
- Ze,
3608
- {
3609
- question: k.question,
3610
- prediction: typeof (re == null ? void 0 : re.prediction) == "string" ? re.prediction : null,
3611
- validOutcomes: k.validOutcomes,
3612
- onTextChange: (Y) => {
3613
- R(k.id, Y);
3614
- },
3615
- fixtureId: k.id,
3616
- optionsLayout: e.optionsLayout
3617
- },
3618
- `${k.id}-${i}`
3619
- );
3620
- default:
3621
- return /* @__PURE__ */ t(X, {});
3622
- }
3623
- }, De = () => {
3624
- const k = se();
3625
- return /* @__PURE__ */ f(X, { children: [
3626
- e.showCountdown && e.eventGame.status === "OPEN" && /* @__PURE__ */ t(
3627
- Wn,
3628
- {
3629
- predictionsCutoffTime: e.eventGame.predictionsCutoff || ""
3630
- }
3631
- ),
3632
- !L && /* @__PURE__ */ t(
3633
- Un,
3634
- {
3635
- eventGame: e.eventGame,
3636
- currentStep: i,
3637
- totalSteps: A
3638
- }
3639
- ),
3640
- /* @__PURE__ */ t("div", { css: j.backdrop, children: i === A ? /* @__PURE__ */ t(
3641
- ft,
3642
- {
3643
- fixtures: e.eventGame.fixtures,
3644
- prediction: e.prediction,
3645
- onEditPrediction: ue,
3646
- onPredictionUpdate: e.setPrediction,
3647
- view: "play",
3648
- play: async () => e.play(),
3649
- isOverlayVariant: !0,
3650
- brandingPrimaryColor: l == null ? void 0 : l.primaryColor
3651
- }
3652
- ) : fe() }),
3653
- /* @__PURE__ */ f("div", { css: j.footer[V][S], children: [
3654
- s ? /* @__PURE__ */ t(X, {}) : W(),
3655
- /* @__PURE__ */ f("div", { css: j.nav, children: [
3656
- i > 1 && i < A && /* @__PURE__ */ t("button", { type: "button", css: j.back, onClick: ge, children: /* @__PURE__ */ t("p", { css: j.navLabel, children: a("eventGame.buttons.back") }) }),
3657
- !L && /* @__PURE__ */ f(
3658
- "button",
3659
- {
3660
- type: "button",
3661
- css: k ? j.next : j.nextIdle,
3662
- style: T,
3663
- onClick: k ? le : void 0,
3664
- disabled: e.isPlaying,
3665
- children: [
3666
- /* @__PURE__ */ t("p", { css: j.navLabel, children: i === A ? e.hasAfterConsents ? a("eventGame.buttons.continue") : a("eventGame.buttons.play") : a("eventGame.buttons.next") }),
3667
- e.isPlaying && /* @__PURE__ */ t(tn, { size: 20, thickness: 3 })
3668
- ]
3669
- }
3670
- )
3671
- ] })
3672
- ] }),
3673
- s ? W() : /* @__PURE__ */ t(X, {})
3674
- ] });
3675
- }, Ge = () => {
3676
- switch (e.eventGame.status) {
3677
- case "PENDING":
3678
- return ye();
3679
- case "LIVE":
3680
- return N();
3681
- case "CLOSED":
3682
- return E();
3683
- default:
3684
- return De();
3685
- }
3686
- }, ve = () => {
3687
- var k, q, Z;
3688
- return /* @__PURE__ */ f(X, { children: [
3689
- /* @__PURE__ */ t("div", { css: j.backdrop, children: /* @__PURE__ */ t(
3690
- ut,
3691
- {
3692
- consents: e.consents,
3693
- primaryColor: p,
3694
- textColor: h.textColor,
3695
- brandingUrls: (k = e.eventGame.branding) == null ? void 0 : k.urls
3696
- }
3697
- ) }),
3698
- /* @__PURE__ */ f("div", { css: j.footer[V][S], children: [
3699
- s ? /* @__PURE__ */ t(X, {}) : W(),
3700
- /* @__PURE__ */ t("div", { css: j.nav, children: /* @__PURE__ */ t(
3701
- nn,
3702
- {
3703
- onClick: e.startPredicting,
3704
- label: ((Z = (q = e.consents) == null ? void 0 : q.labels) == null ? void 0 : Z.ctaLabel) || a("eventGame.buttons.start"),
3705
- isSubmitting: e.isSubmitting,
3706
- primaryColor: p,
3707
- showArrow: !1
3708
- }
3709
- ) })
3710
- ] }),
3711
- s ? W() : /* @__PURE__ */ t(X, {})
3712
- ] });
3713
- };
3714
- return /* @__PURE__ */ t(
3715
- qo,
3716
- {
3717
- entity: { ...e.eventGame, labels: null },
3718
- headline: a("eventGame.headline"),
3719
- finalImage: x,
3720
- rulesDisplay: e.rulesDisplay,
3721
- children: /* @__PURE__ */ t("div", { css: j.scope, style: w, children: e.applyConsentGate ? ve() : Ge() })
3722
- }
3723
- );
3724
- }, Ae = (e) => `var(--fu-ucrc-space-${e})`, qt = "var(--fu-ucrc-font-primary)", Ji = "var(--fu-ucrc-danger-plain-color)", $n = "var(--fu-ucrc-primary-on-primary)", wo = "var(--fu-ucrc-eg-split-primary)", ua = "var(--fu-ucrc-eg-split-text)", fa = Bn({
3725
- "0%": { opacity: 1, transform: "scale(1)" },
3726
- "50%": { opacity: 0.7, transform: "scale(1.1)" },
3727
- "100%": { opacity: 1, transform: "scale(1)" }
3728
- }), ma = {
3729
- display: "flex",
3730
- flexDirection: "column",
3731
- backdropFilter: "blur(4px)",
3732
- backgroundColor: "var(--fu-ucrc-eg-split-bg)",
3733
- borderRadius: "var(--fu-ucrc-radius-sm)"
3734
- }, kn = {
3735
- alignSelf: "center",
3736
- paddingBlock: "10px",
3737
- paddingInline: "16px",
3738
- borderRadius: "var(--fu-ucrc-radius-xl)",
3739
- fontSize: "0.9375em",
3740
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
3741
- transform: "scale(1)",
3742
- "&:hover": { transform: "scale(1.02)" },
3743
- "&:active": { transform: "scale(0.98)" }
3744
- }, Qi = {
3745
- margin: 0,
3746
- fontFamily: qt,
3747
- fontWeight: 500,
3748
- fontSize: "0.9375em",
3749
- lineHeight: "24px",
3750
- letterSpacing: "0.46px",
3751
- textTransform: "uppercase",
3752
- gap: "8px",
3753
- display: "flex",
3754
- alignItems: "center"
3755
- }, eo = {
3756
- backgroundColor: wo,
3757
- color: $n,
3758
- "&:disabled": { opacity: "12%" }
3759
- }, Q = {
3760
- contentArea: n({ padding: Ae("lg"), display: "flex", flexDirection: "column", justifyContent: "center", gap: "16px" }),
3761
- mainPanel: n(ma, { padding: Ae("lg"), gap: Ae("md"), position: "relative", zIndex: 2 }),
3762
- gameState: n({ display: "flex", flexDirection: "column", gap: Ae("xs"), textAlign: "center" }),
3763
- stateTitle: n({
3764
- margin: 0,
3765
- fontFamily: qt,
3766
- fontWeight: 700,
3767
- fontSize: "1.5em",
3768
- lineHeight: "133%",
3769
- letterSpacing: "0.15px",
3770
- color: ua
3771
- }),
3772
- stateDescription: n({
3773
- margin: 0,
3774
- fontFamily: qt,
3775
- fontWeight: 400,
3776
- fontSize: "1.25em",
3777
- lineHeight: "140%",
3778
- letterSpacing: "0.15px",
3779
- color: "var(--fu-ucrc-eg-split-secondary)",
3780
- opacity: "60%"
3781
- }),
3782
- liveRow: n({ display: "flex", alignItems: "center", justifyContent: "center", gap: Ae("xs") }),
3783
- liveDot: n({
3784
- width: "12px",
3785
- height: "12px",
3786
- borderRadius: "50%",
3787
- backgroundColor: Ji,
3788
- animation: `${fa} 2s infinite`
3789
- }),
3790
- liveText: n({
3791
- margin: 0,
3792
- fontFamily: qt,
3793
- fontWeight: 600,
3794
- fontSize: "1em",
3795
- lineHeight: 1.5,
3796
- color: Ji,
3797
- textTransform: "uppercase",
3798
- letterSpacing: "0.5px"
3799
- }),
3800
- countdown: n({ marginTop: Ae("lg"), marginBottom: Ae("lg") }),
3801
- pagination: n({ display: "flex", justifyContent: "center", paddingInline: Ae("lg") }),
3802
- navigation: n({ display: "flex", gap: Ae("md"), justifyContent: "center", alignItems: "center" }),
3803
- back: n(Pe, kn, {
3804
- border: `1px solid ${wo}`,
3805
- backgroundColor: "transparent",
3806
- color: $n,
3807
- "&:hover": { backgroundColor: "var(--fu-ucrc-eg-split-primary-hover)" }
3808
- }),
3809
- // An unstyled Typography: Joy's text.secondary.
3810
- backLabel: n(Qi, { color: "var(--fu-ucrc-joy-text-secondary)" }),
3811
- // Enabled until a pick is made, but a dimmed no-op. Busy, Joy disabled it and kept the label.
3812
- next: n(Pe, kn, eo),
3813
- nextIdle: n(Pe, kn, eo, { opacity: 0.5, cursor: "not-allowed" }),
3814
- nextLabel: n(Qi, { color: $n }),
3815
- presentedBy: n({ marginBottom: Ae("lg"), paddingInline: Ae("lg") })
3816
- }, ga = (e) => {
3817
- var fe, De, Ge, ve, k, q, Z;
3818
- const [i, r] = lt.useState(1), o = Ie(), a = Re(), { t: u } = oe(), s = ie(), d = lo(), l = ((fe = e.eventGame.branding) == null ? void 0 : fe.colors) || null, c = s ? ((Ge = (De = e.eventGame.branding) == null ? void 0 : De.images) == null ? void 0 : Ge.mobileLogo) || ((k = (ve = e.eventGame.branding) == null ? void 0 : ve.images) == null ? void 0 : k.mainLogo) || "" : ((Z = (q = e.eventGame.branding) == null ? void 0 : q.images) == null ? void 0 : Z.mainLogo) || "", y = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : s ? at : ct, g = _e(
3819
- {
3820
- images: e.eventGame.images,
3821
- imagePlaceholder: y
3822
- },
3823
- me.SPLIT
3824
- ), x = (l == null ? void 0 : l.contentColor) || a.textColor, h = (l == null ? void 0 : l.secondaryColor) || a.textColor, v = it((l == null ? void 0 : l.backgroundColor) || a.surfaceVariant || ""), p = (l == null ? void 0 : l.primaryColor) || a.palette.primary.plainColor, b = {
3825
- "--fu-ucrc-eg-split-primary": p,
3826
- "--fu-ucrc-eg-split-primary-hover": `${p}10`,
3827
- "--fu-ucrc-eg-split-text": x,
3828
- "--fu-ucrc-eg-split-secondary": h,
3829
- "--fu-ucrc-eg-split-bg": `rgba(${v ? v.replace(/[^\d,]/g, "") : ""}, 0.5)`
3830
- }, C = (m) => {
3831
- var P, D, B, M;
3832
- return /* @__PURE__ */ t(
3833
- pe,
3834
- {
3835
- brandingLogo: c,
3836
- textColor: m,
3837
- label: null,
3838
- primaryUrl: (D = (P = e.eventGame.branding) == null ? void 0 : P.urls) == null ? void 0 : D.primaryUrl,
3839
- secondaryUrl: (M = (B = e.eventGame.branding) == null ? void 0 : B.urls) == null ? void 0 : M.secondaryUrl
3840
- }
3841
- );
3842
- }, I = en(
3843
- (m, P) => {
3844
- e.setPrediction((D) => {
3845
- const B = { ...D }, M = B.fixtures.find((K) => K.id === m);
3846
- return M && (M.prediction = P), B;
3847
- });
3848
- },
3849
- [e.setPrediction]
3850
- ), w = e.eventGame.fixtures.length + 1, T = e.eventGame.status === "OPEN" && Vn(e.eventGame.predictionsCutoff || ""), W = () => {
3851
- var P, D;
3852
- const m = e.eventGame.fixtures[i - 1];
3853
- if (m && m.outcomeType === F.NUMBER) {
3854
- const B = m.validOutcomes, M = (D = (P = e.prediction) == null ? void 0 : P.fixtures) == null ? void 0 : D.find((K) => K.id === m.id);
3855
- if (M && typeof M.prediction == "number") {
3856
- const K = Dt(M.prediction, B);
3857
- K !== M.prediction && I(m.id, K);
3858
- }
3859
- }
3860
- i < w ? r(i + 1) : e.play();
3861
- }, V = (m) => {
3862
- r(m + 1);
3863
- }, S = () => {
3864
- var D, B;
3865
- if (i === w) return !0;
3866
- const m = e.eventGame.fixtures[i - 1];
3867
- if (!m) return !1;
3868
- const P = (B = (D = e.prediction) == null ? void 0 : D.fixtures) == null ? void 0 : B.find((M) => M.id === m.id);
3869
- if (!P) return !1;
3870
- switch (m.outcomeType) {
3871
- case F.BOOLEAN:
3872
- return typeof P.prediction == "boolean";
3873
- case F.NUMBER:
3874
- return typeof P.prediction == "number";
3875
- case F.FREE_INPUT:
3876
- return typeof P.prediction == "string" && P.prediction.trim().length > 0;
3877
- case F.ENUM:
3878
- return typeof P.prediction == "string" && P.prediction.trim().length > 0;
3879
- default:
3880
- return !1;
3881
- }
3882
- }, R = () => {
3883
- i > 1 && r(i - 1);
3884
- }, A = (m) => /* @__PURE__ */ t("div", { css: Q.contentArea, style: b, children: /* @__PURE__ */ t("div", { css: Q.mainPanel, children: /* @__PURE__ */ t("div", { css: Q.gameState, children: m }) }) }), L = () => A(
3885
- /* @__PURE__ */ f(X, { children: [
3886
- /* @__PURE__ */ t("p", { css: Q.stateTitle, children: u("eventGame.states.pending.title") }),
3887
- /* @__PURE__ */ t("p", { css: Q.stateDescription, children: u("eventGame.states.pending.description") })
3888
- ] })
3889
- ), le = () => A(
3890
- /* @__PURE__ */ f(X, { children: [
3891
- /* @__PURE__ */ f("div", { css: Q.liveRow, children: [
3892
- /* @__PURE__ */ t("div", { css: Q.liveDot }),
3893
- /* @__PURE__ */ t("p", { css: Q.liveText, children: u("eventGame.states.live.indicator") })
3894
- ] }),
3895
- /* @__PURE__ */ t("p", { css: Q.stateDescription, children: u("eventGame.states.live.description") })
3896
- ] })
3897
- ), se = () => A(
3898
- /* @__PURE__ */ f(X, { children: [
3899
- /* @__PURE__ */ t("p", { css: Q.stateTitle, children: u("eventGame.states.closed.title") }),
3900
- /* @__PURE__ */ t("p", { css: Q.stateDescription, children: u("eventGame.states.closed.description") })
3901
- ] })
3902
- ), ge = () => /* @__PURE__ */ f("div", { css: Q.gameState, children: [
3903
- /* @__PURE__ */ t("p", { css: Q.stateTitle, children: u("eventGame.states.open.title") }),
3904
- /* @__PURE__ */ t("p", { css: Q.stateDescription, children: u("eventGame.states.open.description") })
3905
- ] }), ue = ot(() => e.eventGame.fixtures[i - 1], [e.eventGame.fixtures, i]), ye = ot(() => ue ? {
3906
- onSelectionChange: (m) => I(ue.id, m)
3907
- } : {}, [ue == null ? void 0 : ue.id, I]), N = () => {
3908
- var P, D, B, M, K, Te, $, J;
3909
- const m = ue;
3910
- if (T)
3911
- return ge();
3912
- if (m)
3913
- switch (m.outcomeType) {
3914
- case F.NUMBER:
3915
- const ne = (D = (P = e.prediction) == null ? void 0 : P.fixtures) == null ? void 0 : D.find((_) => _.id === m.id), re = m.validOutcomes;
3916
- return /* @__PURE__ */ t(
3917
- on,
3918
- {
3919
- prediction: typeof (ne == null ? void 0 : ne.prediction) == "number" ? ne.prediction : 0,
3920
- isSplitVariant: !0,
3921
- onChange: (_) => ye.onSelectionChange(_),
3922
- question: m.question,
3923
- validOutcomes: re || null,
3924
- fixtureId: m.id
3925
- },
3926
- `${m.id}-${i}`
3927
- );
3928
- case F.BOOLEAN:
3929
- const Y = (M = (B = e.prediction) == null ? void 0 : B.fixtures) == null ? void 0 : M.find(
3930
- (_) => _.id === m.id
3931
- );
3932
- return /* @__PURE__ */ t(
3933
- rn,
3934
- {
3935
- prediction: typeof (Y == null ? void 0 : Y.prediction) == "boolean" ? Y.prediction : null,
3936
- isSplitVariant: !0,
3937
- onSelectionChange: ye.onSelectionChange,
3938
- question: m.question,
3939
- fixtureId: m.id
3940
- },
3941
- m.id
3942
- );
3943
- case F.FREE_INPUT:
3944
- const Se = (Te = (K = e.prediction) == null ? void 0 : K.fixtures) == null ? void 0 : Te.find((_) => _.id === m.id);
3945
- return /* @__PURE__ */ t(
3946
- Ze,
3947
- {
3948
- question: m.question,
3949
- prediction: typeof (Se == null ? void 0 : Se.prediction) == "string" ? Se.prediction : null,
3950
- validOutcomes: null,
3951
- onTextChange: (_) => ye.onSelectionChange(_),
3952
- isSplitVariant: !0,
3953
- fixtureId: m.id
3954
- },
3955
- `${m.id}-${i}`
3956
- );
3957
- case F.ENUM:
3958
- const Ue = (J = ($ = e.prediction) == null ? void 0 : $.fixtures) == null ? void 0 : J.find((_) => _.id === m.id);
3959
- return /* @__PURE__ */ t(
3960
- Ze,
3961
- {
3962
- question: m.question,
3963
- prediction: typeof (Ue == null ? void 0 : Ue.prediction) == "string" ? Ue.prediction : null,
3964
- validOutcomes: m.validOutcomes,
3965
- onTextChange: (_) => ye.onSelectionChange(_),
3966
- isSplitVariant: !0,
3967
- fixtureId: m.id,
3968
- optionsLayout: e.optionsLayout
3969
- },
3970
- `${m.id}-${i}`
3971
- );
3972
- }
3973
- }, E = () => {
3974
- const m = !!e.isPlaying, P = S();
3975
- return /* @__PURE__ */ f(X, { children: [
3976
- e.showCountdown && !T && e.eventGame.status === "OPEN" && /* @__PURE__ */ t("div", { css: Q.countdown, children: /* @__PURE__ */ t(Wn, { predictionsCutoffTime: e.eventGame.predictionsCutoff || "", isSplitVariant: !0 }) }),
3977
- !T && /* @__PURE__ */ t("div", { css: Q.pagination, children: /* @__PURE__ */ t(Un, { eventGame: e.eventGame, currentStep: i, totalSteps: w, isSplitVariant: !0 }) }),
3978
- /* @__PURE__ */ t("div", { css: Q.contentArea, style: b, children: /* @__PURE__ */ f("div", { css: Q.mainPanel, children: [
3979
- i === w ? /* @__PURE__ */ t(
3980
- ft,
3981
- {
3982
- fixtures: e.eventGame.fixtures,
3983
- prediction: e.prediction,
3984
- onEditPrediction: V,
3985
- onPredictionUpdate: e.setPrediction,
3986
- view: "play",
3987
- play: async () => e.play(),
3988
- isSplitVariant: !0,
3989
- brandingPrimaryColor: l == null ? void 0 : l.primaryColor
3990
- }
3991
- ) : N(),
3992
- /* @__PURE__ */ f("div", { css: Q.navigation, children: [
3993
- i > 1 && i < w && /* @__PURE__ */ t("button", { type: "button", css: Q.back, onClick: R, children: /* @__PURE__ */ t("p", { css: Q.backLabel, children: u("eventGame.buttons.back") }) }),
3994
- !T && /* @__PURE__ */ f(
3995
- "button",
3996
- {
3997
- type: "button",
3998
- css: P ? Q.next : Q.nextIdle,
3999
- onClick: P ? W : () => {
4000
- },
4001
- disabled: m,
4002
- children: [
4003
- /* @__PURE__ */ t("p", { css: Q.nextLabel, children: i === w ? e.hasAfterConsents ? u("eventGame.buttons.continue") : u("eventGame.buttons.play") : u("eventGame.buttons.next") }),
4004
- m && /* @__PURE__ */ t(tn, { size: 20, thickness: 3 })
4005
- ]
4006
- }
4007
- )
4008
- ] })
4009
- ] }) })
4010
- ] });
4011
- }, te = () => {
4012
- switch (e.eventGame.status) {
4013
- case "PENDING":
4014
- return L();
4015
- case "LIVE":
4016
- return le();
4017
- case "CLOSED":
4018
- return se();
4019
- default:
4020
- return E();
4021
- }
4022
- }, he = () => {
4023
- var m;
4024
- return /* @__PURE__ */ t("div", { css: Q.contentArea, style: b, children: /* @__PURE__ */ t("div", { css: Q.mainPanel, children: /* @__PURE__ */ t(
4025
- ut,
4026
- {
4027
- consents: e.consents,
4028
- primaryColor: p,
4029
- textColor: x,
4030
- brandingUrls: (m = e.eventGame.branding) == null ? void 0 : m.urls,
4031
- onSubmit: e.startPredicting,
4032
- isSubmitting: e.isSubmitting,
4033
- ctaLabel: u("eventGame.buttons.start"),
4034
- showArrow: !1,
4035
- align: "center"
4036
- }
4037
- ) }) });
4038
- };
4039
- return /* @__PURE__ */ f(Fe, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: [
4040
- /* @__PURE__ */ t(
4041
- _o,
4042
- {
4043
- entity: { ...e.eventGame, labels: null },
4044
- headline: u("eventGame.headline"),
4045
- finalImage: g,
4046
- brandingLogo: c,
4047
- renderPresentedBy: C,
4048
- rulesDisplay: e.rulesDisplay,
4049
- children: e.applyConsentGate ? he() : te()
4050
- }
4051
- ),
4052
- c && d && /* @__PURE__ */ t("div", { css: Q.presentedBy, children: C((l == null ? void 0 : l.contentColor) || o.colorSchemes.dark.textColor) })
4053
- ] });
4054
- }, nt = (e) => `var(--fu-ucrc-space-${e})`, wn = "var(--fu-ucrc-radius-md)", ha = "var(--fu-ucrc-eg-split-image-text)", Po = "var(--fu-ucrc-eg-split-image-secondary)", to = {
4055
- side: { flex: "0 0 50%", width: "50%", minWidth: "50%", maxWidth: "50%" },
4056
- stacked: { flex: "1", width: "100%", minWidth: "100%", maxWidth: "100%" }
4057
- }, xa = {
4058
- display: "flex",
4059
- flexDirection: "column",
4060
- justifyContent: "space-between",
4061
- gap: "10px",
4062
- backgroundImage: "var(--fu-ucrc-eg-split-image)",
4063
- backgroundSize: "cover",
4064
- backgroundPosition: "center",
4065
- overflow: "hidden",
4066
- height: "auto",
4067
- position: "relative",
4068
- "&::before": {
4069
- content: '""',
4070
- position: "absolute",
4071
- width: "100%",
4072
- height: "100%",
4073
- background: "var(--fu-ucrc-eg-split-gradient)",
4074
- borderTopLeftRadius: "5px",
4075
- borderTopRightRadius: "5px"
4076
- }
4077
- }, Wt = (e, i) => n(xa, e ? to.stacked : to.side, {
4078
- borderTopLeftRadius: i ? 0 : wn,
4079
- borderTopRightRadius: e && !i ? wn : 0,
4080
- borderBottomLeftRadius: e ? 0 : wn,
4081
- minHeight: e ? "210px" : "430px"
4082
- }), no = {
4083
- margin: 0,
4084
- fontWeight: 500,
4085
- lineHeight: "166%",
4086
- letterSpacing: "1px",
4087
- fontSize: "0.75em",
4088
- color: Po,
4089
- opacity: "70%",
4090
- textTransform: "uppercase",
4091
- fontFamily: "var(--fu-ucrc-font-secondary)"
4092
- }, io = {
4093
- margin: 0,
4094
- fontWeight: 700,
4095
- lineHeight: "133%",
4096
- fontSize: "1.5em",
4097
- letterSpacing: "0.15px",
4098
- color: ha,
4099
- fontFamily: "var(--fu-ucrc-font-primary)"
4100
- }, oo = {
4101
- margin: 0,
4102
- fontWeight: 400,
4103
- lineHeight: "140%",
4104
- fontSize: "1.25em",
4105
- letterSpacing: "0.15px",
4106
- color: Po,
4107
- opacity: "70%",
4108
- fontFamily: "var(--fu-ucrc-font-primary)"
4109
- }, ro = { display: "flex", alignItems: "center", gap: nt("3xs") }, ao = {
4110
- padding: nt("lg"),
4111
- display: "flex",
4112
- flexDirection: "column",
4113
- justifyContent: "center",
4114
- gap: "16px"
4115
- }, we = {
4116
- section: {
4117
- side: Wt(!1, !1),
4118
- sideTabulated: Wt(!1, !0),
4119
- stacked: Wt(!0, !1),
4120
- stackedTabulated: Wt(!0, !0)
4121
- },
4122
- headlineContent: n({
4123
- zIndex: 1,
4124
- height: "100%",
4125
- padding: nt("xl"),
4126
- gap: nt("xl"),
4127
- display: "flex",
4128
- flexDirection: "column",
4129
- justifyContent: "space-between"
4130
- }),
4131
- kickerRow: {
4132
- side: n(ro, { justifyContent: "flex-start" }),
4133
- stacked: n(ro, { justifyContent: "center" })
4134
- },
4135
- texts: n({ display: "flex", flexDirection: "column", gap: nt("3xs") }),
4136
- kicker: { side: n(no, { textAlign: "left" }), stacked: n(no, { textAlign: "center" }) },
4137
- title: { side: n(io, { textAlign: "left" }), stacked: n(io, { textAlign: "center" }) },
4138
- description: {
4139
- side: n(oo, { textAlign: "left" }),
4140
- stacked: n(oo, { textAlign: "center" })
4141
- },
4142
- content: { side: n(ao, { width: "100%" }), stacked: n(ao, { width: "auto" }) },
4143
- // Translucent panel, from the branding background.
4144
- panel: n({
4145
- padding: nt("lg"),
4146
- gap: nt("md"),
4147
- display: "flex",
4148
- flexDirection: "column",
4149
- alignItems: "center",
4150
- justifyContent: "center",
4151
- backdropFilter: "blur(4px)",
4152
- backgroundColor: "var(--fu-ucrc-eg-split-bg)",
4153
- borderRadius: "var(--fu-ucrc-radius-sm)",
4154
- minHeight: "300px"
4155
- }),
4156
- pagination: n({ display: "flex", justifyContent: "center", marginLeft: 0 }),
4157
- branding: n({
4158
- minWidth: "180px",
4159
- display: "flex",
4160
- gap: "8px",
4161
- alignItems: "center",
4162
- justifyContent: "center",
4163
- textAlign: "center",
4164
- fontSize: "1em"
4165
- })
4166
- }, va = { maxHeight: "50px", maxWidth: "100px" }, pa = (e) => {
4167
- var S, R, A, L, le, se, ge;
4168
- const i = Ie(), r = Re(), { t: o } = oe(), a = ie(), u = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : a ? at : ct, s = _e(
4169
- {
4170
- images: e.event.images,
4171
- imagePlaceholder: u
4172
- },
4173
- me.SPLIT
4174
- ), d = a ? ((R = (S = e.event.branding) == null ? void 0 : S.images) == null ? void 0 : R.mobileLogo) || ((L = (A = e.event.branding) == null ? void 0 : A.images) == null ? void 0 : L.mainLogo) || "" : ((se = (le = e.event.branding) == null ? void 0 : le.images) == null ? void 0 : se.mainLogo) || "", l = ((ge = e.event.branding) == null ? void 0 : ge.colors) || null, c = i.colorSchemes.dark.textColor, y = it((l == null ? void 0 : l.backgroundColor) || r.surfaceVariant || ""), g = Jt(me.SPLIT), x = {
4175
- "--fu-ucrc-eg-split-image": `url("${s}")`,
4176
- "--fu-ucrc-eg-split-gradient": g,
4177
- "--fu-ucrc-eg-split-image-text": (l == null ? void 0 : l.contentColor) || c,
4178
- "--fu-ucrc-eg-split-image-secondary": (l == null ? void 0 : l.secondaryColor) || c,
4179
- "--fu-ucrc-eg-split-bg": `rgba(${y ? y.replace(/[^\d,]/g, "") : ""}, 0.5)`
4180
- }, h = a ? "stacked" : "side", v = e.showPredictionDetails || !1, { rankings: p, pagination: b, loading: C, goToNextPage: I, goToPreviousPage: w } = Xn(
4181
- e.event.id,
4182
- e.sdk
4183
- ), T = () => /* @__PURE__ */ t("div", { css: we.content[h], style: x, children: /* @__PURE__ */ f("div", { css: we.panel, children: [
4184
- /* @__PURE__ */ t(
4185
- _n,
4186
- {
4187
- leaderboard: p,
4188
- userRanking: e.prediction,
4189
- showHeading: !e.showPredictionDetails,
4190
- isSplitVariant: !0,
4191
- loading: C
4192
- }
4193
- ),
4194
- b && (b.hasNextPage || b.hasPreviousPage) && /* @__PURE__ */ t("div", { css: we.pagination, children: /* @__PURE__ */ t(
4195
- Yn,
4196
- {
4197
- hasNextPage: b.hasNextPage,
4198
- hasPreviousPage: b.hasPreviousPage,
4199
- onNextPage: I,
4200
- onPreviousPage: w,
4201
- isOverlayVariant: !1,
4202
- justifyContent: "center"
4203
- }
4204
- ) }),
4205
- d && a && /* @__PURE__ */ t("div", { css: we.branding, children: /* @__PURE__ */ t("img", { src: d, alt: "branding-logo", style: va }) })
4206
- ] }) }), W = (ue) => /* @__PURE__ */ t(pe, { brandingLogo: d, textColor: ue, label: null }), V = () => /* @__PURE__ */ t(
4207
- "div",
4208
- {
4209
- css: a ? v ? we.section.stackedTabulated : we.section.stacked : v ? we.section.sideTabulated : we.section.side,
4210
- style: x,
4211
- children: /* @__PURE__ */ f("div", { css: we.headlineContent, children: [
4212
- /* @__PURE__ */ f("div", { children: [
4213
- /* @__PURE__ */ f("div", { css: we.kickerRow[h], children: [
4214
- /* @__PURE__ */ t("p", { css: we.kicker[h], children: o("eventGame.headline") }),
4215
- /* @__PURE__ */ t(Xt, { rules: e.event.rules || "", rulesDisplay: e.rulesDisplay, isOverlayVariant: !1 })
4216
- ] }),
4217
- /* @__PURE__ */ f("div", { css: we.texts, children: [
4218
- /* @__PURE__ */ t("p", { css: we.title[h], children: e.event.title }),
4219
- /* @__PURE__ */ t("p", { css: we.description[h], children: Pt(e.event.description) })
4220
- ] })
4221
- ] }),
4222
- d && !a && /* @__PURE__ */ t("div", { children: W((l == null ? void 0 : l.contentColor) || c) })
4223
- ] })
4224
- }
4225
- );
4226
- return /* @__PURE__ */ t(Fe, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: e.showPredictionDetails ? /* @__PURE__ */ f(
4227
- jn,
4228
- {
4229
- prediction: e.prediction,
4230
- game: e.event,
4231
- brandingColors: l,
4232
- resultsTabPanelSxProps: {
4233
- display: "flex",
4234
- flexDirection: a ? "column" : "row",
4235
- px: 0,
4236
- pb: 0,
4237
- pt: 0
4238
- },
4239
- children: [
4240
- V(),
4241
- T()
4242
- ]
4243
- }
4244
- ) : /* @__PURE__ */ f(X, { children: [
4245
- V(),
4246
- T()
4247
- ] }) });
4248
- }, ya = (e) => {
4249
- var a, u, s;
4250
- const { t: i } = oe(), r = ((a = e.eventGame.branding) == null ? void 0 : a.colors) || null, o = (r == null ? void 0 : r.primaryColor) || Re().palette.primary.plainColor;
4251
- return /* @__PURE__ */ t(
4252
- Yo,
4253
- {
4254
- entity: e.eventGame,
4255
- headline: i("eventGame.headline"),
4256
- sdk: e.sdk,
4257
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4258
- imagePosition: e.imagePosition,
4259
- onLeadSubmitted: e.onSubmit,
4260
- isSubmitting: e.isSubmitting,
4261
- MainCard: Fe,
4262
- PresentedBy: pe,
4263
- rulesDisplay: e.rulesDisplay,
4264
- content: /* @__PURE__ */ t(
4265
- ut,
4266
- {
4267
- consents: e.consents,
4268
- primaryColor: o,
4269
- brandingUrls: (u = e.eventGame.branding) == null ? void 0 : u.urls,
4270
- align: "center"
4271
- }
4272
- ),
4273
- footerAction: /* @__PURE__ */ t(
4274
- nn,
4275
- {
4276
- onClick: e.onSubmit,
4277
- label: ((s = e.consents.labels) == null ? void 0 : s.ctaLabel) || i("eventGame.buttons.play"),
4278
- isSubmitting: e.isSubmitting,
4279
- primaryColor: o,
4280
- showArrow: !1
4281
- }
4282
- )
4283
- }
4284
- );
4285
- }, ba = (e) => {
4286
- var a, u;
4287
- const { t: i } = oe(), r = ((a = e.eventGame.branding) == null ? void 0 : a.colors) || null, o = (r == null ? void 0 : r.primaryColor) || Re().palette.primary.plainColor;
4288
- return /* @__PURE__ */ t(
4289
- Xo,
4290
- {
4291
- entity: e.eventGame,
4292
- headline: i("eventGame.headline"),
4293
- sdk: e.sdk,
4294
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
4295
- onLeadSubmitted: e.onSubmit,
4296
- isSubmitting: e.isSubmitting,
4297
- MainCard: Fe,
4298
- PresentedBy: pe,
4299
- rulesDisplay: e.rulesDisplay,
4300
- content: (
4301
- // This template keeps its CTA inside the content frame, as its own Play button is
4302
- /* @__PURE__ */ t(
4303
- ut,
4304
- {
4305
- consents: e.consents,
4306
- primaryColor: o,
4307
- brandingUrls: (u = e.eventGame.branding) == null ? void 0 : u.urls,
4308
- onSubmit: e.onSubmit,
4309
- isSubmitting: e.isSubmitting,
4310
- ctaLabel: i("eventGame.buttons.play"),
4311
- showArrow: !1,
4312
- align: "center"
4313
- }
4314
- )
4315
- )
4316
- }
4317
- );
4318
- }, Ca = (e) => {
4319
- var u, s, d;
4320
- const { t: i } = oe(), r = Ie(), o = ((u = e.eventGame.branding) == null ? void 0 : u.colors) || null, a = (o == null ? void 0 : o.primaryColor) || r.colorSchemes.dark.palette.primary.plainColor;
4321
- return /* @__PURE__ */ t(
4322
- Zo,
4323
- {
4324
- entity: e.eventGame,
4325
- headline: i("eventGame.headline"),
4326
- sdk: e.sdk,
4327
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
4328
- onLeadSubmitted: e.onSubmit,
4329
- isSubmitting: e.isSubmitting,
4330
- PresentedBy: pe,
4331
- rulesDisplay: e.rulesDisplay,
4332
- content: /* @__PURE__ */ t(
4333
- ut,
4334
- {
4335
- consents: e.consents,
4336
- primaryColor: a,
4337
- textColor: (o == null ? void 0 : o.contentColor) || r.colorSchemes.dark.textColor,
4338
- brandingUrls: (s = e.eventGame.branding) == null ? void 0 : s.urls
4339
- }
4340
- ),
4341
- footerAction: /* @__PURE__ */ t(
4342
- nn,
4343
- {
4344
- onClick: e.onSubmit,
4345
- label: ((d = e.consents.labels) == null ? void 0 : d.ctaLabel) || i("eventGame.buttons.play"),
4346
- isSubmitting: e.isSubmitting,
4347
- primaryColor: a,
4348
- showArrow: !1
4349
- }
4350
- )
4351
- }
4352
- );
4353
- }, Gt = (e) => `var(--fu-ucrc-space-${e})`, An = { display: "flex", justifyContent: "center", alignItems: "center" }, co = (e, i, r) => n(Pe, {
4354
- ...An,
4355
- flexDirection: "row",
4356
- gap: "8px",
4357
- paddingBlock: Gt(i),
4358
- paddingInline: Gt(r),
4359
- borderRadius: "var(--fu-ucrc-eg-oss-radius-xl)",
4360
- backgroundColor: "var(--fu-ucrc-secondary-container)",
4361
- color: "var(--fu-ucrc-primary-solid-color, #fff)",
4362
- fontSize: `${e}em`,
4363
- fontWeight: 500,
4364
- textTransform: "uppercase",
4365
- "&:hover": { opacity: 0.9 },
4366
- "& > div": { ...An, gap: "8px" },
4367
- "& p": {
4368
- ...ce,
4369
- color: "var(--fu-ucrc-eg-oss-secondary)",
4370
- fontFamily: "var(--fu-ucrc-eg-oss-font-primary)",
4371
- fontSize: `calc(1em / ${e})`,
4372
- fontStyle: "normal",
4373
- lineHeight: "24px",
4374
- letterSpacing: "0.40px",
4375
- textTransform: "uppercase"
4376
- }
4377
- }), Ye = {
4378
- main: n({ display: "flex", flexDirection: "column", gap: "24px", zIndex: 10 }),
4379
- // A blurred panel over the artwork, tinted by the content background at a quarter opacity.
4380
- results: n({
4381
- borderRadius: "var(--fu-ucrc-eg-oss-radius-md)",
4382
- padding: Gt("md"),
4383
- display: "flex",
4384
- flexDirection: "column",
4385
- alignItems: "center",
4386
- alignSelf: "stretch",
4387
- gap: Gt("md"),
4388
- backdropFilter: "blur(4px)",
4389
- position: "relative",
4390
- "&::before": {
4391
- content: '""',
4392
- position: "absolute",
4393
- top: 0,
4394
- left: 0,
4395
- right: 0,
4396
- bottom: 0,
4397
- backgroundColor: "var(--fu-ucrc-eg-oss-content-bg)",
4398
- opacity: 0.25,
4399
- borderRadius: "inherit",
4400
- zIndex: 0,
4401
- backdropFilter: "blur(4px)"
4402
- },
4403
- "& > *": { position: "relative", zIndex: 1 }
4404
- }),
4405
- resultsInner: n({
4406
- display: "flex",
4407
- flexDirection: "column",
4408
- justifyContent: "center",
4409
- alignItems: "center",
4410
- alignSelf: "stretch"
4411
- }),
4412
- centered: n(An),
4413
- row: n({
4414
- display: "flex",
4415
- flexDirection: "row",
4416
- alignItems: "center",
4417
- justifyContent: "space-between",
4418
- gap: Gt("md")
4419
- }),
4420
- additionalCta: co(0.8125, "sm", "md"),
4421
- additionalCtaMobile: co(0.75, "xs", "sm")
4422
- }, Sa = (e) => {
4423
- const i = Ie(), { t: r } = oe(), o = ie(), a = Jt(
4424
- me.OVERLAY
4425
- ), { brandingImage: u, brandingColors: s, brandingLogo: d } = Qt(e.eventGame.branding), l = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : o ? at : ct, c = _e(
4426
- { images: e.eventGame.images, imagePlaceholder: l },
4427
- me.OVERLAY
4428
- ), y = u || c, g = i.colorSchemes.dark, x = {
4429
- "--fu-ucrc-eg-oss-secondary": (s == null ? void 0 : s.secondaryColor) || g.textSecondary,
4430
- "--fu-ucrc-eg-oss-font-primary": i.customFontFamily.light.primary,
4431
- "--fu-ucrc-eg-oss-radius-md": i.customRadius.light.md,
4432
- "--fu-ucrc-eg-oss-radius-xl": i.customRadius.light.xl,
4433
- "--fu-ucrc-eg-oss-content-bg": (s == null ? void 0 : s.backgroundColor) || g.surfaceVariant
4434
- }, h = e.eventGame.status === "OPEN" && e.prediction && e.onPredictionUpdate, v = (C) => {
4435
- console.log(`Edit prediction for fixture at index: ${C}`);
4436
- }, p = () => /* @__PURE__ */ t(
4437
- pe,
4438
- {
4439
- brandingLogo: d,
4440
- textColor: g.textColor,
4441
- label: null
4442
- }
4443
- ), b = () => /* @__PURE__ */ f("div", { css: Ye.main, style: x, children: [
4444
- e.isUnauthorized ? /* @__PURE__ */ t(
4445
- Nn,
4446
- {
4447
- variant: "error",
4448
- title: r("common.authentication.accessRequired"),
4449
- message: r("common.authentication.invalidOrMissingAuth")
4450
- }
4451
- ) : /* @__PURE__ */ t("div", { css: Ye.results, children: /* @__PURE__ */ t("div", { css: Ye.resultsInner, children: h ? /* @__PURE__ */ t(
4452
- ft,
4453
- {
4454
- fixtures: e.eventGame.fixtures,
4455
- prediction: e.prediction,
4456
- onEditPrediction: v,
4457
- onPredictionUpdate: e.onPredictionUpdate,
4458
- play: e.play,
4459
- view: "score",
4460
- isOverlayVariant: !0,
4461
- onPlayResult: e.onPlayResult,
4462
- brandingPrimaryColor: s == null ? void 0 : s.primaryColor
4463
- }
4464
- ) : null }) }),
4465
- e.chanceGameContent,
4466
- o ? /* @__PURE__ */ f(X, { children: [
4467
- e.additionalCTA && /* @__PURE__ */ t("div", { css: Ye.centered, children: /* @__PURE__ */ t(
4468
- Yt,
4469
- {
4470
- additionalCTA: e.additionalCTA,
4471
- css: Ye.additionalCtaMobile
4472
- }
4473
- ) }),
4474
- /* @__PURE__ */ t("div", { css: Ye.centered, children: p() })
4475
- ] }) : (d || e.additionalCTA) && /* @__PURE__ */ f("div", { css: Ye.row, children: [
4476
- p(),
4477
- /* @__PURE__ */ t(
4478
- Yt,
4479
- {
4480
- additionalCTA: e.additionalCTA,
4481
- css: Ye.additionalCta
4482
- }
4483
- )
4484
- ] })
4485
- ] });
4486
- return /* @__PURE__ */ t(
4487
- Ko,
4488
- {
4489
- entity: { ...e.eventGame, labels: null },
4490
- headline: r("eventGame.headline"),
4491
- backgroundImage: $o(y),
4492
- imageBackgroundGradient: a,
4493
- rulesDisplay: e.rulesDisplay,
4494
- children: b()
4495
- }
4496
- );
4497
- }, ka = (e) => {
4498
- const i = (o, a) => {
4499
- switch (o) {
4500
- case F.NUMBER:
4501
- return (a == null ? void 0 : a.min) !== null && (a == null ? void 0 : a.min) !== void 0 ? a.min : 0;
4502
- case F.BOOLEAN:
4503
- case F.ENUM:
4504
- case F.FREE_INPUT:
4505
- return null;
4506
- }
4507
- }, r = new Mo();
4508
- return r.fixtures = e.map((o) => ({
4509
- id: o.id,
4510
- predictionType: o.outcomeType,
4511
- prediction: i(
4512
- o.outcomeType,
4513
- o.validOutcomes
4514
- )
4515
- })), r.tiebreaker = null, r;
4516
- };
4517
- function kt(e) {
4518
- return e.template === me.STANDARD;
4519
- }
4520
- const wa = (e) => {
4521
- var Te;
4522
- const { t: i } = oe(), { game: r, points: o } = dr(
4523
- e.entityId,
4524
- e.sdk,
4525
- e.showPoints
4526
- ), {
4527
- myPrediction: a,
4528
- setMyPrediction: u,
4529
- isApiError: s,
4530
- apiErrorMessage: d,
4531
- setIsApiError: l,
4532
- isUnauthorized: c,
4533
- setIsUnauthorized: y,
4534
- setApiErrorMessage: g
4535
- } = ur(e.entityId, e.sdk), [x, h] = U(!1), [v, p] = U(!1), [b, C] = U(!1), [I, w] = U(!1), [T, W] = U(!1), [V, S] = U(!1), R = Oe(!1), [A, L] = U({
4536
- fixtures: [],
4537
- tiebreaker: null
4538
- }), [le, se] = U({
4539
- open: !1,
4540
- variant: "success",
4541
- title: "",
4542
- message: ""
4543
- }), {
4544
- loading: ge,
4545
- pending: ue,
4546
- checked: ye,
4547
- setChecked: N,
4548
- allRequiredChecked: E,
4549
- submit: te
4550
- } = Ao({
4551
- sdk: e.sdk,
4552
- consents: (Te = e.consents) == null ? void 0 : Te.items,
4553
- // The SDK's ConsentEntityType has no event-game member, so only the id is recorded
4554
- entityId: e.entityId
4555
- }), he = ue.filter(
4556
- ($) => $.position !== "after"
4557
- ), fe = ue.filter(
4558
- ($) => $.position === "after"
4559
- ), De = ($) => {
4560
- N($), W(!1);
4561
- }, Ge = ($) => {
4562
- var J;
4563
- return {
4564
- items: $,
4565
- checked: ye,
4566
- onChange: De,
4567
- labels: (J = e.consents) == null ? void 0 : J.labels,
4568
- showError: T
4569
- };
4570
- };
4571
- je(() => {
4572
- ge || R.current || p(he.length > 0);
4573
- }, [ge, he.length]);
4574
- const ve = ($, J, ne) => {
4575
- se({
4576
- open: !0,
4577
- variant: $,
4578
- title: J,
4579
- message: ne
4580
- });
4581
- }, k = () => {
4582
- se(($) => ({ ...$, open: !1 }));
4583
- }, q = ($) => {
4584
- var J, ne, re, Y, Se;
4585
- $.success ? ve(
4586
- "success",
4587
- i("eventGame.alerts.play.success.title"),
4588
- i("eventGame.alerts.play.success.message")
4589
- ) : ve(
4590
- "error",
4591
- i("eventGame.alerts.play.error.title"),
4592
- ((re = (ne = (J = $.error) == null ? void 0 : J.data) == null ? void 0 : ne.error) == null ? void 0 : re.message) || ((Se = (Y = $.error) == null ? void 0 : Y.error) == null ? void 0 : Se.message) || i("eventGame.alerts.play.error.message")
4593
- );
4594
- }, Z = ot(() => r ? Lo(r.related) : null, [r]);
4595
- if (je(() => {
4596
- r && r.status === "OPEN" && L(ka(r.fixtures));
4597
- }, [r == null ? void 0 : r.status]), !r || a === void 0)
4598
- return /* @__PURE__ */ t(uo, { marginBlock: "160px" });
4599
- if (!r.id)
4600
- return /* @__PURE__ */ t(na, {});
4601
- const m = () => {
4602
- l(!1), y(!1), g("");
4603
- };
4604
- if (c || s)
4605
- return kt(e) ? /* @__PURE__ */ t(
4606
- ia,
4607
- {
4608
- eventGame: r,
4609
- imagePosition: e.imagePosition,
4610
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4611
- isApiError: s,
4612
- apiErrorMessage: d,
4613
- toggleTryAgain: m
4614
- }
4615
- ) : e.template === me.OVERLAY ? /* @__PURE__ */ t(
4616
- ra,
4617
- {
4618
- eventGame: r,
4619
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4620
- isApiError: s,
4621
- apiErrorMessage: d,
4622
- toggleTryAgain: m
4623
- }
4624
- ) : /* @__PURE__ */ t(
4625
- oa,
4626
- {
4627
- eventGame: r,
4628
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4629
- isApiError: s,
4630
- apiErrorMessage: d,
4631
- toggleTryAgain: m
4632
- }
4633
- );
4634
- const P = async () => {
4635
- if (he.length > 0) {
4636
- if (V) return;
4637
- if (!E(he)) {
4638
- W(!0);
4639
- return;
4640
- }
4641
- S(!0), await te(he), S(!1);
4642
- }
4643
- R.current = !0, p(!1);
4644
- }, D = async () => {
4645
- if (!E(fe)) {
4646
- W(!0);
4647
- return;
4648
- }
4649
- S(!0), await te(fe), w(!0), await M(), S(!1), C(!1);
4650
- }, B = async () => {
4651
- if (fe.length > 0 && !I) {
4652
- C(!0);
4653
- return;
4654
- }
4655
- await M();
4656
- }, M = async () => {
4657
- var J, ne;
4658
- h(!0);
4659
- let $ = {
4660
- fixtures: [],
4661
- tiebreaker: null
4662
- //TODO:
4663
- };
4664
- a ? $.fixtures = a.fixtures.map((re) => ({
4665
- id: re.id,
4666
- predictionType: re.predictionType,
4667
- prediction: re.prediction
4668
- })) : $ = { ...A };
4669
- try {
4670
- const re = a ? await e.sdk.eventGame.updatePrediction(
4671
- e.entityId,
4672
- a.id,
4673
- $
4674
- ) : await e.sdk.eventGame.makePrediction(
4675
- e.entityId,
4676
- $
4677
- );
4678
- u(re), (ne = (J = e.callbacks) == null ? void 0 : J.onFinish) == null || ne.call(J, re), ve(
4679
- "success",
4680
- i("eventGame.alerts.play.success.title"),
4681
- i("eventGame.alerts.play.success.message")
4682
- );
4683
- } catch (re) {
4684
- console.error("[event-game-play] play failed", re);
4685
- const { code: Y, message: Se } = zo(re, e.sdk);
4686
- Y === 401 || Y === 403 ? y(!0) : ve(
4687
- "error",
4688
- i("eventGame.alerts.play.error.title"),
4689
- Se || i("eventGame.alerts.play.error.message")
4690
- );
4691
- } finally {
4692
- h(!1);
4693
- }
4694
- };
4695
- if (b && fe.length > 0) {
4696
- const $ = {
4697
- eventGame: r,
4698
- sdk: e.sdk,
4699
- consents: Ge(fe),
4700
- onSubmit: D,
4701
- isSubmitting: V,
4702
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4703
- rulesDisplay: e.rulesDisplay
4704
- };
4705
- return e.template === me.OVERLAY ? /* @__PURE__ */ t(Ca, { ...$ }) : kt(e) ? /* @__PURE__ */ t(
4706
- ya,
4707
- {
4708
- ...$,
4709
- imagePosition: e.imagePosition
4710
- }
4711
- ) : /* @__PURE__ */ t(ba, { ...$ });
4712
- }
4713
- const K = () => {
4714
- const $ = Ge(he), J = fe.length > 0 && !I;
4715
- return e.template === me.OVERLAY ? /* @__PURE__ */ t(cn, { points: o || [], children: /* @__PURE__ */ t(
4716
- da,
4717
- {
4718
- isPlaying: x,
4719
- prediction: A,
4720
- sdk: e.sdk,
4721
- leads: e.leads,
4722
- eventGame: r,
4723
- play: B,
4724
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4725
- setPrediction: L,
4726
- showCountdown: e.showCountdown,
4727
- optionsLayout: e.optionsLayout,
4728
- rulesDisplay: e.rulesDisplay,
4729
- consents: $,
4730
- applyConsentGate: v,
4731
- hasAfterConsents: J,
4732
- isSubmitting: V,
4733
- startPredicting: P
4734
- }
4735
- ) }) : kt(e) ? /* @__PURE__ */ t(cn, { points: o || [], children: /* @__PURE__ */ t(
4736
- Wr,
4737
- {
4738
- isPlaying: x,
4739
- sdk: e.sdk,
4740
- leads: e.leads,
4741
- eventGame: r,
4742
- play: B,
4743
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4744
- imagePosition: e.imagePosition,
4745
- prediction: A,
4746
- setPrediction: L,
4747
- showCountdown: e.showCountdown,
4748
- optionsLayout: e.optionsLayout,
4749
- rulesDisplay: e.rulesDisplay,
4750
- consents: $,
4751
- applyConsentGate: v,
4752
- hasAfterConsents: J,
4753
- isSubmitting: V,
4754
- startPredicting: P
4755
- }
4756
- ) }) : /* @__PURE__ */ t(cn, { points: o || [], children: /* @__PURE__ */ t(
4757
- ga,
4758
- {
4759
- isPlaying: x,
4760
- prediction: A,
4761
- sdk: e.sdk,
4762
- leads: e.leads,
4763
- eventGame: r,
4764
- play: B,
4765
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4766
- setPrediction: L,
4767
- showCountdown: e.showCountdown,
4768
- optionsLayout: e.optionsLayout,
4769
- rulesDisplay: e.rulesDisplay,
4770
- consents: $,
4771
- applyConsentGate: v,
4772
- hasAfterConsents: J,
4773
- isSubmitting: V,
4774
- startPredicting: P
4775
- }
4776
- ) });
4777
- };
4778
- if (r.status === "SETTLED")
4779
- return kt(e) ? /* @__PURE__ */ t(
4780
- ca,
4781
- {
4782
- sdk: e.sdk,
4783
- eventGame: r,
4784
- prediction: a,
4785
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4786
- imagePosition: e.imagePosition,
4787
- showPredictionDetails: e.showPredictionDetails,
4788
- rulesDisplay: e.rulesDisplay
4789
- }
4790
- ) : e.template === me.OVERLAY ? /* @__PURE__ */ t(
4791
- ta,
4792
- {
4793
- sdk: e.sdk,
4794
- game: r,
4795
- prediction: a,
4796
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4797
- showPredictionDetails: e.showPredictionDetails,
4798
- rulesDisplay: e.rulesDisplay
4799
- }
4800
- ) : /* @__PURE__ */ t(
4801
- pa,
4802
- {
4803
- sdk: e.sdk,
4804
- event: r,
4805
- prediction: a,
4806
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4807
- showPredictionDetails: e.showPredictionDetails,
4808
- rulesDisplay: e.rulesDisplay
4809
- }
4810
- );
4811
- if (a) {
4812
- const $ = Z ? /* @__PURE__ */ t(Kn, { entityId: Z, sdk: e.sdk, children: (ne) => /* @__PURE__ */ t(Jn, { infoPage: ne, variant: e.chanceGameVariant }) }) : void 0, J = Z ? /* @__PURE__ */ t(Kn, { entityId: Z, sdk: e.sdk, children: (ne) => /* @__PURE__ */ t(Jn, { infoPage: ne, variant: e.chanceGameVariant, forceMobile: !0 }) }) : void 0;
4813
- return e.template === me.OVERLAY ? /* @__PURE__ */ f(X, { children: [
4814
- /* @__PURE__ */ t(
4815
- Sa,
4816
- {
4817
- sdk: e.sdk,
4818
- leads: e.leads,
4819
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4820
- isUnauthorized: c,
4821
- eventGame: r,
4822
- prediction: a,
4823
- onPredictionUpdate: L,
4824
- play: B,
4825
- onPlayResult: q,
4826
- additionalCTA: e.additionalCTA,
4827
- rulesDisplay: e.rulesDisplay,
4828
- chanceGameContent: $
4829
- }
4830
- ),
4831
- /* @__PURE__ */ t(
4832
- Et,
4833
- {
4834
- notification: le,
4835
- onClose: k
4836
- }
4837
- )
4838
- ] }) : kt(e) ? /* @__PURE__ */ f(X, { children: [
4839
- /* @__PURE__ */ t(
4840
- jr,
4841
- {
4842
- imagePosition: e.imagePosition || "left",
4843
- eventGame: r,
4844
- sdk: e.sdk,
4845
- leads: e.leads,
4846
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4847
- isUnauthorized: c,
4848
- prediction: a,
4849
- onPredictionUpdate: L,
4850
- play: B,
4851
- onPlayResult: q,
4852
- additionalCTA: e.additionalCTA,
4853
- rulesDisplay: e.rulesDisplay,
4854
- chanceGameContent: J
4855
- }
4856
- ),
4857
- /* @__PURE__ */ t(
4858
- Et,
4859
- {
4860
- notification: le,
4861
- onClose: k
4862
- }
4863
- )
4864
- ] }) : /* @__PURE__ */ f(X, { children: [
4865
- /* @__PURE__ */ t(
4866
- qr,
4867
- {
4868
- eventGame: r,
4869
- sdk: e.sdk,
4870
- leads: e.leads,
4871
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4872
- isUnauthorized: c,
4873
- prediction: a,
4874
- onPredictionUpdate: L,
4875
- play: B,
4876
- onPlayResult: q,
4877
- additionalCTA: e.additionalCTA,
4878
- rulesDisplay: e.rulesDisplay,
4879
- chanceGameContent: J
4880
- }
4881
- ),
4882
- /* @__PURE__ */ t(Et, { notification: le, onClose: k })
4883
- ] });
4884
- }
4885
- return /* @__PURE__ */ f(X, { children: [
4886
- K(),
4887
- /* @__PURE__ */ t(Et, { notification: le, onClose: k })
4888
- ] });
4889
- }, Pa = (e) => {
4890
- var r;
4891
- const i = lt.useMemo(
4892
- () => e.template === me.OVERLAY ? { ...e.themeOptions, mode: "dark" } : e.themeOptions,
4893
- [e.template, e.themeOptions]
4894
- );
4895
- return /* @__PURE__ */ t(
4896
- Jo,
4897
- {
4898
- packageName: "event-game-play",
4899
- language: e.language,
4900
- themeOptions: i,
4901
- disableCache: e.disableCache,
4902
- optionsLayout: e.optionsLayout,
4903
- leadPhoneCountryCode: (r = e.leads) == null ? void 0 : r.phoneCountryCode,
4904
- children: e.children
4905
- }
4906
- );
4907
- }, Ma = (e) => /* @__PURE__ */ t(Pa, { ...e, children: /* @__PURE__ */ t(wa, { ...e }) });
4908
- export {
4909
- Ma as M
4910
- };