@sprig-technologies/sprig-browser 2.40.2 → 2.40.4

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,7 +1,7 @@
1
- import { a as A, u as e, h as $, c as L, b as j, e as J, f as fe, p as te, F as oe, _ as K, T as le, A as Ve, g as ke, i as Fe, j as Ze, k as Ye, w as Re, l as ze } from "./view-BGlLLPXB.js";
2
- import { v as Ke, R as V, B as X, M as z, Q as re, O as xe, a as W, b as ue, S as Xe, L as We, u as Je, H as ce, c as Ce, g as et, P as tt, p as rt, d as nt, s as st } from "./getAttributedUrl-C_5gL6aZ.js";
3
- import { a as ve, D as Te, A as _e, g as at } from "./core-Cyu7gofl.js";
4
- import { t as Le } from "./metricsReporter-B-oKhuWk.js";
1
+ import { a as A, u as e, h as $, c as L, b as j, e as z, f as fe, p as re, F as oe, _ as W, T as le, A as Ve, g as ke, i as Fe, j as Ze, k as Ye, w as Re, l as ze } from "./view-E-Mxwe-D.js";
2
+ import { v as Ke, R as V, B as K, M as X, Q as J, O as xe, a as ee, b as ue, S as Xe, L as We, u as Je, H as ce, c as Ce, g as et, P as tt, p as rt, d as nt, s as st } from "./getAttributedUrl-CwDSDeGp.js";
3
+ import { a as ve, D as Te, A as _e, g as at } from "./core-DH1nitXA.js";
4
+ import { t as Le } from "./metricsReporter-VDxBxz-n.js";
5
5
  const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
6
6
  const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: i } = A((o) => ({ apiURL: o.apiURL, viewDocument: o.viewDocument }));
7
7
  return e("div", { id: n, ref: (o) => {
@@ -10,45 +10,45 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
10
10
  o.appendChild(d);
11
11
  }
12
12
  } });
13
- }, se = ({ isDisabled: t, onClick: s, children: r }) => e(X, { className: "ul-card__button-checkmark", disabled: t, onClick: s, 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"] }), lt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
14
- const { useMobileStyling: i, border: o } = A((g) => ({ useMobileStyling: g.useMobileStyling, border: g.border })), [d, c] = $(!1), [m, h] = $(""), [l, u] = $(!1), y = r == null ? void 0 : r.collectName, x = (r == null ? void 0 : r.nameLabelText) || "Full Name", p = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", T = (r == null ? void 0 : r.submitButtonText) || "Submit", D = !!m.trim(), R = d && (!y || D), f = (g, w = !1) => {
13
+ }, se = ({ isDisabled: t, onClick: s, children: r }) => e(K, { className: "ul-card__button-checkmark", disabled: t, onClick: s, 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"] }), lt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
14
+ const { useMobileStyling: i, border: o } = A((g) => ({ useMobileStyling: g.useMobileStyling, border: g.border })), [d, c] = $(!1), [m, h] = $(""), [l, u] = $(!1), y = r == null ? void 0 : r.collectName, f = (r == null ? void 0 : r.nameLabelText) || "Full Name", p = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", T = (r == null ? void 0 : r.submitButtonText) || "Submit", w = !!m.trim(), R = d && (!y || w), k = (g, D = !1) => {
15
15
  g.preventDefault(), g.stopPropagation();
16
16
  let I = null;
17
- if (!w) {
17
+ if (!D) {
18
18
  if (!R) return void u(!0);
19
19
  I = { submitted: !0 }, y && (I.name = m);
20
20
  }
21
- s({ value: I, questionId: n, type: a }, !!w || R);
21
+ s({ value: I, questionId: n, type: a }, !!D || R);
22
22
  };
23
- return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(z, { embeddedType: "pdf", properties: r, children: e(re, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: l && !d, id: "consent", isRadio: !1, isSelected: d, label: p, onUserInputChanged: ({ selected: g }) => {
23
+ return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(X, { embeddedType: "pdf", properties: r, children: e(J, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: l && !d, id: "consent", isRadio: !1, isSelected: d, label: p, onUserInputChanged: ({ selected: g }) => {
24
24
  g !== d && c(!d);
25
- }, useMobileStyling: i }), y && e("input", { "aria-label": x, "aria-placeholder": x, className: L(j("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (g) => {
26
- g.currentTarget.style.borderColor = l && !D ? ve : Te;
25
+ }, useMobileStyling: i }), y && 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: (g) => {
26
+ g.currentTarget.style.borderColor = l && !w ? ve : Te;
27
27
  }, onFocus: (g) => {
28
- g.currentTarget.style.borderColor = l && !D ? ve : o;
28
+ g.currentTarget.style.borderColor = l && !w ? ve : o;
29
29
  }, onInput: (g) => {
30
30
  g.preventDefault(), g.stopPropagation(), h(g.currentTarget.value);
31
- }, placeholder: x, style: l && !D ? { borderColor: ve } : {}, tabIndex: 0, value: m })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(se, { isDisabled: !R, onClick: (g) => f(new SubmitEvent(g.type)), children: J({ buttonText: T }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (g) => f(new SubmitEvent(g.type), !0), children: fe(r) })] })] }) }) }, n);
31
+ }, placeholder: f, style: l && !w ? { borderColor: ve } : {}, tabIndex: 0, value: m })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(se, { isDisabled: !R, onClick: (g) => k(new SubmitEvent(g.type)), children: z({ buttonText: T }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (g) => k(new SubmitEvent(g.type), !0), children: fe(r) })] })] }) }) }, n);
32
32
  }, ot = () => {
33
33
  const { destroy: t, forceBrandedLogo: s } = A((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
34
- return te(() => {
34
+ return re(() => {
35
35
  setTimeout(() => {
36
36
  t(_e);
37
37
  }, s ? 4e3 : 2e3);
38
38
  }, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" });
39
39
  }, ct = ({ activeValue: t, border: s, icon: r, enableCspTrustedTypes: n, isPressed: a, range: i, scaleLabelType: o, selectedValue: d, setSelectedValue: c, setActiveValue: m, setIsPressed: h, useMobileStyling: l, value: u, viewDocument: y }) => {
40
- const x = `option-${u}`, p = o === "number", T = o === "star", D = o === "smiley", R = p && u === t || u === d, [f, g] = (() => {
41
- const k = T && d !== null && u <= d;
42
- return T && u <= t || D && u === t || k || u === t || u === d ? [s, a || k || u === d ? 1 : 0.3] : ["", 1];
43
- })(), w = oe(() => {
44
- const k = { borderColor: R ? f : "", fillOpacity: R ? "" : g, zIndex: R ? 3 : "auto", color: d === u ? "#fff" : "" };
45
- return p ? { ...k, backgroundColor: d === u ? f : "" } : { ...k, color: T || D || d === u ? f : "" };
46
- }, [R, f, g, d, u, p, T, D]), I = oe(() => at((({ icon: k, scaleLabelType: b, value: S, selectedValue: v }) => {
40
+ const f = `option-${u}`, p = o === "number", T = o === "star", w = o === "smiley", R = p && u === t || u === d, [k, g] = (() => {
41
+ const x = T && d !== null && u <= d;
42
+ return T && u <= t || w && u === t || x || u === t || u === d ? [s, a || x || u === d ? 1 : 0.3] : ["", 1];
43
+ })(), D = oe(() => {
44
+ const x = { borderColor: R ? k : "", fillOpacity: R ? "" : g, zIndex: R ? 3 : "auto", color: d === u ? "#fff" : "" };
45
+ return p ? { ...x, backgroundColor: d === u ? k : "" } : { ...x, color: T || w || d === u ? k : "" };
46
+ }, [R, k, g, d, u, p, T, w]), I = oe(() => at((({ icon: x, scaleLabelType: b, value: S, selectedValue: v }) => {
47
47
  if (b === "smiley" && S === v) {
48
48
  let _ = 0;
49
- return k.replace(/black/g, () => ++_ == 1 ? "black" : "white");
49
+ return x.replace(/black/g, () => ++_ == 1 ? "black" : "white");
50
50
  }
51
- return k;
51
+ return x;
52
52
  })({ icon: r, scaleLabelType: o, value: u, selectedValue: d }), n), [n, r, o, d, u]);
53
53
  return e("button", { "aria-label": p ? void 0 : String(u), className: (() => {
54
54
  switch (o) {
@@ -59,68 +59,68 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
59
59
  default:
60
60
  return u === i ? L(j("likert-number", l), j(`likert-number-${u}`, l), j("likert-last-option", l)) : L(j("likert-number", l), j(`likert-number-${u}`, l));
61
61
  }
62
- })(), dangerouslySetInnerHTML: { __html: I }, id: x, onClick: (k) => {
63
- k.preventDefault(), k.stopPropagation(), c(u);
64
- }, onKeyDown: (k) => {
62
+ })(), dangerouslySetInnerHTML: { __html: I }, id: f, onClick: (x) => {
63
+ x.preventDefault(), x.stopPropagation(), c(u);
64
+ }, onKeyDown: (x) => {
65
65
  var v, _;
66
66
  const b = y.querySelectorAll(`.likert-${o ?? "number"}`), S = u - 1;
67
- k.key === "ArrowRight" ? (v = b[S + 1]) == null || v.focus() : k.key === "ArrowLeft" ? (_ = b[S - 1]) == null || _.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), c(u));
67
+ x.key === "ArrowRight" ? (v = b[S + 1]) == null || v.focus() : x.key === "ArrowLeft" ? (_ = b[S - 1]) == null || _.focus() : x.key !== "Enter" && x.key !== " " || (x.preventDefault(), x.stopPropagation(), c(u));
68
68
  }, onPointerDown: () => h(!0), onPointerEnter: () => m(u), onPointerLeave: () => {
69
69
  m(-1), h(!1);
70
- }, style: w, tabIndex: 0 });
70
+ }, style: D, tabIndex: 0 });
71
71
  }, dt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i }) => {
72
- const { border: o, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: m } = A((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [h, l] = $(-1), [u, y] = $(!1), [x, p] = $(null), T = s && s.left, D = s && s.right;
72
+ const { border: o, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: m } = A((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [h, l] = $(-1), [u, y] = $(!1), [f, p] = $(null), T = s && s.left, w = s && s.right;
73
73
  let R;
74
- const { range: f, scaleLabelType: g, ratingIcons: w } = n;
75
- f && (R = Number(f));
76
- const I = R || 5, k = (b) => {
74
+ const { range: k, scaleLabelType: g, ratingIcons: D } = n;
75
+ k && (R = Number(k));
76
+ const I = R || 5, x = (b) => {
77
77
  var S, v;
78
78
  switch (g) {
79
79
  case "star":
80
- return (S = w[0]) == null ? void 0 : S.svg;
80
+ return (S = D[0]) == null ? void 0 : S.svg;
81
81
  case "smiley":
82
- return (v = w[b]) == null ? void 0 : v.svg;
82
+ return (v = D[b]) == null ? void 0 : v.svg;
83
83
  default:
84
84
  return String(b + 1);
85
85
  }
86
86
  };
87
- return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(z, { properties: n, children: [e(W, { children: [e("div", { "aria-label": `Rating (1 - ${I})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(I)].map((b, S) => {
87
+ return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(X, { properties: n, children: [e(ee, { children: [e("div", { "aria-label": `Rating (1 - ${I})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(I)].map((b, S) => {
88
88
  const v = S + 1;
89
- return e(ct, { activeValue: h, border: o, enableCspTrustedTypes: m, icon: k(S), isPressed: u, range: I, scaleLabelType: g, selectedValue: x, setActiveValue: l, setIsPressed: y, setSelectedValue: p, useMobileStyling: d, value: v, viewDocument: c }, S);
90
- }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: T }), e("span", { children: D })] })] }), e(re, { children: e(se, { isDisabled: x === null && n.required, onClick: () => r({ value: x, questionId: a, type: i }, !0), children: J(n) }) })] }) }, a);
89
+ return e(ct, { activeValue: h, border: o, enableCspTrustedTypes: m, icon: x(S), isPressed: u, range: I, scaleLabelType: g, selectedValue: f, setActiveValue: l, setIsPressed: y, setSelectedValue: p, useMobileStyling: d, value: v, viewDocument: c }, S);
90
+ }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: T }), e("span", { children: w })] })] }), e(J, { children: e(se, { isDisabled: f === null && n.required, onClick: () => r({ value: f, questionId: a, type: i }, !0), children: z(n) }) })] }) }, a);
91
91
  }, ut = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
92
- const a = K([]), { border: i, useMobileStyling: o } = A((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling })), d = r.findIndex((u) => n[u.id] === null), [c, m] = $(d), h = le((u, y) => {
92
+ const a = W([]), { border: i, useMobileStyling: o } = A((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling })), d = r.findIndex((u) => n[u.id] === null), [c, m] = $(d), h = le((u, y) => {
93
93
  s(u, y);
94
- const x = c + 1, p = r[x];
95
- p && n[p.id] === null && m(x);
94
+ const f = c + 1, p = r[f];
95
+ p && n[p.id] === null && m(f);
96
96
  }, [s, r, n, c]), l = le((u, y) => {
97
- const x = c === u;
98
- return e(Ve, { animate: !0, header: y.label, isOpen: x, onClick: () => {
97
+ const f = c === u;
98
+ return e(Ve, { animate: !0, header: y.label, isOpen: f, onClick: () => {
99
99
  var p;
100
- return m(x && !((p = window.UserLeap) != null && p.isMobileSDK) ? -1 : u);
100
+ return m(f && !((p = window.UserLeap) != null && p.isMobileSDK) ? -1 : u);
101
101
  }, ref: (p) => {
102
102
  p && (a.current[u] = p);
103
103
  }, showHeaderCheck: n[y.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((p) => e(xe, { allowTextEntry: !1, ariaLabel: `${y.label}-${p.label}`, border: i, error: !1, id: `${y.id}-${p.value}`, isRadio: !0, isSelected: n[y.id] === p.value, label: p.label, onUserInputChanged: () => h(y.id, p.value), useMobileStyling: o }, p.label)) }) }, y.id);
104
104
  }, [i, t, c, h, n, o]);
105
105
  return e("div", { children: r.map((u, y) => l(y, u)) });
106
106
  }, pt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o }) => {
107
- const d = n.matrixColumn, c = n.required, m = (x) => {
108
- x.preventDefault(), x.stopPropagation(), s({ value: l, questionId: a, type: i }, !0), o && o();
109
- }, h = r.reduce((x, p) => (x[p.id] = null, x), {}), [l, u] = $(h);
110
- return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: m, children: e(z, { properties: n, children: [e(W, { children: e(ut, { columns: d, onSelect: (x, p) => {
111
- u((T) => ({ ...T, [x]: p }));
112
- }, options: r, selectedOptions: l }) }), e(re, { children: e(se, { isDisabled: (y = l, c && Object.values(y).every((x) => x == null)), onClick: () => m(new SubmitEvent("submit")), children: J(n) }) })] }) }, a);
107
+ const d = n.matrixColumn, c = n.required, m = (f) => {
108
+ f.preventDefault(), f.stopPropagation(), s({ value: l, questionId: a, type: i }, !0), o && o();
109
+ }, h = r.reduce((f, p) => (f[p.id] = null, f), {}), [l, u] = $(h);
110
+ return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: m, children: e(X, { properties: n, children: [e(ee, { children: e(ut, { columns: d, onSelect: (f, p) => {
111
+ u((T) => ({ ...T, [f]: p }));
112
+ }, options: r, selectedOptions: l }) }), e(J, { children: e(se, { isDisabled: (y = l, c && Object.values(y).every((f) => f == null)), onClick: () => m(new SubmitEvent("submit")), children: z(n) }) })] }) }, a);
113
113
  var y;
114
114
  }, Me = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: i, showIndividualSubmit: o = !1, onSubmitButtonClick: d }) => {
115
- const { border: c, useMobileStyling: m } = A((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling })), h = r.reduce((v, _) => (v[_.id] = { isSelected: !1 }, v), {}), [l, u] = $(h), y = i === "multiplechoice", x = n.required, p = r.find((v) => {
115
+ const { border: c, useMobileStyling: m } = A((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling })), h = r.reduce((v, _) => (v[_.id] = { isSelected: !1 }, v), {}), [l, u] = $(h), y = i === "multiplechoice", f = n.required, p = r.find((v) => {
116
116
  var _;
117
117
  return (_ = v.optionProperties) == null ? void 0 : _.noneOfTheAbove;
118
118
  }), T = (v) => Object.entries(v).some(([_, B]) => {
119
119
  var Q;
120
- const H = r.find((ee) => `${ee.id}` === _), O = B.userText === void 0 || B.userText.trim() === "";
120
+ const H = r.find((te) => `${te.id}` === _), O = B.userText === void 0 || B.userText.trim() === "";
121
121
  return ((Q = H == null ? void 0 : H.optionProperties) == null ? void 0 : Q.allowsTextEntry) && O && B.isSelected;
122
- }), D = (v) => Object.values(v).filter((_) => _.isSelected).length, R = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && D(l) < n.minSelect && (x || D(l) > 0), f = (v) => T(v) || x && !D(v) || !((_) => {
123
- const { minSelect: B = 0, maxSelect: H = 1 / 0, maxSelectMode: O } = n, Q = D(_);
122
+ }), w = (v) => Object.values(v).filter((_) => _.isSelected).length, R = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && w(l) < n.minSelect && (f || w(l) > 0), k = (v) => T(v) || f && !w(v) || !((_) => {
123
+ const { minSelect: B = 0, maxSelect: H = 1 / 0, maxSelectMode: O } = n, Q = w(_);
124
124
  switch (O) {
125
125
  case ue.Maximum:
126
126
  return Q <= H;
@@ -132,11 +132,11 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
132
132
  })(v), g = Object.entries(l).some(([v, _]) => {
133
133
  var B, H;
134
134
  return _.isSelected && ((H = (B = r.find((O) => `${O.id}` === v)) == null ? void 0 : B.optionProperties) == null ? void 0 : H.allowsTextEntry);
135
- }), w = o && (!y || g), I = (v) => {
135
+ }), D = o && (!y || g), I = (v) => {
136
136
  S(v.id, v.selected, v.userText, v.noneOfTheAbove);
137
- }, k = (v) => {
137
+ }, x = (v) => {
138
138
  var _;
139
- return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && D(l) === (n == null ? void 0 : n.maxSelect) && !((_ = l[v]) != null && _.isSelected);
139
+ return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && w(l) === (n == null ? void 0 : n.maxSelect) && !((_ = l[v]) != null && _.isSelected);
140
140
  }, b = () => {
141
141
  s(l, !0), d && d();
142
142
  }, S = (v, _, B, H) => {
@@ -145,16 +145,16 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
145
145
  else p && !H && l[p.id].isSelected && (O[p.id].isSelected = !1);
146
146
  O[v] = { isSelected: _, userText: B }, u(O);
147
147
  };
148
- return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(z, { properties: n, children: [e(W, { children: [n.isDropdown ? e(Xe, { disabledOptions: r.filter((v) => k(v.id)), dropdownFooter: R ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [D(l), "/", n.minSelect] }) : void 0, isMultiSelect: !y, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (v) => {
148
+ return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(X, { properties: n, children: [e(ee, { children: [n.isDropdown ? e(Xe, { disabledOptions: r.filter((v) => x(v.id)), dropdownFooter: R ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [w(l), "/", n.minSelect] }) : void 0, isMultiSelect: !y, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (v) => {
149
149
  const _ = { ...l };
150
150
  for (const B of r) v.includes(B) ? _[B.id].isSelected = !0 : _[B.id].isSelected = !1;
151
151
  u(_);
152
152
  }, options: r, placeholderText: n.dropdownPlaceholderText ?? (y ? "Select choice" : "Select choice(s)"), value: r.filter((v) => l[v.id].isSelected) }) : e("div", { className: L(j("ul-card__choices", m)), role: y ? "radiogroup" : "group", children: [r.map(({ id: v, label: _, value: B, optionProperties: H }) => {
153
153
  var G, ne;
154
- const O = `${v}`, { allowsTextEntry: Q, noneOfTheAbove: ee } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...H };
155
- return e(xe, { allowTextEntry: Q, border: c, disabled: k(O), error: (Z = l, T(Z)), id: O, isRadio: y, isSelected: !!((G = l[O]) != null && G.isSelected), label: _, noneOfTheAbove: ee, onUserInputChanged: I, promptText: "Please specify", text: (ne = l[v]) == null ? void 0 : ne.userText, useMobileStyling: m, value: B }, O);
154
+ const O = `${v}`, { allowsTextEntry: Q, noneOfTheAbove: te } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...H };
155
+ return e(xe, { allowTextEntry: Q, border: c, disabled: x(O), error: (Z = l, T(Z)), id: O, isRadio: y, isSelected: !!((G = l[O]) != null && G.isSelected), label: _, noneOfTheAbove: te, onUserInputChanged: I, promptText: "Please specify", text: (ne = l[v]) == null ? void 0 : ne.userText, useMobileStyling: m, value: B }, O);
156
156
  var Z;
157
- }), !!R && e("div", { className: "ul-card__min-select-counter", children: [D(l), "/", n.minSelect] })] }), w && e(We, { handleSubmit: b, isSubmitDisabled: f(l) })] }), e(re, { children: e(se, { isDisabled: f(l), onClick: b, children: J(n) }) })] }) }, a);
157
+ }), !!R && e("div", { className: "ul-card__min-select-counter", children: [w(l), "/", n.minSelect] })] }), D && e(We, { handleSubmit: b, isSubmitDisabled: k(l) })] }), e(J, { children: e(se, { isDisabled: k(l), onClick: b, children: z(n) }) })] }) }, a);
158
158
  }, mt = (t) => {
159
159
  const { questionId: s, type: r, next: n, options: a } = t;
160
160
  return e(Me, { ...t, onSubmit: (i, o) => {
@@ -173,34 +173,34 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
173
173
  } });
174
174
  }, vt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: i }) => {
175
175
  const [o, d] = $(null), { border: c, useMobileStyling: m, viewDocument: h } = A((y) => ({ border: y.border, useMobileStyling: y.useMobileStyling, viewDocument: y.viewDocument })), l = s && s.left, u = s && s.right;
176
- return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(z, { properties: r, children: [e(W, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((y, x) => e("button", { className: L(j("nps-number", m), j(`nps-number-${x}`, m)), id: `option-${x}`, onClick: (p) => {
177
- p.preventDefault(), p.stopPropagation(), d(x);
176
+ return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(X, { properties: r, children: [e(ee, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((y, f) => e("button", { className: L(j("nps-number", m), j(`nps-number-${f}`, m)), id: `option-${f}`, onClick: (p) => {
177
+ p.preventDefault(), p.stopPropagation(), d(f);
178
178
  }, onKeyDown: (p) => {
179
- var D, R;
179
+ var w, R;
180
180
  const T = h.querySelectorAll("button.nps-number");
181
- p.key === "ArrowRight" ? (D = T[x + 1]) == null || D.focus() : p.key === "ArrowLeft" ? (R = T[x - 1]) == null || R.focus() : p.key !== "Enter" && p.key !== " " || (p.preventDefault(), p.stopPropagation(), d(x));
181
+ p.key === "ArrowRight" ? (w = T[f + 1]) == null || w.focus() : p.key === "ArrowLeft" ? (R = T[f - 1]) == null || R.focus() : p.key !== "Enter" && p.key !== " " || (p.preventDefault(), p.stopPropagation(), d(f));
182
182
  }, onPointerDown: (p) => {
183
183
  p.currentTarget.style.zIndex = "2", p.currentTarget.style.borderColor = c;
184
184
  }, onPointerLeave: (p) => {
185
185
  p.currentTarget.style.zIndex = "auto", p.currentTarget.style.borderColor = Te;
186
- }, style: o === x ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: x }, x)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: l }), e("span", { children: u })] })] }), e(re, { children: e(se, { isDisabled: o === null && r.required, onClick: () => n({ value: o, questionId: a, type: i }, !0), children: J(r) }) })] }) }, a);
186
+ }, style: o === f ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: f }, f)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: l }), e("span", { children: u })] })] }), e(J, { children: e(se, { isDisabled: o === null && r.required, onClick: () => n({ value: o, questionId: a, type: i }, !0), children: z(r) }) })] }) }, a);
187
187
  }, gt = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: i }) => {
188
- const { border: o, useMobileStyling: d, update: c } = A((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, update: T.update })), [m, h] = $(""), l = K(null), u = m.trim(), y = r.required === !0 && !u, x = Je(l, () => c()), p = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
189
- return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(z, { properties: r, children: e("div", { className: "ul-card-text", children: [e(W, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": p, className: L(j("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (T) => {
188
+ const { border: o, useMobileStyling: d, update: c } = A((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, update: T.update })), [m, h] = $(""), l = W(null), u = m.trim(), y = r.required === !0 && !u, f = Je(l, () => c()), p = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
189
+ return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(X, { properties: r, children: e("div", { className: "ul-card-text", children: [e(ee, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": p, className: L(j("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (T) => {
190
190
  T.currentTarget.style.borderColor = Te;
191
191
  }, onChange: (T) => {
192
- const { value: D } = T.currentTarget;
193
- x(), T.preventDefault(), T.stopPropagation(), h(D);
192
+ const { value: w } = T.currentTarget;
193
+ f(), T.preventDefault(), T.stopPropagation(), h(w);
194
194
  }, onFocus: (T) => {
195
195
  T.currentTarget.style.borderColor = o;
196
- }, placeholder: p, ref: l, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(re, { children: e(se, { isDisabled: y, onClick: (T) => {
196
+ }, placeholder: p, ref: l, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(J, { children: e(se, { isDisabled: y, onClick: (T) => {
197
197
  T.preventDefault(), T.stopPropagation();
198
- const D = r.required !== !0 || u.length > 0;
199
- s({ value: m, questionId: n, type: a }, D), i && i();
200
- }, children: J(r) }) })] }) }) }, n);
198
+ const w = r.required !== !0 || u.length > 0;
199
+ s({ value: m, questionId: n, type: a }, w), i && i();
200
+ }, children: z(r) }) })] }) }) }, n);
201
201
  }, bt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o, options: d }) => {
202
- const c = K(null), m = K(0), h = K(0), l = K(null), u = K(!1), y = K([]), [x, p] = $(() => (n == null ? void 0 : n.required) === !0), [T, D] = $(() => d.map((C) => ({ ...C, rank: null }))), R = oe(() => Array.from({ length: d.length }, (C, q) => q + 1), [d.length]), { useMobileStyling: f, isPreview: g, headers: w } = A((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), I = (w == null ? void 0 : w["userleap-platform"]) === "android", k = f && !g && !I, b = !k && !I, S = (C, q) => {
203
- D((P) => {
202
+ const c = W(null), m = W(0), h = W(0), l = W(null), u = W(!1), y = W([]), [f, p] = $(() => (n == null ? void 0 : n.required) === !0), [T, w] = $(() => d.map((C) => ({ ...C, rank: null }))), R = oe(() => Array.from({ length: d.length }, (C, q) => q + 1), [d.length]), { useMobileStyling: k, isPreview: g, headers: D } = A((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), I = (D == null ? void 0 : D["userleap-platform"]) === "android", x = k && !g && !I, b = !x && !I, S = (C, q) => {
203
+ w((P) => {
204
204
  const N = parseInt(q), U = P.map((M) => ({ ...M }));
205
205
  U.some((M) => M.rank == null) && U.forEach((M, ae) => M.rank = ae + 1);
206
206
  const F = U.findIndex((M) => M.id === C);
@@ -210,7 +210,7 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
210
210
  M.id !== C && M.rank >= N && M.rank < E && (M.rank = M.rank + 1);
211
211
  }) : N > E && U.forEach((M) => {
212
212
  M.id !== C && M.rank > E && M.rank <= N && (M.rank = M.rank - 1);
213
- }), U[F].rank = N, U.sort((M, ae) => M.rank - ae.rank), ee(), U;
213
+ }), U[F].rank = N, U.sort((M, ae) => M.rank - ae.rank), te(), U;
214
214
  });
215
215
  }, v = (C, q) => {
216
216
  for (let P = 0; P < y.current.length; P++) {
@@ -221,14 +221,14 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
221
221
  }
222
222
  return null;
223
223
  }, _ = (C) => (q) => {
224
- if (!k) return;
224
+ if (!x) return;
225
225
  q.preventDefault(), q.stopPropagation(), u.current = !0, c.current = C;
226
226
  const P = q.touches[0];
227
227
  m.current = P.clientY, h.current = P.clientY;
228
228
  const N = q.currentTarget.closest(".ul-card-rank__option");
229
229
  N && (l.current = N, N.classList.add("is-dragging"));
230
230
  }, B = (C) => {
231
- if (!k || !u.current || c.current === null) return;
231
+ if (!x || !u.current || c.current === null) return;
232
232
  C.preventDefault(), C.stopPropagation();
233
233
  const q = C.touches[0];
234
234
  h.current = q.clientY;
@@ -239,23 +239,23 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
239
239
  const N = v(q.clientX, q.clientY);
240
240
  N && N.element.classList.add("is-drop-target");
241
241
  }, H = (C) => {
242
- if (!k || !u.current || c.current === null) return;
242
+ if (!x || !u.current || c.current === null) return;
243
243
  C.preventDefault(), C.stopPropagation();
244
244
  const q = C.changedTouches[0], P = v(q.clientX, q.clientY);
245
245
  l.current && (l.current.style.transform = "", l.current.style.zIndex = "", l.current.classList.remove("is-dragging")), y.current.forEach((N) => {
246
246
  N && N.classList.remove("is-drop-target");
247
247
  }), P && P.index !== c.current && O(c.current, P.index), c.current = null, l.current = null, u.current = !1;
248
248
  }, O = (C, q) => {
249
- D((P) => {
249
+ w((P) => {
250
250
  const N = P.map((F) => ({ ...F })), [U] = N.splice(C, 1);
251
251
  return N.splice(q, 0, U), N.forEach((F, E) => {
252
252
  F.rank = E + 1;
253
- }), ee(), N;
253
+ }), te(), N;
254
254
  });
255
255
  }, Q = (C) => {
256
256
  const q = {};
257
257
  C.reduce((P, N) => (P[N.id] = N.rank, P), q), r({ value: q, questionId: a, type: i }, !0);
258
- }, ee = () => {
258
+ }, te = () => {
259
259
  p(!1);
260
260
  }, { left: Z, right: G } = s, ne = d.length, de = (C) => {
261
261
  C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
@@ -266,7 +266,7 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
266
266
  };
267
267
  return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
268
268
  C.preventDefault(), Q(T), o && o();
269
- }, children: e(z, { properties: n, children: I ? e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", children: T.map(({ id: C, label: q, rank: P }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (N) => S(C, N.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((N) => e("option", { className: "ul-card-rank__select-option", value: N, children: N }, `${N}-${a}`))] }), e("span", { children: q })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }) : e(ke, { children: [e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: I ? void 0 : (C) => {
269
+ }, children: e(X, { properties: n, children: e(ke, I ? { children: [e(ee, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", children: T.map(({ id: C, label: q, rank: P }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (N) => S(C, N.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((N) => e("option", { className: "ul-card-rank__select-option", value: N, children: N }, `${N}-${a}`))] }), e("span", { children: q })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(J, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: f, children: z(n) }) }) })] } : { children: [e(ee, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: I ? void 0 : (C) => {
270
270
  C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
271
271
  }, children: T.map(({ id: C, label: q, rank: P }, N) => {
272
272
  return e("li", { className: "ul-card-rank__option", draggable: !!b || void 0, onDragEnd: b ? je : void 0, onDragEnter: b ? de : void 0, onDragLeave: b ? Ge : void 0, onDragStart: b ? (F = N, (E) => {
@@ -276,12 +276,12 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
276
276
  E.preventDefault(), E.currentTarget.classList.remove("is-drop-target");
277
277
  const M = c.current;
278
278
  c.current = null, (Ie = (ae = E.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ae.querySelector(".is-dragging")) == null || Ie.classList.remove("is-dragging"), M != null && M !== U && O(M, U);
279
- }) : void 0, ref: (E) => y.current[N] = E, children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (E) => S(C, E.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((E) => e("option", { className: "ul-card-rank__select-option", value: E, children: E }, E))] }), e("span", { children: q }), !I && e("button", { "aria-label": `Drag ${q} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: k ? H : void 0, onTouchMove: k ? B : void 0, onTouchStart: k ? _(N) : 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);
279
+ }) : void 0, ref: (E) => y.current[N] = E, children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (E) => S(C, E.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((E) => e("option", { className: "ul-card-rank__select-option", value: E, children: E }, E))] }), e("span", { children: q }), !I && e("button", { "aria-label": `Drag ${q} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: x ? H : void 0, onTouchMove: x ? B : void 0, onTouchStart: x ? _(N) : 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, F;
281
- }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: x, children: J(n) }) }) })] }) }) }, a);
282
- }, ge = 1, Ue = 2, Ee = 3, pe = (t) => t.type === "av_permission", De = (t) => t.type === "screen_permission", Ae = (t, s) => t === void 0 ? ge : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Ee : ge : Ue, we = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
283
- }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, Y = Fe((t) => ({ ...we, reset: () => {
284
- t(we);
281
+ }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(J, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: f, children: z(n) }) }) })] }) }) }, a);
282
+ }, ge = 1, Ue = 2, Ee = 3, pe = (t) => t.type === "av_permission", we = (t) => t.type === "screen_permission", Ae = (t, s) => t === void 0 ? ge : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Ee : ge : Ue, De = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
283
+ }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, Y = Fe((t) => ({ ...De, reset: () => {
284
+ t(De);
285
285
  }, updatePage: (s) => {
286
286
  t(s);
287
287
  } }));
@@ -333,9 +333,9 @@ function Se({ pages: t, setIsRequestingPermission: s }) {
333
333
  return;
334
334
  }
335
335
  }
336
- const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L($e, "ul_recorded-task-inset-spacing"), me = L("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: s, bottom: r = !1 }) => t ? null : e(X, { className: L(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ye.bind(null, { status: "abandoned" }), children: s || "Skip" }), Ne = (t) => {
336
+ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L($e, "ul_recorded-task-inset-spacing"), me = L("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: s, bottom: r = !1 }) => t ? null : e(K, { className: L(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ye.bind(null, { status: "abandoned" }), children: s || "Skip" }), Ne = (t) => {
337
337
  const { avStream: s, captureStream: r, recordingMediaTypes: n, updatePage: a } = Y.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
338
- te(() => {
338
+ re(() => {
339
339
  const o = setInterval(() => {
340
340
  i && s && !s.active ? a({ avStream: null, currentPage: t[0] }) : r && r.active || a({ captureStream: void 0, currentPage: t[i ? 1 : 0] });
341
341
  }, 1e3);
@@ -343,26 +343,26 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
343
343
  }, [s, r, i, t, n, a]);
344
344
  }, yt = ({ content: t, pages: s, required: r }) => {
345
345
  const { buttonText: n, skipButtonText: a, taskDetail: i } = t;
346
- return Ne(s), e("div", { className: "ul-task-page", children: [i && e(He, { richTextBody: i }), e("div", { className: me, children: [e(X, { onClick: Se.bind(null, { pages: s }), children: n }), e(he, { required: r, skipButtonText: a })] })] }, "start-task");
346
+ return Ne(s), e("div", { className: "ul-task-page", children: [i && e(He, { richTextBody: i }), e("div", { className: me, children: [e(K, { onClick: Se.bind(null, { pages: s }), children: n }), e(he, { required: r, skipButtonText: a })] })] }, "start-task");
347
347
  }, ft = ({ content: t, pages: s, properties: r }) => {
348
348
  const { buttonText: n, skipButtonText: a } = t;
349
- return Ne(s), e("div", { className: "ul-task-page", children: [t.taskDetail && e(He, { richTextBody: t.taskDetail }), e(z, { 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: L("ul-button-inactive"), onClick: ye.bind(null, { status: "given.up" }), children: a })] }) })] }, "complete-task");
349
+ return Ne(s), e("div", { className: "ul-task-page", children: [t.taskDetail && e(He, { richTextBody: t.taskDetail }), e(X, { properties: r, children: e("div", { className: me, children: [e(K, { className: "ul-complete-task-button", onClick: ye.bind(null, { status: "completed" }), children: n }), e(K, { className: L("ul-button-inactive"), onClick: ye.bind(null, { status: "given.up" }), children: a })] }) })] }, "complete-task");
350
350
  }, kt = ({ content: t, pages: s, required: r }) => {
351
351
  const { buttonText: n, skipButtonText: a } = t, [i] = A((c) => [c.tabTitle]), [o, d] = $(!1);
352
- return e("div", { children: [e("div", { className: Oe, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Be, children: i }) })] }), e("div", { className: r ? "" : me, children: [e(X, { disabled: o, onClick: Se.bind(null, { pages: s, setIsRequestingPermission: d }), children: n }), e(he, { required: r, skipButtonText: a })] })] });
352
+ return e("div", { children: [e("div", { className: Oe, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Be, children: i }) })] }), e("div", { className: r ? "" : me, children: [e(K, { disabled: o, onClick: Se.bind(null, { pages: s, setIsRequestingPermission: d }), children: n }), e(he, { required: r, skipButtonText: a })] })] });
353
353
  }, xt = ({ content: t }) => e(ce, { className: L($e, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), Ct = ({ content: t, pages: s, required: r }) => {
354
354
  const { permissionDeniedHeadline: n, permissionDeniedBody: a, skipButtonText: i, tryAgainButtonText: o } = t, d = pe(s[0]) ? s[0] : null;
355
- return te(() => {
355
+ return re(() => {
356
356
  const c = setInterval(() => {
357
357
  d !== null && be({ currentPage: d, pages: s });
358
358
  }, 1e3);
359
359
  return () => clearInterval(c);
360
- }, [d, s]), d ? e("div", { children: [e("div", { className: Oe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Be, children: a })] }) }), e("div", { className: me, children: [e(X, { onClick: be.bind(null, { currentPage: d, pages: s }), children: o }), e(he, { required: r, skipButtonText: i })] })] }) : null;
360
+ }, [d, s]), d ? e("div", { children: [e("div", { className: Oe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Be, children: a })] }) }), e("div", { className: me, children: [e(K, { onClick: be.bind(null, { currentPage: d, pages: s }), children: o }), e(he, { required: r, skipButtonText: i })] })] }) : null;
361
361
  }, Tt = ({ stream: t }) => e("video", { autoPlay: !0, className: L("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (s) => {
362
362
  s && (s.srcObject = t || null);
363
363
  } }), _t = ({ content: t, pages: s, required: r }) => {
364
364
  const { skipButtonText: n } = t, { avStream: a } = Y.getState();
365
- return Ne(s), e("div", { children: [e(Tt, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(X, { onClick: Se.bind(null, { pages: s }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
365
+ return Ne(s), e("div", { children: [e(Tt, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(K, { onClick: Se.bind(null, { pages: s }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
366
366
  }, St = ({ properties: t }) => {
367
367
  const { pages: s, required: r } = t, { avStream: n, currentPage: a } = Y.getState();
368
368
  if (a === void 0) return null;
@@ -383,16 +383,16 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
383
383
  }, Nt = ({ className: t, properties: s, next: r, questionId: n }) => {
384
384
  const a = A(), { surveyId: i, responseGroupUid: o, userId: d } = a, c = Y(), { screenPermissionRequested: m } = c, h = Y((p) => p.avStream);
385
385
  let l = Y((p) => p.currentPage);
386
- l || (l = function({ pages: p, userId: T, responseGroupUid: D, surveyId: R, questionId: f, next: g }) {
387
- const { updatePage: w } = Y.getState(), { eventEmitFn: I, recorderEventEmitter: k } = A.getState(), b = { questionId: f, surveyId: R, visitorId: T, responseGroupUid: D };
386
+ l || (l = function({ pages: p, userId: T, responseGroupUid: w, surveyId: R, questionId: k, next: g }) {
387
+ const { updatePage: D } = Y.getState(), { eventEmitFn: I, recorderEventEmitter: x } = A.getState(), b = { questionId: k, surveyId: R, visitorId: T, responseGroupUid: w };
388
388
  let S = 0;
389
- k.emit("recorded.task.permission.screen"), I("recorded.task.permission.screen"), k.emit("permission.status", { "permission.status.callback": (_, B, H, O) => {
390
- const Q = p[S], { type: ee } = Q, Z = ["screen"];
389
+ x.emit("recorded.task.permission.screen"), I("recorded.task.permission.screen"), x.emit("permission.status", { "permission.status.callback": (_, B, H, O) => {
390
+ const Q = p[S], { type: te } = Q, Z = ["screen"];
391
391
  if (pe(Q)) {
392
392
  const { permissionDescriptors: G } = Q, ne = G == null ? void 0 : G.includes("microphone"), de = G == null ? void 0 : G.includes("camera");
393
393
  ne && Z.push("audio"), de && Z.push("video"), (_ != null && _.active && !de || _ != null && _.active && B) && S++;
394
394
  }
395
- De(p[S]) && H && (S++, k.emit("begin.recording", { "recording.media.types": Z, "start.recording.callback": (G) => w({ mediaRecordingUids: G }) })), w({ currentPage: p[S], avStream: _, screenPermissionRequested: H, nextQuestion: g, type: ee, passthroughData: b, recordingMediaTypes: Z, captureStream: O });
395
+ we(p[S]) && H && (S++, x.emit("begin.recording", { "recording.media.types": Z, "start.recording.callback": (G) => D({ mediaRecordingUids: G }) })), D({ currentPage: p[S], avStream: _, screenPermissionRequested: H, nextQuestion: g, type: te, passthroughData: b, recordingMediaTypes: Z, captureStream: O });
396
396
  } });
397
397
  const v = p[S];
398
398
  return v.type === "av_permission" && be({ currentPage: v, pages: p }), v;
@@ -400,47 +400,47 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
400
400
  r(p, !0);
401
401
  }, pages: s.pages, responseGroupUid: o, userId: d }));
402
402
  let u = l.headline, y = l.captionText;
403
- const x = Ae(h, l);
404
- return De(l) && m && (u = l.permissionDeniedHeadline, y = l.permissionDeniedCaptionText), pe(l) && x === Ee && (u = l.permissionGrantedHeadline, y = l.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: s == null ? void 0 : s.required, message: u, properties: { captionText: y } }), e(W, { children: e(St, { properties: s }) })] });
403
+ const f = Ae(h, l);
404
+ return we(l) && m && (u = l.permissionDeniedHeadline, y = l.permissionDeniedCaptionText), pe(l) && f === Ee && (u = l.permissionGrantedHeadline, y = l.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: s == null ? void 0 : s.required, message: u, properties: { captionText: y } }), e(ee, { children: e(St, { properties: s }) })] });
405
405
  }, It = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
406
406
  const { visitorAttributes: i, isLongFormSurvey: o } = A((h) => ({ visitorAttributes: h.visitorAttributes, isLongFormSurvey: Le(h.studyType) })), d = (h, l = !1) => {
407
407
  s({ value: l ? { skipped: !0 } : void 0, questionId: n, type: a }, !0);
408
408
  }, c = et(r && r.buttonUrl, i), m = o && r.promptActionType === tt.NO_BUTTON;
409
- return e("div", { className: L(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(z, { properties: r, children: !m && 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: (h) => {
409
+ return e("div", { className: L(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(X, { properties: r, children: !m && 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: (h) => {
410
410
  h.key !== "Enter" && h.key !== " " || s({ value: void 0, questionId: n, type: a }, !0);
411
- }, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: J(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (h) => d(0, !0), children: fe(r) })] }) }) }) }, n);
412
- }, Dt = ({ className: t, questionId: s }) => {
411
+ }, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: z(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (h) => d(0, !0), children: fe(r) })] }) }) }) }, n);
412
+ }, wt = ({ className: t, questionId: s }) => {
413
413
  const { border: r, destroy: n, endCard: a, forceBrandedLogo: i } = A((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
414
- te(() => {
414
+ re(() => {
415
415
  setTimeout(() => {
416
416
  n(_e);
417
417
  }, i ? 4e3 : 2e3);
418
418
  }, [n, i]);
419
419
  const o = a && a.subheader ? e("p", { className: "ul-caption", children: a.subheader }) : null, d = a && a.headline ? a.headline : "";
420
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(Ce, { message: d }), o] }) }) }, s);
421
- }, wt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), qt = ({ className: t }) => {
421
+ }, Dt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), qt = ({ className: t }) => {
422
422
  const { uploadProgress: s } = A((i) => ({ uploadProgress: i.uploadProgress }));
423
423
  let r, n;
424
424
  Object.values(s).filter((i) => i.isSubmitted).length > 1 ? (r = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (r = "Your response is processing", n = "Please keep this tab open until your response is fully processed.");
425
425
  const a = Math.round(Math.min(99, ...Object.values(s).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0)));
426
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(Ce, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] });
427
427
  }, qe = 0, Pe = 1, Pt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
428
- const i = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: d, handleUploadUpdate: c, headers: m, responseGroupUid: h, surveyId: l, viewDocument: u, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, viewDocument: b.viewDocument, visitorId: b.userId })), [x, p] = $(!1), [T, D] = $(null), [R, f] = $(null), [g, w] = $(qe), I = (b, S) => {
429
- b === V.UPLOAD_STARTED ? (D(S[V.UPLOAD_ID]), f(S[V.MEDIA_RECORDING_UID]), p(!0)) : b === V.DELETE ? (D(null), f(null), p(!1)) : b === V.UPLOAD_PROGRESS ? isNaN(S[V.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], progressPct: S[V.UPLOAD_PROGRESS_PCT] }) : b === V.UPLOAD_FINISHED && c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 });
430
- }, k = (b) => {
428
+ const i = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: d, handleUploadUpdate: c, headers: m, responseGroupUid: h, surveyId: l, viewDocument: u, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, viewDocument: b.viewDocument, visitorId: b.userId })), [f, p] = $(!1), [T, w] = $(null), [R, k] = $(null), [g, D] = $(qe), I = (b, S) => {
429
+ b === V.UPLOAD_STARTED ? (w(S[V.UPLOAD_ID]), k(S[V.MEDIA_RECORDING_UID]), p(!0)) : b === V.DELETE ? (w(null), k(null), p(!1)) : b === V.UPLOAD_PROGRESS ? isNaN(S[V.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], progressPct: S[V.UPLOAD_PROGRESS_PCT] }) : b === V.UPLOAD_FINISHED && c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 });
430
+ }, x = (b) => {
431
431
  b.preventDefault(), b.stopPropagation(), document.getElementById(i) && st(i), T && R ? (c({ mediaRecordingUid: R, isSubmitted: !0 }), s({ value: { mediaRecordingUid: R }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0);
432
432
  };
433
- return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(W, { children: [e("div", { id: "ul-question-player-container", style: { display: g === qe ? "" : "none" }, children: e(z, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
434
- b.preventDefault(), b.stopPropagation(), document.getElementById(i) && rt(i), w(Pe);
433
+ return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ee, { children: [e("div", { id: "ul-question-player-container", style: { display: g === qe ? "" : "none" }, children: e(X, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
434
+ b.preventDefault(), b.stopPropagation(), document.getElementById(i) && rt(i), D(Pe);
435
435
  } }) }) }), e("div", { style: { display: g === Pe ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (b) => {
436
436
  if (b && b.children.length === 0) {
437
437
  const S = nt(i, { surveyId: l, responseGroupUid: h, questionId: n, visitorId: y, envId: d }, o, I, void 0, { ...m, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === V.MEDIA_TYPE_AUDIO, u);
438
438
  b.appendChild(S);
439
439
  }
440
- } }) })] }), e(re, { children: [e(se, { isDisabled: !!r.required && !x, onClick: k, children: J(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: k, style: { ...r.required ? { display: "none" } : {}, ...x ? { display: "none" } : {} }, children: fe(r) })] })] });
440
+ } }) })] }), e(J, { children: [e(se, { isDisabled: !!r.required && !f, onClick: x, children: z(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: x, style: { ...r.required ? { display: "none" } : {}, ...f ? { display: "none" } : {} }, children: fe(r) })] })] });
441
441
  }, Qe = (t) => t.type === "thanks" || t.type === "uploading", Rt = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => {
442
442
  const i = ((o) => "properties" in o.props && o.props.properties && "questionHtml" in o.props.properties && o.props.properties.questionHtml ? { content: o.props.properties.questionHtml, isHtml: !0 } : "message" in o.props ? { content: o.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
443
- return e(ie, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? a : null, children: r ? e(wt, {}) : 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(it, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
443
+ return e(ie, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? a : null, children: r ? e(Dt, {}) : 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(it, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
444
444
  }, Lt = ({ card: t, avatars: s }) => {
445
445
  const r = ((n) => {
446
446
  if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
@@ -468,8 +468,8 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
468
468
  }, Et = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: i, startingQuestionIdx: o, currentQuestionBubbleRef: d, handleCardResponse: c }) => {
469
469
  const m = s === r, h = s < r, l = Qe(t);
470
470
  if (l) return e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m });
471
- const u = `${t.name}`, y = a.get(u), x = t.type === "open", p = i.get(u), T = s > (o ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (p === !0 || p === void 0);
472
- return e(Re.Fragment, { children: [e(Rt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m, isThinking: T }), !T && e(Lt, { avatars: n, card: t }), h && x ? e(Mt, { avatars: n, card: t, userResponse: y }) : (!h || !x) && !T && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e($t, { card: t, className: l ? "chat-thanks-card" : "chat-card", isAnswered: h, next: m ? c : () => {
471
+ const u = `${t.name}`, y = a.get(u), f = t.type === "open", p = i.get(u), T = s > (o ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (p === !0 || p === void 0);
472
+ return e(Re.Fragment, { children: [e(Rt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m, isThinking: T }), !T && e(Lt, { avatars: n, card: t }), h && f ? e(Mt, { avatars: n, card: t, userResponse: y }) : (!h || !f) && !T && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e($t, { card: t, className: l ? "chat-thanks-card" : "chat-card", isAnswered: h, next: m ? c : () => {
473
473
  } }) }) })] }, `question-card-${t.name}`);
474
474
  }, ie = Re.forwardRef(({ message: t, isLeft: s = !1, children: r, avatars: n, hideAvatar: a = !1 }, i) => {
475
475
  const o = s ? "chat-bubble-left" : "chat-bubble-right";
@@ -506,7 +506,7 @@ const At = () => {
506
506
  case "texturlprompt":
507
507
  return e(It, { ...a, ...t.props });
508
508
  case "thanks":
509
- return e(Dt, { ...a, ...t.props });
509
+ return e(wt, { ...a, ...t.props });
510
510
  case "uploading":
511
511
  return e(qt, { ...a, ...t.props });
512
512
  case "videovoice":
@@ -516,63 +516,63 @@ const At = () => {
516
516
  }
517
517
  }, Gt = ({ cards: t, next: s, previousResponses: r }) => {
518
518
  const { cardResponses: n, setCardResponse: a } = (() => {
519
- const [f, g] = $(/* @__PURE__ */ new Map());
520
- return { cardResponses: f, setCardResponse: le((w, I) => {
521
- g((k) => new Map(k).set(w, I));
519
+ const [k, g] = $(/* @__PURE__ */ new Map());
520
+ return { cardResponses: k, setCardResponse: le((D, I) => {
521
+ g((x) => new Map(x).set(D, I));
522
522
  }, []) };
523
- })(), { index: i, isLongFormSurvey: o, avatars: d, startingQuestionIdx: c, viewDocument: m, update: h } = A((f) => ({ index: f.index, isLongFormSurvey: Le(f.studyType), avatars: f.avatars, startingQuestionIdx: f.startingQuestionIdx, viewDocument: f.viewDocument, update: f.update })), { currentQuestionBubbleRef: l, scrollToCurrentQuestion: u } = (({ viewDocument: f }) => {
524
- const g = K(null), w = le(() => {
525
- const I = f.querySelector(".ul-card-main-content");
523
+ })(), { index: i, isLongFormSurvey: o, avatars: d, startingQuestionIdx: c, viewDocument: m, update: h } = A((k) => ({ index: k.index, isLongFormSurvey: Le(k.studyType), avatars: k.avatars, startingQuestionIdx: k.startingQuestionIdx, viewDocument: k.viewDocument, update: k.update })), { currentQuestionBubbleRef: l, scrollToCurrentQuestion: u } = (({ viewDocument: k }) => {
524
+ const g = W(null), D = le(() => {
525
+ const I = k.querySelector(".ul-card-main-content");
526
526
  if (g.current && I && I instanceof HTMLElement) {
527
- const k = g.current.offsetTop - I.offsetTop - 16;
528
- I.scrollTo({ top: Math.max(0, k), behavior: "smooth" });
527
+ const x = g.current.offsetTop - I.offsetTop - 16;
528
+ I.scrollTo({ top: Math.max(0, x), behavior: "smooth" });
529
529
  }
530
530
  }, []);
531
- return { currentQuestionBubbleRef: g, scrollToCurrentQuestion: w };
532
- })({ viewDocument: m }), y = ((f, g, w) => {
533
- const [I, k] = $(/* @__PURE__ */ new Map());
534
- return te(() => {
535
- if (f.length > 0 && g < f.length) {
536
- const b = f[g], S = `${b.name}`;
537
- if (g <= (w ?? 0) || Qe(b)) return void k((_) => new Map(_).set(S, !1));
538
- k((_) => new Map(_).set(S, !0));
531
+ return { currentQuestionBubbleRef: g, scrollToCurrentQuestion: D };
532
+ })({ viewDocument: m }), y = ((k, g, D) => {
533
+ const [I, x] = $(/* @__PURE__ */ new Map());
534
+ return re(() => {
535
+ if (k.length > 0 && g < k.length) {
536
+ const b = k[g], S = `${b.name}`;
537
+ if (g <= (D ?? 0) || Qe(b)) return void x((_) => new Map(_).set(S, !1));
538
+ x((_) => new Map(_).set(S, !0));
539
539
  const v = setTimeout(() => {
540
- k((_) => new Map(_).set(S, !1));
540
+ x((_) => new Map(_).set(S, !1));
541
541
  }, 1e3);
542
542
  return () => clearTimeout(v);
543
543
  }
544
- }, [g, f, w]), I;
545
- })(t, i, c), x = ((f, g) => {
546
- const [w, I] = $(/* @__PURE__ */ new Set([0]));
547
- return te(() => {
548
- I((k) => new Set(k).add(f));
549
- }, [f]), te(() => {
550
- const k = g ?? 0;
551
- k > 0 && I((b) => {
544
+ }, [g, k, D]), I;
545
+ })(t, i, c), f = ((k, g) => {
546
+ const [D, I] = $(/* @__PURE__ */ new Set([0]));
547
+ return re(() => {
548
+ I((x) => new Set(x).add(k));
549
+ }, [k]), re(() => {
550
+ const x = g ?? 0;
551
+ x > 0 && I((b) => {
552
552
  const S = new Set(b);
553
- for (let v = 0; v <= k; v++) S.add(v);
553
+ for (let v = 0; v <= x; v++) S.add(v);
554
554
  return S;
555
555
  });
556
- }, [g]), w;
557
- })(i, c), p = oe(() => ({ ...r, ...Ze(t.map((f, g) => {
558
- var w, I;
559
- return { ...f, value: g < i ? ((w = n.get(`${f.name}`)) == null ? void 0 : w.value) ?? null : null, secondaryValue: g < i ? ((I = n.get(`${f.name}`)) == null ? void 0 : I.secondaryValue) ?? null : null };
556
+ }, [g]), D;
557
+ })(i, c), p = oe(() => ({ ...r, ...Ze(t.map((k, g) => {
558
+ var D, I;
559
+ return { ...k, value: g < i ? ((D = n.get(`${k.name}`)) == null ? void 0 : D.value) ?? null : null, secondaryValue: g < i ? ((I = n.get(`${k.name}`)) == null ? void 0 : I.secondaryValue) ?? null : null };
560
560
  })) }), [r, n, t, i]), T = Ye(t, p);
561
- te(() => {
561
+ re(() => {
562
562
  requestAnimationFrame(() => {
563
563
  u();
564
564
  }), h();
565
565
  }, [i, u, y, h]);
566
- const D = le((f, g) => {
566
+ const w = le((k, g) => {
567
567
  if (!g) return;
568
- const w = T[i];
569
- if (!w) return;
570
- const I = `${w.name}`;
571
- a(I, f);
572
- const k = { ...f, questionText: ze(w) };
573
- s([k]);
574
- }, [T, i, s, a]), R = T.map((f, g) => ({ card: f, cardIndex: g })).filter(({ cardIndex: f }) => x.has(f));
575
- return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!o && e(At, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: R.map(({ card: f, cardIndex: g }) => e(Et, { avatars: d, card: f, cardIndex: g, cardResponses: n, currentQuestionBubbleRef: l, handleCardResponse: D, index: i, questionThinkingStates: y, startingQuestionIdx: c }, `question-card-${f.name}`)) }) })] });
568
+ const D = T[i];
569
+ if (!D) return;
570
+ const I = `${D.name}`;
571
+ a(I, k);
572
+ const x = { ...k, questionText: ze(D) };
573
+ s([x]);
574
+ }, [T, i, s, a]), R = T.map((k, g) => ({ card: k, cardIndex: g })).filter(({ cardIndex: k }) => f.has(k));
575
+ return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!o && e(At, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: R.map(({ card: k, cardIndex: g }) => e(Et, { avatars: d, card: k, cardIndex: g, cardResponses: n, currentQuestionBubbleRef: l, handleCardResponse: w, index: i, questionThinkingStates: y, startingQuestionIdx: c }, `question-card-${k.name}`)) }) })] });
576
576
  };
577
577
  export {
578
578
  Gt as default