@sprig-technologies/sprig-bundled 2.40.0 → 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,1508 +0,0 @@
1
- import { u as Q, a as e, h as Z, p as W, c as $, g as X, b as de, d as Be, F as ye, _ as re, T as be, A as Cn, e as qe, f as xn, i as kn, j as wn, k as En, w as nn } from "./view-BjWfEnbU.js";
2
- import { v as jn, E as Te, h as Ue, A as Oe, j as In, i as tn } from "./index-gY11yXiE.js";
3
- import { B as ae, M as se, Q as ve, O as Ae, a as le, b as xe, S as Tn, L as _n, u as Dn, H as Ce, c as $e, g as Sn, P as Pn } from "./getAttributedUrl-BQOt-2c9.js";
4
- const me = "https://cdn.sprig.com", T = { document: void 0, videojs: void 0 }, He = (n) => n + "-loading-spiner", J = "hidden", Ge = ".m3u8", _e = "questionId", De = "ul-video-recorder-camera-off-button", Se = "ul-recording-in-session", Rn = [{ type: "link", content: `${me}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${me}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${me}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${me}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${me}/userleap-web-upchunk-v2.2.2.js` }], rn = [{ type: "link", content: `${me}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${me}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
5
- .video-js .vjs-control {
6
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
7
- }
8
-
9
- .video-js .vjs-progress-control .vjs-progress-holder {
10
- margin: 0 0px;
11
- }
12
-
13
- .video-js .vjs-progress-control {
14
- position: absolute;
15
- height: 3px;
16
- width: 100%;
17
- }
18
- /* position and align the buttons and button texts */
19
- .ul-control-panel {
20
- bottom: 0;
21
- width: 100%;
22
- flex-direction: column;
23
- background-color: white;
24
- height: fit-content;
25
- z-index: 2;
26
- }
27
-
28
- .ul-buttons-panel {
29
- color: black;
30
- display: flex;
31
- gap: 20px;
32
- height: 50px;
33
- justify-content: center;
34
- margin: 10px;
35
- padding: 2px 14px 0;
36
- }
37
-
38
- .video-js .vjs-volume-panel {
39
- height: 30px;
40
- width: 40px;
41
- }
42
-
43
- .ul-inactive {
44
- opacity: 0.3;
45
- cursor: default;
46
- pointer-events: none;
47
- }
48
-
49
- /* buttons */
50
- .ul-buttons-panel > .vjs-button {
51
- background-color: rgba(0, 0, 0, 0.05);
52
- border-radius: 50%;
53
- display: flex;
54
- height: 3em;
55
- justify-content: center;
56
- width: 3em;
57
- }
58
-
59
- .vjs-button>.vjs-icon-placeholder:before {
60
- align-items: center;
61
- display: flex;
62
- font-size: unset;
63
- line-height: 0.5;
64
- justify-content: center;
65
- }
66
-
67
- span.ul-button-text {
68
- align-self: flex-end;
69
- position: relative;
70
- top: 14px;
71
- }
72
-
73
- #ul-camera-button {
74
- white-space: nowrap;
75
- }
76
-
77
- .video-js .vjs-volume-control.vjs-volume-horizontal {
78
- background-color: #fff;
79
- z-index: 1;
80
- }
81
-
82
- .vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level {
83
- background-color: black;
84
- }
85
-
86
- .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,
87
- .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,
88
- .video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active {
89
- width: 40px;
90
- }
91
-
92
- .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,
93
- .video-js .vjs-volume-panel .vjs-volume-control:active,
94
- .video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control,
95
- .video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,
96
- .video-js .vjs-volume-panel:active .vjs-volume-control,
97
- .video-js .vjs-volume-panel:focus .vjs-volume-control {
98
- visibility: visible;
99
- left: 40px;
100
- position: absolute;
101
- transition: visibility 0.1s, opacity 0.1s, height 0.1s, width 0.1s, left 0s, top 0s;
102
- }
103
-
104
- /* play button customization */
105
- .video-js .vjs-play-control {
106
- color: black;
107
- }
108
-
109
- .video-js .vjs-play-control .vjs-icon-placeholder:before {
110
- content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5363 6.40226L1.93958 10.7006C1.64037 10.8502 1.28833 10.6326 1.28833 10.2981V1.7014C1.28833 1.36688 1.64037 1.14931 1.93958 1.29891L10.5363 5.59727C10.868 5.76311 10.868 6.23642 10.5363 6.40226Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
111
- }
112
-
113
- /* position and style the current timer */
114
- .ul-time-panel {
115
- position: absolute;
116
- bottom: 80px;
117
- left: 10px;
118
- height: 22px;
119
- color: black;
120
- border: 1px solid #e0e0eb;
121
- border-radius: 23px;
122
- background-color: white;
123
- width: fit-content;
124
- }
125
-
126
- .video-js .vjs-current-time,
127
- .vjs-no-flex .vjs-current-time {
128
- display: flex;
129
- align-items: center;
130
- text-align: center;
131
- }
132
-
133
- /* remove the dot progress indicator */
134
- .video-js .vjs-play-progress:before,
135
- .video-js .vjs-volume-level:before,
136
- .vjs-icon-circle:before,
137
- .vjs-seek-to-live-control .vjs-icon-placeholder:before {
138
- content: none;
139
- }
140
-
141
- .video-js .vjs-mute-control .vjs-icon-placeholder:before {
142
- content: url("data:image/svg+xml,%3Csvg width='19' height='14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.825.324A.75.75 0 019.25 1v11.667a.75.75 0 01-1.219.585l-3.96-3.169H1a.75.75 0 01-.75-.75v-5a.75.75 0 01.75-.75h3.07L8.031.414a.75.75 0 01.794-.09zM7.75 2.56L4.802 4.92a.75.75 0 01-.469.164H1.75v3.5h2.583a.75.75 0 01.469.165l2.948 2.358V2.56zM14.911.47a.75.75 0 011.061 0 9.084 9.084 0 010 12.844.75.75 0 01-1.06-1.06 7.584 7.584 0 000-10.724.75.75 0 010-1.06zM11.97 3.41a.75.75 0 011.06 0 4.917 4.917 0 010 6.953.75.75 0 11-1.06-1.06 3.417 3.417 0 000-4.832.75.75 0 010-1.06z' fill='%23262136'/%3E%3C/svg%3E");
143
- }
144
-
145
- .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before {
146
- content: url("data:image/svg+xml,%3Csvg width='19' height='14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.5 1.167L4.333 4.5H1v5h3.333L8.5 12.833V1.167zM17.17 4.5l-5 5M12.17 4.5l5 5' stroke='%23262136' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
147
- }
148
-
149
- .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before {
150
- content: url("data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.82489 0.32403C9.08474 0.44892 9.25 0.711703 9.25 1.00001V12.6667C9.25 12.955 9.08474 13.2178 8.82489 13.3427C8.56504 13.4675 8.25661 13.4324 8.03148 13.2523L4.07025 10.0833H1C0.585786 10.0833 0.25 9.74755 0.25 9.33334V4.33334C0.25 3.91913 0.585786 3.58334 1 3.58334H4.07025L8.03148 0.414355C8.25661 0.234253 8.56504 0.19914 8.82489 0.32403ZM7.75 2.56048L4.80185 4.91899C4.66887 5.02538 4.50364 5.08334 4.33333 5.08334H1.75V8.58334H4.33333C4.50364 8.58334 4.66887 8.6413 4.80185 8.74769L7.75 11.1062V2.56048Z' fill='%23262136'/%3E%3C/svg%3E%0A");
151
- }
152
-
153
- .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before {
154
- content: url("data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.82489 0.32403C9.08474 0.44892 9.25 0.711703 9.25 1.00001V12.6667C9.25 12.955 9.08474 13.2178 8.82489 13.3427C8.56504 13.4675 8.25661 13.4324 8.03148 13.2523L4.07025 10.0833H1C0.585786 10.0833 0.25 9.74755 0.25 9.33334V4.33334C0.25 3.91913 0.585786 3.58334 1 3.58334H4.07025L8.03148 0.414355C8.25661 0.234253 8.56504 0.19914 8.82489 0.32403ZM7.75 2.56048L4.80185 4.91899C4.66887 5.02538 4.50364 5.08334 4.33333 5.08334H1.75V8.58334H4.33333C4.50364 8.58334 4.66887 8.6413 4.80185 8.74769L7.75 11.1062V2.56048Z' fill='%23262136'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.9698 3.41124C12.2627 3.11839 12.7376 3.11846 13.0304 3.4114C13.9521 4.33341 14.4699 5.58376 14.4699 6.88748C14.4699 8.19121 13.9521 9.44156 13.0304 10.3636C12.7376 10.6565 12.2627 10.6566 11.9698 10.3637C11.6768 10.0709 11.6767 9.596 11.9696 9.30307C12.6101 8.66235 12.9699 7.79346 12.9699 6.88748C12.9699 5.98151 12.6101 5.11262 11.9696 4.4719C11.6767 4.17896 11.6768 3.70409 11.9698 3.41124Z' fill='%23262136'/%3E%3C/svg%3E%0A");
155
- }
156
-
157
- .video-js .vjs-volume-control:hover .vjs-mouse-display {
158
- display: none !important;
159
- }
160
-
161
- .video-js .vjs-play-progress {
162
- background-color: black;
163
- }
164
-
165
- /* position video player inside the container */
166
- .video-js .vjs-tech {
167
- position: static;
168
- }
169
-
170
- .video-js .vjs-time-tooltip {
171
- padding: 0.25em 0.75em;
172
- align-items: center;
173
- color: #333;
174
- background: #FCFCFD;
175
- border-radius: 99px;
176
- text-align: center;
177
- border: 1px solid #E0E0EB;
178
- display: flex;
179
- align-items: center;
180
- justify-content: center;
181
- top: -25px;
182
- font-size: 12px !important;
183
- width: 50px !important;
184
- }
185
-
186
- .video-js .vjs-play-progress.vjs-slider-bar .vjs-time-tooltip {
187
- visibility: hidden !important;
188
- }
189
-
190
- .video-js .vjs-progress-control .vjs-mouse-display {
191
- z-index: 2;
192
- }
193
-
194
- .ul-video-player {
195
- width: 100%;
196
- display: flex;
197
- flex-direction: column;
198
- height: auto;
199
- border: 1px solid #E6E6E6;
200
- background-color: white;
201
- box-sizing: border-box;
202
- border-radius: 4px;
203
- background-clip: border-box;
204
- overflow: hidden;
205
- }
206
-
207
- .video-js.vjs-fullscreen:not(.vjs-ios-native-fs) {
208
- border: none;
209
- }
210
-
211
- #video-response-player-secondary-video-player {
212
- max-width: 200px;
213
- margin-right: 20px;
214
- background-color: transparent;
215
- }
216
-
217
- #ul-card-video__player_recorder-video-recorder.vjs-fullscreen {
218
- display: table;
219
- }
220
-
221
- .video-js div.vjs-progress-control {
222
- margin-top: -3px;
223
- }
224
-
225
- .video-js .vjs-progress-control .vjs-slider {
226
- background-color: #B2BBBD;
227
- }
228
-
229
- .vjs-record.video-js .vjs-control.vjs-button.vjs-fullscreen-control {
230
- position:relative;
231
- }
232
-
233
- .video-js .vjs-fullscreen-control .vjs-icon-placeholder:before {
234
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.82143 2.54004L12.2614 2.54004C12.9242 2.54004 13.4614 3.0773 13.4614 3.74004L13.4614 6.18004' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M6.17955 13.46L3.73955 13.46C3.07681 13.46 2.53955 12.9227 2.53955 12.26L2.53955 9.81996' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12.7772 3.22266L9.36475 6.63516' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M6.29434 9.70605L2.88184 13.1186' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
235
- }
236
-
237
- .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before {
238
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.583 9.813H5.25a1 1 0 011 1v3.666M5.375 10.688L1 15.061M14.917 5.813H11.25a1 1 0 01-1-1V1.146M15.063 1l-4.376 4.375' stroke='%23262136' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
239
- }
240
-
241
- .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before, .video-js .vjs-icon-replay:before {
242
- content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5363 6.40226L1.93958 10.7006C1.64037 10.8502 1.28833 10.6326 1.28833 10.2981V1.7014C1.28833 1.36688 1.64037 1.14931 1.93958 1.29891L10.5363 5.59727C10.868 5.76311 10.868 6.23642 10.5363 6.40226Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
243
- }
244
-
245
- .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before, .vjs-icon-pause:before {
246
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3.61885' y='2.06074' width='3.16185' height='11.88' rx='0.9' fill='black' stroke='%23EDEDED' stroke-width='0.6' stroke-linecap='round'/%3E%3Crect x='9.21797' y='2.06074' width='3.16185' height='11.88' rx='0.9' fill='black' stroke='%23EDEDED' stroke-width='0.6' stroke-linecap='round'/%3E%3C/svg%3E%0A");
247
- padding: 2px;
248
- }
249
-
250
- .vjs-error-display {
251
- display: none;
252
- }
253
-
254
- .ul-video-player-video {
255
- position: relative;
256
- top: 0;
257
- left: 0;
258
- width: 100%;
259
- }
260
-
261
- .ul-video-container {
262
- width: 100%;
263
- height: auto;
264
- left: 0px;
265
- top: 0px;
266
-
267
- background-color: transparent;
268
- border-radius: 4px;
269
-
270
- align-items: start;
271
- display: flex;
272
- flex-direction: column;
273
-
274
- /* Inside Auto Layout */
275
-
276
- flex: none;
277
- order: 0;
278
- flex-grow: 0;
279
- margin: 10px 0px;
280
- position: relative;
281
- }
282
-
283
- .vjs-record button.vjs-device-button.vjs-control {
284
- background: rgba(255, 255, 255, 96);
285
- width: 100%;
286
- height: 100%;
287
- left: 0;
288
- top: 0;
289
- margin: 0;
290
- border-radius: 0;
291
- line-height: 0.6;
292
- padding: 10px;
293
- display: flex;
294
- align-items: center;
295
- flex-direction: column;
296
- justify-content: center;
297
- z-index: 3;
298
- }
299
-
300
- .vjs-record .vjs-device-button.vjs-control:before {
301
- font-size: 14px !important;
302
- color: #333;
303
- content: "Your browser needs to access your camera and microphone for video recording";
304
- line-height: 135%;
305
- }
306
-
307
- .vjs-record .vjs-device-button.vjs-control.permission-denied:before {
308
- font-size: 16px !important;
309
- color: #262136;
310
- content: "Unable to access your camera and microphone";
311
- }
312
-
313
- .vjs-record .vjs-device-button.vjs-control:after {
314
- display: inline-block;
315
- background: #F0F0F5;
316
- font-size: 13px;
317
- border-radius: 4px;
318
- content: "Request Permissions";
319
- padding: 1em 2em;
320
- color: #333;
321
- margin-top: 20px;
322
- }
323
-
324
- .vjs-record .vjs-device-button.vjs-control.permission-denied:after {
325
- display: inline-block;
326
- background: white;
327
- font-size: 13px;
328
- content: "Please go to your browser settings and update permissions to enable recording";
329
- padding: 1em;
330
- color: #4B575D;
331
- margin: 5px;
332
- line-height: 135%;
333
- text-align: center;
334
- }
335
-
336
- .vjs-control.vjs-button.ul-video-recorder-delete-button, .vjs-control.vjs-button.ul-video-recorder-toggle-button, .vjs-control.vjs-button.ul-video-recorder-camera-off-button-audio-only, .vjs-control.vjs-button.ul-video-recorder-camera-off-button {
337
- cursor: pointer;
338
- }
339
-
340
- .ul-video-recorder-delete-button .vjs-icon-placeholder:before {
341
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.21234 7.37549V11.1193M2.53931 4.25595H13.4593H2.53931ZM5.57234 4.25595V3.00833C5.57222 2.84433 5.60354 2.68192 5.6645 2.53038C5.72546 2.37884 5.81488 2.24115 5.92762 2.12519C6.04037 2.00922 6.17424 1.91726 6.32158 1.85456C6.46892 1.79185 6.62683 1.75964 6.78628 1.75977H9.21234C9.37179 1.75964 9.5297 1.79185 9.67703 1.85456C9.82437 1.91726 9.95824 2.00922 10.071 2.12519C10.1837 2.24115 10.2732 2.37884 10.3341 2.53038C10.3951 2.68192 10.4264 2.84433 10.4263 3.00833V4.25595H5.57234ZM12.2463 4.25595V12.9912C12.2463 13.3223 12.1184 13.6399 11.8907 13.8741C11.6631 14.1082 11.3543 14.2398 11.0323 14.2398H4.96628C4.64432 14.2398 4.33555 14.1082 4.10789 13.8741C3.88023 13.6399 3.75234 13.3223 3.75234 12.9912V4.25595H12.2463ZM6.78628 7.37549V11.1193V7.37549Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
342
- }
343
-
344
- .ul-video-recorder-toggle-button .vjs-icon-placeholder:before {
345
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0Z' fill='%23D15153'/%3E%3C/svg%3E");
346
- }
347
-
348
- .ul-video-recorder-toggle-button.ul-recording-in-session .vjs-icon-placeholder:before {
349
- content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 10L12 2C12 0.89543 11.1046 -4.85396e-07 10 -4.37114e-07L2 -8.74228e-08C0.89543 -3.91405e-08 -4.85396e-07 0.895431 -4.37114e-07 2L-8.74228e-08 10C-3.91405e-08 11.1046 0.895431 12 2 12L10 12C11.1046 12 12 11.1046 12 10Z' fill='%23D15153'/%3E%3C/svg%3E%0A");
350
- }
351
-
352
- .ul-video-recorder-camera-off-button .vjs-icon-placeholder:before {
353
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_2645_4654)'%3E%3Cpath d='M15.1491 4.75L10.5991 8L15.1491 11.25V4.75Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M9.29912 3.4502H2.14912C1.43115 3.4502 0.849121 4.03223 0.849121 4.7502V11.2502C0.849121 11.9682 1.43115 12.5502 2.14912 12.5502H9.29912C10.0171 12.5502 10.5991 11.9682 10.5991 11.2502V4.7502C10.5991 4.03223 10.0171 3.4502 9.29912 3.4502Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_2645_4654'%3E%3Crect width='15.6' height='15.6' fill='white' transform='translate(0.199951 0.200195)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
354
- }
355
-
356
- .ul-video-recorder-camera-off-button-audio-only .vjs-icon-placeholder:before {
357
- content: url("data:image/svg+xml,%3Csvg width='22' height='15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M.75 3A2.75 2.75 0 013.5.25h9.081A2.75 2.75 0 0115.331 3v9a2.75 2.75 0 01-2.75 2.75H3.5A2.75 2.75 0 01.75 12V3zM3.5 1.75c-.69 0-1.25.56-1.25 1.25v9c0 .69.56 1.25 1.25 1.25h9.081c.69 0 1.25-.56 1.25-1.25V3c0-.69-.56-1.25-1.25-1.25H3.5z' fill='%23262136'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.53 2.03l-12 12-1.06-1.06 12-12 1.06 1.06zM20.87 1.525a.75.75 0 01.38.652v10.588a.75.75 0 01-1.134.644l-5.92-3.53a.75.75 0 01-.365-.643v-3.53a.75.75 0 01.366-.644l5.919-3.53a.75.75 0 01.754-.007zm-5.539 4.607V8.81l4.419 2.635V3.497l-4.419 2.635z' fill='%23262136'/%3E%3C/svg%3E");
358
- transform: scale(0.75);
359
- }
360
-
361
- .ul-upload-progress-label {
362
- padding: 0.15em 0.75em;
363
- align-items: center;
364
- font-size: 12px;
365
- color: #333;
366
- background: #FCFCFD;
367
- border-radius: 99px;
368
- text-align: center;
369
- border: 1px solid #E0E0EB;
370
- display: flex;
371
- align-items: center;
372
- justify-content: center;
373
- position: absolute;
374
- bottom: 75px;
375
- left: calc(50% - 65px);
376
- width: 130px;
377
- z-index: 5;
378
- }
379
-
380
- .ul-upload-progress-label__time {
381
- display: inline-flex;
382
- margin-left: 0.8em;
383
- align-items: center;
384
- }
385
-
386
- .ul-upload-progress-label__time:before {
387
- content: "";
388
- display: inline-flex;
389
- width: 1px;
390
- height: 12px;
391
- background-color: #E0E0EB;
392
- margin-right: 0.8em;
393
- }
394
-
395
- @keyframes grow {
396
- 0% {
397
- transform: scale(1);
398
- background-color: #EEECFC;
399
- }
400
- 50% {
401
- transform: scale(1.2);
402
- background-color: #E1DFF4;
403
- }
404
- 100% {
405
- transform: scale(1);
406
- background-color: #EEECFC;
407
- }
408
- }
409
-
410
- .ul-audio-recorder-placeholder:before {
411
- width: 80px;
412
- height: 80px;
413
- border-radius: 120px;
414
- background-color: #EEECFC;
415
- content: "";
416
- position: absolute;
417
- left: calc(50% - 40px);
418
- top: calc(50% - 40px);
419
- animation: 6s infinite grow;
420
- transform-origin: 50% 60%;
421
- }
422
-
423
- .ul-audio-recorder-placeholder:after {
424
- content: url("data:image/svg+xml,%3Csvg width='98' height='98' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='a' maskUnits='userSpaceOnUse' x='0' y='0' width='98' height='98'%3E%3Ccircle cx='49' cy='49' r='49' fill='%23EDECF8'/%3E%3C/mask%3E%3Cg mask='url(%23a)'%3E%3Ccircle cx='49' cy='49' r='50' fill='%23645CC2'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.422 81.812c5.405-15.547 20.187-26.706 37.576-26.706 17.39 0 32.172 11.159 37.577 26.707-9.164 10.43-22.601 17.013-37.576 17.013-14.976 0-28.414-6.583-37.577-17.014z' fill='%23fff' fill-opacity='.6'/%3E%3Ccircle cx='49' cy='29' r='17' fill='%23fff' fill-opacity='.7'/%3E%3C/g%3E%3C/svg%3E");
425
- position: absolute;
426
- left: 50%;
427
- top: 50%;
428
- transform: translate(-50%, -50%);
429
- transform: translate(-50%, -50%) scale(0.6);
430
- }
431
-
432
- .ul-audio-recorder-placeholder {
433
- min-height: 150px;
434
- width: 100%;
435
- background-color: #fcfcfd;
436
- display: block;
437
- position: relative;
438
- }
439
-
440
- .vjs-fullscreen .ul-audio-recorder-placeholder {
441
- vertical-align: middle;
442
- display: table-cell;
443
- }
444
-
445
- .vjs-fullscreen .ul-control-panel {
446
- height: 80px;
447
- position: absolute;
448
- bottom: 0;
449
- left: 0;
450
- width: 100%;
451
- max-width: 100%;
452
- background-color: #F8F8F8;
453
- }
454
-
455
- .vjs-playback-rate .vjs-playback-rate-value {
456
- align-items: center;
457
- display: flex;
458
- font-size: 12px;
459
- justify-content: center;
460
- }
461
-
462
- .vjs-playback-rate .vjs-menu {
463
- left: -5px;
464
- bottom: 3px;
465
- }
466
-
467
- .vjs-menu-button-popup .vjs-menu .vjs-menu-content {
468
- background-color: white;
469
- border: 1px solid rgba(0, 0, 0, 0.1);
470
- box-sizing: border-box;
471
- border-radius: 4px;
472
- }
473
-
474
- .vjs-menu li {
475
- font-size: 12px;
476
- padding: 5px 0;
477
- }
478
-
479
- .vjs-menu li.vjs-selected {
480
- color: lightgray;
481
- }
482
-
483
- .vjs-menu li.vjs-menu-item:hover {
484
- background-color: rgba(0, 0, 0, 0.05);
485
- }
486
-
487
- .vjs-fullscreen .ul-buttons-panel {
488
- top: calc(50% - 30px);
489
- position: relative;
490
- }
491
-
492
- .vjs-fullscreen .vjs-record-indicator.vjs-control {
493
- bottom: 90px !important;
494
- }
495
-
496
- .vjs-record.video-js div.vjs-control.vjs-record-indicator {
497
- padding: 0.3em 0.75em 0.15em 15px;
498
- align-items: center;
499
- font-size: 12px;
500
- color: #333;
501
- background: #FCFCFD;
502
- border-radius: 99px;
503
- text-align: center;
504
- border: 1px solid #E0E0EB;
505
- display: flex;
506
- justify-content: center;
507
- align-items: center;
508
- position: absolute;
509
- bottom: 75px;
510
- top: auto;
511
- left: calc(50% - 21px);
512
- width: 43px;
513
- height: 16px;
514
- z-index: 4;
515
- }
516
-
517
- .vjs-record.video-js div.vjs-control.vjs-record-indicator:after {
518
- content: "";
519
- background-color: #EB5757;
520
- width: 6px;
521
- height: 6px;
522
- border-radius: 8px;
523
- animation: none;
524
- top: 4px;
525
- left: 5px;
526
- }
527
-
528
- .vjs-record.video-js div.vjs-control.vjs-record-indicator:before {
529
- position: relative;
530
- font-size: 9px;
531
- animation: none;
532
- opacity: 1;
533
- color: #333;
534
- top: auto;
535
- left: auto;
536
- }
537
-
538
- .ul-video-player-loading {
539
- display: inline-block;
540
- position: relative;
541
- width: 6rem;
542
- height: 6rem;
543
-
544
- }
545
- .ul-video-player-loading div {
546
- box-sizing: border-box;
547
- position: absolute;
548
- display: block;
549
- width: 80%;
550
- height: 80%;
551
- margin: 5px;
552
- border: 5px solid #666;
553
- border-radius: 50%;
554
- animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
555
- border-color: #666 transparent transparent transparent;
556
- }
557
-
558
- .first {
559
- animation-delay: -0.45s;
560
- }
561
- .second {
562
- animation-delay: -0.3s;
563
- }
564
- .third {
565
- animation-delay: -0.15s;
566
- }
567
-
568
- @keyframes lds-ring {
569
- 0% {
570
- transform: rotate(0deg);
571
- }
572
- 100% {
573
- transform: rotate(360deg);
574
- }
575
- }
576
-
577
- .ul-video-btn {
578
- width: 100%;
579
- border: 1px solid #E6E6E6;
580
- border-radius: 4px;
581
- background-color: rgba(0, 0, 0, 0.02);
582
- padding: 8px;
583
- font-weight: 500;
584
- font-size: 15px;
585
- }
586
-
587
- .ul-record-response-btn:before, .ul-record-response-btn:after, .ul-back-question-btn:before, .ul-back-question-btn:after {
588
- margin: 0 5px;
589
- vertical-align: middle;
590
- }
591
-
592
- .ul-record-response-btn:before {
593
- content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_2645_4654)'%3E%3Cpath d='M15.1491 4.75L10.5991 8L15.1491 11.25V4.75Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M9.29912 3.4502H2.14912C1.43115 3.4502 0.849121 4.03223 0.849121 4.7502V11.2502C0.849121 11.9682 1.43115 12.5502 2.14912 12.5502H9.29912C10.0171 12.5502 10.5991 11.9682 10.5991 11.2502V4.7502C10.5991 4.03223 10.0171 3.4502 9.29912 3.4502Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_2645_4654'%3E%3Crect width='15.6' height='15.6' fill='white' transform='translate(0.199951 0.200195)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
594
- display: inline-block;
595
- transform: translate(0px, 2px);
596
- }
597
-
598
- .ul-record-response-btn:after {
599
- content: 'Record your Response';
600
- }
601
-
602
- .ul-back-question-btn:before {
603
- content: url("data:image/svg+xml,%3Csvg width='15' height='16' viewBox='0 0 15 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.8757 8.22361L1.1118 14.6056C0.945578 14.6887 0.75 14.5678 0.75 14.382V1.61803C0.75 1.43219 0.945579 1.31131 1.1118 1.39443L13.8757 7.77639C14.06 7.86852 14.06 8.13148 13.8757 8.22361Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
604
- display: inline-block;
605
- transform: scale(0.85) translate(0, 1px);
606
- -moz-transform: scale(0.85) translate(0, 2px);
607
- }
608
-
609
- .ul-back-question-btn:after {
610
- content: 'Back to Question';
611
- }
612
-
613
- .hidden {
614
- display: none !important;
615
- opacity: 0;
616
- visibility: hidden;
617
- }
618
-
619
- .visible {
620
- visibility: visible;
621
- opacity: 1;
622
- animation: fade 0.3s;
623
- }
624
-
625
- @keyframes fade {
626
- 0% {
627
- opacity: 0;
628
- }
629
-
630
- 100% {
631
- opacity: 1;
632
- }
633
- }
634
-
635
- #ul-recording-countdown-screen {
636
- width: 100%;
637
- height: 100%;
638
- color: black;
639
- background-color: rgba(255, 255, 255, 0.8);
640
- position: absolute;
641
- text-align: center;
642
- font-size: 15px;
643
- z-index: 1;
644
- display: table;
645
- }
646
-
647
- .ul-countdown-text {
648
- vertical-align: middle;
649
- display: table-cell;
650
- transform: translate(0, -25px);
651
- }
652
-
653
- .vjs-fullscreen > #ul-recording-countdown-screen {
654
- font-size: 25px;
655
- transform: unset;
656
- }
657
-
658
- .vjs-poster {
659
- background-size: cover;
660
- }
661
- ` }], on = "-video-player", Ze = "-secondary-video-player", Qe = "-video-recorder";
662
- let te, Ye;
663
- const pe = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: s, metadata: a }) => {
664
- const d = T.document.documentElement;
665
- if (!r || !s) return;
666
- const u = { event: `SDK - ${n}`, visitorId: r, environmentId: s, metadata: { ...a || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language } };
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
- }, ie = async (n, o, t, r, s, a) => {
669
- pe({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: s, 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 }, i = { action: o, err: { message: n.message, stack: n.stack }, meta: u, vid: s, envId: a };
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(i) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", n);
672
- }, sn = (n, o) => {
673
- if (n.length === 0) return o && o();
674
- Promise.all(n.reduce((t, r) => (t.push(((s, { type: a, content: d }) => new Promise(function(u, i) {
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() {
677
- u(d);
678
- }, p.onerror = function() {
679
- i(d);
680
- }, p.async = !1, p.id = btoa(d), s.appendChild(p);
681
- }))(T.document.head, r)), t), [])).then(() => {
682
- T.videojs = T.document.defaultView.videojs, o && o();
683
- }).catch(function(t) {
684
- console.log(t + " failed to load");
685
- });
686
- }, We = (n, o, t) => {
687
- if (o === "start" && (n.style.visibility = "visible"), o === "none") n.style.visibility = J;
688
- else if (o === "success") n.style.visibility = J, n.innerHTML = "Upload succeeded!";
689
- else {
690
- const r = Math.round(parseFloat(t));
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
- }
693
- }, Pe = (n, o) => {
694
- const t = T.videojs(n.id());
695
- return t == null ? void 0 : t.payload[o];
696
- }, an = (n, o) => {
697
- const t = new (T.videojs.getComponent("Component"))(n);
698
- return t.addClass("ul-buttons-panel"), o.map((r) => {
699
- t.addChild(r);
700
- }), Nn(t), t;
701
- }, Nn = (n) => {
702
- n.children().forEach((o) => {
703
- if (ne[o.name_]) {
704
- const t = ke(ne[o.name_], `ul-${ne[o.name_]}`);
705
- o.el_.appendChild(t);
706
- }
707
- });
708
- }, ke = (n, o = "") => {
709
- const t = T.document.createElement("span");
710
- return t.className = "ul-button-text", t.innerHTML = n, t.id = o, t;
711
- }, ln = (n, o, t, r, s = !1, a) => {
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");
715
- const u = t && t.src ? qn(t.src) : null;
716
- !t || !s && 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", () => {
717
- s || !t || u || Mn(n), a == null || a.play();
718
- }), n.on("pause", () => {
719
- a == null || a.pause();
720
- }), n.on("seeked", () => {
721
- a == null || a.currentTime(n.currentTime());
722
- }), n.on("ratechange", () => {
723
- a == null || a.playbackRate(n.playbackRate());
724
- }), n.addChild(n.audioPlayerPlaceholder, {}, 1), d.addChild(o), n.addChild(d), r && r(n);
725
- }, Ln = (n, o, t, r, s, a, d, u = !1) => {
726
- Ye = Date.now();
727
- const i = we(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
- if (!i) return;
729
- i.payload = t;
730
- const { surveyId: p, questionId: y, responseGroupUid: h, visitorId: l, envId: j } = t;
731
- let E;
732
- const m = (b) => {
733
- const v = De, k = De + "-audio-only";
734
- We(i.uploadProgressLabel, "none"), te && te.startTime >= Ye && te.abort();
735
- const O = T.document.getElementById("ul-camera-button");
736
- b ? (i.children()[0].classList.add("vjs-hidden"), g.removeClass(v), g.addClass(k), O.innerHTML = ne.TurnOnCamera, i.audioPlayerPlaceholder.removeClass("vjs-hidden"), E == null || E.getTracks().forEach((f) => {
737
- f.stop();
738
- }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((f) => {
739
- E = f, f.getVideoTracks().forEach((_) => {
740
- _.enabled = !1;
741
- }), i.record().onDeviceReady(f);
742
- }).catch(i.record().onDeviceError.bind(i.record()))) : (E == null || E.getVideoTracks().forEach((f) => {
743
- f.enabled = !0;
744
- }), i.children()[0].classList.remove("vjs-hidden"), i.record().getDevice(), g.removeClass(k), g.addClass(v), O.innerHTML = ne.TurnOffCamera, i.audioPlayerPlaceholder.addClass("vjs-hidden"));
745
- }, c = new (T.videojs.getComponent("Button"))(i, { clickHandler: () => {
746
- c.hasClass(J) || (pe({ event: "Video Delete Button Clicked", apiBase: r, headers: d, visitorId: l, envId: j, metadata: { questionId: y, responseGroupUid: h, surveyId: p } }), m(i.cameraOff), s(L.DELETE, {}), g.removeClass(J), c.addClass(J));
747
- } });
748
- c.addClass("ul-video-recorder-delete-button"), c.el_.appendChild(ke(ne.DeleteButton, "ul-delete-button"));
749
- const P = T.document.getElementById(o), R = () => {
750
- P.classList.contains("vjs-fullscreen") && i.cameraOff ? P.style.display = "table" : P.style.display = "flex";
751
- };
752
- R();
753
- const g = new (T.videojs.getComponent("Button"))(i, { clickHandler: () => {
754
- i.record().isRecording() || (i.cameraOff = !i.cameraOff, pe({ event: "Video Camera Button Clicked", apiBase: r, headers: d, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: y, responseGroupUid: h, surveyId: p, cameraOff: i.cameraOff } }), m(i.cameraOff), !c.hasClass(J) && c.addClass(J), s(L.DELETE, {}), R());
755
- } });
756
- g.addClass(De), g.el_.appendChild(ke(ne.TurnOffCamera, "ul-camera-button"));
757
- const I = new (T.videojs.getComponent("Button"))(i, { clickHandler: () => {
758
- const b = T.document.getElementById("ul-recorder-toggle");
759
- if (i.record().isRecording()) i.record().stop(), b && (b.innerHTML = ne.RecordButton), I.removeClass(Se), c.removeClass(J);
760
- else {
761
- const v = T.document.getElementById("ul-recording-countdown-screen");
762
- if (v) v.remove(), b && (b.innerHTML = ne.RecordButton), m(i.cameraOff), s(L.DELETE, {}), g.removeClass(J), c.addClass(J), I.removeClass(Se), x.show();
763
- else {
764
- I.addClass(Se), x.hide(), g.addClass(J), c.addClass(J), b && (b.innerHTML = ne.StopButton);
765
- const k = T.document.createElement("div");
766
- k.id = "ul-recording-countdown-screen", P.insertBefore(k, P.children[1]), k.style.height = `${P.offsetHeight}px`, dn(i, 3);
767
- }
768
- }
769
- } });
770
- I.addClass("ul-video-recorder-toggle-button"), I.el_.appendChild(ke(ne.RecordButton, "ul-recorder-toggle"));
771
- const w = T.document.createElement("p");
772
- w.style.visibility = "hidden", w.className = "ul-upload-progress-label", n.appendChild(w), i.uploadProgressLabel = w;
773
- const M = an(i, [c, g, "PlayToggle", I, "FullscreenToggle"]), x = M.children().find((b) => b.name_ === "FullscreenToggle");
774
- x.hasClass("vjs-disabled") && x.hide();
775
- const q = M.children().find((b) => b.name_ === "PlayToggle");
776
- q.hide(), c.addClass(J), ln(i, M, a, !1, u), i.on("stopRecord", () => {
777
- I.hide(), q.show(), x.show(), c.removeClass(J);
778
- }), i.on("deviceReady", () => {
779
- I.show(), q.hide(), c.addClass(J);
780
- }), ((b, v, k, O, f) => {
781
- const { surveyId: _, responseGroupUid: B, visitorId: A, envId: H } = b.payload;
782
- b.on("deviceError", function() {
783
- console.warn("device error: ", b.deviceErrorCode), b.deviceErrorCode.message === "Permission denied" ? (b.deviceButton.addClass("permission-denied"), k && k(L.ERROR, { type: L.PERMISSION_DENIED }), pe({ event: "Video Permission Denied", apiBase: v, headers: f, visitorId: A, envId: H, metadata: { questionId: Pe(b, _e), responseGroupUid: B, surveyId: _ } })) : (k && k(L.ERROR, { type: L.OTHER }), ie(new Error(b.deviceErrorCode.message), "recorderDeviceError", v, f, A, H));
784
- }), b.on("error", function(F, Y) {
785
- ie(Y || b.error(), "recorderError", v, f, A, H);
786
- }), b.on("startRecord", function(F, Y) {
787
- O(b.uploadProgressLabel, "none"), pe({ event: "Video Record Start", apiBase: v, headers: f, visitorId: A, envId: H, metadata: { questionId: Pe(b, _e), responseGroupUid: B, surveyId: _ } });
788
- }), b.on("finishRecord", async function() {
789
- O(b.uploadProgressLabel, "start", 0);
790
- const F = Pe(b, _e);
791
- if (!_) {
792
- const C = "internal error: missing fields in payload";
793
- return k && k(L.ERROR, { type: L.OTHER }), ie(new Error(C), "finishRecord", v, f, A, H), null;
794
- }
795
- b.record().stopDevice();
796
- const Y = b.cameraOff ? L.MEDIA_TYPE_AUDIO : L.MEDIA_TYPE_VIDEO, K = jn();
797
- pe({ event: "Video Record Finish", apiBase: v, headers: f, visitorId: A, envId: H, metadata: { mediaRecordingUid: K, questionId: F, responseGroupUid: B, surveyId: _, mediaType: Y } });
798
- const ce = { surveyId: _, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: Y, mediaRecordingUid: K };
799
- F && (ce.questionId = F), B && (ce.responseGroupUid = B), A && (ce.visitorId = A);
800
- const ue = await (async () => {
801
- const C = await fetch(`${v}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ce) });
802
- if (C.ok) {
803
- const N = await C.json();
804
- return k && k(L.UPLOAD_STARTED, { [L.UPLOAD_ID]: N.upload.id, [L.MEDIA_TYPE]: Y, [L.MEDIA_RECORDING_UID]: K }), N.upload.url;
805
- }
806
- return k && k(L.ERROR, { type: L.OTHER, response: C }), ie(new Error("failed to get upload response with url"), "finishRecord", v, f, A, H), null;
807
- })();
808
- ue && (te = T.document.defaultView.UpChunk.createUpload({ endpoint: ue, file: new T.document.defaultView.File([b.recordedData], `recording ${Y} ${Date.now()}`), chunkSize: 5120 }), te.startTime = Date.now(), pe({ event: "Video Upload Start", apiBase: v, headers: f, visitorId: A, envId: H, metadata: { mediaRecordingUid: K, questionId: F, responseGroupUid: B, surveyId: _, mediaType: Y, url: ue } }), te.on("error", (C) => {
809
- O(b.uploadProgressLabel, "none"), k && k(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: K }), ie(C, "finishRecord", v, f, A, H);
810
- }), te.on("progress", (C) => {
811
- k && k(L.UPLOAD_PROGRESS, { [L.MEDIA_RECORDING_UID]: K, [L.UPLOAD_PROGRESS_PCT]: C.detail }), O(b.uploadProgressLabel, "progress", C.detail);
812
- }), te.on("success", () => {
813
- O(b.uploadProgressLabel, "success"), k && k(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: K }), pe({ event: "Video Upload Success", apiBase: v, headers: f, visitorId: A, envId: H, metadata: { mediaRecordingUid: K, questionId: F, responseGroupUid: B, surveyId: _, mediaType: Y, url: ue, elapsedMs: te.startTime && Date.now() - te.startTime } });
814
- }));
815
- });
816
- })(i, r, s, We, d);
817
- const D = [{ name: "microphone" }];
818
- !i.cameraOff && D.push({ name: "camera" }), Promise.all(D.map((b) => {
819
- var v;
820
- return (v = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : v.query(b);
821
- })).then((b) => {
822
- b.reduce((v, k) => v & k.state === "granted", !0) && i && (i.deviceButton && i.deviceButton.hide(), i.record().getDevice());
823
- }).catch((b) => {
824
- });
825
- }, dn = (n, o = 3) => {
826
- const t = T.document.getElementById("ul-recording-countdown-screen");
827
- t && o === 0 ? (t.remove(), n.record().start()) : t && (t.innerHTML = `<span class='ul-countdown-text'>Recording in... ${o}</span>`, setTimeout(() => {
828
- dn(n, o - 1);
829
- }, 1e3));
830
- }, cn = (n) => {
831
- const o = T.document.createElement("div");
832
- return o.className = "ul-video-container", o.appendChild(((t) => {
833
- const r = T.document.createElement("div");
834
- return r.className = "ul-video-player-loading", r.id = He(t), ["first", "second", "third", "fourth"].map((s) => {
835
- const a = T.document.createElement("div");
836
- a.className = s, r.appendChild(a);
837
- }), r;
838
- })(n)), o;
839
- }, Re = (n, o) => {
840
- const t = T.document.createElement("video");
841
- t.id = n, t.className = "video-js vjs-default-skin ul-video-player-video";
842
- const r = T.document.createElement("p");
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 s = T.document.createElement("a");
845
- return s.href = "https://videojs.com/html5-video-support/", s.target = "_blank", s.innerHTML = "supports HTML5 video", r.appendChild(s), t.appendChild(r), o.appendChild(t), o;
846
- }, Mn = (n, o) => {
847
- n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(), T.document.getElementById(`${n.id()}_html5_api`).style.height = "100%";
848
- }, we = (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), Bn = (n, o, t, r = !1, s = "https://api.sprig.com", a = document, d = null, u = null) => {
849
- T.document = a;
850
- const i = n + on, p = cn(i);
851
- return T.document.addEventListener("securitypolicyviolation", (y) => {
852
- ie(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", s, {});
853
- }), sn(rn, () => {
854
- T.document.getElementById(He(i)).remove(), Re(i, p);
855
- const y = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
856
- try {
857
- const h = n + Ze;
858
- Re(h, p);
859
- const l = we(i, y), j = we(h, { muted: !0, ...y });
860
- if (!l || !j) return;
861
- ((c, P, R) => {
862
- c.addClass(`ul${Ze}`);
863
- const g = new (T.videojs.getComponent("Component"))(c);
864
- P && c.src(P), c.addChild(g), R && R(c);
865
- })(j, d, u), d || j.addClass(J);
866
- const E = an(l, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), m = E.children().find((c) => c.name_ === "FullscreenToggle");
867
- m.hasClass("vjs-disabled") && m.hide(), ln(l, E, o, t, r, j);
868
- } catch (h) {
869
- return void ie(new Error(`Error when creating video player object ${h}`), "playerDeviceError", s, {});
870
- }
871
- }), p;
872
- }, qn = (n) => {
873
- if (!n) return null;
874
- const o = n.match(/https:\/\/stream.mux.com\/(.*)/);
875
- let t = o ? o[1] : null;
876
- return t.includes(Ge) && (t = t.replace(Ge, "")), t ? `https://image.mux.com/${t}/thumbnail.jpg?time=0` : null;
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" }, ne = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" }, Un = ({ properties: n, surveyVideoUrl: o, questionId: t }) => {
878
- const r = `ul-card-video__question_player-q${t}`, { apiURL: s, viewDocument: a } = Q((d) => ({ apiURL: d.apiURL, viewDocument: d.viewDocument }));
879
- return e("div", { id: r, ref: (d) => {
880
- if (d && d.children.length === 0 && !n.properties.hideRecordedPrompt) {
881
- const u = Bn(r, { src: o, type: "application/x-mpegURL" }, void 0, n.properties.mediaType === L.MEDIA_TYPE_AUDIO, s, a);
882
- d.appendChild(u);
883
- }
884
- } });
885
- }, he = ({ isDisabled: n, onClick: o, children: t }) => e(ae, { 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"] }), On = ({ className: n, next: o, properties: t, questionId: r, type: s }) => {
886
- const { useMobileStyling: a, border: d, update: u } = Q((w) => ({ useMobileStyling: w.useMobileStyling, border: w.border, update: w.update })), [i, p] = Z(!1), [y, h] = Z(""), [l, j] = Z(!1), E = t == null ? void 0 : t.collectName, m = (t == null ? void 0 : t.nameLabelText) || "Full Name", c = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", P = (t == null ? void 0 : t.submitButtonText) || "Submit", R = !!y.trim(), g = i && (!E || R), I = (w, M = !1) => {
887
- w.preventDefault(), w.stopPropagation();
888
- let x = null;
889
- if (!M) {
890
- if (!g) return void j(!0);
891
- x = { submitted: !0 }, E && (x.name = y);
892
- }
893
- o({ value: x, questionId: r, type: s }, !!M || g);
894
- };
895
- return W(() => {
896
- u();
897
- }, [u]), e("div", { className: $(n, "ul-card__consent-legal", "fade-in-transition"), children: e(se, { embeddedType: "pdf", properties: t, children: e(ve, { children: [e("div", { className: "sprig-stretch", children: [e(Ae, { allowTextEntry: !1, border: d, error: l && !i, id: "consent", isRadio: !1, isSelected: i, label: c, onUserInputChanged: ({ selected: w }) => {
898
- w !== i && p(!i);
899
- }, useMobileStyling: a }), E && e("input", { "aria-label": m, "aria-placeholder": m, className: $(X("ul-consent-legal__name-input", a)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (w) => {
900
- w.currentTarget.style.borderColor = l && !R ? Te : Ue;
901
- }, onFocus: (w) => {
902
- w.currentTarget.style.borderColor = l && !R ? Te : d;
903
- }, onInput: (w) => {
904
- w.preventDefault(), w.stopPropagation(), h(w.currentTarget.value);
905
- }, placeholder: m, style: l && !R ? { borderColor: Te } : {}, tabIndex: 0, value: y })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(he, { isDisabled: !g, onClick: (w) => I(new SubmitEvent(w.type)), children: de({ buttonText: P }) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (w) => I(new SubmitEvent(w.type), !0), children: Be(t) })] })] }) }) }, r);
906
- }, An = () => {
907
- const { destroy: n, forceBrandedLogo: o } = Q((t) => ({ destroy: t.destroy, forceBrandedLogo: t.forceBrandedLogo }));
908
- return W(() => {
909
- setTimeout(() => {
910
- n(Oe);
911
- }, o ? 4e3 : 2e3);
912
- }, [n, o]), e("div", { className: "end-of-survey-text", children: "End of survey" });
913
- }, $n = ({ activeValue: n, border: o, icon: t, enableCspTrustedTypes: r, isPressed: s, range: a, scaleLabelType: d, selectedValue: u, setSelectedValue: i, setActiveValue: p, setIsPressed: y, useMobileStyling: h, value: l, viewDocument: j }) => {
914
- const E = `option-${l}`, m = d === "number", c = d === "star", P = d === "smiley", R = m && l === n || l === u, [g, I] = (() => {
915
- const x = c && u !== null && l <= u;
916
- return c && l <= n || P && l === n || x || l === n || l === u ? [o, s || x || l === u ? 1 : 0.3] : ["", 1];
917
- })(), w = ye(() => {
918
- const x = { borderColor: R ? g : "", fillOpacity: R ? "" : I, zIndex: R ? 3 : "auto", color: u === l ? "#fff" : "" };
919
- return m ? { ...x, backgroundColor: u === l ? g : "" } : { ...x, color: c || P || u === l ? g : "" };
920
- }, [R, g, I, u, l, m, c, P]), M = ye(() => In((({ icon: x, scaleLabelType: q, value: D, selectedValue: b }) => {
921
- if (q === "smiley" && D === b) {
922
- let v = 0;
923
- return x.replace(/black/g, () => ++v == 1 ? "black" : "white");
924
- }
925
- return x;
926
- })({ icon: t, scaleLabelType: d, value: l, selectedValue: u }), r), [r, t, d, u, l]);
927
- return e("button", { "aria-label": m ? void 0 : String(l), className: (() => {
928
- switch (d) {
929
- case "star":
930
- return $(X("likert-star", h), X(`likert-star-${l}`, h));
931
- case "smiley":
932
- return $(X("likert-smiley", h), X(`likert-smiley-${l}`, h));
933
- default:
934
- return l === a ? $(X("likert-number", h), X(`likert-number-${l}`, h), X("likert-last-option", h)) : $(X("likert-number", h), X(`likert-number-${l}`, h));
935
- }
936
- })(), dangerouslySetInnerHTML: { __html: M }, id: E, onClick: (x) => {
937
- x.preventDefault(), x.stopPropagation(), i(l);
938
- }, onKeyDown: (x) => {
939
- var b, v;
940
- const q = j.querySelectorAll(`.likert-${d ?? "number"}`), D = l - 1;
941
- x.key === "ArrowRight" ? (b = q[D + 1]) == null || b.focus() : x.key === "ArrowLeft" ? (v = q[D - 1]) == null || v.focus() : x.key !== "Enter" && x.key !== " " || (x.preventDefault(), x.stopPropagation(), i(l));
942
- }, onPointerDown: () => y(!0), onPointerEnter: () => p(l), onPointerLeave: () => {
943
- p(-1), y(!1);
944
- }, style: w, tabIndex: 0 });
945
- }, Hn = ({ className: n, labels: o, next: t, properties: r, questionId: s, type: a }) => {
946
- const { border: d, useMobileStyling: u, viewDocument: i, enableCspTrustedTypes: p, update: y } = Q((D) => ({ border: D.border, useMobileStyling: D.useMobileStyling, viewDocument: D.viewDocument, enableCspTrustedTypes: D.enableCspTrustedTypes, update: D.update })), [h, l] = Z(-1), [j, E] = Z(!1), [m, c] = Z(null), P = o && o.left, R = o && o.right;
947
- let g;
948
- const { range: I, scaleLabelType: w, ratingIcons: M } = r;
949
- I && (g = Number(I));
950
- const x = g || 5, q = (D) => {
951
- var b, v;
952
- switch (w) {
953
- case "star":
954
- return (b = M[0]) == null ? void 0 : b.svg;
955
- case "smiley":
956
- return (v = M[D]) == null ? void 0 : v.svg;
957
- default:
958
- return String(D + 1);
959
- }
960
- };
961
- return W(() => {
962
- y();
963
- }, [y]), e("form", { className: $(n, "ul-card--likert", "fade-in-transition"), children: e(se, { properties: r, children: [e(le, { children: [e("div", { "aria-label": `Rating (1 - ${x})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(x)].map((D, b) => {
964
- const v = b + 1;
965
- return e($n, { activeValue: h, border: d, enableCspTrustedTypes: p, icon: q(b), isPressed: j, range: x, scaleLabelType: w, selectedValue: m, setActiveValue: l, setIsPressed: E, setSelectedValue: c, useMobileStyling: u, value: v, viewDocument: i }, b);
966
- }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: P }), e("span", { children: R })] })] }), e(ve, { children: e(he, { isDisabled: m === null && r.required, onClick: () => t({ value: m, questionId: s, type: a }, !0), children: de(r) }) })] }) }, s);
967
- }, Vn = ({ columns: n, onSelect: o, options: t, selectedOptions: r }) => {
968
- const s = re([]), { border: a, useMobileStyling: d } = Q((l) => ({ border: l.border, useMobileStyling: l.useMobileStyling })), u = t.findIndex((l) => r[l.id] === null), [i, p] = Z(u), y = be((l, j) => {
969
- o(l, j);
970
- const E = i + 1, m = t[E];
971
- m && r[m.id] === null && p(E);
972
- }, [o, t, r, i]), h = be((l, j) => {
973
- const E = i === l;
974
- return e(Cn, { animate: !0, header: j.label, isOpen: E, onClick: () => {
975
- var m;
976
- return p(E && !((m = window.UserLeap) != null && m.isMobileSDK) ? -1 : l);
977
- }, ref: (m) => {
978
- m && (s.current[l] = m);
979
- }, showHeaderCheck: r[j.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((m) => e(Ae, { allowTextEntry: !1, ariaLabel: `${j.label}-${m.label}`, border: a, error: !1, id: `${j.id}-${m.value}`, isRadio: !0, isSelected: r[j.id] === m.value, label: m.label, onUserInputChanged: () => y(j.id, m.value), useMobileStyling: d }, m.label)) }) }, j.id);
980
- }, [a, n, i, y, r, d]);
981
- return e("div", { children: t.map((l, j) => h(j, l)) });
982
- }, Fn = ({ className: n, next: o, options: t, properties: r, questionId: s, type: a, onSubmitButtonClick: d }) => {
983
- const u = r.matrixColumn, i = r.required, { update: p } = Q((m) => ({ update: m.update })), y = (m) => {
984
- m.preventDefault(), m.stopPropagation(), o({ value: l, questionId: s, type: a }, !0), d && d();
985
- }, h = t.reduce((m, c) => (m[c.id] = null, m), {}), [l, j] = Z(h);
986
- return W(() => {
987
- p();
988
- }, [p]), e("form", { className: $(n, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: y, children: e(se, { properties: r, children: [e(le, { children: e(Vn, { columns: u, onSelect: (m, c) => {
989
- j((P) => ({ ...P, [m]: c }));
990
- }, options: t, selectedOptions: l }) }), e(ve, { children: e(he, { isDisabled: (E = l, i && Object.values(E).every((m) => m == null)), onClick: () => y(new SubmitEvent("submit")), children: de(r) }) })] }) }, s);
991
- var E;
992
- }, un = ({ className: n, onSubmit: o, options: t = [], properties: r, questionId: s, type: a, showIndividualSubmit: d = !1, onSubmitButtonClick: u }) => {
993
- const { border: i, useMobileStyling: p, update: y } = Q((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling, update: v.update })), h = t.reduce((v, k) => (v[k.id] = { isSelected: !1 }, v), {}), [l, j] = Z(h), E = a === "multiplechoice", m = r.required, c = t.find((v) => {
994
- var k;
995
- return (k = v.optionProperties) == null ? void 0 : k.noneOfTheAbove;
996
- }), P = (v) => Object.entries(v).some(([k, O]) => {
997
- var B;
998
- const f = t.find((A) => `${A.id}` === k), _ = O.userText === void 0 || O.userText.trim() === "";
999
- return ((B = f == null ? void 0 : f.optionProperties) == null ? void 0 : B.allowsTextEntry) && _ && O.isSelected;
1000
- }), R = (v) => Object.values(v).filter((k) => k.isSelected).length, g = r.minSelect && r.minSelect > 0 && r.maxSelectMode === xe.Range && R(l) < r.minSelect && (m || R(l) > 0), I = (v) => P(v) || m && !R(v) || !((k) => {
1001
- const { minSelect: O = 0, maxSelect: f = 1 / 0, maxSelectMode: _ } = r, B = R(k);
1002
- switch (_) {
1003
- case xe.Maximum:
1004
- return B <= f;
1005
- case xe.Range:
1006
- return B === 0 || B >= O;
1007
- default:
1008
- return !0;
1009
- }
1010
- })(v), w = Object.entries(l).some(([v, k]) => {
1011
- var O, f;
1012
- return k.isSelected && ((f = (O = t.find((_) => `${_.id}` === v)) == null ? void 0 : O.optionProperties) == null ? void 0 : f.allowsTextEntry);
1013
- }), M = d && (!E || w), x = (v) => {
1014
- b(v.id, v.selected, v.userText, v.noneOfTheAbove);
1015
- }, q = (v) => {
1016
- var k;
1017
- return (r == null ? void 0 : r.maxSelectMode) !== xe.Unlimited && R(l) === (r == null ? void 0 : r.maxSelect) && !((k = l[v]) != null && k.isSelected);
1018
- }, D = () => {
1019
- o(l, !0), u && u();
1020
- }, b = (v, k, O, f) => {
1021
- const _ = Object.assign({}, l);
1022
- if ((E || f) && k) for (const B of Object.values(_)) B.isSelected = !1, delete B.userText;
1023
- else c && !f && l[c.id].isSelected && (_[c.id].isSelected = !1);
1024
- _[v] = { isSelected: k, userText: O }, j(_);
1025
- };
1026
- return W(() => {
1027
- y();
1028
- }, [y]), e("form", { className: $(n, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: D, children: e(se, { properties: r, children: [e(le, { children: [r.isDropdown ? e(Tn, { disabledOptions: t.filter((v) => q(v.id)), dropdownFooter: g ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [R(l), "/", r.minSelect] }) : void 0, isMultiSelect: !E, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (v) => {
1029
- const k = { ...l };
1030
- for (const O of t) v.includes(O) ? k[O.id].isSelected = !0 : k[O.id].isSelected = !1;
1031
- j(k);
1032
- }, options: t, placeholderText: r.dropdownPlaceholderText ?? (E ? "Select choice" : "Select choice(s)"), value: t.filter((v) => l[v.id].isSelected) }) : e("div", { className: $(X("ul-card__choices", p)), role: E ? "radiogroup" : "group", children: [t.map(({ id: v, label: k, value: O, optionProperties: f }) => {
1033
- var F, Y;
1034
- const _ = `${v}`, { allowsTextEntry: B, noneOfTheAbove: A } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...f };
1035
- return e(Ae, { allowTextEntry: B, border: i, disabled: q(_), error: (H = l, P(H)), id: _, isRadio: E, isSelected: !!((F = l[_]) != null && F.isSelected), label: k, noneOfTheAbove: A, onUserInputChanged: x, promptText: "Please specify", text: (Y = l[v]) == null ? void 0 : Y.userText, useMobileStyling: p, value: O }, _);
1036
- var H;
1037
- }), !!g && e("div", { className: "ul-card__min-select-counter", children: [R(l), "/", r.minSelect] })] }), M && e(_n, { handleSubmit: D, isSubmitDisabled: I(l) })] }), e(ve, { children: e(he, { isDisabled: I(l), onClick: D, children: de(r) }) })] }) }, s);
1038
- }, zn = (n) => {
1039
- const { questionId: o, type: t, next: r, options: s } = n;
1040
- return e(un, { ...n, onSubmit: (a, d) => {
1041
- const u = Object.entries(a).find(([, l]) => l.isSelected) || [void 0, void 0], [i, p] = u, y = s.find((l) => `${l.id}` === i), h = p != null && p.userText ? { [i]: { userText: p.userText } } : null;
1042
- r({ value: y && i ? { [i]: y.value } : {}, secondaryValue: h, questionId: o, type: t }, d);
1043
- } });
1044
- }, Gn = (n) => {
1045
- const { questionId: o, type: t, next: r } = n;
1046
- return e(un, { ...n, onSubmit: (s, a) => {
1047
- const d = Object.entries(s).reduce((i, [p, y]) => (i[p] = y.isSelected, i), {}), u = Object.entries(s).reduce((i, [p, y]) => {
1048
- if (!y.userText) return i;
1049
- const h = i || {};
1050
- return h[p] = { userText: y.userText }, h;
1051
- }, null);
1052
- r({ value: d, secondaryValue: u, questionId: o, type: t }, a);
1053
- } });
1054
- }, Zn = ({ className: n, labels: o, properties: t, next: r, questionId: s, type: a }) => {
1055
- const [d, u] = Z(null), { border: i, useMobileStyling: p, viewDocument: y, update: h } = Q((E) => ({ border: E.border, useMobileStyling: E.useMobileStyling, viewDocument: E.viewDocument, update: E.update })), l = o && o.left, j = o && o.right;
1056
- return W(() => {
1057
- h();
1058
- }, [h]), e("form", { className: $(n, "ul-card--nps", "fade-in-transition"), children: e(se, { properties: t, children: [e(le, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((E, m) => e("button", { className: $(X("nps-number", p), X(`nps-number-${m}`, p)), id: `option-${m}`, onClick: (c) => {
1059
- c.preventDefault(), c.stopPropagation(), u(m);
1060
- }, onKeyDown: (c) => {
1061
- var R, g;
1062
- const P = y.querySelectorAll("button.nps-number");
1063
- c.key === "ArrowRight" ? (R = P[m + 1]) == null || R.focus() : c.key === "ArrowLeft" ? (g = P[m - 1]) == null || g.focus() : c.key !== "Enter" && c.key !== " " || (c.preventDefault(), c.stopPropagation(), u(m));
1064
- }, onPointerDown: (c) => {
1065
- c.currentTarget.style.zIndex = "2", c.currentTarget.style.borderColor = i;
1066
- }, onPointerLeave: (c) => {
1067
- c.currentTarget.style.zIndex = "auto", c.currentTarget.style.borderColor = Ue;
1068
- }, style: d === m ? { backgroundColor: i, color: "#fff" } : void 0, tabIndex: 0, children: m }, m)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: l }), e("span", { children: j })] })] }), e(ve, { children: e(he, { isDisabled: d === null && t.required, onClick: () => r({ value: d, questionId: s, type: a }, !0), children: de(t) }) })] }) }, s);
1069
- }, Qn = ({ className: n, next: o, properties: t, questionId: r, type: s, onSubmitButtonClick: a }) => {
1070
- const { border: d, useMobileStyling: u, update: i } = Q((c) => ({ border: c.border, useMobileStyling: c.useMobileStyling, update: c.update })), [p, y] = Z(""), h = re(null), l = p.trim(), j = t.required === !0 && !l, E = Dn(h, () => i()), m = t && t.openTextPlaceholder ? t.openTextPlaceholder : "";
1071
- return W(() => {
1072
- i();
1073
- }, [i]), e("form", { className: $(n, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(se, { properties: t, children: e("div", { className: "ul-card-text", children: [e(le, { 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: $(X("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (c) => {
1074
- c.currentTarget.style.borderColor = Ue;
1075
- }, onChange: (c) => {
1076
- const { value: P } = c.currentTarget;
1077
- E(), c.preventDefault(), c.stopPropagation(), y(P);
1078
- }, onFocus: (c) => {
1079
- c.currentTarget.style.borderColor = d;
1080
- }, placeholder: m, ref: h, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(Ce, { className: "footer", html: t.footerHtml })] }), e(ve, { children: e(he, { isDisabled: j, onClick: (c) => {
1081
- c.preventDefault(), c.stopPropagation();
1082
- const P = t.required !== !0 || l.length > 0;
1083
- o({ value: p, questionId: r, type: s }, P), a && a();
1084
- }, children: de(t) }) })] }) }) }, r);
1085
- }, Yn = ({ className: n, labels: o, next: t, properties: r, questionId: s, type: a, onSubmitButtonClick: d, options: u }) => {
1086
- const i = re(null), p = re(0), y = re(0), h = re(null), l = re(!1), j = re([]), [E, m] = Z(() => (r == null ? void 0 : r.required) === !0), [c, P] = Z(() => u.map((C) => ({ ...C, rank: null }))), R = ye(() => Array.from({ length: u.length }, (C, N) => N + 1), [u.length]), { useMobileStyling: g, isPreview: I, headers: w, update: M } = Q((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers, update: C.update })), x = (w == null ? void 0 : w["userleap-platform"]) === "android", q = g && !I && !x, D = !q && !x, b = (C, N) => {
1087
- P((U) => {
1088
- const S = parseInt(N), z = U.map((V) => ({ ...V }));
1089
- z.some((V) => V.rank == null) && z.forEach((V, ge) => V.rank = ge + 1);
1090
- const ee = z.findIndex((V) => V.id === C);
1091
- if (ee === -1) return U;
1092
- const G = z[ee].rank;
1093
- return S < G ? z.forEach((V) => {
1094
- V.id !== C && V.rank >= S && V.rank < G && (V.rank = V.rank + 1);
1095
- }) : S > G && z.forEach((V) => {
1096
- V.id !== C && V.rank > G && V.rank <= S && (V.rank = V.rank - 1);
1097
- }), z[ee].rank = S, z.sort((V, ge) => V.rank - ge.rank), A(), z;
1098
- });
1099
- }, v = (C, N) => {
1100
- for (let U = 0; U < j.current.length; U++) {
1101
- const S = j.current[U];
1102
- if (!S || S === h.current) continue;
1103
- const z = S.getBoundingClientRect();
1104
- if (C >= z.left && C <= z.right && N >= z.top && N <= z.bottom) return { element: S, index: U };
1105
- }
1106
- return null;
1107
- }, k = (C) => (N) => {
1108
- if (!q) return;
1109
- N.preventDefault(), N.stopPropagation(), l.current = !0, i.current = C;
1110
- const U = N.touches[0];
1111
- p.current = U.clientY, y.current = U.clientY;
1112
- const S = N.currentTarget.closest(".ul-card-rank__option");
1113
- S && (h.current = S, S.classList.add("is-dragging"));
1114
- }, O = (C) => {
1115
- if (!q || !l.current || i.current === null) return;
1116
- C.preventDefault(), C.stopPropagation();
1117
- const N = C.touches[0];
1118
- y.current = N.clientY;
1119
- const U = y.current - p.current;
1120
- h.current && (h.current.style.transform = `translateY(${U}px)`, h.current.style.zIndex = "1000"), j.current.forEach((z) => {
1121
- z && z !== h.current && z.classList.remove("is-drop-target");
1122
- });
1123
- const S = v(N.clientX, N.clientY);
1124
- S && S.element.classList.add("is-drop-target");
1125
- }, f = (C) => {
1126
- if (!q || !l.current || i.current === null) return;
1127
- C.preventDefault(), C.stopPropagation();
1128
- const N = C.changedTouches[0], U = v(N.clientX, N.clientY);
1129
- h.current && (h.current.style.transform = "", h.current.style.zIndex = "", h.current.classList.remove("is-dragging")), j.current.forEach((S) => {
1130
- S && S.classList.remove("is-drop-target");
1131
- }), U && U.index !== i.current && _(i.current, U.index), i.current = null, h.current = null, l.current = !1;
1132
- }, _ = (C, N) => {
1133
- P((U) => {
1134
- const S = U.map((ee) => ({ ...ee })), [z] = S.splice(C, 1);
1135
- return S.splice(N, 0, z), S.forEach((ee, G) => {
1136
- ee.rank = G + 1;
1137
- }), A(), S;
1138
- });
1139
- }, B = (C) => {
1140
- const N = {};
1141
- C.reduce((U, S) => (U[S.id] = S.rank, U), N), t({ value: N, questionId: s, type: a }, !0);
1142
- }, A = () => {
1143
- m(!1);
1144
- }, { left: H, right: F } = o, Y = u.length, K = (C) => {
1145
- C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
1146
- }, ce = (C) => {
1147
- C.currentTarget.classList.remove("is-drop-target");
1148
- }, ue = (C) => {
1149
- i.current = null, C.currentTarget.classList.remove("is-dragging");
1150
- };
1151
- return W(() => {
1152
- M();
1153
- }, [M]), e("form", { className: $(n, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
1154
- C.preventDefault(), B(c), d && d();
1155
- }, children: e(se, { properties: r, children: x ? e(le, { 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: c.map(({ id: C, label: N, rank: U }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${N}`, className: $("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (S) => b(C, S.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((S) => e("option", { className: "ul-card-rank__select-option", value: S, children: S }, `${S}-${s}`))] }), e("span", { children: N })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Y, " - ", F] }) })] }) }) : e(qe, { children: [e(le, { 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: x ? void 0 : (C) => {
1156
- C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
1157
- }, children: c.map(({ id: C, label: N, rank: U }, S) => {
1158
- return e("li", { className: "ul-card-rank__option", draggable: !!D || void 0, onDragEnd: D ? ue : void 0, onDragEnter: D ? K : void 0, onDragLeave: D ? ce : void 0, onDragStart: D ? (ee = S, (G) => {
1159
- i.current = ee, G.dataTransfer && (G.dataTransfer.effectAllowed = "move", G.dataTransfer.setData("text/plain", String(ee)), G.currentTarget.classList.add("is-dragging"));
1160
- }) : void 0, onDrop: D ? (z = S, (G) => {
1161
- var ge, ze;
1162
- G.preventDefault(), G.currentTarget.classList.remove("is-drop-target");
1163
- const V = i.current;
1164
- i.current = null, (ze = (ge = G.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ge.querySelector(".is-dragging")) == null || ze.classList.remove("is-dragging"), V != null && V !== z && _(V, z);
1165
- }) : void 0, ref: (G) => j.current[S] = G, children: [e("select", { "aria-label": `Rank for ${N}`, className: $("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (G) => b(C, G.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((G) => e("option", { className: "ul-card-rank__select-option", value: G, children: G }, G))] }), e("span", { children: N }), !x && e("button", { "aria-label": `Drag ${N} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: q ? f : void 0, onTouchMove: q ? O : void 0, onTouchStart: q ? k(S) : 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" }) }) })] }, C);
1166
- var z, ee;
1167
- }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Y, " - ", F] }) })] }) }), e(ve, { children: e("div", { className: "ul-card__button-wrapper", children: e(ae, { disabled: E, children: de(r) }) }) })] }) }) }, s);
1168
- }, Ne = 1, pn = 2, vn = 3, Ee = (n) => n.type === "av_permission", Ke = (n) => n.type === "screen_permission", mn = (n, o) => n === void 0 ? Ne : n ? ((t, r) => !(Ee(r) ? r.permissionDescriptors : []).includes("camera") || t.getVideoTracks().length > 0)(n, o) ? vn : Ne : pn, Je = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
1169
- }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, oe = xn((n) => ({ ...Je, reset: () => {
1170
- n(Je);
1171
- }, updatePage: (o) => {
1172
- n(o);
1173
- } }));
1174
- function Le({ currentPage: n, pages: o }) {
1175
- const { avStream: t, recordingMediaTypes: r, updatePage: s } = oe.getState(), { recorderEventEmitter: a } = Q.getState();
1176
- a.emit("av.permission", { "permission.descriptors": n.permissionDescriptors, "stream.ready": (d, u) => {
1177
- if (t === d) return;
1178
- let i = n;
1179
- if (d && !n.permissionDescriptors.includes("camera")) {
1180
- const p = o.indexOf(n), y = u != null && u.active ? p + 2 : p + 1;
1181
- u != null && u.active && r && a.emit("begin.recording", { "recording.media.types": r, "start.recording.callback": (h) => s({ mediaRecordingUids: h }) }), i = o[y];
1182
- }
1183
- s({ currentPage: i, avStream: d });
1184
- } });
1185
- }
1186
- function Me({ status: n }) {
1187
- const { nextQuestion: o, passthroughData: t, mediaRecordingUids: r, reset: s } = oe.getState(), { recorderEventEmitter: a, handleUploadUpdate: d, index: u } = Q.getState(), i = { value: { taskStatus: n }, type: "recordedtask", questionId: (t == null ? void 0 : t.questionId) || 1 };
1188
- t && a.emit("finish.task", { "begin.callback": (p) => {
1189
- d({ mediaRecordingUid: p, isSubmitted: !0, progressPct: 0, isComplete: !1 });
1190
- }, "progress.callback": (p, y) => {
1191
- d({ mediaRecordingUid: p, progressPct: y.detail, isSubmitted: !1, isComplete: !1 });
1192
- }, "upload.callback": (p) => {
1193
- p && d({ mediaRecordingUid: p, isComplete: !0, isSubmitted: !0, progressPct: 100 });
1194
- }, "passthrough.data": t, "current.index": u, "task.response": i, "task.complete.callback": (p) => {
1195
- i.value.taskDurationMillisecond = p, r && (i.value.mediaRecordingUids = r), s(), o(i);
1196
- } });
1197
- }
1198
- function Ve({ pages: n, setIsRequestingPermission: o }) {
1199
- const { recorderEventEmitter: t, eventEmitFn: r } = Q.getState(), { updatePage: s, currentPage: a, recordingMediaTypes: d, screenPermissionRequested: u } = oe.getState();
1200
- if (!a) return;
1201
- const i = n.indexOf(a);
1202
- switch (a.type) {
1203
- case "av_permission": {
1204
- const p = u ? i + 2 : i + 1;
1205
- return u && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (y) => {
1206
- s({ mediaRecordingUids: y });
1207
- } }), void s({ currentPage: n[p] });
1208
- }
1209
- case "screen_permission":
1210
- return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (p, y) => {
1211
- const h = y ? n[i + 1] : a;
1212
- y && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (l) => {
1213
- s({ captureStream: y, mediaRecordingUids: l });
1214
- } }), s({ currentPage: h, screenPermissionRequested: !0, captureStream: y });
1215
- } });
1216
- case "start_task":
1217
- return r("recorded.task.start"), t.emit("recorded.task.start"), t.emit("start.task"), void s({ currentPage: n[i + 1], screenPermissionRequested: !0 });
1218
- case "complete_task":
1219
- return;
1220
- }
1221
- }
1222
- const hn = "ul-permission-graphics-container", gn = "ul-permission-body", bn = $(hn, "ul_recorded-task-inset-spacing"), je = $("ul-horizontal-button-container", "ul-horizontal-button-container-left"), fn = ({ richTextBody: n }) => e(Ce, { className: "ul-rich-text-body", html: n, id: "ul-task-detail-container" }), Ie = ({ required: n, skipButtonText: o, bottom: t = !1 }) => n ? null : e(ae, { className: $(t && "ul-skip-button-below", "ul-button-inactive"), onClick: Me.bind(null, { status: "abandoned" }), children: o || "Skip" }), Fe = (n) => {
1223
- const { avStream: o, captureStream: t, recordingMediaTypes: r, updatePage: s } = oe.getState(), a = (r == null ? void 0 : r.includes("audio")) || (r == null ? void 0 : r.includes("video"));
1224
- W(() => {
1225
- const d = setInterval(() => {
1226
- a && o && !o.active ? s({ avStream: null, currentPage: n[0] }) : t && t.active || s({ captureStream: void 0, currentPage: n[a ? 1 : 0] });
1227
- }, 1e3);
1228
- return () => clearInterval(d);
1229
- }, [o, t, a, n, r, s]);
1230
- }, Wn = ({ content: n, pages: o, required: t }) => {
1231
- const { buttonText: r, skipButtonText: s, taskDetail: a } = n;
1232
- return Fe(o), e("div", { className: "ul-task-page", children: [a && e(fn, { richTextBody: a }), e("div", { className: je, children: [e(ae, { onClick: Ve.bind(null, { pages: o }), children: r }), e(Ie, { required: t, skipButtonText: s })] })] }, "start-task");
1233
- }, Kn = ({ content: n, pages: o, properties: t }) => {
1234
- const { buttonText: r, skipButtonText: s } = n;
1235
- return Fe(o), e("div", { className: "ul-task-page", children: [n.taskDetail && e(fn, { richTextBody: n.taskDetail }), e(se, { properties: t, children: e("div", { className: je, children: [e(ae, { className: "ul-complete-task-button", onClick: Me.bind(null, { status: "completed" }), children: r }), e(ae, { className: $("ul-button-inactive"), onClick: Me.bind(null, { status: "given.up" }), children: s })] }) })] }, "complete-task");
1236
- }, Jn = ({ content: n, pages: o, required: t }) => {
1237
- const { buttonText: r, skipButtonText: s } = n, [a] = Q((i) => [i.tabTitle]), [d, u] = Z(!1);
1238
- return e("div", { children: [e("div", { className: bn, children: [e("p", { style: { marginTop: "auto" }, children: n.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: gn, children: a }) })] }), e("div", { className: t ? "" : je, children: [e(ae, { disabled: d, onClick: Ve.bind(null, { pages: o, setIsRequestingPermission: u }), children: r }), e(Ie, { required: t, skipButtonText: s })] })] });
1239
- }, Xn = ({ content: n }) => e(Ce, { className: $(hn, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: n.svg }, "ul-permission-request-graphic"), et = ({ content: n, pages: o, required: t }) => {
1240
- const { permissionDeniedHeadline: r, permissionDeniedBody: s, skipButtonText: a, tryAgainButtonText: d } = n, u = Ee(o[0]) ? o[0] : null;
1241
- return W(() => {
1242
- const i = setInterval(() => {
1243
- u !== null && Le({ currentPage: u, pages: o });
1244
- }, 1e3);
1245
- return () => clearInterval(i);
1246
- }, [u, o]), u ? e("div", { children: [e("div", { className: bn, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: r }), e("span", { className: gn, children: s })] }) }), e("div", { className: je, children: [e(ae, { onClick: Le.bind(null, { currentPage: u, pages: o }), children: d }), e(Ie, { required: t, skipButtonText: a })] })] }) : null;
1247
- }, nt = ({ stream: n }) => e("video", { autoPlay: !0, className: $("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (o) => {
1248
- o && (o.srcObject = n || null);
1249
- } }), tt = ({ content: n, pages: o, required: t }) => {
1250
- const { skipButtonText: r } = n, { avStream: s } = oe.getState();
1251
- return Fe(o), e("div", { children: [e(nt, { stream: s }), e("div", { className: "ul-vertical-button-container-center", children: [e(ae, { onClick: Ve.bind(null, { pages: o }), children: n.buttonText }), e(Ie, { bottom: !0, required: t, skipButtonText: r })] })] });
1252
- }, rt = ({ properties: n }) => {
1253
- const { pages: o, required: t } = n, { avStream: r, currentPage: s } = oe.getState();
1254
- if (s === void 0) return null;
1255
- switch (s == null ? void 0 : s.type) {
1256
- case "av_permission": {
1257
- const a = mn(r, s);
1258
- return a === Ne ? e(Xn, { content: s }) : e(a === pn ? et : tt, { content: s, pages: o, required: t });
1259
- }
1260
- case "screen_permission":
1261
- return e(Jn, { content: s, pages: o, required: t });
1262
- case "start_task":
1263
- return e(Wn, { content: s, pages: o, required: t });
1264
- case "complete_task":
1265
- return e(Kn, { content: s, pages: o, properties: n });
1266
- default:
1267
- return null;
1268
- }
1269
- }, ot = ({ className: n, properties: o, next: t, questionId: r }) => {
1270
- const s = Q(), { surveyId: a, responseGroupUid: d, userId: u, update: i } = s, p = oe(), { screenPermissionRequested: y } = p, h = oe((c) => c.avStream);
1271
- let l = oe((c) => c.currentPage);
1272
- l || (l = function({ pages: c, userId: P, responseGroupUid: R, surveyId: g, questionId: I, next: w }) {
1273
- const { updatePage: M } = oe.getState(), { eventEmitFn: x, recorderEventEmitter: q } = Q.getState(), D = { questionId: I, surveyId: g, visitorId: P, responseGroupUid: R };
1274
- let b = 0;
1275
- q.emit("recorded.task.permission.screen"), x("recorded.task.permission.screen"), q.emit("permission.status", { "permission.status.callback": (k, O, f, _) => {
1276
- const B = c[b], { type: A } = B, H = ["screen"];
1277
- if (Ee(B)) {
1278
- const { permissionDescriptors: F } = B, Y = F == null ? void 0 : F.includes("microphone"), K = F == null ? void 0 : F.includes("camera");
1279
- Y && H.push("audio"), K && H.push("video"), (k != null && k.active && !K || k != null && k.active && O) && b++;
1280
- }
1281
- Ke(c[b]) && f && (b++, q.emit("begin.recording", { "recording.media.types": H, "start.recording.callback": (F) => M({ mediaRecordingUids: F }) })), M({ currentPage: c[b], avStream: k, screenPermissionRequested: f, nextQuestion: w, type: A, passthroughData: D, recordingMediaTypes: H, captureStream: _ });
1282
- } });
1283
- const v = c[b];
1284
- return v.type === "av_permission" && Le({ currentPage: v, pages: c }), v;
1285
- }({ questionId: r, surveyId: a, next: (c) => {
1286
- t(c, !0);
1287
- }, pages: o.pages, responseGroupUid: d, userId: u }));
1288
- let j = l.headline, E = l.captionText;
1289
- const m = mn(h, l);
1290
- return Ke(l) && y && (j = l.permissionDeniedHeadline, E = l.permissionDeniedCaptionText), Ee(l) && m === vn && (j = l.permissionGrantedHeadline, E = l.permissionGrantedCaptionText), W(() => {
1291
- i();
1292
- }, [i]), e("div", { className: $(n, "ul-center-horizontally", "fade-in-transition"), children: [e($e, { isRequired: o == null ? void 0 : o.required, message: j, properties: { captionText: E } }), e(le, { children: e(rt, { properties: o }) })] });
1293
- }, st = ({ className: n, next: o, properties: t, questionId: r, type: s }) => {
1294
- const { visitorAttributes: a, isLongFormSurvey: d, update: u } = Q((h) => ({ visitorAttributes: h.visitorAttributes, isLongFormSurvey: tn(h.studyType), update: h.update })), i = (h, l = !1) => {
1295
- o({ value: l ? { skipped: !0 } : void 0, questionId: r, type: s }, !0);
1296
- }, p = Sn(t && t.buttonUrl, a), y = d && t.promptActionType === Pn.NO_BUTTON;
1297
- return W(() => {
1298
- u();
1299
- }, [u]), e("div", { className: $(n, "ul-card__text-url-prompt", "fade-in-transition"), children: e(se, { properties: t, children: !y && e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: p, id: "ul-card-text__button", onClick: i, onKeyPress: (h) => {
1300
- h.key !== "Enter" && h.key !== " " || o({ value: void 0, questionId: r, type: s }, !0);
1301
- }, rel: "noreferrer", role: p ? "link" : "button", tabIndex: 0, target: "_blank", children: de(t) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (h) => i(0, !0), children: Be(t) })] }) }) }) }, r);
1302
- }, it = ({ className: n, questionId: o }) => {
1303
- const { border: t, destroy: r, endCard: s, forceBrandedLogo: a } = Q((i) => ({ border: i.border, destroy: i.destroy, endCard: i.endCard, forceBrandedLogo: i.forceBrandedLogo }));
1304
- W(() => {
1305
- setTimeout(() => {
1306
- r(Oe);
1307
- }, a ? 4e3 : 2e3);
1308
- }, [r, a]);
1309
- const d = s && s.subheader ? e("p", { className: "ul-caption", children: s.subheader }) : null, u = s && s.headline ? s.headline : "";
1310
- return e("div", { className: $(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: t, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: t, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e($e, { message: u }), d] }) }) }, o);
1311
- }, at = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), lt = ({ className: n }) => {
1312
- const { uploadProgress: o } = Q((a) => ({ uploadProgress: a.uploadProgress }));
1313
- let t, r;
1314
- Object.values(o).filter((a) => a.isSubmitted).length > 1 ? (t = "Your responses are processing", r = "Please keep this tab open until your responses are fully processed.") : (t = "Your response is processing", r = "Please keep this tab open until your response is fully processed.");
1315
- const s = Math.round(Math.min(99, ...Object.values(o).filter((a) => a.isSubmitted).map((a) => a.progressPct || 0)));
1316
- return e("div", { className: $(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($e, { message: `${t} (${s}% complete)` }), e("p", { className: "ul-caption", children: r })] });
1317
- }, Xe = 0, en = 1, dt = ({ className: n, next: o, properties: t, questionId: r, type: s }) => {
1318
- const a = `ul-card-video__player_recorder-q${r}`, { apiURL: d, envId: u, handleUploadUpdate: i, headers: p, responseGroupUid: y, surveyId: h, update: l, viewDocument: j, visitorId: E } = Q((f) => ({ apiURL: f.apiURL, envId: f.envId, handleUploadUpdate: f.handleUploadUpdate, headers: f.headers, responseGroupUid: f.responseGroupUid, surveyId: f.surveyId, update: f.update, viewDocument: f.viewDocument, visitorId: f.userId })), [m, c] = Z(!1), [P, R] = Z(null), [g, I] = Z(null), [w, M] = Z(Xe), [x, q] = Z(null), [D, b] = Z(null), v = be((f) => {
1319
- f && q(f);
1320
- }, [q]);
1321
- W(() => {
1322
- const f = new ResizeObserver(() => {
1323
- setTimeout(l, 0);
1324
- });
1325
- return D && f.observe(D), x && f.observe(x), () => {
1326
- D && f.unobserve(D), x && f.unobserve(x);
1327
- };
1328
- }, [l, D, x]);
1329
- const k = (f, _) => {
1330
- f === L.UPLOAD_STARTED ? (R(_[L.UPLOAD_ID]), I(_[L.MEDIA_RECORDING_UID]), c(!0)) : f === L.DELETE ? (R(null), I(null), c(!1)) : f === L.UPLOAD_PROGRESS ? isNaN(_[L.UPLOAD_PROGRESS_PCT]) ? i({ mediaRecordingUid: _[L.MEDIA_RECORDING_UID], isComplete: !0 }) : i({ mediaRecordingUid: _[L.MEDIA_RECORDING_UID], progressPct: _[L.UPLOAD_PROGRESS_PCT] }) : f === L.UPLOAD_FINISHED && i({ mediaRecordingUid: _[L.MEDIA_RECORDING_UID], isComplete: !0 });
1331
- }, O = (f) => {
1332
- f.preventDefault(), f.stopPropagation(), document.getElementById(a) && ((_) => {
1333
- const B = _ + Qe;
1334
- if (T.document.getElementById(B) && T.videojs) {
1335
- try {
1336
- if (!T.videojs(B).record().stream) return;
1337
- } catch {
1338
- return;
1339
- }
1340
- T.videojs(B).record().stop(), T.videojs(B).record().stopDevice();
1341
- }
1342
- })(a), P && g ? (i({ mediaRecordingUid: g, isSubmitted: !0 }), o({ value: { mediaRecordingUid: g }, questionId: r, type: s }, !0)) : o({ value: null, questionId: r, type: s }, !0);
1343
- };
1344
- return e("form", { className: $(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(le, { children: [e("div", { id: "ul-question-player-container", ref: v, style: { display: w === Xe ? "" : "none" }, children: e(se, { properties: t, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (f) => {
1345
- f.preventDefault(), f.stopPropagation(), document.getElementById(a) && ((_) => {
1346
- const B = we(_ + on);
1347
- B == null || B.pause();
1348
- })(a), M(en);
1349
- } }) }) }), e("div", { style: { display: w === en ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (f) => {
1350
- if (f && f.children.length === 0) {
1351
- b(f);
1352
- const _ = ((B, A = {}, H = "https://api.userleap.com", F, Y, K, ce = !1, ue = document) => {
1353
- T.document = ue;
1354
- const C = B + Qe, N = cn(C);
1355
- return T.document.addEventListener("securitypolicyviolation", (U) => {
1356
- ie(new Error(`Voice & Video feature violates ${U.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", H, K, A.visitorId, A.envId);
1357
- }), sn(rn.concat(Rn), () => {
1358
- Re(C, N), T.document.getElementById(He(C)).remove();
1359
- try {
1360
- Ln(N, C, A, H, F, Y, K, ce);
1361
- } catch (U) {
1362
- return void ie(new Error(`Error when creating video recorder player object ${U}`), "recorderDeviceError", H, K, A.visitorId, A.envId);
1363
- }
1364
- }), N;
1365
- })(a, { surveyId: h, responseGroupUid: y, questionId: r, visitorId: E, envId: u }, d, k, void 0, { ...p, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === L.MEDIA_TYPE_AUDIO, j);
1366
- f.appendChild(_);
1367
- }
1368
- } }) })] }), e(ve, { children: [e(he, { isDisabled: !!t.required && !m, onClick: O, children: de(t) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: O, style: { ...t.required ? { display: "none" } : {}, ...m ? { display: "none" } : {} }, children: Be(t) })] })] });
1369
- }, yn = (n) => n.type === "thanks" || n.type === "uploading", ct = ({ card: n, avatars: o, isThinking: t, isCurrentQuestion: r, currentQuestionBubbleRef: s }) => {
1370
- 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);
1371
- return e(fe, { avatars: o, isLeft: !0, message: { id: `question-${n.name}`, type: "question", content: a.content }, ref: r ? s : null, children: t ? e(at, {}) : e(qe, { children: [a.isHtml ? e(Ce, { className: "chat-message-text", html: a.content }) : e("div", { className: "chat-message-text", children: a.content }), n.type === "videovoice" && e(Un, { properties: n.props, questionId: n.name, surveyVideoUrl: n.props.properties.videoUrl })] }) });
1372
- }, ut = ({ card: n, avatars: o }) => {
1373
- const t = ((r) => {
1374
- if (!("properties" in r.props) || !r.props.properties || typeof r.props.properties != "object") return null;
1375
- const s = r.props.properties, a = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
1376
- for (const { key: d, isHtml: u } of a) {
1377
- const i = s[d];
1378
- if (typeof i != "string") continue;
1379
- const p = i.trim();
1380
- if (p) {
1381
- if (u && !p.replaceAll(/<[^>]*>/g, "").trim()) continue;
1382
- return { content: p, isHtml: u };
1383
- }
1384
- }
1385
- return null;
1386
- })(n);
1387
- return t ? e(fe, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: t.content }, children: t.isHtml ? e(Ce, { className: "chat-message-text", html: t.content }) : e("div", { className: "chat-message-text", children: t.content }) }) : null;
1388
- }, pt = ({ card: n, userResponse: o, avatars: t }) => {
1389
- const r = ((s, a) => {
1390
- if (s.type === "open" && a && typeof a == "object" && "value" in a) return a.value;
1391
- })(n, o);
1392
- return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: r || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x` })] });
1393
- }, vt = ({ card: n, avatars: o, isCurrentQuestion: t, currentQuestionBubbleRef: r }) => {
1394
- const { endCard: s } = Q((a) => ({ endCard: a.endCard }));
1395
- return e(qe, { children: [e(fe, { avatars: o, isLeft: !0, message: { id: `thanks-${n.name}`, type: "question", content: (s == null ? void 0 : s.headline) ?? "Great! Thank you for your participation." }, ref: t ? r : null }), (s == null ? void 0 : s.subheader) && e(fe, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: s.subheader } }), e(An, {})] });
1396
- }, mt = ({ card: n, cardIndex: o, index: t, avatars: r, cardResponses: s, questionThinkingStates: a, startingQuestionIdx: d, currentQuestionBubbleRef: u, handleCardResponse: i }) => {
1397
- const p = o === t, y = o < t, h = yn(n);
1398
- if (h) return e(vt, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: p });
1399
- const l = `${n.name}`, j = s.get(l), E = n.type === "open", m = a.get(l), c = o > (d ?? 0) && n.type !== "thanks" && n.type !== "uploading" && (m === !0 || m === void 0);
1400
- return e(nn.Fragment, { children: [e(ct, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: p, isThinking: c }), !c && e(ut, { avatars: r, card: n }), y && E ? e(pt, { avatars: r, card: n, userResponse: j }) : (!y || !E) && !c && e(fe, { avatars: r, isLeft: !1, message: { id: `card-${n.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(gt, { card: n, className: h ? "chat-thanks-card" : "chat-card", isAnswered: y, next: p ? i : () => {
1401
- } }) }) })] }, `question-card-${n.name}`);
1402
- }, fe = nn.forwardRef(({ message: n, isLeft: o = !1, children: t, avatars: r, hideAvatar: s = !1 }, a) => {
1403
- const d = o ? "chat-bubble-left" : "chat-bubble-right";
1404
- return e("div", { className: `chat-bubble-container ${o ? "chat-left" : "chat-right"}${o && s ? " chat-no-avatar" : ""}`, ref: a, children: [o && !s && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${d}`, children: t || e("div", { className: "chat-message-text", children: n.content }) }), !o && !s && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
1405
- });
1406
- fe.displayName = "ChatBubble";
1407
- const ht = () => {
1408
- const n = Q((t) => t.close), o = ye(() => () => n(Oe), [n]);
1409
- return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: o, onKeyPress: (t) => {
1410
- t.key === "Enter" && o();
1411
- }, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
1412
- }, gt = ({ card: n, next: o, className: t = "", isAnswered: r = !1 }) => {
1413
- const s = { className: r ? `${t} answered-card` : t, next: r ? () => {
1414
- } : o, questionId: n.name, type: n.type, isAnswered: r };
1415
- switch (n.type) {
1416
- case "consentlegal":
1417
- return e(On, { ...s, ...n.props });
1418
- case "likert":
1419
- return e(Hn, { ...s, ...n.props });
1420
- case "matrix":
1421
- return e(Fn, { ...s, ...n.props });
1422
- case "multiplechoice":
1423
- return e(zn, { ...s, ...n.props });
1424
- case "multipleselect":
1425
- return e(Gn, { ...s, ...n.props });
1426
- case "nps":
1427
- return e(Zn, { ...s, ...n.props });
1428
- case "open":
1429
- return e(Qn, { ...s, ...n.props });
1430
- case "rankorder":
1431
- return e(Yn, { ...s, ...n.props });
1432
- case "recordedtask":
1433
- return e(ot, { ...s, ...n.props });
1434
- case "texturlprompt":
1435
- return e(st, { ...s, ...n.props });
1436
- case "thanks":
1437
- return e(it, { ...s, ...n.props });
1438
- case "uploading":
1439
- return e(lt, { ...s, ...n.props });
1440
- case "videovoice":
1441
- return e(dt, { ...s, ...n.props });
1442
- default:
1443
- return null;
1444
- }
1445
- }, Ct = ({ cards: n, next: o, previousResponses: t }) => {
1446
- const { messagesContainerRef: r, currentQuestionBubbleRef: s, scrollToCurrentQuestion: a } = (() => {
1447
- const g = re(null), I = re(null), w = be(() => {
1448
- if (I.current && g.current) {
1449
- const M = g.current, x = I.current.offsetTop - M.offsetTop - 16;
1450
- M.scrollTo({ top: Math.max(0, x), behavior: "smooth" });
1451
- }
1452
- }, []);
1453
- return { messagesContainerRef: g, currentQuestionBubbleRef: I, scrollToCurrentQuestion: w };
1454
- })(), { cardResponses: d, setCardResponse: u } = (() => {
1455
- const [g, I] = Z(/* @__PURE__ */ new Map());
1456
- return { cardResponses: g, setCardResponse: be((w, M) => {
1457
- I((x) => new Map(x).set(w, M));
1458
- }, []) };
1459
- })(), { index: i, isLongFormSurvey: p, avatars: y, startingQuestionIdx: h, update: l } = Q((g) => ({ index: g.index, isLongFormSurvey: tn(g.studyType), avatars: g.avatars, startingQuestionIdx: g.startingQuestionIdx, update: g.update })), j = ((g, I, w) => {
1460
- const [M, x] = Z(/* @__PURE__ */ new Map());
1461
- return W(() => {
1462
- if (g.length > 0 && I < g.length) {
1463
- const q = g[I], D = `${q.name}`;
1464
- if (I <= (w ?? 0) || yn(q)) return void x((v) => new Map(v).set(D, !1));
1465
- x((v) => new Map(v).set(D, !0));
1466
- const b = setTimeout(() => {
1467
- x((v) => new Map(v).set(D, !1));
1468
- }, 1e3);
1469
- return () => clearTimeout(b);
1470
- }
1471
- }, [I, g, w]), M;
1472
- })(n, i, h), E = ((g, I) => {
1473
- const [w, M] = Z(/* @__PURE__ */ new Set([0]));
1474
- return W(() => {
1475
- M((x) => new Set(x).add(g));
1476
- }, [g]), W(() => {
1477
- const x = I ?? 0;
1478
- x > 0 && M((q) => {
1479
- const D = new Set(q);
1480
- for (let b = 0; b <= x; b++) D.add(b);
1481
- return D;
1482
- });
1483
- }, [I]), w;
1484
- })(i, h), m = ye(() => ({ ...t, ...kn(n.map((g, I) => {
1485
- var w, M;
1486
- return { ...g, value: I < i ? ((w = d.get(`${g.name}`)) == null ? void 0 : w.value) ?? null : null, secondaryValue: I < i ? ((M = d.get(`${g.name}`)) == null ? void 0 : M.secondaryValue) ?? null : null };
1487
- })) }), [t, d, n, i]), c = wn(n, m);
1488
- W(() => {
1489
- requestAnimationFrame(() => {
1490
- a();
1491
- });
1492
- }, [i, a, j]);
1493
- const P = be((g, I) => {
1494
- if (!I) return;
1495
- const w = c[i];
1496
- if (!w) return;
1497
- const M = `${w.name}`;
1498
- u(M, g);
1499
- const x = { ...g, questionText: En(w) };
1500
- o([x]);
1501
- }, [c, i, o, u]), R = c.map((g, I) => ({ card: g, cardIndex: I })).filter(({ cardIndex: g }) => E.has(g));
1502
- return W(() => {
1503
- l();
1504
- }, [i, l]), e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!p && e(ht, {}), e("div", { className: "chat-container", ref: r, children: e("div", { className: "chat-messages", children: R.map(({ card: g, cardIndex: I }) => e(mt, { avatars: y, card: g, cardIndex: I, cardResponses: d, currentQuestionBubbleRef: s, handleCardResponse: P, index: i, questionThinkingStates: j, startingQuestionIdx: h }, `question-card-${g.name}`)) }) })] });
1505
- };
1506
- export {
1507
- Ct as default
1508
- };