@sprig-technologies/sprig-bundled 2.40.1 → 2.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { u as z, a as e, h as G, c as A, g as K, b as le, d as Me, p as ce, F as fe, _ as oe, T as be, A as yn, e as Be, f as Cn, i as xn, j as kn, w as en, k as wn } from "./view-JArMqSNr.js";
2
- import { v as En, E as Ie, h as qe, A as Ue, j as jn, i as nn } from "./index-BZjOqtTO.js";
3
- import { B as se, M as re, Q as ue, O as Oe, a as ae, b as Ce, S as In, L as Tn, u as _n, H as ye, c as Ae, g as Dn, P as Sn } from "./getAttributedUrl-B0b2NdfZ.js";
4
- const pe = "https://cdn.sprig.com", T = { document: void 0, videojs: void 0 }, He = (n) => n + "-loading-spiner", W = "hidden", ze = ".m3u8", Te = "questionId", _e = "ul-video-recorder-camera-off-button", De = "ul-recording-in-session", Pn = [{ type: "link", content: `${pe}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${pe}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${pe}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${pe}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${pe}/userleap-web-upchunk-v2.2.2.js` }], tn = [{ type: "link", content: `${pe}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${pe}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
1
+ import { u as z, a as e, h as G, c as A, g as K, b as le, d as Me, p as ce, F as fe, _ as oe, T as be, A as yn, e as Be, f as Cn, i as xn, j as kn, w as en, k as wn } from "./view-xk7U3_Is.js";
2
+ import { v as En, E as Ie, h as qe, A as Ue, j as jn, i as nn } from "./index-DvlRB1H9.js";
3
+ import { B as se, M as re, Q as ue, O as Oe, a as ae, b as Ce, S as In, L as Tn, u as _n, H as ye, c as Ae, g as Dn, P as Sn } from "./getAttributedUrl-Dau8Mte7.js";
4
+ const pe = "https://cdn.sprig.com", I = { document: void 0, videojs: void 0 }, He = (n) => n + "-loading-spiner", W = "hidden", ze = ".m3u8", Te = "questionId", _e = "ul-video-recorder-camera-off-button", De = "ul-recording-in-session", Pn = [{ type: "link", content: `${pe}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${pe}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${pe}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${pe}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${pe}/userleap-web-upchunk-v2.2.2.js` }], tn = [{ type: "link", content: `${pe}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${pe}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
5
5
  .video-js .vjs-control {
6
6
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
7
7
  }
@@ -661,25 +661,25 @@ span.ul-button-text {
661
661
  ` }], rn = "-video-player", Ge = "-secondary-video-player", Ze = "-video-recorder";
662
662
  let ne, Qe;
663
663
  const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, metadata: a }) => {
664
- const d = T.document.documentElement;
664
+ const d = I.document.documentElement;
665
665
  if (!r || !i) return;
666
666
  const u = { event: `SDK - ${n}`, visitorId: r, environmentId: i, metadata: { ...a || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language } };
667
667
  (await fetch(`${o}/sdk/1/visitors/${r}/analytics`, { method: "POST", cache: "no-cache", headers: t, body: JSON.stringify(u) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", n);
668
668
  }, ie = async (n, o, t, r, i, a) => {
669
669
  de({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: i, envId: a, metadata: { errorMessage: n.message } });
670
- const d = T.document.documentElement, u = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language }, s = { action: o, err: { message: n.message, stack: n.stack }, meta: u, vid: i, envId: a };
670
+ const d = I.document.documentElement, u = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language }, s = { action: o, err: { message: n.message, stack: n.stack }, meta: u, vid: i, envId: a };
671
671
  (await fetch(`${t}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...r, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(s) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", n);
672
672
  }, on = (n, o) => {
673
673
  if (n.length === 0) return o && o();
674
674
  Promise.all(n.reduce((t, r) => (t.push(((i, { type: a, content: d }) => new Promise(function(u, s) {
675
675
  let p;
676
- a === "script" ? (p = T.document.createElement("script"), p.src = d) : a === "link" ? (p = T.document.createElement("link"), p.rel = "stylesheet", p.href = d, p.type = "text/css") : (p = T.document.createElement("style"), p.innerHTML = d), p.onload = function() {
676
+ a === "script" ? (p = I.document.createElement("script"), p.src = d) : a === "link" ? (p = I.document.createElement("link"), p.rel = "stylesheet", p.href = d, p.type = "text/css") : (p = I.document.createElement("style"), p.innerHTML = d), p.onload = function() {
677
677
  u(d);
678
678
  }, p.onerror = function() {
679
679
  s(d);
680
680
  }, p.async = !1, p.id = btoa(d), i.appendChild(p);
681
- }))(T.document.head, r)), t), [])).then(() => {
682
- T.videojs = T.document.defaultView.videojs, o && o();
681
+ }))(I.document.head, r)), t), [])).then(() => {
682
+ I.videojs = I.document.defaultView.videojs, o && o();
683
683
  }).catch(function(t) {
684
684
  console.log(t + " failed to load");
685
685
  });
@@ -691,10 +691,10 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
691
691
  n.innerHTML = `Uploading <span class="ul-upload-progress-label__time">${r}%</span>`, n.style.background = `linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`;
692
692
  }
693
693
  }, Se = (n, o) => {
694
- const t = T.videojs(n.id());
694
+ const t = I.videojs(n.id());
695
695
  return t == null ? void 0 : t.payload[o];
696
696
  }, sn = (n, o) => {
697
- const t = new (T.videojs.getComponent("Component"))(n);
697
+ const t = new (I.videojs.getComponent("Component"))(n);
698
698
  return t.addClass("ul-buttons-panel"), o.map((r) => {
699
699
  t.addChild(r);
700
700
  }), Rn(t), t;
@@ -706,14 +706,14 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
706
706
  }
707
707
  });
708
708
  }, xe = (n, o = "") => {
709
- const t = T.document.createElement("span");
709
+ const t = I.document.createElement("span");
710
710
  return t.className = "ul-button-text", t.innerHTML = n, t.id = o, t;
711
711
  }, an = (n, o, t, r, i = !1, a) => {
712
712
  n.addClass("ul-video-player");
713
- const d = new (T.videojs.getComponent("Component"))(n);
714
- d.addClass("ul-control-panel"), n.progressBar = d.addChild("ProgressControl"), t && n.src(t), n.audioPlayerPlaceholder = new (T.videojs.getComponent("Component"))(n), n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
713
+ const d = new (I.videojs.getComponent("Component"))(n);
714
+ d.addClass("ul-control-panel"), n.progressBar = d.addChild("ProgressControl"), t && n.src(t), n.audioPlayerPlaceholder = new (I.videojs.getComponent("Component"))(n), n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
715
715
  const u = t && t.src ? Bn(t.src) : null;
716
- !t || !i && u ? (n.audioPlayerPlaceholder.hide(), T.document.getElementById(`${n.id()}_html5_api`).style.height = "100%", u && n.poster(u)) : (n.children()[0].classList.add("vjs-hidden"), T.document.getElementById(`${n.id()}_html5_api`).style.height = "0px"), n.on("play", () => {
716
+ !t || !i && u ? (n.audioPlayerPlaceholder.hide(), I.document.getElementById(`${n.id()}_html5_api`).style.height = "100%", u && n.poster(u)) : (n.children()[0].classList.add("vjs-hidden"), I.document.getElementById(`${n.id()}_html5_api`).style.height = "0px"), n.on("play", () => {
717
717
  i || !t || u || Ln(n), a == null || a.play();
718
718
  }), n.on("pause", () => {
719
719
  a == null || a.pause();
@@ -727,60 +727,60 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
727
727
  const s = ke(o, { controls: !1, bigPlayButton: !1, fluid: !1, width: 1280, height: 720, playsinline: !0, plugins: { record: { audio: !0, video: { mandatory: { minWidth: 1280, minHeight: 720 } }, frameWidth: 1280, frameHeight: 720, maxLength: 600, autoMuteDevice: !0 } } });
728
728
  if (!s) return;
729
729
  s.payload = t;
730
- const { surveyId: p, questionId: b, responseGroupUid: c, visitorId: m, envId: x } = t;
731
- let y;
732
- const v = (l) => {
730
+ const { surveyId: p, questionId: b, responseGroupUid: c, visitorId: v, envId: x } = t;
731
+ let C;
732
+ const m = (l) => {
733
733
  const h = _e, j = _e + "-audio-only";
734
734
  Ye(s.uploadProgressLabel, "none"), ne && ne.startTime >= Qe && ne.abort();
735
- const O = T.document.getElementById("ul-camera-button");
736
- l ? (s.children()[0].classList.add("vjs-hidden"), w.removeClass(h), w.addClass(j), O.innerHTML = X.TurnOnCamera, s.audioPlayerPlaceholder.removeClass("vjs-hidden"), y == null || y.getTracks().forEach((S) => {
735
+ const O = I.document.getElementById("ul-camera-button");
736
+ l ? (s.children()[0].classList.add("vjs-hidden"), f.removeClass(h), f.addClass(j), O.innerHTML = X.TurnOnCamera, s.audioPlayerPlaceholder.removeClass("vjs-hidden"), C == null || C.getTracks().forEach((S) => {
737
737
  S.stop();
738
738
  }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((S) => {
739
- y = S, S.getVideoTracks().forEach((q) => {
739
+ C = S, S.getVideoTracks().forEach((q) => {
740
740
  q.enabled = !1;
741
741
  }), s.record().onDeviceReady(S);
742
- }).catch(s.record().onDeviceError.bind(s.record()))) : (y == null || y.getVideoTracks().forEach((S) => {
742
+ }).catch(s.record().onDeviceError.bind(s.record()))) : (C == null || C.getVideoTracks().forEach((S) => {
743
743
  S.enabled = !0;
744
- }), s.children()[0].classList.remove("vjs-hidden"), s.record().getDevice(), w.removeClass(j), w.addClass(h), O.innerHTML = X.TurnOffCamera, s.audioPlayerPlaceholder.addClass("vjs-hidden"));
745
- }, g = new (T.videojs.getComponent("Button"))(s, { clickHandler: () => {
746
- g.hasClass(W) || (de({ event: "Video Delete Button Clicked", apiBase: r, headers: d, visitorId: m, envId: x, metadata: { questionId: b, responseGroupUid: c, surveyId: p } }), v(s.cameraOff), i(M.DELETE, {}), w.removeClass(W), g.addClass(W));
744
+ }), s.children()[0].classList.remove("vjs-hidden"), s.record().getDevice(), f.removeClass(j), f.addClass(h), O.innerHTML = X.TurnOffCamera, s.audioPlayerPlaceholder.addClass("vjs-hidden"));
745
+ }, g = new (I.videojs.getComponent("Button"))(s, { clickHandler: () => {
746
+ g.hasClass(W) || (de({ event: "Video Delete Button Clicked", apiBase: r, headers: d, visitorId: v, envId: x, metadata: { questionId: b, responseGroupUid: c, surveyId: p } }), m(s.cameraOff), i(L.DELETE, {}), f.removeClass(W), g.addClass(W));
747
747
  } });
748
748
  g.addClass("ul-video-recorder-delete-button"), g.el_.appendChild(xe(X.DeleteButton, "ul-delete-button"));
749
- const D = T.document.getElementById(o), f = () => {
750
- D.classList.contains("vjs-fullscreen") && s.cameraOff ? D.style.display = "table" : D.style.display = "flex";
749
+ const _ = I.document.getElementById(o), M = () => {
750
+ _.classList.contains("vjs-fullscreen") && s.cameraOff ? _.style.display = "table" : _.style.display = "flex";
751
751
  };
752
- f();
753
- const w = new (T.videojs.getComponent("Button"))(s, { clickHandler: () => {
754
- s.record().isRecording() || (s.cameraOff = !s.cameraOff, de({ event: "Video Camera Button Clicked", apiBase: r, headers: d, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: b, responseGroupUid: c, surveyId: p, cameraOff: s.cameraOff } }), v(s.cameraOff), !g.hasClass(W) && g.addClass(W), i(M.DELETE, {}), f());
752
+ M();
753
+ const f = new (I.videojs.getComponent("Button"))(s, { clickHandler: () => {
754
+ s.record().isRecording() || (s.cameraOff = !s.cameraOff, de({ event: "Video Camera Button Clicked", apiBase: r, headers: d, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: b, responseGroupUid: c, surveyId: p, cameraOff: s.cameraOff } }), m(s.cameraOff), !g.hasClass(W) && g.addClass(W), i(L.DELETE, {}), M());
755
755
  } });
756
- w.addClass(_e), w.el_.appendChild(xe(X.TurnOffCamera, "ul-camera-button"));
757
- const k = new (T.videojs.getComponent("Button"))(s, { clickHandler: () => {
758
- const l = T.document.getElementById("ul-recorder-toggle");
759
- if (s.record().isRecording()) s.record().stop(), l && (l.innerHTML = X.RecordButton), k.removeClass(De), g.removeClass(W);
756
+ f.addClass(_e), f.el_.appendChild(xe(X.TurnOffCamera, "ul-camera-button"));
757
+ const y = new (I.videojs.getComponent("Button"))(s, { clickHandler: () => {
758
+ const l = I.document.getElementById("ul-recorder-toggle");
759
+ if (s.record().isRecording()) s.record().stop(), l && (l.innerHTML = X.RecordButton), y.removeClass(De), g.removeClass(W);
760
760
  else {
761
- const h = T.document.getElementById("ul-recording-countdown-screen");
762
- if (h) h.remove(), l && (l.innerHTML = X.RecordButton), v(s.cameraOff), i(M.DELETE, {}), w.removeClass(W), g.addClass(W), k.removeClass(De), I.show();
761
+ const h = I.document.getElementById("ul-recording-countdown-screen");
762
+ if (h) h.remove(), l && (l.innerHTML = X.RecordButton), m(s.cameraOff), i(L.DELETE, {}), f.removeClass(W), g.addClass(W), y.removeClass(De), k.show();
763
763
  else {
764
- k.addClass(De), I.hide(), w.addClass(W), g.addClass(W), l && (l.innerHTML = X.StopButton);
765
- const j = T.document.createElement("div");
766
- j.id = "ul-recording-countdown-screen", D.insertBefore(j, D.children[1]), j.style.height = `${D.offsetHeight}px`, ln(s, 3);
764
+ y.addClass(De), k.hide(), f.addClass(W), g.addClass(W), l && (l.innerHTML = X.StopButton);
765
+ const j = I.document.createElement("div");
766
+ j.id = "ul-recording-countdown-screen", _.insertBefore(j, _.children[1]), j.style.height = `${_.offsetHeight}px`, ln(s, 3);
767
767
  }
768
768
  }
769
769
  } });
770
- k.addClass("ul-video-recorder-toggle-button"), k.el_.appendChild(xe(X.RecordButton, "ul-recorder-toggle"));
771
- const R = T.document.createElement("p");
770
+ y.addClass("ul-video-recorder-toggle-button"), y.el_.appendChild(xe(X.RecordButton, "ul-recorder-toggle"));
771
+ const R = I.document.createElement("p");
772
772
  R.style.visibility = "hidden", R.className = "ul-upload-progress-label", n.appendChild(R), s.uploadProgressLabel = R;
773
- const N = sn(s, [g, w, "PlayToggle", k, "FullscreenToggle"]), I = N.children().find((l) => l.name_ === "FullscreenToggle");
774
- I.hasClass("vjs-disabled") && I.hide();
775
- const C = N.children().find((l) => l.name_ === "PlayToggle");
776
- C.hide(), g.addClass(W), an(s, N, a, !1, u), s.on("stopRecord", () => {
777
- k.hide(), C.show(), I.show(), g.removeClass(W);
773
+ const D = sn(s, [g, f, "PlayToggle", y, "FullscreenToggle"]), k = D.children().find((l) => l.name_ === "FullscreenToggle");
774
+ k.hasClass("vjs-disabled") && k.hide();
775
+ const w = D.children().find((l) => l.name_ === "PlayToggle");
776
+ w.hide(), g.addClass(W), an(s, D, a, !1, u), s.on("stopRecord", () => {
777
+ y.hide(), w.show(), k.show(), g.removeClass(W);
778
778
  }), s.on("deviceReady", () => {
779
- k.show(), C.hide(), g.addClass(W);
779
+ y.show(), w.hide(), g.addClass(W);
780
780
  }), ((l, h, j, O, S) => {
781
781
  const { surveyId: q, responseGroupUid: Q, visitorId: H, envId: U } = l.payload;
782
782
  l.on("deviceError", function() {
783
- console.warn("device error: ", l.deviceErrorCode), l.deviceErrorCode.message === "Permission denied" ? (l.deviceButton.addClass("permission-denied"), j && j(M.ERROR, { type: M.PERMISSION_DENIED }), de({ event: "Video Permission Denied", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { questionId: Se(l, Te), responseGroupUid: Q, surveyId: q } })) : (j && j(M.ERROR, { type: M.OTHER }), ie(new Error(l.deviceErrorCode.message), "recorderDeviceError", h, S, H, U));
783
+ console.warn("device error: ", l.deviceErrorCode), l.deviceErrorCode.message === "Permission denied" ? (l.deviceButton.addClass("permission-denied"), j && j(L.ERROR, { type: L.PERMISSION_DENIED }), de({ event: "Video Permission Denied", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { questionId: Se(l, Te), responseGroupUid: Q, surveyId: q } })) : (j && j(L.ERROR, { type: L.OTHER }), ie(new Error(l.deviceErrorCode.message), "recorderDeviceError", h, S, H, U));
784
784
  }), l.on("error", function(Z, Y) {
785
785
  ie(Y || l.error(), "recorderError", h, S, H, U);
786
786
  }), l.on("startRecord", function(Z, Y) {
@@ -790,10 +790,10 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
790
790
  const Z = Se(l, Te);
791
791
  if (!q) {
792
792
  const P = "internal error: missing fields in payload";
793
- return j && j(M.ERROR, { type: M.OTHER }), ie(new Error(P), "finishRecord", h, S, H, U), null;
793
+ return j && j(L.ERROR, { type: L.OTHER }), ie(new Error(P), "finishRecord", h, S, H, U), null;
794
794
  }
795
795
  l.record().stopDevice();
796
- const Y = l.cameraOff ? M.MEDIA_TYPE_AUDIO : M.MEDIA_TYPE_VIDEO, ee = En();
796
+ const Y = l.cameraOff ? L.MEDIA_TYPE_AUDIO : L.MEDIA_TYPE_VIDEO, ee = En();
797
797
  de({ event: "Video Record Finish", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { mediaRecordingUid: ee, questionId: Z, responseGroupUid: Q, surveyId: q, mediaType: Y } });
798
798
  const me = { surveyId: q, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: Y, mediaRecordingUid: ee };
799
799
  Z && (me.questionId = Z), Q && (me.responseGroupUid = Q), H && (me.visitorId = H);
@@ -801,21 +801,21 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
801
801
  const P = await fetch(`${h}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(me) });
802
802
  if (P.ok) {
803
803
  const B = await P.json();
804
- return j && j(M.UPLOAD_STARTED, { [M.UPLOAD_ID]: B.upload.id, [M.MEDIA_TYPE]: Y, [M.MEDIA_RECORDING_UID]: ee }), B.upload.url;
804
+ return j && j(L.UPLOAD_STARTED, { [L.UPLOAD_ID]: B.upload.id, [L.MEDIA_TYPE]: Y, [L.MEDIA_RECORDING_UID]: ee }), B.upload.url;
805
805
  }
806
- return j && j(M.ERROR, { type: M.OTHER, response: P }), ie(new Error("failed to get upload response with url"), "finishRecord", h, S, H, U), null;
806
+ return j && j(L.ERROR, { type: L.OTHER, response: P }), ie(new Error("failed to get upload response with url"), "finishRecord", h, S, H, U), null;
807
807
  })();
808
- E && (ne = T.document.defaultView.UpChunk.createUpload({ endpoint: E, file: new T.document.defaultView.File([l.recordedData], `recording ${Y} ${Date.now()}`), chunkSize: 5120 }), ne.startTime = Date.now(), de({ event: "Video Upload Start", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { mediaRecordingUid: ee, questionId: Z, responseGroupUid: Q, surveyId: q, mediaType: Y, url: E } }), ne.on("error", (P) => {
809
- O(l.uploadProgressLabel, "none"), j && j(M.UPLOAD_FINISHED, { [M.MEDIA_RECORDING_UID]: ee }), ie(P, "finishRecord", h, S, H, U);
808
+ E && (ne = I.document.defaultView.UpChunk.createUpload({ endpoint: E, file: new I.document.defaultView.File([l.recordedData], `recording ${Y} ${Date.now()}`), chunkSize: 5120 }), ne.startTime = Date.now(), de({ event: "Video Upload Start", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { mediaRecordingUid: ee, questionId: Z, responseGroupUid: Q, surveyId: q, mediaType: Y, url: E } }), ne.on("error", (P) => {
809
+ O(l.uploadProgressLabel, "none"), j && j(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: ee }), ie(P, "finishRecord", h, S, H, U);
810
810
  }), ne.on("progress", (P) => {
811
- j && j(M.UPLOAD_PROGRESS, { [M.MEDIA_RECORDING_UID]: ee, [M.UPLOAD_PROGRESS_PCT]: P.detail }), O(l.uploadProgressLabel, "progress", P.detail);
811
+ j && j(L.UPLOAD_PROGRESS, { [L.MEDIA_RECORDING_UID]: ee, [L.UPLOAD_PROGRESS_PCT]: P.detail }), O(l.uploadProgressLabel, "progress", P.detail);
812
812
  }), ne.on("success", () => {
813
- O(l.uploadProgressLabel, "success"), j && j(M.UPLOAD_FINISHED, { [M.MEDIA_RECORDING_UID]: ee }), de({ event: "Video Upload Success", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { mediaRecordingUid: ee, questionId: Z, responseGroupUid: Q, surveyId: q, mediaType: Y, url: E, elapsedMs: ne.startTime && Date.now() - ne.startTime } });
813
+ O(l.uploadProgressLabel, "success"), j && j(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: ee }), de({ event: "Video Upload Success", apiBase: h, headers: S, visitorId: H, envId: U, metadata: { mediaRecordingUid: ee, questionId: Z, responseGroupUid: Q, surveyId: q, mediaType: Y, url: E, elapsedMs: ne.startTime && Date.now() - ne.startTime } });
814
814
  }));
815
815
  });
816
816
  })(s, r, i, Ye, d);
817
- const _ = [{ name: "microphone" }];
818
- !s.cameraOff && _.push({ name: "camera" }), Promise.all(_.map((l) => {
817
+ const T = [{ name: "microphone" }];
818
+ !s.cameraOff && T.push({ name: "camera" }), Promise.all(T.map((l) => {
819
819
  var h;
820
820
  return (h = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : h.query(l);
821
821
  })).then((l) => {
@@ -823,48 +823,48 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
823
823
  }).catch((l) => {
824
824
  });
825
825
  }, ln = (n, o = 3) => {
826
- const t = T.document.getElementById("ul-recording-countdown-screen");
826
+ const t = I.document.getElementById("ul-recording-countdown-screen");
827
827
  t && o === 0 ? (t.remove(), n.record().start()) : t && (t.innerHTML = `<span class='ul-countdown-text'>Recording in... ${o}</span>`, setTimeout(() => {
828
828
  ln(n, o - 1);
829
829
  }, 1e3));
830
830
  }, dn = (n) => {
831
- const o = T.document.createElement("div");
831
+ const o = I.document.createElement("div");
832
832
  return o.className = "ul-video-container", o.appendChild(((t) => {
833
- const r = T.document.createElement("div");
833
+ const r = I.document.createElement("div");
834
834
  return r.className = "ul-video-player-loading", r.id = He(t), ["first", "second", "third", "fourth"].map((i) => {
835
- const a = T.document.createElement("div");
835
+ const a = I.document.createElement("div");
836
836
  a.className = i, r.appendChild(a);
837
837
  }), r;
838
838
  })(n)), o;
839
839
  }, Pe = (n, o) => {
840
- const t = T.document.createElement("video");
840
+ const t = I.document.createElement("video");
841
841
  t.id = n, t.className = "video-js vjs-default-skin ul-video-player-video";
842
- const r = T.document.createElement("p");
842
+ const r = I.document.createElement("p");
843
843
  r.className = "vjs-no-js", r.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
844
- const i = T.document.createElement("a");
844
+ const i = I.document.createElement("a");
845
845
  return i.href = "https://videojs.com/html5-video-support/", i.target = "_blank", i.innerHTML = "supports HTML5 video", r.appendChild(i), t.appendChild(r), o.appendChild(t), o;
846
846
  }, Ln = (n, o) => {
847
- n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(), T.document.getElementById(`${n.id()}_html5_api`).style.height = "100%";
848
- }, ke = (n, o) => T.document.getElementById(n) ? o ? T.videojs(n, o) : T.videojs(n) : (console.error(`Error in finding player element with ID, ${n}`), null), Mn = (n, o, t, r = !1, i = "https://api.sprig.com", a = document, d = null, u = null) => {
849
- T.document = a;
847
+ n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(), I.document.getElementById(`${n.id()}_html5_api`).style.height = "100%";
848
+ }, ke = (n, o) => I.document.getElementById(n) ? o ? I.videojs(n, o) : I.videojs(n) : (console.error(`Error in finding player element with ID, ${n}`), null), Mn = (n, o, t, r = !1, i = "https://api.sprig.com", a = document, d = null, u = null) => {
849
+ I.document = a;
850
850
  const s = n + rn, p = dn(s);
851
- return T.document.addEventListener("securitypolicyviolation", (b) => {
851
+ return I.document.addEventListener("securitypolicyviolation", (b) => {
852
852
  ie(new Error(`Voice & Video feature violates ${b.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
853
853
  }), on(tn, () => {
854
- T.document.getElementById(He(s)).remove(), Pe(s, p);
854
+ I.document.getElementById(He(s)).remove(), Pe(s, p);
855
855
  const b = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
856
856
  try {
857
857
  const c = n + Ge;
858
858
  Pe(c, p);
859
- const m = ke(s, b), x = ke(c, { muted: !0, ...b });
860
- if (!m || !x) return;
861
- ((g, D, f) => {
859
+ const v = ke(s, b), x = ke(c, { muted: !0, ...b });
860
+ if (!v || !x) return;
861
+ ((g, _, M) => {
862
862
  g.addClass(`ul${Ge}`);
863
- const w = new (T.videojs.getComponent("Component"))(g);
864
- D && g.src(D), g.addChild(w), f && f(g);
863
+ const f = new (I.videojs.getComponent("Component"))(g);
864
+ _ && g.src(_), g.addChild(f), M && M(g);
865
865
  })(x, d, u), d || x.addClass(W);
866
- const y = sn(m, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), v = y.children().find((g) => g.name_ === "FullscreenToggle");
867
- v.hasClass("vjs-disabled") && v.hide(), an(m, y, o, t, r, x);
866
+ const C = sn(v, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), m = C.children().find((g) => g.name_ === "FullscreenToggle");
867
+ m.hasClass("vjs-disabled") && m.hide(), an(v, C, o, t, r, x);
868
868
  } catch (c) {
869
869
  return void ie(new Error(`Error when creating video player object ${c}`), "playerDeviceError", i, {});
870
870
  }
@@ -874,33 +874,33 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
874
874
  const o = n.match(/https:\/\/stream.mux.com\/(.*)/);
875
875
  let t = o ? o[1] : null;
876
876
  return t.includes(ze) && (t = t.replace(ze, "")), t ? `https://image.mux.com/${t}/thumbnail.jpg?time=0` : null;
877
- }, M = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, X = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" }, qn = ({ properties: n, surveyVideoUrl: o, questionId: t }) => {
877
+ }, L = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, X = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" }, qn = ({ properties: n, surveyVideoUrl: o, questionId: t }) => {
878
878
  const r = `ul-card-video__question_player-q${t}`, { apiURL: i, viewDocument: a } = z((d) => ({ apiURL: d.apiURL, viewDocument: d.viewDocument }));
879
879
  return e("div", { id: r, ref: (d) => {
880
880
  if (d && d.children.length === 0 && !n.properties.hideRecordedPrompt) {
881
- const u = Mn(r, { src: o, type: "application/x-mpegURL" }, void 0, n.properties.mediaType === M.MEDIA_TYPE_AUDIO, i, a);
881
+ const u = Mn(r, { src: o, type: "application/x-mpegURL" }, void 0, n.properties.mediaType === L.MEDIA_TYPE_AUDIO, i, a);
882
882
  d.appendChild(u);
883
883
  }
884
884
  } });
885
885
  }, ve = ({ isDisabled: n, onClick: o, children: t }) => e(se, { className: "ul-card__button-checkmark", disabled: n, onClick: o, type: "button", children: [e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#ffffff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), t || "Ok"] }), Un = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
886
- const { useMobileStyling: a, border: d } = z((k) => ({ useMobileStyling: k.useMobileStyling, border: k.border })), [u, s] = G(!1), [p, b] = G(""), [c, m] = G(!1), x = t == null ? void 0 : t.collectName, y = (t == null ? void 0 : t.nameLabelText) || "Full Name", v = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", g = (t == null ? void 0 : t.submitButtonText) || "Submit", D = !!p.trim(), f = u && (!x || D), w = (k, R = !1) => {
887
- k.preventDefault(), k.stopPropagation();
888
- let N = null;
886
+ const { useMobileStyling: a, border: d } = z((y) => ({ useMobileStyling: y.useMobileStyling, border: y.border })), [u, s] = G(!1), [p, b] = G(""), [c, v] = G(!1), x = t == null ? void 0 : t.collectName, C = (t == null ? void 0 : t.nameLabelText) || "Full Name", m = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", g = (t == null ? void 0 : t.submitButtonText) || "Submit", _ = !!p.trim(), M = u && (!x || _), f = (y, R = !1) => {
887
+ y.preventDefault(), y.stopPropagation();
888
+ let D = null;
889
889
  if (!R) {
890
- if (!f) return void m(!0);
891
- N = { submitted: !0 }, x && (N.name = p);
890
+ if (!M) return void v(!0);
891
+ D = { submitted: !0 }, x && (D.name = p);
892
892
  }
893
- o({ value: N, questionId: r, type: i }, !!R || f);
893
+ o({ value: D, questionId: r, type: i }, !!R || M);
894
894
  };
895
- return e("div", { className: A(n, "ul-card__consent-legal", "fade-in-transition"), children: e(re, { embeddedType: "pdf", properties: t, children: e(ue, { children: [e("div", { className: "sprig-stretch", children: [e(Oe, { allowTextEntry: !1, border: d, error: c && !u, id: "consent", isRadio: !1, isSelected: u, label: v, onUserInputChanged: ({ selected: k }) => {
896
- k !== u && s(!u);
897
- }, useMobileStyling: a }), x && e("input", { "aria-label": y, "aria-placeholder": y, className: A(K("ul-consent-legal__name-input", a)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (k) => {
898
- k.currentTarget.style.borderColor = c && !D ? Ie : qe;
899
- }, onFocus: (k) => {
900
- k.currentTarget.style.borderColor = c && !D ? Ie : d;
901
- }, onInput: (k) => {
902
- k.preventDefault(), k.stopPropagation(), b(k.currentTarget.value);
903
- }, placeholder: y, style: c && !D ? { borderColor: Ie } : {}, tabIndex: 0, value: p })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ve, { isDisabled: !f, onClick: (k) => w(new SubmitEvent(k.type)), children: le({ buttonText: g }) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (k) => w(new SubmitEvent(k.type), !0), children: Me(t) })] })] }) }) }, r);
895
+ return e("div", { className: A(n, "ul-card__consent-legal", "fade-in-transition"), children: e(re, { embeddedType: "pdf", properties: t, children: e(ue, { children: [e("div", { className: "sprig-stretch", children: [e(Oe, { allowTextEntry: !1, border: d, error: c && !u, id: "consent", isRadio: !1, isSelected: u, label: m, onUserInputChanged: ({ selected: y }) => {
896
+ y !== u && s(!u);
897
+ }, useMobileStyling: a }), x && e("input", { "aria-label": C, "aria-placeholder": C, className: A(K("ul-consent-legal__name-input", a)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (y) => {
898
+ y.currentTarget.style.borderColor = c && !_ ? Ie : qe;
899
+ }, onFocus: (y) => {
900
+ y.currentTarget.style.borderColor = c && !_ ? Ie : d;
901
+ }, onInput: (y) => {
902
+ y.preventDefault(), y.stopPropagation(), b(y.currentTarget.value);
903
+ }, placeholder: C, style: c && !_ ? { borderColor: Ie } : {}, tabIndex: 0, value: p })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ve, { isDisabled: !M, onClick: (y) => f(new SubmitEvent(y.type)), children: le({ buttonText: g }) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => f(new SubmitEvent(y.type), !0), children: Me(t) })] })] }) }) }, r);
904
904
  }, On = () => {
905
905
  const { destroy: n, forceBrandedLogo: o } = z((t) => ({ destroy: t.destroy, forceBrandedLogo: t.forceBrandedLogo }));
906
906
  return ce(() => {
@@ -908,91 +908,91 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
908
908
  n(Ue);
909
909
  }, o ? 4e3 : 2e3);
910
910
  }, [n, o]), e("div", { className: "end-of-survey-text", children: "End of survey" });
911
- }, An = ({ activeValue: n, border: o, icon: t, enableCspTrustedTypes: r, isPressed: i, range: a, scaleLabelType: d, selectedValue: u, setSelectedValue: s, setActiveValue: p, setIsPressed: b, useMobileStyling: c, value: m, viewDocument: x }) => {
912
- const y = `option-${m}`, v = d === "number", g = d === "star", D = d === "smiley", f = v && m === n || m === u, [w, k] = (() => {
913
- const I = g && u !== null && m <= u;
914
- return g && m <= n || D && m === n || I || m === n || m === u ? [o, i || I || m === u ? 1 : 0.3] : ["", 1];
911
+ }, An = ({ activeValue: n, border: o, icon: t, enableCspTrustedTypes: r, isPressed: i, range: a, scaleLabelType: d, selectedValue: u, setSelectedValue: s, setActiveValue: p, setIsPressed: b, useMobileStyling: c, value: v, viewDocument: x }) => {
912
+ const C = `option-${v}`, m = d === "number", g = d === "star", _ = d === "smiley", M = m && v === n || v === u, [f, y] = (() => {
913
+ const k = g && u !== null && v <= u;
914
+ return g && v <= n || _ && v === n || k || v === n || v === u ? [o, i || k || v === u ? 1 : 0.3] : ["", 1];
915
915
  })(), R = fe(() => {
916
- const I = { borderColor: f ? w : "", fillOpacity: f ? "" : k, zIndex: f ? 3 : "auto", color: u === m ? "#fff" : "" };
917
- return v ? { ...I, backgroundColor: u === m ? w : "" } : { ...I, color: g || D || u === m ? w : "" };
918
- }, [f, w, k, u, m, v, g, D]), N = fe(() => jn((({ icon: I, scaleLabelType: C, value: _, selectedValue: l }) => {
919
- if (C === "smiley" && _ === l) {
916
+ const k = { borderColor: M ? f : "", fillOpacity: M ? "" : y, zIndex: M ? 3 : "auto", color: u === v ? "#fff" : "" };
917
+ return m ? { ...k, backgroundColor: u === v ? f : "" } : { ...k, color: g || _ || u === v ? f : "" };
918
+ }, [M, f, y, u, v, m, g, _]), D = fe(() => jn((({ icon: k, scaleLabelType: w, value: T, selectedValue: l }) => {
919
+ if (w === "smiley" && T === l) {
920
920
  let h = 0;
921
- return I.replace(/black/g, () => ++h == 1 ? "black" : "white");
921
+ return k.replace(/black/g, () => ++h == 1 ? "black" : "white");
922
922
  }
923
- return I;
924
- })({ icon: t, scaleLabelType: d, value: m, selectedValue: u }), r), [r, t, d, u, m]);
925
- return e("button", { "aria-label": v ? void 0 : String(m), className: (() => {
923
+ return k;
924
+ })({ icon: t, scaleLabelType: d, value: v, selectedValue: u }), r), [r, t, d, u, v]);
925
+ return e("button", { "aria-label": m ? void 0 : String(v), className: (() => {
926
926
  switch (d) {
927
927
  case "star":
928
- return A(K("likert-star", c), K(`likert-star-${m}`, c));
928
+ return A(K("likert-star", c), K(`likert-star-${v}`, c));
929
929
  case "smiley":
930
- return A(K("likert-smiley", c), K(`likert-smiley-${m}`, c));
930
+ return A(K("likert-smiley", c), K(`likert-smiley-${v}`, c));
931
931
  default:
932
- return m === a ? A(K("likert-number", c), K(`likert-number-${m}`, c), K("likert-last-option", c)) : A(K("likert-number", c), K(`likert-number-${m}`, c));
932
+ return v === a ? A(K("likert-number", c), K(`likert-number-${v}`, c), K("likert-last-option", c)) : A(K("likert-number", c), K(`likert-number-${v}`, c));
933
933
  }
934
- })(), dangerouslySetInnerHTML: { __html: N }, id: y, onClick: (I) => {
935
- I.preventDefault(), I.stopPropagation(), s(m);
936
- }, onKeyDown: (I) => {
934
+ })(), dangerouslySetInnerHTML: { __html: D }, id: C, onClick: (k) => {
935
+ k.preventDefault(), k.stopPropagation(), s(v);
936
+ }, onKeyDown: (k) => {
937
937
  var l, h;
938
- const C = x.querySelectorAll(`.likert-${d ?? "number"}`), _ = m - 1;
939
- I.key === "ArrowRight" ? (l = C[_ + 1]) == null || l.focus() : I.key === "ArrowLeft" ? (h = C[_ - 1]) == null || h.focus() : I.key !== "Enter" && I.key !== " " || (I.preventDefault(), I.stopPropagation(), s(m));
940
- }, onPointerDown: () => b(!0), onPointerEnter: () => p(m), onPointerLeave: () => {
938
+ const w = x.querySelectorAll(`.likert-${d ?? "number"}`), T = v - 1;
939
+ k.key === "ArrowRight" ? (l = w[T + 1]) == null || l.focus() : k.key === "ArrowLeft" ? (h = w[T - 1]) == null || h.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), s(v));
940
+ }, onPointerDown: () => b(!0), onPointerEnter: () => p(v), onPointerLeave: () => {
941
941
  p(-1), b(!1);
942
942
  }, style: R, tabIndex: 0 });
943
943
  }, Hn = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: a }) => {
944
- const { border: d, useMobileStyling: u, viewDocument: s, enableCspTrustedTypes: p } = z((C) => ({ border: C.border, useMobileStyling: C.useMobileStyling, viewDocument: C.viewDocument, enableCspTrustedTypes: C.enableCspTrustedTypes })), [b, c] = G(-1), [m, x] = G(!1), [y, v] = G(null), g = o && o.left, D = o && o.right;
945
- let f;
946
- const { range: w, scaleLabelType: k, ratingIcons: R } = r;
947
- w && (f = Number(w));
948
- const N = f || 5, I = (C) => {
949
- var _, l;
950
- switch (k) {
944
+ const { border: d, useMobileStyling: u, viewDocument: s, enableCspTrustedTypes: p } = z((w) => ({ border: w.border, useMobileStyling: w.useMobileStyling, viewDocument: w.viewDocument, enableCspTrustedTypes: w.enableCspTrustedTypes })), [b, c] = G(-1), [v, x] = G(!1), [C, m] = G(null), g = o && o.left, _ = o && o.right;
945
+ let M;
946
+ const { range: f, scaleLabelType: y, ratingIcons: R } = r;
947
+ f && (M = Number(f));
948
+ const D = M || 5, k = (w) => {
949
+ var T, l;
950
+ switch (y) {
951
951
  case "star":
952
- return (_ = R[0]) == null ? void 0 : _.svg;
952
+ return (T = R[0]) == null ? void 0 : T.svg;
953
953
  case "smiley":
954
- return (l = R[C]) == null ? void 0 : l.svg;
954
+ return (l = R[w]) == null ? void 0 : l.svg;
955
955
  default:
956
- return String(C + 1);
956
+ return String(w + 1);
957
957
  }
958
958
  };
959
- return e("form", { className: A(n, "ul-card--likert", "fade-in-transition"), children: e(re, { properties: r, children: [e(ae, { children: [e("div", { "aria-label": `Rating (1 - ${N})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(N)].map((C, _) => {
960
- const l = _ + 1;
961
- return e(An, { activeValue: b, border: d, enableCspTrustedTypes: p, icon: I(_), isPressed: m, range: N, scaleLabelType: k, selectedValue: y, setActiveValue: c, setIsPressed: x, setSelectedValue: v, useMobileStyling: u, value: l, viewDocument: s }, _);
962
- }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: g }), e("span", { children: D })] })] }), e(ue, { children: e(ve, { isDisabled: y === null && r.required, onClick: () => t({ value: y, questionId: i, type: a }, !0), children: le(r) }) })] }) }, i);
959
+ return e("form", { className: A(n, "ul-card--likert", "fade-in-transition"), children: e(re, { properties: r, children: [e(ae, { children: [e("div", { "aria-label": `Rating (1 - ${D})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(D)].map((w, T) => {
960
+ const l = T + 1;
961
+ return e(An, { activeValue: b, border: d, enableCspTrustedTypes: p, icon: k(T), isPressed: v, range: D, scaleLabelType: y, selectedValue: C, setActiveValue: c, setIsPressed: x, setSelectedValue: m, useMobileStyling: u, value: l, viewDocument: s }, T);
962
+ }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: g }), e("span", { children: _ })] })] }), e(ue, { children: e(ve, { isDisabled: C === null && r.required, onClick: () => t({ value: C, questionId: i, type: a }, !0), children: le(r) }) })] }) }, i);
963
963
  }, $n = ({ columns: n, onSelect: o, options: t, selectedOptions: r }) => {
964
- const i = oe([]), { border: a, useMobileStyling: d } = z((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling })), u = t.findIndex((m) => r[m.id] === null), [s, p] = G(u), b = be((m, x) => {
965
- o(m, x);
966
- const y = s + 1, v = t[y];
967
- v && r[v.id] === null && p(y);
968
- }, [o, t, r, s]), c = be((m, x) => {
969
- const y = s === m;
970
- return e(yn, { animate: !0, header: x.label, isOpen: y, onClick: () => {
971
- var v;
972
- return p(y && !((v = window.UserLeap) != null && v.isMobileSDK) ? -1 : m);
973
- }, ref: (v) => {
974
- v && (i.current[m] = v);
975
- }, showHeaderCheck: r[x.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((v) => e(Oe, { allowTextEntry: !1, ariaLabel: `${x.label}-${v.label}`, border: a, error: !1, id: `${x.id}-${v.value}`, isRadio: !0, isSelected: r[x.id] === v.value, label: v.label, onUserInputChanged: () => b(x.id, v.value), useMobileStyling: d }, v.label)) }) }, x.id);
964
+ const i = oe([]), { border: a, useMobileStyling: d } = z((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling })), u = t.findIndex((v) => r[v.id] === null), [s, p] = G(u), b = be((v, x) => {
965
+ o(v, x);
966
+ const C = s + 1, m = t[C];
967
+ m && r[m.id] === null && p(C);
968
+ }, [o, t, r, s]), c = be((v, x) => {
969
+ const C = s === v;
970
+ return e(yn, { animate: !0, header: x.label, isOpen: C, onClick: () => {
971
+ var m;
972
+ return p(C && !((m = window.UserLeap) != null && m.isMobileSDK) ? -1 : v);
973
+ }, ref: (m) => {
974
+ m && (i.current[v] = m);
975
+ }, showHeaderCheck: r[x.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((m) => e(Oe, { allowTextEntry: !1, ariaLabel: `${x.label}-${m.label}`, border: a, error: !1, id: `${x.id}-${m.value}`, isRadio: !0, isSelected: r[x.id] === m.value, label: m.label, onUserInputChanged: () => b(x.id, m.value), useMobileStyling: d }, m.label)) }) }, x.id);
976
976
  }, [a, n, s, b, r, d]);
977
- return e("div", { children: t.map((m, x) => c(x, m)) });
977
+ return e("div", { children: t.map((v, x) => c(x, v)) });
978
978
  }, Vn = ({ className: n, next: o, options: t, properties: r, questionId: i, type: a, onSubmitButtonClick: d }) => {
979
- const u = r.matrixColumn, s = r.required, p = (y) => {
980
- y.preventDefault(), y.stopPropagation(), o({ value: c, questionId: i, type: a }, !0), d && d();
981
- }, b = t.reduce((y, v) => (y[v.id] = null, y), {}), [c, m] = G(b);
982
- return e("form", { className: A(n, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: p, children: e(re, { properties: r, children: [e(ae, { children: e($n, { columns: u, onSelect: (y, v) => {
983
- m((g) => ({ ...g, [y]: v }));
984
- }, options: t, selectedOptions: c }) }), e(ue, { children: e(ve, { isDisabled: (x = c, s && Object.values(x).every((y) => y == null)), onClick: () => p(new SubmitEvent("submit")), children: le(r) }) })] }) }, i);
979
+ const u = r.matrixColumn, s = r.required, p = (C) => {
980
+ C.preventDefault(), C.stopPropagation(), o({ value: c, questionId: i, type: a }, !0), d && d();
981
+ }, b = t.reduce((C, m) => (C[m.id] = null, C), {}), [c, v] = G(b);
982
+ return e("form", { className: A(n, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: p, children: e(re, { properties: r, children: [e(ae, { children: e($n, { columns: u, onSelect: (C, m) => {
983
+ v((g) => ({ ...g, [C]: m }));
984
+ }, options: t, selectedOptions: c }) }), e(ue, { children: e(ve, { isDisabled: (x = c, s && Object.values(x).every((C) => C == null)), onClick: () => p(new SubmitEvent("submit")), children: le(r) }) })] }) }, i);
985
985
  var x;
986
986
  }, cn = ({ className: n, onSubmit: o, options: t = [], properties: r, questionId: i, type: a, showIndividualSubmit: d = !1, onSubmitButtonClick: u }) => {
987
- const { border: s, useMobileStyling: p } = z((l) => ({ border: l.border, useMobileStyling: l.useMobileStyling })), b = t.reduce((l, h) => (l[h.id] = { isSelected: !1 }, l), {}), [c, m] = G(b), x = a === "multiplechoice", y = r.required, v = t.find((l) => {
987
+ const { border: s, useMobileStyling: p } = z((l) => ({ border: l.border, useMobileStyling: l.useMobileStyling })), b = t.reduce((l, h) => (l[h.id] = { isSelected: !1 }, l), {}), [c, v] = G(b), x = a === "multiplechoice", C = r.required, m = t.find((l) => {
988
988
  var h;
989
989
  return (h = l.optionProperties) == null ? void 0 : h.noneOfTheAbove;
990
990
  }), g = (l) => Object.entries(l).some(([h, j]) => {
991
991
  var q;
992
992
  const O = t.find((Q) => `${Q.id}` === h), S = j.userText === void 0 || j.userText.trim() === "";
993
993
  return ((q = O == null ? void 0 : O.optionProperties) == null ? void 0 : q.allowsTextEntry) && S && j.isSelected;
994
- }), D = (l) => Object.values(l).filter((h) => h.isSelected).length, f = r.minSelect && r.minSelect > 0 && r.maxSelectMode === Ce.Range && D(c) < r.minSelect && (y || D(c) > 0), w = (l) => g(l) || y && !D(l) || !((h) => {
995
- const { minSelect: j = 0, maxSelect: O = 1 / 0, maxSelectMode: S } = r, q = D(h);
994
+ }), _ = (l) => Object.values(l).filter((h) => h.isSelected).length, M = r.minSelect && r.minSelect > 0 && r.maxSelectMode === Ce.Range && _(c) < r.minSelect && (C || _(c) > 0), f = (l) => g(l) || C && !_(l) || !((h) => {
995
+ const { minSelect: j = 0, maxSelect: O = 1 / 0, maxSelectMode: S } = r, q = _(h);
996
996
  switch (S) {
997
997
  case Ce.Maximum:
998
998
  return q <= O;
@@ -1001,36 +1001,36 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
1001
1001
  default:
1002
1002
  return !0;
1003
1003
  }
1004
- })(l), k = Object.entries(c).some(([l, h]) => {
1004
+ })(l), y = Object.entries(c).some(([l, h]) => {
1005
1005
  var j, O;
1006
1006
  return h.isSelected && ((O = (j = t.find((S) => `${S.id}` === l)) == null ? void 0 : j.optionProperties) == null ? void 0 : O.allowsTextEntry);
1007
- }), R = d && (!x || k), N = (l) => {
1008
- _(l.id, l.selected, l.userText, l.noneOfTheAbove);
1009
- }, I = (l) => {
1007
+ }), R = d && (!x || y), D = (l) => {
1008
+ T(l.id, l.selected, l.userText, l.noneOfTheAbove);
1009
+ }, k = (l) => {
1010
1010
  var h;
1011
- return (r == null ? void 0 : r.maxSelectMode) !== Ce.Unlimited && D(c) === (r == null ? void 0 : r.maxSelect) && !((h = c[l]) != null && h.isSelected);
1012
- }, C = () => {
1011
+ return (r == null ? void 0 : r.maxSelectMode) !== Ce.Unlimited && _(c) === (r == null ? void 0 : r.maxSelect) && !((h = c[l]) != null && h.isSelected);
1012
+ }, w = () => {
1013
1013
  o(c, !0), u && u();
1014
- }, _ = (l, h, j, O) => {
1014
+ }, T = (l, h, j, O) => {
1015
1015
  const S = Object.assign({}, c);
1016
1016
  if ((x || O) && h) for (const q of Object.values(S)) q.isSelected = !1, delete q.userText;
1017
- else v && !O && c[v.id].isSelected && (S[v.id].isSelected = !1);
1018
- S[l] = { isSelected: h, userText: j }, m(S);
1017
+ else m && !O && c[m.id].isSelected && (S[m.id].isSelected = !1);
1018
+ S[l] = { isSelected: h, userText: j }, v(S);
1019
1019
  };
1020
- return e("form", { className: A(n, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: C, children: e(re, { properties: r, children: [e(ae, { children: [r.isDropdown ? e(In, { disabledOptions: t.filter((l) => I(l.id)), dropdownFooter: f ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [D(c), "/", r.minSelect] }) : void 0, isMultiSelect: !x, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (l) => {
1020
+ return e("form", { className: A(n, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: w, children: e(re, { properties: r, children: [e(ae, { children: [r.isDropdown ? e(In, { disabledOptions: t.filter((l) => k(l.id)), dropdownFooter: M ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [_(c), "/", r.minSelect] }) : void 0, isMultiSelect: !x, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (l) => {
1021
1021
  const h = { ...c };
1022
1022
  for (const j of t) l.includes(j) ? h[j.id].isSelected = !0 : h[j.id].isSelected = !1;
1023
- m(h);
1023
+ v(h);
1024
1024
  }, options: t, placeholderText: r.dropdownPlaceholderText ?? (x ? "Select choice" : "Select choice(s)"), value: t.filter((l) => c[l.id].isSelected) }) : e("div", { className: A(K("ul-card__choices", p)), role: x ? "radiogroup" : "group", children: [t.map(({ id: l, label: h, value: j, optionProperties: O }) => {
1025
1025
  var U, Z;
1026
1026
  const S = `${l}`, { allowsTextEntry: q, noneOfTheAbove: Q } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...O };
1027
- return e(Oe, { allowTextEntry: q, border: s, disabled: I(S), error: (H = c, g(H)), id: S, isRadio: x, isSelected: !!((U = c[S]) != null && U.isSelected), label: h, noneOfTheAbove: Q, onUserInputChanged: N, promptText: "Please specify", text: (Z = c[l]) == null ? void 0 : Z.userText, useMobileStyling: p, value: j }, S);
1027
+ return e(Oe, { allowTextEntry: q, border: s, disabled: k(S), error: (H = c, g(H)), id: S, isRadio: x, isSelected: !!((U = c[S]) != null && U.isSelected), label: h, noneOfTheAbove: Q, onUserInputChanged: D, promptText: "Please specify", text: (Z = c[l]) == null ? void 0 : Z.userText, useMobileStyling: p, value: j }, S);
1028
1028
  var H;
1029
- }), !!f && e("div", { className: "ul-card__min-select-counter", children: [D(c), "/", r.minSelect] })] }), R && e(Tn, { handleSubmit: C, isSubmitDisabled: w(c) })] }), e(ue, { children: e(ve, { isDisabled: w(c), onClick: C, children: le(r) }) })] }) }, i);
1029
+ }), !!M && e("div", { className: "ul-card__min-select-counter", children: [_(c), "/", r.minSelect] })] }), R && e(Tn, { handleSubmit: w, isSubmitDisabled: f(c) })] }), e(ue, { children: e(ve, { isDisabled: f(c), onClick: w, children: le(r) }) })] }) }, i);
1030
1030
  }, Fn = (n) => {
1031
1031
  const { questionId: o, type: t, next: r, options: i } = n;
1032
1032
  return e(cn, { ...n, onSubmit: (a, d) => {
1033
- const u = Object.entries(a).find(([, m]) => m.isSelected) || [void 0, void 0], [s, p] = u, b = i.find((m) => `${m.id}` === s), c = p != null && p.userText ? { [s]: { userText: p.userText } } : null;
1033
+ const u = Object.entries(a).find(([, v]) => v.isSelected) || [void 0, void 0], [s, p] = u, b = i.find((v) => `${v.id}` === s), c = p != null && p.userText ? { [s]: { userText: p.userText } } : null;
1034
1034
  r({ value: b && s ? { [s]: b.value } : {}, secondaryValue: c, questionId: o, type: t }, d);
1035
1035
  } });
1036
1036
  }, zn = (n) => {
@@ -1044,63 +1044,63 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
1044
1044
  r({ value: d, secondaryValue: u, questionId: o, type: t }, a);
1045
1045
  } });
1046
1046
  }, Gn = ({ className: n, labels: o, properties: t, next: r, questionId: i, type: a }) => {
1047
- const [d, u] = G(null), { border: s, useMobileStyling: p, viewDocument: b } = z((x) => ({ border: x.border, useMobileStyling: x.useMobileStyling, viewDocument: x.viewDocument })), c = o && o.left, m = o && o.right;
1048
- return e("form", { className: A(n, "ul-card--nps", "fade-in-transition"), children: e(re, { properties: t, children: [e(ae, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((x, y) => e("button", { className: A(K("nps-number", p), K(`nps-number-${y}`, p)), id: `option-${y}`, onClick: (v) => {
1049
- v.preventDefault(), v.stopPropagation(), u(y);
1050
- }, onKeyDown: (v) => {
1051
- var D, f;
1047
+ const [d, u] = G(null), { border: s, useMobileStyling: p, viewDocument: b } = z((x) => ({ border: x.border, useMobileStyling: x.useMobileStyling, viewDocument: x.viewDocument })), c = o && o.left, v = o && o.right;
1048
+ return e("form", { className: A(n, "ul-card--nps", "fade-in-transition"), children: e(re, { properties: t, children: [e(ae, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((x, C) => e("button", { className: A(K("nps-number", p), K(`nps-number-${C}`, p)), id: `option-${C}`, onClick: (m) => {
1049
+ m.preventDefault(), m.stopPropagation(), u(C);
1050
+ }, onKeyDown: (m) => {
1051
+ var _, M;
1052
1052
  const g = b.querySelectorAll("button.nps-number");
1053
- v.key === "ArrowRight" ? (D = g[y + 1]) == null || D.focus() : v.key === "ArrowLeft" ? (f = g[y - 1]) == null || f.focus() : v.key !== "Enter" && v.key !== " " || (v.preventDefault(), v.stopPropagation(), u(y));
1054
- }, onPointerDown: (v) => {
1055
- v.currentTarget.style.zIndex = "2", v.currentTarget.style.borderColor = s;
1056
- }, onPointerLeave: (v) => {
1057
- v.currentTarget.style.zIndex = "auto", v.currentTarget.style.borderColor = qe;
1058
- }, style: d === y ? { backgroundColor: s, color: "#fff" } : void 0, tabIndex: 0, children: y }, y)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: c }), e("span", { children: m })] })] }), e(ue, { children: e(ve, { isDisabled: d === null && t.required, onClick: () => r({ value: d, questionId: i, type: a }, !0), children: le(t) }) })] }) }, i);
1053
+ m.key === "ArrowRight" ? (_ = g[C + 1]) == null || _.focus() : m.key === "ArrowLeft" ? (M = g[C - 1]) == null || M.focus() : m.key !== "Enter" && m.key !== " " || (m.preventDefault(), m.stopPropagation(), u(C));
1054
+ }, onPointerDown: (m) => {
1055
+ m.currentTarget.style.zIndex = "2", m.currentTarget.style.borderColor = s;
1056
+ }, onPointerLeave: (m) => {
1057
+ m.currentTarget.style.zIndex = "auto", m.currentTarget.style.borderColor = qe;
1058
+ }, style: d === C ? { backgroundColor: s, color: "#fff" } : void 0, tabIndex: 0, children: C }, C)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: c }), e("span", { children: v })] })] }), e(ue, { children: e(ve, { isDisabled: d === null && t.required, onClick: () => r({ value: d, questionId: i, type: a }, !0), children: le(t) }) })] }) }, i);
1059
1059
  }, Zn = ({ className: n, next: o, properties: t, questionId: r, type: i, onSubmitButtonClick: a }) => {
1060
- const { border: d, useMobileStyling: u, update: s } = z((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling, update: g.update })), [p, b] = G(""), c = oe(null), m = p.trim(), x = t.required === !0 && !m, y = _n(c, () => s()), v = t && t.openTextPlaceholder ? t.openTextPlaceholder : "";
1061
- return e("form", { className: A(n, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(re, { properties: t, children: e("div", { className: "ul-card-text", children: [e(ae, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": v, className: A(K("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (g) => {
1060
+ const { border: d, useMobileStyling: u, update: s } = z((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling, update: g.update })), [p, b] = G(""), c = oe(null), v = p.trim(), x = t.required === !0 && !v, C = _n(c, () => s()), m = t && t.openTextPlaceholder ? t.openTextPlaceholder : "";
1061
+ return e("form", { className: A(n, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(re, { properties: t, children: e("div", { className: "ul-card-text", children: [e(ae, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": m, className: A(K("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (g) => {
1062
1062
  g.currentTarget.style.borderColor = qe;
1063
1063
  }, onChange: (g) => {
1064
- const { value: D } = g.currentTarget;
1065
- y(), g.preventDefault(), g.stopPropagation(), b(D);
1064
+ const { value: _ } = g.currentTarget;
1065
+ C(), g.preventDefault(), g.stopPropagation(), b(_);
1066
1066
  }, onFocus: (g) => {
1067
1067
  g.currentTarget.style.borderColor = d;
1068
- }, placeholder: v, ref: c, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(ye, { className: "footer", html: t.footerHtml })] }), e(ue, { children: e(ve, { isDisabled: x, onClick: (g) => {
1068
+ }, placeholder: m, ref: c, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(ye, { className: "footer", html: t.footerHtml })] }), e(ue, { children: e(ve, { isDisabled: x, onClick: (g) => {
1069
1069
  g.preventDefault(), g.stopPropagation();
1070
- const D = t.required !== !0 || m.length > 0;
1071
- o({ value: p, questionId: r, type: i }, D), a && a();
1070
+ const _ = t.required !== !0 || v.length > 0;
1071
+ o({ value: p, questionId: r, type: i }, _), a && a();
1072
1072
  }, children: le(t) }) })] }) }) }, r);
1073
1073
  }, Qn = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: a, onSubmitButtonClick: d, options: u }) => {
1074
- const s = oe(null), p = oe(0), b = oe(0), c = oe(null), m = oe(!1), x = oe([]), [y, v] = G(() => (r == null ? void 0 : r.required) === !0), [g, D] = G(() => u.map((E) => ({ ...E, rank: null }))), f = fe(() => Array.from({ length: u.length }, (E, P) => P + 1), [u.length]), { useMobileStyling: w, isPreview: k, headers: R } = z((E) => ({ useMobileStyling: E.useMobileStyling, isPreview: E.isPreview, headers: E.headers })), N = (R == null ? void 0 : R["userleap-platform"]) === "android", I = w && !k && !N, C = !I && !N, _ = (E, P) => {
1075
- D((B) => {
1076
- const L = parseInt(P), V = B.map(($) => ({ ...$ }));
1074
+ const s = oe(null), p = oe(0), b = oe(0), c = oe(null), v = oe(!1), x = oe([]), [C, m] = G(() => (r == null ? void 0 : r.required) === !0), [g, _] = G(() => u.map((E) => ({ ...E, rank: null }))), M = fe(() => Array.from({ length: u.length }, (E, P) => P + 1), [u.length]), { useMobileStyling: f, isPreview: y, headers: R } = z((E) => ({ useMobileStyling: E.useMobileStyling, isPreview: E.isPreview, headers: E.headers })), D = (R == null ? void 0 : R["userleap-platform"]) === "android", k = f && !y && !D, w = !k && !D, T = (E, P) => {
1075
+ _((B) => {
1076
+ const N = parseInt(P), V = B.map(($) => ({ ...$ }));
1077
1077
  V.some(($) => $.rank == null) && V.forEach(($, he) => $.rank = he + 1);
1078
1078
  const J = V.findIndex(($) => $.id === E);
1079
1079
  if (J === -1) return B;
1080
1080
  const F = V[J].rank;
1081
- return L < F ? V.forEach(($) => {
1082
- $.id !== E && $.rank >= L && $.rank < F && ($.rank = $.rank + 1);
1083
- }) : L > F && V.forEach(($) => {
1084
- $.id !== E && $.rank > F && $.rank <= L && ($.rank = $.rank - 1);
1085
- }), V[J].rank = L, V.sort(($, he) => $.rank - he.rank), Q(), V;
1081
+ return N < F ? V.forEach(($) => {
1082
+ $.id !== E && $.rank >= N && $.rank < F && ($.rank = $.rank + 1);
1083
+ }) : N > F && V.forEach(($) => {
1084
+ $.id !== E && $.rank > F && $.rank <= N && ($.rank = $.rank - 1);
1085
+ }), V[J].rank = N, V.sort(($, he) => $.rank - he.rank), Q(), V;
1086
1086
  });
1087
1087
  }, l = (E, P) => {
1088
1088
  for (let B = 0; B < x.current.length; B++) {
1089
- const L = x.current[B];
1090
- if (!L || L === c.current) continue;
1091
- const V = L.getBoundingClientRect();
1092
- if (E >= V.left && E <= V.right && P >= V.top && P <= V.bottom) return { element: L, index: B };
1089
+ const N = x.current[B];
1090
+ if (!N || N === c.current) continue;
1091
+ const V = N.getBoundingClientRect();
1092
+ if (E >= V.left && E <= V.right && P >= V.top && P <= V.bottom) return { element: N, index: B };
1093
1093
  }
1094
1094
  return null;
1095
1095
  }, h = (E) => (P) => {
1096
- if (!I) return;
1097
- P.preventDefault(), P.stopPropagation(), m.current = !0, s.current = E;
1096
+ if (!k) return;
1097
+ P.preventDefault(), P.stopPropagation(), v.current = !0, s.current = E;
1098
1098
  const B = P.touches[0];
1099
1099
  p.current = B.clientY, b.current = B.clientY;
1100
- const L = P.currentTarget.closest(".ul-card-rank__option");
1101
- L && (c.current = L, L.classList.add("is-dragging"));
1100
+ const N = P.currentTarget.closest(".ul-card-rank__option");
1101
+ N && (c.current = N, N.classList.add("is-dragging"));
1102
1102
  }, j = (E) => {
1103
- if (!I || !m.current || s.current === null) return;
1103
+ if (!k || !v.current || s.current === null) return;
1104
1104
  E.preventDefault(), E.stopPropagation();
1105
1105
  const P = E.touches[0];
1106
1106
  b.current = P.clientY;
@@ -1108,27 +1108,27 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
1108
1108
  c.current && (c.current.style.transform = `translateY(${B}px)`, c.current.style.zIndex = "1000"), x.current.forEach((V) => {
1109
1109
  V && V !== c.current && V.classList.remove("is-drop-target");
1110
1110
  });
1111
- const L = l(P.clientX, P.clientY);
1112
- L && L.element.classList.add("is-drop-target");
1111
+ const N = l(P.clientX, P.clientY);
1112
+ N && N.element.classList.add("is-drop-target");
1113
1113
  }, O = (E) => {
1114
- if (!I || !m.current || s.current === null) return;
1114
+ if (!k || !v.current || s.current === null) return;
1115
1115
  E.preventDefault(), E.stopPropagation();
1116
1116
  const P = E.changedTouches[0], B = l(P.clientX, P.clientY);
1117
- c.current && (c.current.style.transform = "", c.current.style.zIndex = "", c.current.classList.remove("is-dragging")), x.current.forEach((L) => {
1118
- L && L.classList.remove("is-drop-target");
1119
- }), B && B.index !== s.current && S(s.current, B.index), s.current = null, c.current = null, m.current = !1;
1117
+ c.current && (c.current.style.transform = "", c.current.style.zIndex = "", c.current.classList.remove("is-dragging")), x.current.forEach((N) => {
1118
+ N && N.classList.remove("is-drop-target");
1119
+ }), B && B.index !== s.current && S(s.current, B.index), s.current = null, c.current = null, v.current = !1;
1120
1120
  }, S = (E, P) => {
1121
- D((B) => {
1122
- const L = B.map((J) => ({ ...J })), [V] = L.splice(E, 1);
1123
- return L.splice(P, 0, V), L.forEach((J, F) => {
1121
+ _((B) => {
1122
+ const N = B.map((J) => ({ ...J })), [V] = N.splice(E, 1);
1123
+ return N.splice(P, 0, V), N.forEach((J, F) => {
1124
1124
  J.rank = F + 1;
1125
- }), Q(), L;
1125
+ }), Q(), N;
1126
1126
  });
1127
1127
  }, q = (E) => {
1128
1128
  const P = {};
1129
- E.reduce((B, L) => (B[L.id] = L.rank, B), P), t({ value: P, questionId: i, type: a }, !0);
1129
+ E.reduce((B, N) => (B[N.id] = N.rank, B), P), t({ value: P, questionId: i, type: a }, !0);
1130
1130
  }, Q = () => {
1131
- v(!1);
1131
+ m(!1);
1132
1132
  }, { left: H, right: U } = o, Z = u.length, Y = (E) => {
1133
1133
  E.preventDefault(), E.currentTarget.classList.add("is-drop-target");
1134
1134
  }, ee = (E) => {
@@ -1138,19 +1138,19 @@ const de = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
1138
1138
  };
1139
1139
  return e("form", { className: A(n, "ul-card-rank", "fade-in-transition"), onSubmit: (E) => {
1140
1140
  E.preventDefault(), q(g), d && d();
1141
- }, children: e(re, { properties: r, children: N ? e(ae, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", H] }) }), e("ol", { className: "ul-card-rank__list", children: g.map(({ id: E, label: P, rank: B }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${P}`, className: A("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (L) => _(E, L.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), f.map((L) => e("option", { className: "ul-card-rank__select-option", value: L, children: L }, `${L}-${i}`))] }), e("span", { children: P })] }, E)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", U] }) })] }) }) : e(Be, { children: [e(ae, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", H] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: N ? void 0 : (E) => {
1141
+ }, children: e(re, { properties: r, children: D ? e(ae, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", H] }) }), e("ol", { className: "ul-card-rank__list", children: g.map(({ id: E, label: P, rank: B }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${P}`, className: A("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (N) => T(E, N.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), M.map((N) => e("option", { className: "ul-card-rank__select-option", value: N, children: N }, `${N}-${i}`))] }), e("span", { children: P })] }, E)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", U] }) })] }) }) : e(Be, { children: [e(ae, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", H] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: D ? void 0 : (E) => {
1142
1142
  E.preventDefault(), E.dataTransfer && (E.dataTransfer.dropEffect = "move");
1143
- }, children: g.map(({ id: E, label: P, rank: B }, L) => {
1144
- return e("li", { className: "ul-card-rank__option", draggable: !!C || void 0, onDragEnd: C ? me : void 0, onDragEnter: C ? Y : void 0, onDragLeave: C ? ee : void 0, onDragStart: C ? (J = L, (F) => {
1143
+ }, children: g.map(({ id: E, label: P, rank: B }, N) => {
1144
+ return e("li", { className: "ul-card-rank__option", draggable: !!w || void 0, onDragEnd: w ? me : void 0, onDragEnter: w ? Y : void 0, onDragLeave: w ? ee : void 0, onDragStart: w ? (J = N, (F) => {
1145
1145
  s.current = J, F.dataTransfer && (F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", String(J)), F.currentTarget.classList.add("is-dragging"));
1146
- }) : void 0, onDrop: C ? (V = L, (F) => {
1146
+ }) : void 0, onDrop: w ? (V = N, (F) => {
1147
1147
  var he, Fe;
1148
1148
  F.preventDefault(), F.currentTarget.classList.remove("is-drop-target");
1149
1149
  const $ = s.current;
1150
1150
  s.current = null, (Fe = (he = F.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : he.querySelector(".is-dragging")) == null || Fe.classList.remove("is-dragging"), $ != null && $ !== V && S($, V);
1151
- }) : void 0, ref: (F) => x.current[L] = F, children: [e("select", { "aria-label": `Rank for ${P}`, className: A("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (F) => _(E, F.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), f.map((F) => e("option", { className: "ul-card-rank__select-option", value: F, children: F }, F))] }), e("span", { children: P }), !N && e("button", { "aria-label": `Drag ${P} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: I ? O : void 0, onTouchMove: I ? j : void 0, onTouchStart: I ? h(L) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, E);
1151
+ }) : void 0, ref: (F) => x.current[N] = F, children: [e("select", { "aria-label": `Rank for ${P}`, className: A("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (F) => T(E, F.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), M.map((F) => e("option", { className: "ul-card-rank__select-option", value: F, children: F }, F))] }), e("span", { children: P }), !D && e("button", { "aria-label": `Drag ${P} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: k ? O : void 0, onTouchMove: k ? j : void 0, onTouchStart: k ? h(N) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, E);
1152
1152
  var V, J;
1153
- }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", U] }) })] }) }), e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(se, { disabled: y, children: le(r) }) }) })] }) }) }, i);
1153
+ }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Z, " - ", U] }) })] }) }), e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(se, { disabled: C, children: le(r) }) }) })] }) }) }, i);
1154
1154
  }, Re = 1, un = 2, pn = 3, we = (n) => n.type === "av_permission", We = (n) => n.type === "screen_permission", vn = (n, o) => n === void 0 ? Re : n ? ((t, r) => !(we(r) ? r.permissionDescriptors : []).includes("camera") || t.getVideoTracks().length > 0)(n, o) ? pn : Re : un, Ke = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
1155
1155
  }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, te = Cn((n) => ({ ...Ke, reset: () => {
1156
1156
  n(Ke);
@@ -1195,8 +1195,8 @@ function $e({ pages: n, setIsRequestingPermission: o }) {
1195
1195
  case "screen_permission":
1196
1196
  return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (p, b) => {
1197
1197
  const c = b ? n[s + 1] : a;
1198
- b && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (m) => {
1199
- i({ captureStream: b, mediaRecordingUids: m });
1198
+ b && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (v) => {
1199
+ i({ captureStream: b, mediaRecordingUids: v });
1200
1200
  } }), i({ currentPage: c, screenPermissionRequested: !0, captureStream: b });
1201
1201
  } });
1202
1202
  case "start_task":
@@ -1253,27 +1253,27 @@ const mn = "ul-permission-graphics-container", hn = "ul-permission-body", gn = A
1253
1253
  return null;
1254
1254
  }
1255
1255
  }, rt = ({ className: n, properties: o, next: t, questionId: r }) => {
1256
- const i = z(), { surveyId: a, responseGroupUid: d, userId: u } = i, s = te(), { screenPermissionRequested: p } = s, b = te((v) => v.avStream);
1257
- let c = te((v) => v.currentPage);
1258
- c || (c = function({ pages: v, userId: g, responseGroupUid: D, surveyId: f, questionId: w, next: k }) {
1259
- const { updatePage: R } = te.getState(), { eventEmitFn: N, recorderEventEmitter: I } = z.getState(), C = { questionId: w, surveyId: f, visitorId: g, responseGroupUid: D };
1260
- let _ = 0;
1261
- I.emit("recorded.task.permission.screen"), N("recorded.task.permission.screen"), I.emit("permission.status", { "permission.status.callback": (h, j, O, S) => {
1262
- const q = v[_], { type: Q } = q, H = ["screen"];
1256
+ const i = z(), { surveyId: a, responseGroupUid: d, userId: u } = i, s = te(), { screenPermissionRequested: p } = s, b = te((m) => m.avStream);
1257
+ let c = te((m) => m.currentPage);
1258
+ c || (c = function({ pages: m, userId: g, responseGroupUid: _, surveyId: M, questionId: f, next: y }) {
1259
+ const { updatePage: R } = te.getState(), { eventEmitFn: D, recorderEventEmitter: k } = z.getState(), w = { questionId: f, surveyId: M, visitorId: g, responseGroupUid: _ };
1260
+ let T = 0;
1261
+ k.emit("recorded.task.permission.screen"), D("recorded.task.permission.screen"), k.emit("permission.status", { "permission.status.callback": (h, j, O, S) => {
1262
+ const q = m[T], { type: Q } = q, H = ["screen"];
1263
1263
  if (we(q)) {
1264
1264
  const { permissionDescriptors: U } = q, Z = U == null ? void 0 : U.includes("microphone"), Y = U == null ? void 0 : U.includes("camera");
1265
- Z && H.push("audio"), Y && H.push("video"), (h != null && h.active && !Y || h != null && h.active && j) && _++;
1265
+ Z && H.push("audio"), Y && H.push("video"), (h != null && h.active && !Y || h != null && h.active && j) && T++;
1266
1266
  }
1267
- We(v[_]) && O && (_++, I.emit("begin.recording", { "recording.media.types": H, "start.recording.callback": (U) => R({ mediaRecordingUids: U }) })), R({ currentPage: v[_], avStream: h, screenPermissionRequested: O, nextQuestion: k, type: Q, passthroughData: C, recordingMediaTypes: H, captureStream: S });
1267
+ We(m[T]) && O && (T++, k.emit("begin.recording", { "recording.media.types": H, "start.recording.callback": (U) => R({ mediaRecordingUids: U }) })), R({ currentPage: m[T], avStream: h, screenPermissionRequested: O, nextQuestion: y, type: Q, passthroughData: w, recordingMediaTypes: H, captureStream: S });
1268
1268
  } });
1269
- const l = v[_];
1270
- return l.type === "av_permission" && Ne({ currentPage: l, pages: v }), l;
1271
- }({ questionId: r, surveyId: a, next: (v) => {
1272
- t(v, !0);
1269
+ const l = m[T];
1270
+ return l.type === "av_permission" && Ne({ currentPage: l, pages: m }), l;
1271
+ }({ questionId: r, surveyId: a, next: (m) => {
1272
+ t(m, !0);
1273
1273
  }, pages: o.pages, responseGroupUid: d, userId: u }));
1274
- let m = c.headline, x = c.captionText;
1275
- const y = vn(b, c);
1276
- return We(c) && p && (m = c.permissionDeniedHeadline, x = c.permissionDeniedCaptionText), we(c) && y === pn && (m = c.permissionGrantedHeadline, x = c.permissionGrantedCaptionText), e("div", { className: A(n, "ul-center-horizontally", "fade-in-transition"), children: [e(Ae, { isRequired: o == null ? void 0 : o.required, message: m, properties: { captionText: x } }), e(ae, { children: e(tt, { properties: o }) })] });
1274
+ let v = c.headline, x = c.captionText;
1275
+ const C = vn(b, c);
1276
+ return We(c) && p && (v = c.permissionDeniedHeadline, x = c.permissionDeniedCaptionText), we(c) && C === pn && (v = c.permissionGrantedHeadline, x = c.permissionGrantedCaptionText), e("div", { className: A(n, "ul-center-horizontally", "fade-in-transition"), children: [e(Ae, { isRequired: o == null ? void 0 : o.required, message: v, properties: { captionText: x } }), e(ae, { children: e(tt, { properties: o }) })] });
1277
1277
  }, ot = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
1278
1278
  const { visitorAttributes: a, isLongFormSurvey: d } = z((b) => ({ visitorAttributes: b.visitorAttributes, isLongFormSurvey: nn(b.studyType) })), u = (b, c = !1) => {
1279
1279
  o({ value: c ? { skipped: !0 } : void 0, questionId: r, type: i }, !0);
@@ -1297,45 +1297,45 @@ const mn = "ul-permission-graphics-container", hn = "ul-permission-body", gn = A
1297
1297
  const i = Math.round(Math.min(99, ...Object.values(o).filter((a) => a.isSubmitted).map((a) => a.progressPct || 0)));
1298
1298
  return e("div", { className: A(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(Ae, { message: `${t} (${i}% complete)` }), e("p", { className: "ul-caption", children: r })] });
1299
1299
  }, Je = 0, Xe = 1, lt = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
1300
- const a = `ul-card-video__player_recorder-q${r}`, { apiURL: d, envId: u, handleUploadUpdate: s, headers: p, responseGroupUid: b, surveyId: c, viewDocument: m, visitorId: x } = z((C) => ({ apiURL: C.apiURL, envId: C.envId, handleUploadUpdate: C.handleUploadUpdate, headers: C.headers, responseGroupUid: C.responseGroupUid, surveyId: C.surveyId, viewDocument: C.viewDocument, visitorId: C.userId })), [y, v] = G(!1), [g, D] = G(null), [f, w] = G(null), [k, R] = G(Je), N = (C, _) => {
1301
- C === M.UPLOAD_STARTED ? (D(_[M.UPLOAD_ID]), w(_[M.MEDIA_RECORDING_UID]), v(!0)) : C === M.DELETE ? (D(null), w(null), v(!1)) : C === M.UPLOAD_PROGRESS ? isNaN(_[M.UPLOAD_PROGRESS_PCT]) ? s({ mediaRecordingUid: _[M.MEDIA_RECORDING_UID], isComplete: !0 }) : s({ mediaRecordingUid: _[M.MEDIA_RECORDING_UID], progressPct: _[M.UPLOAD_PROGRESS_PCT] }) : C === M.UPLOAD_FINISHED && s({ mediaRecordingUid: _[M.MEDIA_RECORDING_UID], isComplete: !0 });
1302
- }, I = (C) => {
1303
- C.preventDefault(), C.stopPropagation(), document.getElementById(a) && ((_) => {
1304
- const l = _ + Ze;
1305
- if (T.document.getElementById(l) && T.videojs) {
1300
+ const a = `ul-card-video__player_recorder-q${r}`, { apiURL: d, envId: u, handleUploadUpdate: s, headers: p, responseGroupUid: b, surveyId: c, viewDocument: v, visitorId: x } = z((w) => ({ apiURL: w.apiURL, envId: w.envId, handleUploadUpdate: w.handleUploadUpdate, headers: w.headers, responseGroupUid: w.responseGroupUid, surveyId: w.surveyId, viewDocument: w.viewDocument, visitorId: w.userId })), [C, m] = G(!1), [g, _] = G(null), [M, f] = G(null), [y, R] = G(Je), D = (w, T) => {
1301
+ w === L.UPLOAD_STARTED ? (_(T[L.UPLOAD_ID]), f(T[L.MEDIA_RECORDING_UID]), m(!0)) : w === L.DELETE ? (_(null), f(null), m(!1)) : w === L.UPLOAD_PROGRESS ? isNaN(T[L.UPLOAD_PROGRESS_PCT]) ? s({ mediaRecordingUid: T[L.MEDIA_RECORDING_UID], isComplete: !0 }) : s({ mediaRecordingUid: T[L.MEDIA_RECORDING_UID], progressPct: T[L.UPLOAD_PROGRESS_PCT] }) : w === L.UPLOAD_FINISHED && s({ mediaRecordingUid: T[L.MEDIA_RECORDING_UID], isComplete: !0 });
1302
+ }, k = (w) => {
1303
+ w.preventDefault(), w.stopPropagation(), document.getElementById(a) && ((T) => {
1304
+ const l = T + Ze;
1305
+ if (I.document.getElementById(l) && I.videojs) {
1306
1306
  try {
1307
- if (!T.videojs(l).record().stream) return;
1307
+ if (!I.videojs(l).record().stream) return;
1308
1308
  } catch {
1309
1309
  return;
1310
1310
  }
1311
- T.videojs(l).record().stop(), T.videojs(l).record().stopDevice();
1311
+ I.videojs(l).record().stop(), I.videojs(l).record().stopDevice();
1312
1312
  }
1313
- })(a), g && f ? (s({ mediaRecordingUid: f, isSubmitted: !0 }), o({ value: { mediaRecordingUid: f }, questionId: r, type: i }, !0)) : o({ value: null, questionId: r, type: i }, !0);
1313
+ })(a), g && M ? (s({ mediaRecordingUid: M, isSubmitted: !0 }), o({ value: { mediaRecordingUid: M }, questionId: r, type: i }, !0)) : o({ value: null, questionId: r, type: i }, !0);
1314
1314
  };
1315
- return e("form", { className: A(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ae, { children: [e("div", { id: "ul-question-player-container", style: { display: k === Je ? "" : "none" }, children: e(re, { properties: t, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (C) => {
1316
- C.preventDefault(), C.stopPropagation(), document.getElementById(a) && ((_) => {
1317
- const l = ke(_ + rn);
1315
+ return e("form", { className: A(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ae, { children: [e("div", { id: "ul-question-player-container", style: { display: y === Je ? "" : "none" }, children: e(re, { properties: t, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (w) => {
1316
+ w.preventDefault(), w.stopPropagation(), document.getElementById(a) && ((T) => {
1317
+ const l = ke(T + rn);
1318
1318
  l == null || l.pause();
1319
1319
  })(a), R(Xe);
1320
- } }) }) }), e("div", { style: { display: k === Xe ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (C) => {
1321
- if (C && C.children.length === 0) {
1322
- const _ = ((l, h = {}, j = "https://api.userleap.com", O, S, q, Q = !1, H = document) => {
1323
- T.document = H;
1320
+ } }) }) }), e("div", { style: { display: y === Xe ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (w) => {
1321
+ if (w && w.children.length === 0) {
1322
+ const T = ((l, h = {}, j = "https://api.userleap.com", O, S, q, Q = !1, H = document) => {
1323
+ I.document = H;
1324
1324
  const U = l + Ze, Z = dn(U);
1325
- return T.document.addEventListener("securitypolicyviolation", (Y) => {
1325
+ return I.document.addEventListener("securitypolicyviolation", (Y) => {
1326
1326
  ie(new Error(`Voice & Video feature violates ${Y.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", j, q, h.visitorId, h.envId);
1327
1327
  }), on(tn.concat(Pn), () => {
1328
- Pe(U, Z), T.document.getElementById(He(U)).remove();
1328
+ Pe(U, Z), I.document.getElementById(He(U)).remove();
1329
1329
  try {
1330
1330
  Nn(Z, U, h, j, O, S, q, Q);
1331
1331
  } catch (Y) {
1332
1332
  return void ie(new Error(`Error when creating video recorder player object ${Y}`), "recorderDeviceError", j, q, h.visitorId, h.envId);
1333
1333
  }
1334
1334
  }), Z;
1335
- })(a, { surveyId: c, responseGroupUid: b, questionId: r, visitorId: x, envId: u }, d, N, void 0, { ...p, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === M.MEDIA_TYPE_AUDIO, m);
1336
- C.appendChild(_);
1335
+ })(a, { surveyId: c, responseGroupUid: b, questionId: r, visitorId: x, envId: u }, d, D, void 0, { ...p, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === L.MEDIA_TYPE_AUDIO, v);
1336
+ w.appendChild(T);
1337
1337
  }
1338
- } }) })] }), e(ue, { children: [e(ve, { isDisabled: !!t.required && !y, onClick: I, children: le(t) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: I, style: { ...t.required ? { display: "none" } : {}, ...y ? { display: "none" } : {} }, children: Me(t) })] })] });
1338
+ } }) })] }), e(ue, { children: [e(ve, { isDisabled: !!t.required && !C, onClick: k, children: le(t) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: k, style: { ...t.required ? { display: "none" } : {}, ...C ? { display: "none" } : {} }, children: Me(t) })] })] });
1339
1339
  }, fn = (n) => n.type === "thanks" || n.type === "uploading", dt = ({ card: n, avatars: o, isThinking: t, isCurrentQuestion: r, currentQuestionBubbleRef: i }) => {
1340
1340
  const a = ((d) => "properties" in d.props && d.props.properties && "questionHtml" in d.props.properties && d.props.properties.questionHtml ? { content: d.props.properties.questionHtml, isHtml: !0 } : "message" in d.props ? { content: d.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(n);
1341
1341
  return e(ge, { avatars: o, isLeft: !0, message: { id: `question-${n.name}`, type: "question", content: a.content }, ref: r ? i : null, children: t ? e(st, {}) : e(Be, { children: [a.isHtml ? e(ye, { className: "chat-message-text", html: a.content }) : e("div", { className: "chat-message-text", children: a.content }), n.type === "videovoice" && e(qn, { properties: n.props, questionId: n.name, surveyVideoUrl: n.props.properties.videoUrl })] }) });
@@ -1366,8 +1366,8 @@ const mn = "ul-permission-graphics-container", hn = "ul-permission-body", gn = A
1366
1366
  }, vt = ({ card: n, cardIndex: o, index: t, avatars: r, cardResponses: i, questionThinkingStates: a, startingQuestionIdx: d, currentQuestionBubbleRef: u, handleCardResponse: s }) => {
1367
1367
  const p = o === t, b = o < t, c = fn(n);
1368
1368
  if (c) return e(pt, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: p });
1369
- const m = `${n.name}`, x = i.get(m), y = n.type === "open", v = a.get(m), g = o > (d ?? 0) && n.type !== "thanks" && n.type !== "uploading" && (v === !0 || v === void 0);
1370
- return e(en.Fragment, { children: [e(dt, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: p, isThinking: g }), !g && e(ct, { avatars: r, card: n }), b && y ? e(ut, { avatars: r, card: n, userResponse: x }) : (!b || !y) && !g && e(ge, { avatars: r, isLeft: !1, message: { id: `card-${n.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(ht, { card: n, className: c ? "chat-thanks-card" : "chat-card", isAnswered: b, next: p ? s : () => {
1369
+ const v = `${n.name}`, x = i.get(v), C = n.type === "open", m = a.get(v), g = o > (d ?? 0) && n.type !== "thanks" && n.type !== "uploading" && (m === !0 || m === void 0);
1370
+ return e(en.Fragment, { children: [e(dt, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: p, isThinking: g }), !g && e(ct, { avatars: r, card: n }), b && C ? e(ut, { avatars: r, card: n, userResponse: x }) : (!b || !C) && !g && e(ge, { avatars: r, isLeft: !1, message: { id: `card-${n.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(ht, { card: n, className: c ? "chat-thanks-card" : "chat-card", isAnswered: b, next: p ? s : () => {
1371
1371
  } }) }) })] }, `question-card-${n.name}`);
1372
1372
  }, ge = en.forwardRef(({ message: n, isLeft: o = !1, children: t, avatars: r, hideAvatar: i = !1 }, a) => {
1373
1373
  const d = o ? "chat-bubble-left" : "chat-bubble-right";
@@ -1414,63 +1414,63 @@ const mt = () => {
1414
1414
  }
1415
1415
  }, yt = ({ cards: n, next: o, previousResponses: t }) => {
1416
1416
  const { cardResponses: r, setCardResponse: i } = (() => {
1417
- const [f, w] = G(/* @__PURE__ */ new Map());
1418
- return { cardResponses: f, setCardResponse: be((k, R) => {
1419
- w((N) => new Map(N).set(k, R));
1417
+ const [f, y] = G(/* @__PURE__ */ new Map());
1418
+ return { cardResponses: f, setCardResponse: be((R, D) => {
1419
+ y((k) => new Map(k).set(R, D));
1420
1420
  }, []) };
1421
- })(), { index: a, isLongFormSurvey: d, avatars: u, startingQuestionIdx: s, viewDocument: p } = z((f) => ({ index: f.index, isLongFormSurvey: nn(f.studyType), avatars: f.avatars, startingQuestionIdx: f.startingQuestionIdx, viewDocument: f.viewDocument })), { currentQuestionBubbleRef: b, scrollToCurrentQuestion: c } = (({ viewDocument: f }) => {
1422
- const w = oe(null), k = be(() => {
1423
- const R = f.querySelector(".ul-card-main-content");
1424
- if (w.current && R && R instanceof HTMLElement) {
1425
- const N = w.current.offsetTop - R.offsetTop - 16;
1426
- R.scrollTo({ top: Math.max(0, N), behavior: "smooth" });
1421
+ })(), { index: a, isLongFormSurvey: d, avatars: u, startingQuestionIdx: s, viewDocument: p, update: b } = z((f) => ({ index: f.index, isLongFormSurvey: nn(f.studyType), avatars: f.avatars, startingQuestionIdx: f.startingQuestionIdx, viewDocument: f.viewDocument, update: f.update })), { currentQuestionBubbleRef: c, scrollToCurrentQuestion: v } = (({ viewDocument: f }) => {
1422
+ const y = oe(null), R = be(() => {
1423
+ const D = f.querySelector(".ul-card-main-content");
1424
+ if (y.current && D && D instanceof HTMLElement) {
1425
+ const k = y.current.offsetTop - D.offsetTop - 16;
1426
+ D.scrollTo({ top: Math.max(0, k), behavior: "smooth" });
1427
1427
  }
1428
1428
  }, []);
1429
- return { currentQuestionBubbleRef: w, scrollToCurrentQuestion: k };
1430
- })({ viewDocument: p }), m = ((f, w, k) => {
1431
- const [R, N] = G(/* @__PURE__ */ new Map());
1429
+ return { currentQuestionBubbleRef: y, scrollToCurrentQuestion: R };
1430
+ })({ viewDocument: p }), x = ((f, y, R) => {
1431
+ const [D, k] = G(/* @__PURE__ */ new Map());
1432
1432
  return ce(() => {
1433
- if (f.length > 0 && w < f.length) {
1434
- const I = f[w], C = `${I.name}`;
1435
- if (w <= (k ?? 0) || fn(I)) return void N((l) => new Map(l).set(C, !1));
1436
- N((l) => new Map(l).set(C, !0));
1437
- const _ = setTimeout(() => {
1438
- N((l) => new Map(l).set(C, !1));
1433
+ if (f.length > 0 && y < f.length) {
1434
+ const w = f[y], T = `${w.name}`;
1435
+ if (y <= (R ?? 0) || fn(w)) return void k((h) => new Map(h).set(T, !1));
1436
+ k((h) => new Map(h).set(T, !0));
1437
+ const l = setTimeout(() => {
1438
+ k((h) => new Map(h).set(T, !1));
1439
1439
  }, 1e3);
1440
- return () => clearTimeout(_);
1440
+ return () => clearTimeout(l);
1441
1441
  }
1442
- }, [w, f, k]), R;
1443
- })(n, a, s), x = ((f, w) => {
1444
- const [k, R] = G(/* @__PURE__ */ new Set([0]));
1442
+ }, [y, f, R]), D;
1443
+ })(n, a, s), C = ((f, y) => {
1444
+ const [R, D] = G(/* @__PURE__ */ new Set([0]));
1445
1445
  return ce(() => {
1446
- R((N) => new Set(N).add(f));
1446
+ D((k) => new Set(k).add(f));
1447
1447
  }, [f]), ce(() => {
1448
- const N = w ?? 0;
1449
- N > 0 && R((I) => {
1450
- const C = new Set(I);
1451
- for (let _ = 0; _ <= N; _++) C.add(_);
1452
- return C;
1448
+ const k = y ?? 0;
1449
+ k > 0 && D((w) => {
1450
+ const T = new Set(w);
1451
+ for (let l = 0; l <= k; l++) T.add(l);
1452
+ return T;
1453
1453
  });
1454
- }, [w]), k;
1455
- })(a, s), y = fe(() => ({ ...t, ...xn(n.map((f, w) => {
1456
- var k, R;
1457
- return { ...f, value: w < a ? ((k = r.get(`${f.name}`)) == null ? void 0 : k.value) ?? null : null, secondaryValue: w < a ? ((R = r.get(`${f.name}`)) == null ? void 0 : R.secondaryValue) ?? null : null };
1458
- })) }), [t, r, n, a]), v = kn(n, y);
1454
+ }, [y]), R;
1455
+ })(a, s), m = fe(() => ({ ...t, ...xn(n.map((f, y) => {
1456
+ var R, D;
1457
+ return { ...f, value: y < a ? ((R = r.get(`${f.name}`)) == null ? void 0 : R.value) ?? null : null, secondaryValue: y < a ? ((D = r.get(`${f.name}`)) == null ? void 0 : D.secondaryValue) ?? null : null };
1458
+ })) }), [t, r, n, a]), g = kn(n, m);
1459
1459
  ce(() => {
1460
1460
  requestAnimationFrame(() => {
1461
- c();
1462
- });
1463
- }, [a, c, m]);
1464
- const g = be((f, w) => {
1465
- if (!w) return;
1466
- const k = v[a];
1467
- if (!k) return;
1468
- const R = `${k.name}`;
1469
- i(R, f);
1470
- const N = { ...f, questionText: wn(k) };
1471
- o([N]);
1472
- }, [v, a, o, i]), D = v.map((f, w) => ({ card: f, cardIndex: w })).filter(({ cardIndex: f }) => x.has(f));
1473
- return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!d && e(mt, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: D.map(({ card: f, cardIndex: w }) => e(vt, { avatars: u, card: f, cardIndex: w, cardResponses: r, currentQuestionBubbleRef: b, handleCardResponse: g, index: a, questionThinkingStates: m, startingQuestionIdx: s }, `question-card-${f.name}`)) }) })] });
1461
+ v();
1462
+ }), b();
1463
+ }, [a, v, x, b]);
1464
+ const _ = be((f, y) => {
1465
+ if (!y) return;
1466
+ const R = g[a];
1467
+ if (!R) return;
1468
+ const D = `${R.name}`;
1469
+ i(D, f);
1470
+ const k = { ...f, questionText: wn(R) };
1471
+ o([k]);
1472
+ }, [g, a, o, i]), M = g.map((f, y) => ({ card: f, cardIndex: y })).filter(({ cardIndex: f }) => C.has(f));
1473
+ return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!d && e(mt, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: M.map(({ card: f, cardIndex: y }) => e(vt, { avatars: u, card: f, cardIndex: y, cardResponses: r, currentQuestionBubbleRef: c, handleCardResponse: _, index: a, questionThinkingStates: x, startingQuestionIdx: s }, `question-card-${f.name}`)) }) })] });
1474
1474
  };
1475
1475
  export {
1476
1476
  yt as default