@sprig-technologies/sprig-browser 2.41.0 → 2.41.1

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.
@@ -1,208 +1,208 @@
1
- import { a as $, u as e, h as O, c as P, b as F, e as K, f as fe, p as re, F as le, _ as J, T as oe, A as Fe, g as ke, i as Ze, j as Ye, k as we, l as ze, m as Ke, n as Xe, w as Re, o as We } from "./view-Bt__MdRk.js";
2
- import { v as Je, R as Z, B as X, M as W, Q as ee, O as xe, a as te, b as ue, S as et, L as tt, u as rt, H as ce, c as Ce, g as nt, P as at, p as st, d as it, s as ot } from "./getAttributedUrl-CVKJ3sRY.js";
3
- import { a as ge, D as Se, A as Te, g as lt } from "./core-CRJIQvxS.js";
4
- import { t as Me } from "./metricsReporter-uLWRAnwI.js";
1
+ import { a as O, u as e, h as V, c as L, b as j, e as X, f as xe, p as ne, F as ce, _ as ee, T as le, A as Fe, g as he, i as Ze, j as Ye, k as De, l as ze, m as Ke, n as Xe, w as Me, o as We } from "./view-Bvmj0wxW.js";
2
+ import { v as Je, R as F, B as W, M as J, Q as te, O as Ce, a as re, b as pe, S as et, L as tt, u as rt, H as de, c as Se, g as nt, P as at, p as st, d as it, s as ot } from "./getAttributedUrl-DBTn-NUH.js";
3
+ import { a as be, D as Te, A as _e, g as lt } from "./core-DE_-33ff.js";
4
+ import { t as Ue } from "./metricsReporter-CJzT7qY-.js";
5
5
  const ct = ({ properties: t, surveyVideoUrl: a, questionId: r }) => {
6
- const n = `ul-card-video__question_player-q${r}`, { apiURL: s, viewDocument: i } = $((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
6
+ const n = `ul-card-video__question_player-q${r}`, { apiURL: s, viewDocument: i } = O((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
7
7
  return e("div", { id: n, ref: (l) => {
8
8
  if (l && l.children.length === 0 && !t.properties.hideRecordedPrompt) {
9
- const d = Je(n, { src: a, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === Z.MEDIA_TYPE_AUDIO, s, i);
10
- l.appendChild(d);
9
+ const u = Je(n, { src: a, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === F.MEDIA_TYPE_AUDIO, s, i);
10
+ l.appendChild(u);
11
11
  }
12
12
  } });
13
- }, ae = ({ isDisabled: t, onClick: a, children: r }) => e(X, { className: "ul-card__button-checkmark", disabled: t, onClick: a, type: "button", children: [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" }) }), r || "Ok"] }), dt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
14
- const { useMobileStyling: i, border: l } = $((_) => ({ useMobileStyling: _.useMobileStyling, border: _.border })), [d, c] = O(!1), [v, y] = O(""), [o, p] = O(!1), k = r == null ? void 0 : r.collectName, f = (r == null ? void 0 : r.nameLabelText) || "Full Name", m = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", S = (r == null ? void 0 : r.submitButtonText) || "Submit", N = !!v.trim(), q = d && (!k || N), E = (_, Q = !1) => {
13
+ }, se = ({ isDisabled: t, onClick: a, children: r }) => e(W, { className: "ul-card__button-checkmark", disabled: t, onClick: a, type: "button", children: [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" }) }), r || "Ok"] }), dt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
14
+ const { useMobileStyling: i, border: l } = O((_) => ({ useMobileStyling: _.useMobileStyling, border: _.border })), [u, c] = V(!1), [v, y] = V(""), [o, m] = V(!1), k = r == null ? void 0 : r.collectName, f = (r == null ? void 0 : r.nameLabelText) || "Full Name", h = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", S = (r == null ? void 0 : r.submitButtonText) || "Submit", N = !!v.trim(), q = u && (!k || N), E = (_, G = !1) => {
15
15
  _.preventDefault(), _.stopPropagation();
16
16
  let A = null;
17
- if (!Q) {
18
- if (!q) return void p(!0);
17
+ if (!G) {
18
+ if (!q) return void m(!0);
19
19
  A = { submitted: !0 }, k && (A.name = v);
20
20
  }
21
- a({ value: A, questionId: n, type: s }, !!Q || q);
21
+ a({ value: A, questionId: n, type: s }, !!G || q);
22
22
  };
23
- return e("div", { className: P(t, "ul-card__consent-legal", "fade-in-transition"), children: e(W, { embeddedType: "pdf", properties: r, children: e(ee, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: l, error: o && !d, id: "consent", isRadio: !1, isSelected: d, label: m, onUserInputChanged: ({ selected: _ }) => {
24
- _ !== d && c(!d);
25
- }, useMobileStyling: i }), k && e("input", { "aria-label": f, "aria-placeholder": f, className: P(F("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (_) => {
26
- _.currentTarget.style.borderColor = o && !N ? ge : Se;
23
+ return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(J, { embeddedType: "pdf", properties: r, children: e(te, { children: [e("div", { className: "sprig-stretch", children: [e(Ce, { allowTextEntry: !1, border: l, error: o && !u, id: "consent", isRadio: !1, isSelected: u, label: h, onUserInputChanged: ({ selected: _ }) => {
24
+ _ !== u && c(!u);
25
+ }, useMobileStyling: i }), k && e("input", { "aria-label": f, "aria-placeholder": f, className: L(j("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (_) => {
26
+ _.currentTarget.style.borderColor = o && !N ? be : Te;
27
27
  }, onFocus: (_) => {
28
- _.currentTarget.style.borderColor = o && !N ? ge : l;
28
+ _.currentTarget.style.borderColor = o && !N ? be : l;
29
29
  }, onInput: (_) => {
30
30
  _.preventDefault(), _.stopPropagation(), y(_.currentTarget.value);
31
- }, placeholder: f, style: o && !N ? { borderColor: ge } : {}, tabIndex: 0, value: v })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ae, { isDisabled: !q, onClick: (_) => E(new SubmitEvent(_.type)), children: K({ buttonText: S }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (_) => E(new SubmitEvent(_.type), !0), children: fe(r) })] })] }) }) }, n);
31
+ }, placeholder: f, style: o && !N ? { borderColor: be } : {}, tabIndex: 0, value: v })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(se, { isDisabled: !q, onClick: (_) => E(new SubmitEvent(_.type)), children: X({ buttonText: S }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (_) => E(new SubmitEvent(_.type), !0), children: xe(r) })] })] }) }) }, n);
32
32
  }, ut = () => {
33
- const { destroy: t, forceBrandedLogo: a } = $((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
34
- return re(() => {
33
+ const { destroy: t, forceBrandedLogo: a } = O((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
34
+ return ne(() => {
35
35
  setTimeout(() => {
36
- t(Te);
36
+ t(_e);
37
37
  }, a ? 4e3 : 2e3);
38
38
  }, [t, a]), e("div", { className: "end-of-survey-text", children: "End of survey" });
39
- }, pt = ({ activeValue: t, border: a, icon: r, enableCspTrustedTypes: n, isPressed: s, range: i, scaleLabelType: l, selectedValue: d, setSelectedValue: c, setActiveValue: v, setIsPressed: y, useMobileStyling: o, value: p, viewDocument: k }) => {
40
- const f = `option-${p}`, m = l === "number", S = l === "star", N = l === "smiley", q = m && p === t || p === d, [E, _] = (() => {
41
- const u = S && d !== null && p <= d;
42
- return S && p <= t || N && p === t || u || p === t || p === d ? [a, s || u || p === d ? 1 : 0.3] : ["", 1];
43
- })(), Q = le(() => {
44
- const u = { borderColor: q ? E : "", fillOpacity: q ? "" : _, zIndex: q ? 3 : "auto", color: d === p ? "#fff" : "" };
45
- return m ? { ...u, backgroundColor: d === p ? E : "" } : { ...u, color: S || N || d === p ? E : "" };
46
- }, [q, E, _, d, p, m, S, N]), A = le(() => lt((({ icon: u, scaleLabelType: h, value: x, selectedValue: g }) => {
47
- if (h === "smiley" && x === g) {
39
+ }, pt = ({ activeValue: t, border: a, icon: r, enableCspTrustedTypes: n, isPressed: s, range: i, scaleLabelType: l, selectedValue: u, setSelectedValue: c, setActiveValue: v, setIsPressed: y, useMobileStyling: o, value: m, viewDocument: k }) => {
40
+ const f = `option-${m}`, h = l === "number", S = l === "star", N = l === "smiley", q = h && m === t || m === u, [E, _] = (() => {
41
+ const d = S && u !== null && m <= u;
42
+ return S && m <= t || N && m === t || d || m === t || m === u ? [a, s || d || m === u ? 1 : 0.3] : ["", 1];
43
+ })(), G = ce(() => {
44
+ const d = { borderColor: q ? E : "", fillOpacity: q ? "" : _, zIndex: q ? 3 : "auto", color: u === m ? "#fff" : "" };
45
+ return h ? { ...d, backgroundColor: u === m ? E : "" } : { ...d, color: S || N || u === m ? E : "" };
46
+ }, [q, E, _, u, m, h, S, N]), A = ce(() => lt((({ icon: d, scaleLabelType: p, value: x, selectedValue: g }) => {
47
+ if (p === "smiley" && x === g) {
48
48
  let b = 0;
49
- return u.replace(/black/g, () => ++b == 1 ? "black" : "white");
49
+ return d.replace(/black/g, () => ++b == 1 ? "black" : "white");
50
50
  }
51
- return u;
52
- })({ icon: r, scaleLabelType: l, value: p, selectedValue: d }), n), [n, r, l, d, p]);
53
- return e("button", { "aria-label": m ? void 0 : String(p), className: (() => {
51
+ return d;
52
+ })({ icon: r, scaleLabelType: l, value: m, selectedValue: u }), n), [n, r, l, u, m]);
53
+ return e("button", { "aria-label": h ? void 0 : String(m), className: (() => {
54
54
  switch (l) {
55
55
  case "star":
56
- return P(F("likert-star", o), F(`likert-star-${p}`, o));
56
+ return L(j("likert-star", o), j(`likert-star-${m}`, o));
57
57
  case "smiley":
58
- return P(F("likert-smiley", o), F(`likert-smiley-${p}`, o));
58
+ return L(j("likert-smiley", o), j(`likert-smiley-${m}`, o));
59
59
  default:
60
- return p === i ? P(F("likert-number", o), F(`likert-number-${p}`, o), F("likert-last-option", o)) : P(F("likert-number", o), F(`likert-number-${p}`, o));
60
+ return m === i ? L(j("likert-number", o), j(`likert-number-${m}`, o), j("likert-last-option", o)) : L(j("likert-number", o), j(`likert-number-${m}`, o));
61
61
  }
62
- })(), dangerouslySetInnerHTML: { __html: A }, id: f, onClick: (u) => {
63
- u.preventDefault(), u.stopPropagation(), c(p);
64
- }, onKeyDown: (u) => {
62
+ })(), dangerouslySetInnerHTML: { __html: A }, id: f, onClick: (d) => {
63
+ d.preventDefault(), d.stopPropagation(), c(m);
64
+ }, onKeyDown: (d) => {
65
65
  var g, b;
66
- const h = k.querySelectorAll(`.likert-${l ?? "number"}`), x = p - 1;
67
- u.key === "ArrowRight" ? (g = h[x + 1]) == null || g.focus() : u.key === "ArrowLeft" ? (b = h[x - 1]) == null || b.focus() : u.key !== "Enter" && u.key !== " " || (u.preventDefault(), u.stopPropagation(), c(p));
68
- }, onPointerDown: () => y(!0), onPointerEnter: () => v(p), onPointerLeave: () => {
66
+ const p = k.querySelectorAll(`.likert-${l ?? "number"}`), x = m - 1;
67
+ d.key === "ArrowRight" ? (g = p[x + 1]) == null || g.focus() : d.key === "ArrowLeft" ? (b = p[x - 1]) == null || b.focus() : d.key !== "Enter" && d.key !== " " || (d.preventDefault(), d.stopPropagation(), c(m));
68
+ }, onPointerDown: () => y(!0), onPointerEnter: () => v(m), onPointerLeave: () => {
69
69
  v(-1), y(!1);
70
- }, style: Q, tabIndex: 0 });
70
+ }, style: G, tabIndex: 0 });
71
71
  }, mt = ({ className: t, labels: a, next: r, properties: n, questionId: s, type: i }) => {
72
- const { border: l, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: v } = $((h) => ({ border: h.border, useMobileStyling: h.useMobileStyling, viewDocument: h.viewDocument, enableCspTrustedTypes: h.enableCspTrustedTypes })), [y, o] = O(-1), [p, k] = O(!1), [f, m] = O(null), S = a && a.left, N = a && a.right;
72
+ const { border: l, useMobileStyling: u, viewDocument: c, enableCspTrustedTypes: v } = O((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, viewDocument: p.viewDocument, enableCspTrustedTypes: p.enableCspTrustedTypes })), [y, o] = V(-1), [m, k] = V(!1), [f, h] = V(null), S = a && a.left, N = a && a.right;
73
73
  let q;
74
- const { range: E, scaleLabelType: _, ratingIcons: Q } = n;
74
+ const { range: E, scaleLabelType: _, ratingIcons: G } = n;
75
75
  E && (q = Number(E));
76
- const A = q || 5, u = (h) => {
76
+ const A = q || 5, d = (p) => {
77
77
  var x, g;
78
78
  switch (_) {
79
79
  case "star":
80
- return (x = Q[0]) == null ? void 0 : x.svg;
80
+ return (x = G[0]) == null ? void 0 : x.svg;
81
81
  case "smiley":
82
- return (g = Q[h]) == null ? void 0 : g.svg;
82
+ return (g = G[p]) == null ? void 0 : g.svg;
83
83
  default:
84
- return String(h + 1);
84
+ return String(p + 1);
85
85
  }
86
86
  };
87
- return e("form", { className: P(t, "ul-card--likert", "fade-in-transition"), children: e(W, { properties: n, children: [e(te, { children: [e("div", { "aria-label": `Rating (1 - ${A})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(A)].map((h, x) => {
87
+ return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(J, { properties: n, children: [e(re, { children: [e("div", { "aria-label": `Rating (1 - ${A})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(A)].map((p, x) => {
88
88
  const g = x + 1;
89
- return e(pt, { activeValue: y, border: l, enableCspTrustedTypes: v, icon: u(x), isPressed: p, range: A, scaleLabelType: _, selectedValue: f, setActiveValue: o, setIsPressed: k, setSelectedValue: m, useMobileStyling: d, value: g, viewDocument: c }, x);
90
- }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: S }), e("span", { children: N })] })] }), e(ee, { children: e(ae, { isDisabled: f === null && n.required, onClick: () => r({ value: f, questionId: s, type: i }, !0), children: K(n) }) })] }) }, s);
89
+ return e(pt, { activeValue: y, border: l, enableCspTrustedTypes: v, icon: d(x), isPressed: m, range: A, scaleLabelType: _, selectedValue: f, setActiveValue: o, setIsPressed: k, setSelectedValue: h, useMobileStyling: u, value: g, viewDocument: c }, x);
90
+ }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: S }), e("span", { children: N })] })] }), e(te, { children: e(se, { isDisabled: f === null && n.required, onClick: () => r({ value: f, questionId: s, type: i }, !0), children: X(n) }) })] }) }, s);
91
91
  }, ht = ({ columns: t, onSelect: a, options: r, selectedOptions: n }) => {
92
- const s = J([]), { border: i, useMobileStyling: l } = $((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling })), d = r.findIndex((p) => n[p.id] === null), [c, v] = O(d), y = oe((p, k) => {
93
- a(p, k);
94
- const f = c + 1, m = r[f];
95
- m && n[m.id] === null && v(f);
96
- }, [a, r, n, c]), o = oe((p, k) => {
97
- const f = c === p;
92
+ const s = ee([]), { border: i, useMobileStyling: l } = O((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling })), u = r.findIndex((m) => n[m.id] === null), [c, v] = V(u), y = le((m, k) => {
93
+ a(m, k);
94
+ const f = c + 1, h = r[f];
95
+ h && n[h.id] === null && v(f);
96
+ }, [a, r, n, c]), o = le((m, k) => {
97
+ const f = c === m;
98
98
  return e(Fe, { animate: !0, header: k.label, isOpen: f, onClick: () => {
99
- var m;
100
- return v(f && !((m = window.UserLeap) != null && m.isMobileSDK) ? -1 : p);
101
- }, ref: (m) => {
102
- m && (s.current[p] = m);
103
- }, showHeaderCheck: n[k.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((m) => e(xe, { allowTextEntry: !1, ariaLabel: `${k.label}-${m.label}`, border: i, error: !1, id: `${k.id}-${m.value}`, isRadio: !0, isSelected: n[k.id] === m.value, label: m.label, onUserInputChanged: () => y(k.id, m.value), useMobileStyling: l }, m.label)) }) }, k.id);
99
+ var h;
100
+ return v(f && !((h = window.UserLeap) != null && h.isMobileSDK) ? -1 : m);
101
+ }, ref: (h) => {
102
+ h && (s.current[m] = h);
103
+ }, showHeaderCheck: n[k.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((h) => e(Ce, { allowTextEntry: !1, ariaLabel: `${k.label}-${h.label}`, border: i, error: !1, id: `${k.id}-${h.value}`, isRadio: !0, isSelected: n[k.id] === h.value, label: h.label, onUserInputChanged: () => y(k.id, h.value), useMobileStyling: l }, h.label)) }) }, k.id);
104
104
  }, [i, t, c, y, n, l]);
105
- return e("div", { children: r.map((p, k) => o(k, p)) });
105
+ return e("div", { children: r.map((m, k) => o(k, m)) });
106
106
  }, gt = ({ className: t, next: a, options: r, properties: n, questionId: s, type: i, onSubmitButtonClick: l }) => {
107
- const d = n.matrixColumn, c = n.required, v = (f) => {
107
+ const u = n.matrixColumn, c = n.required, v = (f) => {
108
108
  f.preventDefault(), f.stopPropagation(), a({ value: o, questionId: s, type: i }, !0), l && l();
109
- }, y = r.reduce((f, m) => (f[m.id] = null, f), {}), [o, p] = O(y);
110
- return e("form", { className: P(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: v, children: e(W, { properties: n, children: [e(te, { children: e(ht, { columns: d, onSelect: (f, m) => {
111
- p((S) => ({ ...S, [f]: m }));
112
- }, options: r, selectedOptions: o }) }), e(ee, { children: e(ae, { isDisabled: (k = o, c && Object.values(k).every((f) => f == null)), onClick: () => v(new SubmitEvent("submit")), children: K(n) }) })] }) }, s);
109
+ }, y = r.reduce((f, h) => (f[h.id] = null, f), {}), [o, m] = V(y);
110
+ return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: v, children: e(J, { properties: n, children: [e(re, { children: e(ht, { columns: u, onSelect: (f, h) => {
111
+ m((S) => ({ ...S, [f]: h }));
112
+ }, options: r, selectedOptions: o }) }), e(te, { children: e(se, { isDisabled: (k = o, c && Object.values(k).every((f) => f == null)), onClick: () => v(new SubmitEvent("submit")), children: X(n) }) })] }) }, s);
113
113
  var k;
114
- }, Ue = ({ className: t, onSubmit: a, options: r = [], properties: n, questionId: s, type: i, showIndividualSubmit: l = !1, onSubmitButtonClick: d }) => {
115
- const { border: c, useMobileStyling: v } = $((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), y = r.reduce((g, b) => (g[b.id] = { isSelected: !1 }, g), {}), [o, p] = O(y), k = i === "multiplechoice", f = n.required, m = r.find((g) => {
114
+ }, Ee = ({ className: t, onSubmit: a, options: r = [], properties: n, questionId: s, type: i, showIndividualSubmit: l = !1, onSubmitButtonClick: u }) => {
115
+ const { border: c, useMobileStyling: v } = O((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), y = r.reduce((g, b) => (g[b.id] = { isSelected: !1 }, g), {}), [o, m] = V(y), k = i === "multiplechoice", f = n.required, h = r.find((g) => {
116
116
  var b;
117
117
  return (b = g.optionProperties) == null ? void 0 : b.noneOfTheAbove;
118
118
  }), S = (g) => Object.entries(g).some(([b, I]) => {
119
- var H;
120
- const L = r.find((V) => `${V.id}` === b), R = I.userText === void 0 || I.userText.trim() === "";
121
- return ((H = L == null ? void 0 : L.optionProperties) == null ? void 0 : H.allowsTextEntry) && R && I.isSelected;
122
- }), N = (g) => Object.values(g).filter((b) => b.isSelected).length, q = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && N(o) < n.minSelect && (f || N(o) > 0), E = (g) => S(g) || f && !N(g) || !((b) => {
123
- const { minSelect: I = 0, maxSelect: L = 1 / 0, maxSelectMode: R } = n, H = N(b);
124
- switch (R) {
125
- case ue.Maximum:
126
- return H <= L;
127
- case ue.Range:
128
- return H === 0 || H >= I;
119
+ var Q;
120
+ const R = r.find((z) => `${z.id}` === b), P = I.userText === void 0 || I.userText.trim() === "";
121
+ return ((Q = R == null ? void 0 : R.optionProperties) == null ? void 0 : Q.allowsTextEntry) && P && I.isSelected;
122
+ }), N = (g) => Object.values(g).filter((b) => b.isSelected).length, q = n.minSelect && n.minSelect > 0 && n.maxSelectMode === pe.Range && N(o) < n.minSelect && (f || N(o) > 0), E = (g) => S(g) || f && !N(g) || !((b) => {
123
+ const { minSelect: I = 0, maxSelect: R = 1 / 0, maxSelectMode: P } = n, Q = N(b);
124
+ switch (P) {
125
+ case pe.Maximum:
126
+ return Q <= R;
127
+ case pe.Range:
128
+ return Q === 0 || Q >= I;
129
129
  default:
130
130
  return !0;
131
131
  }
132
132
  })(g), _ = Object.entries(o).some(([g, b]) => {
133
- var I, L;
134
- return b.isSelected && ((L = (I = r.find((R) => `${R.id}` === g)) == null ? void 0 : I.optionProperties) == null ? void 0 : L.allowsTextEntry);
135
- }), Q = l && (!k || _), A = (g) => {
133
+ var I, R;
134
+ return b.isSelected && ((R = (I = r.find((P) => `${P.id}` === g)) == null ? void 0 : I.optionProperties) == null ? void 0 : R.allowsTextEntry);
135
+ }), G = l && (!k || _), A = (g) => {
136
136
  x(g.id, g.selected, g.userText, g.noneOfTheAbove);
137
- }, u = (g) => {
137
+ }, d = (g) => {
138
138
  var b;
139
- return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && N(o) === (n == null ? void 0 : n.maxSelect) && !((b = o[g]) != null && b.isSelected);
140
- }, h = () => {
141
- a(o, !0), d && d();
142
- }, x = (g, b, I, L) => {
143
- const R = Object.assign({}, o);
144
- if ((k || L) && b) for (const H of Object.values(R)) H.isSelected = !1, delete H.userText;
145
- else m && !L && o[m.id].isSelected && (R[m.id].isSelected = !1);
146
- R[g] = { isSelected: b, userText: I }, p(R);
139
+ return (n == null ? void 0 : n.maxSelectMode) !== pe.Unlimited && N(o) === (n == null ? void 0 : n.maxSelect) && !((b = o[g]) != null && b.isSelected);
140
+ }, p = () => {
141
+ a(o, !0), u && u();
142
+ }, x = (g, b, I, R) => {
143
+ const P = Object.assign({}, o);
144
+ if ((k || R) && b) for (const Q of Object.values(P)) Q.isSelected = !1, delete Q.userText;
145
+ else h && !R && o[h.id].isSelected && (P[h.id].isSelected = !1);
146
+ P[g] = { isSelected: b, userText: I }, m(P);
147
147
  };
148
- return e("form", { className: P(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: h, children: e(W, { properties: n, children: [e(te, { children: [n.isDropdown ? e(et, { disabledOptions: r.filter((g) => u(g.id)), dropdownFooter: q ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [N(o), "/", n.minSelect] }) : void 0, isMultiSelect: !k, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
148
+ return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: p, children: e(J, { properties: n, children: [e(re, { children: [n.isDropdown ? e(et, { disabledOptions: r.filter((g) => d(g.id)), dropdownFooter: q ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [N(o), "/", n.minSelect] }) : void 0, isMultiSelect: !k, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
149
149
  const b = { ...o };
150
150
  for (const I of r) g.includes(I) ? b[I.id].isSelected = !0 : b[I.id].isSelected = !1;
151
- p(b);
152
- }, options: r, placeholderText: n.dropdownPlaceholderText ?? (k ? "Select choice" : "Select choice(s)"), value: r.filter((g) => o[g.id].isSelected) }) : e("div", { className: P(F("ul-card__choices", v)), role: k ? "radiogroup" : "group", children: [r.map(({ id: g, label: b, value: I, optionProperties: L }) => {
153
- var j, ne;
154
- const R = `${g}`, { allowsTextEntry: H, noneOfTheAbove: V } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...L };
155
- return e(xe, { allowTextEntry: H, border: c, disabled: u(R), error: (G = o, S(G)), id: R, isRadio: k, isSelected: !!((j = o[R]) != null && j.isSelected), label: b, noneOfTheAbove: V, onUserInputChanged: A, promptText: "Please specify", text: (ne = o[g]) == null ? void 0 : ne.userText, useMobileStyling: v, value: I }, R);
156
- var G;
157
- }), !!q && e("div", { className: "ul-card__min-select-counter", children: [N(o), "/", n.minSelect] })] }), Q && e(tt, { handleSubmit: h, isSubmitDisabled: E(o) })] }), e(ee, { children: e(ae, { isDisabled: E(o), onClick: h, children: K(n) }) })] }) }, s);
151
+ m(b);
152
+ }, options: r, placeholderText: n.dropdownPlaceholderText ?? (k ? "Select choice" : "Select choice(s)"), value: r.filter((g) => o[g.id].isSelected) }) : e("div", { className: L(j("ul-card__choices", v)), role: k ? "radiogroup" : "group", children: [r.map(({ id: g, label: b, value: I, optionProperties: R }) => {
153
+ var H, Z;
154
+ const P = `${g}`, { allowsTextEntry: Q, noneOfTheAbove: z } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...R };
155
+ return e(Ce, { allowTextEntry: Q, border: c, disabled: d(P), error: ($ = o, S($)), id: P, isRadio: k, isSelected: !!((H = o[P]) != null && H.isSelected), label: b, noneOfTheAbove: z, onUserInputChanged: A, promptText: "Please specify", text: (Z = o[g]) == null ? void 0 : Z.userText, useMobileStyling: v, value: I }, P);
156
+ var $;
157
+ }), !!q && e("div", { className: "ul-card__min-select-counter", children: [N(o), "/", n.minSelect] })] }), G && e(tt, { handleSubmit: p, isSubmitDisabled: E(o) })] }), e(te, { children: e(se, { isDisabled: E(o), onClick: p, children: X(n) }) })] }) }, s);
158
158
  }, vt = (t) => {
159
159
  const { questionId: a, type: r, next: n, options: s } = t;
160
- return e(Ue, { ...t, onSubmit: (i, l) => {
161
- const d = Object.entries(i).find(([, p]) => p.isSelected) || [void 0, void 0], [c, v] = d, y = s.find((p) => `${p.id}` === c), o = v != null && v.userText ? { [c]: { userText: v.userText } } : null;
160
+ return e(Ee, { ...t, onSubmit: (i, l) => {
161
+ const u = Object.entries(i).find(([, m]) => m.isSelected) || [void 0, void 0], [c, v] = u, y = s.find((m) => `${m.id}` === c), o = v != null && v.userText ? { [c]: { userText: v.userText } } : null;
162
162
  n({ value: y && c ? { [c]: y.value } : {}, secondaryValue: o, questionId: a, type: r }, l);
163
163
  } });
164
164
  }, bt = (t) => {
165
165
  const { questionId: a, type: r, next: n } = t;
166
- return e(Ue, { ...t, onSubmit: (s, i) => {
167
- const l = Object.entries(s).reduce((c, [v, y]) => (c[v] = y.isSelected, c), {}), d = Object.entries(s).reduce((c, [v, y]) => {
166
+ return e(Ee, { ...t, onSubmit: (s, i) => {
167
+ const l = Object.entries(s).reduce((c, [v, y]) => (c[v] = y.isSelected, c), {}), u = Object.entries(s).reduce((c, [v, y]) => {
168
168
  if (!y.userText) return c;
169
169
  const o = c || {};
170
170
  return o[v] = { userText: y.userText }, o;
171
171
  }, null);
172
- n({ value: l, secondaryValue: d, questionId: a, type: r }, i);
172
+ n({ value: l, secondaryValue: u, questionId: a, type: r }, i);
173
173
  } });
174
174
  }, yt = ({ className: t, labels: a, properties: r, next: n, questionId: s, type: i }) => {
175
- const [l, d] = O(null), { border: c, useMobileStyling: v, viewDocument: y } = $((k) => ({ border: k.border, useMobileStyling: k.useMobileStyling, viewDocument: k.viewDocument })), o = a && a.left, p = a && a.right;
176
- return e("form", { className: P(t, "ul-card--nps", "fade-in-transition"), children: e(W, { properties: r, children: [e(te, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((k, f) => e("button", { className: P(F("nps-number", v), F(`nps-number-${f}`, v)), id: `option-${f}`, onClick: (m) => {
177
- m.preventDefault(), m.stopPropagation(), d(f);
178
- }, onKeyDown: (m) => {
175
+ const [l, u] = V(null), { border: c, useMobileStyling: v, viewDocument: y } = O((k) => ({ border: k.border, useMobileStyling: k.useMobileStyling, viewDocument: k.viewDocument })), o = a && a.left, m = a && a.right;
176
+ return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(J, { properties: r, children: [e(re, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((k, f) => e("button", { className: L(j("nps-number", v), j(`nps-number-${f}`, v)), id: `option-${f}`, onClick: (h) => {
177
+ h.preventDefault(), h.stopPropagation(), u(f);
178
+ }, onKeyDown: (h) => {
179
179
  var N, q;
180
180
  const S = y.querySelectorAll("button.nps-number");
181
- m.key === "ArrowRight" ? (N = S[f + 1]) == null || N.focus() : m.key === "ArrowLeft" ? (q = S[f - 1]) == null || q.focus() : m.key !== "Enter" && m.key !== " " || (m.preventDefault(), m.stopPropagation(), d(f));
182
- }, onPointerDown: (m) => {
183
- m.currentTarget.style.zIndex = "2", m.currentTarget.style.borderColor = c;
184
- }, onPointerLeave: (m) => {
185
- m.currentTarget.style.zIndex = "auto", m.currentTarget.style.borderColor = Se;
186
- }, style: l === f ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: f }, f)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: o }), e("span", { children: p })] })] }), e(ee, { children: e(ae, { isDisabled: l === null && r.required, onClick: () => n({ value: l, questionId: s, type: i }, !0), children: K(r) }) })] }) }, s);
181
+ h.key === "ArrowRight" ? (N = S[f + 1]) == null || N.focus() : h.key === "ArrowLeft" ? (q = S[f - 1]) == null || q.focus() : h.key !== "Enter" && h.key !== " " || (h.preventDefault(), h.stopPropagation(), u(f));
182
+ }, onPointerDown: (h) => {
183
+ h.currentTarget.style.zIndex = "2", h.currentTarget.style.borderColor = c;
184
+ }, onPointerLeave: (h) => {
185
+ h.currentTarget.style.zIndex = "auto", h.currentTarget.style.borderColor = Te;
186
+ }, style: l === f ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: f }, f)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: o }), e("span", { children: m })] })] }), e(te, { children: e(se, { isDisabled: l === null && r.required, onClick: () => n({ value: l, questionId: s, type: i }, !0), children: X(r) }) })] }) }, s);
187
187
  }, ft = ({ className: t, next: a, properties: r, questionId: n, type: s, onSubmitButtonClick: i }) => {
188
- const { border: l, useMobileStyling: d, update: c } = $((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, update: S.update })), [v, y] = O(""), o = J(null), p = v.trim(), k = r.required === !0 && !p, f = rt(o, () => c()), m = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
189
- return e("form", { className: P(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(W, { properties: r, children: e("div", { className: "ul-card-text", children: [e(te, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": m, className: P(F("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (S) => {
190
- S.currentTarget.style.borderColor = Se;
188
+ const { border: l, useMobileStyling: u, update: c } = O((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, update: S.update })), [v, y] = V(""), o = ee(null), m = v.trim(), k = r.required === !0 && !m, f = rt(o, () => c()), h = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
189
+ return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(J, { properties: r, children: e("div", { className: "ul-card-text", children: [e(re, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": h, className: L(j("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (S) => {
190
+ S.currentTarget.style.borderColor = Te;
191
191
  }, onChange: (S) => {
192
192
  const { value: N } = S.currentTarget;
193
193
  f(), S.preventDefault(), S.stopPropagation(), y(N);
194
194
  }, onFocus: (S) => {
195
195
  S.currentTarget.style.borderColor = l;
196
- }, placeholder: m, ref: o, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(ee, { children: e(ae, { isDisabled: k, onClick: (S) => {
196
+ }, placeholder: h, ref: o, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(de, { className: "footer", html: r.footerHtml })] }), e(te, { children: e(se, { isDisabled: k, onClick: (S) => {
197
197
  S.preventDefault(), S.stopPropagation();
198
- const N = r.required !== !0 || p.length > 0;
198
+ const N = r.required !== !0 || m.length > 0;
199
199
  a({ value: v, questionId: n, type: s }, N), i && i();
200
- }, children: K(r) }) })] }) }) }, n);
201
- }, kt = ({ className: t, labels: a, next: r, properties: n, questionId: s, type: i, onSubmitButtonClick: l, options: d }) => {
202
- const c = J(null), v = J(0), y = J(0), o = J(null), p = J(!1), k = J([]), [f, m] = O(() => (n == null ? void 0 : n.required) === !0), [S, N] = O(() => d.map((C) => ({ ...C, rank: null }))), q = le(() => Array.from({ length: d.length }, (C, w) => w + 1), [d.length]), { useMobileStyling: E, isPreview: _, headers: Q } = $((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), A = (Q == null ? void 0 : Q["userleap-platform"]) === "android", u = E && !_ && !A, h = !u && !A, x = (C, w) => {
200
+ }, children: X(r) }) })] }) }) }, n);
201
+ }, kt = ({ className: t, labels: a, next: r, properties: n, questionId: s, type: i, onSubmitButtonClick: l, options: u }) => {
202
+ const c = ee(null), v = ee(0), y = ee(0), o = ee(null), m = ee(!1), k = ee([]), [f, h] = V(() => (n == null ? void 0 : n.required) === !0), [S, N] = V(() => u.map((C) => ({ ...C, rank: null }))), q = ce(() => Array.from({ length: u.length }, (C, w) => w + 1), [u.length]), { useMobileStyling: E, isPreview: _, headers: G } = O((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), A = (G == null ? void 0 : G["userleap-platform"]) === "android", d = E && !_ && !A, p = !d && !A, x = (C, w) => {
203
203
  N((D) => {
204
204
  const T = parseInt(w), U = D.map((M) => ({ ...M }));
205
- U.some((M) => M.rank == null) && U.forEach((M, se) => M.rank = se + 1);
205
+ U.some((M) => M.rank == null) && U.forEach((M, ie) => M.rank = ie + 1);
206
206
  const Y = U.findIndex((M) => M.id === C);
207
207
  if (Y === -1) return D;
208
208
  const B = U[Y].rank;
@@ -210,7 +210,7 @@ const ct = ({ properties: t, surveyVideoUrl: a, questionId: r }) => {
210
210
  M.id !== C && M.rank >= T && M.rank < B && (M.rank = M.rank + 1);
211
211
  }) : T > B && U.forEach((M) => {
212
212
  M.id !== C && M.rank > B && M.rank <= T && (M.rank = M.rank - 1);
213
- }), U[Y].rank = T, U.sort((M, se) => M.rank - se.rank), V(), U;
213
+ }), U[Y].rank = T, U.sort((M, ie) => M.rank - ie.rank), z(), U;
214
214
  });
215
215
  }, g = (C, w) => {
216
216
  for (let D = 0; D < k.current.length; D++) {
@@ -221,14 +221,14 @@ const ct = ({ properties: t, surveyVideoUrl: a, questionId: r }) => {
221
221
  }
222
222
  return null;
223
223
  }, b = (C) => (w) => {
224
- if (!u) return;
225
- w.preventDefault(), w.stopPropagation(), p.current = !0, c.current = C;
224
+ if (!d) return;
225
+ w.preventDefault(), w.stopPropagation(), m.current = !0, c.current = C;
226
226
  const D = w.touches[0];
227
227
  v.current = D.clientY, y.current = D.clientY;
228
228
  const T = w.currentTarget.closest(".ul-card-rank__option");
229
229
  T && (o.current = T, T.classList.add("is-dragging"));
230
230
  }, I = (C) => {
231
- if (!u || !p.current || c.current === null) return;
231
+ if (!d || !m.current || c.current === null) return;
232
232
  C.preventDefault(), C.stopPropagation();
233
233
  const w = C.touches[0];
234
234
  y.current = w.clientY;
@@ -238,93 +238,93 @@ const ct = ({ properties: t, surveyVideoUrl: a, questionId: r }) => {
238
238
  });
239
239
  const T = g(w.clientX, w.clientY);
240
240
  T && T.element.classList.add("is-drop-target");
241
- }, L = (C) => {
242
- if (!u || !p.current || c.current === null) return;
241
+ }, R = (C) => {
242
+ if (!d || !m.current || c.current === null) return;
243
243
  C.preventDefault(), C.stopPropagation();
244
244
  const w = C.changedTouches[0], D = g(w.clientX, w.clientY);
245
245
  o.current && (o.current.style.transform = "", o.current.style.zIndex = "", o.current.classList.remove("is-dragging")), k.current.forEach((T) => {
246
246
  T && T.classList.remove("is-drop-target");
247
- }), D && D.index !== c.current && R(c.current, D.index), c.current = null, o.current = null, p.current = !1;
248
- }, R = (C, w) => {
247
+ }), D && D.index !== c.current && P(c.current, D.index), c.current = null, o.current = null, m.current = !1;
248
+ }, P = (C, w) => {
249
249
  N((D) => {
250
250
  const T = D.map((Y) => ({ ...Y })), [U] = T.splice(C, 1);
251
251
  return T.splice(w, 0, U), T.forEach((Y, B) => {
252
252
  Y.rank = B + 1;
253
- }), V(), T;
253
+ }), z(), T;
254
254
  });
255
- }, H = (C) => {
255
+ }, Q = (C) => {
256
256
  const w = {};
257
257
  C.reduce((D, T) => (D[T.id] = T.rank, D), w), r({ value: w, questionId: s, type: i }, !0);
258
- }, V = () => {
259
- m(!1);
260
- }, { left: G, right: j } = a, ne = d.length, de = (C) => {
258
+ }, z = () => {
259
+ h(!1);
260
+ }, { left: $, right: H } = a, Z = u.length, ae = (C) => {
261
261
  C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
262
- }, Ge = (C) => {
262
+ }, ue = (C) => {
263
263
  C.currentTarget.classList.remove("is-drop-target");
264
264
  }, je = (C) => {
265
265
  c.current = null, C.currentTarget.classList.remove("is-dragging");
266
266
  };
267
- return e("form", { className: P(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
268
- C.preventDefault(), H(S), l && l();
269
- }, children: e(W, { properties: n, children: e(ke, A ? { children: [e(te, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", G] }) }), e("ol", { className: "ul-card-rank__list", children: S.map(({ id: C, label: w, rank: D }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${w}`, className: P("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (T) => x(C, T.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((T) => e("option", { className: "ul-card-rank__select-option", value: T, children: T }, `${T}-${s}`))] }), e("span", { children: w })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", j] }) })] }) }), e(ee, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: f, children: K(n) }) }) })] } : { children: [e(te, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", G] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: A ? void 0 : (C) => {
267
+ return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
268
+ C.preventDefault(), Q(S), l && l();
269
+ }, children: e(J, { properties: n, children: e(he, A ? { children: [e(re, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", $] }) }), e("ol", { className: "ul-card-rank__list", children: S.map(({ id: C, label: w, rank: D }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${w}`, className: L("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (T) => x(C, T.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((T) => e("option", { className: "ul-card-rank__select-option", value: T, children: T }, `${T}-${s}`))] }), e("span", { children: w })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", H] }) })] }) }), e(te, { children: e("div", { className: "ul-card__button-wrapper", children: e(W, { disabled: f, children: X(n) }) }) })] } : { children: [e(re, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", $] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: A ? void 0 : (C) => {
270
270
  C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
271
271
  }, children: S.map(({ id: C, label: w, rank: D }, T) => {
272
- return e("li", { className: "ul-card-rank__option", draggable: !!h || void 0, onDragEnd: h ? je : void 0, onDragEnter: h ? de : void 0, onDragLeave: h ? Ge : void 0, onDragStart: h ? (Y = T, (B) => {
272
+ return e("li", { className: "ul-card-rank__option", draggable: !!p || void 0, onDragEnd: p ? je : void 0, onDragEnter: p ? ae : void 0, onDragLeave: p ? ue : void 0, onDragStart: p ? (Y = T, (B) => {
273
273
  c.current = Y, B.dataTransfer && (B.dataTransfer.effectAllowed = "move", B.dataTransfer.setData("text/plain", String(Y)), B.currentTarget.classList.add("is-dragging"));
274
- }) : void 0, onDrop: h ? (U = T, (B) => {
275
- var se, Ie;
274
+ }) : void 0, onDrop: p ? (U = T, (B) => {
275
+ var ie, we;
276
276
  B.preventDefault(), B.currentTarget.classList.remove("is-drop-target");
277
277
  const M = c.current;
278
- c.current = null, (Ie = (se = B.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : se.querySelector(".is-dragging")) == null || Ie.classList.remove("is-dragging"), M != null && M !== U && R(M, U);
279
- }) : void 0, ref: (B) => k.current[T] = B, children: [e("select", { "aria-label": `Rank for ${w}`, className: P("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (B) => x(C, B.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((B) => e("option", { className: "ul-card-rank__select-option", value: B, children: B }, B))] }), e("span", { children: w }), !A && e("button", { "aria-label": `Drag ${w} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: u ? L : void 0, onTouchMove: u ? I : void 0, onTouchStart: u ? b(T) : 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);
278
+ c.current = null, (we = (ie = B.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ie.querySelector(".is-dragging")) == null || we.classList.remove("is-dragging"), M != null && M !== U && P(M, U);
279
+ }) : void 0, ref: (B) => k.current[T] = B, children: [e("select", { "aria-label": `Rank for ${w}`, className: L("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (B) => x(C, B.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((B) => e("option", { className: "ul-card-rank__select-option", value: B, children: B }, B))] }), e("span", { children: w }), !A && e("button", { "aria-label": `Drag ${w} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: d ? R : void 0, onTouchMove: d ? I : void 0, onTouchStart: d ? b(T) : 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);
280
280
  var U, Y;
281
- }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", j] }) })] }) }), e(ee, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: f, children: K(n) }) }) })] }) }) }, s);
282
- }, ve = 1, Ee = 2, Ae = 3, pe = (t) => t.type === "av_permission", De = (t) => t.type === "screen_permission", Be = (t, a) => t === void 0 ? ve : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, a) ? Ae : ve : Ee, qe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
283
- }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, z = Ze((t) => ({ ...qe, reset: () => {
284
- t(qe);
281
+ }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", H] }) })] }) }), e(te, { children: e("div", { className: "ul-card__button-wrapper", children: e(W, { disabled: f, children: X(n) }) }) })] }) }) }, s);
282
+ }, ye = 1, Ae = 2, Be = 3, me = (t) => t.type === "av_permission", qe = (t) => t.type === "screen_permission", $e = (t, a) => t === void 0 ? ye : t ? ((r, n) => !(me(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, a) ? Be : ye : Ae, Pe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
283
+ }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, K = Ze((t) => ({ ...Pe, reset: () => {
284
+ t(Pe);
285
285
  }, updatePage: (a) => {
286
286
  t(a);
287
287
  } }));
288
- function be({ currentPage: t, pages: a }) {
289
- const { avStream: r, recordingMediaTypes: n, updatePage: s } = z.getState(), { recorderEventEmitter: i } = $.getState();
290
- i.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (l, d) => {
288
+ function fe({ currentPage: t, pages: a }) {
289
+ const { avStream: r, recordingMediaTypes: n, updatePage: s } = K.getState(), { recorderEventEmitter: i } = O.getState();
290
+ i.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (l, u) => {
291
291
  if (r === l) return;
292
292
  let c = t;
293
293
  if (l && !t.permissionDescriptors.includes("camera")) {
294
- const v = a.indexOf(t), y = d != null && d.active ? v + 2 : v + 1;
295
- d != null && d.active && n && i.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (o) => s({ mediaRecordingUids: o }) }), c = a[y];
294
+ const v = a.indexOf(t), y = u != null && u.active ? v + 2 : v + 1;
295
+ u != null && u.active && n && i.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (o) => s({ mediaRecordingUids: o }) }), c = a[y];
296
296
  }
297
297
  s({ currentPage: c, avStream: l });
298
298
  } });
299
299
  }
300
- function ye({ status: t }) {
301
- const { nextQuestion: a, passthroughData: r, mediaRecordingUids: n, reset: s } = z.getState(), { recorderEventEmitter: i, handleUploadUpdate: l, index: d } = $.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
300
+ function ke({ status: t }) {
301
+ const { nextQuestion: a, passthroughData: r, mediaRecordingUids: n, reset: s } = K.getState(), { recorderEventEmitter: i, handleUploadUpdate: l, index: u } = O.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
302
302
  r && i.emit("finish.task", { "begin.callback": (v) => {
303
303
  l({ mediaRecordingUid: v, isSubmitted: !0, progressPct: 0, isComplete: !1 });
304
304
  }, "progress.callback": (v, y) => {
305
305
  l({ mediaRecordingUid: v, progressPct: y.detail, isSubmitted: !1, isComplete: !1 });
306
306
  }, "upload.callback": (v) => {
307
307
  v && l({ mediaRecordingUid: v, isComplete: !0, isSubmitted: !0, progressPct: 100 });
308
- }, "passthrough.data": r, "current.index": d, "task.response": c, "task.complete.callback": (v) => {
308
+ }, "passthrough.data": r, "current.index": u, "task.response": c, "task.complete.callback": (v) => {
309
309
  c.value.taskDurationMillisecond = v, n && (c.value.mediaRecordingUids = n), s(), a(c);
310
310
  } });
311
311
  }
312
- function _e({ pages: t, setIsRequestingPermission: a }) {
313
- const { recorderEventEmitter: r, eventEmitFn: n } = $.getState(), { updatePage: s, currentPage: i, recordingMediaTypes: l, screenPermissionRequested: d } = z.getState();
312
+ function Ne({ pages: t, setIsRequestingPermission: a }) {
313
+ const { recorderEventEmitter: r, eventEmitFn: n } = O.getState(), { updatePage: s, currentPage: i, recordingMediaTypes: l, screenPermissionRequested: u } = K.getState();
314
314
  if (!i) return;
315
315
  const c = t.indexOf(i);
316
316
  switch (i.type) {
317
317
  case "av_permission": {
318
- const v = d ? c + 2 : c + 1;
319
- return d && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (y) => {
318
+ const v = u ? c + 2 : c + 1;
319
+ return u && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (y) => {
320
320
  s({ mediaRecordingUids: y });
321
321
  } }), void s({ currentPage: t[v] });
322
322
  }
323
323
  case "screen_permission":
324
324
  return void r.emit("screen.permission", { "screen.permission.requested": a, "stream.ready.callback": (v, y) => {
325
325
  const o = y ? t[c + 1] : i;
326
- y && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (p) => {
327
- s({ captureStream: y, mediaRecordingUids: p });
326
+ y && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (m) => {
327
+ s({ captureStream: y, mediaRecordingUids: m });
328
328
  } }), s({ currentPage: o, screenPermissionRequested: !0, captureStream: y });
329
329
  } });
330
330
  case "start_task":
@@ -333,9 +333,9 @@ function _e({ pages: t, setIsRequestingPermission: a }) {
333
333
  return;
334
334
  }
335
335
  }
336
- const $e = "ul-permission-graphics-container", Oe = "ul-permission-body", Qe = P($e, "ul_recorded-task-inset-spacing"), me = P("ul-horizontal-button-container", "ul-horizontal-button-container-left"), He = ({ richTextBody: t }) => e(ce, { className: "ul-rich-text-body", html: t, id: "ul-task-detail-container" }), he = ({ required: t, skipButtonText: a, bottom: r = !1 }) => t ? null : e(X, { className: P(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ye.bind(null, { status: "abandoned" }), children: a || "Skip" }), Ne = (t) => {
337
- const { avStream: a, captureStream: r, recordingMediaTypes: n, updatePage: s } = z.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
338
- re(() => {
336
+ const Oe = "ul-permission-graphics-container", Qe = "ul-permission-body", He = L(Oe, "ul_recorded-task-inset-spacing"), ge = L("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Ve = ({ richTextBody: t }) => e(de, { className: "ul-rich-text-body", html: t, id: "ul-task-detail-container" }), ve = ({ required: t, skipButtonText: a, bottom: r = !1 }) => t ? null : e(W, { className: L(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ke.bind(null, { status: "abandoned" }), children: a || "Skip" }), Ie = (t) => {
337
+ const { avStream: a, captureStream: r, recordingMediaTypes: n, updatePage: s } = K.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
338
+ ne(() => {
339
339
  const l = setInterval(() => {
340
340
  i && a && !a.active ? s({ avStream: null, currentPage: t[0] }) : r && r.active || s({ captureStream: void 0, currentPage: t[i ? 1 : 0] });
341
341
  }, 1e3);
@@ -343,33 +343,33 @@ const $e = "ul-permission-graphics-container", Oe = "ul-permission-body", Qe = P
343
343
  }, [a, r, i, t, n, s]);
344
344
  }, xt = ({ content: t, pages: a, required: r }) => {
345
345
  const { buttonText: n, skipButtonText: s, taskDetail: i } = t;
346
- return Ne(a), e("div", { className: "ul-task-page", children: [i && e(He, { richTextBody: i }), e("div", { className: me, children: [e(X, { onClick: _e.bind(null, { pages: a }), children: n }), e(he, { required: r, skipButtonText: s })] })] }, "start-task");
346
+ return Ie(a), e("div", { className: "ul-task-page", children: [i && e(Ve, { richTextBody: i }), e("div", { className: ge, children: [e(W, { onClick: Ne.bind(null, { pages: a }), children: n }), e(ve, { required: r, skipButtonText: s })] })] }, "start-task");
347
347
  }, Ct = ({ content: t, pages: a, properties: r }) => {
348
348
  const { buttonText: n, skipButtonText: s } = t;
349
- return Ne(a), e("div", { className: "ul-task-page", children: [t.taskDetail && e(He, { richTextBody: t.taskDetail }), e(W, { properties: r, children: e("div", { className: me, children: [e(X, { className: "ul-complete-task-button", onClick: ye.bind(null, { status: "completed" }), children: n }), e(X, { className: P("ul-button-inactive"), onClick: ye.bind(null, { status: "given.up" }), children: s })] }) })] }, "complete-task");
349
+ return Ie(a), e("div", { className: "ul-task-page", children: [t.taskDetail && e(Ve, { richTextBody: t.taskDetail }), e(J, { properties: r, children: e("div", { className: ge, children: [e(W, { className: "ul-complete-task-button", onClick: ke.bind(null, { status: "completed" }), children: n }), e(W, { className: L("ul-button-inactive"), onClick: ke.bind(null, { status: "given.up" }), children: s })] }) })] }, "complete-task");
350
350
  }, St = ({ content: t, pages: a, required: r }) => {
351
- const { buttonText: n, skipButtonText: s } = t, [i] = $((c) => [c.tabTitle]), [l, d] = O(!1);
352
- return e("div", { children: [e("div", { className: Qe, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Oe, children: i }) })] }), e("div", { className: r ? "" : me, children: [e(X, { disabled: l, onClick: _e.bind(null, { pages: a, setIsRequestingPermission: d }), children: n }), e(he, { required: r, skipButtonText: s })] })] });
353
- }, Tt = ({ content: t }) => e(ce, { className: P($e, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), _t = ({ content: t, pages: a, required: r }) => {
354
- const { permissionDeniedHeadline: n, permissionDeniedBody: s, skipButtonText: i, tryAgainButtonText: l } = t, d = pe(a[0]) ? a[0] : null;
355
- return re(() => {
351
+ const { buttonText: n, skipButtonText: s } = t, [i] = O((c) => [c.tabTitle]), [l, u] = V(!1);
352
+ return e("div", { children: [e("div", { className: He, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Qe, children: i }) })] }), e("div", { className: r ? "" : ge, children: [e(W, { disabled: l, onClick: Ne.bind(null, { pages: a, setIsRequestingPermission: u }), children: n }), e(ve, { required: r, skipButtonText: s })] })] });
353
+ }, Tt = ({ content: t }) => e(de, { className: L(Oe, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), _t = ({ content: t, pages: a, required: r }) => {
354
+ const { permissionDeniedHeadline: n, permissionDeniedBody: s, skipButtonText: i, tryAgainButtonText: l } = t, u = me(a[0]) ? a[0] : null;
355
+ return ne(() => {
356
356
  const c = setInterval(() => {
357
- d !== null && be({ currentPage: d, pages: a });
357
+ u !== null && fe({ currentPage: u, pages: a });
358
358
  }, 1e3);
359
359
  return () => clearInterval(c);
360
- }, [d, a]), d ? e("div", { children: [e("div", { className: Qe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Oe, children: s })] }) }), e("div", { className: me, children: [e(X, { onClick: be.bind(null, { currentPage: d, pages: a }), children: l }), e(he, { required: r, skipButtonText: i })] })] }) : null;
361
- }, Nt = ({ stream: t }) => e("video", { autoPlay: !0, className: P("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (a) => {
360
+ }, [u, a]), u ? e("div", { children: [e("div", { className: He, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Qe, children: s })] }) }), e("div", { className: ge, children: [e(W, { onClick: fe.bind(null, { currentPage: u, pages: a }), children: l }), e(ve, { required: r, skipButtonText: i })] })] }) : null;
361
+ }, Nt = ({ stream: t }) => e("video", { autoPlay: !0, className: L("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (a) => {
362
362
  a && (a.srcObject = t || null);
363
363
  } }), It = ({ content: t, pages: a, required: r }) => {
364
- const { skipButtonText: n } = t, { avStream: s } = z.getState();
365
- return Ne(a), e("div", { children: [e(Nt, { stream: s }), e("div", { className: "ul-vertical-button-container-center", children: [e(X, { onClick: _e.bind(null, { pages: a }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
364
+ const { skipButtonText: n } = t, { avStream: s } = K.getState();
365
+ return Ie(a), e("div", { children: [e(Nt, { stream: s }), e("div", { className: "ul-vertical-button-container-center", children: [e(W, { onClick: Ne.bind(null, { pages: a }), children: t.buttonText }), e(ve, { bottom: !0, required: r, skipButtonText: n })] })] });
366
366
  }, wt = ({ properties: t }) => {
367
- const { pages: a, required: r } = t, { avStream: n, currentPage: s } = z.getState();
367
+ const { pages: a, required: r } = t, { avStream: n, currentPage: s } = K.getState();
368
368
  if (s === void 0) return null;
369
369
  switch (s == null ? void 0 : s.type) {
370
370
  case "av_permission": {
371
- const i = Be(n, s);
372
- return i === ve ? e(Tt, { content: s }) : e(i === Ee ? _t : It, { content: s, pages: a, required: r });
371
+ const i = $e(n, s);
372
+ return i === ye ? e(Tt, { content: s }) : e(i === Ae ? _t : It, { content: s, pages: a, required: r });
373
373
  }
374
374
  case "screen_permission":
375
375
  return e(St, { content: s, pages: a, required: r });
@@ -381,103 +381,105 @@ const $e = "ul-permission-graphics-container", Oe = "ul-permission-body", Qe = P
381
381
  return null;
382
382
  }
383
383
  }, Dt = ({ className: t, properties: a, next: r, questionId: n }) => {
384
- const s = $(), { surveyId: i, responseGroupUid: l, userId: d } = s, c = z(), { screenPermissionRequested: v } = c, y = z((m) => m.avStream);
385
- let o = z((m) => m.currentPage);
386
- o || (o = function({ pages: m, userId: S, responseGroupUid: N, surveyId: q, questionId: E, next: _ }) {
387
- const { updatePage: Q } = z.getState(), { eventEmitFn: A, recorderEventEmitter: u } = $.getState(), h = { questionId: E, surveyId: q, visitorId: S, responseGroupUid: N };
384
+ const s = O(), { surveyId: i, responseGroupUid: l, userId: u } = s, c = K(), { screenPermissionRequested: v } = c, y = K((h) => h.avStream);
385
+ let o = K((h) => h.currentPage);
386
+ o || (o = function({ pages: h, userId: S, responseGroupUid: N, surveyId: q, questionId: E, next: _ }) {
387
+ const { updatePage: G } = K.getState(), { eventEmitFn: A, recorderEventEmitter: d } = O.getState(), p = { questionId: E, surveyId: q, visitorId: S, responseGroupUid: N };
388
388
  let x = 0;
389
- u.emit("recorded.task.permission.screen"), A("recorded.task.permission.screen"), u.emit("permission.status", { "permission.status.callback": (b, I, L, R) => {
390
- const H = m[x], { type: V } = H, G = ["screen"];
391
- if (pe(H)) {
392
- const { permissionDescriptors: j } = H, ne = j == null ? void 0 : j.includes("microphone"), de = j == null ? void 0 : j.includes("camera");
393
- ne && G.push("audio"), de && G.push("video"), (b != null && b.active && !de || b != null && b.active && I) && x++;
389
+ d.emit("recorded.task.permission.screen"), A("recorded.task.permission.screen"), d.emit("permission.status", { "permission.status.callback": (b, I, R, P) => {
390
+ const Q = h[x], { type: z } = Q, $ = ["screen"];
391
+ if (me(Q)) {
392
+ const { permissionDescriptors: H } = Q, Z = H == null ? void 0 : H.includes("microphone"), ae = H == null ? void 0 : H.includes("camera");
393
+ Z && $.push("audio"), ae && $.push("video"), (b != null && b.active && !ae || b != null && b.active && I) && x++;
394
394
  }
395
- De(m[x]) && L && (x++, u.emit("begin.recording", { "recording.media.types": G, "start.recording.callback": (j) => Q({ mediaRecordingUids: j }) })), Q({ currentPage: m[x], avStream: b, screenPermissionRequested: L, nextQuestion: _, type: V, passthroughData: h, recordingMediaTypes: G, captureStream: R });
395
+ qe(h[x]) && R && (x++, d.emit("begin.recording", { "recording.media.types": $, "start.recording.callback": (H) => G({ mediaRecordingUids: H }) })), G({ currentPage: h[x], avStream: b, screenPermissionRequested: R, nextQuestion: _, type: z, passthroughData: p, recordingMediaTypes: $, captureStream: P });
396
396
  } });
397
- const g = m[x];
398
- return g.type === "av_permission" && be({ currentPage: g, pages: m }), g;
399
- }({ questionId: n, surveyId: i, next: (m) => {
400
- r(m, !0);
401
- }, pages: a.pages, responseGroupUid: l, userId: d }));
402
- let p = o.headline, k = o.captionText;
403
- const f = Be(y, o);
404
- return De(o) && v && (p = o.permissionDeniedHeadline, k = o.permissionDeniedCaptionText), pe(o) && f === Ae && (p = o.permissionGrantedHeadline, k = o.permissionGrantedCaptionText), e("div", { className: P(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: a == null ? void 0 : a.required, message: p, properties: { captionText: k } }), e(te, { children: e(wt, { properties: a }) })] });
397
+ const g = h[x];
398
+ return g.type === "av_permission" && fe({ currentPage: g, pages: h }), g;
399
+ }({ questionId: n, surveyId: i, next: (h) => {
400
+ r(h, !0);
401
+ }, pages: a.pages, responseGroupUid: l, userId: u }));
402
+ let m = o.headline, k = o.captionText;
403
+ const f = $e(y, o);
404
+ return qe(o) && v && (m = o.permissionDeniedHeadline, k = o.permissionDeniedCaptionText), me(o) && f === Be && (m = o.permissionGrantedHeadline, k = o.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Se, { isRequired: a == null ? void 0 : a.required, message: m, properties: { captionText: k } }), e(re, { children: e(wt, { properties: a }) })] });
405
405
  }, qt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
406
- const { visitorAttributes: i, isLongFormSurvey: l } = $((y) => ({ visitorAttributes: y.visitorAttributes, isLongFormSurvey: Me(y.studyType) })), d = (y, o = !1) => {
406
+ const { visitorAttributes: i, isLongFormSurvey: l } = O((y) => ({ visitorAttributes: y.visitorAttributes, isLongFormSurvey: Ue(y.studyType) })), u = (y, o = !1) => {
407
407
  a({ value: o ? { skipped: !0 } : void 0, questionId: n, type: s }, !0);
408
408
  }, c = nt(r && r.buttonUrl, i), v = l && r.promptActionType === at.NO_BUTTON;
409
- return e("div", { className: P(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(W, { properties: r, children: !v && 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: c, id: "ul-card-text__button", onClick: d, onKeyPress: (y) => {
409
+ return e("div", { className: L(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(J, { properties: r, children: !v && 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: c, id: "ul-card-text__button", onClick: u, onKeyPress: (y) => {
410
410
  y.key !== "Enter" && y.key !== " " || a({ value: void 0, questionId: n, type: s }, !0);
411
- }, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: K(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => d(0, !0), children: fe(r) })] }) }) }) }, n);
411
+ }, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: X(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => u(0, !0), children: xe(r) })] }) }) }) }, n);
412
412
  }, Pt = ({ className: t, questionId: a }) => {
413
- const { border: r, destroy: n, endCard: s, forceBrandedLogo: i } = $((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
414
- re(() => {
413
+ const { border: r, destroy: n, endCard: s, forceBrandedLogo: i } = O((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
414
+ ne(() => {
415
415
  setTimeout(() => {
416
- n(Te);
416
+ n(_e);
417
417
  }, i ? 4e3 : 2e3);
418
418
  }, [n, i]);
419
- const l = s && s.subheader ? e("p", { className: "ul-caption", children: s.subheader }) : null, d = s && s.headline ? s.headline : "";
420
- return e("div", { className: P(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(Ce, { message: d }), l] }) }) }, a);
419
+ const l = s && s.subheader ? e("p", { className: "ul-caption", children: s.subheader }) : null, u = s && s.headline ? s.headline : "";
420
+ return e("div", { className: L(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(Se, { message: u }), l] }) }) }, a);
421
421
  }, Lt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), Rt = ({ className: t }) => {
422
- const { uploadProgress: a } = $((i) => ({ uploadProgress: i.uploadProgress }));
422
+ const { uploadProgress: a } = O((i) => ({ uploadProgress: i.uploadProgress }));
423
423
  let r, n;
424
424
  Object.values(a).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.");
425
425
  const s = Math.round(Math.min(99, ...Object.values(a).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0)));
426
- return e("div", { className: P(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(Ce, { message: `${r} (${s}% complete)` }), e("p", { className: "ul-caption", children: n })] });
427
- }, Pe = 0, Le = 1, Mt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
428
- const i = `ul-card-video__player_recorder-q${n}`, { apiURL: l, envId: d, handleUploadUpdate: c, headers: v, responseGroupUid: y, surveyId: o, viewDocument: p, visitorId: k } = $((h) => ({ apiURL: h.apiURL, envId: h.envId, handleUploadUpdate: h.handleUploadUpdate, headers: h.headers, responseGroupUid: h.responseGroupUid, surveyId: h.surveyId, viewDocument: h.viewDocument, visitorId: h.userId })), [f, m] = O(!1), [S, N] = O(null), [q, E] = O(null), [_, Q] = O(Pe), A = (h, x) => {
429
- h === Z.UPLOAD_STARTED ? (N(x[Z.UPLOAD_ID]), E(x[Z.MEDIA_RECORDING_UID]), m(!0)) : h === Z.DELETE ? (N(null), E(null), m(!1)) : h === Z.UPLOAD_PROGRESS ? isNaN(x[Z.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], progressPct: x[Z.UPLOAD_PROGRESS_PCT] }) : h === Z.UPLOAD_FINISHED && c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], isComplete: !0 });
430
- }, u = (h) => {
431
- h.preventDefault(), h.stopPropagation(), document.getElementById(i) && ot(i), S && q ? (c({ mediaRecordingUid: q, isSubmitted: !0 }), a({ value: { mediaRecordingUid: q }, questionId: n, type: s }, !0)) : a({ value: null, questionId: n, type: s }, !0);
426
+ return e("div", { className: L(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(Se, { message: `${r} (${s}% complete)` }), e("p", { className: "ul-caption", children: n })] });
427
+ }, Le = 0, Re = 1, Mt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
428
+ const i = `ul-card-video__player_recorder-q${n}`, { apiURL: l, envId: u, handleUploadUpdate: c, headers: v, responseGroupUid: y, surveyId: o, viewDocument: m, visitorId: k } = O((p) => ({ apiURL: p.apiURL, envId: p.envId, handleUploadUpdate: p.handleUploadUpdate, headers: p.headers, responseGroupUid: p.responseGroupUid, surveyId: p.surveyId, viewDocument: p.viewDocument, visitorId: p.userId })), [f, h] = V(!1), [S, N] = V(null), [q, E] = V(null), [_, G] = V(Le), A = (p, x) => {
429
+ p === F.UPLOAD_STARTED ? (N(x[F.UPLOAD_ID]), E(x[F.MEDIA_RECORDING_UID]), h(!0)) : p === F.DELETE ? (N(null), E(null), h(!1)) : p === F.UPLOAD_PROGRESS ? isNaN(x[F.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: x[F.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: x[F.MEDIA_RECORDING_UID], progressPct: x[F.UPLOAD_PROGRESS_PCT] }) : p === F.UPLOAD_FINISHED && c({ mediaRecordingUid: x[F.MEDIA_RECORDING_UID], isComplete: !0 });
430
+ }, d = (p) => {
431
+ p.preventDefault(), p.stopPropagation(), document.getElementById(i) && ot(i), S && q ? (c({ mediaRecordingUid: q, isSubmitted: !0 }), a({ value: { mediaRecordingUid: q }, questionId: n, type: s }, !0)) : a({ value: null, questionId: n, type: s }, !0);
432
432
  };
433
- return e("form", { className: P(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(te, { children: [e("div", { id: "ul-question-player-container", style: { display: _ === Pe ? "" : "none" }, children: e(W, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (h) => {
434
- h.preventDefault(), h.stopPropagation(), document.getElementById(i) && st(i), Q(Le);
435
- } }) }) }), e("div", { style: { display: _ === Le ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (h) => {
436
- if (h && h.children.length === 0) {
437
- const x = it(i, { surveyId: o, responseGroupUid: y, questionId: n, visitorId: k, envId: d }, l, A, void 0, { ...v, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === Z.MEDIA_TYPE_AUDIO, p);
438
- h.appendChild(x);
433
+ return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(re, { children: [e("div", { id: "ul-question-player-container", style: { display: _ === Le ? "" : "none" }, children: e(J, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (p) => {
434
+ p.preventDefault(), p.stopPropagation(), document.getElementById(i) && st(i), G(Re);
435
+ } }) }) }), e("div", { style: { display: _ === Re ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (p) => {
436
+ if (p && p.children.length === 0) {
437
+ const x = it(i, { surveyId: o, responseGroupUid: y, questionId: n, visitorId: k, envId: u }, l, A, void 0, { ...v, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === F.MEDIA_TYPE_AUDIO, m);
438
+ p.appendChild(x);
439
439
  }
440
- } }) })] }), e(ee, { children: [e(ae, { isDisabled: !!r.required && !f, onClick: u, children: K(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: u, style: { ...r.required ? { display: "none" } : {}, ...f ? { display: "none" } : {} }, children: fe(r) })] })] });
441
- }, Ve = (t) => t.type === "thanks" || t.type === "uploading", Ut = ({ card: t, avatars: a, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: s }) => {
440
+ } }) })] }), e(te, { children: [e(se, { isDisabled: !!r.required && !f, onClick: d, children: X(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: d, style: { ...r.required ? { display: "none" } : {}, ...f ? { display: "none" } : {} }, children: xe(r) })] })] });
441
+ }, Ge = (t) => t.type === "thanks" || t.type === "uploading", Ut = ({ card: t, avatars: a, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: s }) => {
442
442
  const i = ((l) => "properties" in l.props && l.props.properties && "questionHtml" in l.props.properties && l.props.properties.questionHtml ? { content: l.props.properties.questionHtml, isHtml: !0 } : "message" in l.props ? { content: l.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
443
- return e(ie, { avatars: a, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? s : null, children: r ? e(Lt, {}) : e(ke, { children: [i.isHtml ? e(ce, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(ct, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
443
+ return e(oe, { avatars: a, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? s : null, children: r ? e(Lt, {}) : e(he, { children: [i.isHtml ? e(de, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(ct, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
444
444
  }, Et = ({ card: t, avatars: a }) => {
445
445
  const r = ((n) => {
446
446
  if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
447
447
  const s = n.props.properties, i = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
448
- for (const { key: l, isHtml: d } of i) {
448
+ for (const { key: l, isHtml: u } of i) {
449
449
  const c = s[l];
450
450
  if (typeof c != "string") continue;
451
451
  const v = c.trim();
452
452
  if (v) {
453
- if (d && !v.replaceAll(/<[^>]*>/g, "").trim()) continue;
454
- return { content: v, isHtml: d };
453
+ if (u && !v.replaceAll(/<[^>]*>/g, "").trim()) continue;
454
+ return { content: v, isHtml: u };
455
455
  }
456
456
  }
457
457
  return null;
458
458
  })(t);
459
- return r ? e(ie, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e(ce, { className: "chat-message-text", html: r.content }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
459
+ return r ? e(oe, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e(de, { className: "chat-message-text", html: r.content }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
460
460
  }, At = ({ card: t, userResponse: a, avatars: r }) => {
461
461
  const n = ((s, i) => {
462
462
  if (s.type === "open" && i && typeof i == "object" && "value" in i) return i.value;
463
463
  })(t, a);
464
464
  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` })] });
465
465
  }, Bt = ({ card: t, avatars: a, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => {
466
- const { endCard: s } = $((i) => ({ endCard: i.endCard }));
467
- return e(ke, { children: [e(ie, { avatars: a, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (s == null ? void 0 : s.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (s == null ? void 0 : s.subheader) && e(ie, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: s.subheader } }), e(ut, {})] });
468
- }, $t = ({ card: t, cardIndex: a, index: r, avatars: n, cardResponses: s, questionThinkingStates: i, startingQuestionIdx: l, currentQuestionBubbleRef: d, handleCardResponse: c }) => {
469
- const v = a === r, y = a < r, o = Ve(t);
470
- if (o) return e(Bt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: v });
471
- const p = `${t.name}`, k = s.get(p), f = t.type === "open", m = i.get(p), S = a > (l ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (m === !0 || m === void 0);
472
- return e(Re.Fragment, { children: [e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: v, isThinking: S }), !S && e(Et, { avatars: n, card: t }), y && f ? e(At, { avatars: n, card: t, userResponse: k }) : (!y || !f) && !S && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(Qt, { card: t, className: o ? "chat-thanks-card" : "chat-card", isAnswered: y, next: v ? c : () => {
466
+ const { endCard: s } = O((i) => ({ endCard: i.endCard }));
467
+ return e(he, { children: [e(oe, { avatars: a, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (s == null ? void 0 : s.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (s == null ? void 0 : s.subheader) && e(oe, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: s.subheader } }), e(ut, {})] });
468
+ }, $t = ({ card: t, cardIndex: a, index: r, avatars: n, cardResponses: s, questionThinkingStates: i, startingQuestionIdx: l, currentQuestionBubbleRef: u, handleCardResponse: c }) => {
469
+ const v = a === r, y = a < r, o = Ge(t);
470
+ if (o) return e(Bt, { avatars: n, card: t, currentQuestionBubbleRef: u, isCurrentQuestion: v });
471
+ const m = `${t.name}`, k = s.get(m), f = t.type === "open", h = i.get(m);
472
+ if (t.type === "aidynamicfollowup" && (t.props.loading === null || t.props.loading === void 0)) return e(he, {});
473
+ const S = a > (l ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (h === !0 || h === void 0);
474
+ return e(Me.Fragment, { children: [e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: u, isCurrentQuestion: v, isThinking: S }), !S && e(Et, { avatars: n, card: t }), y && f ? e(At, { avatars: n, card: t, userResponse: k }) : (!y || !f) && !S && e(oe, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(Qt, { card: t, className: o ? "chat-thanks-card" : "chat-card", isAnswered: y, next: v ? c : () => {
473
475
  } }) }) })] }, `question-card-${t.name}`);
474
- }, ie = Re.forwardRef(({ message: t, isLeft: a = !1, children: r, avatars: n, hideAvatar: s = !1 }, i) => {
476
+ }, oe = Me.forwardRef(({ message: t, isLeft: a = !1, children: r, avatars: n, hideAvatar: s = !1 }, i) => {
475
477
  const l = a ? "chat-bubble-left" : "chat-bubble-right";
476
478
  return e("div", { className: `chat-bubble-container ${a ? "chat-left" : "chat-right"}${a && s ? " chat-no-avatar" : ""}`, ref: i, children: [a && !s && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${l}`, children: r || e("div", { className: "chat-message-text", children: t.content }) }), !a && !s && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x` })] });
477
479
  });
478
- ie.displayName = "ChatBubble";
480
+ oe.displayName = "ChatBubble";
479
481
  const Ot = () => {
480
- const t = $((r) => r.close), a = le(() => () => t(Te), [t]);
482
+ const t = O((r) => r.close), a = ce(() => () => t(_e), [t]);
481
483
  return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: a, onKeyPress: (r) => {
482
484
  r.key === "Enter" && a();
483
485
  }, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
@@ -517,76 +519,85 @@ const Ot = () => {
517
519
  }
518
520
  }, Ft = ({ cards: t, next: a, previousResponses: r }) => {
519
521
  const { cardResponses: n, setCardResponse: s } = (() => {
520
- const [u, h] = O(/* @__PURE__ */ new Map());
521
- return { cardResponses: u, setCardResponse: oe((x, g) => {
522
- h((b) => new Map(b).set(x, g));
522
+ const [d, p] = V(/* @__PURE__ */ new Map());
523
+ return { cardResponses: d, setCardResponse: le((x, g) => {
524
+ p((b) => new Map(b).set(x, g));
523
525
  }, []) };
524
- })(), { index: i, isLongFormSurvey: l, avatars: d, showSurveyBrand: c, forceBrandedLogo: v, marketingUrlLink: y, startingQuestionIdx: o, viewDocument: p, createDynamicQuestion: k, update: f } = $((u) => ({ index: u.index, isLongFormSurvey: Me(u.studyType), avatars: u.avatars, forceBrandedLogo: u.forceBrandedLogo, startingQuestionIdx: u.startingQuestionIdx, showSurveyBrand: u.showSurveyBrand, marketingUrlLink: Ye({ marketingUrl: u.marketingUrl, slugName: u.slugName, surveyId: u.surveyId, forceBrandedLogo: u.forceBrandedLogo }), viewDocument: u.viewDocument, createDynamicQuestion: u.createDynamicQuestion, update: u.update })), { currentQuestionBubbleRef: m, scrollToCurrentQuestion: S } = (({ viewDocument: u }) => {
525
- const h = J(null), x = oe(() => {
526
- const g = u.querySelector(".ul-card-main-content");
527
- if (h.current && g && g instanceof HTMLElement) {
528
- const b = h.current.offsetTop - g.offsetTop - 16;
526
+ })(), { index: i, isLongFormSurvey: l, avatars: u, showSurveyBrand: c, forceBrandedLogo: v, marketingUrlLink: y, startingQuestionIdx: o, viewDocument: m, createDynamicQuestion: k, update: f } = O((d) => ({ index: d.index, isLongFormSurvey: Ue(d.studyType), avatars: d.avatars, forceBrandedLogo: d.forceBrandedLogo, startingQuestionIdx: d.startingQuestionIdx, showSurveyBrand: d.showSurveyBrand, marketingUrlLink: Ye({ marketingUrl: d.marketingUrl, slugName: d.slugName, surveyId: d.surveyId, forceBrandedLogo: d.forceBrandedLogo }), viewDocument: d.viewDocument, createDynamicQuestion: d.createDynamicQuestion, update: d.update })), { currentQuestionBubbleRef: h, scrollToCurrentQuestion: S } = (({ viewDocument: d }) => {
527
+ const p = ee(null), x = le(() => {
528
+ const g = d.querySelector(".ul-card-main-content");
529
+ if (p.current && g && g instanceof HTMLElement) {
530
+ const b = p.current.offsetTop - g.offsetTop - 16;
529
531
  g.scrollTo({ top: Math.max(0, b), behavior: "smooth" });
530
532
  }
531
533
  }, []);
532
- return { currentQuestionBubbleRef: h, scrollToCurrentQuestion: x };
533
- })({ viewDocument: p }), N = ((u, h, x) => {
534
- const [g, b] = O(/* @__PURE__ */ new Map());
535
- return re(() => {
536
- if (u.length > 0 && h < u.length) {
537
- const I = u[h], L = `${I.name}`;
538
- if (h <= (x ?? 0) || Ve(I)) return void b((V) => new Map(V).set(L, !1));
539
- const R = (V) => V.type === "aidynamicfollowup";
540
- b((V) => {
541
- const G = !R(I) || !!I.props.loading;
542
- return new Map(V).set(L, G);
534
+ return { currentQuestionBubbleRef: p, scrollToCurrentQuestion: x };
535
+ })({ viewDocument: m }), N = ((d, p, x) => {
536
+ const [g, b] = V(/* @__PURE__ */ new Map());
537
+ return ne(() => {
538
+ if (d.length > 0 && p < d.length) {
539
+ const I = d[p], R = `${I.name}`, P = ($) => $.type === "aidynamicfollowup", Q = ($) => {
540
+ var H;
541
+ if (p > 0) {
542
+ const Z = d[p - 1];
543
+ if (P(Z)) {
544
+ const ae = `${Z.name}`, ue = !!((H = Z.props) != null && H.loading);
545
+ if ($.get(ae) !== ue) return new Map($).set(ae, ue);
546
+ }
547
+ }
548
+ return $;
549
+ };
550
+ if (p <= (x ?? 0) || Ge(I)) return b(($) => Q(new Map($).set(R, !1)));
551
+ b(($) => {
552
+ const H = !P(I) || !!I.props.loading;
553
+ return Q(new Map($).set(R, H));
543
554
  });
544
- const H = setTimeout(() => {
545
- b((V) => {
546
- const G = !!R(I) && !!I.props.loading;
547
- return new Map(V).set(L, G);
555
+ const z = setTimeout(() => {
556
+ b(($) => {
557
+ const H = !!P(I) && !!I.props.loading;
558
+ return Q(new Map($).set(R, H));
548
559
  });
549
560
  }, 1e3);
550
- return () => clearTimeout(H);
561
+ return () => clearTimeout(z);
551
562
  }
552
- }, [h, u, x]), g;
553
- })(t, i, o), q = ((u, h) => {
554
- const [x, g] = O(() => /* @__PURE__ */ new Set([u]));
555
- return re(() => {
556
- g((b) => new Set(b).add(u));
557
- }, [u]), re(() => {
558
- const b = h ?? 0;
563
+ }, [p, d, x]), g;
564
+ })(t, i, o), q = ((d, p) => {
565
+ const [x, g] = V(() => /* @__PURE__ */ new Set([d]));
566
+ return ne(() => {
567
+ g((b) => new Set(b).add(d));
568
+ }, [d]), ne(() => {
569
+ const b = p ?? 0;
559
570
  b > 0 && g((I) => {
560
- const L = new Set(I);
561
- for (let R = 0; R <= b; R++) L.add(R);
562
- return L;
571
+ const R = new Set(I);
572
+ for (let P = 0; P <= b; P++) R.add(P);
573
+ return R;
563
574
  });
564
- }, [h]), x;
565
- })(i, o), E = le(() => ({ ...r, ...we(t.map((u, h) => {
575
+ }, [p]), x;
576
+ })(i, o), E = ce(() => ({ ...r, ...De(t.map((d, p) => {
566
577
  var x, g;
567
- return { ...u, value: h < i ? ((x = n.get(`${u.name}`)) == null ? void 0 : x.value) ?? null : null, secondaryValue: h < i ? ((g = n.get(`${u.name}`)) == null ? void 0 : g.secondaryValue) ?? null : null };
578
+ return { ...d, value: p < i ? ((x = n.get(`${d.name}`)) == null ? void 0 : x.value) ?? null : null, secondaryValue: p < i ? ((g = n.get(`${d.name}`)) == null ? void 0 : g.secondaryValue) ?? null : null };
568
579
  })) }), [r, n, t, i]);
569
580
  ze(E);
570
581
  const _ = Ke(t, E);
571
- re(() => {
582
+ ne(() => {
572
583
  requestAnimationFrame(() => {
573
584
  S();
574
585
  }), f();
575
586
  }, [i, S, N, f]);
576
- const Q = oe((u, h) => {
577
- if (!h) return;
587
+ const G = le((d, p) => {
588
+ if (!p) return;
578
589
  const x = _[i];
579
590
  if (!x) return;
580
591
  const g = `${x.name}`;
581
- s(g, u);
582
- const b = { ...u, questionText: We(x) };
592
+ s(g, d);
593
+ const b = { ...d, questionText: We(x) };
583
594
  if (x.childId && (b == null ? void 0 : b.value) != null) {
584
- const I = we([x].map((L) => ({ ...L, value: (b == null ? void 0 : b.value) ?? null, secondaryValue: (b == null ? void 0 : b.secondaryValue) ?? null })));
595
+ const I = De([x].map((R) => ({ ...R, value: (b == null ? void 0 : b.value) ?? null, secondaryValue: (b == null ? void 0 : b.secondaryValue) ?? null })));
585
596
  k({ parentQuestionId: x.name, parentResponseConfig: I });
586
597
  }
587
598
  a([b]);
588
- }, [_, i, a, s]), A = _.map((u, h) => ({ card: u, cardIndex: h })).filter(({ cardIndex: u }) => q.has(u));
589
- return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!l && e(Ot, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: A.map(({ card: u, cardIndex: h }) => e($t, { avatars: d, card: u, cardIndex: h, cardResponses: n, currentQuestionBubbleRef: m, handleCardResponse: Q, index: i, questionThinkingStates: N, startingQuestionIdx: o }, `question-card-${u.name}`)) }) }), l && e("div", { className: "long-form-question-footer-container-logo", children: c && e(Xe, { forceBrandedLogo: v, marketingUrlLink: y }) })] });
599
+ }, [_, i, a, s]), A = _.map((d, p) => ({ card: d, cardIndex: p })).filter(({ cardIndex: d }) => q.has(d));
600
+ return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!l && e(Ot, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: A.map(({ card: d, cardIndex: p }) => e($t, { avatars: u, card: d, cardIndex: p, cardResponses: n, currentQuestionBubbleRef: h, handleCardResponse: G, index: i, questionThinkingStates: N, startingQuestionIdx: o }, `question-card-${d.name}`)) }) }), l && e("div", { className: "long-form-question-footer-container-logo", children: c && e(Xe, { forceBrandedLogo: v, marketingUrlLink: y }) })] });
590
601
  };
591
602
  export {
592
603
  Ft as default