fansunited-frontend-components 0.0.97 → 0.0.99

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 (69) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +958 -1464
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +1 -1
  5. package/CompetitionStatistics.js +2042 -2215
  6. package/CompetitorCard.js +4281 -4919
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +6010 -7547
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +546 -849
  12. package/List.js +227 -218
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +50 -42
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +2 -2
  17. package/PlayerOfTheMatch.js +285 -269
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +80 -127
  20. package/README.md +1 -1
  21. package/Standings.js +991 -1324
  22. package/TopX.js +1120 -1167
  23. package/chunks/{ChanceGameEmbedVariant-CVys-3Zh.js → ChanceGameEmbedVariant-DM9eLG5s.js} +2 -2
  24. package/chunks/CheckCircle-I1FktW5Y.js +13 -0
  25. package/chunks/OddsSkeleton-DP5Yfqpr.js +522 -0
  26. package/chunks/Person-CXRqyF4E.js +11 -0
  27. package/chunks/PickOneOfX-DET4ZhjV.js +3117 -0
  28. package/chunks/Search-CIXthh0D.js +17 -0
  29. package/chunks/TimerOutlined-D-WA_vpE.js +8 -0
  30. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +136 -0
  31. package/chunks/{chevrons-right-CXSpQt9w.js → chevrons-right-HWKW2c4I.js} +24 -4
  32. package/chunks/index-BENM3N_w.js +4 -0
  33. package/chunks/index-BRxAV693.js +4 -0
  34. package/chunks/index-BXYTsvIX.js +4 -0
  35. package/chunks/index-C0ilols1.js +4 -0
  36. package/chunks/index-D7VhczXH.js +4 -0
  37. package/chunks/index-DKwvdw9t.js +4 -0
  38. package/chunks/index-DZN-AITW.js +4 -0
  39. package/chunks/main-B2sDRFF4.js +2184 -0
  40. package/chunks/main-CzfWaEQP.js +4869 -0
  41. package/chunks/main-DFNl3g_U.js +4910 -0
  42. package/chunks/{main-65WcUqAl.js → main-DLwnvntz.js} +600 -593
  43. package/chunks/main-DiBlJBNb.js +1956 -0
  44. package/chunks/main-DxvBjXsd.js +1775 -0
  45. package/chunks/main-S8_NDSiY.js +3209 -0
  46. package/chunks/main-lBgr8Liq.js +6571 -0
  47. package/chunks/{withVersionStamp-BkiEu_79.js → withVersionStamp-BsLyhvNA.js} +1 -1
  48. package/package.json +2 -2
  49. package/chunks/OddsSkeleton-ClJE2xhR.js +0 -26
  50. package/chunks/OddsStrip-BnSp5TXa.js +0 -383
  51. package/chunks/PickOneOfX-DaJtkbCw.js +0 -4206
  52. package/chunks/chevron-left-CxfCSZcr.js +0 -13
  53. package/chunks/chevron-right-BEQMacFn.js +0 -13
  54. package/chunks/index-Aq5MbUB9.js +0 -4
  55. package/chunks/index-BBQm_8LD.js +0 -4
  56. package/chunks/index-BC_sWWgc.js +0 -4
  57. package/chunks/index-DXKDJ1Vp.js +0 -4
  58. package/chunks/index-DjT5NrbA.js +0 -4
  59. package/chunks/index-DvLRehH6.js +0 -4
  60. package/chunks/index-aIMaxR-p.js +0 -4
  61. package/chunks/main-52Wff7qC.js +0 -11441
  62. package/chunks/main-B58mi9jx.js +0 -5622
  63. package/chunks/main-BIdXUTZS.js +0 -7308
  64. package/chunks/main-DD-NEzC7.js +0 -8241
  65. package/chunks/main-DUnfJPzY.js +0 -3608
  66. package/chunks/main-DpCBqqg_.js +0 -1950
  67. package/chunks/main-Drznt1ak.js +0 -1790
  68. package/chunks/users-wbJRbqW8.js +0 -16
  69. package/chunks/x-CK4GYo7T.js +0 -14
@@ -0,0 +1,2184 @@
1
+ import { jsx as t, jsxs as h, Fragment as De } from "@emotion/react/jsx-runtime";
2
+ import { useDisableCache as Gt, getTranslatedPollIds as Pt, isTablet as sn, isMobile as J, getBrandingClickUrl as dn, useInternalTheme as pe, useColors as xe, useEmbedCode as Qe, useConstantContext as we, ConstantsContext as Re, isLarge as $e, extractBrandingModelProperties as Je, defaultBgVertical as Ee, defaultBg as Ue, useImageVariant as Ve, WidgetTemplate as $, isExtraSmall as un, hexToRgb as Ze, stripHtmlTags as gn, useIntlLocale as Nt, isDesktop as mn, useImageBackgroundGradient as fn, sanitizeBackgroundUrl as hn, getRelatedInfoPageId as bn, useConsents as yn, initializeI18n as vn, ChanceGameEmbed as kt, extractSdkError as xn } from "fansunited-frontend-core";
3
+ import { C as At } from "./ChanceGameEmbedVariant-DM9eLG5s.js";
4
+ import Se, { useState as B, useEffect as Ce, useCallback as Cn, useRef as Sn, useMemo as dt } from "react";
5
+ import { PollFullModel as In, SinglePollVoteModel as pn } from "fansunited-sdk-esm/models";
6
+ import { CollectLeadForm as Pn, AspectRatio as ft, useBreakpointUp as et, joyBody as We, joyButton as Ie, OverlaySkeleton as kn, ConsentPanel as Fe, ConsentCta as tt, SignInCta as ht, InlineSpinner as Yt, StandardSkeleton as An, SplitSkeleton as Ln, StandardScoreStateSkeleton as Tn, AlertMessage as bt, AdditionalCTA as yt, ReplayButton as Dn, SplitScoreStateSkeleton as wn, OverlayScoreStateSkeleton as Rn, NotFound as En, OverlayApiErrorSkeleton as Xt, SplitApiErrorSkeleton as _t, StandardApiErrorSkeleton as Kt, StandardLeadAfterCollection as Qt, SplitLeadAfterCollection as Jt, OverlayLeadAfterCollection as Zt, Spinner as Un, WidgetPortal as Vn } from "fansunited-frontend-core/ui/emotion";
7
+ import { css as n } from "@emotion/react";
8
+ import { useTranslation as z } from "react-i18next";
9
+ import { PeopleIcon as en, ReplayIcon as tn } from "fansunited-frontend-core/ui/icons";
10
+ const Fn = (e, l) => {
11
+ const [o, i] = B(null), s = Gt(), r = async () => {
12
+ try {
13
+ const a = await l.voting.getPollById(e, s);
14
+ i(a);
15
+ } catch (a) {
16
+ console.error(a), i(new In());
17
+ }
18
+ };
19
+ return Ce(() => (r(), () => i(null)), [e, l, s]), { poll: o, setPoll: i };
20
+ }, Bn = (e, l, o, i = !1, s = !1) => {
21
+ const [r, a] = B(null), [c, g] = B(!1), [m, b] = B(!1), [f, u] = B(""), [x, C] = B(o);
22
+ o !== x && (C(o), a(null));
23
+ const L = async () => {
24
+ try {
25
+ const p = await l.voting.getMyPollVote(e);
26
+ a(p);
27
+ } catch (T) {
28
+ if (a(new pn()), l.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
29
+ const S = T;
30
+ if (S.error.code === 404)
31
+ return;
32
+ if (S.error.code === 401 || S.error.code === 403) {
33
+ i || g(!0);
34
+ return;
35
+ }
36
+ b(!0), u(S.error.message);
37
+ return;
38
+ }
39
+ const y = T;
40
+ if (y.data.error.code === 404)
41
+ return;
42
+ if (y.data.error.code === 401 || y.data.error.code === 403) {
43
+ i || g(!0);
44
+ return;
45
+ }
46
+ b(!0), u(y.data.error.message);
47
+ }
48
+ };
49
+ return Ce(() => (L(), () => {
50
+ a(null), g(!1), b(!1);
51
+ }), [e, l, o, i, s]), {
52
+ myVote: r,
53
+ setMyVote: a,
54
+ isUnauthorized: c,
55
+ isApiError: m,
56
+ apiErrorMessage: f,
57
+ setIsUnauthorized: g,
58
+ setIsApiError: b,
59
+ setApiErrorMessage: u
60
+ };
61
+ }, Lt = async (e, l, o) => {
62
+ if (!l.length) return [];
63
+ const i = await e.voting.getPolls(
64
+ { pollIds: l, limit: l.length },
65
+ o
66
+ );
67
+ return (i == null ? void 0 : i.data) || [];
68
+ }, On = async (e, l, o = !1) => {
69
+ const i = /* @__PURE__ */ new Set([e.id]), s = (m) => m.filter((b) => !i.has(b)), r = s(Pt(e.related));
70
+ r.forEach((m) => i.add(m));
71
+ const a = await Lt(l, r, o), c = s(
72
+ Array.from(new Set(a.flatMap((m) => Pt(m.related))))
73
+ ), g = await Lt(l, c, o);
74
+ return [...a, ...g];
75
+ }, Mn = (e, l) => {
76
+ const o = l.filter((i) => {
77
+ var s;
78
+ return ((s = i.options) == null ? void 0 : s.length) === e.length ? !0 : (console.warn(
79
+ `[poll-vote] translated poll ${i.id} has a different number of options, its votes are not aggregated`
80
+ ), !1);
81
+ });
82
+ return e.map((i, s) => ({
83
+ ...i,
84
+ votes: o.reduce(
85
+ (r, a) => r + (a.options[s].votes || 0),
86
+ i.votes || 0
87
+ )
88
+ }));
89
+ }, zn = (e, l) => {
90
+ const [o, i] = B([]), [s, r] = B(!1), a = Gt(), c = Cn(async () => {
91
+ if (e != null && e.id)
92
+ try {
93
+ i(await On(e, l, a));
94
+ } catch (g) {
95
+ console.error("[poll-vote] translated polls could not be loaded", g), i([]);
96
+ } finally {
97
+ r(!0);
98
+ }
99
+ }, [e, l, a]);
100
+ return { translations: o, loaded: s, loadTranslations: c };
101
+ }, Tt = { minWidth: "180px", display: "flex", gap: "8px", alignItems: "center", fontSize: "1em" }, je = {
102
+ centered: n({ ...Tt, flexDirection: "column", zIndex: 1 }),
103
+ inline: n({ ...Tt, zIndex: 10 }),
104
+ label: n({
105
+ margin: 0,
106
+ fontWeight: 400,
107
+ lineHeight: "166%",
108
+ letterSpacing: "0.4px",
109
+ fontSize: "1em",
110
+ color: "var(--fu-ucrc-pv-presented-by)",
111
+ textAlign: "right",
112
+ fontFamily: "var(--fu-ucrc-font-secondary)"
113
+ }),
114
+ link: n({ cursor: "pointer", textDecoration: "none", display: "inline-flex" }),
115
+ clickable: n({ cursor: "pointer", display: "inline-flex" })
116
+ }, W = (e) => {
117
+ const l = sn(), o = J(), i = e.isSplitVariant && l, s = dn(e.primaryUrl, e.secondaryUrl, "logo");
118
+ if (!e.brandingLogo) return null;
119
+ const r = /* @__PURE__ */ t("img", { src: e.brandingLogo, alt: "branding-logo", style: { maxHeight: "50px", maxWidth: "100px" } }), a = s ? typeof window > "u" ? /* @__PURE__ */ t("a", { css: je.link, href: s, target: "_blank", rel: "noopener noreferrer", children: r }) : /* @__PURE__ */ t("div", { css: je.clickable, onClick: () => window.open(s, "_blank", "noopener,noreferrer"), children: r }) : r;
120
+ return /* @__PURE__ */ h(
121
+ "div",
122
+ {
123
+ css: e.isCentered || i || o ? je.centered : je.inline,
124
+ style: { "--fu-ucrc-pv-presented-by": e.textColor },
125
+ children: [
126
+ e.label && /* @__PURE__ */ t("p", { css: je.label, children: e.label }),
127
+ a
128
+ ]
129
+ }
130
+ );
131
+ }, Be = ({
132
+ sdk: e,
133
+ contentId: l,
134
+ contentName: o,
135
+ brandingColors: i,
136
+ brandingUrls: s,
137
+ campaignId: r,
138
+ campaignName: a,
139
+ startGame: c,
140
+ fields: g = ["fullName", "email"],
141
+ leadTitle: m,
142
+ leadDescription: b,
143
+ leadCta: f,
144
+ leadSuccessTitle: u,
145
+ leadSuccessDescription: x,
146
+ syncWithProfile: C = !1,
147
+ consents: L,
148
+ isAfterPosition: T = !1,
149
+ isSubmittingParticipation: p = !1
150
+ }) => {
151
+ const { t: y } = z(), S = m ?? y("leads.header.title"), E = b ?? y("leads.header.description"), q = f ?? y("leads.buttons.submit"), H = u ?? y("leads.success.title"), w = x ?? y("leads.success.description"), d = {
152
+ defaultLabel: y(T ? "poll.buttons.vote" : "poll.buttons.start"),
153
+ onClick: c
154
+ };
155
+ return /* @__PURE__ */ t(
156
+ Pn,
157
+ {
158
+ sdk: e,
159
+ content: {
160
+ id: l,
161
+ type: "poll",
162
+ name: o
163
+ },
164
+ onSuccessCta: d,
165
+ branding: {
166
+ colors: i,
167
+ urls: s
168
+ },
169
+ campaign: {
170
+ id: r,
171
+ name: a
172
+ },
173
+ fields: g,
174
+ labels: {
175
+ title: S,
176
+ description: E,
177
+ submitButtonLabel: q,
178
+ successTitle: H,
179
+ successDescription: w
180
+ },
181
+ syncWithProfile: C,
182
+ consents: L,
183
+ isSubmittingParticipation: p
184
+ }
185
+ );
186
+ }, He = {
187
+ borderRadius: "var(--fu-ucrc-radius-sm)",
188
+ flex: 1,
189
+ padding: "var(--fu-ucrc-space-xs)",
190
+ gap: "var(--fu-ucrc-space-xs)",
191
+ backgroundColor: "#FFFFFF",
192
+ boxShadow: "none",
193
+ cursor: "pointer",
194
+ opacity: 1,
195
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
196
+ transform: "scale(1)",
197
+ display: "flex",
198
+ flexDirection: "column",
199
+ "&:hover": { transform: "scale(1.02)" },
200
+ "&:active": { transform: "scale(0.98)" }
201
+ }, Dt = {
202
+ backgroundColor: "var(--fu-ucrc-pv-primary)",
203
+ boxShadow: "inset 0 0 0 var(--fu-ucrc-border-size) var(--fu-ucrc-pv-primary)"
204
+ }, wt = {
205
+ cursor: "not-allowed",
206
+ opacity: 0.5,
207
+ "&:hover": { transform: "scale(1)" },
208
+ "&:active": { transform: "scale(1)" }
209
+ }, Rt = {
210
+ margin: 0,
211
+ fontFamily: "var(--fu-ucrc-font-primary)",
212
+ fontWeight: 500,
213
+ fontSize: "0.935em",
214
+ letterSpacing: "0.46px",
215
+ textAlign: "center",
216
+ color: "var(--fu-ucrc-pv-option-text)",
217
+ paddingInline: "var(--fu-ucrc-space-2xs)"
218
+ }, ye = {
219
+ card: n(He),
220
+ cardSelected: n(He, Dt),
221
+ cardDisabled: n(He, wt),
222
+ cardSelectedDisabled: n(He, Dt, wt),
223
+ media: n({ borderRadius: "var(--fu-ucrc-radius-xs)", overflow: "hidden", flexGrow: 1 }),
224
+ img: n({ width: "100%", height: "100%", objectFit: "cover" }),
225
+ mediaTitle: n({ ...Rt, lineHeight: "24px" }),
226
+ title: n({ ...Rt, lineHeight: "16px", marginBlock: "auto" })
227
+ }, jn = (e) => {
228
+ var f;
229
+ const l = pe(), o = xe(), i = Qe(e.option.embedCode || ""), s = !!e.option.embedCode, r = e.optionsImages.get(e.option.id), a = e.selectedOptions.includes(e.option.id), c = e.isVoting || e.disabled || e.multipleChoice && !a && e.selectedOptions.length >= (e.maxChoices || 1), g = {
230
+ "--fu-ucrc-pv-primary": ((f = e.brandingColors) == null ? void 0 : f.primaryColor) || o.palette.primary.plainColor,
231
+ // The card is always white, so unselected text keeps the light scheme's colour.
232
+ "--fu-ucrc-pv-option-text": a ? o.palette.primary.onPrimary : l.colorSchemes.light.textColor
233
+ }, m = c ? void 0 : () => e.answerPoll([e.option.id]), b = s ? /* @__PURE__ */ t("div", { ref: i }) : r ? /* @__PURE__ */ t("img", { src: r, alt: "Option illustration", css: ye.img }) : null;
234
+ return /* @__PURE__ */ t(
235
+ "div",
236
+ {
237
+ css: a ? c ? ye.cardSelectedDisabled : ye.cardSelected : c ? ye.cardDisabled : ye.card,
238
+ style: g,
239
+ onClick: m,
240
+ children: b ? /* @__PURE__ */ h(De, { children: [
241
+ /* @__PURE__ */ t("div", { css: ye.media, children: /* @__PURE__ */ t(ft, { ratio: "16/9", radius: "var(--fu-ucrc-radius-xs)", children: b }) }),
242
+ /* @__PURE__ */ t("p", { css: ye.mediaTitle, children: e.option.title })
243
+ ] }) : /* @__PURE__ */ t("p", { css: ye.title, children: e.option.title })
244
+ }
245
+ );
246
+ }, Et = { display: "flex", flexDirection: "column", gap: "16px" }, te = {
247
+ list: n({ ...Et, paddingBlock: "16px" }),
248
+ row: n({ display: "flex", flexDirection: "row", gap: "16px" }),
249
+ column: n(Et),
250
+ wrapRow: n({ display: "flex", flexWrap: "wrap", flexDirection: "row", gap: "16px", paddingBlock: "16px" }),
251
+ wrapColumn: n({ display: "flex", flexWrap: "wrap", flexDirection: "column", gap: "16px", paddingBlock: "16px" })
252
+ }, nn = (e) => {
253
+ const l = [];
254
+ for (let o = 0; o < e.length; o += 2) l.push(e.slice(o, o + 2));
255
+ return l;
256
+ }, vt = (e) => {
257
+ const l = et("md"), o = (i) => /* @__PURE__ */ t(
258
+ jn,
259
+ {
260
+ option: i,
261
+ optionsImages: e.optionsImages,
262
+ selectedOptions: e.selectedOptions,
263
+ answerPoll: e.answerPoll,
264
+ brandingColors: e.brandingColors,
265
+ multipleChoice: e.multipleChoice,
266
+ maxChoices: e.maxChoices,
267
+ isVoting: e.isVoting,
268
+ disabled: e.disabled
269
+ },
270
+ i.id
271
+ );
272
+ return e.optionsLayout === "twoByTwo" ? /* @__PURE__ */ t("div", { css: te.list, children: nn(e.options).map((i, s) => /* @__PURE__ */ t("div", { css: l ? te.row : te.column, children: i.map(o) }, `row-${s}`)) }) : e.optionsLayout === "column" ? /* @__PURE__ */ t("div", { css: te.list, children: e.options.map(o) }) : /* @__PURE__ */ t("div", { css: l ? te.wrapRow : te.wrapColumn, children: e.options.map(o) });
273
+ }, Oe = (e) => {
274
+ const l = /* @__PURE__ */ new Map(), o = J();
275
+ return e.forEach((i) => {
276
+ var a, c;
277
+ const r = (o ? (a = i.images) == null ? void 0 : a.mobile : (c = i.images) == null ? void 0 : c.main) || "";
278
+ l.set(i.id, r);
279
+ }), l;
280
+ }, qn = {
281
+ display: "flex",
282
+ flexDirection: "column",
283
+ gap: "var(--fu-ucrc-space-md)",
284
+ backdropFilter: "blur(4px)",
285
+ position: "relative",
286
+ "&::before": {
287
+ content: '""',
288
+ position: "absolute",
289
+ top: 0,
290
+ left: 0,
291
+ right: 0,
292
+ bottom: 0,
293
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
294
+ borderRadius: "inherit",
295
+ zIndex: 0
296
+ },
297
+ "& > *": { position: "relative", zIndex: 1 }
298
+ }, ve = {
299
+ backdrop: qn,
300
+ column: n({ display: "flex", flexDirection: "column", gap: "24px" }),
301
+ titleRow: n({ display: "flex", gap: "8px", alignItems: "flex-start", justifyContent: "center" }),
302
+ title: n({
303
+ ...We,
304
+ fontFamily: "var(--fu-ucrc-pv-font-primary)",
305
+ lineHeight: "150%",
306
+ letterSpacing: "0.15px",
307
+ fontWeight: 500,
308
+ fontSize: "1.25em",
309
+ textAlign: "center",
310
+ color: "var(--fu-ucrc-text-color)"
311
+ })
312
+ }, ln = (e) => `var(--fu-ucrc-space-${e})`, Ut = { display: "flex", alignItems: "center", gap: ln("md") }, Vt = {
313
+ ...We,
314
+ fontFamily: "var(--fu-ucrc-font-primary)",
315
+ fontWeight: 500,
316
+ fontSize: "0.9375em",
317
+ lineHeight: "24px",
318
+ letterSpacing: "0.46px",
319
+ textTransform: "uppercase",
320
+ color: "var(--fu-ucrc-pv-on-primary)",
321
+ gap: "8px",
322
+ display: "flex",
323
+ alignItems: "center"
324
+ }, Ft = n(Ie, {
325
+ borderRadius: "var(--fu-ucrc-pv-button-radius)",
326
+ paddingBlock: "10px",
327
+ paddingInline: "16px",
328
+ backgroundColor: "var(--fu-ucrc-pv-primary)",
329
+ color: "var(--fu-ucrc-pv-on-primary)",
330
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
331
+ transform: "scale(1)",
332
+ fontSize: "0.9375em",
333
+ "&:hover": { transform: "scale(1.02)" },
334
+ "&:active": { transform: "scale(0.98)" },
335
+ "&:disabled": { opacity: "34%" }
336
+ }), fe = {
337
+ content: n(ve.backdrop, {
338
+ borderRadius: "var(--fu-ucrc-radius-sm)",
339
+ padding: ln("md"),
340
+ "&::before": { opacity: 0.5 }
341
+ }),
342
+ embed: n({ overflow: "hidden", borderRadius: "var(--fu-ucrc-radius-sm)" }),
343
+ footer: n(Ut, { justifyContent: "space-between" }),
344
+ footerMobile: n(Ut, { justifyContent: "center", flexDirection: "column-reverse" }),
345
+ next: Ft,
346
+ // Joy's `ml: { md: "auto" }`: pushed to the end from the md viewport breakpoint.
347
+ nextEnd: n(Ft, { marginLeft: "auto" }),
348
+ label: n(Vt),
349
+ labelHidden: n(Vt, { visibility: "hidden" }),
350
+ loading: n({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
351
+ }, Wn = (e) => {
352
+ var d, me, P, ce, Y, _, Z, ne, le, ie, X, ee, se, I, U, V, O, j, D, K, de, oe;
353
+ const [l, o] = Se.useState(
354
+ ((d = e.leads) == null ? void 0 : d.position) === "before" && e.poll.authRequirement === "LEAD"
355
+ );
356
+ Se.useEffect(() => {
357
+ var ae;
358
+ o(((ae = e.leads) == null ? void 0 : ae.position) === "before" && e.poll.authRequirement === "LEAD" || !1);
359
+ }, [(me = e.leads) == null ? void 0 : me.position, e.poll.authRequirement]);
360
+ const { optionsLayout: i } = we(Re), s = pe(), r = Oe(e.options), { t: a } = z(), c = J(), g = $e(), m = et("md"), b = Qe(e.poll.embedCode), f = !l && !!e.poll.embedCode, u = ((P = e.leads) == null ? void 0 : P.position) === "after" ? a("poll.buttons.continue") : a("poll.buttons.vote"), { brandingImage: x, brandingColors: C, brandingLogo: L } = Je(e.poll.branding || null), T = e.defaultImagePlaceholderUrl || (c ? Ee : Ue), p = Ve({ images: e.poll.images, imagePlaceholder: T }, $.OVERLAY), y = x || p, S = s.colorSchemes.dark, E = s.colorSchemes.light, q = (C == null ? void 0 : C.primaryColor) || E.palette.primary.plainColor, H = {
361
+ "--fu-ucrc-pv-content-bg": (C == null ? void 0 : C.backgroundColor) || S.surfaceVariant,
362
+ "--fu-ucrc-pv-primary": q,
363
+ "--fu-ucrc-pv-on-primary": E.palette.primary.onPrimary,
364
+ "--fu-ucrc-pv-button-radius": s.customRadius.light.xl,
365
+ "--fu-ucrc-pv-font-primary": s.customFontFamily.dark.primary
366
+ }, w = () => {
367
+ o(!1);
368
+ };
369
+ return /* @__PURE__ */ t(
370
+ kn,
371
+ {
372
+ entity: e.poll,
373
+ headline: a("poll.headline"),
374
+ finalImage: y,
375
+ rulesDisplay: e.rulesDisplay,
376
+ children: /* @__PURE__ */ h("div", { css: ve.column, style: H, children: [
377
+ /* @__PURE__ */ t("div", { css: fe.content, children: e.applyConsentGate ? /* @__PURE__ */ t(
378
+ Fe,
379
+ {
380
+ consents: e.consents,
381
+ primaryColor: q,
382
+ textColor: (C == null ? void 0 : C.contentColor) || S.textColor,
383
+ brandingUrls: (ce = e.poll.branding) == null ? void 0 : ce.urls
384
+ }
385
+ ) : l ? /* @__PURE__ */ t(
386
+ Be,
387
+ {
388
+ sdk: e.sdk,
389
+ startGame: w,
390
+ contentId: e.poll.id,
391
+ contentName: e.poll.title,
392
+ brandingColors: (Y = e.poll.branding) == null ? void 0 : Y.colors,
393
+ brandingUrls: (_ = e.poll.branding) == null ? void 0 : _.urls,
394
+ campaignId: (Z = e.leads) == null ? void 0 : Z.campaignId,
395
+ campaignName: (ne = e.leads) == null ? void 0 : ne.campaignName,
396
+ fields: (le = e.leads) == null ? void 0 : le.fields,
397
+ leadTitle: (ie = e.poll.labels) == null ? void 0 : ie.leadTitle,
398
+ leadDescription: (X = e.poll.labels) == null ? void 0 : X.leadDescription,
399
+ leadCta: (ee = e.poll.labels) == null ? void 0 : ee.leadCta,
400
+ leadSuccessTitle: (se = e.poll.labels) == null ? void 0 : se.leadSuccessTitle,
401
+ leadSuccessDescription: (I = e.poll.labels) == null ? void 0 : I.leadSuccessDescription,
402
+ syncWithProfile: (U = e.leads) == null ? void 0 : U.syncWithProfile,
403
+ consents: e.leadConsents
404
+ }
405
+ ) : /* @__PURE__ */ h(De, { children: [
406
+ f && /* @__PURE__ */ t("div", { css: fe.embed, children: /* @__PURE__ */ t(ft, { ratio: "16/9", children: /* @__PURE__ */ t("div", { ref: b }) }) }),
407
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: ve.titleRow, children: /* @__PURE__ */ t("p", { css: ve.title, children: e.poll.alternativeTitle }) }),
408
+ /* @__PURE__ */ t(
409
+ vt,
410
+ {
411
+ options: e.options || [],
412
+ answerPoll: e.answerPoll,
413
+ selectedOptions: e.selectedOptions,
414
+ optionsLayout: g ? "column" : i ?? "row",
415
+ brandingColors: C,
416
+ optionsImages: r,
417
+ multipleChoice: e.poll.multipleChoice,
418
+ maxChoices: e.optionChoices,
419
+ isVoting: e.isVoting,
420
+ disabled: e.signInRequired
421
+ }
422
+ )
423
+ ] }) }),
424
+ /* @__PURE__ */ h("div", { css: c ? fe.footerMobile : fe.footer, children: [
425
+ /* @__PURE__ */ t(
426
+ W,
427
+ {
428
+ brandingLogo: L,
429
+ textColor: S.textColor,
430
+ label: ((V = e.poll.labels) == null ? void 0 : V.sponsor) || null,
431
+ primaryUrl: (j = (O = e.poll.branding) == null ? void 0 : O.urls) == null ? void 0 : j.primaryUrl,
432
+ secondaryUrl: (K = (D = e.poll.branding) == null ? void 0 : D.urls) == null ? void 0 : K.secondaryUrl
433
+ }
434
+ ),
435
+ e.applyConsentGate ? /* @__PURE__ */ t(
436
+ tt,
437
+ {
438
+ onClick: e.startVoting,
439
+ label: ((oe = (de = e.consents) == null ? void 0 : de.labels) == null ? void 0 : oe.ctaLabel) || a("poll.buttons.start"),
440
+ isSubmitting: e.isSubmitting,
441
+ primaryColor: q
442
+ }
443
+ ) : !l && (e.signInRequired ? /* @__PURE__ */ t(ht, { signInCTA: e.signInCTA, primaryColor: q }) : /* @__PURE__ */ h(
444
+ "button",
445
+ {
446
+ type: "button",
447
+ css: !c && m ? fe.nextEnd : fe.next,
448
+ onClick: e.voteForPoll,
449
+ disabled: e.selectedOptions.length === 0 || e.isVoting,
450
+ children: [
451
+ /* @__PURE__ */ t("p", { css: e.isVoting ? fe.labelHidden : fe.label, children: u }),
452
+ e.isVoting && /* @__PURE__ */ t("span", { css: fe.loading, children: /* @__PURE__ */ t(Yt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
453
+ ]
454
+ }
455
+ ))
456
+ ] })
457
+ ] })
458
+ }
459
+ );
460
+ }, Bt = {
461
+ margin: 0,
462
+ fontFamily: "var(--fu-ucrc-font-primary)",
463
+ fontWeight: 500,
464
+ fontSize: "0.9375em",
465
+ lineHeight: "24px",
466
+ letterSpacing: "0.46px",
467
+ textTransform: "uppercase",
468
+ color: "var(--fu-ucrc-primary-on-primary)",
469
+ gap: "8px",
470
+ display: "flex",
471
+ alignItems: "center"
472
+ }, Ge = {
473
+ root: n(Ie, {
474
+ alignSelf: "center",
475
+ paddingBlock: "10px",
476
+ paddingInline: "16px",
477
+ borderRadius: "var(--fu-ucrc-radius-xl)",
478
+ fontSize: "0.9375em",
479
+ backgroundColor: "var(--fu-ucrc-pv-button)",
480
+ color: "var(--fu-ucrc-primary-on-primary)",
481
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
482
+ transform: "scale(1)",
483
+ "&:hover": { transform: "scale(1.02)" },
484
+ "&:active": { transform: "scale(0.98)" },
485
+ "&:disabled": { opacity: "12%" }
486
+ }),
487
+ label: n(Bt),
488
+ labelHidden: n({ ...Bt, visibility: "hidden" }),
489
+ loading: n({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
490
+ }, on = (e) => /* @__PURE__ */ h(
491
+ "button",
492
+ {
493
+ type: "button",
494
+ css: Ge.root,
495
+ style: { "--fu-ucrc-pv-button": e.buttonColor },
496
+ disabled: e.selectedOptions.length === 0 || e.isVoting,
497
+ onClick: e.onClick,
498
+ children: [
499
+ /* @__PURE__ */ t("p", { css: e.isVoting ? Ge.labelHidden : Ge.label, children: e.label }),
500
+ e.isVoting && /* @__PURE__ */ t("span", { css: Ge.loading, children: /* @__PURE__ */ t(Yt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
501
+ ]
502
+ }
503
+ ), Ot = {
504
+ display: "flex",
505
+ width: "100%",
506
+ borderRadius: "var(--fu-ucrc-radius-md)",
507
+ border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-pv-card-border, var(--fu-ucrc-secondary-container))",
508
+ overflow: "hidden",
509
+ background: "var(--fu-ucrc-surface)",
510
+ minHeight: "250px"
511
+ }, Mt = {
512
+ row: n({ ...Ot, flexDirection: "row" }),
513
+ column: n({ ...Ot, flexDirection: "column" })
514
+ }, Q = ({ children: e, brandingBorderColor: l, state: o }) => {
515
+ const i = J(), s = $e();
516
+ return /* @__PURE__ */ t(
517
+ "div",
518
+ {
519
+ css: (o === "play" ? s : i) ? Mt.column : Mt.row,
520
+ style: l ? { "--fu-ucrc-pv-card-border": l } : void 0,
521
+ children: e
522
+ }
523
+ );
524
+ }, be = (e) => `var(--fu-ucrc-space-${e})`, Ne = { display: "flex", flexDirection: "column" }, Ye = { display: "flex", alignItems: "center", gap: be("lg") }, A = {
525
+ area: n({ ...Ne, padding: be("md") }),
526
+ // Joy's responsive gap: lg below the md breakpoint, md from it.
527
+ question: n({ ...Ne, gap: be("lg") }),
528
+ questionMd: n({ ...Ne, gap: be("md") }),
529
+ content: n({
530
+ ...Ne,
531
+ borderRadius: "var(--fu-ucrc-radius-md)",
532
+ paddingInline: be("md"),
533
+ paddingTop: be("md"),
534
+ paddingBottom: be("lg"),
535
+ gap: be("md"),
536
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
537
+ backdropFilter: "blur(4px)"
538
+ }),
539
+ titleRow: n({ gap: "8px", display: "flex", justifyContent: "center" }),
540
+ title: n({
541
+ ...We,
542
+ fontFamily: "var(--fu-ucrc-font-primary)",
543
+ lineHeight: "150%",
544
+ letterSpacing: "0.15px",
545
+ fontWeight: 500,
546
+ fontSize: "1.25em",
547
+ textAlign: "center",
548
+ color: "var(--fu-ucrc-pv-text)"
549
+ }),
550
+ footer: n({ ...Ye, justifyContent: "space-between" }),
551
+ footerEnd: n({ ...Ye, justifyContent: "flex-end" }),
552
+ footerColumn: n({ ...Ye, flexDirection: "column", justifyContent: "space-between" }),
553
+ footerColumnEnd: n({ ...Ye, flexDirection: "column", justifyContent: "flex-end" }),
554
+ navigation: n({ display: "flex", gap: be("md"), justifyContent: "center", alignItems: "center" })
555
+ }, $n = (e) => {
556
+ var ce, Y, _, Z, ne, le, ie, X, ee, se;
557
+ const [l, o] = Se.useState(
558
+ ((ce = e.leads) == null ? void 0 : ce.position) === "before" && e.poll.authRequirement === "LEAD"
559
+ );
560
+ Se.useEffect(() => {
561
+ var I;
562
+ o(((I = e.leads) == null ? void 0 : I.position) === "before" && e.poll.authRequirement === "LEAD" || !1);
563
+ }, [(Y = e.leads) == null ? void 0 : Y.position, e.poll.authRequirement]);
564
+ const { optionsLayout: i } = we(Re), s = Qe(e.poll.embedCode), r = !l && !!e.poll.embedCode, a = Oe(e.options), { t: c } = z(), g = J(), m = un(), b = et("md"), f = xe(), u = ((_ = e.poll.branding) == null ? void 0 : _.colors) || null, x = g ? ((ne = (Z = e.poll.branding) == null ? void 0 : Z.images) == null ? void 0 : ne.mobileLogo) || ((ie = (le = e.poll.branding) == null ? void 0 : le.images) == null ? void 0 : ie.mainLogo) || "" : ((ee = (X = e.poll.branding) == null ? void 0 : X.images) == null ? void 0 : ee.mainLogo) || "", C = e.imagePosition || "left", L = Ve(
565
+ {
566
+ images: e.poll.images,
567
+ imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
568
+ },
569
+ $.STANDARD
570
+ ), T = ((se = e.leads) == null ? void 0 : se.position) === "after" ? c("poll.buttons.continue") : c("poll.buttons.vote"), p = m || g && !!L, y = (u == null ? void 0 : u.contentColor) || f.textColor, S = (u == null ? void 0 : u.backgroundColor) || f.surfaceVariant, E = (u == null ? void 0 : u.primaryColor) || f.palette.primary.plainColor, q = {
571
+ "--fu-ucrc-pv-text": y,
572
+ "--fu-ucrc-pv-content-bg": `rgba(${S ? Ze(S).replace(/[^\d,]/g, "") : ""}, 0.5)`
573
+ }, H = () => {
574
+ o(!1);
575
+ }, w = (I) => {
576
+ var U, V, O, j, D;
577
+ return /* @__PURE__ */ t(
578
+ W,
579
+ {
580
+ brandingLogo: x,
581
+ textColor: I,
582
+ label: ((U = e.poll.labels) == null ? void 0 : U.sponsor) || null,
583
+ primaryUrl: (O = (V = e.poll.branding) == null ? void 0 : V.urls) == null ? void 0 : O.primaryUrl,
584
+ secondaryUrl: (D = (j = e.poll.branding) == null ? void 0 : j.urls) == null ? void 0 : D.secondaryUrl
585
+ }
586
+ );
587
+ }, d = () => {
588
+ var I, U, V;
589
+ return /* @__PURE__ */ t("div", { css: A.area, style: q, children: /* @__PURE__ */ h("div", { css: b ? A.questionMd : A.question, children: [
590
+ /* @__PURE__ */ t("div", { css: A.content, children: /* @__PURE__ */ t(
591
+ Fe,
592
+ {
593
+ consents: e.consents,
594
+ primaryColor: E,
595
+ textColor: y,
596
+ brandingUrls: (I = e.poll.branding) == null ? void 0 : I.urls,
597
+ align: "center"
598
+ }
599
+ ) }),
600
+ /* @__PURE__ */ h("div", { css: p ? x ? A.footerColumn : A.footerColumnEnd : x ? A.footer : A.footerEnd, children: [
601
+ x && !p && w(y),
602
+ /* @__PURE__ */ t("div", { css: A.navigation, children: /* @__PURE__ */ t(
603
+ tt,
604
+ {
605
+ onClick: e.startVoting,
606
+ label: ((V = (U = e.consents) == null ? void 0 : U.labels) == null ? void 0 : V.ctaLabel) || c("poll.buttons.start"),
607
+ isSubmitting: e.isSubmitting,
608
+ primaryColor: E
609
+ }
610
+ ) })
611
+ ] }),
612
+ x && p && w(y)
613
+ ] }) });
614
+ }, me = () => {
615
+ var I, U, V, O, j, D, K, de, oe, ae, Pe;
616
+ return /* @__PURE__ */ t("div", { css: A.area, style: q, children: /* @__PURE__ */ h("div", { css: b ? A.questionMd : A.question, children: [
617
+ /* @__PURE__ */ t("div", { css: A.content, children: /* @__PURE__ */ t(
618
+ Be,
619
+ {
620
+ sdk: e.sdk,
621
+ startGame: H,
622
+ contentId: e.poll.id,
623
+ contentName: e.poll.title,
624
+ brandingColors: (I = e.poll.branding) == null ? void 0 : I.colors,
625
+ brandingUrls: (U = e.poll.branding) == null ? void 0 : U.urls,
626
+ campaignId: (V = e.leads) == null ? void 0 : V.campaignId,
627
+ campaignName: (O = e.leads) == null ? void 0 : O.campaignName,
628
+ fields: (j = e.leads) == null ? void 0 : j.fields,
629
+ leadTitle: (D = e.poll.labels) == null ? void 0 : D.leadTitle,
630
+ leadDescription: (K = e.poll.labels) == null ? void 0 : K.leadDescription,
631
+ leadCta: (de = e.poll.labels) == null ? void 0 : de.leadCta,
632
+ leadSuccessTitle: (oe = e.poll.labels) == null ? void 0 : oe.leadSuccessTitle,
633
+ leadSuccessDescription: (ae = e.poll.labels) == null ? void 0 : ae.leadSuccessDescription,
634
+ syncWithProfile: (Pe = e.leads) == null ? void 0 : Pe.syncWithProfile,
635
+ consents: e.leadConsents
636
+ }
637
+ ) }),
638
+ w(y)
639
+ ] }) });
640
+ }, P = () => /* @__PURE__ */ t("div", { css: A.area, style: q, children: /* @__PURE__ */ h("div", { css: b ? A.questionMd : A.question, children: [
641
+ /* @__PURE__ */ h("div", { css: A.content, children: [
642
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: A.titleRow, children: /* @__PURE__ */ t("p", { css: A.title, children: e.poll.alternativeTitle }) }),
643
+ /* @__PURE__ */ t(
644
+ vt,
645
+ {
646
+ options: e.options || [],
647
+ answerPoll: e.answerPoll,
648
+ selectedOptions: e.selectedOptions,
649
+ optionsLayout: i ?? "twoByTwo",
650
+ optionsImages: a,
651
+ brandingColors: u,
652
+ multipleChoice: e.poll.multipleChoice,
653
+ maxChoices: e.optionChoices,
654
+ isVoting: e.isVoting,
655
+ disabled: e.signInRequired
656
+ }
657
+ )
658
+ ] }),
659
+ /* @__PURE__ */ h("div", { css: p ? x ? A.footerColumn : A.footerColumnEnd : x ? A.footer : A.footerEnd, children: [
660
+ x && !p && w(y),
661
+ /* @__PURE__ */ t("div", { css: A.navigation, children: e.signInRequired ? /* @__PURE__ */ t(ht, { signInCTA: e.signInCTA, primaryColor: E }) : /* @__PURE__ */ t(
662
+ on,
663
+ {
664
+ selectedOptions: e.selectedOptions,
665
+ label: T,
666
+ buttonColor: E,
667
+ onClick: e.voteForPoll,
668
+ isVoting: e.isVoting
669
+ }
670
+ ) })
671
+ ] }),
672
+ x && p && w(y)
673
+ ] }) });
674
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, children: /* @__PURE__ */ t(
675
+ An,
676
+ {
677
+ entity: e.poll,
678
+ headline: c("poll.headline"),
679
+ finalImage: L,
680
+ imagePosition: C,
681
+ rulesDisplay: e.rulesDisplay,
682
+ embedCodeContainerRef: s,
683
+ hasEmbedCode: r,
684
+ children: e.applyConsentGate ? d() : l ? me() : P()
685
+ }
686
+ ) });
687
+ }, re = (e) => `var(--fu-ucrc-space-${e})`, Xe = "var(--fu-ucrc-text-color)", zt = {
688
+ display: "flex",
689
+ flexDirection: "column",
690
+ backdropFilter: "blur(4px)",
691
+ backgroundColor: "var(--fu-ucrc-pv-split-bg)",
692
+ borderRadius: "var(--fu-ucrc-radius-sm)"
693
+ }, _e = { display: "flex", gap: re("lg") }, R = {
694
+ questionArea: n({ width: "100%", display: "flex", flexDirection: "column", justifyContent: "center" }),
695
+ questionAreaContent: n({
696
+ padding: re("lg"),
697
+ display: "flex",
698
+ flexDirection: "column",
699
+ justifyContent: "center",
700
+ gap: "16px"
701
+ }),
702
+ embedHeadline: n({ gap: re("xl"), display: "flex", flexDirection: "column", alignItems: "center" }),
703
+ headlineText: n({
704
+ margin: 0,
705
+ fontWeight: 500,
706
+ lineHeight: "166%",
707
+ letterSpacing: "1px",
708
+ fontSize: "0.75em",
709
+ color: Xe,
710
+ opacity: "70%",
711
+ textTransform: "uppercase",
712
+ fontFamily: "var(--fu-ucrc-font-secondary)",
713
+ textAlign: "center"
714
+ }),
715
+ texts: n({ display: "flex", flexDirection: "column", gap: re("3xs") }),
716
+ titleText: n({
717
+ margin: 0,
718
+ fontWeight: 700,
719
+ lineHeight: "133%",
720
+ fontSize: "1.5em",
721
+ letterSpacing: "0.15px",
722
+ color: Xe,
723
+ fontFamily: "var(--fu-ucrc-font-primary)",
724
+ textAlign: "center"
725
+ }),
726
+ descriptionText: n({
727
+ margin: 0,
728
+ fontWeight: 400,
729
+ lineHeight: "140%",
730
+ fontSize: "1.25em",
731
+ letterSpacing: "0.15px",
732
+ color: Xe,
733
+ opacity: "70%",
734
+ fontFamily: "var(--fu-ucrc-font-primary)",
735
+ textAlign: "center"
736
+ }),
737
+ leadContent: n(zt, { padding: re("md"), gap: re("md") }),
738
+ mainContent: n(zt, { padding: re("lg"), gap: re("md") }),
739
+ alternativeTitleSection: n({ gap: "8px", display: "flex", justifyContent: "center" }),
740
+ alternativeTitle: n({
741
+ margin: 0,
742
+ fontFamily: "var(--fu-ucrc-font-primary)",
743
+ lineHeight: "150%",
744
+ letterSpacing: "0.15px",
745
+ fontWeight: 500,
746
+ fontSize: "1.25em",
747
+ textAlign: "center",
748
+ color: Xe
749
+ }),
750
+ embedFooter: {
751
+ stackedLogo: n(_e, { flexDirection: "column-reverse", justifyContent: "space-between" }),
752
+ stacked: n(_e, { flexDirection: "column-reverse", justifyContent: "center" }),
753
+ sideLogo: n(_e, { flexDirection: "row", justifyContent: "space-between" }),
754
+ side: n(_e, { flexDirection: "row", justifyContent: "center" })
755
+ },
756
+ buttonFooter: n({ display: "flex", flexDirection: "column", gap: re("lg") }),
757
+ // The original showed it only on large screens, which its branch excludes.
758
+ presentedByMobile: n({ display: "none", justifyContent: "center" }),
759
+ block: n({ display: "block" }),
760
+ hidden: n({ display: "none" }),
761
+ presentedByBottom: n({ marginBottom: re("lg"), paddingInline: re("lg") })
762
+ }, Hn = (e) => {
763
+ var Y, _, Z, ne, le, ie, X, ee, se;
764
+ const [l, o] = Se.useState(
765
+ ((Y = e.leads) == null ? void 0 : Y.position) === "before" && e.poll.authRequirement === "LEAD"
766
+ );
767
+ Se.useEffect(() => {
768
+ var I;
769
+ o(
770
+ ((I = e.leads) == null ? void 0 : I.position) === "before" && e.poll.authRequirement === "LEAD" || !1
771
+ );
772
+ }, [(_ = e.leads) == null ? void 0 : _.position, e.poll.authRequirement]);
773
+ const { optionsLayout: i } = we(Re), s = pe(), r = xe(), a = J(), c = $e(), g = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : a ? Ee : Ue, m = Ve(
774
+ {
775
+ images: e.poll.images,
776
+ imagePlaceholder: g
777
+ },
778
+ $.SPLIT
779
+ ), b = Oe(e.options), { t: f } = z(), u = ((Z = e.poll.branding) == null ? void 0 : Z.colors) || null, x = a ? ((ne = e.poll.branding) == null ? void 0 : ne.images.mobileLogo) || ((le = e.poll.branding) == null ? void 0 : le.images.mainLogo) || "" : ((ie = e.poll.branding) == null ? void 0 : ie.images.mainLogo) || "", C = Qe(e.poll.embedCode), L = !l && !!e.poll.embedCode, T = ((X = e.leads) == null ? void 0 : X.position) === "after" ? f("poll.buttons.continue") : f("poll.buttons.vote"), p = (u == null ? void 0 : u.backgroundColor) || r.surfaceVariant, y = (u == null ? void 0 : u.primaryColor) || ((se = (ee = r.palette) == null ? void 0 : ee.primary) == null ? void 0 : se.plainColor), S = r.textColor, E = Ze(p || ""), q = {
780
+ "--fu-ucrc-pv-split-bg": `rgba(${E ? E.replace(/[^\d,]/g, "") : ""}, 0.5)`
781
+ }, H = () => {
782
+ o(!1);
783
+ }, w = (I, U) => {
784
+ var V, O, j, D, K;
785
+ return /* @__PURE__ */ t(
786
+ W,
787
+ {
788
+ brandingLogo: x,
789
+ textColor: I,
790
+ label: ((V = e.poll.labels) == null ? void 0 : V.sponsor) || null,
791
+ primaryUrl: (j = (O = e.poll.branding) == null ? void 0 : O.urls) == null ? void 0 : j.primaryUrl,
792
+ secondaryUrl: (K = (D = e.poll.branding) == null ? void 0 : D.urls) == null ? void 0 : K.secondaryUrl,
793
+ isCentered: U || !1
794
+ }
795
+ );
796
+ }, d = e.signInRequired ? /* @__PURE__ */ t(ht, { signInCTA: e.signInCTA, primaryColor: y }) : /* @__PURE__ */ t(
797
+ on,
798
+ {
799
+ selectedOptions: e.selectedOptions,
800
+ label: T,
801
+ buttonColor: y,
802
+ onClick: e.voteForPoll,
803
+ isVoting: e.isVoting
804
+ }
805
+ ), me = () => {
806
+ var I;
807
+ return /* @__PURE__ */ t("div", { css: R.mainContent, children: /* @__PURE__ */ t(
808
+ Fe,
809
+ {
810
+ consents: e.consents,
811
+ primaryColor: y,
812
+ textColor: S,
813
+ brandingUrls: (I = e.poll.branding) == null ? void 0 : I.urls,
814
+ onSubmit: e.startVoting,
815
+ isSubmitting: e.isSubmitting,
816
+ ctaLabel: f("poll.buttons.start"),
817
+ align: "center"
818
+ }
819
+ ) });
820
+ }, P = () => {
821
+ var I, U, V, O, j, D, K, de, oe, ae, Pe;
822
+ return /* @__PURE__ */ h(De, { children: [
823
+ /* @__PURE__ */ t("div", { css: R.leadContent, children: /* @__PURE__ */ t(
824
+ Be,
825
+ {
826
+ sdk: e.sdk,
827
+ startGame: H,
828
+ contentId: e.poll.id,
829
+ contentName: e.poll.title,
830
+ brandingColors: (I = e.poll.branding) == null ? void 0 : I.colors,
831
+ brandingUrls: (U = e.poll.branding) == null ? void 0 : U.urls,
832
+ campaignId: (V = e.leads) == null ? void 0 : V.campaignId,
833
+ campaignName: (O = e.leads) == null ? void 0 : O.campaignName,
834
+ fields: (j = e.leads) == null ? void 0 : j.fields,
835
+ leadTitle: (D = e.poll.labels) == null ? void 0 : D.leadTitle,
836
+ leadDescription: (K = e.poll.labels) == null ? void 0 : K.leadDescription,
837
+ leadCta: (de = e.poll.labels) == null ? void 0 : de.leadCta,
838
+ leadSuccessTitle: (oe = e.poll.labels) == null ? void 0 : oe.leadSuccessTitle,
839
+ leadSuccessDescription: (ae = e.poll.labels) == null ? void 0 : ae.leadSuccessDescription,
840
+ syncWithProfile: (Pe = e.leads) == null ? void 0 : Pe.syncWithProfile,
841
+ consents: e.leadConsents
842
+ }
843
+ ) }),
844
+ x ? /* @__PURE__ */ t("div", { css: c ? R.block : R.hidden, children: w(S) }) : null
845
+ ] });
846
+ }, ce = () => /* @__PURE__ */ h("div", { css: R.mainContent, children: [
847
+ e.poll.alternativeTitle ? /* @__PURE__ */ t("div", { css: R.alternativeTitleSection, children: /* @__PURE__ */ t("p", { css: R.alternativeTitle, children: e.poll.alternativeTitle }) }) : null,
848
+ /* @__PURE__ */ t(
849
+ vt,
850
+ {
851
+ options: e.options || [],
852
+ answerPoll: e.answerPoll,
853
+ selectedOptions: e.selectedOptions,
854
+ optionsLayout: c ? "column" : i ?? "twoByTwo",
855
+ brandingColors: u,
856
+ optionsImages: b,
857
+ multipleChoice: e.poll.multipleChoice,
858
+ maxChoices: e.optionChoices,
859
+ isVoting: e.isVoting,
860
+ disabled: e.signInRequired
861
+ }
862
+ ),
863
+ L ? /* @__PURE__ */ h(
864
+ "div",
865
+ {
866
+ css: c ? x ? R.embedFooter.stackedLogo : R.embedFooter.stacked : x ? R.embedFooter.sideLogo : R.embedFooter.side,
867
+ children: [
868
+ w((u == null ? void 0 : u.contentColor) || S),
869
+ d
870
+ ]
871
+ }
872
+ ) : /* @__PURE__ */ h("div", { css: R.buttonFooter, children: [
873
+ d,
874
+ x && !c ? /* @__PURE__ */ t("div", { css: R.presentedByMobile, children: w((u == null ? void 0 : u.contentColor) || S) }) : null
875
+ ] })
876
+ ] });
877
+ return /* @__PURE__ */ h(Q, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, state: "play", children: [
878
+ /* @__PURE__ */ t(
879
+ Ln,
880
+ {
881
+ entity: { ...e.poll, type: "poll" },
882
+ headline: f("poll.headline"),
883
+ finalImage: m,
884
+ rulesDisplay: e.rulesDisplay,
885
+ embedCodeContainerRef: C,
886
+ hasEmbedCode: L,
887
+ brandingLogo: x,
888
+ renderPresentedBy: w,
889
+ children: /* @__PURE__ */ t("div", { css: R.questionArea, style: q, children: /* @__PURE__ */ h("div", { css: R.questionAreaContent, children: [
890
+ L && /* @__PURE__ */ t("div", { css: R.embedHeadline, children: /* @__PURE__ */ h("div", { children: [
891
+ /* @__PURE__ */ t("p", { css: R.headlineText, children: f("poll.headline") }),
892
+ /* @__PURE__ */ h("div", { css: R.texts, children: [
893
+ /* @__PURE__ */ t("p", { css: R.titleText, children: e.poll.title }),
894
+ /* @__PURE__ */ t("p", { css: R.descriptionText, children: gn(e.poll.description) })
895
+ ] })
896
+ ] }) }),
897
+ e.applyConsentGate ? me() : l ? P() : ce()
898
+ ] }) })
899
+ }
900
+ ),
901
+ x && c && /* @__PURE__ */ t("div", { css: R.presentedByBottom, children: w((u == null ? void 0 : u.contentColor) || s.colorSchemes.dark.textColor, !0) })
902
+ ] });
903
+ }, xt = "var(--fu-ucrc-pv-option-text)", jt = {
904
+ borderRadius: "var(--fu-ucrc-radius-sm)",
905
+ flex: 1,
906
+ padding: "var(--fu-ucrc-space-xs)",
907
+ backgroundColor: "#FFFFFF",
908
+ display: "flex",
909
+ flexDirection: "column",
910
+ position: "relative",
911
+ overflow: "hidden",
912
+ justifyContent: "center"
913
+ }, qt = {
914
+ margin: 0,
915
+ fontFamily: "var(--fu-ucrc-font-primary)",
916
+ fontWeight: 500,
917
+ fontSize: "0.935em",
918
+ letterSpacing: "0.46px",
919
+ textAlign: "center",
920
+ color: xt
921
+ }, ut = {
922
+ margin: 0,
923
+ fontSize: "0.7em",
924
+ fontWeight: 500,
925
+ color: xt,
926
+ fontFamily: "var(--fu-ucrc-font-secondary)",
927
+ whiteSpace: "nowrap"
928
+ }, G = {
929
+ card: n(jt),
930
+ cardSelected: n(jt, { backgroundColor: "var(--fu-ucrc-pv-primary)" }),
931
+ // Starts empty and grows to the share once mounted.
932
+ bar: n({
933
+ position: "absolute",
934
+ top: 0,
935
+ left: 0,
936
+ height: "100%",
937
+ width: "var(--fu-ucrc-pv-share)",
938
+ backgroundColor: "var(--fu-ucrc-pv-bar)",
939
+ transition: "width 0.8s ease-out",
940
+ zIndex: 0
941
+ }),
942
+ media: n({
943
+ borderRadius: "var(--fu-ucrc-radius-xs)",
944
+ overflow: "hidden",
945
+ flexGrow: 1,
946
+ marginBottom: "var(--fu-ucrc-space-2xs)"
947
+ }),
948
+ img: n({ width: "100%", height: "100%", objectFit: "cover" }),
949
+ mediaVotes: n({
950
+ display: "flex",
951
+ alignItems: "center",
952
+ justifyContent: "center",
953
+ gap: "var(--fu-ucrc-space-2xs)",
954
+ marginBlock: "var(--fu-ucrc-space-2xs)"
955
+ }),
956
+ mediaCount: n({ ...ut, lineHeight: 1 }),
957
+ mediaTitle: n({ ...qt, lineHeight: "24px", paddingInline: "var(--fu-ucrc-space-2xs)" }),
958
+ row: n({ position: "relative", zIndex: 1, display: "flex", gap: "var(--fu-ucrc-space-xs)" }),
959
+ votes: n({
960
+ display: "flex",
961
+ flexDirection: "column",
962
+ justifyContent: "center",
963
+ gap: "var(--fu-ucrc-space-2xs)",
964
+ flexShrink: 0,
965
+ minWidth: "fit-content"
966
+ }),
967
+ votesTop: n({ display: "flex", alignItems: "center", gap: "var(--fu-ucrc-space-2xs)" }),
968
+ count: n({ ...ut, lineHeight: 0 }),
969
+ percentage: n({ ...ut, fontSize: "0.65em", fontWeight: 400, lineHeight: 1, textAlign: "center" }),
970
+ text: n({ display: "flex", alignItems: "center", flex: 1, minWidth: 0, gap: "var(--fu-ucrc-space-xs)" }),
971
+ title: n({
972
+ ...qt,
973
+ lineHeight: "16px",
974
+ flex: 1,
975
+ minWidth: 0,
976
+ wordBreak: "break-word",
977
+ hyphens: "auto"
978
+ })
979
+ }, Gn = (e) => {
980
+ var u;
981
+ const l = Nt(), o = pe(), i = xe(), [s, r] = B(0), a = e.optionsImages.get(e.option.id), c = e.selectedOptions.includes(e.option.id), g = e.option.votes, m = e.totalVotes > 0 ? g / e.totalVotes * 100 : 0;
982
+ Ce(() => {
983
+ const x = setTimeout(() => r(m), 100);
984
+ return () => clearTimeout(x);
985
+ }, [m]);
986
+ const b = {
987
+ "--fu-ucrc-pv-primary": ((u = e.brandingColors) == null ? void 0 : u.primaryColor) || i.palette.primary.plainColor,
988
+ // The card is always white, so unselected text keeps the light scheme's colour.
989
+ "--fu-ucrc-pv-option-text": c ? i.palette.primary.onPrimary : o.colorSchemes.light.textColor,
990
+ "--fu-ucrc-pv-bar": c ? i.palette.primary.primaryContainer : o.mode === "light" ? "rgba(0, 0, 0, 0.1)" : "rgba(0, 0, 0, 0.2)",
991
+ "--fu-ucrc-pv-share": `${s}%`
992
+ }, f = /* @__PURE__ */ t(en, { size: "12px", color: xt });
993
+ return /* @__PURE__ */ h("div", { css: c ? G.cardSelected : G.card, style: b, children: [
994
+ /* @__PURE__ */ t("div", { css: G.bar }),
995
+ a ? /* @__PURE__ */ h(De, { children: [
996
+ /* @__PURE__ */ t("div", { css: G.media, children: /* @__PURE__ */ t(ft, { ratio: "16/9", radius: "var(--fu-ucrc-radius-xs)", children: /* @__PURE__ */ t("img", { src: a, alt: "Option illustration", css: G.img }) }) }),
997
+ /* @__PURE__ */ h("div", { css: G.mediaVotes, children: [
998
+ f,
999
+ /* @__PURE__ */ h("p", { css: G.mediaCount, children: [
1000
+ g.toLocaleString(l),
1001
+ " (",
1002
+ m.toFixed(1),
1003
+ "%)"
1004
+ ] })
1005
+ ] }),
1006
+ /* @__PURE__ */ t("p", { css: G.mediaTitle, children: e.option.title })
1007
+ ] }) : /* @__PURE__ */ h("div", { css: G.row, children: [
1008
+ /* @__PURE__ */ h("div", { css: G.votes, children: [
1009
+ /* @__PURE__ */ h("div", { css: G.votesTop, children: [
1010
+ f,
1011
+ /* @__PURE__ */ t("p", { css: G.count, children: g.toLocaleString(l) })
1012
+ ] }),
1013
+ /* @__PURE__ */ h("p", { css: G.percentage, children: [
1014
+ "(",
1015
+ m.toFixed(1),
1016
+ "%)"
1017
+ ] })
1018
+ ] }),
1019
+ /* @__PURE__ */ t("div", { css: G.text, children: /* @__PURE__ */ t("p", { css: G.title, children: e.option.title }) })
1020
+ ] })
1021
+ ] });
1022
+ }, gt = {
1023
+ root: n({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-md)" }),
1024
+ footer: n({
1025
+ display: "flex",
1026
+ alignItems: "center",
1027
+ justifyContent: "center",
1028
+ gap: "var(--fu-ucrc-space-xs)",
1029
+ paddingTop: "var(--fu-ucrc-space-md)",
1030
+ borderTop: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-outline-enabled-border)"
1031
+ }),
1032
+ total: n({
1033
+ margin: 0,
1034
+ lineHeight: 1.5,
1035
+ color: "var(--fu-ucrc-text-color)",
1036
+ fontWeight: 500,
1037
+ fontFamily: "var(--fu-ucrc-font-secondary)",
1038
+ fontSize: "0.875em"
1039
+ })
1040
+ }, Ct = (e) => {
1041
+ const { t: l } = z(), o = Nt(), i = et("md"), s = e.options.reduce((c, g) => c + (g.votes || 0), 0), r = (c) => /* @__PURE__ */ t(
1042
+ Gn,
1043
+ {
1044
+ option: c,
1045
+ optionsImages: e.optionsImages,
1046
+ selectedOptions: e.selectedOptions,
1047
+ brandingColors: e.brandingColors,
1048
+ totalVotes: s
1049
+ },
1050
+ c.id
1051
+ ), a = e.optionsLayout === "twoByTwo" ? /* @__PURE__ */ t("div", { css: te.list, children: nn(e.options).map((c, g) => /* @__PURE__ */ t("div", { css: i ? te.row : te.column, children: c.map(r) }, `row-${g}`)) }) : e.optionsLayout === "column" ? /* @__PURE__ */ t("div", { css: te.list, children: e.options.map(r) }) : /* @__PURE__ */ t("div", { css: i ? te.wrapRow : te.wrapColumn, children: e.options.map(r) });
1052
+ return /* @__PURE__ */ h("div", { css: gt.root, children: [
1053
+ a,
1054
+ /* @__PURE__ */ h("div", { css: gt.footer, children: [
1055
+ /* @__PURE__ */ t(en, { size: "1.2em", color: "var(--fu-ucrc-text-color)" }),
1056
+ /* @__PURE__ */ h("p", { css: gt.total, children: [
1057
+ s.toLocaleString(o),
1058
+ " ",
1059
+ l("poll.totalVotes")
1060
+ ] })
1061
+ ] })
1062
+ ] });
1063
+ }, ge = (e) => `var(--fu-ucrc-space-${e})`, Ke = { display: "flex", alignItems: "center", gap: ge("lg") }, F = {
1064
+ area: n({ display: "flex", flexDirection: "column", paddingInline: ge("md") }),
1065
+ question: n({ display: "flex", flexDirection: "column", gap: ge("md") }),
1066
+ questionMobile: n({ display: "flex", flexDirection: "column", gap: ge("lg") }),
1067
+ content: n({
1068
+ borderRadius: "var(--fu-ucrc-radius-md)",
1069
+ paddingInline: ge("md"),
1070
+ paddingTop: ge("md"),
1071
+ paddingBottom: ge("lg"),
1072
+ gap: ge("md"),
1073
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
1074
+ display: "flex",
1075
+ flexDirection: "column",
1076
+ backdropFilter: "blur(4px)"
1077
+ }),
1078
+ titleRow: n({ gap: "8px", display: "flex", justifyContent: "center" }),
1079
+ title: n({
1080
+ ...We,
1081
+ fontFamily: "var(--fu-ucrc-font-primary)",
1082
+ lineHeight: "150%",
1083
+ letterSpacing: "0.15px",
1084
+ fontWeight: 500,
1085
+ fontSize: "1.25em",
1086
+ textAlign: "center",
1087
+ color: "var(--fu-ucrc-pv-text)"
1088
+ }),
1089
+ footer: n({ ...Ke, justifyContent: "space-between" }),
1090
+ footerEnd: n({ ...Ke, justifyContent: "flex-end" }),
1091
+ footerMobile: n({ ...Ke, flexDirection: "column", justifyContent: "space-between" }),
1092
+ footerMobileEnd: n({ ...Ke, flexDirection: "column", justifyContent: "flex-end" }),
1093
+ block: n({ display: "block" }),
1094
+ hidden: n({ display: "none" }),
1095
+ actions: n({ display: "flex", gap: "16px" }),
1096
+ additionalCta: n(Ie, {
1097
+ display: "flex",
1098
+ paddingBlock: ge("xs"),
1099
+ paddingInline: ge("md"),
1100
+ flexDirection: "column",
1101
+ justifyContent: "center",
1102
+ alignItems: "center",
1103
+ gap: "8px",
1104
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1105
+ border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-secondary-container)",
1106
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1107
+ // Joy's solidColor (common.white) is not in the theme snapshot.
1108
+ color: "var(--fu-ucrc-primary-solid-color, #fff)",
1109
+ fontSize: "0.8125em",
1110
+ "&:hover": { backgroundColor: "var(--fu-ucrc-secondary-container)", opacity: 0.9 },
1111
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1112
+ "& p": {
1113
+ ...We,
1114
+ color: "var(--fu-ucrc-text-secondary)",
1115
+ fontFamily: "var(--fu-ucrc-font-primary)",
1116
+ fontSize: "0.8125em",
1117
+ fontStyle: "normal",
1118
+ fontWeight: 500,
1119
+ lineHeight: "22px",
1120
+ letterSpacing: "0.46px",
1121
+ textTransform: "uppercase"
1122
+ }
1123
+ })
1124
+ }, Nn = (e) => {
1125
+ var C, L, T, p, y;
1126
+ const l = Ve(
1127
+ {
1128
+ images: e.poll.images,
1129
+ imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
1130
+ },
1131
+ $.STANDARD
1132
+ ), { optionsLayout: o } = we(Re), { t: i } = z(), s = xe(), r = ((C = e.poll.branding) == null ? void 0 : C.colors) || null, a = J(), c = a ? ((L = e.poll.branding) == null ? void 0 : L.images.mobileLogo) || ((T = e.poll.branding) == null ? void 0 : T.images.mainLogo) || "" : ((p = e.poll.branding) == null ? void 0 : p.images.mainLogo) || "", g = e.imagePosition || "left", m = Oe(e.poll.options), b = (r == null ? void 0 : r.contentColor) || s.textColor, f = {
1133
+ "--fu-ucrc-pv-text": b,
1134
+ "--fu-ucrc-pv-content-bg": `rgba(${Ze(s.surfaceVariant)}, 0.5)`
1135
+ }, u = /* @__PURE__ */ t(W, { brandingLogo: c, textColor: b, label: ((y = e.poll.labels) == null ? void 0 : y.sponsor) || null }), x = () => {
1136
+ var S, E;
1137
+ return /* @__PURE__ */ h(De, { children: [
1138
+ /* @__PURE__ */ t("div", { css: F.area, style: f, children: /* @__PURE__ */ t("div", { css: a ? F.questionMobile : F.question, children: /* @__PURE__ */ h("div", { css: F.content, children: [
1139
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: F.titleRow, children: /* @__PURE__ */ t("p", { css: F.title, children: e.poll.alternativeTitle }) }),
1140
+ /* @__PURE__ */ t(
1141
+ Ct,
1142
+ {
1143
+ options: e.poll.options,
1144
+ selectedOptions: ((S = e.userVote) == null ? void 0 : S.optionIds) || [],
1145
+ optionsLayout: o ?? "twoByTwo",
1146
+ optionsImages: m,
1147
+ brandingColors: ((E = e.poll.branding) == null ? void 0 : E.colors) || null
1148
+ }
1149
+ )
1150
+ ] }) }) }),
1151
+ e.chanceGameContent && /* @__PURE__ */ t("div", { css: F.area, children: e.chanceGameContent }),
1152
+ /* @__PURE__ */ t("div", { css: F.area, children: /* @__PURE__ */ h("div", { css: a ? F.questionMobile : F.question, children: [
1153
+ /* @__PURE__ */ h("div", { css: a ? c ? F.footerMobile : F.footerMobileEnd : c ? F.footer : F.footerEnd, children: [
1154
+ c && /* @__PURE__ */ t("div", { css: a ? F.hidden : F.block, children: u }),
1155
+ /* @__PURE__ */ h("div", { css: F.actions, children: [
1156
+ /* @__PURE__ */ t(yt, { additionalCTA: e.additionalCTA, css: F.additionalCta }),
1157
+ !e.maxAttemptsReached && /* @__PURE__ */ t(Dn, { label: i("poll.buttons.voteAgain"), onClick: e.voteAgain })
1158
+ ] })
1159
+ ] }),
1160
+ c && /* @__PURE__ */ t("div", { css: a ? F.block : F.hidden, children: u })
1161
+ ] }) })
1162
+ ] });
1163
+ };
1164
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: (r == null ? void 0 : r.borderColor) || null, children: /* @__PURE__ */ t(
1165
+ Tn,
1166
+ {
1167
+ entity: e.poll,
1168
+ headline: i("poll.headline"),
1169
+ finalImage: l,
1170
+ imagePosition: g,
1171
+ rulesDisplay: e.rulesDisplay,
1172
+ children: e.isUnauthorized ? /* @__PURE__ */ h(De, { children: [
1173
+ /* @__PURE__ */ t(
1174
+ bt,
1175
+ {
1176
+ variant: "error",
1177
+ title: i("common.authentication.accessRequired"),
1178
+ message: i("common.authentication.invalidOrMissingAuth")
1179
+ }
1180
+ ),
1181
+ c && u
1182
+ ] }) : x()
1183
+ }
1184
+ ) });
1185
+ }, he = (e) => `var(--fu-ucrc-space-${e})`, mt = "var(--fu-ucrc-text-primary)", N = {
1186
+ questionAreaContent: n({
1187
+ padding: he("lg"),
1188
+ display: "flex",
1189
+ flexDirection: "column",
1190
+ justifyContent: "center",
1191
+ gap: he("lg"),
1192
+ flex: 1,
1193
+ height: "100%"
1194
+ }),
1195
+ // Translucent panel, from the branding background: `--fu-ucrc-pv-split-bg` on the parent.
1196
+ panel: n({
1197
+ padding: he("lg"),
1198
+ gap: he("lg"),
1199
+ display: "flex",
1200
+ flexDirection: "column",
1201
+ backdropFilter: "blur(4px)",
1202
+ backgroundColor: "var(--fu-ucrc-pv-split-bg)",
1203
+ borderRadius: "var(--fu-ucrc-radius-sm)"
1204
+ }),
1205
+ alternativeTitleSection: n({ gap: "8px", display: "flex", justifyContent: "center" }),
1206
+ alternativeTitle: n({
1207
+ margin: 0,
1208
+ fontFamily: "var(--fu-ucrc-font-primary)",
1209
+ lineHeight: "150%",
1210
+ letterSpacing: "0.15px",
1211
+ fontWeight: 500,
1212
+ fontSize: "1.25em",
1213
+ textAlign: "center",
1214
+ color: "var(--fu-ucrc-text-color)"
1215
+ }),
1216
+ ctaContainer: n({ display: "flex", flexDirection: "column", alignItems: "center" }),
1217
+ ctaContent: n({
1218
+ display: "flex",
1219
+ flexDirection: "column",
1220
+ justifyContent: "center",
1221
+ alignItems: "center",
1222
+ gap: he("lg")
1223
+ }),
1224
+ buttons: n({ display: "flex", flexDirection: "column", gap: "16px" }),
1225
+ playAgain: n(Ie, {
1226
+ display: "flex",
1227
+ paddingBlock: he("xs"),
1228
+ paddingInline: "16px",
1229
+ flexDirection: "column",
1230
+ justifyContent: "center",
1231
+ alignItems: "center",
1232
+ gap: "8px",
1233
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1234
+ color: mt,
1235
+ backgroundColor: "var(--fu-ucrc-surface)",
1236
+ fontSize: "0.9375em",
1237
+ "&:hover": { backgroundColor: "var(--fu-ucrc-on-surface)" }
1238
+ }),
1239
+ playAgainContent: n({
1240
+ display: "flex",
1241
+ justifyContent: "center",
1242
+ alignItems: "center",
1243
+ gap: "8px",
1244
+ alignSelf: "stretch"
1245
+ }),
1246
+ playAgainLabel: n({
1247
+ margin: 0,
1248
+ color: mt,
1249
+ textAlign: "center",
1250
+ fontFamily: "var(--fu-ucrc-font-primary)",
1251
+ fontSize: "0.9375em",
1252
+ fontStyle: "normal",
1253
+ fontWeight: 500,
1254
+ lineHeight: "22px",
1255
+ letterSpacing: "0.46px",
1256
+ textTransform: "uppercase"
1257
+ }),
1258
+ alertArea: {
1259
+ side: n({
1260
+ flex: "0 0 50%",
1261
+ width: "50%",
1262
+ minWidth: "50%",
1263
+ maxWidth: "50%",
1264
+ display: "flex",
1265
+ flexDirection: "column",
1266
+ justifyContent: "center"
1267
+ }),
1268
+ stacked: n({
1269
+ flex: "1",
1270
+ width: "100%",
1271
+ minWidth: "100%",
1272
+ maxWidth: "100%",
1273
+ display: "flex",
1274
+ flexDirection: "column",
1275
+ justifyContent: "center"
1276
+ })
1277
+ },
1278
+ alertWrapper: n({ padding: he("lg") }),
1279
+ // Joy's solid Button restyled by sx; the label colour is the branding secondary (`--fu-ucrc-pv-split-secondary`).
1280
+ additionalCta: n(Ie, {
1281
+ display: "flex",
1282
+ paddingBlock: he("xs"),
1283
+ paddingInline: he("md"),
1284
+ flexDirection: "column",
1285
+ justifyContent: "center",
1286
+ alignItems: "center",
1287
+ gap: "8px",
1288
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1289
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1290
+ // Joy solid colour (common.white); no theme var carries it.
1291
+ color: "#fff",
1292
+ fontSize: "0.9375em",
1293
+ "&:hover": { backgroundColor: "var(--fu-ucrc-secondary-container)", opacity: 0.9 },
1294
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1295
+ "& p": {
1296
+ margin: 0,
1297
+ color: "var(--fu-ucrc-pv-split-secondary)",
1298
+ textAlign: "center",
1299
+ fontFamily: "var(--fu-ucrc-font-primary)",
1300
+ fontSize: "0.9375em",
1301
+ fontStyle: "normal",
1302
+ fontWeight: 500,
1303
+ lineHeight: "22px",
1304
+ letterSpacing: "0.46px",
1305
+ textTransform: "uppercase"
1306
+ }
1307
+ })
1308
+ }, Yn = {
1309
+ display: "flex",
1310
+ width: "16px",
1311
+ height: "16px",
1312
+ justifyContent: "flex-end",
1313
+ alignItems: "center",
1314
+ color: mt
1315
+ }, Xn = (e) => {
1316
+ var p, y, S, E, q, H, w, d;
1317
+ const l = pe(), o = xe(), i = J(), s = mn(), r = $e(), a = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : i ? Ee : Ue, c = Ve(
1318
+ {
1319
+ images: e.poll.images,
1320
+ imagePlaceholder: a
1321
+ },
1322
+ $.SPLIT
1323
+ ), g = Oe(e.poll.options), { t: m } = z(), { optionsLayout: b } = we(Re), f = ((p = e.poll.branding) == null ? void 0 : p.colors) || null, u = (f == null ? void 0 : f.backgroundColor) || o.surfaceVariant, x = o.textColor, C = i ? ((y = e.poll.branding) == null ? void 0 : y.images.mobileLogo) || ((S = e.poll.branding) == null ? void 0 : S.images.mainLogo) || "" : ((E = e.poll.branding) == null ? void 0 : E.images.mainLogo) || "", L = {
1324
+ "--fu-ucrc-pv-split-bg": `rgba(${u ? Ze(u || "").replace(/[^\d,]/g, "") : ""}, 0.5)`,
1325
+ "--fu-ucrc-pv-split-secondary": (f == null ? void 0 : f.secondaryColor) || o.textSecondary
1326
+ }, T = s ? /* @__PURE__ */ t(
1327
+ W,
1328
+ {
1329
+ brandingLogo: C,
1330
+ textColor: (f == null ? void 0 : f.contentColor) || l.colorSchemes.dark.textColor,
1331
+ label: ((q = e.poll.labels) == null ? void 0 : q.sponsor) || null
1332
+ }
1333
+ ) : null;
1334
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: (f == null ? void 0 : f.borderColor) || null, children: /* @__PURE__ */ t(
1335
+ wn,
1336
+ {
1337
+ entity: e.poll,
1338
+ headline: m("poll.headline"),
1339
+ finalImage: c,
1340
+ brandingContent: T,
1341
+ rulesDisplay: e.rulesDisplay,
1342
+ children: e.isUnauthorized ? /* @__PURE__ */ t("div", { css: r ? N.alertArea.stacked : N.alertArea.side, children: /* @__PURE__ */ t("div", { css: N.alertWrapper, children: /* @__PURE__ */ t(
1343
+ bt,
1344
+ {
1345
+ variant: "error",
1346
+ title: m("common.authentication.accessRequired"),
1347
+ message: m("common.authentication.invalidOrMissingAuth")
1348
+ }
1349
+ ) }) }) : /* @__PURE__ */ h("div", { css: N.questionAreaContent, style: L, children: [
1350
+ /* @__PURE__ */ h("div", { css: N.panel, children: [
1351
+ e.poll.alternativeTitle ? /* @__PURE__ */ t("div", { css: N.alternativeTitleSection, children: /* @__PURE__ */ t("p", { css: N.alternativeTitle, children: e.poll.alternativeTitle }) }) : null,
1352
+ /* @__PURE__ */ t(
1353
+ Ct,
1354
+ {
1355
+ options: e.poll.options,
1356
+ selectedOptions: ((H = e.userVote) == null ? void 0 : H.optionIds) || [],
1357
+ optionsLayout: b ?? "twoByTwo",
1358
+ optionsImages: g,
1359
+ brandingColors: ((w = e.poll.branding) == null ? void 0 : w.colors) || null
1360
+ }
1361
+ )
1362
+ ] }),
1363
+ !e.maxAttemptsReached || e.additionalCTA !== void 0 ? /* @__PURE__ */ t("div", { id: "poll-desktop-thanks", css: N.panel, children: /* @__PURE__ */ t("div", { css: N.ctaContainer, children: /* @__PURE__ */ t("div", { css: N.ctaContent, children: /* @__PURE__ */ h("div", { css: N.buttons, children: [
1364
+ !e.maxAttemptsReached && /* @__PURE__ */ t("button", { type: "button", css: N.playAgain, onClick: e.voteAgain, children: /* @__PURE__ */ h("div", { css: N.playAgainContent, children: [
1365
+ /* @__PURE__ */ t(tn, { style: Yn }),
1366
+ /* @__PURE__ */ t("p", { css: N.playAgainLabel, children: m("poll.buttons.voteAgain") })
1367
+ ] }) }),
1368
+ /* @__PURE__ */ t(yt, { additionalCTA: e.additionalCTA, css: N.additionalCta })
1369
+ ] }) }) }) }) : null,
1370
+ e.chanceGameContent,
1371
+ r && C && /* @__PURE__ */ t(
1372
+ W,
1373
+ {
1374
+ brandingLogo: C,
1375
+ textColor: (f == null ? void 0 : f.contentColor) || x,
1376
+ label: ((d = e.poll.labels) == null ? void 0 : d.sponsor) || null,
1377
+ isCentered: !0
1378
+ }
1379
+ )
1380
+ ] })
1381
+ }
1382
+ ) });
1383
+ }, qe = (e) => `var(--fu-ucrc-space-${e})`, Wt = {
1384
+ ...ve.backdrop,
1385
+ borderRadius: "var(--fu-ucrc-pv-radius-md)",
1386
+ alignItems: "center",
1387
+ alignSelf: "stretch",
1388
+ "&::before": { ...ve.backdrop["&::before"], opacity: 0.25, backdropFilter: "blur(4px)" }
1389
+ }, $t = {
1390
+ margin: 0,
1391
+ fontFamily: "var(--fu-ucrc-pv-font-primary)",
1392
+ fontSize: "0.9375em",
1393
+ fontStyle: "normal",
1394
+ fontWeight: 500,
1395
+ lineHeight: "24px",
1396
+ letterSpacing: "0.46px",
1397
+ textTransform: "uppercase"
1398
+ }, Ht = "var(--fu-ucrc-primary-solid-color, #fff)", ue = {
1399
+ main: n({ display: "flex", flexDirection: "column", gap: "24px", zIndex: 10 }),
1400
+ results: n(Wt, { padding: qe("md") }),
1401
+ resultsInner: n({
1402
+ display: "flex",
1403
+ flexDirection: "column",
1404
+ justifyContent: "center",
1405
+ alignItems: "center",
1406
+ alignSelf: "stretch"
1407
+ }),
1408
+ full: n({ width: "100%" }),
1409
+ cta: n(Wt, { paddingBlock: qe("md") }),
1410
+ buttons: n({ display: "flex", flexDirection: "column", gap: qe("md") }),
1411
+ voteAgain: n(Ie, {
1412
+ display: "flex",
1413
+ minHeight: "48px",
1414
+ paddingTop: "12px",
1415
+ paddingBottom: "12px",
1416
+ paddingRight: "24px",
1417
+ paddingLeft: "16px",
1418
+ flexDirection: "column",
1419
+ justifyContent: "center",
1420
+ alignItems: "center",
1421
+ gap: "8px",
1422
+ borderRadius: "var(--fu-ucrc-pv-radius-xl)",
1423
+ backgroundColor: "var(--fu-ucrc-on-surface)",
1424
+ color: Ht,
1425
+ fontSize: "0.9375em",
1426
+ "&:hover": { backgroundColor: "var(--fu-ucrc-surface-variant)" }
1427
+ }),
1428
+ voteAgainContent: n({ display: "flex", justifyContent: "center", alignItems: "center", gap: "8px", alignSelf: "stretch" }),
1429
+ voteAgainLabel: n($t, { color: "var(--fu-ucrc-text-primary)", textAlign: "center" }),
1430
+ additionalCta: n(Ie, {
1431
+ display: "flex",
1432
+ paddingBlock: qe("sm"),
1433
+ paddingInline: qe("md"),
1434
+ flexDirection: "column",
1435
+ justifyContent: "center",
1436
+ alignItems: "center",
1437
+ gap: "8px",
1438
+ borderRadius: "var(--fu-ucrc-pv-radius-xl)",
1439
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1440
+ color: Ht,
1441
+ fontSize: "0.9375em",
1442
+ "&:hover": { opacity: 0.9 },
1443
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1444
+ "& p": { ...$t, color: "var(--fu-ucrc-pv-secondary)" }
1445
+ })
1446
+ }, _n = {
1447
+ display: "flex",
1448
+ width: "24px",
1449
+ height: "24px",
1450
+ justifyContent: "center",
1451
+ alignItems: "center",
1452
+ color: "var(--fu-ucrc-text-primary)"
1453
+ }, Kn = (e) => {
1454
+ var T, p, y;
1455
+ const l = pe(), { t: o } = z(), i = $e(), s = J(), r = fn($.OVERLAY), { optionsLayout: a } = we(Re), { brandingImage: c, brandingColors: g, brandingLogo: m } = Je(e.poll.branding), b = e.defaultImagePlaceholderUrl || (s ? Ee : Ue), f = Ve({ images: e.poll.images, imagePlaceholder: b }, $.OVERLAY), u = hn(c || f), x = Oe(e.poll.options), C = l.colorSchemes.dark, L = {
1456
+ "--fu-ucrc-pv-content-bg": (g == null ? void 0 : g.backgroundColor) || C.surfaceVariant,
1457
+ "--fu-ucrc-pv-secondary": (g == null ? void 0 : g.secondaryColor) || C.textSecondary,
1458
+ "--fu-ucrc-pv-font-primary": l.customFontFamily.light.primary,
1459
+ "--fu-ucrc-pv-radius-md": l.customRadius.light.md,
1460
+ "--fu-ucrc-pv-radius-xl": l.customRadius.light.xl
1461
+ };
1462
+ return /* @__PURE__ */ t(
1463
+ Rn,
1464
+ {
1465
+ entity: e.poll,
1466
+ headline: o("poll.headline"),
1467
+ backgroundImage: u,
1468
+ imageBackgroundGradient: r,
1469
+ rulesDisplay: e.rulesDisplay,
1470
+ children: /* @__PURE__ */ h("div", { css: ue.main, style: L, children: [
1471
+ e.isUnauthorized ? /* @__PURE__ */ t(
1472
+ bt,
1473
+ {
1474
+ variant: "error",
1475
+ title: o("common.authentication.accessRequired"),
1476
+ message: o("common.authentication.invalidOrMissingAuth")
1477
+ }
1478
+ ) : /* @__PURE__ */ t("div", { css: ue.results, children: /* @__PURE__ */ h("div", { css: ue.resultsInner, children: [
1479
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: ve.titleRow, children: /* @__PURE__ */ t("p", { css: ve.title, children: e.poll.alternativeTitle }) }),
1480
+ /* @__PURE__ */ t("div", { css: ue.full, children: /* @__PURE__ */ t(
1481
+ Ct,
1482
+ {
1483
+ options: e.poll.options,
1484
+ selectedOptions: ((T = e.userVote) == null ? void 0 : T.optionIds) || [],
1485
+ optionsLayout: i ? "column" : a ?? "row",
1486
+ optionsImages: x,
1487
+ brandingColors: ((p = e.poll.branding) == null ? void 0 : p.colors) || null
1488
+ }
1489
+ ) })
1490
+ ] }) }),
1491
+ (!e.maxAttemptsReached || e.additionalCTA !== void 0) && /* @__PURE__ */ t("div", { css: ue.cta, children: /* @__PURE__ */ h("div", { css: ue.buttons, children: [
1492
+ !e.maxAttemptsReached && /* @__PURE__ */ t("button", { type: "button", css: ue.voteAgain, onClick: e.voteAgain, children: /* @__PURE__ */ h("div", { css: ue.voteAgainContent, children: [
1493
+ /* @__PURE__ */ t(tn, { style: _n }),
1494
+ /* @__PURE__ */ t("p", { css: ue.voteAgainLabel, children: o("poll.buttons.voteAgain") })
1495
+ ] }) }),
1496
+ /* @__PURE__ */ t(yt, { additionalCTA: e.additionalCTA, css: ue.additionalCta })
1497
+ ] }) }),
1498
+ e.chanceGameContent,
1499
+ /* @__PURE__ */ t(
1500
+ W,
1501
+ {
1502
+ brandingLogo: m,
1503
+ textColor: C.textColor,
1504
+ label: ((y = e.poll.labels) == null ? void 0 : y.sponsor) || null
1505
+ }
1506
+ )
1507
+ ] })
1508
+ }
1509
+ );
1510
+ }, Qn = () => {
1511
+ const { t: e } = z();
1512
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: null, children: /* @__PURE__ */ t(En, { title: e("poll.pollNotFound"), message: e("poll.pollNotFoundDescription") }) });
1513
+ }, Jn = ({
1514
+ poll: e,
1515
+ template: l,
1516
+ imagePosition: o,
1517
+ defaultImagePlaceholderUrl: i,
1518
+ rulesDisplay: s
1519
+ }) => {
1520
+ var f;
1521
+ const { t: r } = z(), a = J(), c = ((f = e.branding) == null ? void 0 : f.colors) || null, { brandingLogo: g } = Je(
1522
+ e.branding || null
1523
+ ), m = (u) => {
1524
+ var x;
1525
+ return /* @__PURE__ */ t(
1526
+ W,
1527
+ {
1528
+ brandingLogo: g,
1529
+ textColor: u,
1530
+ label: ((x = e.labels) == null ? void 0 : x.sponsor) || null
1531
+ }
1532
+ );
1533
+ }, b = {
1534
+ entity: e,
1535
+ headline: r("poll.headline"),
1536
+ tryAgainButtonText: "",
1537
+ isApiError: !1,
1538
+ alertVariant: "neutral",
1539
+ customAlertTitle: r("poll.gameNotAvailable"),
1540
+ customAlertMessage: r("poll.gameNotAvailableDescription"),
1541
+ renderPresentedBy: m,
1542
+ rulesDisplay: s
1543
+ };
1544
+ return l === $.OVERLAY ? /* @__PURE__ */ t(
1545
+ Xt,
1546
+ {
1547
+ ...b,
1548
+ defaultImagePlaceholderUrl: i || (a ? Ee : Ue)
1549
+ }
1550
+ ) : l === $.SPLIT ? /* @__PURE__ */ t(Q, { brandingBorderColor: (c == null ? void 0 : c.borderColor) || null, children: /* @__PURE__ */ t(
1551
+ _t,
1552
+ {
1553
+ ...b,
1554
+ defaultImagePlaceholderUrl: i
1555
+ }
1556
+ ) }) : /* @__PURE__ */ t(Q, { brandingBorderColor: (c == null ? void 0 : c.borderColor) || null, children: /* @__PURE__ */ t(
1557
+ Kt,
1558
+ {
1559
+ ...b,
1560
+ imagePosition: o || "left",
1561
+ defaultImagePlaceholderUrl: i
1562
+ }
1563
+ ) });
1564
+ }, Zn = (e) => {
1565
+ var s, r, a, c;
1566
+ const l = ((s = e.poll.branding) == null ? void 0 : s.colors) || null, o = J() ? ((r = e.poll.branding) == null ? void 0 : r.images.mobileLogo) || ((a = e.poll.branding) == null ? void 0 : a.images.mainLogo) || "" : ((c = e.poll.branding) == null ? void 0 : c.images.mainLogo) || "", { t: i } = z();
1567
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: /* @__PURE__ */ t(
1568
+ Kt,
1569
+ {
1570
+ entity: e.poll,
1571
+ headline: i("poll.headline"),
1572
+ tryAgainButtonText: i("poll.buttons.tryAgain"),
1573
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1574
+ imagePosition: e.imagePosition || "left",
1575
+ isApiError: e.isApiError,
1576
+ apiErrorMessage: e.apiErrorMessage,
1577
+ toggleTryAgain: e.toggleTryAgain,
1578
+ rulesDisplay: e.rulesDisplay,
1579
+ renderPresentedBy: (g) => {
1580
+ var m;
1581
+ return /* @__PURE__ */ t(
1582
+ W,
1583
+ {
1584
+ brandingLogo: o,
1585
+ textColor: g,
1586
+ label: ((m = e.poll.labels) == null ? void 0 : m.sponsor) || null
1587
+ }
1588
+ );
1589
+ }
1590
+ }
1591
+ ) });
1592
+ }, el = (e) => {
1593
+ var r, a, c, g;
1594
+ const l = J(), { t: o } = z(), i = ((r = e.poll.branding) == null ? void 0 : r.colors) || null, s = l ? ((a = e.poll.branding) == null ? void 0 : a.images.mobileLogo) || ((c = e.poll.branding) == null ? void 0 : c.images.mainLogo) || "" : ((g = e.poll.branding) == null ? void 0 : g.images.mainLogo) || "";
1595
+ return /* @__PURE__ */ t(Q, { brandingBorderColor: (i == null ? void 0 : i.borderColor) || null, children: /* @__PURE__ */ t(
1596
+ _t,
1597
+ {
1598
+ entity: e.poll,
1599
+ headline: o("poll.headline"),
1600
+ tryAgainButtonText: o("poll.buttons.tryAgain"),
1601
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1602
+ isApiError: e.isApiError,
1603
+ apiErrorMessage: e.apiErrorMessage,
1604
+ toggleTryAgain: e.toggleTryAgain,
1605
+ rulesDisplay: e.rulesDisplay,
1606
+ renderPresentedBy: (m) => {
1607
+ var b;
1608
+ return /* @__PURE__ */ t(
1609
+ W,
1610
+ {
1611
+ brandingLogo: s,
1612
+ textColor: m,
1613
+ label: ((b = e.poll.labels) == null ? void 0 : b.sponsor) || null
1614
+ }
1615
+ );
1616
+ }
1617
+ }
1618
+ ) });
1619
+ }, tl = (e) => {
1620
+ const { t: l } = z(), o = J(), i = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : o ? Ee : Ue, { brandingLogo: s } = Je(
1621
+ e.poll.branding || null
1622
+ );
1623
+ return /* @__PURE__ */ t(
1624
+ Xt,
1625
+ {
1626
+ entity: e.poll,
1627
+ headline: l("poll.headline"),
1628
+ tryAgainButtonText: l("poll.buttons.tryAgain"),
1629
+ defaultImagePlaceholderUrl: i,
1630
+ isApiError: e.isApiError,
1631
+ apiErrorMessage: e.apiErrorMessage,
1632
+ toggleTryAgain: e.toggleTryAgain,
1633
+ rulesDisplay: e.rulesDisplay,
1634
+ renderPresentedBy: (r) => {
1635
+ var a;
1636
+ return /* @__PURE__ */ t(
1637
+ W,
1638
+ {
1639
+ brandingLogo: s,
1640
+ textColor: r,
1641
+ label: ((a = e.poll.labels) == null ? void 0 : a.sponsor) || null
1642
+ }
1643
+ );
1644
+ }
1645
+ }
1646
+ );
1647
+ }, nl = (e) => {
1648
+ const { t: l } = z();
1649
+ return /* @__PURE__ */ t(
1650
+ Qt,
1651
+ {
1652
+ entity: e.poll,
1653
+ headline: l("poll.headline"),
1654
+ sdk: e.sdk,
1655
+ leads: e.leads,
1656
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1657
+ imagePosition: e.imagePosition,
1658
+ onLeadSubmitted: e.onLeadSubmitted,
1659
+ isSubmitting: e.isSubmitting,
1660
+ MainCard: Q,
1661
+ PresentedBy: W,
1662
+ CollectLeadWrapper: Be,
1663
+ consents: e.consents
1664
+ }
1665
+ );
1666
+ }, ll = (e) => {
1667
+ const { t: l } = z();
1668
+ return /* @__PURE__ */ t(
1669
+ Jt,
1670
+ {
1671
+ entity: e.poll,
1672
+ headline: l("poll.headline"),
1673
+ sdk: e.sdk,
1674
+ leads: e.leads,
1675
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1676
+ onLeadSubmitted: e.onLeadSubmitted,
1677
+ isSubmitting: e.isSubmitting,
1678
+ MainCard: Q,
1679
+ PresentedBy: W,
1680
+ CollectLeadWrapper: Be,
1681
+ consents: e.consents
1682
+ }
1683
+ );
1684
+ }, il = (e) => {
1685
+ const { t: l } = z();
1686
+ return /* @__PURE__ */ t(
1687
+ Zt,
1688
+ {
1689
+ entity: e.poll,
1690
+ headline: l("poll.headline"),
1691
+ sdk: e.sdk,
1692
+ leads: e.leads,
1693
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1694
+ onLeadSubmitted: e.onLeadSubmitted,
1695
+ isSubmitting: e.isSubmitting,
1696
+ PresentedBy: W,
1697
+ CollectLeadWrapper: Be,
1698
+ consents: e.consents
1699
+ }
1700
+ );
1701
+ }, ol = (e) => {
1702
+ var s, r, a;
1703
+ const { t: l } = z(), o = ((s = e.poll.branding) == null ? void 0 : s.colors) || null, i = (o == null ? void 0 : o.primaryColor) || xe().palette.primary.plainColor;
1704
+ return /* @__PURE__ */ t(
1705
+ Qt,
1706
+ {
1707
+ entity: e.poll,
1708
+ headline: l("poll.headline"),
1709
+ sdk: e.sdk,
1710
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1711
+ imagePosition: e.imagePosition,
1712
+ onLeadSubmitted: e.onSubmit,
1713
+ isSubmitting: e.isSubmitting,
1714
+ MainCard: Q,
1715
+ PresentedBy: W,
1716
+ rulesDisplay: e.rulesDisplay,
1717
+ content: /* @__PURE__ */ t(
1718
+ Fe,
1719
+ {
1720
+ consents: e.consents,
1721
+ primaryColor: i,
1722
+ brandingUrls: (r = e.poll.branding) == null ? void 0 : r.urls,
1723
+ align: "center"
1724
+ }
1725
+ ),
1726
+ footerAction: /* @__PURE__ */ t(
1727
+ tt,
1728
+ {
1729
+ onClick: e.onSubmit,
1730
+ label: ((a = e.consents.labels) == null ? void 0 : a.ctaLabel) || l("poll.buttons.vote"),
1731
+ isSubmitting: e.isSubmitting,
1732
+ primaryColor: i
1733
+ }
1734
+ )
1735
+ }
1736
+ );
1737
+ }, al = (e) => {
1738
+ var s, r;
1739
+ const { t: l } = z(), o = ((s = e.poll.branding) == null ? void 0 : s.colors) || null, i = (o == null ? void 0 : o.primaryColor) || xe().palette.primary.plainColor;
1740
+ return /* @__PURE__ */ t(
1741
+ Jt,
1742
+ {
1743
+ entity: e.poll,
1744
+ headline: l("poll.headline"),
1745
+ sdk: e.sdk,
1746
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1747
+ onLeadSubmitted: e.onSubmit,
1748
+ isSubmitting: e.isSubmitting,
1749
+ MainCard: Q,
1750
+ PresentedBy: W,
1751
+ rulesDisplay: e.rulesDisplay,
1752
+ content: /* @__PURE__ */ t(
1753
+ Fe,
1754
+ {
1755
+ consents: e.consents,
1756
+ primaryColor: i,
1757
+ brandingUrls: (r = e.poll.branding) == null ? void 0 : r.urls,
1758
+ onSubmit: e.onSubmit,
1759
+ isSubmitting: e.isSubmitting,
1760
+ ctaLabel: l("poll.buttons.vote"),
1761
+ align: "center"
1762
+ }
1763
+ )
1764
+ }
1765
+ );
1766
+ }, rl = (e) => {
1767
+ var r, a, c;
1768
+ const { t: l } = z(), o = pe(), i = ((r = e.poll.branding) == null ? void 0 : r.colors) || null, s = (i == null ? void 0 : i.primaryColor) || o.colorSchemes.dark.palette.primary.plainColor;
1769
+ return /* @__PURE__ */ t(
1770
+ Zt,
1771
+ {
1772
+ entity: e.poll,
1773
+ headline: l("poll.headline"),
1774
+ sdk: e.sdk,
1775
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1776
+ onLeadSubmitted: e.onSubmit,
1777
+ isSubmitting: e.isSubmitting,
1778
+ PresentedBy: W,
1779
+ rulesDisplay: e.rulesDisplay,
1780
+ content: /* @__PURE__ */ t(
1781
+ Fe,
1782
+ {
1783
+ consents: e.consents,
1784
+ primaryColor: s,
1785
+ textColor: (i == null ? void 0 : i.contentColor) || o.colorSchemes.dark.textColor,
1786
+ brandingUrls: (a = e.poll.branding) == null ? void 0 : a.urls
1787
+ }
1788
+ ),
1789
+ footerAction: /* @__PURE__ */ t(
1790
+ tt,
1791
+ {
1792
+ onClick: e.onSubmit,
1793
+ label: ((c = e.consents.labels) == null ? void 0 : c.ctaLabel) || l("poll.buttons.vote"),
1794
+ isSubmitting: e.isSubmitting,
1795
+ primaryColor: s
1796
+ }
1797
+ )
1798
+ }
1799
+ );
1800
+ };
1801
+ function Te(e) {
1802
+ return e.template === $.STANDARD;
1803
+ }
1804
+ const cl = (e) => {
1805
+ var It, pt;
1806
+ const [l, o] = B([]), [i, s] = B(!1), [r, a] = B(!1), [c, g] = B(!1), [m, b] = B(!1), [f, u] = B(!1), [x, C] = B(!1), [L, T] = B(!1), [p, y] = B(!1), [S, E] = B(!1), [q, H] = B(!1), w = Sn(!1), { poll: d, setPoll: me } = Fn(e.entityId, e.sdk), {
1807
+ myVote: P,
1808
+ setMyVote: ce,
1809
+ isUnauthorized: Y,
1810
+ isApiError: _,
1811
+ apiErrorMessage: Z,
1812
+ setIsApiError: ne,
1813
+ setApiErrorMessage: le,
1814
+ setIsUnauthorized: ie
1815
+ } = Bn(
1816
+ e.entityId,
1817
+ e.sdk,
1818
+ c,
1819
+ // A REGISTERED poll now renders for anonymous users, so its 401 is expected.
1820
+ (d == null ? void 0 : d.authRequirement) === "REGISTERED" && !e.userIsLoggedIn,
1821
+ !!e.userIsLoggedIn
1822
+ ), X = dt(() => !d || !P || !(P != null && P.id) || d.maxAttempts === -1 || d.maxAttempts === null || P.attempts === null ? !1 : (d == null ? void 0 : d.maxAttempts) <= (P == null ? void 0 : P.attempts), [d, P]), {
1823
+ translations: ee,
1824
+ loaded: se,
1825
+ loadTranslations: I
1826
+ } = zn(d, e.sdk), U = !!e.aggregateTranslatedVotes && X && !se;
1827
+ Ce(() => {
1828
+ U && I();
1829
+ }, [U]);
1830
+ const V = dt(() => !d || !ee.length ? null : Mn(d.options, ee), [d, ee]), O = dt(() => d ? bn(d.related) : null, [d]), {
1831
+ loading: j,
1832
+ pending: D,
1833
+ checked: K,
1834
+ setChecked: de,
1835
+ allRequiredChecked: oe,
1836
+ submit: ae
1837
+ } = yn({
1838
+ sdk: e.sdk,
1839
+ consents: (It = e.consents) == null ? void 0 : It.items,
1840
+ entityId: e.entityId,
1841
+ entityType: "poll"
1842
+ }), ke = !!((d == null ? void 0 : d.authRequirement) === "LEAD" ? (pt = e.leads) == null ? void 0 : pt.position : void 0) && D.length > 0, Ae = ke ? [] : D.filter((v) => v.position !== "after"), Le = ke ? [] : D.filter((v) => v.position === "after"), an = (v) => {
1843
+ de(v), H(!1);
1844
+ };
1845
+ if (Ce(() => {
1846
+ vn(e.language || "en");
1847
+ }, [e.language]), Ce(() => {
1848
+ var k;
1849
+ if (!d || j || w.current) return;
1850
+ const v = d.authRequirement === "LEAD" && ((k = e.leads) == null ? void 0 : k.position) === "before";
1851
+ T(!v && Ae.length > 0);
1852
+ }, [d, j, Ae.length]), Ce(() => {
1853
+ var v, k;
1854
+ !i || !(P != null && P.id) || (k = (v = e.callbacks) == null ? void 0 : v.onFinish) == null || k.call(v, P);
1855
+ }, [i]), !d || !P || j || U)
1856
+ return /* @__PURE__ */ t(Un, { marginBlock: "160px" });
1857
+ if (!d.id)
1858
+ return /* @__PURE__ */ t(Qn, {});
1859
+ if (d.status !== "ACTIVE")
1860
+ return /* @__PURE__ */ t(
1861
+ Jn,
1862
+ {
1863
+ poll: d,
1864
+ template: e.template,
1865
+ imagePosition: Te(e) ? e.imagePosition : void 0,
1866
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1867
+ rulesDisplay: e.rulesDisplay
1868
+ }
1869
+ );
1870
+ const nt = d.authRequirement === "REGISTERED" && !e.userIsLoggedIn, lt = () => {
1871
+ ne(!1), le(""), ie(!1), g(!c);
1872
+ };
1873
+ if (Y || _)
1874
+ return Te(e) ? /* @__PURE__ */ t(
1875
+ Zn,
1876
+ {
1877
+ poll: d,
1878
+ imagePosition: e.imagePosition,
1879
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1880
+ isApiError: _,
1881
+ apiErrorMessage: Z,
1882
+ toggleTryAgain: lt,
1883
+ rulesDisplay: e.rulesDisplay
1884
+ }
1885
+ ) : e.template === $.OVERLAY ? /* @__PURE__ */ t(
1886
+ tl,
1887
+ {
1888
+ poll: d,
1889
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1890
+ isApiError: _,
1891
+ apiErrorMessage: Z,
1892
+ toggleTryAgain: lt,
1893
+ rulesDisplay: e.rulesDisplay
1894
+ }
1895
+ ) : /* @__PURE__ */ t(
1896
+ el,
1897
+ {
1898
+ poll: d,
1899
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1900
+ isApiError: _,
1901
+ apiErrorMessage: Z,
1902
+ toggleTryAgain: lt,
1903
+ rulesDisplay: e.rulesDisplay
1904
+ }
1905
+ );
1906
+ const Me = d.multipleChoice && d.maxMultipleChoiceOptions || 1, it = (v) => {
1907
+ if (Me === 1)
1908
+ o(v);
1909
+ else {
1910
+ const k = v[0];
1911
+ o((M) => M.includes(k) ? M.filter((ze) => ze !== k) : M.length < Me ? [...M, k] : M);
1912
+ }
1913
+ }, ot = async () => {
1914
+ var v;
1915
+ if (Le.length > 0 && !S) {
1916
+ y(!0);
1917
+ return;
1918
+ }
1919
+ if (((v = e.leads) == null ? void 0 : v.position) === "after" && d.authRequirement === "LEAD" && !f) {
1920
+ C(!0);
1921
+ return;
1922
+ }
1923
+ await rt();
1924
+ }, at = async () => {
1925
+ if (Ae.length > 0) {
1926
+ if (m) return;
1927
+ if (!oe(Ae)) {
1928
+ H(!0);
1929
+ return;
1930
+ }
1931
+ b(!0), await ae(Ae), b(!1);
1932
+ }
1933
+ w.current = !0, T(!1);
1934
+ }, rn = async () => {
1935
+ if (!oe(Le)) {
1936
+ H(!0);
1937
+ return;
1938
+ }
1939
+ b(!0), await ae(Le), E(!0), await rt(), b(!1), y(!1);
1940
+ }, rt = async () => {
1941
+ a(!0);
1942
+ try {
1943
+ const v = await e.sdk.voting.voteForPoll(
1944
+ e.entityId,
1945
+ l
1946
+ ), k = { ...d };
1947
+ k.options = d.options.map((M) => l.includes(M.id) ? {
1948
+ ...M,
1949
+ votes: M.votes + 1
1950
+ } : M), k.totalVotes = (d.totalVotes || 0) + l.length, e.aggregateTranslatedVotes && await I(), me(k), ce(v), s(!0);
1951
+ } catch (v) {
1952
+ console.error("[poll-vote] vote failed", v);
1953
+ const { code: k, message: M } = xn(v, e.sdk);
1954
+ k === 401 || k === 403 ? ie(!0) : (ne(!0), le(M));
1955
+ } finally {
1956
+ a(!1);
1957
+ }
1958
+ }, ct = async () => {
1959
+ u(!0), b(!0), await rt(), b(!1), C(!1);
1960
+ }, st = () => {
1961
+ s(!1), o([]), b(!1), u(!1), C(!1), y(!1), H(!1);
1962
+ }, St = (v) => {
1963
+ var k;
1964
+ return {
1965
+ items: v,
1966
+ checked: K,
1967
+ onChange: an,
1968
+ labels: (k = e.consents) == null ? void 0 : k.labels,
1969
+ showError: q
1970
+ };
1971
+ }, cn = () => {
1972
+ const v = St(Ae), k = ke ? D : void 0, M = Le.length > 0 && !S;
1973
+ return e.template === $.OVERLAY ? /* @__PURE__ */ t(
1974
+ Wn,
1975
+ {
1976
+ sdk: e.sdk,
1977
+ leads: e.leads,
1978
+ poll: d,
1979
+ options: d.options,
1980
+ selectedOptions: l,
1981
+ answerPoll: it,
1982
+ voteForPoll: ot,
1983
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1984
+ optionChoices: Me,
1985
+ isVoting: r,
1986
+ rulesDisplay: e.rulesDisplay,
1987
+ consents: v,
1988
+ leadConsents: k,
1989
+ applyConsentGate: L,
1990
+ isSubmitting: m,
1991
+ hasAfterConsents: M,
1992
+ startVoting: at,
1993
+ signInRequired: nt,
1994
+ signInCTA: e.signInCTA
1995
+ }
1996
+ ) : Te(e) ? /* @__PURE__ */ t(
1997
+ $n,
1998
+ {
1999
+ sdk: e.sdk,
2000
+ leads: e.leads,
2001
+ poll: d,
2002
+ options: d.options,
2003
+ selectedOptions: l,
2004
+ answerPoll: it,
2005
+ voteForPoll: ot,
2006
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2007
+ imagePosition: e.imagePosition,
2008
+ optionChoices: Me,
2009
+ isVoting: r,
2010
+ rulesDisplay: e.rulesDisplay,
2011
+ consents: v,
2012
+ leadConsents: k,
2013
+ applyConsentGate: L,
2014
+ isSubmitting: m,
2015
+ hasAfterConsents: M,
2016
+ startVoting: at,
2017
+ signInRequired: nt,
2018
+ signInCTA: e.signInCTA
2019
+ }
2020
+ ) : /* @__PURE__ */ t(
2021
+ Hn,
2022
+ {
2023
+ sdk: e.sdk,
2024
+ leads: e.leads,
2025
+ poll: d,
2026
+ options: d.options,
2027
+ selectedOptions: l,
2028
+ answerPoll: it,
2029
+ voteForPoll: ot,
2030
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2031
+ optionChoices: Me,
2032
+ isVoting: r,
2033
+ rulesDisplay: e.rulesDisplay,
2034
+ consents: v,
2035
+ leadConsents: k,
2036
+ applyConsentGate: L,
2037
+ isSubmitting: m,
2038
+ hasAfterConsents: M,
2039
+ startVoting: at,
2040
+ signInRequired: nt,
2041
+ signInCTA: e.signInCTA
2042
+ }
2043
+ );
2044
+ };
2045
+ if (p && Le.length > 0) {
2046
+ const v = {
2047
+ poll: d,
2048
+ sdk: e.sdk,
2049
+ consents: St(Le),
2050
+ onSubmit: rn,
2051
+ isSubmitting: m,
2052
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2053
+ rulesDisplay: e.rulesDisplay
2054
+ };
2055
+ return e.template === $.OVERLAY ? /* @__PURE__ */ t(rl, { ...v }) : Te(e) ? /* @__PURE__ */ t(
2056
+ ol,
2057
+ {
2058
+ ...v,
2059
+ imagePosition: e.imagePosition
2060
+ }
2061
+ ) : /* @__PURE__ */ t(al, { ...v });
2062
+ }
2063
+ if (x)
2064
+ return e.template === $.OVERLAY ? /* @__PURE__ */ t(
2065
+ il,
2066
+ {
2067
+ poll: d,
2068
+ sdk: e.sdk,
2069
+ leads: e.leads,
2070
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2071
+ onLeadSubmitted: ct,
2072
+ isSubmitting: m,
2073
+ consents: ke ? D : void 0
2074
+ }
2075
+ ) : Te(e) ? /* @__PURE__ */ t(
2076
+ nl,
2077
+ {
2078
+ poll: d,
2079
+ sdk: e.sdk,
2080
+ leads: e.leads,
2081
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2082
+ imagePosition: e.imagePosition,
2083
+ onLeadSubmitted: ct,
2084
+ isSubmitting: m,
2085
+ consents: ke ? D : void 0
2086
+ }
2087
+ ) : /* @__PURE__ */ t(
2088
+ ll,
2089
+ {
2090
+ poll: d,
2091
+ sdk: e.sdk,
2092
+ leads: e.leads,
2093
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2094
+ onLeadSubmitted: ct,
2095
+ isSubmitting: m,
2096
+ consents: ke ? D : void 0
2097
+ }
2098
+ );
2099
+ if (i || X) {
2100
+ const v = V ? { ...d, options: V } : d, k = O ? /* @__PURE__ */ t(kt, { entityId: O, sdk: e.sdk, children: (ze) => /* @__PURE__ */ t(
2101
+ At,
2102
+ {
2103
+ infoPage: ze,
2104
+ variant: e.chanceGameVariant
2105
+ }
2106
+ ) }) : void 0, M = O ? /* @__PURE__ */ t(kt, { entityId: O, sdk: e.sdk, children: (ze) => /* @__PURE__ */ t(
2107
+ At,
2108
+ {
2109
+ infoPage: ze,
2110
+ variant: e.chanceGameVariant,
2111
+ forceMobile: !0
2112
+ }
2113
+ ) }) : void 0;
2114
+ return e.template === $.OVERLAY ? /* @__PURE__ */ t(
2115
+ Kn,
2116
+ {
2117
+ userVote: P,
2118
+ poll: v,
2119
+ maxAttemptsReached: X,
2120
+ voteAgain: st,
2121
+ sdk: e.sdk,
2122
+ leads: e.leads,
2123
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2124
+ isUnauthorized: Y,
2125
+ additionalCTA: e.additionalCTA,
2126
+ rulesDisplay: e.rulesDisplay,
2127
+ chanceGameContent: k
2128
+ }
2129
+ ) : Te(e) ? /* @__PURE__ */ t(
2130
+ Nn,
2131
+ {
2132
+ imagePosition: e.imagePosition || "left",
2133
+ userVote: P,
2134
+ poll: v,
2135
+ maxAttemptsReached: X,
2136
+ voteAgain: st,
2137
+ sdk: e.sdk,
2138
+ leads: e.leads,
2139
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2140
+ isUnauthorized: Y,
2141
+ additionalCTA: e.additionalCTA,
2142
+ rulesDisplay: e.rulesDisplay,
2143
+ chanceGameContent: M
2144
+ }
2145
+ ) : /* @__PURE__ */ t(
2146
+ Xn,
2147
+ {
2148
+ userVote: P,
2149
+ poll: v,
2150
+ maxAttemptsReached: X,
2151
+ voteAgain: st,
2152
+ sdk: e.sdk,
2153
+ leads: e.leads,
2154
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2155
+ isUnauthorized: Y,
2156
+ additionalCTA: e.additionalCTA,
2157
+ rulesDisplay: e.rulesDisplay,
2158
+ chanceGameContent: M
2159
+ }
2160
+ );
2161
+ }
2162
+ return cn();
2163
+ }, sl = (e) => {
2164
+ var o;
2165
+ const l = Se.useMemo(
2166
+ () => e.template === $.OVERLAY ? { ...e.themeOptions, mode: "dark" } : e.themeOptions,
2167
+ [e.template, e.themeOptions]
2168
+ );
2169
+ return /* @__PURE__ */ t(
2170
+ Vn,
2171
+ {
2172
+ packageName: "poll-vote",
2173
+ language: e.language,
2174
+ themeOptions: l,
2175
+ disableCache: e.disableCache,
2176
+ optionsLayout: e.optionsLayout,
2177
+ leadPhoneCountryCode: (o = e.leads) == null ? void 0 : o.phoneCountryCode,
2178
+ children: e.children
2179
+ }
2180
+ );
2181
+ }, xl = (e) => /* @__PURE__ */ t(sl, { ...e, children: /* @__PURE__ */ t(cl, { ...e }) });
2182
+ export {
2183
+ xl as M
2184
+ };