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