UNPKG

@sprig-technologies/sprig-bundled

Version:

npm package for the sprig web sdk with bundled dependencies

1,072 lines 157 kB
import { e as _e, A as pe, s as Ee, D as _r, c as br, S as G, a as Ve, C as ht, b as ft, d as vr, i as yr, E as xr, f as be, g as K, h as Xe, j as kr, r as wr, v as gt, k as _t } from "./index-BnOajwL7.js"; var ke, M, rn, ae, bt, on, $e, sn, xe = {}, an = [], Cr = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, qe = Array.isArray; function ee(e, t) { for (var n in t) e[n] = t[n]; return e; } function ln(e) { var t = e.parentNode; t && t.removeChild(e); } function Z(e, t, n) { var r, o, i, s = {}; for (i in t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : s[i] = t[i]; if (arguments.length > 2 && (s.children = arguments.length > 3 ? ke.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (i in e.defaultProps) s[i] === void 0 && (s[i] = e.defaultProps[i]); return ve(e, s, r, o, null); } function ve(e, t, n, r, o) { var i = { type: e, props: t, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++rn, __i: -1, __u: 0 }; return o == null && M.vnode != null && M.vnode(i), i; } function cn() { return { current: null }; } function B(e) { return e.children; } function Y(e, t) { this.props = e, this.context = t; } function me(e, t) { if (t == null) return e.__ ? me(e.__, e.__i + 1) : null; for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e; return typeof e.type == "function" ? me(e) : null; } function un(e) { var t, n; if ((e = e.__) != null && e.__c != null) { for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) { e.__e = e.__c.base = n.__e; break; } return un(e); } } function ze(e) { (!e.__d && (e.__d = !0) && ae.push(e) && !Le.__r++ || bt !== M.debounceRendering) && ((bt = M.debounceRendering) || on)(Le); } function Le() { var e, t, n, r, o, i, s, l, c; for (ae.sort($e); e = ae.shift(); ) e.__d && (t = ae.length, r = void 0, i = (o = (n = e).__v).__e, l = [], c = [], (s = n.__P) && ((r = ee({}, o)).__v = o.__v + 1, M.vnode && M.vnode(r), et(s, r, o, n.__n, s.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? me(o), !!(32 & o.__u), c), r.__.__k[r.__i] = r, mn(l, r, c), r.__e != i && un(r)), ae.length > t && ae.sort($e)); Le.__r = 0; } function dn(e, t, n, r, o, i, s, l, c, p, m) { var u, d, h, g, x, y = r && r.__k || an, k = t.length; for (n.__d = c, function(b, S, E) { var f, v, _, N, I, P = S.length, C = E.length, w = C, L = 0; for (b.__k = [], f = 0; f < P; f++) (v = b.__k[f] = (v = S[f]) == null || typeof v == "boolean" || typeof v == "function" ? null : typeof v == "string" || typeof v == "number" || typeof v == "bigint" || v.constructor == String ? ve(null, v, null, null, v) : qe(v) ? ve(B, { children: v }, null, null, null) : v.constructor === void 0 && v.__b > 0 ? ve(v.type, v.props, v.key, v.ref ? v.ref : null, v.__v) : v) != null ? (v.__ = b, v.__b = b.__b + 1, I = Sr(v, E, N = f + L, w), v.__i = I, _ = null, I !== -1 && (w--, (_ = E[I]) && (_.__u |= 131072)), _ == null || _.__v === null ? (I == -1 && L--, typeof v.type != "function" && (v.__u |= 65536)) : I !== N && (I === N + 1 ? L++ : I > N ? w > P - N ? L += I - N : L-- : L = I < N && I == N - 1 ? I - N : 0, I !== f + L && (v.__u |= 65536))) : (_ = E[f]) && _.key == null && _.__e && (_.__e == b.__d && (b.__d = me(_)), Qe(_, _, !1), E[f] = null, w--); if (w) for (f = 0; f < C; f++) (_ = E[f]) != null && !(131072 & _.__u) && (_.__e == b.__d && (b.__d = me(_)), Qe(_, _)); }(n, t, y), c = n.__d, u = 0; u < k; u++) (h = n.__k[u]) != null && typeof h != "boolean" && typeof h != "function" && (d = h.__i === -1 ? xe : y[h.__i] || xe, h.__i = u, et(e, h, d, o, i, s, l, c, p, m), g = h.__e, h.ref && d.ref != h.ref && (d.ref && tt(d.ref, null, h), m.push(h.ref, h.__c || g, h)), x == null && g != null && (x = g), 65536 & h.__u || d.__k === h.__k ? c = pn(h, c, e) : typeof h.type == "function" && h.__d !== void 0 ? c = h.__d : g && (c = g.nextSibling), h.__d = void 0, h.__u &= -196609); n.__d = c, n.__e = x; } function pn(e, t, n) { var r, o; if (typeof e.type == "function") { for (r = e.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = e, t = pn(r[o], t, n)); return t; } return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling; } function te(e, t) { return t = t || [], e == null || typeof e == "boolean" || (qe(e) ? e.some(function(n) { te(n, t); }) : t.push(e)), t; } function Sr(e, t, n, r) { var o = e.key, i = e.type, s = n - 1, l = n + 1, c = t[n]; if (c === null || c && o == c.key && i === c.type) return n; if (r > (c == null || 131072 & c.__u ? 0 : 1)) for (; s >= 0 || l < t.length; ) { if (s >= 0) { if ((c = t[s]) && !(131072 & c.__u) && o == c.key && i === c.type) return s; s--; } if (l < t.length) { if ((c = t[l]) && !(131072 & c.__u) && o == c.key && i === c.type) return l; l++; } } return -1; } function vt(e, t, n) { t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Cr.test(t) ? n : n + "px"; } function Se(e, t, n, r, o) { var i; e: if (t === "style") if (typeof n == "string") e.style.cssText = n; else { if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || vt(e.style, t, ""); if (n) for (t in n) r && n[t] === r[t] || vt(e.style, t, n[t]); } else if (t[0] === "o" && t[1] === "n") i = t !== (t = t.replace(/(PointerCapture)$|Capture$/, "$1")), t = t.toLowerCase() in e ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = n, n ? r ? n.u = r.u : (n.u = Date.now(), e.addEventListener(t, i ? xt : yt, i)) : e.removeEventListener(t, i ? xt : yt, i); else { if (o) t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (t !== "width" && t !== "height" && t !== "href" && t !== "list" && t !== "form" && t !== "tabIndex" && t !== "download" && t !== "rowSpan" && t !== "colSpan" && t !== "role" && t in e) try { e[t] = n ?? ""; break e; } catch { } typeof n == "function" || (n == null || n === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, n)); } } function yt(e) { var t = this.l[e.type + !1]; if (e.t) { if (e.t <= t.u) return; } else e.t = Date.now(); return t(M.event ? M.event(e) : e); } function xt(e) { return this.l[e.type + !0](M.event ? M.event(e) : e); } function et(e, t, n, r, o, i, s, l, c, p) { var m, u, d, h, g, x, y, k, b, S, E, f, v, _, N, I = t.type; if (t.constructor !== void 0) return null; 128 & n.__u && (c = !!(32 & n.__u), i = [l = t.__e = n.__e]), (m = M.__b) && m(t); e: if (typeof I == "function") try { if (k = t.props, b = (m = I.contextType) && r[m.__c], S = m ? b ? b.props.value : m.__ : r, n.__c ? y = (u = t.__c = n.__c).__ = u.__E : ("prototype" in I && I.prototype.render ? t.__c = u = new I(k, S) : (t.__c = u = new Y(k, S), u.constructor = I, u.render = Tr), b && b.sub(u), u.props = k, u.state || (u.state = {}), u.context = S, u.__n = r, d = u.__d = !0, u.__h = [], u._sb = []), u.__s == null && (u.__s = u.state), I.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = ee({}, u.__s)), ee(u.__s, I.getDerivedStateFromProps(k, u.__s))), h = u.props, g = u.state, u.__v = t, d) I.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), u.componentDidMount != null && u.__h.push(u.componentDidMount); else { if (I.getDerivedStateFromProps == null && k !== h && u.componentWillReceiveProps != null && u.componentWillReceiveProps(k, S), !u.__e && (u.shouldComponentUpdate != null && u.shouldComponentUpdate(k, u.__s, S) === !1 || t.__v === n.__v)) { for (t.__v !== n.__v && (u.props = k, u.state = u.__s, u.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(P) { P && (P.__ = t); }), E = 0; E < u._sb.length; E++) u.__h.push(u._sb[E]); u._sb = [], u.__h.length && s.push(u); break e; } u.componentWillUpdate != null && u.componentWillUpdate(k, u.__s, S), u.componentDidUpdate != null && u.__h.push(function() { u.componentDidUpdate(h, g, x); }); } if (u.context = S, u.props = k, u.__P = e, u.__e = !1, f = M.__r, v = 0, "prototype" in I && I.prototype.render) { for (u.state = u.__s, u.__d = !1, f && f(t), m = u.render(u.props, u.state, u.context), _ = 0; _ < u._sb.length; _++) u.__h.push(u._sb[_]); u._sb = []; } else do u.__d = !1, f && f(t), m = u.render(u.props, u.state, u.context), u.state = u.__s; while (u.__d && ++v < 25); u.state = u.__s, u.getChildContext != null && (r = ee(ee({}, r), u.getChildContext())), d || u.getSnapshotBeforeUpdate == null || (x = u.getSnapshotBeforeUpdate(h, g)), dn(e, qe(N = m != null && m.type === B && m.key == null ? m.props.children : m) ? N : [N], t, n, r, o, i, s, l, c, p), u.base = t.__e, t.__u &= -161, u.__h.length && s.push(u), y && (u.__E = u.__ = null); } catch (P) { t.__v = null, c || i != null ? (t.__e = l, t.__u |= c ? 160 : 32, i[i.indexOf(l)] = null) : (t.__e = n.__e, t.__k = n.__k), M.__e(P, t, n); } else i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Ir(n.__e, t, n, r, o, i, s, c, p); (m = M.diffed) && m(t); } function mn(e, t, n) { t.__d = void 0; for (var r = 0; r < n.length; r++) tt(n[r], n[++r], n[++r]); M.__c && M.__c(t, e), e.some(function(o) { try { e = o.__h, o.__h = [], e.some(function(i) { i.call(o); }); } catch (i) { M.__e(i, o.__v); } }); } function Ir(e, t, n, r, o, i, s, l, c) { var p, m, u, d, h, g, x, y = n.props, k = t.props, b = t.type; if (b === "svg" && (o = !0), i != null) { for (p = 0; p < i.length; p++) if ((h = i[p]) && "setAttribute" in h == !!b && (b ? h.localName === b : h.nodeType === 3)) { e = h, i[p] = null; break; } } if (e == null) { if (b === null) return document.createTextNode(k); e = o ? document.createElementNS("http://www.w3.org/2000/svg", b) : document.createElement(b, k.is && k), i = null, l = !1; } if (b === null) y === k || l && e.data === k || (e.data = k); else { if (i = i && ke.call(e.childNodes), y = n.props || xe, !l && i != null) for (y = {}, p = 0; p < e.attributes.length; p++) y[(h = e.attributes[p]).name] = h.value; for (p in y) h = y[p], p == "children" || (p == "dangerouslySetInnerHTML" ? u = h : p === "key" || p in k || Se(e, p, null, h, o)); for (p in k) h = k[p], p == "children" ? d = h : p == "dangerouslySetInnerHTML" ? m = h : p == "value" ? g = h : p == "checked" ? x = h : p === "key" || l && typeof h != "function" || y[p] === h || Se(e, p, h, y[p], o); if (m) l || u && (m.__html === u.__html || m.__html === e.innerHTML) || (e.innerHTML = m.__html), t.__k = []; else if (u && (e.innerHTML = ""), dn(e, qe(d) ? d : [d], t, n, r, o && b !== "foreignObject", i, s, i ? i[0] : n.__k && me(n, 0), l, c), i != null) for (p = i.length; p--; ) i[p] != null && ln(i[p]); l || (p = "value", g !== void 0 && (g !== e[p] || b === "progress" && !g || b === "option" && g !== y[p]) && Se(e, p, g, y[p], !1), p = "checked", x !== void 0 && x !== e[p] && Se(e, p, x, y[p], !1)); } return e; } function tt(e, t, n) { try { typeof e == "function" ? e(t) : e.current = t; } catch (r) { M.__e(r, n); } } function Qe(e, t, n) { var r, o; if (M.unmount && M.unmount(e), (r = e.ref) && (r.current && r.current !== e.__e || tt(r, null, t)), (r = e.__c) != null) { if (r.componentWillUnmount) try { r.componentWillUnmount(); } catch (i) { M.__e(i, t); } r.base = r.__P = null, e.__c = void 0; } if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && Qe(r[o], t, n || typeof e.type != "function"); n || e.__e == null || ln(e.__e), e.__ = e.__e = e.__d = void 0; } function Tr(e, t, n) { return this.constructor(e, n); } function he(e, t, n) { var r, o, i, s; M.__ && M.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], s = [], et(t, e = (!r && n || t).__k = Z(B, null, [e]), o || xe, xe, t.ownerSVGElement !== void 0, !r && n ? [n] : o ? null : t.firstChild ? ke.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, s), mn(i, e, s); } function hn(e, t) { he(e, t, hn); } function Nr(e, t, n) { var r, o, i, s, l = ee({}, e.props); for (i in e.type && e.type.defaultProps && (s = e.type.defaultProps), t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : l[i] = t[i] === void 0 && s !== void 0 ? s[i] : t[i]; return arguments.length > 2 && (l.children = arguments.length > 3 ? ke.call(arguments, 2) : n), ve(e.type, l, r || e.key, o || e.ref, null); } function fn(e, t) { var n = { __c: t = "__cC" + sn++, __: e, Consumer: function(r, o) { return r.children(o); }, Provider: function(r) { var o, i; return this.getChildContext || (o = [], (i = {})[t] = this, this.getChildContext = function() { return i; }, this.shouldComponentUpdate = function(s) { this.props.value !== s.value && o.some(function(l) { l.__e = !0, ze(l); }); }, this.sub = function(s) { o.push(s); var l = s.componentWillUnmount; s.componentWillUnmount = function() { o.splice(o.indexOf(s), 1), l && l.call(s); }; }), r.children; } }; return n.Provider.__ = n.Consumer.contextType = n; } ke = an.slice, M = { __e: function(e, t, n, r) { for (var o, i, s; t = t.__; ) if ((o = t.__c) && !o.__) try { if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), s = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, r || {}), s = o.__d), s) return o.__E = o; } catch (l) { e = l; } throw e; } }, rn = 0, Y.prototype.setState = function(e, t) { var n; n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ee({}, this.state), typeof e == "function" && (e = e(ee({}, n), this.props)), e && ee(n, e), e != null && this.__v && (t && this._sb.push(t), ze(this)); }, Y.prototype.forceUpdate = function(e) { this.__v && (this.__e = !0, e && this.__h.push(e), ze(this)); }, Y.prototype.render = B, ae = [], on = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, $e = function(e, t) { return e.__v.__b - t.__v.__b; }, Le.__r = 0, sn = 0; var Er = 0; function a(e, t, n, r, o, i) { var s, l, c = {}; for (l in t) l == "ref" ? s = t[l] : c[l] = t[l]; var p = { type: e, props: c, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Er, __i: -1, __u: 0, __source: o, __self: i }; if (typeof e == "function" && (s = e.defaultProps)) for (l in s) c[l] === void 0 && (c[l] = s[l]); return M.vnode && M.vnode(p), p; } var ne, D, Ue, kt, fe = 0, gn = [], Ie = [], wt = M.__b, Ct = M.__r, St = M.diffed, It = M.__c, Tt = M.unmount; function ce(e, t) { M.__h && M.__h(D, e, fe || t), fe = 0; var n = D.__H || (D.__H = { __: [], __h: [] }); return e >= n.__.length && n.__.push({ __V: Ie }), n.__[e]; } function F(e) { return fe = 1, nt(yn, e); } function nt(e, t, n) { var r = ce(ne++, 2); if (r.t = e, !r.__c && (r.__ = [n ? n(t) : yn(void 0, t), function(l) { var c = r.__N ? r.__N[0] : r.__[0], p = r.t(c, l); c !== p && (r.__N = [p, r.__[1]], r.__c.setState({})); }], r.__c = D, !D.u)) { var o = function(l, c, p) { if (!r.__c.__H) return !0; var m = r.__c.__H.__.filter(function(d) { return d.__c; }); if (m.every(function(d) { return !d.__N; })) return !i || i.call(this, l, c, p); var u = !1; return m.forEach(function(d) { if (d.__N) { var h = d.__[0]; d.__ = d.__N, d.__N = void 0, h !== d.__[0] && (u = !0); } }), !(!u && r.__c.props === l) && (!i || i.call(this, l, c, p)); }; D.u = !0; var i = D.shouldComponentUpdate, s = D.componentWillUpdate; D.componentWillUpdate = function(l, c, p) { if (this.__e) { var m = i; i = void 0, o(l, c, p), i = m; } s && s.call(this, l, c, p); }, D.shouldComponentUpdate = o; } return r.__N || r.__; } function A(e, t) { var n = ce(ne++, 3); !M.__s && ot(n.__H, t) && (n.__ = e, n.i = t, D.__H.__h.push(n)); } function we(e, t) { var n = ce(ne++, 4); !M.__s && ot(n.__H, t) && (n.__ = e, n.i = t, D.__h.push(n)); } function z(e) { return fe = 5, re(function() { return { current: e }; }, []); } function _n(e, t, n) { fe = 6, we(function() { return typeof e == "function" ? (e(t()), function() { return e(null); }) : e ? (e.current = t(), function() { return e.current = null; }) : void 0; }, n == null ? n : n.concat(e)); } function re(e, t) { var n = ce(ne++, 7); return ot(n.__H, t) ? (n.__V = e(), n.i = t, n.__h = e, n.__V) : n.__; } function le(e, t) { return fe = 8, re(function() { return e; }, t); } function bn(e) { var t = D.context[e.__c], n = ce(ne++, 9); return n.c = e, t ? (n.__ == null && (n.__ = !0, t.sub(D)), t.props.value) : e.__; } function rt(e, t) { M.useDebugValue && M.useDebugValue(t ? t(e) : e); } function vn() { var e = ce(ne++, 11); if (!e.__) { for (var t = D.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__; var n = t.__m || (t.__m = [0, 0]); e.__ = "P" + n[0] + "-" + n[1]++; } return e.__; } function Lr() { for (var e; e = gn.shift(); ) if (e.__P && e.__H) try { e.__H.__h.forEach(Te), e.__H.__h.forEach(We), e.__H.__h = []; } catch (t) { e.__H.__h = [], M.__e(t, e.__v); } } M.__b = function(e) { D = null, wt && wt(e); }, M.__r = function(e) { Ct && Ct(e), ne = 0; var t = (D = e.__c).__H; t && (Ue === D ? (t.__h = [], D.__h = [], t.__.forEach(function(n) { n.__N && (n.__ = n.__N), n.__V = Ie, n.__N = n.i = void 0; })) : (t.__h.forEach(Te), t.__h.forEach(We), t.__h = [], ne = 0)), Ue = D; }, M.diffed = function(e) { St && St(e); var t = e.__c; t && t.__H && (t.__H.__h.length && (gn.push(t) !== 1 && kt === M.requestAnimationFrame || ((kt = M.requestAnimationFrame) || Pr)(Lr)), t.__H.__.forEach(function(n) { n.i && (n.__H = n.i), n.__V !== Ie && (n.__ = n.__V), n.i = void 0, n.__V = Ie; })), Ue = D = null; }, M.__c = function(e, t) { t.some(function(n) { try { n.__h.forEach(Te), n.__h = n.__h.filter(function(r) { return !r.__ || We(r); }); } catch (r) { t.some(function(o) { o.__h && (o.__h = []); }), t = [], M.__e(r, n.__v); } }), It && It(e, t); }, M.unmount = function(e) { Tt && Tt(e); var t, n = e.__c; n && n.__H && (n.__H.__.forEach(function(r) { try { Te(r); } catch (o) { t = o; } }), n.__H = void 0, t && M.__e(t, n.__v)); }; var Nt = typeof requestAnimationFrame == "function"; function Pr(e) { var t, n = function() { clearTimeout(r), Nt && cancelAnimationFrame(t), setTimeout(e); }, r = setTimeout(n, 100); Nt && (t = requestAnimationFrame(n)); } function Te(e) { var t = D, n = e.__c; typeof n == "function" && (e.__c = void 0, n()), D = t; } function We(e) { var t = D; e.__c = e.__(), D = t; } function ot(e, t) { return !e || e.length !== t.length || t.some(function(n, r) { return n !== e[r]; }); } function yn(e, t) { return typeof t == "function" ? t(e) : t; } function xn(e, t) { for (var n in t) e[n] = t[n]; return e; } function Ze(e, t) { for (var n in e) if (n !== "__source" && !(n in t)) return !0; for (var r in t) if (r !== "__source" && e[r] !== t[r]) return !0; return !1; } function Pe(e) { this.props = e; } function kn(e, t) { function n(o) { var i = this.props.ref, s = i == o.ref; return !s && i && (i.call ? i(null) : i.current = null), t ? !t(this.props, o) || !s : Ze(this.props, o); } function r(o) { return this.shouldComponentUpdate = n, Z(e, o); } return r.displayName = "Memo(" + (e.displayName || e.name) + ")", r.prototype.isReactComponent = !0, r.__f = !0, r; } (Pe.prototype = new Y()).isPureReactComponent = !0, Pe.prototype.shouldComponentUpdate = function(e, t) { return Ze(this.props, e) || Ze(this.state, t); }; var Et = M.__b; M.__b = function(e) { e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Et && Et(e); }; var Mr = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911; function it(e) { function t(n) { var r = xn({}, n); return delete r.ref, e(r, n.ref || null); } return t.$$typeof = Mr, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t; } var Lt = function(e, t) { return e == null ? null : te(te(e).map(t)); }, wn = { map: Lt, forEach: Lt, count: function(e) { return e ? te(e).length : 0; }, only: function(e) { var t = te(e); if (t.length !== 1) throw "Children.only"; return t[0]; }, toArray: te }, qr = M.__e; M.__e = function(e, t, n, r) { if (e.then) { for (var o, i = t; i = i.__; ) if ((o = i.__c) && o.__c) return t.__e == null && (t.__e = n.__e, t.__k = n.__k), o.__c(e, t); } qr(e, t, n, r); }; var Pt = M.unmount; function Cn(e, t, n) { return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(r) { typeof r.__c == "function" && r.__c(); }), e.__c.__H = null), (e = xn({}, e)).__c != null && (e.__c.__P === n && (e.__c.__P = t), e.__c = null), e.__k = e.__k && e.__k.map(function(r) { return Cn(r, t, n); })), e; } function Sn(e, t, n) { return e && n && (e.__v = null, e.__k = e.__k && e.__k.map(function(r) { return Sn(r, t, n); }), e.__c && e.__c.__P === t && (e.__e && n.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = n)), e; } function ye() { this.__u = 0, this.t = null, this.__b = null; } function In(e) { var t = e.__.__c; return t && t.__a && t.__a(e); } function Tn(e) { var t, n, r; function o(i) { if (t || (t = e()).then(function(s) { n = s.default || s; }, function(s) { r = s; }), r) throw r; if (!n) throw t; return Z(n, i); } return o.displayName = "Lazy", o.__f = !0, o; } function de() { this.u = null, this.o = null; } M.unmount = function(e) { var t = e.__c; t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), Pt && Pt(e); }, (ye.prototype = new Y()).__c = function(e, t) { var n = t.__c, r = this; r.t == null && (r.t = []), r.t.push(n); var o = In(r.__v), i = !1, s = function() { i || (i = !0, n.__R = null, o ? o(l) : l()); }; n.__R = s; var l = function() { if (!--r.__u) { if (r.state.__a) { var c = r.state.__a; r.__v.__k[0] = Sn(c, c.__c.__P, c.__c.__O); } var p; for (r.setState({ __a: r.__b = null }); p = r.t.pop(); ) p.forceUpdate(); } }; r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), e.then(s, s); }, ye.prototype.componentWillUnmount = function() { this.t = []; }, ye.prototype.render = function(e, t) { if (this.__b) { if (this.__v.__k) { var n = document.createElement("div"), r = this.__v.__k[0].__c; this.__v.__k[0] = Cn(this.__b, n, r.__O = r.__P); } this.__b = null; } var o = t.__a && Z(B, null, e.fallback); return o && (o.__u &= -33), [Z(B, null, t.__a ? null : e.children), o]; }; var Mt = function(e, t, n) { if (++n[1] === n[0] && e.o.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.o.size)) for (n = e.u; n; ) { for (; n.length > 3; ) n.pop()(); if (n[1] < n[0]) break; e.u = n = n[2]; } }; function Rr(e) { return this.getChildContext = function() { return e.context; }, e.children; } function Hr(e) { var t = this, n = e.i; t.componentWillUnmount = function() { he(null, t.l), t.l = null, t.i = null; }, t.i && t.i !== n && t.componentWillUnmount(), t.l || (t.i = n, t.l = { nodeType: 1, parentNode: n, childNodes: [], appendChild: function(r) { this.childNodes.push(r), t.i.appendChild(r); }, insertBefore: function(r, o) { this.childNodes.push(r), t.i.appendChild(r); }, removeChild: function(r) { this.childNodes.splice(this.childNodes.indexOf(r) >>> 1, 1), t.i.removeChild(r); } }), he(Z(Rr, { context: t.context }, e.__v), t.l); } function Nn(e, t) { var n = Z(Hr, { __v: e, i: t }); return n.containerInfo = t, n; } (de.prototype = new Y()).__a = function(e) { var t = this, n = In(t.__v), r = t.o.get(e); return r[0]++, function(o) { var i = function() { t.props.revealOrder ? (r.push(o), Mt(t, e, r)) : o(); }; n ? n(i) : i(); }; }, de.prototype.render = function(e) { this.u = null, this.o = /* @__PURE__ */ new Map(); var t = te(e.children); e.revealOrder && e.revealOrder[0] === "b" && t.reverse(); for (var n = t.length; n--; ) this.o.set(t[n], this.u = [1, 0, this.u]); return e.children; }, de.prototype.componentDidUpdate = de.prototype.componentDidMount = function() { var e = this; this.o.forEach(function(t, n) { Mt(e, n, t); }); }; var En = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Or = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, Ur = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Dr = /[A-Z0-9]/g, jr = typeof document < "u", Fr = function(e) { return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e); }; function Ln(e, t, n) { return t.__k == null && (t.textContent = ""), he(e, t), typeof n == "function" && n(), e ? e.__c : null; } function Pn(e, t, n) { return hn(e, t), typeof n == "function" && n(), e ? e.__c : null; } Y.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) { Object.defineProperty(Y.prototype, e, { configurable: !0, get: function() { return this["UNSAFE_" + e]; }, set: function(t) { Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t }); } }); }); var qt = M.event; function Ar() { } function Br() { return this.cancelBubble; } function Vr() { return this.defaultPrevented; } M.event = function(e) { return qt && (e = qt(e)), e.persist = Ar, e.isPropagationStopped = Br, e.isDefaultPrevented = Vr, e.nativeEvent = e; }; var st, $r = { enumerable: !1, configurable: !0, get: function() { return this.class; } }, Rt = M.vnode; M.vnode = function(e) { typeof e.type == "string" && function(t) { var n = t.props, r = t.type, o = {}; for (var i in n) { var s = n[i]; if (!(i === "value" && "defaultValue" in n && s == null || jr && i === "children" && r === "noscript" || i === "class" || i === "className")) { var l = i.toLowerCase(); i === "defaultValue" && "value" in n && n.value == null ? i = "value" : i === "download" && s === !0 ? s = "" : l === "ondoubleclick" ? i = "ondblclick" : l !== "onchange" || r !== "input" && r !== "textarea" || Fr(n.type) ? l === "onfocus" ? i = "onfocusin" : l === "onblur" ? i = "onfocusout" : Ur.test(i) ? i = l : r.indexOf("-") === -1 && Or.test(i) ? i = i.replace(Dr, "-$&").toLowerCase() : s === null && (s = void 0) : l = i = "oninput", l === "oninput" && o[i = l] && (i = "oninputCapture"), o[i] = s; } } r == "select" && o.multiple && Array.isArray(o.value) && (o.value = te(n.children).forEach(function(c) { c.props.selected = o.value.indexOf(c.props.value) != -1; })), r == "select" && o.defaultValue != null && (o.value = te(n.children).forEach(function(c) { c.props.selected = o.multiple ? o.defaultValue.indexOf(c.props.value) != -1 : o.defaultValue == c.props.value; })), n.class && !n.className ? (o.class = n.class, Object.defineProperty(o, "className", $r)) : (n.className && !n.class || n.class && n.className) && (o.class = o.className = n.className), t.props = o; }(e), e.$$typeof = En, Rt && Rt(e); }; var Ht = M.__r; M.__r = function(e) { Ht && Ht(e), st = e.__c; }; var Ot = M.diffed; M.diffed = function(e) { Ot && Ot(e); var t = e.props, n = e.__e; n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value), st = null; }; var Mn = { ReactCurrentDispatcher: { current: { readContext: function(e) { return st.__n[e.__c].props.value; } } } }; function qn(e) { return Z.bind(null, e); } function Ce(e) { return !!e && e.$$typeof === En; } function Rn(e) { return Ce(e) && e.type === B; } function Hn(e) { return Ce(e) ? Nr.apply(null, arguments) : e; } function at(e) { return !!e.__k && (he(null, e), !0); } function On(e) { return e && (e.base || e.nodeType === 1 && e) || null; } var Un = function(e, t) { return e(t); }, Dn = function(e, t) { return e(t); }, jn = B; function lt(e) { e(); } function Fn(e) { return e; } function An() { return [!1, lt]; } var Bn = we, Vn = Ce; function $n(e, t) { var n = t(), r = F({ h: { __: n, v: t } }), o = r[0].h, i = r[1]; return we(function() { o.__ = n, o.v = t, De(o) && i({ h: o }); }, [e, n, t]), A(function() { return De(o) && i({ h: o }), e(function() { De(o) && i({ h: o }); }); }, [e]), n; } function De(e) { var t, n, r = e.v, o = e.__; try { var i = r(); return !((t = o) === (n = i) && (t !== 0 || 1 / t == 1 / n) || t != t && n != n); } catch { return !0; } } var zr = { useState: F, useId: vn, useReducer: nt, useEffect: A, useLayoutEffect: we, useInsertionEffect: Bn, useTransition: An, useDeferredValue: Fn, useSyncExternalStore: $n, startTransition: lt, useRef: z, useImperativeHandle: _n, useMemo: re, useCallback: le, useContext: bn, useDebugValue: rt, version: "17.0.2", Children: wn, render: Ln, hydrate: Pn, unmountComponentAtNode: at, createPortal: Nn, createElement: Z, createContext: fn, createFactory: qn, cloneElement: Hn, createRef: cn, Fragment: B, isValidElement: Ce, isElement: Vn, isFragment: Rn, findDOMNode: On, Component: Y, PureComponent: Pe, memo: kn, forwardRef: it, flushSync: Dn, unstable_batchedUpdates: Un, StrictMode: jn, Suspense: ye, SuspenseList: de, lazy: Tn, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Mn }; const Qr = Object.freeze(Object.defineProperty({ __proto__: null, Children: wn, Component: Y, Fragment: B, PureComponent: Pe, StrictMode: jn, Suspense: ye, SuspenseList: de, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Mn, cloneElement: Hn, createContext: fn, createElement: Z, createFactory: qn, createPortal: Nn, createRef: cn, default: zr, findDOMNode: On, flushSync: Dn, forwardRef: it, hydrate: Pn, isElement: Vn, isFragment: Rn, isValidElement: Ce, lazy: Tn, memo: kn, render: Ln, startTransition: lt, unmountComponentAtNode: at, unstable_batchedUpdates: Un, useCallback: le, useContext: bn, useDebugValue: rt, useDeferredValue: Fn, useEffect: A, useErrorBoundary: function(e) { var t = ce(ne++, 10), n = F(); return t.__ = e, D.componentDidCatch || (D.componentDidCatch = function(r, o) { t.__ && t.__(r, o), n[1](r); }), [n[0], function() { n[1](void 0); }]; }, useId: vn, useImperativeHandle: _n, useInsertionEffect: Bn, useLayoutEffect: we, useMemo: re, useReducer: nt, useRef: z, useState: F, useSyncExternalStore: $n, useTransition: An, version: "17.0.2" }, Symbol.toStringTag, { value: "Module" })), Ut = (e) => { let t; const n = /* @__PURE__ */ new Set(), r = (s, l) => { const c = typeof s == "function" ? s(t) : s; if (!Object.is(c, t)) { const p = t; t = l ?? typeof c != "object" ? c : Object.assign({}, t, c), n.forEach((m) => m(t, p)); } }, o = () => t, i = { setState: r, getState: o, subscribe: (s) => (n.add(s), () => n.delete(s)), destroy: () => n.clear() }; return t = e(r, o, i), i; }; function Wr(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function Zr(e) { if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e; var t = e.default; if (typeof t == "function") { var n = function r() { return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; n.prototype = t.prototype; } else n = {}; return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) { var o = Object.getOwnPropertyDescriptor(e, r); Object.defineProperty(n, r, o.get ? o : { enumerable: !0, get: function() { return e[r]; } }); }), n; } var Dt = { exports: {} }, je = {}; const zn = Zr(Qr); var jt, Ft, At, Bt, Vt = { exports: {} }, Fe = {}; function Gr() { return Ft || (Ft = 1, Vt.exports = function() { if (jt) return Fe; jt = 1; var e = zn, t = typeof Object.is == "function" ? Object.is : function(c, p) { return c === p && (c !== 0 || 1 / c == 1 / p) || c != c && p != p; }, n = e.useState, r = e.useEffect, o = e.useLayoutEffect, i = e.useDebugValue; function s(c) { var p = c.getSnapshot; c = c.value; try { var m = p(); return !t(c, m); } catch { return !0; } } var l = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? function(c, p) { return p(); } : function(c, p) { var m = p(), u = n({ inst: { value: m, getSnapshot: p } }), d = u[0].inst, h = u[1]; return o(function() { d.value = m, d.getSnapshot = p, s(d) && h({ inst: d }); }, [c, m, p]), r(function() { return s(d) && h({ inst: d }), c(function() { s(d) && h({ inst: d }); }); }, [c]), i(m), m; }; return Fe.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : l, Fe; }()), Vt.exports; } var Kr = (Bt || (Bt = 1, Dt.exports = function() { if (At) return je; At = 1; var e = zn, t = Gr(), n = typeof Object.is == "function" ? Object.is : function(c, p) { return c === p && (c !== 0 || 1 / c == 1 / p) || c != c && p != p; }, r = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, s = e.useMemo, l = e.useDebugValue; return je.useSyncExternalStoreWithSelector = function(c, p, m, u, d) { var h = o(null); if (h.current === null) { var g = { hasValue: !1, value: null }; h.current = g; } else g = h.current; h = s(function() { function y(f) { if (!S) { if (S = !0, k = f, f = u(f), d !== void 0 && g.hasValue) { var v = g.value; if (d(v, f)) return b = v; } return b = f; } if (v = b, n(k, f)) return v; var _ = u(f); return d !== void 0 && d(v, _) ? v : (k = f, b = _); } var k, b, S = !1, E = m === void 0 ? null : m; return [function() { return y(p()); }, E === null ? void 0 : function() { return y(E()); }]; }, [p, m, u, d]); var x = r(c, h[0], h[1]); return i(function() { g.hasValue = !0, g.value = x; }, [x]), l(x), x; }, je; }()), Dt.exports); const Yr = Wr(Kr), { useSyncExternalStoreWithSelector: Jr } = Yr, $t = (e) => { const t = typeof e == "function" ? ((r) => r ? Ut(r) : Ut)(e) : e, n = (r, o) => function(i, s = i.getState, l) { const c = Jr(i.subscribe, i.getState, i.getServerState || i.getState, s, l); return rt(c), c; }(t, r, o); return Object.assign(n, t), n; }, Qn = (e) => e ? $t(e) : $t, Xr = 1, eo = 2, ct = { eq: (e, t) => e == t, neq(e, t) { return !this.eq(e, t); }, gt: (e, t) => e > t, gte: (e, t) => e >= t, lt: (e, t) => e < t, lte: (e, t) => e <= t, list_exact: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && e.slice().sort().join(",") === t.slice().sort().join(","), list_all: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && !t.some((n) => e.indexOf(n) === -1), list_alo(e, t) { if (!Array.isArray(t)) return !1; const n = Array.isArray(e) ? e : [e], r = new Set(n); return t.some((o) => r.has(o)); }, list_dni(e, t) { if (!Array.isArray(t)) return !1; const n = Array.isArray(e) ? e : [e], r = new Set(n); return t.every((o) => !r.has(o)); }, contains(e, t) { const n = e.toLowerCase(), r = t.toLowerCase(); return n.includes(r); }, notcontains(e, t) { return !this.contains(e, t); } }, to = (e, t, n) => { switch (t) { case "videovoice": return !!(e && e.value); case "open": return !!n; case "multipleselect": return !!(n && Object.keys(n).length); case "recordedtask": return (n == null ? void 0 : n.taskStatus) === "completed"; case "texturlprompt": return !e.value; case "consentlegal": case "nps": case "likert": return n !== null; case "multiplechoice": return n !== void 0; case "matrix": return !!(n && Object.values(n).every((r) => r !== null)); default: return !0; } }, Wn = (e, t) => { if (t === "matrix") { const n = Object.keys(e).length, r = Object.values(e).filter((o) => o !== null).length; return r > 0 && r < n; } return !1; }, Zn = ({ cards: e, index: t, hasEndCard: n, allResponses: r, uploadProgress: o = {} }) => { if (t >= e.length || t < 0) return null; const i = e[t]; let s = t + 1; const l = i.props.routingOptions || []; for (let m = 0; m < l.length; m++) { const { group: u, target: d } = l[m]; if (!(u != null && u.length)) continue; const h = u[0]; if (h.questionIndex === void 0 || h.questionIndex > r.length) continue; let g = zt({ comparator: h.comparator, response: r[h.questionIndex], type: i.type, value: h.value }); for (let x = 1; x < u.length; x += 2) { const y = u[x], k = u[x + 1], b = zt({ comparator: k.comparator, response: r[k.questionIndex], type: e[k.questionIndex].type, value: k.value }); y === Xr ? g && (g = b) : y === eo && (g || (g = b)); } if (g) { s = d === -1 && n ? e.length - 1 : d; break; } } const c = e.findIndex((m) => m.type === "uploading"); let p; return p = c > 0 ? n ? e.length - 3 : e.length - 2 : e.length - 1, t >= p || s === -1 || s !== null && s > p ? c > 0 && Object.values(o).some((u) => u.isSubmitted && !u.isComplete) ? c : n ? e.length - 1 : null : s === -1 ? null : s; }, zt = ({ comparator: e, response: t, type: n, value: r }) => { if (e === "answered") switch (n) { case "texturlprompt": return t === void 0; case "consentlegal": return t && t.submitted === !0; case "recordedtask": return "taskStatus" in t && t.taskStatus === "completed"; case "likert": case "nps": return Number.isInteger(t); case "matrix": return Object.values(t).every((o) => o !== null); case "multiplechoice": return t !== void 0; case "multipleselect": return (t == null ? void 0 : t.length) > 0; case "open": return t && t.length > 0; case "videovoice": return !!(t != null && t.mediaRecordingUid); default: return !1; } if (e === "given_up") return n !== "recordedtask" || "taskStatus" in t && t.taskStatus === "given.up"; if (e === "partial") return n === "matrix" && Wn(t, n); if (e === "skipped") switch (n) { case "texturlprompt": return t == null ? void 0 : t.skipped; case "consentlegal": case "likert": case "nps": case "videovoice": return t === null; case "recordedtask": return "taskStatus" in t && t.taskStatus === "abandoned"; case "open": case "multipleselect": return (t == null ? void 0 : t.length) === 0; case "multiplechoice": return t === void 0; case "matrix": return Object.values(t).every((o) => o === null); default: return !1; } return ct[e](t, r); }, no = (e) => { var r, o, i; switch (e.type) { case "multipleselect": return e && e.props && e.props.options ? e.props.options.length > 13 ? e.props.options.map((s) => [s.value]) : (t = e.props.options.map((s) => s.value), n = !e.props.properties.required, t.reduce((s, l) => s.concat(s.map((c) => [...c, l])), [[]]).filter((s) => n || s.length > 0)) : null; case "multiplechoice": { if (!e || !e.props || !e.props.options) return null; const s = e.props.options.map((l) => l.value); return e.props.properties.required || s.push(void 0), s; } case "matrix": { if (!((r = e == null ? void 0 : e.props) != null && r.options)) return null; const s = e.props.properties.matrixColumn, l = e.props.options, c = l.reduce((m, u) => (m[u.id] = null, m), {}), p = [{ ...c, [l[0].id]: s[0].value }, l.reduce((m, u) => (m[u.id] = s[0].value, m), {})]; return e.props.properties.required || p.push(c), p; } case "likert": { const s = Number((i = (o = e.props) == null ? void 0 : o.properties) == null ? void 0 : i.range) || 5; return [...Array.from(Array(s).keys()).map((c) => c + 1), ...e.props.properties.required ? [] : [null]]; } case "nps": return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...e.props.properties.required ? [] : [null]]; case "videovoice": case "open": return ["1", ...e.props.properties.required ? [] : [""]]; case "recordedtask": { const s = [{ taskStatus: "completed" }, { taskStatus: "given.up" }]; return e.props.properties.required || s.push({ taskStatus: "abandoned" }), s; } case "texturlprompt": return [void 0, ...e.props.properties.required ? [] : [{ skipped: !0 }]]; case "consentlegal": return [1, ...e.props.properties.required ? [] : [null]]; default: return [1]; } var t, n; }, ro = (e) => e in ct, oo = (e) => typeof e == "object" && e !== null && "taskStatus" in e, io = (e, t = []) => t.reduce((n, r) => { const { group: o, target: i } = r; if (!(o != null && o.length)) return [...n]; const s = o.filter((l) => !!Number(l) || typeof l == "object" && l.questionIndex === e).map((l) => { const { comparator: c, value: p } = l; return { comparator: c, target: i, value: p }; }); return [...n, ...s]; }, []), Ae = /* @__PURE__ */ new Set(["thanks", "uploading"]), R = Qn()((e, t) => ({ allResponses: [], answers: void 0, apiURL: "", border: "#000000", cards: [], close: async (n = pe) => { const r = t(), { fadeout: o, remove: i, trackHistory: s, studyType: l } = r; await o(n), Be(r) || s({ event: "closed" }), vr.info("SurveyClosing", { surveyId: r.surveyId }), ht.enable(), i({ initiator: ft.Closed, studyType: l }); }, configureExitOnOverlayClick: () => { }, customMetadata: {}, destroy: async (n) => { const { eventEmitFn: r, fadeout: o, remove: i, studyType: s, surveyId: l } = t(); r("survey.complete", l), await o(n), ht.enable(), i({ initiator: ft.Complete, studyType: s }); }, endCard: { headline: "" }, envId: "", eventEmitFn: _e.emit.bind(_e), fadeout: async (n) => { const { eventEmitFn: r, headers: o, viewDocument: i } = t(); return Ee(o) ? Promise.resolve() : (r(G.SurveyFadingOut), new Promise((s) => { const l = i.getElementById(n); l ? (l.addEventListener("transitionend", () => { s(); }), l.classList.remove("ul-app--visible")) : s(); })); }, forceBrandedLogo: !1, frame: document.createElement("iframe"), handleClickEmbedButton: (n) => { const { cards: r, eventEmitFn: o, index: i } = t(); o(n, { qid: r[i].name, props: r[i].props }), e(() => ({ hasViewedEmbed: !0 })); }, handleUploadUpdate: ({ mediaRecordingUid: n, isComplete: r, progressPct: o, isSubmitted: i }) => { var h, g, x; const { cards: s, destroy: l, index: c, uploadProgress: p } = t(), m = r || ((h = p[n]) == null ? void 0 : h.isComplete), u = { ...p, [n]: { progressPct: m ? 100 : o || ((g = p[n]) == null ? void 0 : g.progressPct), isComplete: m, isSubmitted: i || ((x = p[n]) == null ? void 0 : x.isSubmitted) } }; if (e({ uploadProgress: u }), s[c].type !== "uploading") return; const d = Object.entries(p).every(([y, k]) => !k.isSubmitted || k.isComplete || n == y && r); if (d && c >= s.length - 1) return l(pe); e({ index: d ? c + 1 : c, uploadingCardViewed: !0 }); }, hasViewedEmbed: !1, headers: { Authorization: "", "Content-Type": "", "userleap-platform": "web", "x-ul-environment-id": "", "x-ul-installation-method": "web-snippet", "x-ul-sdk-version": "", "x-ul-visitor-id": "" }, index: 0, isPreview: !1, marketingUrl: "https://sprig.com", meta: { ch: 0, cw: 0, l: "", mode: null, p: "", sh: 0, sw: 0 }, mode: void 0, next: (n) => { const { allResponses: r, cards: o, eventEmitFn: i, index: s, responseGroupUid: l, submit: c, trackHistory: p, uploadProgress: m, viewedCardCount: u } = t(); e({ minScrollableHeight: void 0 }); const d = Array.isArray(n.data) ? n.data : [n.data], h = Date.now(), g = [...o], x = { response: [], responseGroupUid: l, questionIndex: s }; let y = null; const k = r.slice(0); d.forEach((E, f) => { const v = g[s + f], { type: _, ...N } = E, I = { ...N, answeredAt: h }, P = I.value; ((w) => w && !Ae.has(w.type))(v) && (v.value = P), x.response.push(I); let C = _ === "multiplechoice" ? Object.values(P).find((w) => w !== !1) : P; _ === "multipleselect" && (C = g[s + f].props.options.reduce((w, L) => (P[L.id] && w.push(L.value), w), [])), k[s + f] = C, y = Zn({ cards: g, index: s + f, hasEndCard: !!n.endCard, uploadProgress: m, allResponses: k }); }), e({ allResponses: k }), (y === null || Ae.has(g[y].type)) && (x.completedAt = h); const b = c(x); if (y === null) return void n.completeSurvey(); y && !Ae.has(g[y].type) && b.finally(() => { p({ event: "seen", index: y }); }); const S = g[y]; g[y] && i && i("survey.question", { qid: S.name, props: S.props }), e({ cards: g, hasViewedEmbed: !1, index: y, viewedCardCount: u + 1 }); }, pendingRemoveIframeReason: null, previewKey: null, previewMode: void 0, recorder: () => { }, recorderEventEmitter: _e, resolveTrackedPromise: () => { const { removeIframeIfReady: n } = t(); e((r) => ({ unresolvedRequestCount: r.unresolvedRequestCount - 1 })), n(); }, responseGroupUid: "", remove: ({ initiator: n, studyType: r }) => { const { eventEmitFn: o, removeIframeIfReady: i, surveyId: s } = t(); e({ pendingRemoveIframeReason: n, studyType: r }), o(G.SurveyCloseRequested, { name: G.SurveyCloseRequested, initiator: n, studyType: r, "survey.id": s }), i(); }, removeIframeIfReady: () => { const { eventEmitFn: n, pendingRemoveIframeReason: r, unresolvedRequestCount: o, studyType: i, surveyId: s } = t(); r && o === 0 && (n(G.SurveyWillClose, { name: G.SurveyWillClose, initiator: r, studyType: i, "survey.id": s }), e({ pendingRemoveIframeReason: null, studyType: i })); }, seen: async () => { const { trackHistory: n } = t(); return n({ event: "seen", isNew: !0 }); }, slugName: null, showStripes: !1, showSurveyBrand: !1, styleNonce: "", submit: async ({ completedAt: n, questionIndex: r, response: o, responseGroupUid: i }) => { const s = t(); if (!i || Be(s)) return; const l = { responseGroupUid: i, meta: s.meta, customMetadata: s.customMetadata, responses: o, completedAt: n, previewKey: s.previewKey }, c = await s.trackPromise(Ve(`${s.apiURL}/sdk/1/environments/${s.envId}/visitors/${s.userId}/responses/submit`, { body: JSON.stringify(l), headers: s.headers, method: "POST" })); c.ok ? o.forEach((p, m) => { s.eventEmitFn(G.QuestionAnswered, { ...p, questionIndex: r ? r + m : void 0, "survey.id": s.surveyId }); }) : c.reportError && (console.warn("[Sprig] (ERR-427) Failed to submit response", c.error), await s.trackPromise(Qt(s, "submitResponse", c.error))); }, surveyId: 0, tabTitle: "", trackHistory: async ({ event: n, index: r, isNew: o = !1 }) => { const i = t(); if (Be(i)) return; const { cards: s, index: l } = i; let c = r ?? l, p = s[c]; for (; p; ) { const m = { sid: i.surveyId, qid: p.name, action: n, vid: i.userId, eid: i.envId, isNew: o, responseGroupUid: i.responseGroupUid, previewKey: i.previewKey }, u = await i.trackPromise(Ve(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`, { method: "POST", headers: i.headers, body: JSON.stringify(m) })); !u.ok && u.reportError && (console.warn("[Sprig] (ERR-428) Failed to track survey event", u.error), await i.trackPromise(Qt(i, "trackHistory", u.error))); const d = s[c + 1]; if (!p.groupId || !(d != null && d.groupId) || d.groupId !== p.groupId) break; c++, p = d, o = !1; } }, trackPromise: async (n) => { const { resolveTrackedPromise: r } = t(); return e((o) => ({ unresolvedRequestCount: o.unresolvedRequestCount + 1 })), n.then((o) => (r(), o)).catch((o) => { throw r(), o; }); }, unresolvedRequestCount: 0, update: () => { const { cards: n, index: r, headers: o, eventEmitFn: i, frame: s, useMobileStyling: l, surveyId: c, viewDocument: p } = t(), m = o["userleap-platform"] === "web", u = Ee(o), d = n[r], h = d.type === "matrix" && !(d.props.properties.displayMatrixAsAccordion || l); e({ minScrollableHeight: void 0 }), setTimeout(() => { var k, b, S; !u && !l && ((k = s == null ? void 0 : s.setWidth) == null || k.call(s, _r)); const [g, x, y] = br(p, m && !l, u); u ? (i(G.SurveyHeight, { name: G.SurveyHeight, contentFrameHeight: g, "survey.id": c }), i(G.SurveyWidth, { name: G.SurveyWidth, contentFrameWidth: x, "survey.id": c })) : ((b = s.setHeight) == null || b.call(s, g), e({ minScrollableHeight: y }), !l && h && ((S = s.setWidth) == null || S.call(s, x))); }, 100); }, uploadingCardViewed: !1, uploadProgress: {}, useDesktopPrototype: void 0, useMobileStyling: !1, userId: "", viewDocument: window.document, viewedCardCount: 0, focusedQuestionId: null, setFocusedQuestionId: (n) => e({ focusedQuestionId: n }) })), Be = (e) => !e.userId || e.meta && e.meta.mode === "test" || e.isPreview || e.previewMode, Qt = async (e, t, n) => { const { mode: r,