fansunited-frontend-components 1.1.0 → 1.2.0

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