@sprig-technologies/sprig-bundled 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-ui-BDY1U1pN.js +1512 -0
- package/dist/{conversational-ui-B9SOjjQE.cjs → conversational-ui-EBO_5YT4.cjs} +2 -2
- package/dist/{conversational-v2-styles-D3WQxdro.cjs → conversational-v2-styles-BTm-8rVB.cjs} +1 -1
- package/dist/{conversational-v2-styles-XFcJt3-u.js → conversational-v2-styles-Bj3dBWvf.js} +1 -1
- package/dist/getAttributedUrl-8t2IIhOk.js +193 -0
- package/dist/getAttributedUrl-M03Qw_Lk.cjs +12 -0
- package/dist/{index-B2lKZafM.cjs → index-B0e_zgRQ.cjs} +4 -4
- package/dist/index-BLbkNfGp.cjs +1 -0
- package/dist/{index-Bbp8h_Ls.js → index-BUTuSSuP.js} +229 -224
- package/dist/index-D2wwf1iZ.js +717 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +1 -1
- package/dist/view-0ocXtsSZ.cjs +1 -0
- package/dist/view-DcerBHpf.js +1780 -0
- package/package.json +1 -1
- package/dist/conversational-ui-WaAjNR3Q.js +0 -1502
- package/dist/getAttributedUrl-CMu77L08.js +0 -197
- package/dist/getAttributedUrl-CkFVhnm0.cjs +0 -12
- package/dist/index-BnE-K_Xo.cjs +0 -1
- package/dist/index-CY9QSu7D.js +0 -706
- package/dist/view-CHBo6RQ4.js +0 -1728
- package/dist/view-s39eJCD9.cjs +0 -1
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { a as s, c as C, u as T, F as X, h as q, p as S, _ as L, d as H, v as Z, b as P, y as _, x as Q } from "./view-CHBo6RQ4.js";
|
|
2
|
-
import { j as G, k as J, l as Y, m as ee, E as M } from "./index-Bbp8h_Ls.js";
|
|
3
|
-
const te = (e) => s("button", { ...e, className: C("ul-card-text__button", e.className), id: "ul-card-text__button" }), oe = ({ html: e, ...t }) => {
|
|
4
|
-
const { enableCspTrustedTypes: i } = T((n) => ({ enableCspTrustedTypes: n.enableCspTrustedTypes })), o = X(() => G(e, i), [i, e]);
|
|
5
|
-
return s("div", { ...t, dangerouslySetInnerHTML: { __html: o } });
|
|
6
|
-
}, V = () => {
|
|
7
|
-
const { viewDocument: e } = T((o) => ({ viewDocument: o.viewDocument })), [t, i] = q(!1);
|
|
8
|
-
return S(() => {
|
|
9
|
-
const o = e.querySelector(".sprig-question-body"), n = new ResizeObserver(() => {
|
|
10
|
-
window.requestAnimationFrame(() => {
|
|
11
|
-
i(!!(o && J(o) && o.scrollHeight > o.offsetHeight));
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
return o && n.observe(o), () => {
|
|
15
|
-
o && n.disconnect();
|
|
16
|
-
};
|
|
17
|
-
}, [e]), t;
|
|
18
|
-
}, F = ({ plainText: e, richText: t, id: i, className: o, isHeader: n, showAsterisk: l }) => t ? s(oe, { className: o, html: t, id: i }) : e ? n ? s("h1", { className: o, id: i, children: [e, l && "*"] }) : s("p", { className: o, id: i, children: e }) : null, me = ({ message: e, properties: t, isRequired: i }) => {
|
|
19
|
-
const o = L(null), n = t == null ? void 0 : t.captionText, l = V();
|
|
20
|
-
return s("div", { className: C("question-header-container", "sprig-header-container", l ? "sprig-border-bottom" : null), ref: o, children: [s("div", { className: "question-header-button-container", children: s(F, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: t == null ? void 0 : t.questionHtml, showAsterisk: i }) }), s(F, { className: "ul-caption", id: "ul-caption", plainText: n, richText: t == null ? void 0 : t.captionHtml })] });
|
|
21
|
-
}, ne = () => s("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: s("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), be = ({ isSubmitDisabled: e, handleSubmit: t }) => s("div", { className: "ul-card-longform__submit-button-container", children: s(te, { className: "ul-card-longform__submit-button", disabled: e, onClick: t, children: ["OK ", s(ne, {})] }) }), ie = (e, t) => {
|
|
22
|
-
const i = L(0);
|
|
23
|
-
return () => {
|
|
24
|
-
if (e.current) {
|
|
25
|
-
const o = e.current;
|
|
26
|
-
o.style.height = "1px";
|
|
27
|
-
const n = o.scrollHeight + (o.offsetHeight - o.clientHeight), l = parseInt(window.getComputedStyle(o).getPropertyValue("max-height")), r = n <= l ? n : l;
|
|
28
|
-
i.current !== r && requestAnimationFrame(() => {
|
|
29
|
-
t();
|
|
30
|
-
}), i.current = r, o.style.height = `${r}px`;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}, R = ({ buttonText: e = "View Prototype", handleClick: t }) => s("button", { className: "prototype-button", onClick: t, children: e }, "prototype-btn"), ve = ({ embeddedType: e = "prototype", properties: t, children: i }) => {
|
|
34
|
-
var g;
|
|
35
|
-
const { handleClickEmbedButton: o, hasViewedEmbed: n, headers: l, useDesktopPrototype: r } = T((p) => ({ handleClickEmbedButton: p.handleClickEmbedButton, hasViewedEmbed: p.hasViewedEmbed, headers: p.headers, useDesktopPrototype: p.useDesktopPrototype })), c = (t == null ? void 0 : t.conceptUrl) || ((g = t == null ? void 0 : t.consentDocument) == null ? void 0 : g.url), a = window.innerWidth < ee, h = l["userleap-platform"], u = (p, f) => {
|
|
36
|
-
p.preventDefault(), o(f);
|
|
37
|
-
};
|
|
38
|
-
if ((() => {
|
|
39
|
-
const { update: p, index: f, isConversationalUI: v, viewDocument: k } = T(({ update: b, index: m, isConversationalUI: x, viewDocument: y }) => ({ update: b, index: m, isConversationalUI: x, viewDocument: y })), d = Y(p, 100);
|
|
40
|
-
S(() => {
|
|
41
|
-
if (v) return;
|
|
42
|
-
const b = new ResizeObserver(d), m = k.querySelector(".ul-card__container");
|
|
43
|
-
return m && b.observe(m, { box: "border-box" }), () => {
|
|
44
|
-
b.disconnect();
|
|
45
|
-
};
|
|
46
|
-
}, [d, p, f, v, k]);
|
|
47
|
-
})(), !r && a && !n && c && ["email", "link"].includes(h)) {
|
|
48
|
-
if (e === "prototype") return s(R, { handleClick: (p) => {
|
|
49
|
-
u(p, "question.prototype.click");
|
|
50
|
-
} });
|
|
51
|
-
if (e === "pdf") return s(R, { buttonText: (t == null ? void 0 : t.viewDocumentText) || "View Document", handleClick: (p) => {
|
|
52
|
-
u(p, "question.agreement.click");
|
|
53
|
-
} });
|
|
54
|
-
}
|
|
55
|
-
return s(H, { children: i });
|
|
56
|
-
}, j = ({ isSelected: e, id: t, divId: i, themeColor: o, disabled: n = !1 }) => s("div", { "aria-checked": e, "aria-disabled": n, "aria-labelledby": `label-${t}`, className: "select-checkbox", id: i, role: "checkbox", style: { ...e ? { backgroundColor: o, borderColor: o, boxShadow: "none" } : {}, ...n ? { opacity: 0.5 } : {} }, tabIndex: n ? -1 : 0, children: e && s(Z, {}) }), xe = ({ ariaLabel: e, border: t, choiceStyle: i = {}, label: o, isSelected: n, value: l, text: r, id: c, isRadio: a, useMobileStyling: h, error: u, allowTextEntry: g, noneOfTheAbove: p, promptText: f, disabled: v = !1, onUserInputChanged: k }) => {
|
|
57
|
-
const { styleNonce: d, viewDocument: b } = T((w) => ({ styleNonce: w.styleNonce, viewDocument: w.viewDocument })), [m, x] = q(!1);
|
|
58
|
-
re(b, t, d);
|
|
59
|
-
const y = ({ isSelected: w, userText: I }) => {
|
|
60
|
-
k && k({ id: c, selected: w, value: l, userText: I, noneOfTheAbove: p });
|
|
61
|
-
}, E = (w) => {
|
|
62
|
-
v || (w.stopPropagation(), y({ isSelected: a || !n, userText: r }), x(!1));
|
|
63
|
-
}, z = () => {
|
|
64
|
-
m || x(!0);
|
|
65
|
-
}, D = () => {
|
|
66
|
-
m && x(!1);
|
|
67
|
-
}, N = { onClick: (w) => E(w), onKeyPress: (w) => ((I) => {
|
|
68
|
-
v || I.key !== "Enter" && I.key !== " " || E(I);
|
|
69
|
-
})(w) };
|
|
70
|
-
"ontouchstart" in b.documentElement ? (N.onTouchStart = D, N.onTouchCancel = D, N.onTouchEnd = D) : (N.onMouseDown = z, N.onMouseLeave = D);
|
|
71
|
-
const $ = a ? `radio-${c}` : `checkbox-${c}`, U = n || m ? [O] : [], K = [...u ? [B] : [], ...U, ...v ? ["ul-choice-disabled"] : []], W = o ? { "aria-labelledby": `label-${c}` } : { "aria-label": e };
|
|
72
|
-
return s("div", { className: C(P("choice", h), ...K), id: `choice-div-${c}`, style: { ...i, ...u ? { borderColor: M } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : N, "aria-disabled": v, children: [s("div", { className: C("choice-label-container"), children: [a ? s("div", { ...W, className: C("select-radio", ...U), id: $, role: "radio", tabIndex: 0 }) : s(j, { disabled: v, divId: $, id: c, isSelected: n, themeColor: t }), o && s("label", { className: C(P("select-label", h)), htmlFor: $, id: `label-${c}`, children: o })] }), g && n && s("div", { className: C("choice-text-entry-container", ...U), children: s(se, { onTextChange: (w) => y({ isSelected: n, userText: w }), promptText: f || "Please specify", textValue: r, useMobileStyling: h }) })] });
|
|
73
|
-
}, se = ({ promptText: e, textValue: t, onTextChange: i, useMobileStyling: o }) => {
|
|
74
|
-
const n = L(null), { update: l } = T((c) => ({ update: c.update })), r = ie(n, () => l());
|
|
75
|
-
return S(() => (r(), n.current && n.current.focus(), () => {
|
|
76
|
-
l();
|
|
77
|
-
}), []), s("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: C(P("choice-text-input", o)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (c) => {
|
|
78
|
-
r(), c.stopPropagation(), i(c.currentTarget.value);
|
|
79
|
-
}, onClick: (c) => {
|
|
80
|
-
c.stopPropagation();
|
|
81
|
-
}, onKeyPress: (c) => {
|
|
82
|
-
c.stopPropagation();
|
|
83
|
-
}, placeholder: e, ref: n, role: "textbox", rows: 1, value: t });
|
|
84
|
-
}, A = "ul-select-style-element", O = "ul-select-active-dynamic-style", B = "ul-select-error-dynamic-style", re = (e, t, i) => {
|
|
85
|
-
let o = e.getElementById(A), n = !1;
|
|
86
|
-
o || (o = e.createElement("style"), n = !0), o.tagName.toLowerCase() === "style" && (o.id = A, i && (o.nonce = i), o.textContent = ae(t), n && e.head.appendChild(o));
|
|
87
|
-
}, ae = (e) => `
|
|
88
|
-
.${O} {
|
|
89
|
-
border-color: ${e};
|
|
90
|
-
}
|
|
91
|
-
.${O} .select-radio, .${O}.select-radio {
|
|
92
|
-
border: 6px solid ${e};
|
|
93
|
-
box-shadow: none;
|
|
94
|
-
}
|
|
95
|
-
.${B} {
|
|
96
|
-
border-color: ${M};
|
|
97
|
-
}
|
|
98
|
-
`, we = ({ children: e }) => s("div", { className: "sprig-question-body", children: e }), ge = ({ children: e }) => {
|
|
99
|
-
const t = V(), { isConversationalUI: i } = T((o) => ({ isConversationalUI: o.isConversationalUI }));
|
|
100
|
-
return s("div", { className: C("sprig-question-footer-container", t && !i ? "sprig-border-top" : null), children: e });
|
|
101
|
-
};
|
|
102
|
-
var le = ((e) => (e.CONTINUE = "CONTINUE", e.EXTERNAL = "EXTERNAL", e.NO_BUTTON = "NO_BUTTON", e))(le || {}), ce = ((e) => (e.Unlimited = "Unlimited", e.Maximum = "Maximum", e.Range = "Range", e))(ce || {});
|
|
103
|
-
function ye(e) {
|
|
104
|
-
const t = e.props;
|
|
105
|
-
if (t === null || typeof t != "object") return !1;
|
|
106
|
-
const i = Reflect.get(t, "properties");
|
|
107
|
-
return typeof i == "object" && i !== null && "required" in i;
|
|
108
|
-
}
|
|
109
|
-
const de = ({ options: e, selectItem: t, selectedOptions: i, showCheckbox: o, disabledOptions: n, dropdownFooter: l, panelRef: r }) => {
|
|
110
|
-
const { themeColor: c } = T((a) => ({ doc: a.viewDocument, themeColor: a.border }));
|
|
111
|
-
return s("div", { className: "select-list", ref: r, children: [e.map((a) => {
|
|
112
|
-
return s("div", { "aria-disabled": n == null ? void 0 : n.includes(a), className: C("select-option", n != null && n.includes(a) ? "ul-choice-disabled" : ""), onClick: (u) => {
|
|
113
|
-
n != null && n.includes(a) || (t(a), u.stopPropagation());
|
|
114
|
-
}, role: "option", style: { ...n != null && n.includes(a) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [o && s(j, { divId: (h = a.id, `checkbox-div-${h}`), id: a.id, isSelected: i.includes(a), themeColor: c }), a.label] }, a.id);
|
|
115
|
-
var h;
|
|
116
|
-
}), l] });
|
|
117
|
-
}, Ce = ({ isMultiSelect: e = !1, multiselectText: t = "choices selected", onChange: i, options: o, placeholderText: n, value: l, disabledOptions: r = [], dropdownFooter: c }) => {
|
|
118
|
-
const [a, h] = q(!1), u = L(null), { viewDocument: g, update: p, isConversationalUI: f } = T((d) => ({ viewDocument: d.viewDocument, update: d.update, isConversationalUI: d.isConversationalUI })), v = () => {
|
|
119
|
-
h(!a);
|
|
120
|
-
};
|
|
121
|
-
_(() => {
|
|
122
|
-
f || p();
|
|
123
|
-
}, [a, f, p]), _(() => {
|
|
124
|
-
a && u.current && u.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
125
|
-
}, [a]), S(() => {
|
|
126
|
-
var b;
|
|
127
|
-
const d = (m) => {
|
|
128
|
-
const x = m.target;
|
|
129
|
-
(x == null ? void 0 : x.closest(".select-option.ul-choice-disabled")) || h(!1);
|
|
130
|
-
};
|
|
131
|
-
g.addEventListener("click", d);
|
|
132
|
-
try {
|
|
133
|
-
(b = window.parent) == null || b.addEventListener("click", d);
|
|
134
|
-
} catch {
|
|
135
|
-
window.addEventListener("click", d);
|
|
136
|
-
}
|
|
137
|
-
return () => {
|
|
138
|
-
var m;
|
|
139
|
-
g.removeEventListener("click", d);
|
|
140
|
-
try {
|
|
141
|
-
(m = window.parent) == null || m.removeEventListener("click", d);
|
|
142
|
-
} catch {
|
|
143
|
-
window.removeEventListener("click", d);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}, [g]);
|
|
147
|
-
const k = l.length === 0 ? ["select-button-placeholder"] : [];
|
|
148
|
-
return s(H, { children: [s("button", { "aria-label": "choice dropdown button", className: C("select-button", ...k), onClick: (d) => {
|
|
149
|
-
d.stopPropagation(), v();
|
|
150
|
-
}, type: "button", children: [s("span", { children: l.length === 0 ? n : l.length === 1 ? l[0].label : `${l.length} ${t}` }), s(Q, {})] }), a && s(de, { disabledOptions: r, dropdownFooter: c, options: o, panelRef: u, selectedOptions: l, selectItem: (d) => {
|
|
151
|
-
var x;
|
|
152
|
-
const b = l.some((y) => y.id === d.id), m = l.some((y) => {
|
|
153
|
-
var E;
|
|
154
|
-
return (E = y.optionProperties) == null ? void 0 : E.noneOfTheAbove;
|
|
155
|
-
});
|
|
156
|
-
(x = d.optionProperties) != null && x.noneOfTheAbove && !b ? i([d]) : e ? i(b ? l.filter((y) => y.id !== d.id) : m ? [d] : [...l, d]) : b || i([d]), e || v();
|
|
157
|
-
}, showCheckbox: e })] });
|
|
158
|
-
}, ue = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, Te = (e = void 0, t = {}) => {
|
|
159
|
-
if (!e) return e;
|
|
160
|
-
const i = ["http:", "https:", "itms-apps:", "market:"], o = ((r) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(r) ? r : `http://${r}`)(e);
|
|
161
|
-
if (!o) return;
|
|
162
|
-
try {
|
|
163
|
-
const r = new URL(o);
|
|
164
|
-
if (!r.protocol || !i.includes(r.protocol)) return;
|
|
165
|
-
} catch {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const n = [], l = ((r, c, a) => {
|
|
169
|
-
let h = r;
|
|
170
|
-
for (const [u, g] of Object.entries(ue)) if (h.toLowerCase().includes(u)) if (c[g]) {
|
|
171
|
-
const p = new RegExp(u, "gi");
|
|
172
|
-
h = h.replace(p, c[g]);
|
|
173
|
-
} else a.push(u);
|
|
174
|
-
return h;
|
|
175
|
-
})(o, t, n);
|
|
176
|
-
return n.length === 0 ? l : ((r, c) => {
|
|
177
|
-
if (!r.includes("?")) return r;
|
|
178
|
-
const a = r.slice(0, r.indexOf("?")), h = r.slice(r.indexOf("?") + 1).split("&").map((u) => u.split("=")).filter((u) => !c.includes(u[1]));
|
|
179
|
-
return h.length === 0 ? a : `${a}?${h.map((u) => u.join("=")).join("&")}`;
|
|
180
|
-
})(l, n);
|
|
181
|
-
};
|
|
182
|
-
export {
|
|
183
|
-
te as B,
|
|
184
|
-
me as H,
|
|
185
|
-
be as L,
|
|
186
|
-
ve as M,
|
|
187
|
-
xe as O,
|
|
188
|
-
le as P,
|
|
189
|
-
we as Q,
|
|
190
|
-
Ce as S,
|
|
191
|
-
oe as a,
|
|
192
|
-
ge as b,
|
|
193
|
-
ce as c,
|
|
194
|
-
ye as d,
|
|
195
|
-
Te as g,
|
|
196
|
-
ie as u
|
|
197
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./view-s39eJCD9.cjs"),k=require("./index-B2lKZafM.cjs"),S=t=>e.u("button",{...t,className:e.cc("ul-card-text__button",t.className),id:"ul-card-text__button"}),q=({html:t,...o})=>{const{enableCspTrustedTypes:l}=e.useConfig(i=>({enableCspTrustedTypes:i.enableCspTrustedTypes})),n=e.F(()=>k.getHtml(t,l),[l,t]);return e.u("div",{...o,dangerouslySetInnerHTML:{__html:n}})},_=()=>{const{viewDocument:t}=e.useConfig(n=>({viewDocument:n.viewDocument})),[o,l]=e.h(!1);return e.p(()=>{const n=t.querySelector(".sprig-question-body"),i=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{l(!!(n&&k.isHTMLElement(n)&&n.scrollHeight>n.offsetHeight))})});return n&&i.observe(n),()=>{n&&i.disconnect()}},[t]),o},L=({plainText:t,richText:o,id:l,className:n,isHeader:i,showAsterisk:c})=>o?e.u(q,{className:n,html:o,id:l}):t?i?e.u("h1",{className:n,id:l,children:[t,c&&"*"]}):e.u("p",{className:n,id:l,children:t}):null,z=()=>e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),P=(t,o)=>{const l=e._(0);return()=>{if(t.current){const n=t.current;n.style.height="1px";const i=n.scrollHeight+(n.offsetHeight-n.clientHeight),c=parseInt(window.getComputedStyle(n).getPropertyValue("max-height")),r=i<=c?i:c;l.current!==r&&requestAnimationFrame(()=>{o()}),l.current=r,n.style.height=`${r}px`}}},U=({buttonText:t="View Prototype",handleClick:o})=>e.u("button",{className:"prototype-button",onClick:o,children:t},"prototype-btn"),M=({isSelected:t,id:o,divId:l,themeColor:n,disabled:i=!1})=>e.u("div",{"aria-checked":t,"aria-disabled":i,"aria-labelledby":`label-${o}`,className:"select-checkbox",id:l,role:"checkbox",style:{...t?{backgroundColor:n,borderColor:n,boxShadow:"none"}:{},...i?{opacity:.5}:{}},tabIndex:i?-1:0,children:t&&e.u(e.SvgCheckmark,{})}),W=({promptText:t,textValue:o,onTextChange:l,useMobileStyling:n})=>{const i=e._(null),{update:c}=e.useConfig(a=>({update:a.update})),r=P(i,()=>c());return e.p(()=>(r(),i.current&&i.current.focus(),()=>{c()}),[]),e.u("textarea",{"aria-label":t,"aria-multiline":"true","aria-placeholder":t,className:e.cc(e.getClasses("choice-text-input",n)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{r(),a.stopPropagation(),l(a.currentTarget.value)},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:t,ref:i,role:"textbox",rows:1,value:o})},$="ul-select-style-element",D="ul-select-active-dynamic-style",A="ul-select-error-dynamic-style",K=(t,o,l)=>{let n=t.getElementById($),i=!1;n||(n=t.createElement("style"),i=!0),n.tagName.toLowerCase()==="style"&&(n.id=$,l&&(n.nonce=l),n.textContent=X(o),i&&t.head.appendChild(n))},X=t=>`
|
|
2
|
-
.${D} {
|
|
3
|
-
border-color: ${t};
|
|
4
|
-
}
|
|
5
|
-
.${D} .select-radio, .${D}.select-radio {
|
|
6
|
-
border: 6px solid ${t};
|
|
7
|
-
box-shadow: none;
|
|
8
|
-
}
|
|
9
|
-
.${A} {
|
|
10
|
-
border-color: ${k.ERROR_BORDER_COLOR};
|
|
11
|
-
}
|
|
12
|
-
`;var H=(t=>(t.CONTINUE="CONTINUE",t.EXTERNAL="EXTERNAL",t.NO_BUTTON="NO_BUTTON",t))(H||{}),B=(t=>(t.Unlimited="Unlimited",t.Maximum="Maximum",t.Range="Range",t))(B||{});const Q=({options:t,selectItem:o,selectedOptions:l,showCheckbox:n,disabledOptions:i,dropdownFooter:c,panelRef:r})=>{const{themeColor:a}=e.useConfig(s=>({doc:s.viewDocument,themeColor:s.border}));return e.u("div",{className:"select-list",ref:r,children:[t.map(s=>{return e.u("div",{"aria-disabled":i==null?void 0:i.includes(s),className:e.cc("select-option",i!=null&&i.includes(s)?"ul-choice-disabled":""),onClick:u=>{i!=null&&i.includes(s)||(o(s),u.stopPropagation())},role:"option",style:{...i!=null&&i.includes(s)?{opacity:.5,cursor:"not-allowed"}:{}},children:[n&&e.u(M,{divId:(h=s.id,`checkbox-div-${h}`),id:s.id,isSelected:l.includes(s),themeColor:a}),s.label]},s.id);var h}),c]})},Z={"{{user_id}}":"externalUserId","{{email}}":"email"};exports.Button=S,exports.Header=({message:t,properties:o,isRequired:l})=>{const n=e._(null),i=o==null?void 0:o.captionText,c=_();return e.u("div",{className:e.cc("question-header-container","sprig-header-container",c?"sprig-border-bottom":null),ref:n,children:[e.u("div",{className:"question-header-button-container",children:e.u(L,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:t,richText:o==null?void 0:o.questionHtml,showAsterisk:l})}),e.u(L,{className:"ul-caption",id:"ul-caption",plainText:i,richText:o==null?void 0:o.captionHtml})]})},exports.Html=q,exports.LongformSubmitButton=({isSubmitDisabled:t,handleSubmit:o})=>e.u("div",{className:"ul-card-longform__submit-button-container",children:e.u(S,{className:"ul-card-longform__submit-button",disabled:t,onClick:o,children:["OK ",e.u(z,{})]})}),exports.MaxSelectModes=B,exports.MobileEmbedView=({embeddedType:t="prototype",properties:o,children:l})=>{var x;const{handleClickEmbedButton:n,hasViewedEmbed:i,headers:c,useDesktopPrototype:r}=e.useConfig(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),a=(o==null?void 0:o.conceptUrl)||((x=o==null?void 0:o.consentDocument)==null?void 0:x.url),s=window.innerWidth<k.EMBED_MOBILE_MAX_WIDTH,h=c["userleap-platform"],u=(p,y)=>{p.preventDefault(),n(y)};if((()=>{const{update:p,index:y,isConversationalUI:g,viewDocument:f}=e.useConfig(({update:b,index:m,isConversationalUI:v,viewDocument:w})=>({update:b,index:m,isConversationalUI:v,viewDocument:w})),d=k.debounce(p,100);e.p(()=>{if(g)return;const b=new ResizeObserver(d),m=f.querySelector(".ul-card__container");return m&&b.observe(m,{box:"border-box"}),()=>{b.disconnect()}},[d,p,y,g,f])})(),!r&&s&&!i&&a&&["email","link"].includes(h)){if(t==="prototype")return e.u(U,{handleClick:p=>{u(p,"question.prototype.click")}});if(t==="pdf")return e.u(U,{buttonText:(o==null?void 0:o.viewDocumentText)||"View Document",handleClick:p=>{u(p,"question.agreement.click")}})}return e.u(e.g,{children:l})},exports.Option=({ariaLabel:t,border:o,choiceStyle:l={},label:n,isSelected:i,value:c,text:r,id:a,isRadio:s,useMobileStyling:h,error:u,allowTextEntry:x,noneOfTheAbove:p,promptText:y,disabled:g=!1,onUserInputChanged:f})=>{const{styleNonce:d,viewDocument:b}=e.useConfig(C=>({styleNonce:C.styleNonce,viewDocument:C.viewDocument})),[m,v]=e.h(!1);K(b,o,d);const w=({isSelected:C,userText:E})=>{f&&f({id:a,selected:C,value:c,userText:E,noneOfTheAbove:p})},N=C=>{g||(C.stopPropagation(),w({isSelected:s||!i,userText:r}),v(!1))},F=()=>{m||v(!0)},O=()=>{m&&v(!1)},T={onClick:C=>N(C),onKeyPress:C=>(E=>{g||E.key!=="Enter"&&E.key!==" "||N(E)})(C)};"ontouchstart"in b.documentElement?(T.onTouchStart=O,T.onTouchCancel=O,T.onTouchEnd=O):(T.onMouseDown=F,T.onMouseLeave=O);const I=s?`radio-${a}`:`checkbox-${a}`,R=i||m?[D]:[],V=[...u?[A]:[],...R,...g?["ul-choice-disabled"]:[]],j=n?{"aria-labelledby":`label-${a}`}:{"aria-label":t};return e.u("div",{className:e.cc(e.getClasses("choice",h),...V),id:`choice-div-${a}`,style:{...l,...u?{borderColor:k.ERROR_BORDER_COLOR}:{},...g?{opacity:.5,cursor:"not-allowed"}:{}},...g?{}:T,"aria-disabled":g,children:[e.u("div",{className:e.cc("choice-label-container"),children:[s?e.u("div",{...j,className:e.cc("select-radio",...R),id:I,role:"radio",tabIndex:0}):e.u(M,{disabled:g,divId:I,id:a,isSelected:i,themeColor:o}),n&&e.u("label",{className:e.cc(e.getClasses("select-label",h)),htmlFor:I,id:`label-${a}`,children:n})]}),x&&i&&e.u("div",{className:e.cc("choice-text-entry-container",...R),children:e.u(W,{onTextChange:C=>w({isSelected:i,userText:C}),promptText:y||"Please specify",textValue:r,useMobileStyling:h})})]})},exports.PromptActionTypeEnum=H,exports.QuestionBodyFooterContainer=({children:t})=>{const o=_(),{isConversationalUI:l}=e.useConfig(n=>({isConversationalUI:n.isConversationalUI}));return e.u("div",{className:e.cc("sprig-question-footer-container",o&&!l?"sprig-border-top":null),children:t})},exports.QuestionBodyWrapper=({children:t})=>e.u("div",{className:"sprig-question-body",children:t}),exports.Select=({isMultiSelect:t=!1,multiselectText:o="choices selected",onChange:l,options:n,placeholderText:i,value:c,disabledOptions:r=[],dropdownFooter:a})=>{const[s,h]=e.h(!1),u=e._(null),{viewDocument:x,update:p,isConversationalUI:y}=e.useConfig(d=>({viewDocument:d.viewDocument,update:d.update,isConversationalUI:d.isConversationalUI})),g=()=>{h(!s)};e.y(()=>{y||p()},[s,y,p]),e.y(()=>{s&&u.current&&u.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[s]),e.p(()=>{var b;const d=m=>{const v=m.target;(v==null?void 0:v.closest(".select-option.ul-choice-disabled"))||h(!1)};x.addEventListener("click",d);try{(b=window.parent)==null||b.addEventListener("click",d)}catch{window.addEventListener("click",d)}return()=>{var m;x.removeEventListener("click",d);try{(m=window.parent)==null||m.removeEventListener("click",d)}catch{window.removeEventListener("click",d)}}},[x]);const f=c.length===0?["select-button-placeholder"]:[];return e.u(e.g,{children:[e.u("button",{"aria-label":"choice dropdown button",className:e.cc("select-button",...f),onClick:d=>{d.stopPropagation(),g()},type:"button",children:[e.u("span",{children:c.length===0?i:c.length===1?c[0].label:`${c.length} ${o}`}),e.u(e.SvgCaret,{})]}),s&&e.u(Q,{disabledOptions:r,dropdownFooter:a,options:n,panelRef:u,selectedOptions:c,selectItem:d=>{var v;const b=c.some(w=>w.id===d.id),m=c.some(w=>{var N;return(N=w.optionProperties)==null?void 0:N.noneOfTheAbove});(v=d.optionProperties)!=null&&v.noneOfTheAbove&&!b?l([d]):t?l(b?c.filter(w=>w.id!==d.id):m?[d]:[...c,d]):b||l([d]),t||g()},showCheckbox:t})]})},exports.appCardHasPropertiesWithRequired=function(t){const o=t.props;if(o===null||typeof o!="object")return!1;const l=Reflect.get(o,"properties");return typeof l=="object"&&l!==null&&"required"in l},exports.getAttributedUrl=(t=void 0,o={})=>{if(!t)return t;const l=["http:","https:","itms-apps:","market:"],n=(r=>/^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(r)?r:`http://${r}`)(t);if(!n)return;try{const r=new URL(n);if(!r.protocol||!l.includes(r.protocol))return}catch{return}const i=[],c=((r,a,s)=>{let h=r;for(const[u,x]of Object.entries(Z))if(h.toLowerCase().includes(u))if(a[x]){const p=new RegExp(u,"gi");h=h.replace(p,a[x])}else s.push(u);return h})(n,o,i);return i.length===0?c:((r,a)=>{if(!r.includes("?"))return r;const s=r.slice(0,r.indexOf("?")),h=r.slice(r.indexOf("?")+1).split("&").map(u=>u.split("=")).filter(u=>!a.includes(u[1]));return h.length===0?s:`${s}?${h.map(u=>u.join("=")).join("&")}`})(c,i)},exports.useAutoSize=P;
|
package/dist/index-BnE-K_Xo.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-s39eJCD9.cjs"),X=require("./index-B2lKZafM.cjs"),p=require("./getAttributedUrl-CkFVhnm0.cjs"),we=({className:r,message:i,next:a,properties:n,questionId:t,type:o})=>{const{useMobileStyling:g,border:h,isLongFormSurvey:c,focusedQuestionId:m}=e.useConfig(f=>({useMobileStyling:f.useMobileStyling,border:f.border,isLongFormSurvey:X.isLongFormSurvey(f.studyType),focusedQuestionId:f.focusedQuestionId})),[u,y]=e.h(!1),[s,S]=e.h(""),[d,b]=e.h(!1),v=c&&m===t,x=n==null?void 0:n.collectName,T=(n==null?void 0:n.nameLabelText)||"Full Name",k=(n==null?void 0:n.consentText)||"I agree to the stated conditions",O=(n==null?void 0:n.submitButtonText)||"Submit",R=!!s.trim(),F=u&&(!x||R),D=(f,w=!1)=>{f.preventDefault(),f.stopPropagation();let Q=null;if(!w){if(!F)return void b(!0);Q={submitted:!0},x&&(Q.name=s)}a({value:Q,questionId:t,type:o},F)};return e.u("div",{className:e.cc(r,c&&!v&&"ul-card--unfocused","ul-card__consent-legal","fade-in-transition"),children:[e.u(p.Header,{isRequired:c&&(n==null?void 0:n.required),message:i,properties:{questionHtml:n.questionHtml}}),n!=null&&n.richTextBody?e.u(p.QuestionBodyWrapper,{children:e.u(p.Html,{className:"ul-rich-text-body",html:n.richTextBody,id:"ul-card__consent-legal-body-container"})}):null,e.u(p.MobileEmbedView,{embeddedType:"pdf",properties:n,children:e.u(p.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(p.Option,{allowTextEntry:!1,border:h,error:d&&!u,id:"consent",isRadio:!1,isSelected:u,label:k,onUserInputChanged:({selected:f})=>{f!==u&&y(!u)},useMobileStyling:g}),x&&e.u("input",{"aria-label":T,"aria-placeholder":T,className:e.cc(e.getClasses("ul-consent-legal__name-input",g)),"data-gramm":"false",maxLength:250,name:"name",onBlur:f=>{f.currentTarget.style.borderColor=d&&!R?X.ERROR_BORDER_COLOR:X.DEFAULT_BORDER_COLOR},onFocus:f=>{f.currentTarget.style.borderColor=d&&!R?X.ERROR_BORDER_COLOR:h},onInput:f=>{f.preventDefault(),f.stopPropagation(),S(f.currentTarget.value)},placeholder:T,style:d&&!R?{borderColor:X.ERROR_BORDER_COLOR}:{},tabIndex:0,value:s})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(p.Button,{className:F?"":"sprig-button-disabled",onClick:D,children:O}),n.required===!1&&!c&&e.u("button",{className:"ul-card-skip__button",onClick:f=>D(f,!0),children:e.getSkipButtonText(n)})]})]})})]},t)},Le=({activeValue:r,border:i,icon:a,isPressed:n,onSubmit:t,range:o,scaleLabelType:g,selectedValue:h,setSelectedValue:c,setActiveValue:m,setIsPressed:u,useMobileStyling:y,value:s,viewDocument:S})=>{const{isLongFormSurvey:d,enableCspTrustedTypes:b}=e.useConfig(w=>({isLongFormSurvey:X.isLongFormSurvey(w.studyType),enableCspTrustedTypes:w.enableCspTrustedTypes})),v=`option-${s}`,x=g==="number",T=g==="star",k=g==="smiley",O=x&&s===r||s===h,[R,F]=(()=>{const w=T&&h!==null&&s<=h;return T&&s<=r||k&&s===r||w||s===r||s===h?[i,n||w||s===h?1:.3]:["",1]})(),D=e.F(()=>{const w={borderColor:O?R:"",fillOpacity:O?"":F,zIndex:O?3:"auto",color:h===s?"#fff":""};return x?{...w,backgroundColor:h===s?R:""}:{...w,color:T||k||h===s?R:""}},[O,R,F,h,s,x,T,k]),f=e.F(()=>X.getHtml((({icon:w,scaleLabelType:Q,value:_,selectedValue:B})=>{if(Q==="smiley"&&_===B){let H=0;return w.replace(/black/g,()=>++H==1?"black":"white")}return w})({icon:a,scaleLabelType:g,value:s,selectedValue:h}),b),[b,a,g,h,s]);return e.u("button",{"aria-label":x?void 0:String(s),className:(()=>{switch(g){case"star":return e.cc(e.getClasses("likert-star",y),e.getClasses(`likert-star-${s}`,y));case"smiley":return e.cc(e.getClasses("likert-smiley",y),e.getClasses(`likert-smiley-${s}`,y));default:return s===o?e.cc(e.getClasses("likert-number",y),e.getClasses(`likert-number-${s}`,y),e.getClasses("likert-last-option",y)):e.cc(e.getClasses("likert-number",y),e.getClasses(`likert-number-${s}`,y))}})(),dangerouslySetInnerHTML:{__html:f},id:v,onClick:w=>{d&&(w.preventDefault(),w.stopPropagation(),c(s)),t()},onKeyDown:w=>{var B,H;const Q=S.querySelectorAll(`.likert-${g??"number"}`),_=s-1;w.key==="ArrowRight"?(B=Q[_+1])==null||B.focus():w.key==="ArrowLeft"?(H=Q[_-1])==null||H.focus():w.key!=="Enter"&&w.key!==" "||(d&&(w.preventDefault(),w.stopPropagation(),c(s)),t())},onPointerDown:()=>u(!0),onPointerEnter:()=>m(s),onPointerLeave:()=>{m(-1),u(!1)},style:D,tabIndex:0})},qe=({className:r,labels:i,message:a,next:n,properties:t,questionId:o,type:g})=>{const{border:h,useMobileStyling:c,viewDocument:m,isLongFormSurvey:u,focusedQuestionId:y}=e.useConfig(_=>({border:_.border,useMobileStyling:_.useMobileStyling,viewDocument:_.viewDocument,isLongFormSurvey:X.isLongFormSurvey(_.studyType),focusedQuestionId:_.focusedQuestionId})),[s,S]=e.h(-1),[d,b]=e.h(!1),[v,x]=e.h(null),T=u&&y===o,k=i&&i.left,O=i&&i.right;let R;const{range:F,scaleLabelType:D,ratingIcons:f}=t;F&&(R=Number(F));const w=R||5,Q=_=>{var B,H;switch(D){case"star":return(B=f[0])==null?void 0:B.svg;case"smiley":return(H=f[_])==null?void 0:H.svg;default:return String(_+1)}};return e.u("form",{className:e.cc(r,"ul-card--likert","fade-in-transition",u&&!T&&"ul-card--unfocused"),children:[e.u(p.Header,{isRequired:u&&(t==null?void 0:t.required),message:a,properties:t}),e.u(p.MobileEmbedView,{properties:t,children:e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${w})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(w)].map((_,B)=>{const H=B+1;return e.u(Le,{activeValue:s,border:h,icon:Q(B),isPressed:d,onSubmit:()=>n({value:H,questionId:o,type:g},!0),range:w,scaleLabelType:D,selectedValue:v,setActiveValue:S,setIsPressed:b,setSelectedValue:x,useMobileStyling:c,value:H,viewDocument:m},B)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:k}),e.u("span",{children:O})]})]}),!t.required&&!u&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(p.Button,{onClick:_=>{_.preventDefault(),_.stopPropagation(),n({value:null,questionId:o,type:g},!0)},children:e.getButtonText(t)})})})]})})]},o)},fe=r=>r&&(r.scrollHeight>r.offsetHeight?r:fe(r.parentElement)),Be=r=>{if(!r||!(a=>a instanceof HTMLElement)(r))return 0;const i=getComputedStyle(r);return parseFloat(i.marginTop)+parseFloat(i.marginBottom)+(parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth))},Re=({columns:r,onSelect:i,options:a,selectedOptions:n})=>{const t=e._([]),{border:o,useMobileStyling:g}=e.useConfig(s=>({border:s.border,useMobileStyling:s.useMobileStyling})),h=a.findIndex(s=>n[s.id]===null),[c,m]=e.h(h),u=e.T((s,S)=>{i(s,S);const d=c+1,b=a[d];if(b&&n[b.id]===null){m(d);const v=t.current[c];if(v!=null&&v.firstElementChild){const x=fe(v),T=v.firstElementChild,k=Be(v)+T.clientHeight;x==null||x.scrollTo(0,v.offsetTop+k)}}},[i,a,n,c]),y=e.T((s,S)=>{const d=c===s;return e.u(e.Accordion,{animate:!0,header:S.label,isOpen:d,onClick:()=>{var b;return m(d&&!((b=window.UserLeap)!=null&&b.isMobileSDK)?-1:s)},ref:b=>{b&&(t.current[s]=b)},showHeaderCheck:n[S.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:r.map(b=>e.u(p.Option,{allowTextEntry:!1,ariaLabel:`${S.label}-${b.label}`,border:o,error:!1,id:`${S.id}-${b.value}`,isRadio:!0,isSelected:n[S.id]===b.value,label:b.label,onUserInputChanged:()=>u(S.id,b.value),useMobileStyling:g},b.label))})},S.id)},[o,r,c,u,n,g]);return e.u("div",{children:a.map((s,S)=>y(S,s))})},Me=({columns:r,onSelect:i,options:a,selectedOptions:n})=>{const{border:t,useMobileStyling:o,isLongFormSurvey:g}=e.useConfig(d=>({border:d.border,useMobileStyling:d.useMobileStyling,isLongFormSurvey:X.isLongFormSurvey(d.studyType)})),h=a.length,c=r.length,m=e._(null),[u,y]=e.h(!1),[s,S]=e.h(!1);return e.p(()=>{const d=m.current,b=new ResizeObserver(v=>{window.requestAnimationFrame(()=>{d&&(y(Math.round(v[0].contentRect.width)<d.scrollWidth),S(Math.round(v[0].contentRect.width)<d.scrollWidth))})});return d&&b.observe(d),()=>{d&&b.unobserve(d)}},[]),e.u("div",{className:"ul-card--matrix_question_container",children:[e.u("div",{className:e.cc("ul-card--matrix_container",u&&"ul-matrix-scroll-gradient"),onScroll:()=>{(()=>{const d=m.current;d&&y(d.clientWidth+Math.abs(d.scrollLeft)<d.scrollWidth)})()},ref:m,children:e.u("div",{className:e.cc(g&&"ul-card--matrix_grid_longform","ul-card--matrix_grid"),style:`--numColumns: ${c}; --numRows: ${h+1};`,children:[e.u("div",{})," ",r.map(d=>e.u("div",{className:"ul-matrix-column-label",children:d.label},d.label)),a.map(d=>e.u(e.g,{children:[e.u("div",{"aria-label":d.label,className:"ul-matrix-row-label",children:d.label},d.label),e.u("div",{className:"ul-matrix-row-options",role:"radiogroup",children:r.map((b,v)=>{const x=v===c-1;return e.u("div",{className:e.cc("ul-matrix-option-wrapper",x&&"ul-matrix-last-option"),children:e.u(p.Option,{allowTextEntry:!1,ariaLabel:`${d.label}-${b.label}`,border:t,choiceStyle:{background:"transparent",border:"none",marginBottom:"0",padding:"0"},error:!1,id:`${d.id}-${b.value}`,isRadio:!0,isSelected:n[d.id]===b.value,onUserInputChanged:()=>i(d.id,b.value),useMobileStyling:o})},b.value)})})]}))]})}),(u||s)&&e.u("button",{className:s&&!u?"ul-matrix-scroll-arrow left":"ul-matrix-scroll-arrow",onClick:s&&!u?d=>{d.preventDefault();const b=m.current;if(b){const v=getComputedStyle(b).direction==="rtl";b.scrollTo({left:v?b.scrollWidth-b.clientWidth:0,behavior:"smooth"})}}:d=>{d.preventDefault();const b=m.current;if(b){const v=getComputedStyle(b).direction==="rtl";b.scrollTo({left:v?b.clientWidth-b.scrollWidth:b.scrollWidth,behavior:"smooth"})}},children:s&&!u?e.u(Pe,{}):e.u(De,{})})]})},Pe=()=>e.u("svg",{fill:"currentColor",height:"32",transform:"matrix(-1,0,0,1,0,0)",version:"1.1",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),De=()=>e.u("svg",{fill:"currentColor",height:"32",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),Fe=({className:r,message:i,next:a,options:n,properties:t,questionId:o,type:g,showIndividualSubmit:h=!1,onSubmitButtonClick:c})=>{const{useMobileStyling:m,isLongFormSurvey:u,focusedQuestionId:y,setFocusedQuestionId:s}=e.useConfig(D=>({useMobileStyling:D.useMobileStyling,isLongFormSurvey:X.isLongFormSurvey(D.studyType),focusedQuestionId:D.focusedQuestionId,setFocusedQuestionId:D.setFocusedQuestionId})),S=t.matrixColumn,d=t.required,b=u&&y===o,v=D=>{D.preventDefault(),D.stopPropagation(),a({value:T,questionId:o,type:g},!0),c&&c()},x=n.reduce((D,f)=>(D[f.id]=null,D),{}),[T,k]=e.h(x),O=D=>d&&Object.values(D).every(f=>f==null),R=(D,f)=>{u&&a({value:{...T,[D]:f},questionId:o,type:g},!O({...T,[D]:f})),k(w=>({...w,[D]:f}))},F=t.displayMatrixAsAccordion||m;return e.u("form",{className:e.cc(r,!u&&"ul-card__matrix","fade-in-transition",u&&!b&&"ul-card--unfocused"),id:"text-form",onClick:()=>{b&&s(o)},onSubmit:v,children:[e.u(p.Header,{isRequired:u&&(t==null?void 0:t.required),message:i,properties:t}),e.u(p.MobileEmbedView,{properties:t,children:[e.u(p.QuestionBodyWrapper,{children:[F?e.u(Re,{columns:S,onSelect:R,options:n,selectedOptions:T}):e.u(Me,{columns:S,onSelect:R,options:n,selectedOptions:T}),h&&e.u(p.LongformSubmitButton,{handleSubmit:v,isSubmitDisabled:O(T)})]}),!u&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(p.Button,{disabled:O(T),children:e.getButtonText(t)})})})]})]},o)},ye=({className:r,message:i,onSubmit:a,options:n=[],properties:t,questionId:o,type:g,showIndividualSubmit:h=!1,onSubmitButtonClick:c})=>{const{border:m,useMobileStyling:u,isLongFormSurvey:y,focusedQuestionId:s,setFocusedQuestionId:S}=e.useConfig(N=>({border:N.border,useMobileStyling:N.useMobileStyling,isLongFormSurvey:X.isLongFormSurvey(N.studyType),focusedQuestionId:N.focusedQuestionId,setFocusedQuestionId:N.setFocusedQuestionId})),d=y&&s===o,b=n.reduce((N,q)=>(N[q.id]={isSelected:!1},N),{}),[v,x]=e.h(b),T=g==="multiplechoice",k=t.required,O=n.find(N=>{var q;return(q=N.optionProperties)==null?void 0:q.noneOfTheAbove}),R=N=>Object.entries(N).some(([q,U])=>{var l;const Z=n.find(C=>`${C.id}`===q),V=U.userText===void 0||U.userText.trim()==="";return((l=Z==null?void 0:Z.optionProperties)==null?void 0:l.allowsTextEntry)&&V&&U.isSelected}),F=N=>Object.values(N).filter(q=>q.isSelected).length,D=t.minSelect&&t.minSelect>0&&t.maxSelectMode===p.MaxSelectModes.Range&&F(v)<t.minSelect&&(k||F(v)>0),f=N=>R(N)||k&&!F(N)||!(q=>{const{minSelect:U=0,maxSelect:Z=1/0,maxSelectMode:V}=t,l=F(q);switch(V){case p.MaxSelectModes.Maximum:return l<=Z;case p.MaxSelectModes.Range:return l===0||l>=U;default:return!0}})(N),w=Object.entries(v).some(([N,q])=>{var U,Z;return q.isSelected&&((Z=(U=n.find(V=>`${V.id}`===N))==null?void 0:U.optionProperties)==null?void 0:Z.allowsTextEntry)}),Q=h&&(!T||w),_=N=>{K(N.id,N.selected,N.userText,N.noneOfTheAbove),N.selected&&y&&!T&&!d&&S(o)},B=N=>{var q;return(t==null?void 0:t.maxSelectMode)!==p.MaxSelectModes.Unlimited&&F(v)===(t==null?void 0:t.maxSelect)&&!((q=v[N])!=null&&q.isSelected)},H=N=>{N.preventDefault(),N.stopPropagation(),a(v,!0),c&&c()},K=(N,q,U,Z)=>{const V=Object.assign({},v);if((T||Z)&&q)for(const L of Object.values(V))L.isSelected=!1,delete L.userText;else O&&!Z&&v[O.id].isSelected&&(V[O.id].isSelected=!1);V[N]={isSelected:q,userText:U};const l=T&&Object.entries(V).some(([L,E])=>{var P,W;return E.isSelected&&((W=(P=n.find(G=>`${G.id}`===L))==null?void 0:P.optionProperties)==null?void 0:W.allowsTextEntry)}),C=!f(V);y&&(a(V,C),T&&!l&&C&&c&&c()),x(V)};return e.u("form",{className:e.cc(r,"ul-card--multiple","fade-in-transition",y&&!d&&"ul-card--unfocused"),id:"text-form",onClick:g==="multipleselect"?()=>{y&&s!==o&&g==="multipleselect"&&S(o)}:void 0,onSubmit:H,children:[e.u(p.Header,{isRequired:y&&(t==null?void 0:t.required),message:i,properties:t}),e.u(p.MobileEmbedView,{properties:t,children:e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[t.isDropdown?e.u(p.Select,{disabledOptions:n.filter(N=>B(N.id)),dropdownFooter:D?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[F(v),"/",t.minSelect]}):void 0,isMultiSelect:!T,multiselectText:t.dropdownMultiselectedText??"choices selected",onChange:N=>{const q={...v};for(const U of n)N.includes(U)?q[U.id].isSelected=!0:q[U.id].isSelected=!1;y&&a(q,!f(q)),x(q)},options:n,placeholderText:t.dropdownPlaceholderText??(T?"Select choice":"Select choice(s)"),value:n.filter(N=>v[N.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",u)),role:T?"radiogroup":"group",children:[n.map(({id:N,label:q,value:U,optionProperties:Z})=>{var E,P;const V=`${N}`,{allowsTextEntry:l,noneOfTheAbove:C}={allowsTextEntry:!1,noneOfTheAbove:!1,...Z};return e.u(p.Option,{allowTextEntry:l,border:m,disabled:B(V),error:(L=v,R(L)),id:V,isRadio:T,isSelected:!!((E=v[V])!=null&&E.isSelected),label:q,noneOfTheAbove:C,onUserInputChanged:_,promptText:(Z==null?void 0:Z.otherOptionPlaceholder)||"Please specify",text:(P=v[N])==null?void 0:P.userText,useMobileStyling:u,value:U},V);var L}),!!D&&e.u("div",{className:"ul-card__min-select-counter",children:[F(v),"/",t.minSelect]})]}),Q&&e.u(p.LongformSubmitButton,{handleSubmit:H,isSubmitDisabled:f(v)})]}),!y&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(p.Button,{disabled:f(v),onClick:H,children:e.getButtonText(t)})})})]})})]},o)},Qe=r=>{const{questionId:i,type:a,next:n,options:t}=r,{setFocusedQuestionId:o}=e.useConfig(g=>({setFocusedQuestionId:g.setFocusedQuestionId}));return e.u(ye,{...r,onSubmit:(g,h)=>{var S;const c=Object.entries(g).find(([,d])=>d.isSelected)||[void 0,void 0],[m,u]=c,y=t.find(d=>`${d.id}`===m);!((S=y==null?void 0:y.optionProperties)!=null&&S.allowsTextEntry)||u!=null&&u.userText&&u.userText.trim()!==""||o(i);const s=u!=null&&u.userText?{[m]:{userText:u.userText}}:null;n({value:y&&m?{[m]:y.value}:{},secondaryValue:s,questionId:i,type:a},h)}})},Ee=r=>{const{questionId:i,type:a,next:n}=r;return e.u(ye,{...r,onSubmit:(t,o)=>{const g=Object.entries(t).reduce((c,[m,u])=>(c[m]=u.isSelected,c),{}),h=Object.entries(t).reduce((c,[m,u])=>{if(!u.userText)return c;const y=c||{};return y[m]={userText:u.userText},y},null);n({value:g,secondaryValue:h,questionId:i,type:a},o)}})},Oe=({className:r,labels:i,message:a,properties:n,next:t,questionId:o,type:g})=>{const[h,c]=e.h(null),{border:m,useMobileStyling:u,viewDocument:y,isLongFormSurvey:s,focusedQuestionId:S}=e.useConfig(x=>({border:x.border,useMobileStyling:x.useMobileStyling,viewDocument:x.viewDocument,isLongFormSurvey:X.isLongFormSurvey(x.studyType),focusedQuestionId:x.focusedQuestionId})),d=s&&S===o,b=i&&i.left,v=i&&i.right;return e.u("form",{className:e.cc(r,"ul-card--nps","fade-in-transition",s&&!d&&"ul-card--unfocused"),children:[e.u(p.Header,{isRequired:s&&(n==null?void 0:n.required),message:a,properties:n}),e.u(p.MobileEmbedView,{properties:n,children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((x,T)=>e.u("button",{className:e.cc(e.getClasses("nps-number",u),e.getClasses(`nps-number-${T}`,u)),id:`option-${T}`,onClick:k=>{s&&(k.preventDefault(),k.stopPropagation(),c(T)),t({value:T,questionId:o,type:g},!0)},onKeyDown:k=>{var R,F;const O=y.querySelectorAll("button.nps-number");k.key==="ArrowRight"?(R=O[T+1])==null||R.focus():k.key==="ArrowLeft"?(F=O[T-1])==null||F.focus():k.key!=="Enter"&&k.key!==" "||(s&&(k.preventDefault(),k.stopPropagation(),c(T)),t({value:T,questionId:o,type:g},!0))},onPointerDown:k=>{k.currentTarget.style.zIndex="2",k.currentTarget.style.borderColor=m},onPointerLeave:k=>{k.currentTarget.style.zIndex="auto",k.currentTarget.style.borderColor=X.DEFAULT_BORDER_COLOR},style:h===T?{backgroundColor:m,color:"#fff"}:void 0,tabIndex:0,children:T},T))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:b}),e.u("span",{children:v})]})]}),!n.required&&!s&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(p.Button,{onClick:x=>{x.preventDefault(),x.stopPropagation(),t({value:null,questionId:o,type:g},!0)},children:e.getButtonText(n)})})})]})]},o)},Ae=r=>{const{className:i,message:a,next:n,properties:t,questionId:o,type:g,showIndividualSubmit:h=!1,onSubmitButtonClick:c}=r,m=g==="aidynamicfollowup"?r.loading:void 0,{border:u,useMobileStyling:y,update:s,isLongFormSurvey:S,focusedQuestionId:d,setFocusedQuestionId:b,isPreview:v}=e.useConfig(_=>({border:_.border,useMobileStyling:_.useMobileStyling,update:_.update,isLongFormSurvey:X.isLongFormSurvey(_.studyType),focusedQuestionId:_.focusedQuestionId,setFocusedQuestionId:_.setFocusedQuestionId,isPreview:_.isPreview})),[x,T]=e.h(""),k=e._(null),O=S&&d===o;e.p(()=>{var _,B;S&&!v&&(O?(_=k.current)==null||_.focus():(B=k.current)==null||B.blur())},[S,O,v]);const R=x.trim(),F=t.required===!0&&!R,D=p.useAutoSize(k,()=>s()),f=_=>{_.preventDefault(),_.stopPropagation();const B=R.length>0,H=!t.required||B;n({value:x,questionId:o,type:g},H),c&&c(B)},w=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";if(m==null&&g==="aidynamicfollowup")return e.u(e.g,{});const Q=m?"Preparing your next question":a;return e.u("form",{className:e.cc(i,"ul-card-text","fade-in-transition",S&&!O&&"ul-card--unfocused"),id:"text-form",onClick:()=>{S&&d!==o&&b(o)},children:[e.u(p.Header,{isRequired:S&&(t==null?void 0:t.required),message:Q,properties:t}),e.u(p.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":w,className:e.cc(!!m&&"ul-card-text__input__loading",e.getClasses("ul-card-text__input",y)),"data-gramm":"false",disabled:!!m,maxLength:5e3,name:"text",onBlur:_=>{_.currentTarget.style.borderColor=X.DEFAULT_BORDER_COLOR},onChange:_=>{const{value:B}=_.currentTarget;if(D(),_.preventDefault(),_.stopPropagation(),T(B),S){const H=B.trim().length>0;n({value:B,questionId:o,type:g},H)}},onFocus:_=>{_.currentTarget.style.borderColor=u,b(o)},placeholder:w,ref:k,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(p.Html,{className:"footer",html:t.footerHtml}),h&&e.u(p.LongformSubmitButton,{handleSubmit:f,isSubmitDisabled:F}),e.u(p.QuestionBodyFooterContainer,{children:!S&&e.u(p.Button,{disabled:F||!!m,onClick:f,children:e.getButtonText(t)})})]})})})]},o)},ae=1,Se=2,xe=3,se=r=>r.type==="av_permission",ge=r=>r.type==="screen_permission",Ce=(r,i)=>r===void 0?ae:r?((a,n)=>!(se(n)?n.permissionDescriptors:[]).includes("camera")||a.getVideoTracks().length>0)(r,i)?xe:ae:Se,he={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ee=e.create(r=>({...he,reset:()=>{r(he)},updatePage:i=>{r(i)}}));function ue({currentPage:r,pages:i}){const{avStream:a,recordingMediaTypes:n,updatePage:t}=ee.getState(),{recorderEventEmitter:o}=e.useConfig.getState();o.emit("av.permission",{"permission.descriptors":r.permissionDescriptors,"stream.ready":(g,h)=>{if(a===g)return;let c=r;if(g&&!r.permissionDescriptors.includes("camera")){const m=i.indexOf(r),u=h!=null&&h.active?m+2:m+1;h!=null&&h.active&&n&&o.emit("begin.recording",{"recording.media.types":n,"start.recording.callback":y=>t({mediaRecordingUids:y})}),c=i[u]}t({currentPage:c,avStream:g})}})}function ce({status:r}){const{nextQuestion:i,passthroughData:a,mediaRecordingUids:n,reset:t}=ee.getState(),{recorderEventEmitter:o,handleUploadUpdate:g,index:h}=e.useConfig.getState(),c={value:{taskStatus:r},type:"recordedtask",questionId:(a==null?void 0:a.questionId)||1};a&&o.emit("finish.task",{"begin.callback":m=>{g({mediaRecordingUid:m,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(m,u)=>{g({mediaRecordingUid:m,progressPct:u.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":m=>{m&&g({mediaRecordingUid:m,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":a,"current.index":h,"task.response":c,"task.complete.callback":m=>{c.value.taskDurationMillisecond=m,n&&(c.value.mediaRecordingUids=n),t(),i(c)}})}function de({pages:r,setIsRequestingPermission:i}){const{recorderEventEmitter:a,eventEmitFn:n}=e.useConfig.getState(),{updatePage:t,currentPage:o,recordingMediaTypes:g,screenPermissionRequested:h}=ee.getState();if(!o)return;const c=r.indexOf(o);switch(o.type){case"av_permission":{const m=h?c+2:c+1;return h&&g&&a.emit("begin.recording",{"recording.media.types":g,"start.recording.callback":u=>{t({mediaRecordingUids:u})}}),void t({currentPage:r[m]})}case"screen_permission":return void a.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(m,u)=>{const y=u?r[c+1]:o;u&&g&&a.emit("begin.recording",{"recording.media.types":g,"start.recording.callback":s=>{t({captureStream:u,mediaRecordingUids:s})}}),t({currentPage:y,screenPermissionRequested:!0,captureStream:u})}});case"start_task":return n("recorded.task.start"),a.emit("recorded.task.start"),a.emit("start.task"),void t({currentPage:r[c+1],screenPermissionRequested:!0});case"complete_task":return}}const Te="ul-permission-graphics-container",ke="ul-permission-body",_e=e.cc(Te,"ul_recorded-task-inset-spacing"),oe=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Ie=({richTextBody:r})=>e.u(p.Html,{className:"ul-rich-text-body",html:r,id:"ul-task-detail-container"}),le=({required:r,skipButtonText:i,bottom:a=!1})=>r?null:e.u(p.Button,{className:e.cc(a&&"ul-skip-button-below","ul-button-inactive"),onClick:ce.bind(null,{status:"abandoned"}),children:i||"Skip"}),pe=r=>{const{avStream:i,captureStream:a,recordingMediaTypes:n,updatePage:t}=ee.getState(),o=(n==null?void 0:n.includes("audio"))||(n==null?void 0:n.includes("video"));e.p(()=>{const g=setInterval(()=>{o&&i&&!i.active?t({avStream:null,currentPage:r[0]}):a&&a.active||t({captureStream:void 0,currentPage:r[o?1:0]})},1e3);return()=>clearInterval(g)},[i,a,o,r,n,t])},He=({content:r,pages:i,required:a})=>{const{buttonText:n,skipButtonText:t,taskDetail:o}=r;return pe(i),e.u("div",{className:"ul-task-page",children:[o&&e.u(Ie,{richTextBody:o}),e.u("div",{className:oe,children:[e.u(p.Button,{onClick:de.bind(null,{pages:i}),children:n}),e.u(le,{required:a,skipButtonText:t})]})]},"start-task")},$e=({content:r,pages:i,properties:a})=>{const{buttonText:n,skipButtonText:t}=r;return pe(i),e.u("div",{className:"ul-task-page",children:[r.taskDetail&&e.u(Ie,{richTextBody:r.taskDetail}),e.u(p.MobileEmbedView,{properties:a,children:e.u("div",{className:oe,children:[e.u(p.Button,{className:"ul-complete-task-button",onClick:ce.bind(null,{status:"completed"}),children:n}),e.u(p.Button,{className:e.cc("ul-button-inactive"),onClick:ce.bind(null,{status:"given.up"}),children:t})]})})]},"complete-task")},Ve=({content:r,pages:i,required:a})=>{const{buttonText:n,skipButtonText:t}=r,[o]=e.useConfig(c=>[c.tabTitle]),[g,h]=e.h(!1);return e.u("div",{children:[e.u("div",{className:_e,children:[e.u("p",{style:{marginTop:"auto"},children:r.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:ke,children:o})})]}),e.u("div",{className:a?"":oe,children:[e.u(p.Button,{disabled:g,onClick:de.bind(null,{pages:i,setIsRequestingPermission:h}),children:n}),e.u(le,{required:a,skipButtonText:t})]})]})},Ue=({content:r})=>e.u(p.Html,{className:e.cc(Te,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:r.svg},"ul-permission-request-graphic"),We=({content:r,pages:i,required:a})=>{const{permissionDeniedHeadline:n,permissionDeniedBody:t,skipButtonText:o,tryAgainButtonText:g}=r,h=se(i[0])?i[0]:null;return e.p(()=>{const c=setInterval(()=>{h!==null&&ue({currentPage:h,pages:i})},1e3);return()=>clearInterval(c)},[h,i]),h?e.u("div",{children:[e.u("div",{className:_e,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:n}),e.u("span",{className:ke,children:t})]})}),e.u("div",{className:oe,children:[e.u(p.Button,{onClick:ue.bind(null,{currentPage:h,pages:i}),children:g}),e.u(le,{required:a,skipButtonText:o})]})]}):null},je=({stream:r})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:i=>{i&&(i.srcObject=r||null)}}),Ze=({content:r,pages:i,required:a})=>{const{skipButtonText:n}=r,{avStream:t}=ee.getState();return pe(i),e.u("div",{children:[e.u(je,{stream:t}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(p.Button,{onClick:de.bind(null,{pages:i}),children:r.buttonText}),e.u(le,{bottom:!0,required:a,skipButtonText:n})]})]})},ze=({properties:r})=>{const{pages:i,required:a}=r,{avStream:n,currentPage:t}=ee.getState();if(t===void 0)return null;switch(t==null?void 0:t.type){case"av_permission":{const o=Ce(n,t);return o===ae?e.u(Ue,{content:t}):o===Se?e.u(We,{content:t,pages:i,required:a}):e.u(Ze,{content:t,pages:i,required:a})}case"screen_permission":return e.u(Ve,{content:t,pages:i,required:a});case"start_task":return e.u(He,{content:t,pages:i,required:a});case"complete_task":return e.u($e,{content:t,pages:i,properties:r});default:return null}},Ge=({className:r,properties:i,next:a,questionId:n})=>{const t=e.useConfig(),{surveyId:o,responseGroupUid:g,userId:h,update:c}=t,m=ee(),{screenPermissionRequested:u}=m,y=ee(v=>v.avStream);let s=ee(v=>v.currentPage);s||(s=function({pages:v,userId:x,responseGroupUid:T,surveyId:k,questionId:O,next:R}){const{updatePage:F}=ee.getState(),{eventEmitFn:D,recorderEventEmitter:f}=e.useConfig.getState(),w={questionId:O,surveyId:k,visitorId:x,responseGroupUid:T};let Q=0;f.emit("recorded.task.permission.screen"),D("recorded.task.permission.screen"),f.emit("permission.status",{"permission.status.callback":(B,H,K,N)=>{const q=v[Q],{type:U}=q,Z=["screen"];if(se(q)){const{permissionDescriptors:V}=q,l=V==null?void 0:V.includes("microphone"),C=V==null?void 0:V.includes("camera");l&&Z.push("audio"),C&&Z.push("video"),(B!=null&&B.active&&!C||B!=null&&B.active&&H)&&Q++}ge(v[Q])&&K&&(Q++,f.emit("begin.recording",{"recording.media.types":Z,"start.recording.callback":V=>F({mediaRecordingUids:V})})),F({currentPage:v[Q],avStream:B,screenPermissionRequested:K,nextQuestion:R,type:U,passthroughData:w,recordingMediaTypes:Z,captureStream:N})}});const _=v[Q];return _.type==="av_permission"&&ue({currentPage:_,pages:v}),_}({questionId:n,surveyId:o,next:v=>{a(v,!0)},pages:i.pages,responseGroupUid:g,userId:h}));let S=s.headline,d=s.captionText;const b=Ce(y,s);return ge(s)&&u&&(S=s.permissionDeniedHeadline,d=s.permissionDeniedCaptionText),se(s)&&b===xe&&(S=s.permissionGrantedHeadline,d=s.permissionGrantedCaptionText),e.p(()=>{c()},[c]),e.u("div",{className:e.cc(r,"ul-center-horizontally","fade-in-transition"),children:[e.u(p.Header,{isRequired:i==null?void 0:i.required,message:S,properties:{captionText:d}}),e.u(p.QuestionBodyWrapper,{children:e.u(ze,{properties:i})})]})},Ye=({richTextBody:r,plaintextBody:i})=>r?e.u(p.Html,{className:"ul-rich-text-body",html:r,id:"ul-card__text-url-body-container"}):i?e.u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(i?i.split(/\n\s*\n/g):[]).map((a,n)=>e.u("p",{children:a},n))}):null,Ke=({className:r,message:i,next:a,properties:n,questionId:t,type:o})=>{const{visitorAttributes:g,isLongFormSurvey:h}=e.useConfig(y=>({visitorAttributes:y.visitorAttributes,isLongFormSurvey:X.isLongFormSurvey(y.studyType)})),c=(y,s=!1)=>{a({value:s?{skipped:!0}:void 0,questionId:t,type:o},!0)},m=p.getAttributedUrl(n&&n.buttonUrl,g),u=h&&n.promptActionType===p.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(r,"ul-card__text-url-prompt","fade-in-transition"),children:[e.u(p.Header,{isRequired:h&&(n==null?void 0:n.required),message:i,properties:{questionHtml:n.questionHtml}}),e.u(p.QuestionBodyWrapper,{children:e.u(Ye,{plaintextBody:n==null?void 0:n.body,richTextBody:n==null?void 0:n.richTextBody})}),e.u(p.MobileEmbedView,{properties:n,children:!u&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:m,id:"ul-card-text__button",onClick:c,onKeyPress:y=>{y.key!=="Enter"&&y.key!==" "||a({value:void 0,questionId:t,type:o},!0)},rel:"noreferrer",role:m?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(n)}),n.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:y=>c(0,!0),children:e.getSkipButtonText(n)})]})})})]},t)},Xe=({className:r,questionId:i})=>{const{border:a,destroy:n,endCard:t,forceBrandedLogo:o,update:g}=e.useConfig(m=>({border:m.border,destroy:m.destroy,endCard:m.endCard,forceBrandedLogo:m.forceBrandedLogo,update:m.update}));e.p(()=>{setTimeout(()=>{n(X.APP_ID)},o?4e3:2e3)},[n,o]);const h=t&&t.subheader?e.u("p",{className:"ul-caption",children:t.subheader}):null,c=t&&t.headline?t.headline:"";return e.p(()=>{g()},[g]),e.u("div",{className:e.cc(r,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("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:a,fillRule:"evenodd"}),e.u("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:a,fillRule:"evenodd"}),e.u("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.u(p.Header,{message:c}),h]})})},i)},Je=({className:r})=>{const{uploadProgress:i}=e.useConfig(o=>({uploadProgress:o.uploadProgress}));let a,n;Object.values(i).filter(o=>o.isSubmitted).length>1?(a="Your responses are processing",n="Please keep this tab open until your responses are fully processed."):(a="Your response is processing",n="Please keep this tab open until your response is fully processed.");const t=Math.round(Math.min(99,...Object.values(i).filter(o=>o.isSubmitted).map(o=>o.progressPct||0)));return e.u("div",{className:e.cc(r,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(p.Header,{message:`${a} (${t}% complete)`}),e.u("p",{className:"ul-caption",children:n})]})},Ne=e.F$1(void 0),et=({value:r,children:i})=>e.u(Ne.Provider,{value:r,children:i}),tt=({isRightLabel:r,isLeftLabel:i})=>r?e.MaxDiffChoice.RIGHT:i?e.MaxDiffChoice.LEFT:null,rt="Best",nt="Worst",it=({className:r,labels:i,message:a,properties:n,options:t,questionId:o,type:g,next:h})=>{var O,R,F,D;const[c,m]=e.h(t.map((f,w)=>({...f,label:f.label===""?`Item ${w+1}`:f.label,isRightLabel:!1,isLeftLabel:!1}))),u=(()=>{const f=e.q(Ne);if(f===void 0)throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");return f})(),y={padding:"24px",display:"flex",cursor:"pointer",width:"auto"},[s,S]=e.h(!1);e.p(()=>{const f=c.findIndex(q=>q.isRightLabel),w=c.findIndex(q=>q.isLeftLabel),Q=f!==-1&&w!==-1;S(Q);const _=!n.required||n.required&&Q,B=c.map(q=>({id:q.id,option:q.label,selected:tt(q)})),H=Math.floor(o),K=Object.keys(u).filter(q=>q.startsWith(H.toString())).map(Number).sort((q,U)=>q-U).at(-1),N=[];if(typeof K=="number"){const q=u[K],U=JSON.parse(q);N.push(...U)}N.push(B),setTimeout(()=>{h({value:N,questionId:o,type:g},_,Q),S(!1)},Q?500:0)},[c]);const{border:d,useMobileStyling:b,enableCspTrustedTypes:v}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,enableCspTrustedTypes:f.enableCspTrustedTypes})),x=(f,w)=>()=>{s||m(Q=>((_,B,H)=>_.map(K=>K.id===B?{...K,isRightLabel:H===e.MaxDiffChoice.RIGHT,isLeftLabel:H===e.MaxDiffChoice.LEFT}:H===e.MaxDiffChoice.RIGHT&&K.isRightLabel||H===e.MaxDiffChoice.LEFT&&K.isLeftLabel?{...K,isRightLabel:!1,isLeftLabel:!1}:K))(Q,f,w))},T=(O=n.ratingIcons)==null?void 0:O[0].svg,k=(R=n.ratingIcons)==null?void 0:R[1].svg;return e.u("form",{className:e.cc(r,"ul-card-maxdiff","fade-in-transition"),children:[e.u(p.Header,{isRequired:n==null?void 0:n.required,message:a,properties:n}),e.u(p.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--maxdiff__question-inner-container",children:[e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.left)||((F=n==null?void 0:n.labels)==null?void 0:F.left)||rt}),e.u("div",{children:" "}),e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.right)||((D=n==null?void 0:n.labels)==null?void 0:D.right)||nt}),c.map(({id:f,label:w,isLeftLabel:Q,isRightLabel:_})=>e.u(e.g,{children:[e.u("div",{className:"ul-card-maxdiff__option-control "+(k?"smiley":""),children:k?e.u(be,{ariaPressed:Q,className:Q?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:v,html:k,id:`smiley-good-${f}`,onClick:x(f,e.MaxDiffChoice.LEFT)}):e.u(p.Option,{allowTextEntry:!1,ariaLabel:`bestLabel-${w}`,border:d,choiceStyle:y,error:!1,id:`${f}`,isRadio:!0,isSelected:Q,onUserInputChanged:x(f,e.MaxDiffChoice.LEFT),useMobileStyling:b})}),e.u("div",{className:"ul-card-maxdiff__option-label",children:w}),e.u("div",{className:"ul-card-maxdiff__option-control "+(T?"smiley":""),children:T?e.u(be,{ariaPressed:_,className:_?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:v,html:T,id:`smiley-bad-${f}`,onClick:x(f,e.MaxDiffChoice.RIGHT)}):e.u(p.Option,{allowTextEntry:!1,ariaLabel:`worstLabel-${w}`,border:d,choiceStyle:y,error:!1,id:`${f}`,isRadio:!0,isSelected:_,onUserInputChanged:x(f,e.MaxDiffChoice.RIGHT),useMobileStyling:b})})]}))]})})]},o)},be=({enableCspTrustedTypes:r,ariaPressed:i,className:a,html:n,id:t,onClick:o})=>{const g=e.F(()=>X.getHtml(n,r),[r,n]);return e.u("span",{"aria-pressed":i,className:a,dangerouslySetInnerHTML:{__html:g},id:t,onClick:o,tabIndex:0,type:"button"})},st=({className:r,labels:i,message:a,next:n,properties:t,questionId:o,type:g,onSubmitButtonClick:h,options:c,showIndividualSubmit:m=!1})=>{const u=e._(null),y=e._(0),s=e._(0),S=e._(null),d=e._(!1),b=e._([]),[v,x]=e.h(()=>(t==null?void 0:t.required)===!0),[T,k]=e.h(()=>c.map(I=>({...I,rank:null}))),O=e.F(()=>Array.from({length:c.length},(I,A)=>A+1),[c.length]),{isLongFormSurvey:R,focusedQuestionId:F,setFocusedQuestionId:D,useMobileStyling:f,isPreview:w,headers:Q}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,isLongFormSurvey:X.isLongFormSurvey(I.studyType),focusedQuestionId:I.focusedQuestionId,setFocusedQuestionId:I.setFocusedQuestionId,isPreview:I.isPreview,headers:I.headers})),_=(Q==null?void 0:Q["userleap-platform"])==="android",B=f&&!w&&!_,H=!B&&!_,K=R&&F===o,N=I=>{I.preventDefault(),L(T),h&&h()},q=(I,A)=>{k($=>{const M=parseInt(A),j=$.map(z=>({...z}));j.some(z=>z.rank==null)&&j.forEach((z,ne)=>z.rank=ne+1);const J=j.findIndex(z=>z.id===I);if(J===-1)return $;const Y=j[J].rank;return M<Y?j.forEach(z=>{z.id!==I&&z.rank>=M&&z.rank<Y&&(z.rank=z.rank+1)}):M>Y&&j.forEach(z=>{z.id!==I&&z.rank>Y&&z.rank<=M&&(z.rank=z.rank-1)}),j[J].rank=M,j.sort((z,ne)=>z.rank-ne.rank),E(j),j})},U=(I,A)=>{for(let $=0;$<b.current.length;$++){const M=b.current[$];if(!M||M===S.current)continue;const j=M.getBoundingClientRect();if(I>=j.left&&I<=j.right&&A>=j.top&&A<=j.bottom)return{element:M,index:$}}return null},Z=I=>A=>{if(!B)return;A.preventDefault(),A.stopPropagation(),d.current=!0,u.current=I;const $=A.touches[0];y.current=$.clientY,s.current=$.clientY;const M=A.currentTarget.closest(".ul-card-rank__option");M&&(S.current=M,M.classList.add("is-dragging"))},V=I=>{if(!B||!d.current||u.current===null)return;I.preventDefault(),I.stopPropagation();const A=I.touches[0];s.current=A.clientY;const $=s.current-y.current;S.current&&(S.current.style.transform=`translateY(${$}px)`,S.current.style.zIndex="1000"),b.current.forEach(j=>{j&&j!==S.current&&j.classList.remove("is-drop-target")});const M=U(A.clientX,A.clientY);M&&M.element.classList.add("is-drop-target")},l=I=>{if(!B||!d.current||u.current===null)return;I.preventDefault(),I.stopPropagation();const A=I.changedTouches[0],$=U(A.clientX,A.clientY);S.current&&(S.current.style.transform="",S.current.style.zIndex="",S.current.classList.remove("is-dragging")),b.current.forEach(M=>{M&&M.classList.remove("is-drop-target")}),$&&$.index!==u.current&&C(u.current,$.index),u.current=null,S.current=null,d.current=!1},C=(I,A)=>{k($=>{const M=$.map(J=>({...J})),[j]=M.splice(I,1);return M.splice(A,0,j),M.forEach((J,Y)=>{J.rank=Y+1}),E(M),M})},L=I=>{const A={};I.reduce(($,M)=>($[M.id]=M.rank,$),A),n({value:A,questionId:o,type:g},!0)},E=I=>{x(!1),R&&L(I)},{left:P,right:W}=i,G=c.length,te=I=>{I.preventDefault(),I.currentTarget.classList.add("is-drop-target")},re=I=>{I.currentTarget.classList.remove("is-drop-target")},ie=I=>{u.current=null,I.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(r,"ul-card-rank","fade-in-transition",R&&!K&&"ul-card--unfocused"),onClick:R&&!K?()=>{D(o)}:void 0,onSubmit:N,children:[e.u(p.Header,{isRequired:t==null?void 0:t.required,message:a,properties:t}),e.u(p.MobileEmbedView,{properties:t,children:_?e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",P]})}),e.u("ol",{className:"ul-card-rank__list",children:T.map(({id:I,label:A,rank:$})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${A}`,className:e.cc("ul-card-rank__select",$==null&&"ul-card-rank__select--placeholder"),name:`rank[${I}]`,onChange:M=>q(I,M.currentTarget.value),value:$??"",children:[$==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),O.map(M=>e.u("option",{className:"ul-card-rank__select-option",value:M,children:M},`${M}-${o}`))]}),e.u("span",{children:A})]},I))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",W]})})]}),m&&e.u(p.LongformSubmitButton,{handleSubmit:N,isSubmitDisabled:v})]}),!R&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(p.Button,{disabled:v,children:e.getButtonText(t)})})})]}):e.u(e.g,{children:[e.u(p.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",P]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:_?void 0:I=>{I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="move")},children:T.map(({id:I,label:A,rank:$},M)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!H||void 0,onDragEnd:H?ie:void 0,onDragEnter:H?te:void 0,onDragLeave:H?re:void 0,onDragStart:H?(J=M,Y=>{u.current=J,Y.dataTransfer&&(Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",String(J)),Y.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:H?(j=M,Y=>{var ne,me;Y.preventDefault(),Y.currentTarget.classList.remove("is-drop-target");const z=u.current;u.current=null,(me=(ne=Y.currentTarget.closest(".ul-card-rank__list"))==null?void 0:ne.querySelector(".is-dragging"))==null||me.classList.remove("is-dragging"),z!=null&&z!==j&&C(z,j)}):void 0,ref:Y=>b.current[M]=Y,children:[e.u("select",{"aria-label":`Rank for ${A}`,className:e.cc("ul-card-rank__select",$==null&&"ul-card-rank__select--placeholder"),name:`rank[${I}]`,onChange:Y=>q(I,Y.currentTarget.value),value:$??"",children:[$==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),O.map(Y=>e.u("option",{className:"ul-card-rank__select-option",value:Y,children:Y},`${Y}-${o}`))]}),e.u("span",{children:A}),!_&&e.u("button",{"aria-label":`Drag ${A} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:B?l:void 0,onTouchMove:B?V:void 0,onTouchStart:B?Z(M):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("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"})})})]},I);var j,J})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",W]})})]}),m&&e.u(p.LongformSubmitButton,{handleSubmit:N,isSubmitDisabled:v})]}),!R&&e.u(p.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(p.Button,{disabled:v,children:e.getButtonText(t)})})})]})})]},o)},ot=new Set(["aidynamicfollowup","open","matrix","multipleselect","multiplechoice","rankorder"]),ve=({cardInstance:r,moveToNextQuestion:i,showIndividualSubmit:a,submitQuestion:n,updateCardValues:t,allResponsesArray:o})=>{const{isLongFormSurvey:g,createDynamicQuestion:h,cards:c,surveyVisitorAttributes:m}=e.useConfig(k=>({isLongFormSurvey:X.isLongFormSurvey(k.studyType),createDynamicQuestion:k.createDynamicQuestion,cards:k.cards,surveyVisitorAttributes:k.surveyVisitorAttributes}));if(!r)return null;const{name:u,type:y,props:s,childId:S}=r,d=a&&ot.has(y),b=s==null?void 0:s.displayLogic,v=b==null?void 0:e.someDisplayLogicOptionMatches({displayLogic:b,allResponses:o,cards:c,surveyVisitorAttributes:m??{}});if(b&&b.length>0&&!v)return null;const x={className:"ul-card",next:(k,O,R=!0)=>n(k,O&&R),questionId:u,type:y,showIndividualSubmit:a,...d?{next:(k,O)=>{t(k.questionId,k,O??!0)},onSubmitButtonClick:(k=!1)=>{S?k?(i(u),h({parentQuestionId:u})):i(S):i(u)}}:{}},T=(()=>{switch(y){case"consentlegal":return e.u(we,{...x,...s});case"likert":return e.u(qe,{...x,...s});case"matrix":return e.u(Fe,{...x,...s});case"maxdiff":return e.u(it,{...x,...s});case"multiplechoice":return e.u(Qe,{...x,...s});case"multipleselect":return e.u(Ee,{...x,...s});case"nps":return e.u(Oe,{...x,...s});case"open":case"aidynamicfollowup":return e.u(Ae,{...x,type:r.type,...s});case"rankorder":return e.u(st,{...x,...s});case"recordedtask":return e.u(Ge,{...x,...s});case"texturlprompt":return e.u(Ke,{...x,...s});case"thanks":return e.u(Xe,{...x,...s});case"uploading":return e.u(Je,{...x,...s});default:return null}})();return T?g?e.u("div",{className:"ul-card-scroll-wrapper",children:T},u):T:null},lt=({isSubmitDisabled:r=!1,onSubmit:i,buttonText:a})=>{var S;const{cards:n,forceBrandedLogo:t,index:o,marketingUrl:g,showSurveyBrand:h,slugName:c,surveyId:m,useMobileStyling:u}=e.useConfig(d=>({cards:d.cards,forceBrandedLogo:d.forceBrandedLogo,index:d.index,marketingUrl:d.marketingUrl,showSurveyBrand:d.showSurveyBrand,slugName:d.slugName,surveyId:d.surveyId,useMobileStyling:d.useMobileStyling})),y=((S=n[o])==null?void 0:S.type)==="thanks",s=e.buildMarketingUrl({marketingUrl:g,slugName:c,surveyId:m,forceBrandedLogo:t});return e.u("footer",{className:e.cc("long-form-question-footer-container",u&&"long-form-question-footer-container--mobile",y&&"long-form-question-footer-container-center"),children:[y&&t?e.u(e.ThankYouLink,{marketingUrlLink:s}):e.u("div",{className:"long-form-question-footer-container-logo",children:h?e.u(e.SprigBrandLogo,{forceBrandedLogo:t,marketingUrlLink:s}):null}),!y&&e.u("div",{className:e.cc("ul-card__button-wrapper","ul-card-vertical__button-wrapper","long-form-question-footer-container-actions"),children:e.u(p.Button,{className:e.cc("long-form-button",r&&"sprig-button-disabled"),disabled:r,onClick:i,children:e.u("span",{className:"long-form-button-text-container",children:a??e.u(e.Arrow,{stroke:"white"})})})})]})};exports.PageCard=({cards:r,next:i,previousResponses:a})=>{var V;const n=e._(null),[t,o]=e.h({}),[g,h]=e.h({}),{isLongFormSurvey:c,focusedQuestionId:m,setFocusedQuestionId:u,createDynamicQuestion:y,allResponses:s,cardIndexByName:S,surveyVisitorAttributes:d,cards:b}=e.useConfig(l=>({isLongFormSurvey:X.isLongFormSurvey(l.studyType),focusedQuestionId:l.focusedQuestionId,setFocusedQuestionId:l.setFocusedQuestionId,createDynamicQuestion:l.createDynamicQuestion,allResponses:l.allResponses,cardIndexByName:l.cardIndexByName,surveyVisitorAttributes:l.surveyVisitorAttributes,cards:l.cards})),v=e.F(()=>({...a,...e.buildReadableResponseMap(r.map(l=>{var C,L;return{...l,value:((C=t[l.name])==null?void 0:C.value)??null,secondaryValue:((L=t[l.name])==null?void 0:L.secondaryValue)??null}}))}),[a,t,r]);e.useSetAllResponsesRaw(v);const x=e.pipeReadableResponsesIntoCards(r,v),T=e.F(()=>e.buildResponsesArrayForDisplayLogic({storeAllResponses:s,cards:r,cardValues:t,cardIndexByName:S}),[s,r,t,S]),k=e.F(()=>{const l=new Set;return r.forEach(C=>{var E;const L=(E=C.props)==null?void 0:E.displayLogic;if(!L||L.length===0)return void l.add(C.name);e.someDisplayLogicOptionMatches({displayLogic:L,allResponses:T,cards:b,surveyVisitorAttributes:d??{}})&&l.add(C.name)}),l},[r,T,d,b]),O=e._(null);e.p(()=>{const l=k,C=O.current;if(C!==null)for(const L of C)l.has(L)||(o(E=>{const P={...E};return delete P[L],P}),h(E=>{const P={...E};return delete P[L],P}));O.current=new Set(l)},[k]);const R=e._(null),F=e._(!1),D=e._(null),f=e.T(l=>{var P,W;F.current=!0;const C=r.findIndex(G=>G.name===l);if(!c||l===null||C===-1)return void(F.current=!1);const L=(P=R.current)==null?void 0:P.querySelectorAll(".ul-card-scroll-wrapper")[C],E=(W=R.current)==null?void 0:W.closest(".ul-card-main-content");if(L&&E){if(L&&E){const G=L.getBoundingClientRect(),te=E.getBoundingClientRect(),re=G.top-te.top+E.scrollTop,ie=re+G.height/2,I=window.innerHeight-157;let A;G.height>=I?A=re:A=ie-E.clientHeight/2;const $=E.clientHeight,M=E.scrollHeight-$,j=Math.max(0,Math.min(A,M));E.scrollTo({top:j,behavior:"smooth"}),setTimeout(()=>{F.current=!1},500)}}else F.current=!1},[c,r]);e.p(()=>{m!==null&&r.findIndex(l=>l.name===m)!==-1||u(r[0].name)},[r,m,u]);const w=({displayCard:l,response:C})=>{if(l&&((l==null?void 0:l.childId)??0)>0){const L=e.buildReadableResponseMap([l].map(E=>({...E,value:(C==null?void 0:C.value)??null,secondaryValue:(C==null?void 0:C.secondaryValue)??null})));y({parentQuestionId:l==null?void 0:l.name,parentResponseConfig:L})}};function Q(l,C){return l.filter(L=>k.has(L.name)).map(L=>{const E=C[L.name],P=x.find(W=>W.name===L.name);return{...E,questionText:P?e.getProcessedQuestionText(P):void 0}})}const _=l=>{if(!c)return;let C=r.findIndex(L=>L.name===l)+1;for(;C<r.length&&!k.has(r[C].name);)C++;C<r.length?u(r[C].name):u(l)};e.p(()=>{c&&m!==null&&(D.current!==m?f(m):D.current=null)},[m,c,f]);const B=e.T(()=>{var te,re;if(F.current)return;const l=(te=R.current)==null?void 0:te.closest(".ul-card-main-content");if(!l)return;const C=(re=R.current)==null?void 0:re.querySelectorAll(".ul-card-scroll-wrapper");if(!C||C.length===0)return;const L=l.getBoundingClientRect(),E=L.top+L.height/2;let P=0,W=1/0;C.forEach((ie,I)=>{const A=ie.getBoundingClientRect(),$=A.top+A.height/2,M=Math.abs(E-$);M<W&&(W=M,P=I)});const G=r[P];D.current=G.name,u(G.name)},[r,u]);e.p(()=>{var C;if(!c)return;const l=((C=R.current)==null?void 0:C.closest(".ul-card__container"))||null;return l&&l.addEventListener("scroll",B,{passive:!0}),()=>{l&&l.removeEventListener("scroll",B)}},[B,c]);const H=e.F(()=>r.every(l=>{var C;return!k.has(l.name)||!(!(l!=null&&l.props)||!("properties"in l.props)||((C=l.props.properties)==null?void 0:C.required)!==!1)||g[l.name]}),[g,r,k]),K=async(l,C,L)=>{return h(P=>({...P,[l]:L})),await(E=P=>({...P,[l]:C}),new Promise(P=>{o(W=>{const G=E(W);return P(G),G})}));var E};e.p(()=>{var E;if(!c)return;const l=n.current,C=(E=r==null?void 0:r[0])==null?void 0:E.groupId;n.current=C;const L={};if(r.forEach(P=>{var W,G;p.appCardHasPropertiesWithRequired(P)&&(P.props.properties.required||(L[P.name]={value:((W=t[P.name])==null?void 0:W.value)??null,secondaryValue:((G=t[P.name])==null?void 0:G.secondaryValue)??null,questionId:P.name,type:P.type}))}),l==null||l!==C)o(L),h({});else{o(W=>({...W,...L}));const P=r.reduce((W,G)=>{var te;return G.type==="aidynamicfollowup"&&((te=G.props)==null?void 0:te.loading)===null&&(W[G.name]=!0),W},{});h(W=>({...W,...P}))}},[r,c]);const N=async(l,C)=>{if(c){const L=await K(l.questionId,l,C),E=q(l.type),P=U(l.type);if(E&&_(l.questionId),P&&C){const W=Q(r,L);i(W)}}else{const L=x.find(P=>P.name===l.questionId),E={...l,questionText:L?e.getProcessedQuestionText(L):void 0};w({displayCard:L,response:l}),i([E])}},q=l=>new Set(["nps","likert","multiplechoice"]).has(l),U=l=>new Set(["videovoice","consentlegal","texturlprompt","maxdiff"]).has(l),Z=((V=r[0])==null?void 0:V.type)==="thanks";return c?e.u("div",{className:"ul-card-list-container--longform","data-testid":"ui-container",ref:R,children:[e.u(et,{value:a,children:x.map((l,C)=>e.u(ve,{allResponsesArray:T,cardInstance:l,moveToNextQuestion:_,showIndividualSubmit:c&&r.length>1&&C<r.length-1,submitQuestion:N,updateCardValues:K},(l==null?void 0:l.name)||C))}),!Z&&e.u(lt,{isSubmitDisabled:!H,onSubmit:function(){const l=Q(r,t);if((x==null?void 0:x.length)===1&&(l==null?void 0:l.length)===1){const C=x[0],L=l[0];w({displayCard:C,response:L})}i(l)}})]}):e.u(e.g,{children:[e.u("div",{"data-testid":"ui-container",style:{display:"none"}}),x.map((l,C)=>e.u(ve,{allResponsesArray:T,cardInstance:l,moveToNextQuestion:_,showIndividualSubmit:c&&r.length>1&&C<r.length-1,submitQuestion:N,updateCardValues:K},(l==null?void 0:l.name)||C))]})};
|