@sprig-technologies/sprig-browser
Version:
npm package for the sprig web sdk
1,106 lines • 134 kB
JavaScript
import { A as G, d as ln, e as un, C as mt, f as Ke, r as cn } from "./core-YTxB8B8q.js";
import { e as pe, h as Ie, S as q, s as de, b as qe, D as _t, t as Re, u as dn, v as ht } from "./metricsReporter-0HbKrvkx.js";
var ge, C, ar, Z, gt, sr, Je, lr, me = {}, ur = [], pn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Ue = Array.isArray;
function B(e, t) {
for (var r in t) e[r] = t[r];
return e;
}
function cr(e) {
var t = e.parentNode;
t && t.removeChild(e);
}
function V(e, t, r) {
var o, n, i, a = {};
for (i in t) i == "key" ? o = t[i] : i == "ref" ? n = t[i] : a[i] = t[i];
if (arguments.length > 2 && (a.children = arguments.length > 3 ? ge.call(arguments, 2) : r), typeof e == "function" && e.defaultProps != null) for (i in e.defaultProps) a[i] === void 0 && (a[i] = e.defaultProps[i]);
return fe(e, a, o, n, null);
}
function fe(e, t, r, o, n) {
var i = { type: e, props: t, key: r, ref: o, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: n ?? ++ar, __i: -1, __u: 0 };
return n == null && C.vnode != null && C.vnode(i), i;
}
function dr() {
return { current: null };
}
function z(e) {
return e.children;
}
function F(e, t) {
this.props = e, this.context = t;
}
function ae(e, t) {
if (t == null) return e.__ ? ae(e.__, e.__i + 1) : null;
for (var r; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) return r.__e;
return typeof e.type == "function" ? ae(e) : null;
}
function pr(e) {
var t, r;
if ((e = e.__) != null && e.__c != null) {
for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) {
e.__e = e.__c.base = r.__e;
break;
}
return pr(e);
}
}
function Ye(e) {
(!e.__d && (e.__d = !0) && Z.push(e) && !Ae.__r++ || gt !== C.debounceRendering) && ((gt = C.debounceRendering) || sr)(Ae);
}
function Ae() {
var e, t, r, o, n, i, a, s, l;
for (Z.sort(Je); e = Z.shift(); ) e.__d && (t = Z.length, o = void 0, i = (n = (r = e).__v).__e, s = [], l = [], (a = r.__P) && ((o = B({}, n)).__v = n.__v + 1, C.vnode && C.vnode(o), nt(a, o, n, r.__n, a.ownerSVGElement !== void 0, 32 & n.__u ? [i] : null, s, i ?? ae(n), !!(32 & n.__u), l), o.__.__k[o.__i] = o, _r(s, o, l), o.__e != i && pr(o)), Z.length > t && Z.sort(Je));
Ae.__r = 0;
}
function fr(e, t, r, o, n, i, a, s, l, u, d) {
var c, _, p, y, m, g = o && o.__k || ur, x = t.length;
for (r.__d = l, function(f, k, w) {
var h, v, b, A, R, N = k.length, L = w.length, U = L, j = 0;
for (f.__k = [], h = 0; h < N; h++) (v = f.__k[h] = (v = k[h]) == null || typeof v == "boolean" || typeof v == "function" ? null : typeof v == "string" || typeof v == "number" || typeof v == "bigint" || v.constructor == String ? fe(null, v, null, null, v) : Ue(v) ? fe(z, { children: v }, null, null, null) : v.constructor === void 0 && v.__b > 0 ? fe(v.type, v.props, v.key, v.ref ? v.ref : null, v.__v) : v) != null ? (v.__ = f, v.__b = f.__b + 1, R = fn(v, w, A = h + j, U), v.__i = R, b = null, R !== -1 && (U--, (b = w[R]) && (b.__u |= 131072)), b == null || b.__v === null ? (R == -1 && j--, typeof v.type != "function" && (v.__u |= 65536)) : R !== A && (R === A + 1 ? j++ : R > A ? U > N - A ? j += R - A : j-- : j = R < A && R == A - 1 ? R - A : 0, R !== h + j && (v.__u |= 65536))) : (b = w[h]) && b.key == null && b.__e && (b.__e == f.__d && (f.__d = ae(b)), Xe(b, b, !1), w[h] = null, U--);
if (U) for (h = 0; h < L; h++) (b = w[h]) != null && !(131072 & b.__u) && (b.__e == f.__d && (f.__d = ae(b)), Xe(b, b));
}(r, t, g), l = r.__d, c = 0; c < x; c++) (p = r.__k[c]) != null && typeof p != "boolean" && typeof p != "function" && (_ = p.__i === -1 ? me : g[p.__i] || me, p.__i = c, nt(e, p, _, n, i, a, s, l, u, d), y = p.__e, p.ref && _.ref != p.ref && (_.ref && ot(_.ref, null, p), d.push(p.ref, p.__c || y, p)), m == null && y != null && (m = y), 65536 & p.__u || _.__k === p.__k ? l = mr(p, l, e) : typeof p.type == "function" && p.__d !== void 0 ? l = p.__d : y && (l = y.nextSibling), p.__d = void 0, p.__u &= -196609);
r.__d = l, r.__e = m;
}
function mr(e, t, r) {
var o, n;
if (typeof e.type == "function") {
for (o = e.__k, n = 0; o && n < o.length; n++) o[n] && (o[n].__ = e, t = mr(o[n], t, r));
return t;
}
return e.__e != t && (r.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
}
function $(e, t) {
return t = t || [], e == null || typeof e == "boolean" || (Ue(e) ? e.some(function(r) {
$(r, t);
}) : t.push(e)), t;
}
function fn(e, t, r, o) {
var n = e.key, i = e.type, a = r - 1, s = r + 1, l = t[r];
if (l === null || l && n == l.key && i === l.type) return r;
if (o > (l == null || 131072 & l.__u ? 0 : 1)) for (; a >= 0 || s < t.length; ) {
if (a >= 0) {
if ((l = t[a]) && !(131072 & l.__u) && n == l.key && i === l.type) return a;
a--;
}
if (s < t.length) {
if ((l = t[s]) && !(131072 & l.__u) && n == l.key && i === l.type) return s;
s++;
}
}
return -1;
}
function yt(e, t, r) {
t[0] === "-" ? e.setProperty(t, r ?? "") : e[t] = r == null ? "" : typeof r != "number" || pn.test(t) ? r : r + "px";
}
function ke(e, t, r, o, n) {
var i;
e: if (t === "style") if (typeof r == "string") e.style.cssText = r;
else {
if (typeof o == "string" && (e.style.cssText = o = ""), o) for (t in o) r && t in r || yt(e.style, t, "");
if (r) for (t in r) o && r[t] === o[t] || yt(e.style, t, r[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] = r, r ? o ? r.u = o.u : (r.u = Date.now(), e.addEventListener(t, i ? vt : bt, i)) : e.removeEventListener(t, i ? vt : bt, i);
else {
if (n) 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] = r ?? "";
break e;
} catch {
}
typeof r == "function" || (r == null || r === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, r));
}
}
function bt(e) {
var t = this.l[e.type + !1];
if (e.t) {
if (e.t <= t.u) return;
} else e.t = Date.now();
return t(C.event ? C.event(e) : e);
}
function vt(e) {
return this.l[e.type + !0](C.event ? C.event(e) : e);
}
function nt(e, t, r, o, n, i, a, s, l, u) {
var d, c, _, p, y, m, g, x, f, k, w, h, v, b, A, R = t.type;
if (t.constructor !== void 0) return null;
128 & r.__u && (l = !!(32 & r.__u), i = [s = t.__e = r.__e]), (d = C.__b) && d(t);
e: if (typeof R == "function") try {
if (x = t.props, f = (d = R.contextType) && o[d.__c], k = d ? f ? f.props.value : d.__ : o, r.__c ? g = (c = t.__c = r.__c).__ = c.__E : ("prototype" in R && R.prototype.render ? t.__c = c = new R(x, k) : (t.__c = c = new F(x, k), c.constructor = R, c.render = _n), f && f.sub(c), c.props = x, c.state || (c.state = {}), c.context = k, c.__n = o, _ = c.__d = !0, c.__h = [], c._sb = []), c.__s == null && (c.__s = c.state), R.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = B({}, c.__s)), B(c.__s, R.getDerivedStateFromProps(x, c.__s))), p = c.props, y = c.state, c.__v = t, _) R.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), c.componentDidMount != null && c.__h.push(c.componentDidMount);
else {
if (R.getDerivedStateFromProps == null && x !== p && c.componentWillReceiveProps != null && c.componentWillReceiveProps(x, k), !c.__e && (c.shouldComponentUpdate != null && c.shouldComponentUpdate(x, c.__s, k) === !1 || t.__v === r.__v)) {
for (t.__v !== r.__v && (c.props = x, c.state = c.__s, c.__d = !1), t.__e = r.__e, t.__k = r.__k, t.__k.forEach(function(N) {
N && (N.__ = t);
}), w = 0; w < c._sb.length; w++) c.__h.push(c._sb[w]);
c._sb = [], c.__h.length && a.push(c);
break e;
}
c.componentWillUpdate != null && c.componentWillUpdate(x, c.__s, k), c.componentDidUpdate != null && c.__h.push(function() {
c.componentDidUpdate(p, y, m);
});
}
if (c.context = k, c.props = x, c.__P = e, c.__e = !1, h = C.__r, v = 0, "prototype" in R && R.prototype.render) {
for (c.state = c.__s, c.__d = !1, h && h(t), d = c.render(c.props, c.state, c.context), b = 0; b < c._sb.length; b++) c.__h.push(c._sb[b]);
c._sb = [];
} else do
c.__d = !1, h && h(t), d = c.render(c.props, c.state, c.context), c.state = c.__s;
while (c.__d && ++v < 25);
c.state = c.__s, c.getChildContext != null && (o = B(B({}, o), c.getChildContext())), _ || c.getSnapshotBeforeUpdate == null || (m = c.getSnapshotBeforeUpdate(p, y)), fr(e, Ue(A = d != null && d.type === z && d.key == null ? d.props.children : d) ? A : [A], t, r, o, n, i, a, s, l, u), c.base = t.__e, t.__u &= -161, c.__h.length && a.push(c), g && (c.__E = c.__ = null);
} catch (N) {
t.__v = null, l || i != null ? (t.__e = s, t.__u |= l ? 160 : 32, i[i.indexOf(s)] = null) : (t.__e = r.__e, t.__k = r.__k), C.__e(N, t, r);
}
else i == null && t.__v === r.__v ? (t.__k = r.__k, t.__e = r.__e) : t.__e = mn(r.__e, t, r, o, n, i, a, l, u);
(d = C.diffed) && d(t);
}
function _r(e, t, r) {
t.__d = void 0;
for (var o = 0; o < r.length; o++) ot(r[o], r[++o], r[++o]);
C.__c && C.__c(t, e), e.some(function(n) {
try {
e = n.__h, n.__h = [], e.some(function(i) {
i.call(n);
});
} catch (i) {
C.__e(i, n.__v);
}
});
}
function mn(e, t, r, o, n, i, a, s, l) {
var u, d, c, _, p, y, m, g = r.props, x = t.props, f = t.type;
if (f === "svg" && (n = !0), i != null) {
for (u = 0; u < i.length; u++) if ((p = i[u]) && "setAttribute" in p == !!f && (f ? p.localName === f : p.nodeType === 3)) {
e = p, i[u] = null;
break;
}
}
if (e == null) {
if (f === null) return document.createTextNode(x);
e = n ? document.createElementNS("http://www.w3.org/2000/svg", f) : document.createElement(f, x.is && x), i = null, s = !1;
}
if (f === null) g === x || s && e.data === x || (e.data = x);
else {
if (i = i && ge.call(e.childNodes), g = r.props || me, !s && i != null) for (g = {}, u = 0; u < e.attributes.length; u++) g[(p = e.attributes[u]).name] = p.value;
for (u in g) p = g[u], u == "children" || (u == "dangerouslySetInnerHTML" ? c = p : u === "key" || u in x || ke(e, u, null, p, n));
for (u in x) p = x[u], u == "children" ? _ = p : u == "dangerouslySetInnerHTML" ? d = p : u == "value" ? y = p : u == "checked" ? m = p : u === "key" || s && typeof p != "function" || g[u] === p || ke(e, u, p, g[u], n);
if (d) s || c && (d.__html === c.__html || d.__html === e.innerHTML) || (e.innerHTML = d.__html), t.__k = [];
else if (c && (e.innerHTML = ""), fr(e, Ue(_) ? _ : [_], t, r, o, n && f !== "foreignObject", i, a, i ? i[0] : r.__k && ae(r, 0), s, l), i != null) for (u = i.length; u--; ) i[u] != null && cr(i[u]);
s || (u = "value", y !== void 0 && (y !== e[u] || f === "progress" && !y || f === "option" && y !== g[u]) && ke(e, u, y, g[u], !1), u = "checked", m !== void 0 && m !== e[u] && ke(e, u, m, g[u], !1));
}
return e;
}
function ot(e, t, r) {
try {
typeof e == "function" ? e(t) : e.current = t;
} catch (o) {
C.__e(o, r);
}
}
function Xe(e, t, r) {
var o, n;
if (C.unmount && C.unmount(e), (o = e.ref) && (o.current && o.current !== e.__e || ot(o, null, t)), (o = e.__c) != null) {
if (o.componentWillUnmount) try {
o.componentWillUnmount();
} catch (i) {
C.__e(i, t);
}
o.base = o.__P = null, e.__c = void 0;
}
if (o = e.__k) for (n = 0; n < o.length; n++) o[n] && Xe(o[n], t, r || typeof e.type != "function");
r || e.__e == null || cr(e.__e), e.__ = e.__e = e.__d = void 0;
}
function _n(e, t, r) {
return this.constructor(e, r);
}
function se(e, t, r) {
var o, n, i, a;
C.__ && C.__(e, t), n = (o = typeof r == "function") ? null : r && r.__k || t.__k, i = [], a = [], nt(t, e = (!o && r || t).__k = V(z, null, [e]), n || me, me, t.ownerSVGElement !== void 0, !o && r ? [r] : n ? null : t.firstChild ? ge.call(t.childNodes) : null, i, !o && r ? r : n ? n.__e : t.firstChild, o, a), _r(i, e, a);
}
function hr(e, t) {
se(e, t, hr);
}
function hn(e, t, r) {
var o, n, i, a, s = B({}, e.props);
for (i in e.type && e.type.defaultProps && (a = e.type.defaultProps), t) i == "key" ? o = t[i] : i == "ref" ? n = t[i] : s[i] = t[i] === void 0 && a !== void 0 ? a[i] : t[i];
return arguments.length > 2 && (s.children = arguments.length > 3 ? ge.call(arguments, 2) : r), fe(e.type, s, o || e.key, n || e.ref, null);
}
function gr(e, t) {
var r = { __c: t = "__cC" + lr++, __: e, Consumer: function(o, n) {
return o.children(n);
}, Provider: function(o) {
var n, i;
return this.getChildContext || (n = [], (i = {})[t] = this, this.getChildContext = function() {
return i;
}, this.shouldComponentUpdate = function(a) {
this.props.value !== a.value && n.some(function(s) {
s.__e = !0, Ye(s);
});
}, this.sub = function(a) {
n.push(a);
var s = a.componentWillUnmount;
a.componentWillUnmount = function() {
n.splice(n.indexOf(a), 1), s && s.call(a);
};
}), o.children;
} };
return r.Provider.__ = r.Consumer.contextType = r;
}
ge = ur.slice, C = { __e: function(e, t, r, o) {
for (var n, i, a; t = t.__; ) if ((n = t.__c) && !n.__) try {
if ((i = n.constructor) && i.getDerivedStateFromError != null && (n.setState(i.getDerivedStateFromError(e)), a = n.__d), n.componentDidCatch != null && (n.componentDidCatch(e, o || {}), a = n.__d), a) return n.__E = n;
} catch (s) {
e = s;
}
throw e;
} }, ar = 0, F.prototype.setState = function(e, t) {
var r;
r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = B({}, this.state), typeof e == "function" && (e = e(B({}, r), this.props)), e && B(r, e), e != null && this.__v && (t && this._sb.push(t), Ye(this));
}, F.prototype.forceUpdate = function(e) {
this.__v && (this.__e = !0, e && this.__h.push(e), Ye(this));
}, F.prototype.render = z, Z = [], sr = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Je = function(e, t) {
return e.__v.__b - t.__v.__b;
}, Ae.__r = 0, lr = 0;
var gn = 0;
function S(e, t, r, o, n, i) {
var a, s, l = {};
for (s in t) s == "ref" ? a = t[s] : l[s] = t[s];
var u = { type: e, props: l, key: r, ref: a, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --gn, __i: -1, __u: 0, __source: n, __self: i };
if (typeof e == "function" && (a = e.defaultProps)) for (s in a) l[s] === void 0 && (l[s] = a[s]);
return C.vnode && C.vnode(u), u;
}
var Q, E, He, xt, le = 0, yr = [], we = [], kt = C.__b, wt = C.__r, Ct = C.diffed, St = C.__c, It = C.unmount;
function X(e, t) {
C.__h && C.__h(E, e, le || t), le = 0;
var r = E.__H || (E.__H = { __: [], __h: [] });
return e >= r.__.length && r.__.push({ __V: we }), r.__[e];
}
function J(e) {
return le = 1, it(kr, e);
}
function it(e, t, r) {
var o = X(Q++, 2);
if (o.t = e, !o.__c && (o.__ = [r ? r(t) : kr(void 0, t), function(s) {
var l = o.__N ? o.__N[0] : o.__[0], u = o.t(l, s);
l !== u && (o.__N = [u, o.__[1]], o.__c.setState({}));
}], o.__c = E, !E.u)) {
var n = function(s, l, u) {
if (!o.__c.__H) return !0;
var d = o.__c.__H.__.filter(function(_) {
return _.__c;
});
if (d.every(function(_) {
return !_.__N;
})) return !i || i.call(this, s, l, u);
var c = !1;
return d.forEach(function(_) {
if (_.__N) {
var p = _.__[0];
_.__ = _.__N, _.__N = void 0, p !== _.__[0] && (c = !0);
}
}), !(!c && o.__c.props === s) && (!i || i.call(this, s, l, u));
};
E.u = !0;
var i = E.shouldComponentUpdate, a = E.componentWillUpdate;
E.componentWillUpdate = function(s, l, u) {
if (this.__e) {
var d = i;
i = void 0, n(s, l, u), i = d;
}
a && a.call(this, s, l, u);
}, E.shouldComponentUpdate = n;
}
return o.__N || o.__;
}
function H(e, t) {
var r = X(Q++, 3);
!C.__s && st(r.__H, t) && (r.__ = e, r.i = t, E.__H.__h.push(r));
}
function ye(e, t) {
var r = X(Q++, 4);
!C.__s && st(r.__H, t) && (r.__ = e, r.i = t, E.__h.push(r));
}
function Y(e) {
return le = 5, ee(function() {
return { current: e };
}, []);
}
function br(e, t, r) {
le = 6, ye(function() {
return typeof e == "function" ? (e(t()), function() {
return e(null);
}) : e ? (e.current = t(), function() {
return e.current = null;
}) : void 0;
}, r == null ? r : r.concat(e));
}
function ee(e, t) {
var r = X(Q++, 7);
return st(r.__H, t) ? (r.__V = e(), r.i = t, r.__h = e, r.__V) : r.__;
}
function Ee(e, t) {
return le = 8, ee(function() {
return e;
}, t);
}
function vr(e) {
var t = E.context[e.__c], r = X(Q++, 9);
return r.c = e, t ? (r.__ == null && (r.__ = !0, t.sub(E)), t.props.value) : e.__;
}
function at(e, t) {
C.useDebugValue && C.useDebugValue(t ? t(e) : e);
}
function xr() {
var e = X(Q++, 11);
if (!e.__) {
for (var t = E.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__;
var r = t.__m || (t.__m = [0, 0]);
e.__ = "P" + r[0] + "-" + r[1]++;
}
return e.__;
}
function yn() {
for (var e; e = yr.shift(); ) if (e.__P && e.__H) try {
e.__H.__h.forEach(Ce), e.__H.__h.forEach(et), e.__H.__h = [];
} catch (t) {
e.__H.__h = [], C.__e(t, e.__v);
}
}
C.__b = function(e) {
E = null, kt && kt(e);
}, C.__r = function(e) {
wt && wt(e), Q = 0;
var t = (E = e.__c).__H;
t && (He === E ? (t.__h = [], E.__h = [], t.__.forEach(function(r) {
r.__N && (r.__ = r.__N), r.__V = we, r.__N = r.i = void 0;
})) : (t.__h.forEach(Ce), t.__h.forEach(et), t.__h = [], Q = 0)), He = E;
}, C.diffed = function(e) {
Ct && Ct(e);
var t = e.__c;
t && t.__H && (t.__H.__h.length && (yr.push(t) !== 1 && xt === C.requestAnimationFrame || ((xt = C.requestAnimationFrame) || bn)(yn)), t.__H.__.forEach(function(r) {
r.i && (r.__H = r.i), r.__V !== we && (r.__ = r.__V), r.i = void 0, r.__V = we;
})), He = E = null;
}, C.__c = function(e, t) {
t.some(function(r) {
try {
r.__h.forEach(Ce), r.__h = r.__h.filter(function(o) {
return !o.__ || et(o);
});
} catch (o) {
t.some(function(n) {
n.__h && (n.__h = []);
}), t = [], C.__e(o, r.__v);
}
}), St && St(e, t);
}, C.unmount = function(e) {
It && It(e);
var t, r = e.__c;
r && r.__H && (r.__H.__.forEach(function(o) {
try {
Ce(o);
} catch (n) {
t = n;
}
}), r.__H = void 0, t && C.__e(t, r.__v));
};
var Rt = typeof requestAnimationFrame == "function";
function bn(e) {
var t, r = function() {
clearTimeout(o), Rt && cancelAnimationFrame(t), setTimeout(e);
}, o = setTimeout(r, 100);
Rt && (t = requestAnimationFrame(r));
}
function Ce(e) {
var t = E, r = e.__c;
typeof r == "function" && (e.__c = void 0, r()), E = t;
}
function et(e) {
var t = E;
e.__c = e.__(), E = t;
}
function st(e, t) {
return !e || e.length !== t.length || t.some(function(r, o) {
return r !== e[o];
});
}
function kr(e, t) {
return typeof t == "function" ? t(e) : t;
}
function wr(e, t) {
for (var r in t) e[r] = t[r];
return e;
}
function tt(e, t) {
for (var r in e) if (r !== "__source" && !(r in t)) return !0;
for (var o in t) if (o !== "__source" && e[o] !== t[o]) return !0;
return !1;
}
function je(e) {
this.props = e;
}
function Cr(e, t) {
function r(n) {
var i = this.props.ref, a = i == n.ref;
return !a && i && (i.call ? i(null) : i.current = null), t ? !t(this.props, n) || !a : tt(this.props, n);
}
function o(n) {
return this.shouldComponentUpdate = r, V(e, n);
}
return o.displayName = "Memo(" + (e.displayName || e.name) + ")", o.prototype.isReactComponent = !0, o.__f = !0, o;
}
(je.prototype = new F()).isPureReactComponent = !0, je.prototype.shouldComponentUpdate = function(e, t) {
return tt(this.props, e) || tt(this.state, t);
};
var At = C.__b;
C.__b = function(e) {
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), At && At(e);
};
var vn = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
function lt(e) {
function t(r) {
var o = wr({}, r);
return delete o.ref, e(o, r.ref || null);
}
return t.$$typeof = vn, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
}
var Et = function(e, t) {
return e == null ? null : $($(e).map(t));
}, Sr = { map: Et, forEach: Et, count: function(e) {
return e ? $(e).length : 0;
}, only: function(e) {
var t = $(e);
if (t.length !== 1) throw "Children.only";
return t[0];
}, toArray: $ }, xn = C.__e;
C.__e = function(e, t, r, o) {
if (e.then) {
for (var n, i = t; i = i.__; ) if ((n = i.__c) && n.__c) return t.__e == null && (t.__e = r.__e, t.__k = r.__k), n.__c(e, t);
}
xn(e, t, r, o);
};
var jt = C.unmount;
function Ir(e, t, r) {
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
typeof o.__c == "function" && o.__c();
}), e.__c.__H = null), (e = wr({}, e)).__c != null && (e.__c.__P === r && (e.__c.__P = t), e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
return Ir(o, t, r);
})), e;
}
function Rr(e, t, r) {
return e && r && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
return Rr(o, t, r);
}), e.__c && e.__c.__P === t && (e.__e && r.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = r)), e;
}
function ie() {
this.__u = 0, this.t = null, this.__b = null;
}
function Ar(e) {
var t = e.__.__c;
return t && t.__a && t.__a(e);
}
function Te(e) {
var t, r, o;
function n(i) {
if (t || (t = e()).then(function(a) {
r = a.default || a;
}, function(a) {
o = a;
}), o) throw o;
if (!r) throw t;
return V(r, i);
}
return n.displayName = "Lazy", n.__f = !0, n;
}
function ne() {
this.u = null, this.o = null;
}
C.unmount = function(e) {
var t = e.__c;
t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), jt && jt(e);
}, (ie.prototype = new F()).__c = function(e, t) {
var r = t.__c, o = this;
o.t == null && (o.t = []), o.t.push(r);
var n = Ar(o.__v), i = !1, a = function() {
i || (i = !0, r.__R = null, n ? n(s) : s());
};
r.__R = a;
var s = function() {
if (!--o.__u) {
if (o.state.__a) {
var l = o.state.__a;
o.__v.__k[0] = Rr(l, l.__c.__P, l.__c.__O);
}
var u;
for (o.setState({ __a: o.__b = null }); u = o.t.pop(); ) u.forceUpdate();
}
};
o.__u++ || 32 & t.__u || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(a, a);
}, ie.prototype.componentWillUnmount = function() {
this.t = [];
}, ie.prototype.render = function(e, t) {
if (this.__b) {
if (this.__v.__k) {
var r = document.createElement("div"), o = this.__v.__k[0].__c;
this.__v.__k[0] = Ir(this.__b, r, o.__O = o.__P);
}
this.__b = null;
}
var n = t.__a && V(z, null, e.fallback);
return n && (n.__u &= -33), [V(z, null, t.__a ? null : e.children), n];
};
var Nt = function(e, t, r) {
if (++r[1] === r[0] && e.o.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.o.size)) for (r = e.u; r; ) {
for (; r.length > 3; ) r.pop()();
if (r[1] < r[0]) break;
e.u = r = r[2];
}
};
function kn(e) {
return this.getChildContext = function() {
return e.context;
}, e.children;
}
function wn(e) {
var t = this, r = e.i;
t.componentWillUnmount = function() {
se(null, t.l), t.l = null, t.i = null;
}, t.i && t.i !== r && t.componentWillUnmount(), t.l || (t.i = r, t.l = { nodeType: 1, parentNode: r, childNodes: [], appendChild: function(o) {
this.childNodes.push(o), t.i.appendChild(o);
}, insertBefore: function(o, n) {
this.childNodes.push(o), t.i.appendChild(o);
}, removeChild: function(o) {
this.childNodes.splice(this.childNodes.indexOf(o) >>> 1, 1), t.i.removeChild(o);
} }), se(V(kn, { context: t.context }, e.__v), t.l);
}
function Er(e, t) {
var r = V(wn, { __v: e, i: t });
return r.containerInfo = t, r;
}
(ne.prototype = new F()).__a = function(e) {
var t = this, r = Ar(t.__v), o = t.o.get(e);
return o[0]++, function(n) {
var i = function() {
t.props.revealOrder ? (o.push(n), Nt(t, e, o)) : n();
};
r ? r(i) : i();
};
}, ne.prototype.render = function(e) {
this.u = null, this.o = /* @__PURE__ */ new Map();
var t = $(e.children);
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
for (var r = t.length; r--; ) this.o.set(t[r], this.u = [1, 0, this.u]);
return e.children;
}, ne.prototype.componentDidUpdate = ne.prototype.componentDidMount = function() {
var e = this;
this.o.forEach(function(t, r) {
Nt(e, r, t);
});
};
var jr = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Cn = /^(?: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]/, Sn = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, In = /[A-Z0-9]/g, Rn = typeof document < "u", An = function(e) {
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
};
function Nr(e, t, r) {
return t.__k == null && (t.textContent = ""), se(e, t), typeof r == "function" && r(), e ? e.__c : null;
}
function Lr(e, t, r) {
return hr(e, t), typeof r == "function" && r(), e ? e.__c : null;
}
F.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
Object.defineProperty(F.prototype, e, { configurable: !0, get: function() {
return this["UNSAFE_" + e];
}, set: function(t) {
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
} });
});
var Lt = C.event;
function En() {
}
function jn() {
return this.cancelBubble;
}
function Nn() {
return this.defaultPrevented;
}
C.event = function(e) {
return Lt && (e = Lt(e)), e.persist = En, e.isPropagationStopped = jn, e.isDefaultPrevented = Nn, e.nativeEvent = e;
};
var ut, Ln = { enumerable: !1, configurable: !0, get: function() {
return this.class;
} }, Ut = C.vnode;
C.vnode = function(e) {
typeof e.type == "string" && function(t) {
var r = t.props, o = t.type, n = {};
for (var i in r) {
var a = r[i];
if (!(i === "value" && "defaultValue" in r && a == null || Rn && i === "children" && o === "noscript" || i === "class" || i === "className")) {
var s = i.toLowerCase();
i === "defaultValue" && "value" in r && r.value == null ? i = "value" : i === "download" && a === !0 ? a = "" : s === "ondoubleclick" ? i = "ondblclick" : s !== "onchange" || o !== "input" && o !== "textarea" || An(r.type) ? s === "onfocus" ? i = "onfocusin" : s === "onblur" ? i = "onfocusout" : Sn.test(i) ? i = s : o.indexOf("-") === -1 && Cn.test(i) ? i = i.replace(In, "-$&").toLowerCase() : a === null && (a = void 0) : s = i = "oninput", s === "oninput" && n[i = s] && (i = "oninputCapture"), n[i] = a;
}
}
o == "select" && n.multiple && Array.isArray(n.value) && (n.value = $(r.children).forEach(function(l) {
l.props.selected = n.value.indexOf(l.props.value) != -1;
})), o == "select" && n.defaultValue != null && (n.value = $(r.children).forEach(function(l) {
l.props.selected = n.multiple ? n.defaultValue.indexOf(l.props.value) != -1 : n.defaultValue == l.props.value;
})), r.class && !r.className ? (n.class = r.class, Object.defineProperty(n, "className", Ln)) : (r.className && !r.class || r.class && r.className) && (n.class = n.className = r.className), t.props = n;
}(e), e.$$typeof = jr, Ut && Ut(e);
};
var Tt = C.__r;
C.__r = function(e) {
Tt && Tt(e), ut = e.__c;
};
var Ot = C.diffed;
C.diffed = function(e) {
Ot && Ot(e);
var t = e.props, r = e.__e;
r != null && e.type === "textarea" && "value" in t && t.value !== r.value && (r.value = t.value == null ? "" : t.value), ut = null;
};
var Ur = { ReactCurrentDispatcher: { current: { readContext: function(e) {
return ut.__n[e.__c].props.value;
} } } };
function Tr(e) {
return V.bind(null, e);
}
function be(e) {
return !!e && e.$$typeof === jr;
}
function Or(e) {
return be(e) && e.type === z;
}
function Vr(e) {
return be(e) ? hn.apply(null, arguments) : e;
}
function Ne(e) {
return !!e.__k && (se(null, e), !0);
}
function qr(e) {
return e && (e.base || e.nodeType === 1 && e) || null;
}
var Hr = function(e, t) {
return e(t);
}, Pr = function(e, t) {
return e(t);
}, Mr = z;
function ct(e) {
e();
}
function Fr(e) {
return e;
}
function zr() {
return [!1, ct];
}
var Dr = ye, Br = be;
function $r(e, t) {
var r = t(), o = J({ h: { __: r, v: t } }), n = o[0].h, i = o[1];
return ye(function() {
n.__ = r, n.v = t, Pe(n) && i({ h: n });
}, [e, r, t]), H(function() {
return Pe(n) && i({ h: n }), e(function() {
Pe(n) && i({ h: n });
});
}, [e]), r;
}
function Pe(e) {
var t, r, o = e.v, n = e.__;
try {
var i = o();
return !((t = n) === (r = i) && (t !== 0 || 1 / t == 1 / r) || t != t && r != r);
} catch {
return !0;
}
}
var Un = { useState: J, useId: xr, useReducer: it, useEffect: H, useLayoutEffect: ye, useInsertionEffect: Dr, useTransition: zr, useDeferredValue: Fr, useSyncExternalStore: $r, startTransition: ct, useRef: Y, useImperativeHandle: br, useMemo: ee, useCallback: Ee, useContext: vr, useDebugValue: at, version: "17.0.2", Children: Sr, render: Nr, hydrate: Lr, unmountComponentAtNode: Ne, createPortal: Er, createElement: V, createContext: gr, createFactory: Tr, cloneElement: Vr, createRef: dr, Fragment: z, isValidElement: be, isElement: Br, isFragment: Or, findDOMNode: qr, Component: F, PureComponent: je, memo: Cr, forwardRef: lt, flushSync: Pr, unstable_batchedUpdates: Hr, StrictMode: Mr, Suspense: ie, SuspenseList: ne, lazy: Te, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Ur };
const Tn = Object.freeze(Object.defineProperty({ __proto__: null, Children: Sr, Component: F, Fragment: z, PureComponent: je, StrictMode: Mr, Suspense: ie, SuspenseList: ne, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Ur, cloneElement: Vr, createContext: gr, createElement: V, createFactory: Tr, createPortal: Er, createRef: dr, default: Un, findDOMNode: qr, flushSync: Pr, forwardRef: lt, hydrate: Lr, isElement: Br, isFragment: Or, isValidElement: be, lazy: Te, memo: Cr, render: Nr, startTransition: ct, unmountComponentAtNode: Ne, unstable_batchedUpdates: Hr, useCallback: Ee, useContext: vr, useDebugValue: at, useDeferredValue: Fr, useEffect: H, useErrorBoundary: function(e) {
var t = X(Q++, 10), r = J();
return t.__ = e, E.componentDidCatch || (E.componentDidCatch = function(o, n) {
t.__ && t.__(o, n), r[1](o);
}), [r[0], function() {
r[1](void 0);
}];
}, useId: xr, useImperativeHandle: br, useInsertionEffect: Dr, useLayoutEffect: ye, useMemo: ee, useReducer: it, useRef: Y, useState: J, useSyncExternalStore: $r, useTransition: zr, version: "17.0.2" }, Symbol.toStringTag, { value: "Module" })), Vt = (e) => {
let t;
const r = /* @__PURE__ */ new Set(), o = (a, s) => {
const l = typeof a == "function" ? a(t) : a;
if (!Object.is(l, t)) {
const u = t;
t = s ?? typeof l != "object" ? l : Object.assign({}, t, l), r.forEach((d) => d(t, u));
}
}, n = () => t, i = { setState: o, getState: n, subscribe: (a) => (r.add(a), () => r.delete(a)), destroy: () => r.clear() };
return t = e(o, n, i), i;
};
function On(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function Vn(e) {
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
var t = e.default;
if (typeof t == "function") {
var r = function o() {
return this instanceof o ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
r.prototype = t.prototype;
} else r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
var n = Object.getOwnPropertyDescriptor(e, o);
Object.defineProperty(r, o, n.get ? n : { enumerable: !0, get: function() {
return e[o];
} });
}), r;
}
var qt = { exports: {} }, Me = {};
const Qr = Vn(Tn);
var Ht, Pt, Mt, Ft, zt = { exports: {} }, Fe = {};
function qn() {
return Pt || (Pt = 1, zt.exports = function() {
if (Ht) return Fe;
Ht = 1;
var e = Qr, t = typeof Object.is == "function" ? Object.is : function(l, u) {
return l === u && (l !== 0 || 1 / l == 1 / u) || l != l && u != u;
}, r = e.useState, o = e.useEffect, n = e.useLayoutEffect, i = e.useDebugValue;
function a(l) {
var u = l.getSnapshot;
l = l.value;
try {
var d = u();
return !t(l, d);
} catch {
return !0;
}
}
var s = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? function(l, u) {
return u();
} : function(l, u) {
var d = u(), c = r({ inst: { value: d, getSnapshot: u } }), _ = c[0].inst, p = c[1];
return n(function() {
_.value = d, _.getSnapshot = u, a(_) && p({ inst: _ });
}, [l, d, u]), o(function() {
return a(_) && p({ inst: _ }), l(function() {
a(_) && p({ inst: _ });
});
}, [l]), i(d), d;
};
return Fe.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : s, Fe;
}()), zt.exports;
}
var Hn = (Ft || (Ft = 1, qt.exports = function() {
if (Mt) return Me;
Mt = 1;
var e = Qr, t = qn(), r = typeof Object.is == "function" ? Object.is : function(l, u) {
return l === u && (l !== 0 || 1 / l == 1 / u) || l != l && u != u;
}, o = t.useSyncExternalStore, n = e.useRef, i = e.useEffect, a = e.useMemo, s = e.useDebugValue;
return Me.useSyncExternalStoreWithSelector = function(l, u, d, c, _) {
var p = n(null);
if (p.current === null) {
var y = { hasValue: !1, value: null };
p.current = y;
} else y = p.current;
p = a(function() {
function g(h) {
if (!k) {
if (k = !0, x = h, h = c(h), _ !== void 0 && y.hasValue) {
var v = y.value;
if (_(v, h)) return f = v;
}
return f = h;
}
if (v = f, r(x, h)) return v;
var b = c(h);
return _ !== void 0 && _(v, b) ? v : (x = h, f = b);
}
var x, f, k = !1, w = d === void 0 ? null : d;
return [function() {
return g(u());
}, w === null ? void 0 : function() {
return g(w());
}];
}, [u, d, c, _]);
var m = o(l, p[0], p[1]);
return i(function() {
y.hasValue = !0, y.value = m;
}, [m]), s(m), m;
}, Me;
}()), qt.exports);
const Pn = On(Hn), { useSyncExternalStoreWithSelector: Mn } = Pn, Dt = (e) => {
const t = typeof e == "function" ? ((o) => o ? Vt(o) : Vt)(e) : e, r = (o, n) => function(i, a = i.getState, s) {
const l = Mn(i.subscribe, i.getState, i.getServerState || i.getState, a, s);
return at(l), l;
}(t, o, n);
return Object.assign(r, t), r;
}, Fn = (e) => e ? Dt(e) : Dt;
var zn = ((e) => (e.RIGHT = "right", e.LEFT = "left", e))(zn || {});
const ze = (e) => e != null && typeof e == "object" && typeof Reflect.get(e, "taskStatus") == "string", Bt = (e) => e != null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((t) => t === null || typeof t == "string"), $t = (e) => e != null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((t) => t === null || typeof t == "number"), Qt = (e) => Array.isArray(e) && e.every((t) => Array.isArray(t) && t.every((r) => {
if (typeof r != "object" || r === null) return !1;
const o = Reflect.get(r, "selected");
return o === "left" || o === "right" || o === null;
})), rt = (e, t) => {
const { allowUndefined: r = !0, rejectBooleanRecord: o = !1 } = t ?? {};
if (e === void 0) return r;
if (e === null || typeof e == "string" || typeof e == "number" || Array.isArray(e)) return !0;
if (typeof e == "object" && e !== null) {
if (o) {
const n = Object.values(e);
if (n.length > 0 && n.every((i) => typeof i == "boolean")) return !1;
}
return !0;
}
return !1;
}, dt = (e, t) => {
var r;
if (t === null) return null;
if (e.type === "texturlprompt") return ((o) => o === void 0 || typeof o == "object" && o !== null && "skipped" in o)(t) ? t : void 0;
if (t === void 0) return null;
if (e.type === "consentlegal") return typeof t == "object" && "submitted" in t && t.submitted === !0 ? t : null;
if (e.type === "multipleselect") {
const o = (r = e.props) == null ? void 0 : r.options;
if (Array.isArray(o) && ((n) => typeof n == "object" && n !== null && !Array.isArray(n) && Object.values(n).every((i) => typeof i == "boolean"))(t)) {
const n = t;
return o.reduce((i, a) => (n[String(a.id)] && i.push(a.value), i), []);
}
}
if (e.type === "multiplechoice") {
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
if (Object.keys(t).length === 0) return null;
const o = Object.values(t).find((n) => n !== !1 && n !== void 0);
if (o !== void 0) return o;
}
return rt(t, { allowUndefined: !1, rejectBooleanRecord: !0 }) ? t : null;
}
return rt(t, { allowUndefined: !1, rejectBooleanRecord: !0 }) ? t : null;
}, wo = ({ storeAllResponses: e, cards: t, cardValues: r, cardIndexByName: o }) => {
const n = e ? [...e] : [];
if (o === void 0) return n;
for (const i of t) {
const a = o[i.name];
if (typeof a != "number") continue;
const s = r[i.name];
(s == null ? void 0 : s.value) !== void 0 && (n[a] = dt(i, s.value));
}
return n;
}, Dn = /<piped-value\b([^>]*)>.*?<\/piped-value>/gis, Wt = ["questionHtml", "captionHtml", "footerHtml", "richTextBody"], pt = (e) => !!e.props && typeof e.props == "object" && "properties" in e.props, De = (e) => !!e.props && typeof e.props == "object" && "options" in e.props && Array.isArray(e.props.options), Zt = (e) => ["string", "number"].includes(typeof e), Gt = (e) => e.length === 0 ? "" : e.length === 1 ? e[0] : e.join(", "), Bn = (e) => {
var r, o;
const t = ((n) => n != null && typeof n == "object" && "value" in n)(e) ? e.value : void 0;
if (t != null) {
if (e.type === "multipleselect" && De(e) && ((n) => !!n && typeof n == "object" && !Array.isArray(n))(t)) {
const n = e.secondaryValue ?? null, i = e.props.options.filter((a) => t[String(a.id)] === !0).map((a) => {
var s;
return a.label + ((s = n == null ? void 0 : n[String(a.id)]) != null && s.userText ? `: ${n[String(a.id)].userText}` : "");
});
return i.length ? Gt(i) : "No options selected";
}
if (e.type === "multiplechoice" && typeof t == "object" && t !== null) {
const n = Object.keys(t);
if (n.length === 0) return "No options selected";
const i = e.secondaryValue ?? null, a = n[0];
if (a) {
const s = e.props.options.find((l) => String(l.id) === a);
return (s == null ? void 0 : s.label) + ((r = i == null ? void 0 : i[a]) != null && r.userText ? `: ${(o = i == null ? void 0 : i[a]) == null ? void 0 : o.userText}` : "");
}
}
if (e.type === "matrix" && De(e) && ((n) => {
if (!pt(n)) return !1;
const i = n.props.properties;
return !!i && typeof i == "object" && "matrixColumn" in i;
})(e)) {
const n = e.props.options, i = e.props.properties.matrixColumn, a = [];
for (const [s, l] of Object.entries(t)) {
const u = n.find((y) => String(y.id) === s), d = (u == null ? void 0 : u.label) ?? s, c = Zt(l) ? String(l) : JSON.stringify(l), _ = i.find((y) => y.value === c), p = (_ == null ? void 0 : _.label) ?? c;
a.push(`${d}: ${p}`);
}
return a.join("; ");
}
if (e.type === "rankorder" && De(e)) {
const n = e.props.options.reduce((a, s) => (a[String(s.id)] = s.label, a), {}), i = [];
for (const [a, s] of Object.entries(t)) {
const l = n[a];
l && (i[s - 1] = l);
}
return Gt(i);
}
if (Zt(t)) {
const n = String(t).replaceAll(/[\u200B-\u200D\uFEFF]/g, "").trim();
return n === "" ? void 0 : n;
}
try {
return JSON.stringify(t);
} catch {
return String(t);
}
}
}, Co = (e, t) => e.map((r) => {
if (!pt(r) || r.props.properties === void 0 || r.props.properties === null) return r;
const o = r.props.properties;
if (o === null || typeof o != "object" || !Wt.some((a) => a in o)) return r;
let n = !1;
const i = {};
for (const a of Wt) {
const s = o[a];
if (s !== void 0) {
const l = $n(s, t);
i[a] = l, l !== s && (n = !0);
}
}
return n ? { ...r, props: { ...r.props, properties: { ...o, ...i } } } : r;
}), Kt = (e, t) => {
const r = new RegExp(`${t}="([^"]*)"`, "i").exec(e);
return (r == null ? void 0 : r[1]) ?? null;
}, $n = (e, t) => {
if (e == null) return e;
let r = !1;
const o = e.replace(Dn, (n, i) => {
r = !0;
const a = Kt(i, "answer-id"), s = Kt(i, "fallback-text") ?? "";
if (!a) return s;
const l = a.startsWith("attr-") ? a : Number(a);
if (Object.hasOwn(t, l)) {
const u = t[l];
return String(u);
}
return s;
});
return r ? o : e;
}, Wr = (e, t) => {
const r = {};
if (t) for (const [o, n] of Object.entries(t)) typeof n == "string" ? r[`attr-${o}`] = n : n != null && (r[`attr-${o}`] = JSON.stringify(n));
for (const o of e) {
const n = Bn(o);
n !== void 0 && (r[o.name] = n);
}
return r;
}, So = (e) => {
var t;
return pt(e) && ((t = e.props.properties) != null && t.questionHtml) && typeof e.props.properties.questionHtml == "string" ? e.props.properties.questionHtml.replace(/<[^>]*>/g, "").trim() : e.props && "message" in e.props && typeof e.props.message == "string" ? e.props.message.trim() : e.props && "questionHtml" in e.props && typeof e.props.questionHtml == "string" ? e.props.questionHtml.replace(/<[^>]*>/g, "").trim() : "";
}, Qn = (e, t, r) => {
switch (t) {
case "videovoice":
return !!(e != null && e.value);
case "open":
return !!r;
case "multipleselect":
return !!(r && Object.keys(r).length);
case "recordedtask":
return r !== null && typeof r == "object" && "taskStatus" in r && r.taskStatus === "completed";
case "texturlprompt":
return !e.value;
case "consentlegal":
case "nps":
case "likert":
return r !== null;
case "multiplechoice":
return r !== void 0;
case "matrix":
return !!(r && Object.values(r).every((o) => o !== null));
default:
return !0;
}
}, Zr = (e, t) => {
if (t === "matrix" && e && typeof e == "object") {
const r = Object.keys(e).length, o = Object.values(e).filter((n) => n !== null).length;
return o > 0 && o < r;
}
return !1;
}, Le = (e) => e == null ? "" : typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : String(e), oe = { eq: (e, t) => Number(e) === Number(t), neq: (e, t) => !oe.eq(e, t), gt: (e, t) => Number(e) > Number(t), gte: (e, t) => Number(e) >= Number(t), lt: (e, t) => Number(e) < Number(t), lte: (e, t) => Number(e) <= Number(t), list_exact(e, t) {
if (!Array.isArray(e) || !Array.isArray(t)) return !1;
const r = (o, n) => String(o).localeCompare(String(n));
return e.slice().sort(r).join(",") === t.slice().sort(r).join(",");
}, list_all: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && !t.some((r) => !e.includes(r)), list_alo(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.some((n) => o.has(n));
}, list_dni(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.every((n) => !o.has(n));
}, contains(e, t) {
const r = Le(e).toLowerCase(), o = Le(t).toLowerCase();
return r.includes(o);
}, notcontains: (e, t) => !oe.contains(e, t) }, _e = { eq: (e, t) => e == t, neq: (e, t) => !_e.eq(e, t), gt: (e, t) => Number(e) > Number(t), gte: (e, t) => Number(e) >= Number(t), lt: (e, t) => Number(e) < Number(t), lte: (e, t) => Number(e) <= Number(t), list_exact(e, t) {
if (!Array.isArray(e) || !Array.isArray(t)) return !1;
const r = (o, n) => String(o).localeCompare(String(n));
return e.slice().sort(r).join(",") === t.slice().sort(r).join(",");
}, list_all: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && !t.some((r) => !e.includes(r)), list_alo(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.some((n) => o.has(n));
}, list_dni(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.every((n) => !o.has(n));
}, contains(e, t) {
const r = String(e ?? "").toLowerCase(), o = String(t ?? "").toLowerCase();
return r.includes(o);
}, notcontains: (e, t) => !_e.contains(e, t) }, Wn = (e) => e in _e, Gr = 1, Zn = 2, Gn = (e) => {
var o, n, i;
switch (e.type) {
case "multipleselect":
return e && e.props && e.props.options ? e.props.options.length > 13 ? e.props.options.map((a) => [a.value]) : (t = e.props.options.map((a) => a.value), r = !e.props.properties.required, t.reduce((a, s) => a.concat(a.map((l) => [...l, s])), [[]]).filter((a) => r || a.length > 0)) : null;
case "multiplechoice": {
if (!e || !e.props || !e.props.options) return null;
const a = e.props.options.map((s) => s.value);
return e.props.properties.required || a.push(void 0), a;
}
case "matrix": {
if (!((o = e == null ? void 0 : e.props) != null && o.options)) return null;
const a = e.props.properties.matrixColumn, s = e.props.options, l = s.reduce((d, c) => (d[c.id] = null, d), {}), u = [{ ...l, [s[0].id]: a[0].value }, s.reduce((d, c) => (d[c.id] = a[0].value, d), {})];
return e.props.properties.required || u.push(l), u;
}
case "likert": {
const a = Number((i = (n = e.props) == null ? void 0 : n.properties) == null ? void 0 : i.range) || 5;
return [...Array.from(new Array(a).keys()).map((l) => l + 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 a = [{ taskStatus: "completed" }, { taskStatus: "given.up" }];
return e.props.properties.required || a.push({ taskStatus: "abandoned" }), a;
}
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, r;
}, Kn = (e) => typeof e == "object" && e !== null && "taskStatus" in e, Jn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "comparator" in e && "questionIndex" in e, Kr = (e, t) => {
const r = [];
for (const o of e) Array.isArray(o) ? r.push(...Kr(o, t)) : Jn(o) && o.questionIndex === t && r.push(o);
return r;
}, Yn = (e, t = []) => t.reduce((r, o) => {
const { group: n, target: i } = o;
if (!(n != null && n.length)) return [...r];
const a = Kr(n, e).map((s) => {
const { comparator: l, value: u } = s;
return { comparator: l, target: i, value: u };
});
return [...r, ...a];
}, []), Jr = (e, t, r) => r > 0 ? t ? e.length - 3 : e.length - 2 : t ? e.length - 2 : e.length - 1, Yr = ({ cards: e, index: t, hasEndCard: r, allResponses: o, uploadProgress: n = {}, surveyVisitorAttributes: i = {} }) => {
var c, _, p;
if (t >= e.length || t < 0) return null;
const a = e[t];
let s = t + 1;
const l = a.props.routingOptions || [];
for (const y of l) {
if (!Xr(y)) continue;
const { group: m, target: g } = y;
if (nn({ group: m, allResponses: o, cards: e, surveyVisitorAttributes: i })) {
s = g === -1 && r ? e.length - 1 : g;
break;
}
}
const u = e.findIndex((y) => y.type === "uploading"), d = Jr(e, r, u);
for (; s !== null && s !== -1 && s <= d && ((_ = (c = e[s]) == null ? void 0 : c.props) != null && _.displayLogic) && e[s].props.displayLogic.length > 0; ) {
const y = e[s].props.displayLogic || [];
if (rn({ displayLogic: y, allResponses: o, cards: e, surveyVisitorAttributes: i })) break;
s++;
}
if (s !== -1 && ((p = e == null ? void 0 : e[s]) != null && p.parentId)) {
const y = e.findIndex((m) => {
var g;
return m.name === ((g = e == null ? void 0 : e[s]) == null ? void 0 : g.parentId);
});
if (y > -1) {
const m = e[y], g = o[y], x = he({ comparator: "answered", type: m.type, response: g }), f = m.type === "matrix" && he({ comparator: "partial", type: m.type, response: g });
x || f || s++;
}
}
return t >= d || s === -1 || s !== null && s > d ? u > 0 && Object.values(n).some((m) => m.isSubmitted && !m.isComplete) ? u : r ? e.length - 1 : null : s === -1 ? null : s;
}, Xr = (e) => typeof e == "object" && e !== null && "group" in e, en = (e) => e === Gr || e === Zn, Jt = ({ segment: e, allResponses: t, cards: r, surveyVisitorAttributes: o }) => Array.isArray(e) ? tn({ segments: e, allResponses: t, cards: r, surveyVisitorAttributes: o }) : !en(e) && !!((n) => typeof n == "object" && n !== null && !Array.isArray(n) && "comparator" in n)(e) && (({ rule: n, allResponses: i, cards: a,