@sprig-technologies/sprig-bundled 2.40.0 → 2.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-styles-BiL7hMhj.js +4 -0
- package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
- package/dist/conversational-ui-COaQs_Nu.cjs +658 -0
- package/dist/conversational-ui-D-i49ps3.js +1477 -0
- package/dist/getAttributedUrl-B0b2NdfZ.js +188 -0
- package/dist/getAttributedUrl-B2AD3-f7.cjs +12 -0
- package/dist/{index-gY11yXiE.js → index-BZjOqtTO.js} +388 -394
- package/dist/index-BlwcV11_.js +658 -0
- package/dist/index-C3Nj6aLe.cjs +1 -0
- package/dist/{index-C4jT0KTM.cjs → index-D7xIZ9_C.cjs} +21 -21
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3 -3
- package/dist/view-CRNTl40s.cjs +1 -0
- package/dist/view-JArMqSNr.js +1494 -0
- package/package.json +1 -1
- package/dist/conversational-styles-CWNea3pP.js +0 -4
- package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
- package/dist/conversational-ui-B4Gz-ntg.cjs +0 -658
- package/dist/conversational-ui-B_gqybcU.js +0 -1508
- package/dist/getAttributedUrl-BQOt-2c9.js +0 -192
- package/dist/getAttributedUrl-SO6zrj5v.cjs +0 -12
- package/dist/index-B7XdLO9n.cjs +0 -1
- package/dist/index-rqy70x2s.js +0 -670
- package/dist/view-BjWfEnbU.js +0 -1482
- package/dist/view-D-Rk2_yd.cjs +0 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { a as s, c as y, u as C, F as W, h as U, p as O, _ as P, e as H, r as X, g as $, y as Z, s as Q } from "./view-JArMqSNr.js";
|
|
2
|
+
import { j as G, k as J, l as Y, m as ee, E as M } from "./index-BZjOqtTO.js";
|
|
3
|
+
const te = (e) => s("button", { ...e, className: y("ul-card-text__button", e.className), id: "ul-card-text__button" }), oe = ({ html: e, ...i }) => {
|
|
4
|
+
const { enableCspTrustedTypes: r } = C((o) => ({ enableCspTrustedTypes: o.enableCspTrustedTypes })), t = W(() => G(e, r), [r, e]);
|
|
5
|
+
return s("div", { ...i, dangerouslySetInnerHTML: { __html: t } });
|
|
6
|
+
}, R = () => {
|
|
7
|
+
const { viewDocument: e } = C((t) => ({ viewDocument: t.viewDocument })), [i, r] = U(!1);
|
|
8
|
+
return O(() => {
|
|
9
|
+
const t = e.querySelector(".sprig-question-body"), o = new ResizeObserver(() => {
|
|
10
|
+
window.requestAnimationFrame(() => {
|
|
11
|
+
r(!!(t && J(t) && t.scrollHeight > t.offsetHeight));
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return t && o.observe(t), () => {
|
|
15
|
+
t && o.disconnect();
|
|
16
|
+
};
|
|
17
|
+
}, [e]), i;
|
|
18
|
+
}, q = ({ plainText: e, richText: i, id: r, className: t, isHeader: o, showAsterisk: l }) => i ? s(oe, { className: t, html: i, id: r }) : e ? o ? s("h1", { className: t, id: r, children: [e, l && "*"] }) : s("p", { className: t, id: r, children: e }) : null, me = ({ message: e, properties: i, isRequired: r }) => {
|
|
19
|
+
const t = P(null), o = i == null ? void 0 : i.captionText, l = R();
|
|
20
|
+
return s("div", { className: y("question-header-container", "sprig-header-container", l ? "sprig-border-bottom" : null), ref: t, children: [s("div", { className: "question-header-button-container", children: s(q, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: i == null ? void 0 : i.questionHtml, showAsterisk: r }) }), s(q, { className: "ul-caption", id: "ul-caption", plainText: o, richText: i == null ? void 0 : i.captionHtml })] });
|
|
21
|
+
}, ie = () => 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: i }) => s("div", { className: "ul-card-longform__submit-button-container", children: s(te, { className: "ul-card-longform__submit-button", disabled: e, onClick: i, children: ["OK ", s(ie, {})] }) }), ne = (e, i) => {
|
|
22
|
+
const r = P(0);
|
|
23
|
+
return () => {
|
|
24
|
+
if (e.current) {
|
|
25
|
+
const t = e.current;
|
|
26
|
+
t.style.height = "1px";
|
|
27
|
+
const o = t.scrollHeight + (t.offsetHeight - t.clientHeight), l = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), a = o <= l ? o : l;
|
|
28
|
+
r.current !== a && requestAnimationFrame(() => {
|
|
29
|
+
i();
|
|
30
|
+
}), r.current = a, t.style.height = `${a}px`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, F = ({ buttonText: e = "View Prototype", handleClick: i }) => s("button", { className: "prototype-button", onClick: i, children: e }, "prototype-btn"), ve = ({ embeddedType: e = "prototype", properties: i, children: r }) => {
|
|
34
|
+
var T;
|
|
35
|
+
const { handleClickEmbedButton: t, hasViewedEmbed: o, headers: l, useDesktopPrototype: a } = C((d) => ({ handleClickEmbedButton: d.handleClickEmbedButton, hasViewedEmbed: d.hasViewedEmbed, headers: d.headers, useDesktopPrototype: d.useDesktopPrototype })), n = (i == null ? void 0 : i.conceptUrl) || ((T = i == null ? void 0 : i.consentDocument) == null ? void 0 : T.url), h = window.innerWidth < ee, p = l["userleap-platform"], u = (d, k) => {
|
|
36
|
+
d.preventDefault(), t(k);
|
|
37
|
+
};
|
|
38
|
+
if ((() => {
|
|
39
|
+
const { update: d, index: k, isConversationalUI: v, viewDocument: c } = C(({ update: b, index: m, isConversationalUI: x, viewDocument: f }) => ({ update: b, index: m, isConversationalUI: x, viewDocument: f })), g = Y(d, 100);
|
|
40
|
+
O(() => {
|
|
41
|
+
if (v) return;
|
|
42
|
+
const b = new ResizeObserver(g), m = c.querySelector(".ul-card__container");
|
|
43
|
+
return m && b.observe(m, { box: "border-box" }), () => {
|
|
44
|
+
b.disconnect();
|
|
45
|
+
};
|
|
46
|
+
}, [g, d, k, v, c]);
|
|
47
|
+
})(), !a && h && !o && n && ["email", "link"].includes(p)) {
|
|
48
|
+
if (e === "prototype") return s(F, { handleClick: (d) => {
|
|
49
|
+
u(d, "question.prototype.click");
|
|
50
|
+
} });
|
|
51
|
+
if (e === "pdf") return s(F, { buttonText: (i == null ? void 0 : i.viewDocumentText) || "View Document", handleClick: (d) => {
|
|
52
|
+
u(d, "question.agreement.click");
|
|
53
|
+
} });
|
|
54
|
+
}
|
|
55
|
+
return s(H, { children: r });
|
|
56
|
+
}, B = ({ isSelected: e, id: i, divId: r, themeColor: t, disabled: o = !1 }) => s("div", { "aria-checked": e, "aria-disabled": o, "aria-labelledby": `label-${i}`, className: "select-checkbox", id: r, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...o ? { opacity: 0.5 } : {} }, tabIndex: o ? -1 : 0, children: e && s(X, {}) }), xe = ({ ariaLabel: e, border: i, choiceStyle: r = {}, label: t, isSelected: o, value: l, text: a, id: n, isRadio: h, useMobileStyling: p, error: u, allowTextEntry: T, noneOfTheAbove: d, promptText: k, disabled: v = !1, onUserInputChanged: c }) => {
|
|
57
|
+
const { styleNonce: g, viewDocument: b } = C((w) => ({ styleNonce: w.styleNonce, viewDocument: w.viewDocument })), [m, x] = U(!1);
|
|
58
|
+
re(b, i, g);
|
|
59
|
+
const f = ({ isSelected: w, userText: E }) => {
|
|
60
|
+
c && c({ id: n, selected: w, value: l, userText: E, noneOfTheAbove: d });
|
|
61
|
+
}, _ = (w) => {
|
|
62
|
+
v || (w.stopPropagation(), f({ isSelected: h || !o, userText: a }), x(!1));
|
|
63
|
+
}, j = () => {
|
|
64
|
+
m || x(!0);
|
|
65
|
+
}, D = () => {
|
|
66
|
+
m && x(!1);
|
|
67
|
+
}, N = { onClick: (w) => _(w), onKeyPress: (w) => ((E) => {
|
|
68
|
+
v || E.key !== "Enter" && E.key !== " " || _(E);
|
|
69
|
+
})(w) };
|
|
70
|
+
"ontouchstart" in b.documentElement ? (N.onTouchStart = D, N.onTouchCancel = D, N.onTouchEnd = D) : (N.onMouseDown = j, N.onMouseLeave = D);
|
|
71
|
+
const S = h ? `radio-${n}` : `checkbox-${n}`, L = o || m ? [I] : [], z = [...u ? [V] : [], ...L, ...v ? ["ul-choice-disabled"] : []], K = t ? { "aria-labelledby": `label-${n}` } : { "aria-label": e };
|
|
72
|
+
return s("div", { className: y($("choice", p), ...z), id: `choice-div-${n}`, style: { ...r, ...u ? { borderColor: M } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : N, "aria-disabled": v, children: [s("div", { className: y("choice-label-container"), children: [h ? s("div", { ...K, className: y("select-radio", ...L), id: S, role: "radio", tabIndex: 0 }) : s(B, { disabled: v, divId: S, id: n, isSelected: o, themeColor: i }), t && s("label", { className: y($("select-label", p)), htmlFor: S, id: `label-${n}`, children: t })] }), T && o && s("div", { className: y("choice-text-entry-container", ...L), children: s(se, { onTextChange: (w) => f({ isSelected: o, userText: w }), promptText: k || "Please specify", textValue: a, useMobileStyling: p }) })] });
|
|
73
|
+
}, se = ({ promptText: e, textValue: i, onTextChange: r, useMobileStyling: t }) => {
|
|
74
|
+
const o = P(null), { update: l } = C((n) => ({ update: n.update })), a = ne(o, () => l());
|
|
75
|
+
return O(() => (a(), o.current && o.current.focus(), () => {
|
|
76
|
+
l();
|
|
77
|
+
}), []), s("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: y($("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (n) => {
|
|
78
|
+
a(), n.stopPropagation(), r(n.currentTarget.value);
|
|
79
|
+
}, onClick: (n) => {
|
|
80
|
+
n.stopPropagation();
|
|
81
|
+
}, onKeyPress: (n) => {
|
|
82
|
+
n.stopPropagation();
|
|
83
|
+
}, placeholder: e, ref: o, role: "textbox", rows: 1, value: i });
|
|
84
|
+
}, A = "ul-select-style-element", I = "ul-select-active-dynamic-style", V = "ul-select-error-dynamic-style", re = (e, i, r) => {
|
|
85
|
+
let t = e.getElementById(A), o = !1;
|
|
86
|
+
t || (t = e.createElement("style"), o = !0), t.tagName.toLowerCase() === "style" && (t.id = A, r && (t.nonce = r), t.textContent = ae(i), o && e.head.appendChild(t));
|
|
87
|
+
}, ae = (e) => `
|
|
88
|
+
.${I} {
|
|
89
|
+
border-color: ${e};
|
|
90
|
+
}
|
|
91
|
+
.${I} .select-radio, .${I}.select-radio {
|
|
92
|
+
border: 6px solid ${e};
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
}
|
|
95
|
+
.${V} {
|
|
96
|
+
border-color: ${M};
|
|
97
|
+
}
|
|
98
|
+
`, we = ({ children: e }) => s("div", { className: "sprig-question-body", children: e }), ge = ({ children: e }) => {
|
|
99
|
+
const i = R(), { isConversationalUI: r } = C((t) => ({ isConversationalUI: t.isConversationalUI }));
|
|
100
|
+
return s("div", { className: y("sprig-question-footer-container", i && !r ? "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
|
+
const de = ({ options: e, selectItem: i, selectedOptions: r, showCheckbox: t, disabledOptions: o, dropdownFooter: l }) => {
|
|
104
|
+
const { themeColor: a } = C((n) => ({ doc: n.viewDocument, themeColor: n.border }));
|
|
105
|
+
return s("div", { className: "select-list", children: [e.map((n) => {
|
|
106
|
+
return s("div", { "aria-disabled": o == null ? void 0 : o.includes(n), className: y("select-option", o != null && o.includes(n) ? "ul-choice-disabled" : ""), onClick: (p) => {
|
|
107
|
+
o != null && o.includes(n) || (i(n), p.stopPropagation());
|
|
108
|
+
}, role: "option", style: { ...o != null && o.includes(n) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && s(B, { divId: (h = n.id, `checkbox-div-${h}`), id: n.id, isSelected: r.includes(n), themeColor: a }), n.label] }, n.id);
|
|
109
|
+
var h;
|
|
110
|
+
}), l] });
|
|
111
|
+
}, ye = ({ isMultiSelect: e = !1, multiselectText: i = "choices selected", onChange: r, options: t, placeholderText: o, value: l, disabledOptions: a = [], dropdownFooter: n }) => {
|
|
112
|
+
const [h, p] = U(!1), { viewDocument: u, update: T, isConversationalUI: d } = C((c) => ({ viewDocument: c.viewDocument, update: c.update, isConversationalUI: c.isConversationalUI })), k = () => {
|
|
113
|
+
p(!h);
|
|
114
|
+
};
|
|
115
|
+
Z(() => {
|
|
116
|
+
d || T();
|
|
117
|
+
}, [h, d, T]), O(() => {
|
|
118
|
+
var g;
|
|
119
|
+
const c = (b) => {
|
|
120
|
+
const m = b.target;
|
|
121
|
+
(m == null ? void 0 : m.closest(".select-option.ul-choice-disabled")) || p(!1);
|
|
122
|
+
};
|
|
123
|
+
u.addEventListener("click", c);
|
|
124
|
+
try {
|
|
125
|
+
(g = window.parent) == null || g.addEventListener("click", c);
|
|
126
|
+
} catch {
|
|
127
|
+
window.addEventListener("click", c);
|
|
128
|
+
}
|
|
129
|
+
return () => {
|
|
130
|
+
var b;
|
|
131
|
+
u.removeEventListener("click", c);
|
|
132
|
+
try {
|
|
133
|
+
(b = window.parent) == null || b.removeEventListener("click", c);
|
|
134
|
+
} catch {
|
|
135
|
+
window.removeEventListener("click", c);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}, [u]);
|
|
139
|
+
const v = l.length === 0 ? ["select-button-placeholder"] : [];
|
|
140
|
+
return s(H, { children: [s("button", { "aria-label": "choice dropdown button", className: y("select-button", ...v), onClick: (c) => {
|
|
141
|
+
c.stopPropagation(), k();
|
|
142
|
+
}, type: "button", children: [s("span", { children: l.length === 0 ? o : l.length === 1 ? l[0].label : `${l.length} ${i}` }), s(Q, {})] }), h && s(de, { disabledOptions: a, dropdownFooter: n, options: t, selectedOptions: l, selectItem: (c) => {
|
|
143
|
+
var m;
|
|
144
|
+
const g = l.some((x) => x.id === c.id), b = l.some((x) => {
|
|
145
|
+
var f;
|
|
146
|
+
return (f = x.optionProperties) == null ? void 0 : f.noneOfTheAbove;
|
|
147
|
+
});
|
|
148
|
+
(m = c.optionProperties) != null && m.noneOfTheAbove && !g ? r([c]) : e ? r(g ? l.filter((x) => x.id !== c.id) : b ? [c] : [...l, c]) : g || r([c]), e || k();
|
|
149
|
+
}, showCheckbox: e })] });
|
|
150
|
+
}, ue = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, Te = (e = void 0, i = {}) => {
|
|
151
|
+
if (!e) return e;
|
|
152
|
+
const r = ["http:", "https:", "itms-apps:", "market:"], t = ((a) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(a) ? a : `http://${a}`)(e);
|
|
153
|
+
if (!t) return;
|
|
154
|
+
try {
|
|
155
|
+
const a = new URL(t);
|
|
156
|
+
if (!a.protocol || !r.includes(a.protocol)) return;
|
|
157
|
+
} catch {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const o = [], l = ((a, n, h) => {
|
|
161
|
+
let p = a;
|
|
162
|
+
for (const [u, T] of Object.entries(ue)) if (p.toLowerCase().includes(u)) if (n[T]) {
|
|
163
|
+
const d = new RegExp(u, "gi");
|
|
164
|
+
p = p.replace(d, n[T]);
|
|
165
|
+
} else h.push(u);
|
|
166
|
+
return p;
|
|
167
|
+
})(t, i, o);
|
|
168
|
+
return o.length === 0 ? l : ((a, n) => {
|
|
169
|
+
if (!a.includes("?")) return a;
|
|
170
|
+
const h = a.slice(0, a.indexOf("?")), p = a.slice(a.indexOf("?") + 1).split("&").map((u) => u.split("=")).filter((u) => !n.includes(u[1]));
|
|
171
|
+
return p.length === 0 ? h : `${h}?${p.map((u) => u.join("=")).join("&")}`;
|
|
172
|
+
})(l, o);
|
|
173
|
+
};
|
|
174
|
+
export {
|
|
175
|
+
te as B,
|
|
176
|
+
oe as H,
|
|
177
|
+
be as L,
|
|
178
|
+
ve as M,
|
|
179
|
+
xe as O,
|
|
180
|
+
le as P,
|
|
181
|
+
ge as Q,
|
|
182
|
+
ye as S,
|
|
183
|
+
we as a,
|
|
184
|
+
ce as b,
|
|
185
|
+
me as c,
|
|
186
|
+
Te as g,
|
|
187
|
+
ne as u
|
|
188
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const e=require("./view-CRNTl40s.cjs"),k=require("./index-D7xIZ9_C.cjs"),_=t=>e.u("button",{...t,className:e.cc("ul-card-text__button",t.className),id:"ul-card-text__button"}),q=({html:t,...i})=>{const{enableCspTrustedTypes:r}=e.useConfig(n=>({enableCspTrustedTypes:n.enableCspTrustedTypes})),o=e.F(()=>k.getHtml(t,r),[r,t]);return e.u("div",{...i,dangerouslySetInnerHTML:{__html:o}})},L=()=>{const{viewDocument:t}=e.useConfig(o=>({viewDocument:o.viewDocument})),[i,r]=e.h(!1);return e.p(()=>{const o=t.querySelector(".sprig-question-body"),n=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{r(!!(o&&k.isHTMLElement(o)&&o.scrollHeight>o.offsetHeight))})});return o&&n.observe(o),()=>{o&&n.disconnect()}},[t]),i},R=({plainText:t,richText:i,id:r,className:o,isHeader:n,showAsterisk:c})=>i?e.u(q,{className:o,html:i,id:r}):t?n?e.u("h1",{className:o,id:r,children:[t,c&&"*"]}):e.u("p",{className:o,id:r,children:t}):null,j=()=>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"})}),M=(t,i)=>{const r=e._(0);return()=>{if(t.current){const o=t.current;o.style.height="1px";const n=o.scrollHeight+(o.offsetHeight-o.clientHeight),c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),s=n<=c?n:c;r.current!==s&&requestAnimationFrame(()=>{i()}),r.current=s,o.style.height=`${s}px`}}},U=({buttonText:t="View Prototype",handleClick:i})=>e.u("button",{className:"prototype-button",onClick:i,children:t},"prototype-btn"),P=({isSelected:t,id:i,divId:r,themeColor:o,disabled:n=!1})=>e.u("div",{"aria-checked":t,"aria-disabled":n,"aria-labelledby":`label-${i}`,className:"select-checkbox",id:r,role:"checkbox",style:{...t?{backgroundColor:o,borderColor:o,boxShadow:"none"}:{},...n?{opacity:.5}:{}},tabIndex:n?-1:0,children:t&&e.u(e.SvgCheckmark,{})}),W=({promptText:t,textValue:i,onTextChange:r,useMobileStyling:o})=>{const n=e._(null),{update:c}=e.useConfig(l=>({update:l.update})),s=M(n,()=>c());return e.p(()=>(s(),n.current&&n.current.focus(),()=>{c()}),[]),e.u("textarea",{"aria-label":t,"aria-multiline":"true","aria-placeholder":t,className:e.cc(e.getClasses("choice-text-input",o)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:l=>{s(),l.stopPropagation(),r(l.currentTarget.value)},onClick:l=>{l.stopPropagation()},onKeyPress:l=>{l.stopPropagation()},placeholder:t,ref:n,role:"textbox",rows:1,value:i})},$="ul-select-style-element",O="ul-select-active-dynamic-style",A="ul-select-error-dynamic-style",K=(t,i,r)=>{let o=t.getElementById($),n=!1;o||(o=t.createElement("style"),n=!0),o.tagName.toLowerCase()==="style"&&(o.id=$,r&&(o.nonce=r),o.textContent=X(i),n&&t.head.appendChild(o))},X=t=>`
|
|
2
|
+
.${O} {
|
|
3
|
+
border-color: ${t};
|
|
4
|
+
}
|
|
5
|
+
.${O} .select-radio, .${O}.select-radio {
|
|
6
|
+
border: 6px solid ${t};
|
|
7
|
+
box-shadow: none;
|
|
8
|
+
}
|
|
9
|
+
.${A} {
|
|
10
|
+
border-color: ${k.ERROR_BORDER_COLOR};
|
|
11
|
+
}
|
|
12
|
+
`;var B=(t=>(t.CONTINUE="CONTINUE",t.EXTERNAL="EXTERNAL",t.NO_BUTTON="NO_BUTTON",t))(B||{}),H=(t=>(t.Unlimited="Unlimited",t.Maximum="Maximum",t.Range="Range",t))(H||{});const Q=({options:t,selectItem:i,selectedOptions:r,showCheckbox:o,disabledOptions:n,dropdownFooter:c})=>{const{themeColor:s}=e.useConfig(l=>({doc:l.viewDocument,themeColor:l.border}));return e.u("div",{className:"select-list",children:[t.map(l=>{return e.u("div",{"aria-disabled":n==null?void 0:n.includes(l),className:e.cc("select-option",n!=null&&n.includes(l)?"ul-choice-disabled":""),onClick:p=>{n!=null&&n.includes(l)||(i(l),p.stopPropagation())},role:"option",style:{...n!=null&&n.includes(l)?{opacity:.5,cursor:"not-allowed"}:{}},children:[o&&e.u(P,{divId:(h=l.id,`checkbox-div-${h}`),id:l.id,isSelected:r.includes(l),themeColor:s}),l.label]},l.id);var h}),c]})},Z={"{{user_id}}":"externalUserId","{{email}}":"email"};exports.Button=_,exports.Header=({message:t,properties:i,isRequired:r})=>{const o=e._(null),n=i==null?void 0:i.captionText,c=L();return e.u("div",{className:e.cc("question-header-container","sprig-header-container",c?"sprig-border-bottom":null),ref:o,children:[e.u("div",{className:"question-header-button-container",children:e.u(R,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:t,richText:i==null?void 0:i.questionHtml,showAsterisk:r})}),e.u(R,{className:"ul-caption",id:"ul-caption",plainText:n,richText:i==null?void 0:i.captionHtml})]})},exports.Html=q,exports.LongformSubmitButton=({isSubmitDisabled:t,handleSubmit:i})=>e.u("div",{className:"ul-card-longform__submit-button-container",children:e.u(_,{className:"ul-card-longform__submit-button",disabled:t,onClick:i,children:["OK ",e.u(j,{})]})}),exports.MaxSelectModes=H,exports.MobileEmbedView=({embeddedType:t="prototype",properties:i,children:r})=>{var w;const{handleClickEmbedButton:o,hasViewedEmbed:n,headers:c,useDesktopPrototype:s}=e.useConfig(d=>({handleClickEmbedButton:d.handleClickEmbedButton,hasViewedEmbed:d.hasViewedEmbed,headers:d.headers,useDesktopPrototype:d.useDesktopPrototype})),l=(i==null?void 0:i.conceptUrl)||((w=i==null?void 0:i.consentDocument)==null?void 0:w.url),h=window.innerWidth<k.EMBED_MOBILE_MAX_WIDTH,p=c["userleap-platform"],u=(d,y)=>{d.preventDefault(),o(y)};if((()=>{const{update:d,index:y,isConversationalUI:g,viewDocument:a}=e.useConfig(({update:b,index:m,isConversationalUI:v,viewDocument:f})=>({update:b,index:m,isConversationalUI:v,viewDocument:f})),x=k.debounce(d,100);e.p(()=>{if(g)return;const b=new ResizeObserver(x),m=a.querySelector(".ul-card__container");return m&&b.observe(m,{box:"border-box"}),()=>{b.disconnect()}},[x,d,y,g,a])})(),!s&&h&&!n&&l&&["email","link"].includes(p)){if(t==="prototype")return e.u(U,{handleClick:d=>{u(d,"question.prototype.click")}});if(t==="pdf")return e.u(U,{buttonText:(i==null?void 0:i.viewDocumentText)||"View Document",handleClick:d=>{u(d,"question.agreement.click")}})}return e.u(e.g,{children:r})},exports.Option=({ariaLabel:t,border:i,choiceStyle:r={},label:o,isSelected:n,value:c,text:s,id:l,isRadio:h,useMobileStyling:p,error:u,allowTextEntry:w,noneOfTheAbove:d,promptText:y,disabled:g=!1,onUserInputChanged:a})=>{const{styleNonce:x,viewDocument:b}=e.useConfig(C=>({styleNonce:C.styleNonce,viewDocument:C.viewDocument})),[m,v]=e.h(!1);K(b,i,x);const f=({isSelected:C,userText:N})=>{a&&a({id:l,selected:C,value:c,userText:N,noneOfTheAbove:d})},I=C=>{g||(C.stopPropagation(),f({isSelected:h||!n,userText:s}),v(!1))},F=()=>{m||v(!0)},E=()=>{m&&v(!1)},T={onClick:C=>I(C),onKeyPress:C=>(N=>{g||N.key!=="Enter"&&N.key!==" "||I(N)})(C)};"ontouchstart"in b.documentElement?(T.onTouchStart=E,T.onTouchCancel=E,T.onTouchEnd=E):(T.onMouseDown=F,T.onMouseLeave=E);const D=h?`radio-${l}`:`checkbox-${l}`,S=n||m?[O]:[],V=[...u?[A]:[],...S,...g?["ul-choice-disabled"]:[]],z=o?{"aria-labelledby":`label-${l}`}:{"aria-label":t};return e.u("div",{className:e.cc(e.getClasses("choice",p),...V),id:`choice-div-${l}`,style:{...r,...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:[h?e.u("div",{...z,className:e.cc("select-radio",...S),id:D,role:"radio",tabIndex:0}):e.u(P,{disabled:g,divId:D,id:l,isSelected:n,themeColor:i}),o&&e.u("label",{className:e.cc(e.getClasses("select-label",p)),htmlFor:D,id:`label-${l}`,children:o})]}),w&&n&&e.u("div",{className:e.cc("choice-text-entry-container",...S),children:e.u(W,{onTextChange:C=>f({isSelected:n,userText:C}),promptText:y||"Please specify",textValue:s,useMobileStyling:p})})]})},exports.PromptActionTypeEnum=B,exports.QuestionBodyFooterContainer=({children:t})=>{const i=L(),{isConversationalUI:r}=e.useConfig(o=>({isConversationalUI:o.isConversationalUI}));return e.u("div",{className:e.cc("sprig-question-footer-container",i&&!r?"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:i="choices selected",onChange:r,options:o,placeholderText:n,value:c,disabledOptions:s=[],dropdownFooter:l})=>{const[h,p]=e.h(!1),{viewDocument:u,update:w,isConversationalUI:d}=e.useConfig(a=>({viewDocument:a.viewDocument,update:a.update,isConversationalUI:a.isConversationalUI})),y=()=>{p(!h)};e.y(()=>{d||w()},[h,d,w]),e.p(()=>{var x;const a=b=>{const m=b.target;(m==null?void 0:m.closest(".select-option.ul-choice-disabled"))||p(!1)};u.addEventListener("click",a);try{(x=window.parent)==null||x.addEventListener("click",a)}catch{window.addEventListener("click",a)}return()=>{var b;u.removeEventListener("click",a);try{(b=window.parent)==null||b.removeEventListener("click",a)}catch{window.removeEventListener("click",a)}}},[u]);const g=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",...g),onClick:a=>{a.stopPropagation(),y()},type:"button",children:[e.u("span",{children:c.length===0?n:c.length===1?c[0].label:`${c.length} ${i}`}),e.u(e.SvgCaret,{})]}),h&&e.u(Q,{disabledOptions:s,dropdownFooter:l,options:o,selectedOptions:c,selectItem:a=>{var m;const x=c.some(v=>v.id===a.id),b=c.some(v=>{var f;return(f=v.optionProperties)==null?void 0:f.noneOfTheAbove});(m=a.optionProperties)!=null&&m.noneOfTheAbove&&!x?r([a]):t?r(x?c.filter(v=>v.id!==a.id):b?[a]:[...c,a]):x||r([a]),t||y()},showCheckbox:t})]})},exports.getAttributedUrl=(t=void 0,i={})=>{if(!t)return t;const r=["http:","https:","itms-apps:","market:"],o=(s=>/^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(s)?s:`http://${s}`)(t);if(!o)return;try{const s=new URL(o);if(!s.protocol||!r.includes(s.protocol))return}catch{return}const n=[],c=((s,l,h)=>{let p=s;for(const[u,w]of Object.entries(Z))if(p.toLowerCase().includes(u))if(l[w]){const d=new RegExp(u,"gi");p=p.replace(d,l[w])}else h.push(u);return p})(o,i,n);return n.length===0?c:((s,l)=>{if(!s.includes("?"))return s;const h=s.slice(0,s.indexOf("?")),p=s.slice(s.indexOf("?")+1).split("&").map(u=>u.split("=")).filter(u=>!l.includes(u[1]));return p.length===0?h:`${h}?${p.map(u=>u.join("=")).join("&")}`})(c,n)},exports.useAutoSize=M;
|