@sprig-technologies/sprig-browser 2.40.0 → 2.40.2

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 (34) hide show
  1. package/dist/conversational-styles-BiL7hMhj.js +4 -0
  2. package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
  3. package/dist/conversational-ui-BYWN-x1R.js +579 -0
  4. package/dist/conversational-ui-N_aaTzqd.cjs +1 -0
  5. package/dist/core-Br8FqGd4.cjs +12 -0
  6. package/dist/{core-CzqULo6b.js → core-Cyu7gofl.js} +451 -458
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.d.ts +11 -0
  9. package/dist/core.js +2 -2
  10. package/dist/debounce-CMb8f7wh.js +9 -0
  11. package/dist/debounce-DsC7462b.cjs +1 -0
  12. package/dist/{getAttributedUrl-C1AsMcwH.cjs → getAttributedUrl-CJJ96Ihj.cjs} +6 -6
  13. package/dist/{getAttributedUrl-DUesmkhh.js → getAttributedUrl-C_5gL6aZ.js} +241 -244
  14. package/dist/index-BSk-C5b7.js +695 -0
  15. package/dist/index-MWKreg7C.cjs +1 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.js +2 -2
  19. package/dist/{metricsReporter-BChkCOLD.js → metricsReporter-B-oKhuWk.js} +1 -1
  20. package/dist/{metricsReporter-Bqy_vLyq.cjs → metricsReporter-Dc4CZlRc.cjs} +1 -1
  21. package/dist/replay.cjs +1 -1
  22. package/dist/replay.js +134 -138
  23. package/dist/view-BGlLLPXB.js +1503 -0
  24. package/dist/view-BGzeHt4l.cjs +1 -0
  25. package/package.json +1 -1
  26. package/dist/conversational-styles-CWNea3pP.js +0 -4
  27. package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
  28. package/dist/conversational-ui-D2Y5H9To.js +0 -610
  29. package/dist/conversational-ui-DJlCFQ-6.cjs +0 -1
  30. package/dist/core-CvM2f3CD.cjs +0 -12
  31. package/dist/index-D1_q2uph.cjs +0 -1
  32. package/dist/index-mshAF3wp.js +0 -709
  33. package/dist/view-C7XtFlCN.cjs +0 -1
  34. package/dist/view-afp9mz2J.js +0 -1491
@@ -1,709 +0,0 @@
1
- import { a as V, h as $, u as e, c as B, b as X, f as De, F as be, p as Z, g as fe, e as pe, _ as ne, T as ye, A as ir, i as sr, m as ar, q as or, M as le, n as lr, o as dr, r as cr, s as ur, j as pr, k as mr, y as gr, l as Be } from "./view-afp9mz2J.js";
2
- import { t as se } from "./metricsReporter-BChkCOLD.js";
3
- import { a as Ne, D as Re, g as Ge, A as hr } from "./core-CzqULo6b.js";
4
- import { c as te, a as ie, H as xe, M as ue, Q as ce, O as ve, B as Y, L as Se, b as _e, S as br, u as vr, g as fr, P as yr, p as Sr, v as xr, R as re, d as kr, s as _r } from "./getAttributedUrl-DUesmkhh.js";
5
- const Ir = ({ className: n, message: i, next: l, properties: r, questionId: t, type: d }) => {
6
- const { useMobileStyling: b, border: y, isLongFormSurvey: o, focusedQuestionId: f } = V((c) => ({ useMobileStyling: c.useMobileStyling, border: c.border, isLongFormSurvey: se(c.studyType), focusedQuestionId: c.focusedQuestionId })), [s, g] = $(!1), [a, k] = $(""), [m, h] = $(!1), q = o && f === t, T = r == null ? void 0 : r.collectName, w = (r == null ? void 0 : r.nameLabelText) || "Full Name", I = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", L = (r == null ? void 0 : r.submitButtonText) || "Submit", P = !!a.trim(), U = s && (!T || P), R = (c, S = !1) => {
7
- c.preventDefault(), c.stopPropagation();
8
- let D = null;
9
- if (!S) {
10
- if (!U) return void h(!0);
11
- D = { submitted: !0 }, T && (D.name = a);
12
- }
13
- l({ value: D, questionId: t, type: d }, U);
14
- };
15
- return e("div", { className: B(n, o && !q && "ul-card--unfocused", "ul-card__consent-legal", "fade-in-transition"), children: [e(te, { isRequired: o && (r == null ? void 0 : r.required), message: i, properties: { questionHtml: r.questionHtml } }), r != null && r.richTextBody ? e(ie, { children: e(xe, { className: "ul-rich-text-body", html: r.richTextBody, id: "ul-card__consent-legal-body-container" }) }) : null, e(ue, { embeddedType: "pdf", properties: r, children: e(ce, { children: [e("div", { className: "sprig-stretch", children: [e(ve, { allowTextEntry: !1, border: y, error: m && !s, id: "consent", isRadio: !1, isSelected: s, label: I, onUserInputChanged: ({ selected: c }) => {
16
- c !== s && g(!s);
17
- }, useMobileStyling: b }), T && e("input", { "aria-label": w, "aria-placeholder": w, className: B(X("ul-consent-legal__name-input", b)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (c) => {
18
- c.currentTarget.style.borderColor = m && !P ? Ne : Re;
19
- }, onFocus: (c) => {
20
- c.currentTarget.style.borderColor = m && !P ? Ne : y;
21
- }, onInput: (c) => {
22
- c.preventDefault(), c.stopPropagation(), k(c.currentTarget.value);
23
- }, placeholder: w, style: m && !P ? { borderColor: Ne } : {}, tabIndex: 0, value: a })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(Y, { className: U ? "" : "sprig-button-disabled", onClick: R, children: L }), r.required === !1 && !o && e("button", { className: "ul-card-skip__button", onClick: (c) => R(c, !0), children: De(r) })] })] }) })] }, t);
24
- }, Tr = ({ activeValue: n, border: i, icon: l, isPressed: r, onSubmit: t, range: d, scaleLabelType: b, selectedValue: y, setSelectedValue: o, setActiveValue: f, setIsPressed: s, useMobileStyling: g, value: a, viewDocument: k }) => {
25
- const { isLongFormSurvey: m, enableCspTrustedTypes: h } = V((S) => ({ isLongFormSurvey: se(S.studyType), enableCspTrustedTypes: S.enableCspTrustedTypes })), q = `option-${a}`, T = b === "number", w = b === "star", I = b === "smiley", L = T && a === n || a === y, [P, U] = (() => {
26
- const S = w && y !== null && a <= y;
27
- return w && a <= n || I && a === n || S || a === n || a === y ? [i, r || S || a === y ? 1 : 0.3] : ["", 1];
28
- })(), R = be(() => {
29
- const S = { borderColor: L ? P : "", fillOpacity: L ? "" : U, zIndex: L ? 3 : "auto", color: y === a ? "#fff" : "" };
30
- return T ? { ...S, backgroundColor: y === a ? P : "" } : { ...S, color: w || I || y === a ? P : "" };
31
- }, [L, P, U, y, a, T, w, I]), c = be(() => Ge((({ icon: S, scaleLabelType: D, value: F, selectedValue: p }) => {
32
- if (D === "smiley" && F === p) {
33
- let x = 0;
34
- return S.replace(/black/g, () => ++x == 1 ? "black" : "white");
35
- }
36
- return S;
37
- })({ icon: l, scaleLabelType: b, value: a, selectedValue: y }), h), [h, l, b, y, a]);
38
- return e("button", { "aria-label": T ? void 0 : String(a), className: (() => {
39
- switch (b) {
40
- case "star":
41
- return B(X("likert-star", g), X(`likert-star-${a}`, g));
42
- case "smiley":
43
- return B(X("likert-smiley", g), X(`likert-smiley-${a}`, g));
44
- default:
45
- return a === d ? B(X("likert-number", g), X(`likert-number-${a}`, g), X("likert-last-option", g)) : B(X("likert-number", g), X(`likert-number-${a}`, g));
46
- }
47
- })(), dangerouslySetInnerHTML: { __html: c }, id: q, onClick: (S) => {
48
- m && (S.preventDefault(), S.stopPropagation(), o(a)), t();
49
- }, onKeyDown: (S) => {
50
- var p, x;
51
- const D = k.querySelectorAll(`.likert-${b ?? "number"}`), F = a - 1;
52
- S.key === "ArrowRight" ? (p = D[F + 1]) == null || p.focus() : S.key === "ArrowLeft" ? (x = D[F - 1]) == null || x.focus() : S.key !== "Enter" && S.key !== " " || (m && (S.preventDefault(), S.stopPropagation(), o(a)), t());
53
- }, onPointerDown: () => s(!0), onPointerEnter: () => f(a), onPointerLeave: () => {
54
- f(-1), s(!1);
55
- }, style: R, tabIndex: 0 });
56
- }, Cr = ({ className: n, labels: i, message: l, next: r, properties: t, questionId: d, type: b }) => {
57
- const { border: y, useMobileStyling: o, viewDocument: f, isLongFormSurvey: s, focusedQuestionId: g, update: a } = V((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, viewDocument: p.viewDocument, isLongFormSurvey: se(p.studyType), focusedQuestionId: p.focusedQuestionId, update: p.update })), [k, m] = $(-1), [h, q] = $(!1), [T, w] = $(null), I = s && g === d, L = i && i.left, P = i && i.right;
58
- let U;
59
- const { range: R, scaleLabelType: c, ratingIcons: S } = t;
60
- R && (U = Number(R));
61
- const D = U || 5, F = (p) => {
62
- var x, _;
63
- switch (c) {
64
- case "star":
65
- return (x = S[0]) == null ? void 0 : x.svg;
66
- case "smiley":
67
- return (_ = S[p]) == null ? void 0 : _.svg;
68
- default:
69
- return String(p + 1);
70
- }
71
- };
72
- return Z(() => {
73
- a();
74
- }, [a]), e("form", { className: B(n, "ul-card--likert", "fade-in-transition", s && !I && "ul-card--unfocused"), children: [e(te, { isRequired: s && (t == null ? void 0 : t.required), message: l, properties: t }), e(ue, { properties: t, children: e(fe, { children: [e(ie, { children: [e("div", { "aria-label": `Rating (1 - ${D})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(D)].map((p, x) => {
75
- const _ = x + 1;
76
- return e(Tr, { activeValue: k, border: y, icon: F(x), isPressed: h, onSubmit: () => r({ value: _, questionId: d, type: b }, !0), range: D, scaleLabelType: c, selectedValue: T, setActiveValue: m, setIsPressed: q, setSelectedValue: w, useMobileStyling: o, value: _, viewDocument: f }, x);
77
- }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: L }), e("span", { children: P })] })] }), !t.required && !s && e(ce, { children: e("div", { className: "ul-vertical-centered-container", children: e(Y, { onClick: (p) => {
78
- p.preventDefault(), p.stopPropagation(), r({ value: null, questionId: d, type: b }, !0);
79
- }, children: pe(t) }) }) })] }) })] }, d);
80
- }, Ve = (n) => n && (n.scrollHeight > n.offsetHeight ? n : Ve(n.parentElement)), Nr = (n) => {
81
- if (!n || !((l) => l instanceof HTMLElement)(n)) return 0;
82
- const i = getComputedStyle(n);
83
- return parseFloat(i.marginTop) + parseFloat(i.marginBottom) + (parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth));
84
- }, qr = ({ columns: n, onSelect: i, options: l, selectedOptions: r }) => {
85
- const t = ne([]), { border: d, useMobileStyling: b } = V((a) => ({ border: a.border, useMobileStyling: a.useMobileStyling })), y = l.findIndex((a) => r[a.id] === null), [o, f] = $(y), s = ye((a, k) => {
86
- i(a, k);
87
- const m = o + 1, h = l[m];
88
- if (h && r[h.id] === null) {
89
- f(m);
90
- const q = t.current[o];
91
- if (q != null && q.firstElementChild) {
92
- const T = Ve(q), w = q.firstElementChild, I = Nr(q) + w.clientHeight;
93
- T == null || T.scrollTo(0, q.offsetTop + I);
94
- }
95
- }
96
- }, [i, l, r, o]), g = ye((a, k) => {
97
- const m = o === a;
98
- return e(ir, { animate: !0, header: k.label, isOpen: m, onClick: () => {
99
- var h;
100
- return f(m && !((h = window.UserLeap) != null && h.isMobileSDK) ? -1 : a);
101
- }, ref: (h) => {
102
- h && (t.current[a] = h);
103
- }, showHeaderCheck: r[k.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((h) => e(ve, { allowTextEntry: !1, ariaLabel: `${k.label}-${h.label}`, border: d, error: !1, id: `${k.id}-${h.value}`, isRadio: !0, isSelected: r[k.id] === h.value, label: h.label, onUserInputChanged: () => s(k.id, h.value), useMobileStyling: b }, h.label)) }) }, k.id);
104
- }, [d, n, o, s, r, b]);
105
- return e("div", { children: l.map((a, k) => g(k, a)) });
106
- }, wr = ({ columns: n, onSelect: i, options: l, selectedOptions: r }) => {
107
- const { border: t, useMobileStyling: d, isLongFormSurvey: b } = V((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling, isLongFormSurvey: se(m.studyType) })), y = l.length, o = n.length, f = ne(null), [s, g] = $(!1), [a, k] = $(!1);
108
- return Z(() => {
109
- const m = f.current, h = new ResizeObserver((q) => {
110
- window.requestAnimationFrame(() => {
111
- m && (g(Math.round(q[0].contentRect.width) < m.scrollWidth), k(Math.round(q[0].contentRect.width) < m.scrollWidth));
112
- });
113
- });
114
- return m && h.observe(m), () => {
115
- m && h.unobserve(m);
116
- };
117
- }, []), e("div", { className: "ul-card--matrix_question_container", children: [e("div", { className: B("ul-card--matrix_container", s && "ul-matrix-scroll-gradient"), onScroll: () => {
118
- (() => {
119
- const m = f.current;
120
- m && g(m.clientWidth + Math.abs(m.scrollLeft) < m.scrollWidth);
121
- })();
122
- }, ref: f, children: e("div", { className: B(b && "ul-card--matrix_grid_longform", "ul-card--matrix_grid"), style: `--numColumns: ${o}; --numRows: ${y + 1};`, children: [e("div", {}), " ", n.map((m) => e("div", { className: "ul-matrix-column-label", children: m.label }, m.label)), l.map((m) => e(fe, { children: [e("div", { "aria-label": m.label, className: "ul-matrix-row-label", children: m.label }, m.label), e("div", { className: "ul-matrix-row-options", role: "radiogroup", children: n.map((h, q) => e("div", { className: B("ul-matrix-option-wrapper", q === o - 1 && "ul-matrix-last-option"), children: e(ve, { allowTextEntry: !1, ariaLabel: `${m.label}-${h.label}`, border: t, choiceStyle: { background: "transparent", border: "none", marginBottom: "0", padding: "0" }, error: !1, id: `${m.id}-${h.value}`, isRadio: !0, isSelected: r[m.id] === h.value, onUserInputChanged: () => i(m.id, h.value), useMobileStyling: d }) }, h.value)) })] }))] }) }), (s || a) && e("button", { className: a && !s ? "ul-matrix-scroll-arrow left" : "ul-matrix-scroll-arrow", onClick: a && !s ? (m) => {
123
- m.preventDefault();
124
- const h = f.current;
125
- if (h) {
126
- const q = getComputedStyle(h).direction === "rtl";
127
- h.scrollTo({ left: q ? h.scrollWidth - h.clientWidth : 0, behavior: "smooth" });
128
- }
129
- } : (m) => {
130
- m.preventDefault();
131
- const h = f.current;
132
- if (h) {
133
- const q = getComputedStyle(h).direction === "rtl";
134
- h.scrollTo({ left: q ? h.clientWidth - h.scrollWidth : h.scrollWidth, behavior: "smooth" });
135
- }
136
- }, children: e(a && !s ? Lr : Pr, {}) })] });
137
- }, Lr = () => e("svg", { fill: "currentColor", height: "32", transform: "matrix(-1,0,0,1,0,0)", version: "1.1", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Pr = () => e("svg", { fill: "currentColor", height: "32", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Dr = ({ className: n, message: i, next: l, options: r, properties: t, questionId: d, type: b, showIndividualSubmit: y = !1, onSubmitButtonClick: o }) => {
138
- const { useMobileStyling: f, isLongFormSurvey: s, focusedQuestionId: g, setFocusedQuestionId: a, update: k } = V((c) => ({ useMobileStyling: c.useMobileStyling, isLongFormSurvey: se(c.studyType), focusedQuestionId: c.focusedQuestionId, setFocusedQuestionId: c.setFocusedQuestionId, update: c.update })), m = t.matrixColumn, h = t.required, q = s && g === d, T = (c) => {
139
- c.preventDefault(), c.stopPropagation(), l({ value: I, questionId: d, type: b }, !0), o && o();
140
- }, w = r.reduce((c, S) => (c[S.id] = null, c), {}), [I, L] = $(w), P = (c) => h && Object.values(c).every((S) => S == null), U = (c, S) => {
141
- s && l({ value: { ...I, [c]: S }, questionId: d, type: b }, !P({ ...I, [c]: S })), L((D) => ({ ...D, [c]: S }));
142
- }, R = t.displayMatrixAsAccordion || f;
143
- return Z(() => {
144
- k();
145
- }, [k]), e("form", { className: B(n, !s && "ul-card__matrix", "fade-in-transition", s && !q && "ul-card--unfocused"), id: "text-form", onClick: () => {
146
- q && a(d);
147
- }, onSubmit: T, children: [e(te, { isRequired: s && (t == null ? void 0 : t.required), message: i, properties: t }), e(ue, { properties: t, children: [e(ie, { children: [e(R ? qr : wr, { columns: m, onSelect: U, options: r, selectedOptions: I }), y && e(Se, { handleSubmit: T, isSubmitDisabled: P(I) })] }), !s && e(ce, { children: e("div", { className: "ul-card__button-wrapper", children: e(Y, { disabled: P(I), children: pe(t) }) }) })] })] }, d);
148
- }, je = ({ className: n, message: i, onSubmit: l, options: r = [], properties: t, questionId: d, type: b, showIndividualSubmit: y = !1, onSubmitButtonClick: o }) => {
149
- const { border: f, useMobileStyling: s, isLongFormSurvey: g, focusedQuestionId: a, setFocusedQuestionId: k, update: m } = V((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, isLongFormSurvey: se(u.studyType), focusedQuestionId: u.focusedQuestionId, setFocusedQuestionId: u.setFocusedQuestionId, update: u.update })), h = g && a === d, q = r.reduce((u, N) => (u[N.id] = { isSelected: !1 }, u), {}), [T, w] = $(q), I = b === "multiplechoice", L = t.required, P = r.find((u) => {
150
- var N;
151
- return (N = u.optionProperties) == null ? void 0 : N.noneOfTheAbove;
152
- }), U = (u) => Object.entries(u).some(([N, M]) => {
153
- var K;
154
- const W = r.find((J) => `${J.id}` === N), Q = M.userText === void 0 || M.userText.trim() === "";
155
- return ((K = W == null ? void 0 : W.optionProperties) == null ? void 0 : K.allowsTextEntry) && Q && M.isSelected;
156
- }), R = (u) => Object.values(u).filter((N) => N.isSelected).length, c = t.minSelect && t.minSelect > 0 && t.maxSelectMode === _e.Range && R(T) < t.minSelect && (L || R(T) > 0), S = (u) => U(u) || L && !R(u) || !((N) => {
157
- const { minSelect: M = 0, maxSelect: W = 1 / 0, maxSelectMode: Q } = t, K = R(N);
158
- switch (Q) {
159
- case _e.Maximum:
160
- return K <= W;
161
- case _e.Range:
162
- return K === 0 || K >= M;
163
- default:
164
- return !0;
165
- }
166
- })(u), D = Object.entries(T).some(([u, N]) => {
167
- var M, W;
168
- return N.isSelected && ((W = (M = r.find((Q) => `${Q.id}` === u)) == null ? void 0 : M.optionProperties) == null ? void 0 : W.allowsTextEntry);
169
- }), F = y && (!I || D), p = (u) => {
170
- v(u.id, u.selected, u.userText, u.noneOfTheAbove), u.selected && g && !I && !h && k(d);
171
- }, x = (u) => {
172
- var N;
173
- return (t == null ? void 0 : t.maxSelectMode) !== _e.Unlimited && R(T) === (t == null ? void 0 : t.maxSelect) && !((N = T[u]) != null && N.isSelected);
174
- }, _ = (u) => {
175
- u.preventDefault(), u.stopPropagation(), l(T, !0), o && o();
176
- }, v = (u, N, M, W) => {
177
- const Q = Object.assign({}, T);
178
- if ((I || W) && N) for (const z of Object.values(Q)) z.isSelected = !1, delete z.userText;
179
- else P && !W && T[P.id].isSelected && (Q[P.id].isSelected = !1);
180
- Q[u] = { isSelected: N, userText: M };
181
- const K = I && Object.entries(Q).some(([z, ae]) => {
182
- var ee, me;
183
- return ae.isSelected && ((me = (ee = r.find((ke) => `${ke.id}` === z)) == null ? void 0 : ee.optionProperties) == null ? void 0 : me.allowsTextEntry);
184
- }), J = !S(Q);
185
- g && (l(Q, J), I && !K && J && o && o()), w(Q);
186
- };
187
- return Z(() => {
188
- m();
189
- }, []), e("form", { className: B(n, "ul-card--multiple", "fade-in-transition", g && !h && "ul-card--unfocused"), id: "text-form", onClick: b === "multipleselect" ? () => {
190
- g && a !== d && b === "multipleselect" && k(d);
191
- } : void 0, onSubmit: _, children: [e(te, { isRequired: g && (t == null ? void 0 : t.required), message: i, properties: t }), e(ue, { properties: t, children: e(fe, { children: [e(ie, { children: [t.isDropdown ? e(br, { disabledOptions: r.filter((u) => x(u.id)), dropdownFooter: c ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [R(T), "/", t.minSelect] }) : void 0, isMultiSelect: !I, multiselectText: t.dropdownMultiselectedText ?? "choices selected", onChange: (u) => {
192
- const N = { ...T };
193
- for (const M of r) u.includes(M) ? N[M.id].isSelected = !0 : N[M.id].isSelected = !1;
194
- g && l(N, !S(N)), w(N);
195
- }, options: r, placeholderText: t.dropdownPlaceholderText ?? (I ? "Select choice" : "Select choice(s)"), value: r.filter((u) => T[u.id].isSelected) }) : e("div", { className: B(X("ul-card__choices", s)), role: I ? "radiogroup" : "group", children: [r.map(({ id: u, label: N, value: M, optionProperties: W }) => {
196
- var ae, ee;
197
- const Q = `${u}`, { allowsTextEntry: K, noneOfTheAbove: J } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...W };
198
- return e(ve, { allowTextEntry: K, border: f, disabled: x(Q), error: (z = T, U(z)), id: Q, isRadio: I, isSelected: !!((ae = T[Q]) != null && ae.isSelected), label: N, noneOfTheAbove: J, onUserInputChanged: p, promptText: "Please specify", text: (ee = T[u]) == null ? void 0 : ee.userText, useMobileStyling: s, value: M }, Q);
199
- var z;
200
- }), !!c && e("div", { className: "ul-card__min-select-counter", children: [R(T), "/", t.minSelect] })] }), F && e(Se, { handleSubmit: _, isSubmitDisabled: S(T) })] }), !g && e(ce, { children: e("div", { className: "ul-card__button-wrapper", children: e(Y, { disabled: S(T), onClick: _, children: pe(t) }) }) })] }) })] }, d);
201
- }, Rr = (n) => {
202
- const { questionId: i, type: l, next: r, options: t } = n, { setFocusedQuestionId: d } = V((b) => ({ setFocusedQuestionId: b.setFocusedQuestionId }));
203
- return e(je, { ...n, onSubmit: (b, y) => {
204
- var k;
205
- const o = Object.entries(b).find(([, m]) => m.isSelected) || [void 0, void 0], [f, s] = o, g = t.find((m) => `${m.id}` === f);
206
- !((k = g == null ? void 0 : g.optionProperties) != null && k.allowsTextEntry) || s != null && s.userText && s.userText.trim() !== "" || d(i);
207
- const a = s != null && s.userText ? { [f]: { userText: s.userText } } : null;
208
- r({ value: g && f ? { [f]: g.value } : {}, secondaryValue: a, questionId: i, type: l }, y);
209
- } });
210
- }, Mr = (n) => {
211
- const { questionId: i, type: l, next: r } = n;
212
- return e(je, { ...n, onSubmit: (t, d) => {
213
- const b = Object.entries(t).reduce((o, [f, s]) => (o[f] = s.isSelected, o), {}), y = Object.entries(t).reduce((o, [f, s]) => {
214
- if (!s.userText) return o;
215
- const g = o || {};
216
- return g[f] = { userText: s.userText }, g;
217
- }, null);
218
- r({ value: b, secondaryValue: y, questionId: i, type: l }, d);
219
- } });
220
- }, Er = ({ className: n, labels: i, message: l, properties: r, next: t, questionId: d, type: b }) => {
221
- const [y, o] = $(null), { border: f, useMobileStyling: s, viewDocument: g, isLongFormSurvey: a, focusedQuestionId: k, update: m } = V((w) => ({ border: w.border, useMobileStyling: w.useMobileStyling, viewDocument: w.viewDocument, isLongFormSurvey: se(w.studyType), focusedQuestionId: w.focusedQuestionId, update: w.update })), h = a && k === d, q = i && i.left, T = i && i.right;
222
- return Z(() => {
223
- m();
224
- }, [m]), e("form", { className: B(n, "ul-card--nps", "fade-in-transition", a && !h && "ul-card--unfocused"), children: [e(te, { isRequired: a && (r == null ? void 0 : r.required), message: l, properties: r }), e(ue, { properties: r, children: [e(ie, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((w, I) => e("button", { className: B(X("nps-number", s), X(`nps-number-${I}`, s)), id: `option-${I}`, onClick: (L) => {
225
- a && (L.preventDefault(), L.stopPropagation(), o(I)), t({ value: I, questionId: d, type: b }, !0);
226
- }, onKeyDown: (L) => {
227
- var U, R;
228
- const P = g.querySelectorAll("button.nps-number");
229
- L.key === "ArrowRight" ? (U = P[I + 1]) == null || U.focus() : L.key === "ArrowLeft" ? (R = P[I - 1]) == null || R.focus() : L.key !== "Enter" && L.key !== " " || (a && (L.preventDefault(), L.stopPropagation(), o(I)), t({ value: I, questionId: d, type: b }, !0));
230
- }, onPointerDown: (L) => {
231
- L.currentTarget.style.zIndex = "2", L.currentTarget.style.borderColor = f;
232
- }, onPointerLeave: (L) => {
233
- L.currentTarget.style.zIndex = "auto", L.currentTarget.style.borderColor = Re;
234
- }, style: y === I ? { backgroundColor: f, color: "#fff" } : void 0, tabIndex: 0, children: I }, I)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: q }), e("span", { children: T })] })] }), !r.required && !a && e(ce, { children: e("div", { className: "ul-vertical-centered-container", children: e(Y, { onClick: (w) => {
235
- w.preventDefault(), w.stopPropagation(), t({ value: null, questionId: d, type: b }, !0);
236
- }, children: pe(r) }) }) })] })] }, d);
237
- }, Ur = ({ className: n, message: i, next: l, properties: r, questionId: t, type: d, showIndividualSubmit: b = !1, onSubmitButtonClick: y }) => {
238
- const { border: o, useMobileStyling: f, update: s, isLongFormSurvey: g, focusedQuestionId: a, setFocusedQuestionId: k, isPreview: m } = V((c) => ({ border: c.border, useMobileStyling: c.useMobileStyling, update: c.update, isLongFormSurvey: se(c.studyType), focusedQuestionId: c.focusedQuestionId, setFocusedQuestionId: c.setFocusedQuestionId, isPreview: c.isPreview })), [h, q] = $(""), T = ne(null), w = g && a === t;
239
- Z(() => {
240
- var c, S;
241
- g && !m && (w ? (c = T.current) == null || c.focus() : (S = T.current) == null || S.blur());
242
- }, [g, w, m]);
243
- const I = h.trim(), L = r.required === !0 && !I, P = vr(T, () => s()), U = (c) => {
244
- c.preventDefault(), c.stopPropagation(), l({ value: h, questionId: t, type: d }, !r.required || I.length > 0), y && y();
245
- }, R = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
246
- return e("form", { className: B(n, "ul-card-text", "fade-in-transition", g && !w && "ul-card--unfocused"), id: "text-form", onClick: () => {
247
- g && a !== t && k(t);
248
- }, children: [e(te, { isRequired: g && (r == null ? void 0 : r.required), message: i, properties: r }), e(ue, { properties: r, children: e("div", { className: "ul-card-text", children: e(ie, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": R, className: B(X("ul-card-text__input", f)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (c) => {
249
- c.currentTarget.style.borderColor = Re;
250
- }, onChange: (c) => {
251
- const { value: S } = c.currentTarget;
252
- if (P(), c.preventDefault(), c.stopPropagation(), q(S), g) {
253
- const D = S.trim().length > 0;
254
- l({ value: S, questionId: t, type: d }, D);
255
- }
256
- }, onFocus: (c) => {
257
- c.currentTarget.style.borderColor = o, k(t);
258
- }, placeholder: R, ref: T, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(xe, { className: "footer", html: r.footerHtml }), b && e(Se, { handleSubmit: U, isSubmitDisabled: L }), e(ce, { children: !g && e(Y, { disabled: L, onClick: U, children: pe(r) }) })] }) }) })] }, t);
259
- }, we = 1, We = 2, Ze = 3, Ie = (n) => n.type === "av_permission", Fe = (n) => n.type === "screen_permission", ze = (n, i) => n === void 0 ? we : n ? ((l, r) => !(Ie(r) ? r.permissionDescriptors : []).includes("camera") || l.getVideoTracks().length > 0)(n, i) ? Ze : we : We, Oe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
260
- }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, de = sr((n) => ({ ...Oe, reset: () => {
261
- n(Oe);
262
- }, updatePage: (i) => {
263
- n(i);
264
- } }));
265
- function Le({ currentPage: n, pages: i }) {
266
- const { avStream: l, recordingMediaTypes: r, updatePage: t } = de.getState(), { recorderEventEmitter: d } = V.getState();
267
- d.emit("av.permission", { "permission.descriptors": n.permissionDescriptors, "stream.ready": (b, y) => {
268
- if (l === b) return;
269
- let o = n;
270
- if (b && !n.permissionDescriptors.includes("camera")) {
271
- const f = i.indexOf(n), s = y != null && y.active ? f + 2 : f + 1;
272
- y != null && y.active && r && d.emit("begin.recording", { "recording.media.types": r, "start.recording.callback": (g) => t({ mediaRecordingUids: g }) }), o = i[s];
273
- }
274
- t({ currentPage: o, avStream: b });
275
- } });
276
- }
277
- function Pe({ status: n }) {
278
- const { nextQuestion: i, passthroughData: l, mediaRecordingUids: r, reset: t } = de.getState(), { recorderEventEmitter: d, handleUploadUpdate: b, index: y } = V.getState(), o = { value: { taskStatus: n }, type: "recordedtask", questionId: (l == null ? void 0 : l.questionId) || 1 };
279
- l && d.emit("finish.task", { "begin.callback": (f) => {
280
- b({ mediaRecordingUid: f, isSubmitted: !0, progressPct: 0, isComplete: !1 });
281
- }, "progress.callback": (f, s) => {
282
- b({ mediaRecordingUid: f, progressPct: s.detail, isSubmitted: !1, isComplete: !1 });
283
- }, "upload.callback": (f) => {
284
- f && b({ mediaRecordingUid: f, isComplete: !0, isSubmitted: !0, progressPct: 100 });
285
- }, "passthrough.data": l, "current.index": y, "task.response": o, "task.complete.callback": (f) => {
286
- o.value.taskDurationMillisecond = f, r && (o.value.mediaRecordingUids = r), t(), i(o);
287
- } });
288
- }
289
- function Me({ pages: n, setIsRequestingPermission: i }) {
290
- const { recorderEventEmitter: l, eventEmitFn: r } = V.getState(), { updatePage: t, currentPage: d, recordingMediaTypes: b, screenPermissionRequested: y } = de.getState();
291
- if (!d) return;
292
- const o = n.indexOf(d);
293
- switch (d.type) {
294
- case "av_permission": {
295
- const f = y ? o + 2 : o + 1;
296
- return y && b && l.emit("begin.recording", { "recording.media.types": b, "start.recording.callback": (s) => {
297
- t({ mediaRecordingUids: s });
298
- } }), void t({ currentPage: n[f] });
299
- }
300
- case "screen_permission":
301
- return void l.emit("screen.permission", { "screen.permission.requested": i, "stream.ready.callback": (f, s) => {
302
- const g = s ? n[o + 1] : d;
303
- s && b && l.emit("begin.recording", { "recording.media.types": b, "start.recording.callback": (a) => {
304
- t({ captureStream: s, mediaRecordingUids: a });
305
- } }), t({ currentPage: g, screenPermissionRequested: !0, captureStream: s });
306
- } });
307
- case "start_task":
308
- return r("recorded.task.start"), l.emit("recorded.task.start"), l.emit("start.task"), void t({ currentPage: n[o + 1], screenPermissionRequested: !0 });
309
- case "complete_task":
310
- return;
311
- }
312
- }
313
- const Ye = "ul-permission-graphics-container", Ke = "ul-permission-body", Xe = B(Ye, "ul_recorded-task-inset-spacing"), Te = B("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Je = ({ richTextBody: n }) => e(xe, { className: "ul-rich-text-body", html: n, id: "ul-task-detail-container" }), Ce = ({ required: n, skipButtonText: i, bottom: l = !1 }) => n ? null : e(Y, { className: B(l && "ul-skip-button-below", "ul-button-inactive"), onClick: Pe.bind(null, { status: "abandoned" }), children: i || "Skip" }), Ee = (n) => {
314
- const { avStream: i, captureStream: l, recordingMediaTypes: r, updatePage: t } = de.getState(), d = (r == null ? void 0 : r.includes("audio")) || (r == null ? void 0 : r.includes("video"));
315
- Z(() => {
316
- const b = setInterval(() => {
317
- d && i && !i.active ? t({ avStream: null, currentPage: n[0] }) : l && l.active || t({ captureStream: void 0, currentPage: n[d ? 1 : 0] });
318
- }, 1e3);
319
- return () => clearInterval(b);
320
- }, [i, l, d, n, r, t]);
321
- }, Br = ({ content: n, pages: i, required: l }) => {
322
- const { buttonText: r, skipButtonText: t, taskDetail: d } = n;
323
- return Ee(i), e("div", { className: "ul-task-page", children: [d && e(Je, { richTextBody: d }), e("div", { className: Te, children: [e(Y, { onClick: Me.bind(null, { pages: i }), children: r }), e(Ce, { required: l, skipButtonText: t })] })] }, "start-task");
324
- }, Fr = ({ content: n, pages: i, properties: l }) => {
325
- const { buttonText: r, skipButtonText: t } = n;
326
- return Ee(i), e("div", { className: "ul-task-page", children: [n.taskDetail && e(Je, { richTextBody: n.taskDetail }), e(ue, { properties: l, children: e("div", { className: Te, children: [e(Y, { className: "ul-complete-task-button", onClick: Pe.bind(null, { status: "completed" }), children: r }), e(Y, { className: B("ul-button-inactive"), onClick: Pe.bind(null, { status: "given.up" }), children: t })] }) })] }, "complete-task");
327
- }, Or = ({ content: n, pages: i, required: l }) => {
328
- const { buttonText: r, skipButtonText: t } = n, [d] = V((o) => [o.tabTitle]), [b, y] = $(!1);
329
- return e("div", { children: [e("div", { className: Xe, children: [e("p", { style: { marginTop: "auto" }, children: n.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Ke, children: d }) })] }), e("div", { className: l ? "" : Te, children: [e(Y, { disabled: b, onClick: Me.bind(null, { pages: i, setIsRequestingPermission: y }), children: r }), e(Ce, { required: l, skipButtonText: t })] })] });
330
- }, Qr = ({ content: n }) => e(xe, { className: B(Ye, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: n.svg }, "ul-permission-request-graphic"), Ar = ({ content: n, pages: i, required: l }) => {
331
- const { permissionDeniedHeadline: r, permissionDeniedBody: t, skipButtonText: d, tryAgainButtonText: b } = n, y = Ie(i[0]) ? i[0] : null;
332
- return Z(() => {
333
- const o = setInterval(() => {
334
- y !== null && Le({ currentPage: y, pages: i });
335
- }, 1e3);
336
- return () => clearInterval(o);
337
- }, [y, i]), y ? e("div", { children: [e("div", { className: Xe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: r }), e("span", { className: Ke, children: t })] }) }), e("div", { className: Te, children: [e(Y, { onClick: Le.bind(null, { currentPage: y, pages: i }), children: b }), e(Ce, { required: l, skipButtonText: d })] })] }) : null;
338
- }, $r = ({ stream: n }) => e("video", { autoPlay: !0, className: B("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (i) => {
339
- i && (i.srcObject = n || null);
340
- } }), Hr = ({ content: n, pages: i, required: l }) => {
341
- const { skipButtonText: r } = n, { avStream: t } = de.getState();
342
- return Ee(i), e("div", { children: [e($r, { stream: t }), e("div", { className: "ul-vertical-button-container-center", children: [e(Y, { onClick: Me.bind(null, { pages: i }), children: n.buttonText }), e(Ce, { bottom: !0, required: l, skipButtonText: r })] })] });
343
- }, Gr = ({ properties: n }) => {
344
- const { pages: i, required: l } = n, { avStream: r, currentPage: t } = de.getState();
345
- if (t === void 0) return null;
346
- switch (t == null ? void 0 : t.type) {
347
- case "av_permission": {
348
- const d = ze(r, t);
349
- return d === we ? e(Qr, { content: t }) : e(d === We ? Ar : Hr, { content: t, pages: i, required: l });
350
- }
351
- case "screen_permission":
352
- return e(Or, { content: t, pages: i, required: l });
353
- case "start_task":
354
- return e(Br, { content: t, pages: i, required: l });
355
- case "complete_task":
356
- return e(Fr, { content: t, pages: i, properties: n });
357
- default:
358
- return null;
359
- }
360
- }, Vr = ({ className: n, properties: i, next: l, questionId: r }) => {
361
- const t = V(), { surveyId: d, responseGroupUid: b, userId: y } = t, o = de(), { screenPermissionRequested: f } = o, s = de((h) => h.avStream);
362
- let g = de((h) => h.currentPage);
363
- g || (g = function({ pages: h, userId: q, responseGroupUid: T, surveyId: w, questionId: I, next: L }) {
364
- const { updatePage: P } = de.getState(), { eventEmitFn: U, recorderEventEmitter: R } = V.getState(), c = { questionId: I, surveyId: w, visitorId: q, responseGroupUid: T };
365
- let S = 0;
366
- R.emit("recorded.task.permission.screen"), U("recorded.task.permission.screen"), R.emit("permission.status", { "permission.status.callback": (F, p, x, _) => {
367
- const v = h[S], { type: u } = v, N = ["screen"];
368
- if (Ie(v)) {
369
- const { permissionDescriptors: M } = v, W = M == null ? void 0 : M.includes("microphone"), Q = M == null ? void 0 : M.includes("camera");
370
- W && N.push("audio"), Q && N.push("video"), (F != null && F.active && !Q || F != null && F.active && p) && S++;
371
- }
372
- Fe(h[S]) && x && (S++, R.emit("begin.recording", { "recording.media.types": N, "start.recording.callback": (M) => P({ mediaRecordingUids: M }) })), P({ currentPage: h[S], avStream: F, screenPermissionRequested: x, nextQuestion: L, type: u, passthroughData: c, recordingMediaTypes: N, captureStream: _ });
373
- } });
374
- const D = h[S];
375
- return D.type === "av_permission" && Le({ currentPage: D, pages: h }), D;
376
- }({ questionId: r, surveyId: d, next: (h) => {
377
- l(h, !0);
378
- }, pages: i.pages, responseGroupUid: b, userId: y }));
379
- let a = g.headline, k = g.captionText;
380
- const m = ze(s, g);
381
- return Fe(g) && f && (a = g.permissionDeniedHeadline, k = g.permissionDeniedCaptionText), Ie(g) && m === Ze && (a = g.permissionGrantedHeadline, k = g.permissionGrantedCaptionText), e("div", { className: B(n, "ul-center-horizontally", "fade-in-transition"), children: [e(te, { isRequired: i == null ? void 0 : i.required, message: a, properties: { captionText: k } }), e(ie, { children: e(Gr, { properties: i }) })] });
382
- }, jr = ({ richTextBody: n, plaintextBody: i, update: l }) => (Z(() => {
383
- l();
384
- }, [l]), n ? e(xe, { className: "ul-rich-text-body", html: n, id: "ul-card__text-url-body-container" }) : i ? e("div", { className: "ul-rich-text-body", id: "ul-card__text-url-body-container", children: (i ? i.split(/\n\s*\n/g) : []).map((r, t) => e("p", { children: r }, t)) }) : null), Wr = ({ className: n, message: i, next: l, properties: r, questionId: t, type: d }) => {
385
- const { visitorAttributes: b, isLongFormSurvey: y, update: o } = V((a) => ({ visitorAttributes: a.visitorAttributes, isLongFormSurvey: se(a.studyType), update: a.update })), f = (a, k = !1) => {
386
- l({ value: k ? { skipped: !0 } : void 0, questionId: t, type: d }, !0);
387
- }, s = fr(r && r.buttonUrl, b), g = y && r.promptActionType === yr.NO_BUTTON;
388
- return e("div", { className: B(n, "ul-card__text-url-prompt", "fade-in-transition"), children: [e(te, { isRequired: y && (r == null ? void 0 : r.required), message: i, properties: { questionHtml: r.questionHtml } }), e(ie, { children: e(jr, { plaintextBody: r == null ? void 0 : r.body, richTextBody: r == null ? void 0 : r.richTextBody, update: o }) }), e(ue, { properties: r, children: !g && e(ce, { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: s, id: "ul-card-text__button", onClick: f, onKeyPress: (a) => {
389
- a.key !== "Enter" && a.key !== " " || l({ value: void 0, questionId: t, type: d }, !0);
390
- }, rel: "noreferrer", role: s ? "link" : "button", tabIndex: 0, target: "_blank", children: pe(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (a) => f(0, !0), children: De(r) })] }) }) })] }, t);
391
- }, Zr = ({ className: n, questionId: i }) => {
392
- const { border: l, destroy: r, endCard: t, forceBrandedLogo: d } = V((o) => ({ border: o.border, destroy: o.destroy, endCard: o.endCard, forceBrandedLogo: o.forceBrandedLogo }));
393
- Z(() => {
394
- setTimeout(() => {
395
- r(hr);
396
- }, d ? 4e3 : 2e3);
397
- }, [r, d]);
398
- const b = t && t.subheader ? e("p", { className: "ul-caption", children: t.subheader }) : null, y = t && t.headline ? t.headline : "";
399
- return e("div", { className: B(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: l, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: l, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(te, { message: y }), b] }) }) }, i);
400
- }, ge = "ul-card-video__player_recorder", Qe = "ul-video-btn", qe = 0, Ae = 1, zr = ({ className: n, message: i, next: l, properties: r, questionId: t, type: d }) => {
401
- const { apiURL: b, envId: y, handleUploadUpdate: o, headers: f, responseGroupUid: s, surveyId: g, update: a, viewDocument: k, visitorId: m } = V((v) => ({ apiURL: v.apiURL, envId: v.envId, handleUploadUpdate: v.handleUploadUpdate, headers: v.headers, responseGroupUid: v.responseGroupUid, surveyId: v.surveyId, update: v.update, viewDocument: v.viewDocument, visitorId: v.userId })), [h, q] = $(!1), [T, w] = $(null), [I, L] = $(null), [P, U] = $(qe), [R, c] = $(null), [S, D] = $(null), F = r && r.videoUrl, p = ye((v) => {
402
- v && c(v);
403
- }, [c]);
404
- Z(() => {
405
- const v = new ResizeObserver(() => {
406
- setTimeout(a, 0);
407
- });
408
- return S && v.observe(S), R && v.observe(R), () => {
409
- S && v.unobserve(S), R && v.unobserve(R);
410
- };
411
- }, [a, S, R]), Z(() => {
412
- a();
413
- }, []);
414
- const x = (v, u) => {
415
- v === re.UPLOAD_STARTED ? (w(u[re.UPLOAD_ID]), L(u[re.MEDIA_RECORDING_UID]), q(!0)) : v === re.DELETE ? (w(null), L(null), q(!1)) : v === re.UPLOAD_PROGRESS ? isNaN(u[re.UPLOAD_PROGRESS_PCT]) ? o({ mediaRecordingUid: u[re.MEDIA_RECORDING_UID], isComplete: !0 }) : o({ mediaRecordingUid: u[re.MEDIA_RECORDING_UID], progressPct: u[re.UPLOAD_PROGRESS_PCT] }) : v === re.UPLOAD_FINISHED && o({ mediaRecordingUid: u[re.MEDIA_RECORDING_UID], isComplete: !0 });
416
- }, _ = (v) => {
417
- v.preventDefault(), v.stopPropagation(), document.getElementById(ge) && _r(ge), T && I ? (o({ mediaRecordingUid: I, isSubmitted: !0 }), l({ value: { mediaRecordingUid: I }, questionId: t, type: d }, !0)) : l({ value: null, questionId: t, type: d }, !0);
418
- };
419
- return e("form", { className: B(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(te, { isRequired: r == null ? void 0 : r.required, message: i, properties: r }), e(ie, { children: [e("div", { id: "ul-question-player-container", ref: p, style: { display: P === qe ? "" : "none" }, children: [e("div", { id: ge, ref: (v) => {
420
- if (v && v.children.length === 0 && !r.hideRecordedPrompt) {
421
- D(v);
422
- const u = xr(ge, { src: F, type: "application/x-mpegURL" }, void 0, r.mediaType === re.MEDIA_TYPE_AUDIO, b, k);
423
- v.appendChild(u);
424
- }
425
- } }), e(ue, { properties: r, children: e("button", { className: `${Qe} ul-record-response-btn`, onClick: (v) => {
426
- v.preventDefault(), v.stopPropagation(), document.getElementById(ge) && Sr(ge), U(Ae);
427
- } }) })] }), e("div", { style: { display: P === Ae ? "block" : "none" }, children: [e("button", { className: `${Qe} ul-back-question-btn`, onClick: (v) => {
428
- v.preventDefault(), v.stopPropagation(), U(qe);
429
- }, style: { display: r.hideRecordedPrompt ? "none" : "block" } }), e("div", { id: "ul-recorder-player-container", ref: (v) => {
430
- if (v && v.children.length === 0) {
431
- D(v);
432
- const u = kr(ge, { surveyId: g, responseGroupUid: s, questionId: t, visitorId: m, envId: y }, b, x, void 0, { ...f, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === re.MEDIA_TYPE_AUDIO, k);
433
- v.appendChild(u);
434
- }
435
- } })] })] }), e(ce, { children: [e(Y, { disabled: !h, onClick: _, children: pe(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: _, style: { display: r.required ? "none" : "block", ...h ? { display: "none" } : {} }, children: De(r) })] })] });
436
- }, Yr = ({ className: n }) => {
437
- const { uploadProgress: i } = V((d) => ({ uploadProgress: d.uploadProgress }));
438
- let l, r;
439
- Object.values(i).filter((d) => d.isSubmitted).length > 1 ? (l = "Your responses are processing", r = "Please keep this tab open until your responses are fully processed.") : (l = "Your response is processing", r = "Please keep this tab open until your response is fully processed.");
440
- const t = Math.round(Math.min(99, ...Object.values(i).filter((d) => d.isSubmitted).map((d) => d.progressPct || 0)));
441
- return e("div", { className: B(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(te, { message: `${l} (${t}% complete)` }), e("p", { className: "ul-caption", children: r })] });
442
- }, er = ar(void 0), Kr = ({ value: n, children: i }) => e(er.Provider, { value: n, children: i }), Xr = ({ isRightLabel: n, isLeftLabel: i }) => n ? le.RIGHT : i ? le.LEFT : null, Jr = "Best", et = "Worst", rt = ({ className: n, labels: i, message: l, properties: r, options: t, questionId: d, type: b, next: y }) => {
443
- var L, P, U, R;
444
- const [o, f] = $(t.map((c, S) => ({ ...c, label: c.label === "" ? `Item ${S + 1}` : c.label, isRightLabel: !1, isLeftLabel: !1 }))), s = (() => {
445
- const c = or(er);
446
- if (c === void 0) throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");
447
- return c;
448
- })(), g = { padding: "24px", display: "flex", cursor: "pointer", width: "auto" }, [a, k] = $(!1);
449
- Z(() => {
450
- const c = o.findIndex((u) => u.isRightLabel), S = o.findIndex((u) => u.isLeftLabel), D = c !== -1 && S !== -1;
451
- k(D);
452
- const F = !r.required || r.required && D, p = o.map((u) => ({ id: u.id, option: u.label, selected: Xr(u) })), x = Math.floor(d), _ = Object.keys(s).filter((u) => u.startsWith(x.toString())).map(Number).sort((u, N) => u - N).at(-1), v = [];
453
- if (typeof _ == "number") {
454
- const u = s[_], N = JSON.parse(u);
455
- v.push(...N);
456
- }
457
- v.push(p), setTimeout(() => {
458
- y({ value: v, questionId: d, type: b }, F, D), k(!1);
459
- }, D ? 500 : 0);
460
- }, [o]);
461
- const { border: m, useMobileStyling: h, enableCspTrustedTypes: q } = V((c) => ({ border: c.border, useMobileStyling: c.useMobileStyling, enableCspTrustedTypes: c.enableCspTrustedTypes })), T = (c, S) => () => {
462
- a || f((D) => ((F, p, x) => F.map((_) => _.id === p ? { ..._, isRightLabel: x === le.RIGHT, isLeftLabel: x === le.LEFT } : x === le.RIGHT && _.isRightLabel || x === le.LEFT && _.isLeftLabel ? { ..._, isRightLabel: !1, isLeftLabel: !1 } : _))(D, c, S));
463
- }, w = (L = r.ratingIcons) == null ? void 0 : L[0].svg, I = (P = r.ratingIcons) == null ? void 0 : P[1].svg;
464
- return e("form", { className: B(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(te, { isRequired: r == null ? void 0 : r.required, message: l, properties: r }), e(ie, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (i == null ? void 0 : i.left) || ((U = r == null ? void 0 : r.labels) == null ? void 0 : U.left) || Jr }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (i == null ? void 0 : i.right) || ((R = r == null ? void 0 : r.labels) == null ? void 0 : R.right) || et }), o.map(({ id: c, label: S, isLeftLabel: D, isRightLabel: F }) => e(fe, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (I ? "smiley" : ""), children: I ? e($e, { ariaPressed: D, className: D ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: q, html: I, id: `smiley-good-${c}`, onClick: T(c, le.LEFT) }) : e(ve, { allowTextEntry: !1, ariaLabel: `bestLabel-${S}`, border: m, choiceStyle: g, error: !1, id: `${c}`, isRadio: !0, isSelected: D, onUserInputChanged: T(c, le.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: S }), e("div", { className: "ul-card-maxdiff__option-control " + (w ? "smiley" : ""), children: w ? e($e, { ariaPressed: F, className: F ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: q, html: w, id: `smiley-bad-${c}`, onClick: T(c, le.RIGHT) }) : e(ve, { allowTextEntry: !1, ariaLabel: `worstLabel-${S}`, border: m, choiceStyle: g, error: !1, id: `${c}`, isRadio: !0, isSelected: F, onUserInputChanged: T(c, le.RIGHT), useMobileStyling: h }) })] }))] }) })] }, d);
465
- }, $e = ({ enableCspTrustedTypes: n, ariaPressed: i, className: l, html: r, id: t, onClick: d }) => {
466
- const b = be(() => Ge(r, n), [n, r]);
467
- return e("span", { "aria-pressed": i, className: l, dangerouslySetInnerHTML: { __html: b }, id: t, onClick: d, tabIndex: 0, type: "button" });
468
- }, tt = ({ className: n, labels: i, message: l, next: r, properties: t, questionId: d, type: b, onSubmitButtonClick: y, options: o, showIndividualSubmit: f = !1 }) => {
469
- const s = ne(null), g = ne(0), a = ne(0), k = ne(null), m = ne(!1), h = ne([]), [q, T] = $(() => (t == null ? void 0 : t.required) === !0), [w, I] = $(() => o.map((C) => ({ ...C, rank: null }))), L = be(() => Array.from({ length: o.length }, (C, O) => O + 1), [o.length]), { isLongFormSurvey: P, focusedQuestionId: U, setFocusedQuestionId: R, useMobileStyling: c, isPreview: S, headers: D, update: F } = V((C) => ({ useMobileStyling: C.useMobileStyling, isLongFormSurvey: se(C.studyType), focusedQuestionId: C.focusedQuestionId, setFocusedQuestionId: C.setFocusedQuestionId, isPreview: C.isPreview, headers: C.headers, update: C.update })), p = (D == null ? void 0 : D["userleap-platform"]) === "android", x = c && !S && !p, _ = !x && !p, v = P && U === d, u = (C) => {
470
- C.preventDefault(), z(w), y && y();
471
- }, N = (C, O) => {
472
- I((A) => {
473
- const E = parseInt(O), H = A.map((G) => ({ ...G }));
474
- H.some((G) => G.rank == null) && H.forEach((G, he) => G.rank = he + 1);
475
- const oe = H.findIndex((G) => G.id === C);
476
- if (oe === -1) return A;
477
- const j = H[oe].rank;
478
- return E < j ? H.forEach((G) => {
479
- G.id !== C && G.rank >= E && G.rank < j && (G.rank = G.rank + 1);
480
- }) : E > j && H.forEach((G) => {
481
- G.id !== C && G.rank > j && G.rank <= E && (G.rank = G.rank - 1);
482
- }), H[oe].rank = E, H.sort((G, he) => G.rank - he.rank), ae(H), H;
483
- });
484
- }, M = (C, O) => {
485
- for (let A = 0; A < h.current.length; A++) {
486
- const E = h.current[A];
487
- if (!E || E === k.current) continue;
488
- const H = E.getBoundingClientRect();
489
- if (C >= H.left && C <= H.right && O >= H.top && O <= H.bottom) return { element: E, index: A };
490
- }
491
- return null;
492
- }, W = (C) => (O) => {
493
- if (!x) return;
494
- O.preventDefault(), O.stopPropagation(), m.current = !0, s.current = C;
495
- const A = O.touches[0];
496
- g.current = A.clientY, a.current = A.clientY;
497
- const E = O.currentTarget.closest(".ul-card-rank__option");
498
- E && (k.current = E, E.classList.add("is-dragging"));
499
- }, Q = (C) => {
500
- if (!x || !m.current || s.current === null) return;
501
- C.preventDefault(), C.stopPropagation();
502
- const O = C.touches[0];
503
- a.current = O.clientY;
504
- const A = a.current - g.current;
505
- k.current && (k.current.style.transform = `translateY(${A}px)`, k.current.style.zIndex = "1000"), h.current.forEach((H) => {
506
- H && H !== k.current && H.classList.remove("is-drop-target");
507
- });
508
- const E = M(O.clientX, O.clientY);
509
- E && E.element.classList.add("is-drop-target");
510
- }, K = (C) => {
511
- if (!x || !m.current || s.current === null) return;
512
- C.preventDefault(), C.stopPropagation();
513
- const O = C.changedTouches[0], A = M(O.clientX, O.clientY);
514
- k.current && (k.current.style.transform = "", k.current.style.zIndex = "", k.current.classList.remove("is-dragging")), h.current.forEach((E) => {
515
- E && E.classList.remove("is-drop-target");
516
- }), A && A.index !== s.current && J(s.current, A.index), s.current = null, k.current = null, m.current = !1;
517
- }, J = (C, O) => {
518
- I((A) => {
519
- const E = A.map((oe) => ({ ...oe })), [H] = E.splice(C, 1);
520
- return E.splice(O, 0, H), E.forEach((oe, j) => {
521
- oe.rank = j + 1;
522
- }), ae(E), E;
523
- });
524
- }, z = (C) => {
525
- const O = {};
526
- C.reduce((A, E) => (A[E.id] = E.rank, A), O), r({ value: O, questionId: d, type: b }, !0);
527
- }, ae = (C) => {
528
- T(!1), P && z(C);
529
- }, { left: ee, right: me } = i, ke = o.length, rr = (C) => {
530
- C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
531
- }, tr = (C) => {
532
- C.currentTarget.classList.remove("is-drop-target");
533
- }, nr = (C) => {
534
- s.current = null, C.currentTarget.classList.remove("is-dragging");
535
- };
536
- return Z(() => {
537
- F();
538
- }, [F]), e("form", { className: B(n, "ul-card-rank", "fade-in-transition", P && !v && "ul-card--unfocused"), onClick: P ? () => {
539
- P && U !== d && R(d);
540
- } : void 0, onSubmit: u, children: [e(te, { isRequired: t == null ? void 0 : t.required, message: l, properties: t }), e(ue, { properties: t, children: e(fe, p ? { children: [e(ie, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", ee] }) }), e("ol", { className: "ul-card-rank__list", children: w.map(({ id: C, label: O, rank: A }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${O}`, className: B("ul-card-rank__select", A == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (E) => N(C, E.currentTarget.value), value: A ?? "", children: [A == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), L.map((E) => e("option", { className: "ul-card-rank__select-option", value: E, children: E }, `${E}-${d}`))] }), e("span", { children: O })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ke, " - ", me] }) })] }), f && e(Se, { handleSubmit: u, isSubmitDisabled: q })] }), !P && e(ce, { children: e("div", { className: "ul-card__button-wrapper", children: e(Y, { disabled: q, children: pe(t) }) }) })] } : { children: [e(ie, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", ee] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: p ? void 0 : (C) => {
541
- C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
542
- }, children: w.map(({ id: C, label: O, rank: A }, E) => {
543
- return e("li", { className: "ul-card-rank__option", draggable: !!_ || void 0, onDragEnd: _ ? nr : void 0, onDragEnter: _ ? rr : void 0, onDragLeave: _ ? tr : void 0, onDragStart: _ ? (oe = E, (j) => {
544
- s.current = oe, j.dataTransfer && (j.dataTransfer.effectAllowed = "move", j.dataTransfer.setData("text/plain", String(oe)), j.currentTarget.classList.add("is-dragging"));
545
- }) : void 0, onDrop: _ ? (H = E, (j) => {
546
- var he, Ue;
547
- j.preventDefault(), j.currentTarget.classList.remove("is-drop-target");
548
- const G = s.current;
549
- s.current = null, (Ue = (he = j.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : he.querySelector(".is-dragging")) == null || Ue.classList.remove("is-dragging"), G != null && G !== H && J(G, H);
550
- }) : void 0, ref: (j) => h.current[E] = j, children: [e("select", { "aria-label": `Rank for ${O}`, className: B("ul-card-rank__select", A == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (j) => N(C, j.currentTarget.value), value: A ?? "", children: [A == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), L.map((j) => e("option", { className: "ul-card-rank__select-option", value: j, children: j }, `${j}-${d}`))] }), e("span", { children: O }), !p && e("button", { "aria-label": `Drag ${O} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: x ? K : void 0, onTouchMove: x ? Q : void 0, onTouchStart: x ? W(E) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, C);
551
- var H, oe;
552
- }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ke, " - ", me] }) })] }), f && e(Se, { handleSubmit: u, isSubmitDisabled: q })] }), !P && e(ce, { children: e("div", { className: "ul-card__button-wrapper", children: e(Y, { disabled: q, children: pe(t) }) }) })] }) })] }, d);
553
- }, nt = /* @__PURE__ */ new Set(["open", "matrix", "multipleselect", "multiplechoice", "rankorder"]), He = ({ cardInstance: n, moveToNextQuestion: i, showIndividualSubmit: l, submitQuestion: r, updateCardValues: t }) => {
554
- const { isLongFormSurvey: d } = V((a) => ({ isLongFormSurvey: se(a.studyType) }));
555
- if (!n) return null;
556
- const { name: b, type: y, props: o } = n, f = l && nt.has(y), s = { className: "ul-card", next: (a, k, m = !0) => r(a, k && m), questionId: b, type: y, showIndividualSubmit: l, ...f ? { next: (a, k) => {
557
- t(a.questionId, a, k ?? !0);
558
- }, onSubmitButtonClick: () => i(b) } : {} }, g = (() => {
559
- switch (y) {
560
- case "consentlegal":
561
- return e(Ir, { ...s, ...o });
562
- case "likert":
563
- return e(Cr, { ...s, ...o });
564
- case "matrix":
565
- return e(Dr, { ...s, ...o });
566
- case "maxdiff":
567
- return e(rt, { ...s, ...o });
568
- case "multiplechoice":
569
- return e(Rr, { ...s, ...o });
570
- case "multipleselect":
571
- return e(Mr, { ...s, ...o });
572
- case "nps":
573
- return e(Er, { ...s, ...o });
574
- case "open":
575
- return e(Ur, { ...s, ...o });
576
- case "rankorder":
577
- return e(tt, { ...s, ...o });
578
- case "recordedtask":
579
- return e(Vr, { ...s, ...o });
580
- case "texturlprompt":
581
- return e(Wr, { ...s, ...o });
582
- case "thanks":
583
- return e(Zr, { ...s, ...o });
584
- case "uploading":
585
- return e(Yr, { ...s, ...o });
586
- case "videovoice":
587
- return e(zr, { ...s, ...o });
588
- default:
589
- return null;
590
- }
591
- })();
592
- return g ? d ? e("div", { className: "ul-card-scroll-wrapper", children: g }, b) : g : null;
593
- }, it = ({ isSubmitDisabled: n = !1, onSubmit: i, buttonText: l }) => {
594
- var k;
595
- const { cards: r, forceBrandedLogo: t, index: d, marketingUrl: b, showSurveyBrand: y, slugName: o, surveyId: f, useMobileStyling: s } = V((m) => ({ cards: m.cards, forceBrandedLogo: m.forceBrandedLogo, index: m.index, marketingUrl: m.marketingUrl, showSurveyBrand: m.showSurveyBrand, slugName: m.slugName, surveyId: m.surveyId, useMobileStyling: m.useMobileStyling })), g = ((k = r[d]) == null ? void 0 : k.type) === "thanks", a = dr({ marketingUrl: b, slugName: o, surveyId: f, forceBrandedLogo: t });
596
- return e("footer", { className: B("long-form-question-footer-container", s && "long-form-question-footer-container--mobile", g && "long-form-question-footer-container-center"), children: [g && t ? e(lr, { marketingUrlLink: a }) : e("div", { className: "long-form-question-footer-container-logo", children: y ? e(cr, { forceBrandedLogo: t, marketingUrlLink: a }) : null }), !g && e("div", { className: B("ul-card__button-wrapper", "ul-card-vertical__button-wrapper", "long-form-question-footer-container-actions"), children: e(Y, { className: B("long-form-button", n && "sprig-button-disabled"), disabled: n, onClick: i, children: e("span", { className: "long-form-button-text-container", children: l ?? e(ur, { stroke: "white" }) }) }) })] });
597
- }, dt = ({ cards: n, next: i, previousResponses: l }) => {
598
- var F;
599
- const [r, t] = $({}), [d, b] = $({}), y = be(() => ({ ...l, ...pr(n.map((p) => {
600
- var x, _;
601
- return { ...p, value: ((x = r[p.name]) == null ? void 0 : x.value) ?? null, secondaryValue: ((_ = r[p.name]) == null ? void 0 : _.secondaryValue) ?? null };
602
- })) }), [l, r, n]), o = mr(n, y), { isLongFormSurvey: f, focusedQuestionId: s, setFocusedQuestionId: g, update: a, index: k } = V((p) => ({ index: p.index, isLongFormSurvey: se(p.studyType), focusedQuestionId: p.focusedQuestionId, setFocusedQuestionId: p.setFocusedQuestionId, update: p.update })), m = ne(null), h = ne(!1), q = ne(null);
603
- gr(() => {
604
- a();
605
- }, [a, k]);
606
- const T = ye((p) => {
607
- var u, N;
608
- h.current = !0;
609
- const x = n.findIndex((M) => M.name === p);
610
- if (!f || p === null || x === -1) return void (h.current = !1);
611
- const _ = (u = m.current) == null ? void 0 : u.querySelectorAll(".ul-card-scroll-wrapper")[x], v = (N = m.current) == null ? void 0 : N.closest(".ul-card__container");
612
- if (_ && v) {
613
- if (_ && v) {
614
- const M = _.getBoundingClientRect(), W = v.getBoundingClientRect(), Q = M.top - W.top + v.scrollTop, K = Q + M.height / 2, J = window.innerHeight - 157;
615
- let z;
616
- M.height >= J ? z = Q : z = K - v.clientHeight / 2;
617
- const ae = v.clientHeight, ee = v.scrollHeight - ae, me = Math.max(0, Math.min(z, ee));
618
- v.scrollTo({ top: me, behavior: "smooth" }), setTimeout(() => {
619
- h.current = !1;
620
- }, 500);
621
- }
622
- } else h.current = !1;
623
- }, [f, n]);
624
- function w(p, x) {
625
- return p.map((_) => {
626
- const v = x[_.name], u = o.find((N) => N.name === _.name);
627
- return { ...v, questionText: u ? Be(u) : void 0 };
628
- });
629
- }
630
- Z(() => {
631
- s !== null && n.findIndex((p) => p.name === s) !== -1 || g(n[0].name);
632
- }, [n, s, g]);
633
- const I = (p) => {
634
- if (!f) return;
635
- const x = n.findIndex((_) => _.name === p) + 1;
636
- if (x < n.length) {
637
- const _ = n[x].name;
638
- g(_);
639
- } else g(p);
640
- };
641
- Z(() => {
642
- f && s !== null && (q.current !== s ? T(s) : q.current = null);
643
- }, [s, f, T]);
644
- const L = ye(() => {
645
- var W, Q;
646
- if (h.current) return;
647
- const p = (W = m.current) == null ? void 0 : W.closest(".ul-card__container");
648
- if (!p) return;
649
- const x = (Q = m.current) == null ? void 0 : Q.querySelectorAll(".ul-card-scroll-wrapper");
650
- if (!x || x.length === 0) return;
651
- const _ = p.getBoundingClientRect(), v = _.top + _.height / 2;
652
- let u = 0, N = 1 / 0;
653
- x.forEach((K, J) => {
654
- const z = K.getBoundingClientRect(), ae = z.top + z.height / 2, ee = Math.abs(v - ae);
655
- ee < N && (N = ee, u = J);
656
- });
657
- const M = n[u];
658
- q.current = M.name, g(M.name);
659
- }, [n, g]);
660
- Z(() => {
661
- var x;
662
- if (!f) return;
663
- const p = ((x = m.current) == null ? void 0 : x.closest(".ul-card__container")) || null;
664
- return p && p.addEventListener("scroll", L, { passive: !0 }), () => {
665
- p && p.removeEventListener("scroll", L);
666
- };
667
- }, [L, f]);
668
- const P = be(() => Object.values(d).every((p, x) => {
669
- var v;
670
- const _ = n[x];
671
- return !(!(_ != null && _.props) || !("properties" in _.props) || ((v = _.props.properties) == null ? void 0 : v.required) !== !1) || p;
672
- }), [d, n]), U = async (p, x, _) => {
673
- return b((u) => ({ ...u, [p]: _ })), await (v = (u) => ({ ...u, [p]: x }), new Promise((u) => {
674
- t((N) => {
675
- const M = v(N);
676
- return u(M), M;
677
- });
678
- }));
679
- var v;
680
- };
681
- Z(() => {
682
- if (!f) return;
683
- const p = {};
684
- n.forEach((x) => {
685
- var v, u;
686
- const _ = x;
687
- (u = (v = _.props) == null ? void 0 : v.properties) != null && u.required || (p[_.name] = { value: null, questionId: _.name, type: _.type });
688
- }), t(p), b({});
689
- }, [n, f]);
690
- const R = async (p, x) => {
691
- if (f) {
692
- const _ = await U(p.questionId, p, x), v = c(p.type), u = S(p.type);
693
- if (v && I(p.questionId), u && x) {
694
- const N = w(n, _);
695
- i(N);
696
- }
697
- } else {
698
- const _ = o.find((u) => u.name === p.questionId), v = { ...p, questionText: _ ? Be(_) : void 0 };
699
- i([v]);
700
- }
701
- }, c = (p) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(p), S = (p) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(p), D = ((F = n[0]) == null ? void 0 : F.type) === "thanks";
702
- return f ? e("div", { className: "ul-card-list-container--longform", "data-testid": "ui-container", ref: m, children: [e(Kr, { value: l, children: o.map((p, x) => e(He, { cardInstance: p, moveToNextQuestion: I, showIndividualSubmit: f && n.length > 1 && x < n.length - 1, submitQuestion: R, updateCardValues: U }, (p == null ? void 0 : p.name) || x)) }), !D && e(it, { isSubmitDisabled: Object.keys(r).length < n.length || !P, onSubmit: function() {
703
- const p = w(n, r);
704
- i(p);
705
- } })] }) : e(fe, { children: [e("div", { "data-testid": "ui-container", style: { display: "none" } }), o.map((p, x) => e(He, { cardInstance: p, moveToNextQuestion: I, showIndividualSubmit: f && n.length > 1 && x < n.length - 1, submitQuestion: R, updateCardValues: U }, (p == null ? void 0 : p.name) || x))] });
706
- };
707
- export {
708
- dt as PageCard
709
- };