UNPKG

@sprig-technologies/sprig-browser

Version:

npm package for the sprig web sdk

488 lines 57.4 kB
import { a as O, u as e, h as H, e as z, i as le, c as A, b as j, g as ie, f as Te, p as te, F as pe, _ as ee, T as de, A as Ke, M as he, j as Xe, P as We, k as Je, l as et, m as tt, n as rt, D as ke, w as Ue, o as nt, t as at } from "./view-CvoT_Cd7.js"; import { v as st, R as Z, B as W, M as J, Q as re, O as we, a as ne, S as it, L as ot, u as lt, H as me, b as _e, g as ct, s as Pe, c as dt, d as ut, D as pt } from "./videoPlayer-DGWjJmY2.js"; import { b as ye, D as Ae, A as Ne, g as mt } from "./core-BtQuNcD-.js"; import { t as Ee } from "./metricsReporter-CVAZgxNJ.js"; const ht = ({ properties: t, surveyVideoUrl: s, questionId: r }) => { const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: i } = O((c) => ({ apiURL: c.apiURL, viewDocument: c.viewDocument })); return e("div", { id: n, ref: (c) => { if ((c == null ? void 0 : c.children.length) === 0 && !t.properties.hideRecordedPrompt) { const l = st(n, { src: s, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === Z.MEDIA_TYPE_AUDIO, a, i); c.appendChild(l); } } }); }, gt = () => e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), ae = ({ isDisabled: t, onClick: s, children: r, style: n, showCheckmark: a }) => { const i = a ?? (typeof r == "string" && r.toLowerCase() === "finish"); return e(W, { disabled: !!t, onClick: s, style: n, type: "button", children: [i && e("span", { style: { paddingRight: "4px" }, children: e(gt, {}) }), r] }); }, vt = ({ className: t, next: s, properties: r, questionId: n, type: a, isAnswered: i }) => { const { useMobileStyling: c, border: l, cards: m } = O((o) => ({ useMobileStyling: o.useMobileStyling, border: o.border, cards: o.cards })), [u, y] = H(!1), [h, d] = H(""), [b, q] = H(!1), v = r == null ? void 0 : r.collectName, N = (r == null ? void 0 : r.nameLabelText) || "Full Name", I = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", k = z({ buttonText: (r == null ? void 0 : r.submitButtonText) || "Submit" }), _ = le(n, m), S = !!h.trim(), M = u && (!v || S), G = (o, f = !1) => { o.preventDefault(), o.stopPropagation(); let x = null; if (!f) { if (!M) return void q(!0); x = { submitted: !0 }, v && (x.name = h); } s({ value: x, questionId: n, type: a }, !!f || M); }; return e("div", { className: A(t, "ul-card__consent-legal", "fade-in-transition"), children: e(J, { embeddedType: "pdf", properties: r, children: e(re, { children: [e("div", { className: "sprig-stretch", children: [e(we, { allowTextEntry: !1, border: l, error: b && !u, id: "consent", isRadio: !1, isSelected: u, label: I, onUserInputChanged: ({ selected: o }) => { o !== u && y(!u); }, useMobileStyling: c }), v && e("input", { "aria-label": N, "aria-placeholder": N, className: A(j("ul-consent-legal__name-input", c)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (o) => { o.currentTarget.style.borderColor = b && !S ? ye : Ae; }, onFocus: (o) => { o.currentTarget.style.borderColor = b && !S ? ye : l; }, onInput: (o) => { o.preventDefault(), o.stopPropagation(), d(o.currentTarget.value); }, placeholder: N, style: b && !S ? { borderColor: ye } : {}, tabIndex: 0, value: h })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: !i && (r.required ? e(ae, { isDisabled: !M, onClick: (o) => G(new SubmitEvent(o.type)), showCheckmark: _, children: k }) : e(ie, { children: [e(ae, { isDisabled: !M, onClick: (o) => G(new SubmitEvent(o.type)), showCheckmark: _, children: k }), e("button", { className: "ul-card-skip__button", onClick: (o) => G(new SubmitEvent(o.type), !0), children: Te(r) })] })) })] }) }) }, n); }, bt = () => { const { destroy: t, forceBrandedLogo: s } = O((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo })); return te(() => { setTimeout(() => { t(Ne); }, s ? 4e3 : 2e3); }, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" }); }, yt = ({ activeValue: t, border: s, icon: r, enableCspTrustedTypes: n, isPressed: a, range: i, scaleLabelType: c, selectedValue: l, setSelectedValue: m, setActiveValue: u, setIsPressed: y, useMobileStyling: h, value: d, viewDocument: b }) => { const q = `option-${d}`, v = c === "number", N = c === "star", I = c === "smiley", k = v && d === t || d === l, [_, S] = (() => { const o = N && l !== null && d <= l; return N && d <= t || I && d === t || o || d === t || d === l ? [s, a || o || d === l ? 1 : 0.3] : ["", 1]; })(), M = pe(() => { const o = { borderColor: k ? _ : "", fillOpacity: k ? "" : S, zIndex: k ? 3 : "auto", color: l === d ? "#fff" : "" }; return v ? { ...o, backgroundColor: l === d ? _ : "" } : { ...o, color: N || I || l === d ? _ : "" }; }, [k, _, S, l, d, v, N, I]), G = pe(() => mt((({ icon: o, scaleLabelType: f, value: x, selectedValue: T }) => { if (f === "smiley" && x === T) { let g = 0; return o.replace(/black/g, () => ++g == 1 ? "black" : "white"); } return o; })({ icon: r, scaleLabelType: c, value: d, selectedValue: l }), n), [n, r, c, l, d]); return e("button", { "aria-label": v ? void 0 : String(d), className: (() => { switch (c) { case "star": return A(j("likert-star", h), j(`likert-star-${d}`, h)); case "smiley": return A(j("likert-smiley", h), j(`likert-smiley-${d}`, h)); default: return d === i ? A(j("likert-number", h), j(`likert-number-${d}`, h), j("likert-last-option", h)) : A(j("likert-number", h), j(`likert-number-${d}`, h)); } })(), dangerouslySetInnerHTML: { __html: G }, id: q, onClick: (o) => { o.preventDefault(), o.stopPropagation(), m(d); }, onKeyDown: (o) => { var T, g; const f = b.querySelectorAll(`.likert-${c ?? "number"}`), x = d - 1; o.key === "ArrowRight" ? (T = f[x + 1]) == null || T.focus() : o.key === "ArrowLeft" ? (g = f[x - 1]) == null || g.focus() : o.key !== "Enter" && o.key !== " " || (o.preventDefault(), o.stopPropagation(), m(d)); }, onPointerDown: () => y(!0), onPointerEnter: () => u(d), onPointerLeave: () => { u(-1), y(!1); }, style: M, tabIndex: 0 }); }, ft = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i, isAnswered: c }) => { const { border: l, useMobileStyling: m, viewDocument: u, enableCspTrustedTypes: y, cards: h } = O((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, viewDocument: p.viewDocument, enableCspTrustedTypes: p.enableCspTrustedTypes, cards: p.cards })), [d, b] = H(-1), [q, v] = H(!1), [N, I] = H(null), k = s && s.left, _ = s && s.right; let S; const { range: M, scaleLabelType: G, ratingIcons: o } = n; M && (S = Number(M)); const f = S || 5, x = (p) => { var w, P; switch (G) { case "star": return (w = o[0]) == null ? void 0 : w.svg; case "smiley": return (P = o[p]) == null ? void 0 : P.svg; default: return String(p + 1); } }, T = z(n), g = le(a, h); return e("form", { className: A(t, "ul-card--likert", "fade-in-transition"), children: e(J, { properties: n, children: [e(ne, { children: [e("div", { "aria-label": `Rating (1 - ${f})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(f)].map((p, w) => { const P = w + 1; return e(yt, { activeValue: d, border: l, enableCspTrustedTypes: y, icon: x(w), isPressed: q, range: f, scaleLabelType: G, selectedValue: N, setActiveValue: b, setIsPressed: v, setSelectedValue: I, useMobileStyling: m, value: P, viewDocument: u }, w); }) }), (k || _) && e("div", { className: "ul-card--likert__labels", children: [e("span", { children: k }), e("span", { children: _ })] })] }), e(re, { children: !c && e(ae, { isDisabled: N === null && n.required, onClick: () => { r({ value: N, questionId: a, type: i }, !0); }, showCheckmark: g, children: T }) })] }) }, a); }, kt = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => { const a = ee([]), { border: i, useMobileStyling: c } = O((d) => ({ border: d.border, useMobileStyling: d.useMobileStyling })), l = r.findIndex((d) => n[d.id] === null), [m, u] = H(l), y = de((d, b) => { s(d, b); const q = m + 1, v = r[q]; v && n[v.id] === null && u(q); }, [s, r, n, m]), h = de((d, b) => { const q = m === d; return e(Ke, { animate: !0, header: b.label, isOpen: q, onClick: () => { var v; return u(q && !((v = window.UserLeap) != null && v.isMobileSDK) ? -1 : d); }, ref: (v) => { v && (a.current[d] = v); }, showHeaderCheck: n[b.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((v) => e(we, { allowTextEntry: !1, ariaLabel: `${b.label}-${v.label}`, border: i, error: !1, id: `${b.id}-${v.value}`, isRadio: !0, isSelected: n[b.id] === v.value, label: v.label, onUserInputChanged: () => y(b.id, v.value), useMobileStyling: c }, v.label)) }) }, b.id); }, [i, t, m, y, n, c]); return e("div", { children: r.map((d, b) => h(b, d)) }); }, xt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: i, onSubmitButtonClick: c, isAnswered: l }) => { const { cards: m } = O((k) => ({ cards: k.cards })), u = n.matrixColumn, y = n.required, h = (k) => { k.preventDefault(), k.stopPropagation(), s({ value: b, questionId: a, type: i }, !0), c && c(); }, d = r.reduce((k, _) => (k[_.id] = null, k), {}), [b, q] = H(d), v = z(n), N = le(a, m); return e("form", { className: A(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: h, children: e(J, { properties: n, children: [e(ne, { children: e(kt, { columns: u, onSelect: (k, _) => { q((S) => ({ ...S, [k]: _ })); }, options: r, selectedOptions: b }) }), e(re, { children: !l && e(ae, { isDisabled: (I = b, y && Object.values(I).every((k) => k == null)), onClick: () => h(new SubmitEvent("submit")), showCheckmark: N, children: v }) })] }) }, a); var I; }, Be = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: i, showIndividualSubmit: c = !1, onSubmitButtonClick: l, isAnswered: m }) => { const { border: u, useMobileStyling: y, cards: h } = O((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, cards: p.cards })), d = r.reduce((p, w) => (p[w.id] = { isSelected: !1 }, p), {}), [b, q] = H(d), v = i === "multiplechoice", N = n.required, I = r.find((p) => { var w; return (w = p.optionProperties) == null ? void 0 : w.noneOfTheAbove; }), k = (p) => Object.entries(p).some(([w, P]) => { var E; const B = r.find((V) => `${V.id}` === w), L = P.userText === void 0 || P.userText.trim() === ""; return ((E = B == null ? void 0 : B.optionProperties) == null ? void 0 : E.allowsTextEntry) && L && P.isSelected; }), _ = (p) => Object.values(p).filter((w) => w.isSelected).length, S = n.minSelect && n.minSelect > 0 && n.maxSelectMode === he.Range && _(b) < n.minSelect && (N || _(b) > 0), M = (p) => k(p) || N && !_(p) || !((w) => { const { minSelect: P = 0, maxSelect: B = 1 / 0, maxSelectMode: L } = n, E = _(w); switch (L) { case he.Maximum: return E <= B; case he.Range: return E === 0 || E >= P; default: return !0; } })(p), G = Object.entries(b).some(([p, w]) => { var P, B; return w.isSelected && ((B = (P = r.find((L) => `${L.id}` === p)) == null ? void 0 : P.optionProperties) == null ? void 0 : B.allowsTextEntry); }), o = c && (!v || G), f = (p) => { g(p.id, p.selected, p.userText, p.noneOfTheAbove); }, x = (p) => { var w; return (n == null ? void 0 : n.maxSelectMode) !== he.Unlimited && _(b) === (n == null ? void 0 : n.maxSelect) && !((w = b[p]) != null && w.isSelected); }, T = () => { s(b, !0), l && l(); }, g = (p, w, P, B) => { const L = Object.assign({}, b); if ((v || B) && w) for (const E of Object.values(L)) E.isSelected = !1, delete E.userText; else I && !B && b[I.id].isSelected && (L[I.id].isSelected = !1); L[p] = { isSelected: w, userText: P }, q(L); }; return e("form", { className: A(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: T, children: e(J, { properties: n, children: [e(ne, { children: [n.isDropdown ? e(it, { disabledOptions: r.filter((p) => x(p.id)), dropdownFooter: S ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [_(b), "/", n.minSelect] }) : void 0, isMultiSelect: !v, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (p) => { const w = { ...b }; for (const P of r) p.includes(P) ? w[P.id].isSelected = !0 : w[P.id].isSelected = !1; q(w); }, options: r, placeholderText: n.dropdownPlaceholderText ?? (v ? "Select choice" : "Select choice(s)"), value: r.filter((p) => b[p.id].isSelected) }) : e("div", { className: A(j("ul-card__choices", y)), role: v ? "radiogroup" : "group", children: [r.map(({ id: p, label: w, value: P, optionProperties: B }) => { var K, se; const L = `${p}`, { allowsTextEntry: E, noneOfTheAbove: V } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...B }; return e(we, { allowTextEntry: E, border: u, disabled: x(L), error: k({ [L]: b[L] }), id: L, isRadio: v, isSelected: !!((K = b[L]) != null && K.isSelected), label: w, noneOfTheAbove: V, onUserInputChanged: f, promptText: (B == null ? void 0 : B.otherOptionPlaceholder) || "Please specify", text: (se = b[p]) == null ? void 0 : se.userText, useMobileStyling: y, value: P }, L); }), !!S && e("div", { className: "ul-card__min-select-counter", children: [_(b), "/", n.minSelect] })] }), o && e(ot, { handleSubmit: T, isSubmitDisabled: M(b) })] }), !m && e(re, { children: e(ae, { isDisabled: M(b), onClick: T, showCheckmark: le(a, h), children: z(n) }) })] }) }, a); }, Ct = (t) => { const { questionId: s, type: r, next: n, options: a } = t; return e(Be, { ...t, onSubmit: (i, c) => { const l = Object.entries(i).find(([, d]) => d.isSelected) || [void 0, void 0], [m, u] = l, y = a.find((d) => `${d.id}` === m), h = u != null && u.userText ? { [m]: { userText: u.userText } } : null; n({ value: y && m ? { [m]: y.value } : {}, secondaryValue: h, questionId: s, type: r }, c); } }); }, St = (t) => { const { questionId: s, type: r, next: n } = t; return e(Be, { ...t, onSubmit: (a, i) => { const c = Object.entries(a).reduce((m, [u, y]) => (m[u] = y.isSelected, m), {}), l = Object.entries(a).reduce((m, [u, y]) => { if (!y.userText) return m; const h = m || {}; return h[u] = { userText: y.userText }, h; }, null); n({ value: c, secondaryValue: l, questionId: s, type: r }, i); } }); }, Tt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: i, isAnswered: c }) => { const [l, m] = H(null), { border: u, useMobileStyling: y, viewDocument: h, cards: d } = O((N) => ({ border: N.border, useMobileStyling: N.useMobileStyling, viewDocument: N.viewDocument, cards: N.cards })), b = s && s.left, q = s && s.right, v = le(a, d); return e("form", { className: A(t, "ul-card--nps", "fade-in-transition"), children: e(J, { properties: r, children: [e(ne, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((N, I) => e("button", { className: A(j("nps-number", y), j(`nps-number-${I}`, y)), id: `option-${I}`, onClick: (k) => { k.preventDefault(), k.stopPropagation(), m(I); }, onKeyDown: (k) => { var S, M; const _ = h.querySelectorAll("button.nps-number"); k.key === "ArrowRight" ? (S = _[I + 1]) == null || S.focus() : k.key === "ArrowLeft" ? (M = _[I - 1]) == null || M.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), m(I)); }, onPointerDown: (k) => { k.currentTarget.style.zIndex = "2"; }, onPointerLeave: (k) => { k.currentTarget.style.zIndex = "auto"; }, style: l === I ? { backgroundColor: u, color: "#fff" } : void 0, tabIndex: 0, children: I }, I)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: b }), e("span", { children: q })] })] }), e(re, { children: !c && e(ae, { isDisabled: l === null && r.required, onClick: () => { n({ value: l, questionId: a, type: i }, !0); }, showCheckmark: v, children: z(r) }) })] }) }, a); }, wt = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: i, isAnswered: c }) => { const { border: l, useMobileStyling: m, update: u, cards: y } = O((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, update: S.update, cards: S.cards })), [h, d] = H(""), b = ee(null), q = h.trim(), v = r.required === !0 && !q, N = lt(b, () => u()), I = r && r.openTextPlaceholder ? r.openTextPlaceholder : "", k = z(r), _ = le(n, y); return e("form", { className: A(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(J, { properties: r, children: e("div", { className: "ul-card-text", children: [e(ne, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": I, className: A(j("ul-card-text__input", m)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (S) => { S.currentTarget.style.borderColor = Ae; }, onChange: (S) => { const { value: M } = S.currentTarget; N(), S.preventDefault(), S.stopPropagation(), d(M); }, onFocus: (S) => { S.currentTarget.style.borderColor = l; }, placeholder: I, ref: b, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(me, { className: "footer", html: r.footerHtml })] }), e(re, { children: !c && e(ae, { isDisabled: v, onClick: (S) => { S.preventDefault(), S.stopPropagation(); const M = r.required !== !0 || q.length > 0; s({ value: h, questionId: n, type: a }, M), i && i(); }, showCheckmark: _, children: k }) })] }) }) }, n); }, _t = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i, onSubmitButtonClick: c, options: l, isAnswered: m }) => { const u = ee(null), y = ee(0), h = ee(0), d = ee(null), b = ee(!1), q = ee([]), [v, N] = H(() => (n == null ? void 0 : n.required) === !0), [I, k] = H(() => l.map((C) => ({ ...C, rank: null }))), _ = pe(() => Array.from({ length: l.length }, (C, R) => R + 1), [l.length]), { useMobileStyling: S, isPreview: M, headers: G } = O((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), o = (G == null ? void 0 : G["userleap-platform"]) === "android", f = S && !M && !o, x = !f && !o, T = (C, R) => { k((U) => { const D = parseInt(R), Q = U.map(($) => ({ ...$ })); Q.some(($) => $.rank == null) && Q.forEach(($, ce) => $.rank = ce + 1); const Y = Q.findIndex(($) => $.id === C); if (Y === -1) return U; const F = Q[Y].rank; return D < F ? Q.forEach(($) => { $.id !== C && $.rank >= D && $.rank < F && ($.rank = $.rank + 1); }) : D > F && Q.forEach(($) => { $.id !== C && $.rank > F && $.rank <= D && ($.rank = $.rank - 1); }), Q[Y].rank = D, Q.sort(($, ce) => $.rank - ce.rank), E(), Q; }); }, g = (C, R) => { for (let U = 0; U < q.current.length; U++) { const D = q.current[U]; if (!D || D === d.current) continue; const Q = D.getBoundingClientRect(); if (C >= Q.left && C <= Q.right && R >= Q.top && R <= Q.bottom) return { element: D, index: U }; } return null; }, p = (C) => (R) => { if (!f) return; R.preventDefault(), R.stopPropagation(), b.current = !0, u.current = C; const U = R.touches[0]; y.current = U.clientY, h.current = U.clientY; const D = R.currentTarget.closest(".ul-card-rank__option"); D && (d.current = D, D.classList.add("is-dragging")); }, w = (C) => { if (!f || !b.current || u.current === null) return; C.preventDefault(), C.stopPropagation(); const R = C.touches[0]; h.current = R.clientY; const U = h.current - y.current; d.current && (d.current.style.transform = `translateY(${U}px)`, d.current.style.zIndex = "1000"), q.current.forEach((Q) => { Q && Q !== d.current && Q.classList.remove("is-drop-target"); }); const D = g(R.clientX, R.clientY); D && D.element.classList.add("is-drop-target"); }, P = (C) => { if (!f || !b.current || u.current === null) return; C.preventDefault(), C.stopPropagation(); const R = C.changedTouches[0], U = g(R.clientX, R.clientY); d.current && (d.current.style.transform = "", d.current.style.zIndex = "", d.current.classList.remove("is-dragging")), q.current.forEach((D) => { D && D.classList.remove("is-drop-target"); }), U && U.index !== u.current && B(u.current, U.index), u.current = null, d.current = null, b.current = !1; }, B = (C, R) => { k((U) => { const D = U.map((Y) => ({ ...Y })), [Q] = D.splice(C, 1); return D.splice(R, 0, Q), D.forEach((Y, F) => { Y.rank = F + 1; }), E(), D; }); }, L = (C) => { const R = {}; C.reduce((U, D) => (U[D.id] = D.rank, U), R), r({ value: R, questionId: a, type: i }, !0); }, E = () => { N(!1); }, { left: V, right: K } = s, se = l.length, Ze = (C) => { C.preventDefault(), C.currentTarget.classList.add("is-drop-target"); }, Ye = (C) => { C.currentTarget.classList.remove("is-drop-target"); }, ze = (C) => { u.current = null, C.currentTarget.classList.remove("is-dragging"); }; return e("form", { className: A(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => { C.preventDefault(), L(I), c && c(); }, children: e(J, { properties: n, children: e(ie, o ? { children: [e(ne, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", V] }) }), e("ol", { className: "ul-card-rank__list", children: I.map(({ id: C, label: R, rank: U }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${R}`, className: A("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (D) => T(C, D.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), _.map((D) => e("option", { className: "ul-card-rank__select-option", value: D, children: D }, `${D}-${a}`))] }), e("span", { children: R })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [se, " - ", K] }) })] }) }), e(re, { children: !m && e("div", { className: "ul-card__button-wrapper", children: e(W, { disabled: v, children: z(n) }) }) })] } : { children: [e(ne, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", V] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: o ? void 0 : (C) => { C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move"); }, children: I.map(({ id: C, label: R, rank: U }, D) => { return e("li", { className: "ul-card-rank__option", draggable: !!x || void 0, onDragEnd: x ? ze : void 0, onDragEnter: x ? Ze : void 0, onDragLeave: x ? Ye : void 0, onDragStart: x ? (Y = D, (F) => { u.current = Y, F.dataTransfer && (F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", String(Y)), F.currentTarget.classList.add("is-dragging")); }) : void 0, onDrop: x ? (Q = D, (F) => { var ce, qe; F.preventDefault(), F.currentTarget.classList.remove("is-drop-target"); const $ = u.current; u.current = null, (qe = (ce = F.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ce.querySelector(".is-dragging")) == null || qe.classList.remove("is-dragging"), $ != null && $ !== Q && B($, Q); }) : void 0, ref: (F) => q.current[D] = F, children: [e("select", { "aria-label": `Rank for ${R}`, className: A("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (F) => T(C, F.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), _.map((F) => e("option", { className: "ul-card-rank__select-option", value: F, children: F }, F))] }), e("span", { children: R }), !o && e("button", { "aria-label": `Drag ${R} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: f ? P : void 0, onTouchMove: f ? w : void 0, onTouchStart: f ? p(D) : 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); var Q, Y; }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [se, " - ", K] }) })] }) }), e(re, { children: !m && e("div", { className: "ul-card__button-wrapper", children: e(W, { disabled: v, children: z(n) }) }) })] }) }) }, a); }, xe = 1, $e = 2, Oe = 3, ge = (t) => t.type === "av_permission", Le = (t) => t.type === "screen_permission", Qe = (t, s) => t === void 0 ? xe : t ? ((r, n) => !(ge(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Oe : xe : $e, Re = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => { }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, X = Xe((t) => ({ ...Re, reset: () => { t(Re); }, updatePage: (s) => { t(s); } })); function Ce({ currentPage: t, pages: s }) { const { avStream: r, recordingMediaTypes: n, updatePage: a } = X.getState(), { recorderEventEmitter: i } = O.getState(); i.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (c, l) => { if (r === c) return; let m = t; if (c && !t.permissionDescriptors.includes("camera")) { const u = s.indexOf(t), y = l != null && l.active ? u + 2 : u + 1; l != null && l.active && n && i.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (h) => a({ mediaRecordingUids: h }) }), m = s[y]; } a({ currentPage: m, avStream: c }); } }); } function Se({ status: t }) { const { nextQuestion: s, passthroughData: r, mediaRecordingUids: n, reset: a } = X.getState(), { recorderEventEmitter: i, handleUploadUpdate: c, index: l } = O.getState(), m = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 }; r && i.emit("finish.task", { "begin.callback": (u) => { c({ mediaRecordingUid: u, isSubmitted: !0, progressPct: 0, isComplete: !1 }); }, "progress.callback": (u, y) => { c({ mediaRecordingUid: u, progressPct: y.detail, isSubmitted: !1, isComplete: !1 }); }, "upload.callback": (u) => { u && c({ mediaRecordingUid: u, isComplete: !0, isSubmitted: !0, progressPct: 100 }); }, "passthrough.data": r, "current.index": l, "task.response": m, "task.complete.callback": (u) => { m.value.taskDurationMillisecond = u, n && (m.value.mediaRecordingUids = n), a(), s(m); } }); } function Ie({ pages: t, setIsRequestingPermission: s }) { const { recorderEventEmitter: r, eventEmitFn: n } = O.getState(), { updatePage: a, currentPage: i, recordingMediaTypes: c, screenPermissionRequested: l } = X.getState(); if (!i) return; const m = t.indexOf(i); switch (i.type) { case "av_permission": { const u = l ? m + 2 : m + 1; return l && c && r.emit("begin.recording", { "recording.media.types": c, "start.recording.callback": (y) => { a({ mediaRecordingUids: y }); } }), void a({ currentPage: t[u] }); } case "screen_permission": return void r.emit("screen.permission", { "screen.permission.requested": s, "stream.ready.callback": (u, y) => { const h = y ? t[m + 1] : i; y && c && r.emit("begin.recording", { "recording.media.types": c, "start.recording.callback": (d) => { a({ captureStream: y, mediaRecordingUids: d }); } }), a({ currentPage: h, screenPermissionRequested: !0, captureStream: y }); } }); case "start_task": return n("recorded.task.start"), r.emit("recorded.task.start"), r.emit("start.task"), void a({ currentPage: t[m + 1], screenPermissionRequested: !0 }); case "complete_task": return; } } const Fe = "ul-permission-graphics-container", He = "ul-permission-body", Ge = A(Fe, "ul_recorded-task-inset-spacing"), ve = A("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Ve = ({ richTextBody: t }) => e(me, { className: "ul-rich-text-body", html: t, id: "ul-task-detail-container" }), be = ({ required: t, skipButtonText: s, bottom: r = !1 }) => t ? null : e(W, { className: A(r && "ul-skip-button-below", "ul-button-inactive"), onClick: Se.bind(null, { status: "abandoned" }), children: s || "Skip" }), De = (t) => { const { avStream: s, captureStream: r, recordingMediaTypes: n, updatePage: a } = X.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video")); te(() => { const c = setInterval(() => { i && s && !s.active ? a({ avStream: null, currentPage: t[0] }) : r && r.active || a({ captureStream: void 0, currentPage: t[i ? 1 : 0] }); }, 1e3); return () => clearInterval(c); }, [s, r, i, t, n, a]); }, Nt = ({ content: t, pages: s, required: r }) => { const { buttonText: n, skipButtonText: a, taskDetail: i } = t; return De(s), e("div", { className: "ul-task-page", children: [i && e(Ve, { richTextBody: i }), e("div", { className: ve, children: [e(W, { onClick: Ie.bind(null, { pages: s }), children: n }), e(be, { required: r, skipButtonText: a })] })] }, "start-task"); }, It = ({ content: t, pages: s, properties: r }) => { const { buttonText: n, skipButtonText: a } = t; return De(s), e("div", { className: "ul-task-page", children: [t.taskDetail && e(Ve, { richTextBody: t.taskDetail }), e(J, { properties: r, children: e("div", { className: ve, children: [e(W, { className: "ul-complete-task-button", onClick: Se.bind(null, { status: "completed" }), children: n }), e(W, { className: A("ul-button-inactive"), onClick: Se.bind(null, { status: "given.up" }), children: a })] }) })] }, "complete-task"); }, Dt = ({ content: t, pages: s, required: r }) => { const { buttonText: n, skipButtonText: a } = t, [i] = O((m) => [m.tabTitle]), [c, l] = H(!1); return e("div", { children: [e("div", { className: Ge, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: He, children: i }) })] }), e("div", { className: r ? "" : ve, children: [e(W, { disabled: c, onClick: Ie.bind(null, { pages: s, setIsRequestingPermission: l }), children: n }), e(be, { required: r, skipButtonText: a })] })] }); }, qt = ({ content: t }) => e(me, { className: A(Fe, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), Pt = ({ content: t, pages: s, required: r }) => { const { permissionDeniedHeadline: n, permissionDeniedBody: a, skipButtonText: i, tryAgainButtonText: c } = t, l = ge(s[0]) ? s[0] : null; return te(() => { const m = setInterval(() => { l !== null && Ce({ currentPage: l, pages: s }); }, 1e3); return () => clearInterval(m); }, [l, s]), l ? e("div", { children: [e("div", { className: Ge, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: He, children: a })] }) }), e("div", { className: ve, children: [e(W, { onClick: Ce.bind(null, { currentPage: l, pages: s }), children: c }), e(be, { required: r, skipButtonText: i })] })] }) : null; }, Lt = ({ stream: t }) => e("video", { autoPlay: !0, className: A("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (s) => { s && (s.srcObject = t || null); } }), Rt = ({ content: t, pages: s, required: r }) => { const { skipButtonText: n } = t, { avStream: a } = X.getState(); return De(s), e("div", { children: [e(Lt, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(W, { onClick: Ie.bind(null, { pages: s }), children: t.buttonText }), e(be, { bottom: !0, required: r, skipButtonText: n })] })] }); }, Mt = ({ properties: t }) => { const { pages: s, required: r } = t, { avStream: n, currentPage: a } = X.getState(); if (a === void 0) return null; switch (a == null ? void 0 : a.type) { case "av_permission": { const i = Qe(n, a); return i === xe ? e(qt, { content: a }) : e(i === $e ? Pt : Rt, { content: a, pages: s, required: r }); } case "screen_permission": return e(Dt, { content: a, pages: s, required: r }); case "start_task": return e(Nt, { content: a, pages: s, required: r }); case "complete_task": return e(It, { content: a, pages: s, properties: t }); default: return null; } }, Ut = ({ className: t, properties: s, next: r, questionId: n }) => { const a = O(), { surveyId: i, responseGroupUid: c, userId: l } = a, m = X(), { screenPermissionRequested: u } = m, y = X((v) => v.avStream); let h = X((v) => v.currentPage); h || (h = function({ pages: v, userId: N, responseGroupUid: I, surveyId: k, questionId: _, next: S }) { const { updatePage: M } = X.getState(), { eventEmitFn: G, recorderEventEmitter: o } = O.getState(), f = { questionId: _, surveyId: k, visitorId: N, responseGroupUid: I }; let x = 0; o.emit("recorded.task.permission.screen"), G("recorded.task.permission.screen"), o.emit("permission.status", { "permission.status.callback": (g, p, w, P) => { const B = v[x], { type: L } = B, E = ["screen"]; if (ge(B)) { const { permissionDescriptors: V } = B, K = V == null ? void 0 : V.includes("microphone"), se = V == null ? void 0 : V.includes("camera"); K && E.push("audio"), se && E.push("video"), (g != null && g.active && !se || g != null && g.active && p) && x++; } Le(v[x]) && w && (x++, o.emit("begin.recording", { "recording.media.types": E, "start.recording.callback": (V) => M({ mediaRecordingUids: V }) })), M({ currentPage: v[x], avStream: g, screenPermissionRequested: w, nextQuestion: S, type: L, passthroughData: f, recordingMediaTypes: E, captureStream: P }); } }); const T = v[x]; return T.type === "av_permission" && Ce({ currentPage: T, pages: v }), T; }({ questionId: n, surveyId: i, next: (v) => { r(v, !0); }, pages: s.pages, responseGroupUid: c, userId: l })); let d = h.headline, b = h.captionText; const q = Qe(y, h); return Le(h) && u && (d = h.permissionDeniedHeadline, b = h.permissionDeniedCaptionText), ge(h) && q === Oe && (d = h.permissionGrantedHeadline, b = h.permissionGrantedCaptionText), e("div", { className: A(t, "ul-center-horizontally", "fade-in-transition"), children: [e(_e, { isRequired: s == null ? void 0 : s.required, message: d, properties: { captionText: b } }), e(ne, { children: e(Mt, { properties: s }) })] }); }, At = ({ className: t, next: s, properties: r, questionId: n, type: a, isAnswered: i }) => { const { visitorAttributes: c, isLongFormSurvey: l } = O((h) => ({ visitorAttributes: h.visitorAttributes, isLongFormSurvey: Ee(h.studyType) })), m = (h, d = !1) => { s({ value: d ? { skipped: !0 } : void 0, questionId: n, type: a }, !0); }, u = ct(r && r.buttonUrl, c), y = l && r.promptActionType === We.NO_BUTTON; return e("div", { className: A(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(J, { properties: r, children: !i && !y && e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: u, id: "ul-card-text__button", onClick: m, onKeyPress: (h) => { h.key !== "Enter" && h.key !== " " || s({ value: void 0, questionId: n, type: a }, !0); }, rel: "noreferrer", role: u ? "link" : "button", tabIndex: 0, target: "_blank", children: z(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (h) => m(0, !0), children: Te(r) })] }) }) }) }, n); }, Et = ({ className: t, questionId: s }) => { const { border: r, destroy: n, endCard: a, forceBrandedLogo: i, quotaEndcardText: c } = O((y) => ({ border: y.border, destroy: y.destroy, endCard: y.endCard, forceBrandedLogo: y.forceBrandedLogo, quotaEndcardText: y.quotaEndcardText })); te(() => { setTimeout(() => { n(Ne); }, i ? 4e3 : 2e3); }, [n, i]); const l = (c == null ? void 0 : c.subheader) ?? (a == null ? void 0 : a.subheader), m = l ? e("p", { className: "ul-caption", children: l }) : null, u = (c == null ? void 0 : c.headline) ?? (a == null ? void 0 : a.headline) ?? ""; return e("div", { className: A(t, "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: r, 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: r, 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(_e, { message: u }), m] }) }) }, s); }, Bt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), $t = ({ className: t }) => { const { uploadProgress: s } = O((i) => ({ uploadProgress: i.uploadProgress })); let r, n; Object.values(s).filter((i) => i.isSubmitted).length > 1 ? (r = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (r = "Your response is processing", n = "Please keep this tab open until your response is fully processed."); const a = Math.round(Math.min(99, ...Object.values(s).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0))); return e("div", { className: A(t, "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(_e, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] }); }, Me = 0, Ot = 1, Qt = ({ className: t, next: s, properties: r, questionId: n, type: a, isAnswered: i }) => { const { apiURL: c, envId: l, handleUploadUpdate: m, headers: u, responseGroupUid: y, surveyId: h, viewDocument: d, visitorId: b, cards: q } = O((g) => ({ apiURL: g.apiURL, envId: g.envId, handleUploadUpdate: g.handleUploadUpdate, headers: g.headers, responseGroupUid: g.responseGroupUid, surveyId: g.surveyId, viewDocument: g.viewDocument, visitorId: g.userId, cards: g.cards })), [v, N] = H(!1), [I, k] = H(null), [_, S] = H(null), [M] = H(Me), G = z(r), o = le(n, q); if (i) return null; const f = `ul-card-video__player_recorder-q${n}`, x = (g, p) => { g === Z.UPLOAD_STARTED ? (k(p[Z.UPLOAD_ID]), S(p[Z.MEDIA_RECORDING_UID]), N(!0)) : g === Z.DELETE ? (k(null), S(null), N(!1)) : g === Z.UPLOAD_PROGRESS ? isNaN(p[Z.UPLOAD_PROGRESS_PCT]) ? m({ mediaRecordingUid: p[Z.MEDIA_RECORDING_UID], isComplete: !0 }) : m({ mediaRecordingUid: p[Z.MEDIA_RECORDING_UID], progressPct: p[Z.UPLOAD_PROGRESS_PCT] }) : g === Z.UPLOAD_FINISHED && m({ mediaRecordingUid: p[Z.MEDIA_RECORDING_UID], isComplete: !0 }); }, T = (g) => { g.preventDefault(), g.stopPropagation(), document.getElementById(f) && Pe(f), I && _ ? (m({ mediaRecordingUid: _, isSubmitted: !0 }), s({ value: { mediaRecordingUid: _ }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0); }; return e("form", { className: A(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ne, { children: !i && e("div", { id: "ul-question-player-container", style: { display: M === Me ? "" : "none" }, children: e(J, { properties: r, children: [e(ae, { isDisabled: !v, onClick: () => { Pe(), s({ value: { uploadId: I, mediaRecordingUid: _ }, questionId: n, type: a }, !0); }, showCheckmark: o, children: G }), e("div", { style: { display: M === Ot ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (g) => { if (g && g.children.length === 0) { const p = dt(f, { surveyId: h, responseGroupUid: y, questionId: n, visitorId: b, envId: l }, c, x, void 0, { ...u, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === Z.MEDIA_TYPE_AUDIO, d); g.appendChild(p); } } }) })] }) }) }), !i && e(re, { children: [e(ae, { isDisabled: !!r.required && !v, onClick: T, showCheckmark: o, children: z(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: T, style: { ...r.required ? { display: "none" } : {}, ...v ? { display: "none" } : {} }, children: Te(r) })] })] }); }, ue = (t) => t.type === "aidynamicfollowup" || t.type === "aidynamicstandalone", fe = (t) => { var s; return ue(t) && ((s = t.props) == null ? void 0 : s.loading) === ke.inFlight; }, je = (t) => t.type === "thanks" || t.type === "uploading", Ft = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => { const i = ((l) => "properties" in l.props && l.props.properties && "questionHtml" in l.props.properties && l.props.properties.questionHtml ? { content: l.props.properties.questionHtml, image: l.props.properties.image, isHtml: !0 } : "message" in l.props ? "image" in l.props.properties && l.props.properties.image ? { content: l.props.message, image: l.props.properties.image, isHtml: !1 } : { content: l.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t), c = n && !(i != null && i.image) ? a : null; return e(ie, { children: [(i == null ? void 0 : i.image) && e(oe, { avatars: s, isLeft: !0, ref: n ? a : null, children: !r && e(pt, { image: i.image }) }), e(oe, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: c, children: r ? e(Bt, {}) : e(ie, { children: [i.isHtml ? e(me, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(ht, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) })] }); }, Ht = ({ card: t, avatars: s }) => { const r = ((n) => { if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null; const a = n.props.properties, i = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }]; for (const { key: c, isHtml: l } of i) { const m = a[c]; if (typeof m != "string") continue; const u = m.trim(); if (u) { if (l && !u.replaceAll(/<[^>]*>/g, "").trim()) continue; return { content: u, isHtml: l }; } } return null; })(t); return r ? e(oe, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e(me, { className: "chat-message-text", html: r.content }) : e("div", { className: "chat-message-text", children: r.content }) }) : null; }, Gt = () => { const { providerPersona: t, showProviderPersona: s, experimentFlags: r } = O((a) => ({ providerPersona: a.providerPersona, showProviderPersona: a.showProviderPersona, experimentFlags: a.experimentFlags })); return (r == null ? void 0 : r["sdk-new-convo-ui"]) && s && t ? e("div", { className: "chat-persona-label", children: t }) : null; }, Vt = ({ card: t, userResponse: s, avatars: r }) => { const n = ((a, i) => { if ((a.type === "open" || a.type === "aidynamicfollowup" || a.type === "aidynamicstandalone") && i && typeof i == "object" && "value" in i) return i.value; })(t, s); return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: n || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] }); }, jt = ({ card: t, avatars: s, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => { const { endCard: a, quotaEndcardText: i } = O((m) => ({ endCard: m.endCard, quotaEndcardText: m.quotaEndcardText })), c = (i == null ? void 0 : i.headline) ?? (a == null ? void 0 : a.headline) ?? "Great! Thank you for your participation.", l = (i == null ? void 0 : i.subheader) ?? (a == null ? void 0 : a.subheader); return e(ie, { children: [e(oe, { avatars: s, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: c }, ref: r ? n : null }), l && e(oe, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: l } }), e(bt, {})] }); }, Zt = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: i, startingQuestionIdx: c, currentQuestionBubbleRef: l, handleCardResponse: m }) => { const u = s === r, y = s < r, h = je(t); if (h) return e(jt, { avatars: n, card: t, currentQuestionBubbleRef: l, isCurrentQuestion: u }); const d = `${t.name}`, b = a.get(d), q = t.type === "open" || t.type === "aidynamicfollowup" || t.type === "aidynamicstandalone", v = i.get(d); if (t.type === "aidynamicfollowup" && (t.props.loading === ke.failure || t.props.loading === void 0) || t.type === "aidynamicstandalone" && t.props.loading === ke.failure) return e(ie, {}); const N = (s > (c ?? 0) || ue(t)) && t.type !== "thanks" && t.type !== "uploading" && (v === !0 || v === void 0); return e(Ue.Fragment, { children: [e(Ft, { avatars: n, card: t, currentQuestionBubbleRef: l, isCurrentQuestion: u, isThinking: N }), !N && e(ie, { children: [e(Ht, { avatars: n, card: t }), e(Gt, {})] }), y && q ? e(Vt, { avatars: n, card: t, userResponse: b }) : (!y || !q) && !N && e(oe, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { cl