@sidebandai/sideband-web 0.0.0-stage → 1.4.3

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.
package/dist/index.js ADDED
@@ -0,0 +1,1085 @@
1
+ import { SidebandApiError as e, SurveySessionStore as t, SurveySessionStore as n, SyncEngine as r, buildFabTitle as i, buildFabTitle as a, createSidebandClient as o, createSidebandRuntime as s, getChoiceValue as c, getChoiceValue as l, getDeviceId as u, getSessionId as d, isPositiveSentimentChoice as f, isSystemOtherChoice as p, resolveSnackbarPresentation as m } from "@sidebandai/sideband-core";
2
+ //#region ../design-tokens/src/index.ts
3
+ var h = "rgba(0, 0, 0, 0)", g = (e, t = 1) => ({
4
+ hex: e,
5
+ alpha: t
6
+ }), _ = (e, t) => [
7
+ {
8
+ variable: `--sb-theme-choice-${e}-background`,
9
+ path: [
10
+ "choice",
11
+ e,
12
+ "background"
13
+ ],
14
+ fallback: t[0]
15
+ },
16
+ {
17
+ variable: `--sb-theme-choice-${e}-foreground`,
18
+ path: [
19
+ "choice",
20
+ e,
21
+ "foreground"
22
+ ],
23
+ fallback: t[1]
24
+ },
25
+ {
26
+ variable: `--sb-theme-choice-${e}-border`,
27
+ path: [
28
+ "choice",
29
+ e,
30
+ "border"
31
+ ],
32
+ fallback: t[2]
33
+ }
34
+ ], v = (e, t) => [
35
+ {
36
+ variable: `--sb-theme-button-${e}-foreground`,
37
+ path: [
38
+ "button",
39
+ e,
40
+ "foreground"
41
+ ],
42
+ fallback: t[0]
43
+ },
44
+ {
45
+ variable: `--sb-theme-button-${e}-background`,
46
+ path: [
47
+ "button",
48
+ e,
49
+ "background"
50
+ ],
51
+ fallback: t[1]
52
+ },
53
+ {
54
+ variable: `--sb-theme-button-${e}-hover-background`,
55
+ path: [
56
+ "button",
57
+ e,
58
+ "hoverBackground"
59
+ ],
60
+ fallback: t[2]
61
+ },
62
+ {
63
+ variable: `--sb-theme-button-${e}-pressed-background`,
64
+ path: [
65
+ "button",
66
+ e,
67
+ "pressedBackground"
68
+ ],
69
+ fallback: t[3]
70
+ },
71
+ {
72
+ variable: `--sb-theme-button-${e}-disabled-background`,
73
+ path: [
74
+ "button",
75
+ e,
76
+ "disabledBackground"
77
+ ],
78
+ fallback: t[4]
79
+ },
80
+ {
81
+ variable: `--sb-theme-button-${e}-disabled-foreground`,
82
+ path: [
83
+ "button",
84
+ e,
85
+ "disabledForeground"
86
+ ],
87
+ fallback: t[5]
88
+ }
89
+ ], y = [
90
+ {
91
+ variable: "--sb-theme-sheet-background",
92
+ path: ["sheet", "background"],
93
+ fallback: g("#FFFFFF")
94
+ },
95
+ {
96
+ variable: "--sb-theme-sheet-scrim",
97
+ path: ["sheet", "scrim"],
98
+ fallback: g("#000000", .5)
99
+ },
100
+ {
101
+ variable: "--sb-theme-sheet-divider",
102
+ path: ["sheet", "divider"],
103
+ fallback: g("#E5E5E5")
104
+ },
105
+ {
106
+ variable: "--sb-theme-sheet-progress-track",
107
+ path: ["sheet", "progressTrack"],
108
+ fallback: g("#000000", .12)
109
+ },
110
+ {
111
+ variable: "--sb-theme-sheet-progress-fill",
112
+ path: ["sheet", "progressFill"],
113
+ fallback: g("#000000")
114
+ },
115
+ {
116
+ variable: "--sb-theme-sheet-close-button-background",
117
+ path: ["sheet", "closeButtonBackground"],
118
+ fallback: g("#000000", 0)
119
+ },
120
+ {
121
+ variable: "--sb-theme-sheet-close-button-foreground",
122
+ path: ["sheet", "closeButtonForeground"],
123
+ fallback: g("#000000")
124
+ },
125
+ {
126
+ variable: "--sb-theme-content-heading",
127
+ path: ["content", "heading"],
128
+ fallback: g("#000000")
129
+ },
130
+ {
131
+ variable: "--sb-theme-content-body",
132
+ path: ["content", "body"],
133
+ fallback: g("#333030")
134
+ },
135
+ {
136
+ variable: "--sb-theme-content-helper",
137
+ path: ["content", "helper"],
138
+ fallback: g("#5C5C5C")
139
+ },
140
+ {
141
+ variable: "--sb-theme-content-error",
142
+ path: ["content", "error"],
143
+ fallback: g("#B42318")
144
+ },
145
+ {
146
+ variable: "--sb-theme-completion-outer-background",
147
+ path: ["completion", "outerBackground"],
148
+ fallback: g("#E8E8E8")
149
+ },
150
+ {
151
+ variable: "--sb-theme-completion-inner-background",
152
+ path: ["completion", "innerBackground"],
153
+ fallback: g("#000000")
154
+ },
155
+ {
156
+ variable: "--sb-theme-completion-glyph",
157
+ path: ["completion", "glyph"],
158
+ fallback: g("#FFFFFF")
159
+ },
160
+ ..._("default", [
161
+ g("#FFFFFF"),
162
+ g("#000000"),
163
+ g("#DBDBDB")
164
+ ]),
165
+ ..._("hover", [
166
+ g("#F5F5F5"),
167
+ g("#000000"),
168
+ g("#DBDBDB")
169
+ ]),
170
+ ..._("pressed", [
171
+ g("#000000"),
172
+ g("#FFFFFF"),
173
+ g("#000000")
174
+ ]),
175
+ ..._("selected", [
176
+ g("#000000"),
177
+ g("#FFFFFF"),
178
+ g("#000000")
179
+ ]),
180
+ ..._("disabled", [
181
+ g("#F2F2F2"),
182
+ g("#8A8A8A"),
183
+ g("#E5E5E5")
184
+ ]),
185
+ ...v("primary", [
186
+ g("#FFFFFF"),
187
+ g("#121212"),
188
+ g("#292929"),
189
+ g("#000000"),
190
+ g("#E5E5E5"),
191
+ g("#8A8A8A")
192
+ ]),
193
+ ...v("secondary", [
194
+ g("#000000"),
195
+ g("#F2F2F2"),
196
+ g("#E8E8E8"),
197
+ g("#DBDBDB"),
198
+ g("#E5E5E5"),
199
+ g("#8A8A8A")
200
+ ]),
201
+ ...v("tertiary", [
202
+ g("#000000"),
203
+ g("#FFFFFF"),
204
+ g("#F5F5F5"),
205
+ g("#E8E8E8"),
206
+ g("#E5E5E5"),
207
+ g("#8A8A8A")
208
+ ]),
209
+ {
210
+ variable: "--sb-theme-input-background",
211
+ path: ["input", "background"],
212
+ fallback: g("#FFFFFF")
213
+ },
214
+ {
215
+ variable: "--sb-theme-input-foreground",
216
+ path: ["input", "foreground"],
217
+ fallback: g("#000000")
218
+ },
219
+ {
220
+ variable: "--sb-theme-input-placeholder",
221
+ path: ["input", "placeholder"],
222
+ fallback: g("#000000", .4)
223
+ },
224
+ {
225
+ variable: "--sb-theme-input-border",
226
+ path: ["input", "border"],
227
+ fallback: g("#000000", .18)
228
+ },
229
+ {
230
+ variable: "--sb-theme-input-focused-border",
231
+ path: ["input", "focusedBorder"],
232
+ fallback: g("#000000", .7)
233
+ },
234
+ {
235
+ variable: "--sb-theme-input-error-border",
236
+ path: ["input", "errorBorder"],
237
+ fallback: g("#B42318")
238
+ },
239
+ {
240
+ variable: "--sb-theme-input-disabled-background",
241
+ path: ["input", "disabledBackground"],
242
+ fallback: g("#F2F2F2")
243
+ },
244
+ {
245
+ variable: "--sb-theme-input-disabled-foreground",
246
+ path: ["input", "disabledForeground"],
247
+ fallback: g("#8A8A8A")
248
+ },
249
+ {
250
+ variable: "--sb-theme-fab-background",
251
+ path: ["fab", "background"],
252
+ fallback: g("#000000")
253
+ },
254
+ {
255
+ variable: "--sb-theme-fab-foreground",
256
+ path: ["fab", "foreground"],
257
+ fallback: g("#FFFFFF")
258
+ },
259
+ {
260
+ variable: "--sb-theme-fab-border",
261
+ path: ["fab", "border"],
262
+ fallback: g("#FFFFFF", .15)
263
+ },
264
+ {
265
+ variable: "--sb-theme-fab-accent-primary",
266
+ path: ["fab", "accentPrimary"],
267
+ fallback: g("#000000")
268
+ },
269
+ {
270
+ variable: "--sb-theme-fab-accent-secondary",
271
+ path: ["fab", "accentSecondary"],
272
+ fallback: g("#FFFFFF")
273
+ },
274
+ {
275
+ variable: "--sb-theme-fab-timer-track",
276
+ path: ["fab", "timerTrack"],
277
+ fallback: g("#000000", .16)
278
+ },
279
+ {
280
+ variable: "--sb-theme-fab-timer-fill",
281
+ path: ["fab", "timerFill"],
282
+ fallback: g("#000000")
283
+ }
284
+ ];
285
+ y.map((e) => e.variable);
286
+ var ee = Object.fromEntries(y.map((e) => [e.variable, x(e.fallback)]));
287
+ function b(e) {
288
+ return e && typeof e == "object" && !Array.isArray(e) ? e : {};
289
+ }
290
+ function x(e, t = h) {
291
+ return !e || typeof e.hex != "string" || !/^#[0-9a-fA-F]{6}$/.test(e.hex) || !Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1 ? t : `rgba(${Number.parseInt(e.hex.slice(1, 3), 16)}, ${Number.parseInt(e.hex.slice(3, 5), 16)}, ${Number.parseInt(e.hex.slice(5, 7), 16)}, ${e.alpha})`;
292
+ }
293
+ function S(e, t) {
294
+ let n = e;
295
+ for (let e of t) n = b(n)[e];
296
+ return n;
297
+ }
298
+ function C(e) {
299
+ return Object.fromEntries(y.map((t) => [t.variable, x(S(e, t.path), x(t.fallback))]));
300
+ }
301
+ function w(e, t) {
302
+ return g(`#${[
303
+ 1,
304
+ 3,
305
+ 5
306
+ ].map((n) => {
307
+ let r = Number.parseInt(e.hex.slice(n, n + 2), 16), i = Number.parseInt(t.hex.slice(n, n + 2), 16);
308
+ return Math.round(r * e.alpha + i * (1 - e.alpha)).toString(16).padStart(2, "0");
309
+ }).join("")}`, 1);
310
+ }
311
+ function te(e) {
312
+ let t = (t) => {
313
+ let n = y.find((e) => e.path.join(".") === t.join(".")), r = S(e, t);
314
+ return x(r, "") ? r : n.fallback;
315
+ }, n = {
316
+ ...t(["sheet", "background"]),
317
+ alpha: 1
318
+ }, r = t(["content", "heading"]), i = t([
319
+ "choice",
320
+ "selected",
321
+ "background"
322
+ ]), a = w(i, n), o = [
323
+ 1,
324
+ 3,
325
+ 5
326
+ ].map((e) => Number.parseInt(n.hex.slice(e, e + 2), 16) / 255), s = o[0] * .2126 + o[1] * .7152 + o[2] * .0722 < .5, c = n.hex.toUpperCase() === (s ? "#000000" : "#FFFFFF"), l = (e, t) => x(w({
327
+ ...e,
328
+ alpha: e.alpha * t
329
+ }, n)), u = w({
330
+ ...r,
331
+ alpha: r.alpha * (s ? c ? .15 : .08 : .14)
332
+ }, n), d = (e) => [
333
+ 1,
334
+ 3,
335
+ 5
336
+ ].reduce((t, n, r) => t + Number.parseInt(e.hex.slice(n, n + 2), 16) * [
337
+ .2126,
338
+ .7152,
339
+ .0722
340
+ ][r], 0), f = d(u) > d(n);
341
+ return {
342
+ "--sb-snackbar-surface": x(n),
343
+ "--sb-snackbar-text": x(r),
344
+ "--sb-snackbar-border": x(g(s ? "#FFFFFF" : "#000000", s ? .1 : .05)),
345
+ "--sb-snackbar-normal": l(r, s ? c ? .2 : .14 : c ? .08 : .1),
346
+ "--sb-snackbar-hover": l(r, s ? c ? .24 : .18 : .04),
347
+ "--sb-snackbar-pressed": l(i, s ? c ? .28 : .24 : .2),
348
+ "--sb-snackbar-active": x(a),
349
+ "--sb-snackbar-on-active": x(t([
350
+ "choice",
351
+ "selected",
352
+ "foreground"
353
+ ])),
354
+ "--sb-snackbar-ghost": x(u),
355
+ "--sb-snackbar-remaining": x(f ? u : n),
356
+ "--sb-snackbar-elapsed": x(f ? n : u)
357
+ };
358
+ }
359
+ var T = {
360
+ entrance: 1969.207,
361
+ timerEntrance: 2169.207,
362
+ widen: 200,
363
+ expand: 450
364
+ }, E = {
365
+ delay: 400,
366
+ enter: 450,
367
+ exit: 400,
368
+ removal: 450,
369
+ reduced: 150
370
+ }, ne = E.delay + E.enter;
371
+ function D(e, t) {
372
+ let { viewport: n, safeArea: r = {}, compactHeight: i } = t, a = A(r.left) + 12, o = A(r.right) + 12, s = A(r.top) + 24, c = A(r.bottom) + 8, l = Math.max(0, n.width - a - o), u = Math.min(364, l), d = Math.min(376, l), f = Math.max(0, n.height - s - c), p = Math.min(t.cardHeight, f);
373
+ if (t.barPosition) return {
374
+ compactWidth: n.width,
375
+ compactLeft: 0,
376
+ compactBottom: 0,
377
+ cardWidth: d,
378
+ cardHeight: p,
379
+ maxCardHeight: f,
380
+ cardLeft: a + (l - d) / 2,
381
+ cardBottom: c,
382
+ cardTop: A(r.top) + 12,
383
+ entranceOffset: 0,
384
+ transformOrigin: t.barPosition === "top" ? "50% 0%" : "50% 100%"
385
+ };
386
+ let m = N(e, {
387
+ viewport: n,
388
+ element: {
389
+ width: u,
390
+ height: i
391
+ },
392
+ safeArea: r
393
+ }), h = Math.max(a, Math.min(m.left, n.width - o - u)), g = Math.max(c, Math.min(n.height - m.top - i, n.height - s - i));
394
+ return {
395
+ compactWidth: u,
396
+ cardWidth: d,
397
+ compactLeft: h,
398
+ compactBottom: g,
399
+ cardHeight: p,
400
+ maxCardHeight: f,
401
+ cardTop: 0,
402
+ entranceOffset: (u - i) * M(e?.anchor).x,
403
+ cardLeft: a + (l - d) / 2,
404
+ cardBottom: Math.max(c, Math.min(g, n.height - s - p)),
405
+ transformOrigin: m.transformOrigin
406
+ };
407
+ }
408
+ var O = {
409
+ x: 1,
410
+ y: 1
411
+ }, k = {
412
+ x: -16,
413
+ y: -24
414
+ };
415
+ function A(e) {
416
+ return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : 0;
417
+ }
418
+ function j(e) {
419
+ return typeof e == "number" && Number.isFinite(e) ? e : 0;
420
+ }
421
+ function M(e) {
422
+ let t = b(e), n = typeof t.x == "number" && Number.isFinite(t.x) ? t.x : O.x, r = typeof t.y == "number" && Number.isFinite(t.y) ? t.y : O.y;
423
+ return {
424
+ x: Math.min(1, Math.max(0, n)),
425
+ y: Math.min(1, Math.max(0, r))
426
+ };
427
+ }
428
+ function N(e, t) {
429
+ let n = b(e), r = M(n.position), i = M(n.anchor), a = b(n.offset), o = e ? j(a.x) : k.x, s = e ? j(a.y) : k.y, c = t.safeArea ?? {}, l = A(c.left), u = A(c.right), d = A(c.top), f = A(c.bottom), p = Math.max(0, A(t.viewport.width) - l - u - A(t.element.width)), m = Math.max(0, A(t.viewport.height) - d - f - A(t.element.height));
430
+ return {
431
+ left: l + r.x * p + o,
432
+ top: d + r.y * m + s,
433
+ travelX: p,
434
+ travelY: m,
435
+ position: r,
436
+ anchor: i,
437
+ transformOrigin: `${i.x * 100}% ${i.y * 100}%`
438
+ };
439
+ }
440
+ function P(e, t, n = "forward") {
441
+ let r = e === "bar" || e === "fill" ? e : "none", i = n === "reverse" ? "reverse" : "forward", a = typeof t == "number" && Number.isFinite(t) && t > 0 ? t : null;
442
+ return {
443
+ style: r,
444
+ direction: i,
445
+ durationMs: a,
446
+ visible: r !== "none",
447
+ cssVariables: {
448
+ "--sb-timer-style": r,
449
+ "--sb-timer-direction": i,
450
+ ...a === null ? {} : { "--sb-timer-duration": `${a}ms` }
451
+ }
452
+ };
453
+ }
454
+ //#endregion
455
+ //#region src/ui/icons.ts
456
+ var F = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M6.4 6.4 17.6 17.6M17.6 6.4 6.4 17.6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>", I = "<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\"><path d=\"M6.66667 0 5.49167 1.175 10.1417 5.83333H0V7.5h10.1417l-4.65 4.6583 1.175 1.175L13.3333 6.66667 6.66667 0Z\" fill=\"currentColor\"/></svg>", L = "<svg viewBox=\"0 0 36 28\" aria-hidden=\"true\"><path d=\"m11.2619 21.3151-8.40108-8.4011L0 15.7546l11.2619 11.262L35.4379 2.84067 32.5972 0 11.2619 21.3151Z\" fill=\"currentColor\"/></svg>", R = "<svg viewBox=\"0 0 35.5556 35.5556\" aria-hidden=\"true\"><path d=\"M19.436 3.05195 11.2286 11.2594c-.5481.5481-.8592 1.3037-.8592 2.0888v14.8c0 1.6297 1.3333 2.963 2.9629 2.963h13.3334c1.1851 0 2.2518-.7111 2.7259-1.7926l4.8296-11.2741c1.2445-2.9333-.9037-6.1925-4.0889-6.1925H21.762l1.4074-6.78523c.1481-.74075-.0741-1.4963-.6074-2.02963-.8741-.85926-2.2667-.85926-3.126.01481ZM4.44343 31.1112c1.62963 0 2.96296-1.3333 2.96296-2.963V16.2964c0-1.6296-1.33333-2.963-2.96296-2.963-1.62963 0-2.96296 1.3334-2.96296 2.963v11.8518c0 1.6297 1.33333 2.963 2.96296 2.963Z\" fill=\"currentColor\"/></svg>", z = "<svg viewBox=\"0 0 35.5556 35.5556\" aria-hidden=\"true\"><path d=\"m16.1165 32.5036 8.1926-8.2074c.5481-.5482.8592-1.3037.8592-2.0889v-14.8c0-1.62963-1.3333-2.96296-2.9629-2.96296H8.88686c-1.18519 0-2.25185.71111-2.71111 1.79259L1.34612 17.511c-1.25926 2.9333.88889 6.1926 4.07407 6.1926h8.37041l-1.4074 6.7852c-.1482.7407.074 1.4963.6074 2.0296.874.8593 2.2666.8593 3.1259-.0148ZM31.1091 4.44434c-1.6296 0-2.963 1.33333-2.963 2.96296v11.8519c0 1.6296 1.3334 2.9629 2.963 2.9629 1.6296 0 2.9629-1.3333 2.9629-2.9629V7.4073c0-1.62963-1.3333-2.96296-2.9629-2.96296Z\" fill=\"currentColor\"/></svg>", B = ".sb-snackbar-root{--sb-text:var(--sb-snackbar-text);--sb-text-muted:var(--sb-theme-content-body);--sb-surface:var(--sb-snackbar-surface);z-index:1100;pointer-events:none;color:var(--sb-snackbar-text);font-family:Inter,-apple-system,BlinkMacSystemFont,system-ui,sans-serif;position:fixed;inset:0}.sb-snackbar-root *,.sb-snackbar-root :before,.sb-snackbar-root :after{box-sizing:border-box}.sb-snackbar-root h2{text-transform:none;letter-spacing:normal}.sb-snackbar-shell{left:var(--sb-snackbar-left);bottom:var(--sb-snackbar-bottom);width:var(--sb-snackbar-width);transition:left .2s ease-in-out,bottom .2s ease-in-out,width .2s ease-in-out;position:absolute}.sb-snackbar-surface{width:100%;height:var(--sb-snackbar-height,64px);border-radius:calc(var(--sb-snackbar-compact-height,64px) / 2);background:var(--sb-snackbar-surface);box-shadow:inset 0 0 0 1px var(--sb-snackbar-border);transition:height .45s cubic-bezier(0,.87,.39,1),border-radius .45s cubic-bezier(0,.87,.39,1);position:relative;overflow:hidden}.sb-snackbar-compact{width:var(--sb-snackbar-compact-width,364px);align-items:center;gap:10px;min-height:64px;padding:10px;transition:opacity .12s ease-out;display:flex;position:relative}.sb-snackbar-artwork{--sb-theme-fab-accent-primary:var(--sb-theme-sheet-progress-fill);--sb-theme-fab-accent-secondary:var(--sb-snackbar-surface);--sb-theme-fab-foreground:var(--sb-snackbar-text);background:var(--sb-theme-sheet-progress-fill);border-radius:50%;flex:0 0 40px;width:40px;height:40px;position:relative;overflow:hidden}.sb-snackbar-artwork img{z-index:2;object-fit:cover;width:100%;height:100%;position:absolute;inset:0}.sb-snackbar-prompt{overflow-wrap:anywhere;flex:1;min-width:0;margin:0;font-size:14px;font-weight:600;line-height:20px;position:relative}.sb-snackbar-answers{flex:none;gap:4px;display:flex;position:relative}.sb-snackbar-answer{width:44px;height:44px;color:var(--sb-snackbar-text);background:var(--sb-snackbar-normal);cursor:pointer;pointer-events:auto;border:0;border-radius:50%;place-items:center;margin:0;padding:0;transition:background .12s ease-out,scale .12s ease-out;display:grid}.sb-snackbar-answer svg{width:18px;height:18px}.sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover)}.sb-snackbar-answer:active:not(:disabled){background:var(--sb-snackbar-pressed);scale:.94}.sb-snackbar-answer[aria-pressed=true]{color:var(--sb-snackbar-on-active);background:var(--sb-snackbar-active)}.sb-snackbar-answer:disabled{cursor:default;pointer-events:none;opacity:1}.sb-snackbar-close{top:-25px;width:44px;height:44px;color:var(--sb-snackbar-text);pointer-events:auto;cursor:pointer;background:0 0;border:0;place-items:center;margin:0;padding:13px;display:grid;position:absolute;inset-inline-start:-15px}.sb-snackbar-close svg{background:var(--sb-snackbar-surface);border-radius:50%;width:18px;height:18px;padding:2px}.sb-snackbar-answer:focus-visible,.sb-snackbar-close:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-snackbar-timer{pointer-events:none;position:absolute;overflow:hidden}.sb-snackbar-timer--fill{background:var(--sb-snackbar-elapsed);inset:0}.sb-snackbar-timer--bar{inset-inline:1px 3px;background:var(--sb-theme-sheet-progress-track);height:2px;bottom:-6px}.sb-snackbar-timer-fill{transform-origin:0;background:var(--sb-theme-sheet-progress-fill);width:100%;height:100%;display:block}.sb-snackbar-timer--fill .sb-snackbar-timer-fill{background:var(--sb-snackbar-remaining)}.sb-snackbar-root:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)) .sb-snackbar-timer-fill{transform-origin:100%}.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation:sb-snackbar-countdown var(--sb-snackbar-duration) linear forwards}.sb-snackbar-root[data-frozen=true] .sb-snackbar-timer-fill{transform:scaleX(var(--sb-snackbar-fraction));animation:none}.sb-snackbar-overlay{background:var(--sb-theme-sheet-scrim);opacity:0;pointer-events:none;border:0;width:100%;height:100%;margin:0;padding:0;transition:opacity .45s ease-out;position:absolute;inset:0}.sb-snackbar-card{width:var(--sb-snackbar-card-width);max-height:var(--sb-snackbar-max-height);opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;overflow:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root{position:static;inset:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root__overlay{display:none}.sb-snackbar-root .sb-snackbar-card .sb-sheet{width:100%;max-height:none;box-shadow:none;background:0 0;border:0;margin:0;animation:none;position:relative;inset:auto;transform:none}.sb-snackbar-card[inert] *{animation-play-state:paused}.sb-snackbar-root[data-stage=widening] .sb-snackbar-compact,.sb-snackbar-root[data-stage=expanding] .sb-snackbar-compact,.sb-snackbar-root[data-stage=ready] .sb-snackbar-compact{opacity:0}.sb-snackbar-root[data-expanded=true] .sb-snackbar-overlay{opacity:1;pointer-events:auto}.sb-snackbar-root[data-expanded=true] .sb-snackbar-close{display:none}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-surface,.sb-snackbar-root[data-stage=ready] .sb-snackbar-surface{box-shadow:none;background:var(--sb-theme-sheet-background);border-radius:40px}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-card{opacity:1;transition:opacity .3s ease-out .12s}.sb-snackbar-root[data-stage=ready] .sb-snackbar-card{opacity:1;pointer-events:auto}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell{animation:.89016s cubic-bezier(.649439,.0577174,.124599,1) .18584s both sb-snackbar-enter-scale,.893207s cubic-bezier(.649439,.0577174,.124599,1) 1.076s both sb-snackbar-enter-width}.sb-snackbar-root[data-stage=entering] .sb-snackbar-surface{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close{animation:.2s ease-out 1.076s both sb-snackbar-label}.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer{animation:.2s ease-out 1.96921s both sb-snackbar-label}.sb-root--inline .sb-snackbar-root{position:absolute}@keyframes sb-snackbar-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-snackbar-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-snackbar-enter-width{0%{width:var(--sb-snackbar-compact-height,64px);translate:var(--sb-snackbar-entrance-offset) 0}to{width:var(--sb-snackbar-width);translate:0}}@keyframes sb-snackbar-label{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation-duration:var(--sb-snackbar-duration)!important}.sb-snackbar-root .sb-snackbar-shell,.sb-snackbar-root .sb-snackbar-surface,.sb-snackbar-root .sb-snackbar-card,.sb-snackbar-root .sb-snackbar-compact,.sb-snackbar-root .sb-snackbar-overlay{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell,.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers{animation:none}}.sb-snackbar-root[data-presentation=bar]{--sb-bar-hidden-y:max(80px, 100%)}.sb-snackbar-root[data-presentation=bar][data-position=top]{--sb-bar-hidden-y:calc(-1 * max(80px, 100%))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{top:var(--sb-bar-top,0px);transition:left .2s ease-in-out,top .2s ease-in-out,width .2s ease-in-out;bottom:auto}.sb-snackbar-root[data-presentation=bar]:not([data-expanded=true]) .sb-snackbar-surface{box-shadow:none;border-radius:0}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{border-block-start:1px solid var(--sb-snackbar-border);min-height:48px;padding:10px max(108px, env(safe-area-inset-right,0px)) 10px max(108px, env(safe-area-inset-left,0px));pointer-events:auto;justify-content:center}.sb-snackbar-root[data-presentation=bar][data-position=bottom] .sb-snackbar-compact{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-compact{padding-top:calc(10px + env(safe-area-inset-top,0px));border-block-start:0;border-block-end:1px solid var(--sb-snackbar-border)}.sb-bar-content{align-items:center;gap:12px;min-width:0;transition:opacity .25s ease-out;display:flex;position:relative}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:center;text-wrap:pretty;flex:0 auto;font-size:14px;font-weight:400;line-height:1.3}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border:1px solid var(--sb-snackbar-border);background:var(--sb-snackbar-surface);-webkit-tap-highlight-color:transparent;border-radius:36px;width:36px;height:24px;transition:background .18s,border-color .18s,scale .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:14.4px;height:14.4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer[aria-pressed=true]{background:var(--sb-snackbar-active);color:var(--sb-snackbar-on-active)}.sb-bar-acknowledgement{opacity:0;visibility:hidden;pointer-events:none;text-align:center;color:var(--sb-snackbar-text);justify-content:center;align-items:center;padding:10px 24px;font-size:18px;font-weight:600;line-height:1.4;transition:opacity .35s cubic-bezier(.16,1,.3,1) .1s,translate .35s cubic-bezier(.16,1,.3,1) .1s;display:flex;position:absolute;inset:0;translate:0 10px}.sb-snackbar-root[data-rated=true] .sb-bar-content,.sb-snackbar-root[data-rated=true] .sb-bar-dismiss,.sb-snackbar-root[data-rated=true][data-presentation=bar] .sb-snackbar-timer{opacity:0;pointer-events:none}.sb-snackbar-root[data-rated=true] .sb-bar-acknowledgement{opacity:1;visibility:visible;translate:0}.sb-bar-acknowledgement-copy{overflow-wrap:anywhere;min-width:0;max-width:100%}.sb-snackbar-root[data-presentation=bar][data-rated=true] .sb-snackbar-compact{min-height:var(--sb-snackbar-height,48px)}.sb-bar-dismiss{inset-inline-end:20px;width:68px;height:44px;color:var(--sb-theme-content-body);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:0;margin:0;padding:0 5px;font-size:14px;line-height:1.3;transition:opacity .25s ease-out;position:absolute;top:50%;translate:0 -50%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-surface)}@media (hover:hover){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover);border-color:var(--sb-theme-input-border)}}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{background:var(--sb-snackbar-pressed);scale:.96}.sb-bar-dismiss:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-bar-dismiss:disabled{cursor:default}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer{transition:opacity .25s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:auto 25px;background:var(--sb-snackbar-border);width:58px;height:1px;top:calc(50% + 8px);bottom:auto}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar .sb-snackbar-timer-fill{background:var(--sb-theme-content-body)}.sb-snackbar-root[data-presentation=bar][data-paused=true] .sb-snackbar-timer-fill{animation-play-state:paused}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.45s cubic-bezier(.16,1,.3,1) .4s both sb-bar-enter}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell{pointer-events:none;animation:.4s cubic-bezier(.55,0,.55,.2) both sb-bar-exit}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-overlay{opacity:0;pointer-events:none}.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.4s ease-out both sb-bar-card-exit}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-timer{animation:none}@keyframes sb-bar-enter{0%{translate:0 var(--sb-bar-hidden-y)}to{translate:0}}@keyframes sb-bar-exit{0%{translate:0}to{translate:0 var(--sb-bar-hidden-y)}}@keyframes sb-bar-fade-in{0%{opacity:0}to{opacity:1}}@keyframes sb-bar-fade-out{0%{opacity:1}to{opacity:0}}@keyframes sb-bar-card-exit{0%{opacity:1;translate:0}to{opacity:0;translate:0 12px}}@media (width<=768px){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-inline:max(24px, env(safe-area-inset-left,0px)) max(24px, env(safe-area-inset-right,0px))}.sb-bar-content{width:100%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:start;flex:1}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:5.333px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border-radius:48px;width:48px;height:32px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:19.2px;height:19.2px}.sb-bar-acknowledgement{text-align:start;justify-content:flex-start}.sb-snackbar-root[data-presentation=bar][data-timed=true] .sb-bar-dismiss{display:none}.sb-snackbar-root[data-presentation=bar][data-timed=false] .sb-bar-content{padding-inline-end:76px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:0;width:auto;top:0}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-timer--bar{top:auto;bottom:0}}.sb-root--inline .sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-block:10px}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-in}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell,.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-out}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{transition:none}.sb-bar-acknowledgement{transition:opacity .15s ease-out;translate:none}.sb-bar-content,.sb-bar-dismiss{transition:opacity .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{scale:1}}:host{--sb-surface:var(--sb-theme-sheet-background,#fff);--sb-surface-muted:var(--sb-theme-button-secondary-background,#f2f2f2);--sb-border:var(--sb-theme-input-border,#0808081f);--sb-border-strong:#0808083d;--sb-border-active:var(--sb-theme-input-focused-border,#080808b3);--sb-text:var(--sb-theme-content-heading,#080808);--sb-text-muted:var(--sb-theme-content-body,#5c5c5c);--sb-overlay:var(--sb-theme-sheet-scrim,#00000061);--sb-ease:cubic-bezier(.2, .9, .2, 1);--sb-fab-motion-ease:cubic-bezier(.649439, .0577174, .124599, 1);--sb-sheet-motion-ease:cubic-bezier(0, .87, .39, 1);font-family:-apple-system,BlinkMacSystemFont,system-ui,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.sb-safe-area-probe{visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);position:fixed;inset:0}.sb-fab{right:16px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:1000;box-sizing:border-box;border:1px solid var(--sb-theme-fab-border,#080808);background:var(--sb-theme-fab-background,#080808);min-width:0;height:60px;color:var(--sb-theme-fab-foreground,#fff);border-color:var(--sb-theme-fab-border,#080808);cursor:pointer;will-change:transform;align-items:center;transition:scale .12s ease-out;display:inline-flex;position:fixed;overflow:hidden}.sb-fab--entering{animation:sb-fab-enter-scale .89016s var(--sb-fab-motion-ease) .259705s both, sb-fab-enter-width .893207s var(--sb-fab-motion-ease) 1.076s both;transform-origin:50%!important}.sb-fab--entering .sb-fab__label{animation:sb-fab-label-in .2s var(--sb-fab-motion-ease) 1.14987s both}.sb-fab--entering .sb-fab__timer{animation:sb-fab-timer-in .2s var(--sb-fab-motion-ease) 1.96921s both}.sb-fab--entering .sb-fab__timer-fill{animation-delay:1.96921s}.sb-fab--exiting{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));pointer-events:none;scale:var(--sb-fab-exit-scale,1);translate:var(--sb-fab-exit-offset,0) 0;animation:.292089s cubic-bezier(.677885,.170122,.695982,.997824) .3s forwards sb-fab-exit-width,.390467s cubic-bezier(.362165,.0946429,.49708,.932961) .466372s forwards sb-fab-exit-scale;transform:none;transform-origin:50%!important}.sb-fab--exiting .sb-fab__label{opacity:var(--sb-fab-exit-label-opacity,1);animation:.389727s cubic-bezier(.5,0,.5,1) .3s forwards sb-fab-label-out}.sb-fab--exiting .sb-fab__timer{opacity:var(--sb-fab-exit-timer-opacity,0)}.sb-fab--exiting .sb-fab__badge{animation:.297243s cubic-bezier(.5,0,1,.600461) .398177s forwards sb-fab-badge-out}.sb-next:hover,.sb-next:focus-visible,.sb-button:hover,.sb-button:focus-visible,.sb-choice:hover,.sb-choice:focus-visible{transform:translateY(-1px)}.sb-fab:active{transition-duration:80ms;scale:.97}.sb-fab:focus-visible,.sb-next:focus-visible,.sb-button:focus-visible,.sb-choice:focus-visible,.sb-sheet__close:focus-visible,.sb-sentiment:focus-visible,.sb-sheet-root__overlay:focus-visible{outline-offset:2px;outline:2px solid #6366f1a6}.sb-fab--expanded{width:var(--sb-fab-expanded-width,auto);border-radius:999px;justify-content:flex-start;gap:12px;min-height:60px;padding:13px 28px 13px 14px}.sb-fab__label{z-index:1;width:var(--sb-fab-label-width,auto);color:currentColor;text-align:left;white-space:nowrap;text-overflow:clip;min-width:0;font-size:14px;font-weight:600;line-height:1;position:relative;overflow:hidden}.sb-fab__badge{z-index:1;background:var(--sb-theme-fab-accent-primary,#f97316);border-radius:50%;flex:none;place-items:center;width:32px;height:32px;display:grid;position:relative}.sb-fab__badge-artwork{background:var(--sb-theme-fab-accent-secondary,#2563eb);border-radius:50%;display:block;position:absolute;inset:5.44px}.sb-fab__badge-image{z-index:2;border-radius:inherit;object-fit:cover;width:100%;height:100%;display:block;position:absolute;inset:0}.sb-fab__badge-glyph-center,.sb-fab__badge-glyph-amber,.sb-fab__badge-glyph-mint,.sb-fab__badge-glyph-rose{border-radius:999px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.sb-fab__badge-glyph-center{background:var(--sb-theme-fab-foreground,#fff);border-radius:3.52px;width:4.16px;height:11.52px}.sb-fab__badge-glyph-amber{background:#fac143;width:2.88px;height:6.72px;translate:-3.04px .8px}.sb-fab__badge-glyph-mint{background:#39c690;width:2.88px;height:5.44px;translate:3.04px -.32px}.sb-fab__badge-glyph-rose{background:#e86398;width:2.56px;height:4.16px;translate:.96px 3.68px}.sb-fab__timer{z-index:0;pointer-events:none;position:absolute;overflow:hidden}.sb-fab__timer--bar{background:var(--sb-theme-fab-timer-track,#08080829);border-radius:999px;height:2px;bottom:4px;left:59px;right:29px}.sb-fab[data-timer-direction=rtl] .sb-fab__timer--bar{left:29px;right:59px}.sb-fab__timer--fill{border-radius:inherit;background:var(--sb-theme-fab-timer-track,#08080829);inset:0}.sb-fab__timer-fill{border-radius:inherit;background:var(--sb-theme-fab-timer-fill,#080808e6);width:100%;height:100%;transform-origin:var(--sb-fab-timer-origin,left);animation:sb-fab-timer-bar var(--sb-timer-duration) linear forwards;display:block}.sb-sheet-root{z-index:1100;position:fixed;inset:0}.sb-sheet-root__overlay{background:var(--sb-overlay);cursor:pointer;border:none;animation:.2s ease-in both sb-overlay-in;position:absolute;inset:0}.sb-sheet-root--exiting{pointer-events:none}.sb-sheet-root--exiting .sb-sheet-root__overlay{animation:.2s ease-in forwards sb-overlay-out}.sb-sheet{width:min(100%,100vw);min-height:418px;padding:24px 20px calc(18px + env(safe-area-inset-bottom,0px));box-sizing:border-box;background:var(--sb-surface);box-shadow:var(--sb-shadow);color:var(--sb-text);animation:sb-sheet-in-mobile .45s var(--sb-sheet-motion-ease) both;border-radius:40px 40px 0 0;position:absolute;bottom:0;left:0;right:0}.sb-sheet--thanks{min-height:381px;padding-top:18px}.sb-sheet__header{justify-content:flex-end;align-items:flex-start;min-height:28px;margin-bottom:22px;display:flex;position:relative}.sb-progress{background:var(--sb-theme-sheet-progress-track,#eaeaea);border-radius:999px;width:219px;max-width:calc(100% - 96px);height:6px;position:absolute;top:5px;left:50%;overflow:hidden;transform:translate(-50%)}.sb-progress__fill{border-radius:inherit;background:var(--sb-theme-sheet-progress-fill,#080808);height:100%;transition:width .22s var(--sb-ease);display:block}.sb-sheet__close{background:var(--sb-theme-sheet-close-button-background,transparent);width:20px;height:20px;color:var(--sb-theme-sheet-close-button-foreground,var(--sb-text));cursor:pointer;border:none;padding:0}.sb-sheet__close svg,.sb-next svg,.sb-thanks__icon-core svg{width:100%;height:100%;display:block}.sb-sheet__body{gap:26px;display:grid}.sb-sheet__copy{justify-items:center;gap:8px;display:grid}.sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;margin:0;font-size:16px;font-weight:400;line-height:1.4}.sb-sheet__body h2,.sb-thanks__copy h2{color:var(--sb-theme-content-heading,var(--sb-text));text-align:center;margin:0;font-size:22px;font-weight:600;line-height:1.2}.sb-sheet__body h2{justify-self:center;width:min(297px,100%)}.sb-choice--selected,.sb-choice:hover,.sb-textarea-shell:focus-within{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active))}.sb-choice:hover{background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-choice:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text))}.sb-choice--selected{box-shadow:0 0 0 3px #0808080d}.sb-choice:disabled{border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c);cursor:not-allowed}.sb-question--choices{grid-template-columns:repeat(2,160px);justify-content:center;justify-self:center;gap:9px;width:min(330px,100%)}.sb-choice{border:1px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:160px;height:51px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));text-align:center;white-space:nowrap;cursor:pointer;transition:transform .2s var(--sb-ease), border-color .18s ease, box-shadow .18s ease, background-color .18s ease;border-radius:999px;justify-content:center;align-items:center;padding:0 16px;font-size:16px;font-weight:700;line-height:1.2;display:flex}.sb-choice__label{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.sb-choice--other{border-color:var(--sb-theme-choice-default-border,#e2e2e2);padding:0;font-weight:400}.sb-choice__other-content{align-items:center;gap:0;display:inline-flex}.sb-choice__other-caret{background:var(--sb-theme-input-foreground,var(--sb-text));flex:none;width:1px;height:22px}.sb-choice__other-label{color:var(--sb-theme-input-placeholder,#08080866);line-height:1.2}.sb-choice--selected{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-question--text{justify-self:center;width:min(330px,100%)}.sb-textarea-shell{border:1px solid var(--sb-theme-input-border,#08080833);background:var(--sb-theme-input-background,var(--sb-surface));border-radius:16px;width:100%;min-height:155px;transition:border-color .18s,box-shadow .18s}.sb-textarea{resize:none;width:100%;min-height:155px;color:var(--sb-theme-input-foreground,var(--sb-text));font:inherit;box-sizing:border-box;background:0 0;border:none;outline:none;padding:16px 22px;font-size:16px;line-height:1.2}.sb-textarea::placeholder{color:var(--sb-theme-input-placeholder,#08080866)}.sb-textarea-shell:focus-within{border-color:var(--sb-theme-input-focused-border,var(--sb-border-active))}.sb-textarea:disabled{color:var(--sb-theme-input-disabled-foreground,var(--sb-text-muted))}.sb-textarea-shell:has(.sb-textarea:disabled){background:var(--sb-theme-input-disabled-background,var(--sb-surface-muted))}.sb-sheet__footer{min-height:84px;margin:0 -20px calc(-18px - env(safe-area-inset-bottom,0px));padding:18px 20px calc(18px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);box-sizing:border-box;justify-content:flex-end;align-items:center;gap:16px;display:flex}.sb-next,.sb-button{cursor:pointer;min-height:48px;font:inherit;transition:transform .2s var(--sb-ease), opacity .18s ease, box-shadow .18s ease;border:none;border-radius:999px}.sb-next{background:var(--sb-theme-button-primary-background,#080808);width:101px;color:var(--sb-theme-button-primary-foreground,#fff);place-items:center;padding:0;display:grid}.sb-next--acknowledging svg{animation:.36s cubic-bezier(.2,.8,.2,1) both sb-next-acknowledgement}.sb-next:disabled,.sb-button:disabled{cursor:not-allowed;box-shadow:none;transform:none}.sb-next:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-thanks{justify-items:center;gap:23px;padding-top:12px;display:grid}.sb-thanks__icon-shell{background:var(--sb-theme-completion-outer-background,#f0f0f0);border-radius:999px;place-items:center;width:120px;height:120px;display:grid}.sb-thanks__icon-core{background:var(--sb-theme-completion-inner-background,#080808);width:66px;height:66px;color:var(--sb-theme-completion-glyph,#fff);border-radius:999px;place-items:center;display:grid}.sb-thanks__copy{gap:8px;max-width:313px;display:grid}.sb-thanks__copy h2{letter-spacing:-.03em;font-size:30px;line-height:1.1}.sb-thanks__copy p{color:var(--sb-theme-content-body,var(--sb-text-muted));text-align:center;margin:0;font-size:14px;line-height:1.3}.sb-thanks__actions{gap:10px;width:100%;display:flex}.sb-button{flex:1 1 0;padding:16px;font-size:14px;font-weight:600;line-height:1}.sb-button--primary{background:var(--sb-theme-button-primary-background,#080808);color:var(--sb-theme-button-primary-foreground,#fff)}.sb-button--secondary{background:var(--sb-theme-button-secondary-background,#f2f2f2);color:var(--sb-theme-button-secondary-foreground,var(--sb-text))}.sb-button--tertiary{background:var(--sb-theme-button-tertiary-background,transparent);color:var(--sb-theme-button-tertiary-foreground,var(--sb-text))}.sb-button--primary:hover,.sb-button--primary:focus-visible{background:var(--sb-theme-button-primary-hover-background,#080808)}.sb-button--secondary:hover,.sb-button--secondary:focus-visible{background:var(--sb-theme-button-secondary-hover-background,#f2f2f2)}.sb-button--tertiary:hover,.sb-button--tertiary:focus-visible{background:var(--sb-theme-button-tertiary-hover-background,#f2f2f2)}.sb-button--primary:active{background:var(--sb-theme-button-primary-pressed-background,#080808)}.sb-button--secondary:active{background:var(--sb-theme-button-secondary-pressed-background,#e2e2e2)}.sb-button--tertiary:active{background:var(--sb-theme-button-tertiary-pressed-background,#e2e2e2)}.sb-button--primary:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-button--secondary:disabled{background:var(--sb-theme-button-secondary-disabled-background,#f2f2f2);color:var(--sb-theme-button-secondary-disabled-foreground,var(--sb-text))}.sb-button--tertiary:disabled{background:var(--sb-theme-button-tertiary-disabled-background,#f2f2f2);color:var(--sb-theme-button-tertiary-disabled-foreground,var(--sb-text))}@media (width>=768px){.sb-fab{bottom:24px;right:24px}}.sb-sheet-root__overlay{padding:0}.sb-sheet{top:auto;right:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));width:min(376px,100% - 24px);min-height:0;max-height:calc(100% - 16px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));box-shadow:none;animation:sb-card-in .45s var(--sb-sheet-motion-ease) both;interpolate-size:allow-keywords;border-radius:40px;padding:0;transition:height .45s cubic-bezier(0,.83,.363,.994);position:absolute;left:50%;overflow:hidden;transform:translate(-50%)}.sb-sheet-root--exiting .sb-sheet{animation:.45s ease-in forwards sb-card-out}.sb-sheet--thanks{min-height:0;padding:22px 20px}.sb-sheet__header{height:50px;min-height:0;margin:0;display:block;position:relative}.sb-progress{width:216px;max-width:calc(100% - 96px);height:6px;top:27px}.sb-progress__fill{transition:width .45s var(--sb-sheet-motion-ease)}.sb-sheet__close{box-sizing:border-box;border-radius:4px;width:40px;height:40px;padding:8px;position:absolute;top:10px;right:16px}.sb-sheet__close svg{width:24px;height:24px}.sb-sheet__body{animation:.25s ease-in-out both sb-step-in;display:block}.sb-sheet__copy{box-sizing:border-box;align-content:center;justify-items:center;gap:0;height:88px;padding:0 23px;display:grid}.sb-sheet__body h2{text-align:center;text-wrap:balance;width:100%;margin:0;font-size:19px;font-weight:600;line-height:1.22}.sb-sheet__body--sentiment{padding:12px 24px 22px}.sb-sheet__body--sentiment .sb-sheet__copy{gap:8px;height:auto;min-height:84px;padding:0}.sb-sheet__body--sentiment .sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:16px;font-weight:400;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2{-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:22px;font-weight:600;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2.sb-sheet__acknowledgement{align-content:center;min-height:70px;font-size:29px;line-height:1.08;animation:.28s cubic-bezier(.2,.8,.2,1) both sb-acknowledgement-in}.sb-question{justify-items:stretch;display:grid}.sb-question--sentiment{grid-template-columns:repeat(2,80px);justify-content:center;gap:25px;width:185px;margin:37px auto 31px;position:relative}.sb-sheet__body--sentiment:has(.sb-sheet__acknowledgement) .sb-question--sentiment{margin-top:35px}.sb-sentiment{z-index:0;border:1.111px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:80px;height:80px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));cursor:pointer;border-radius:50%;place-items:center;padding:0;transition:transform .12s ease-out,border-color .18s,background-color .18s;display:grid;position:relative}.sb-sentiment__icon{z-index:1;width:35.5556px;height:35.5556px}.sb-sentiment__icon svg{width:100%;height:100%;display:block}.sb-sentiment:hover{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active));background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-sentiment:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text));transform:scale(.97)}.sb-sentiment--selected,.sb-sentiment--selected:disabled{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-sentiment:disabled:not(.sb-sentiment--selected){border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c)}.sb-sentiment:disabled{cursor:default}.sb-spark-ring{z-index:-1;pointer-events:none;animation:.22s cubic-bezier(.25,.46,.45,.94) both sb-spark-ring-in;position:absolute;inset:-26px}.sb-spark-ring__spark{--sb-spark-angle:calc(var(--sb-spark-index) * 30deg);width:7px;height:7px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-54px);background:#dedede;border-radius:50%;position:absolute;top:50%;left:50%}.sb-spark-ring__spark:nth-child(2n){width:12px;height:12px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-59px)}.sb-question--choices,.sb-question--text{justify-self:stretch;width:auto;margin:0 24px}.sb-question--choices{scrollbar-gutter:stable;align-content:start;gap:8px;max-height:320.5px;overflow:hidden auto}.sb-question--choices-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sb-question--choices-single{grid-template-columns:minmax(0,1fr)}.sb-question--choices-scrolling{padding-bottom:20px}.sb-choice{white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0;height:51px;padding:0 8px}.sb-question--choices-single .sb-choice{text-align:left;border-radius:16px;justify-content:flex-start;height:auto;min-height:51px;padding:16px 22px}.sb-choice--other{color:var(--sb-theme-input-placeholder,#08080866);gap:0;font-weight:400}.sb-choice--other:before{background:var(--sb-theme-input-foreground,var(--sb-text));flex:0 0 1px;width:1px;height:22px;position:static;transform:none}.sb-question--text{padding-top:10px}.sb-question--other{animation:.25s ease-in-out both sb-step-in}.sb-textarea-shell,.sb-textarea{height:155px;min-height:155px}.sb-textarea{padding:17px 22px;font-size:16px;font-weight:400;line-height:1.2}.sb-sheet__body--question{padding-bottom:16px}.sb-sheet__footer{border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);justify-content:flex-end;align-items:center;gap:16px;min-height:84px;margin:0;padding:16px 20px 20px;display:flex}.sb-sheet__footer-comment{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:left;-webkit-line-clamp:2;-webkit-box-orient:vertical;flex:auto;margin:0;font-size:16px;font-weight:600;line-height:1.2;animation:.18s ease-out both sb-footer-comment-in,.18s ease-in 1s forwards sb-footer-comment-out;display:-webkit-box;overflow:hidden}.sb-next{flex:0 0 101px;height:48px}.sb-next svg{width:20px;height:20px;transform:none}.sb-sheet--completing .sb-progress__fill{transition-duration:.5s}.sb-thanks{gap:23px;padding:0;animation:.3s ease-in-out .89s both sb-completion-in}.sb-thanks__icon-shell{animation:sb-completion-icon-in .72s var(--sb-sheet-motion-ease) .35s both}.sb-thanks__icon-core svg{width:35.44px;height:27.02px}.sb-thanks__copy{width:100%;max-width:330px}.sb-thanks__copy h2{letter-spacing:-.6px;font-weight:600}.sb-thanks__copy p{max-width:292px;margin-inline:auto;line-height:1.5}.sb-thanks__actions{gap:10px}.sb-choice-measure{white-space:nowrap;visibility:hidden;width:max-content;padding:0 8px;font-size:16px;font-weight:700;position:fixed;top:-10000px;left:-10000px}.sb-choice-measure--other{padding-left:9px;padding-right:8px;font-weight:400}@keyframes sb-fab-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-fab-enter-width{0%{width:60px;translate:var(--sb-fab-anchor-offset) 0}to{width:var(--sb-fab-expanded-width);translate:0}}@keyframes sb-fab-label-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-timer-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-exit-width{0%{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));translate:var(--sb-fab-exit-offset,0) 0}to{width:60px;translate:var(--sb-fab-anchor-offset) 0}}@keyframes sb-fab-label-out{0%{opacity:var(--sb-fab-exit-label-opacity,1)}to{opacity:0}}@keyframes sb-fab-badge-out{0%{scale:1}to{scale:0}}@keyframes sb-fab-exit-scale{0%{scale:var(--sb-fab-exit-scale,1)}to{scale:0}}@keyframes sb-sheet-in-mobile{0%{opacity:0;transform:translateY(28px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-sheet-in-desktop{0%{opacity:0;transform:translate(-50%,calc(28px - 50%))}to{opacity:1;transform:translate(-50%,-50%)}}@keyframes sb-sheet-out-mobile{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}@keyframes sb-sheet-out-desktop{0%{opacity:1;transform:translate(-50%,-50%)}to{opacity:0;transform:translate(-50%,100vh)}}@keyframes sb-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes sb-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes sb-fab-timer-bar{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-card-in{0%{opacity:0;transform:translate(-50%,28px)}to{opacity:1;transform:translate(-50%)}}@keyframes sb-card-out{0%{opacity:1;transform:translate(-50%)}to{opacity:0;transform:translate(-50%,calc(100% + 8px))}}@keyframes sb-step-in{0%{opacity:0}to{opacity:1}}@keyframes sb-acknowledgement-in{0%{opacity:0;transform:scale(1.12)}to{opacity:1;transform:scale(1)}}@keyframes sb-next-acknowledgement{0%,to{rotate:0deg;scale:1}39%{rotate:-14deg;scale:1.18}}@keyframes sb-spark-ring-in{0%{opacity:0;transform:scale(.55)}to{opacity:1;transform:scale(1)}}@keyframes sb-footer-comment-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-footer-comment-out{0%{opacity:1}to{opacity:0}}@keyframes sb-completion-icon-in{0%{opacity:0;transform:translateY(46px)scale(.72)}58%{opacity:1;transform:translateY(46px)scale(1.82)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes sb-completion-in{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.sb-fab--entering,.sb-fab--entering .sb-fab__label,.sb-fab--entering .sb-fab__timer,.sb-fab--exiting,.sb-fab--exiting .sb-fab__label,.sb-fab--exiting .sb-fab__badge,.sb-sheet,.sb-step,.sb-spark-ring,.sb-sheet__acknowledgement,.sb-sheet__footer-comment,.sb-thanks,.sb-thanks__icon-shell,.sb-sheet-root__overlay,.sb-sheet-root--exiting .sb-sheet,.sb-sheet-root--exiting .sb-sheet-root__overlay{animation-duration:.001ms;animation-delay:0s}.sb-fab--entering .sb-fab__timer-fill{animation-delay:0s}.sb-sheet__footer-comment{animation:none}}";
457
+ //#endregion
458
+ //#region src/ui/snackbar-ui.ts
459
+ function V(e, t) {
460
+ let n = document.createElement(e);
461
+ return n.className = t, n;
462
+ }
463
+ var re = class {
464
+ root = V("div", "sb-snackbar-root");
465
+ shell = V("div", "sb-snackbar-shell");
466
+ surface = V("div", "sb-snackbar-surface");
467
+ compact = V("div", "sb-snackbar-compact");
468
+ card = V("div", "sb-snackbar-card");
469
+ overlay = document.createElement("button");
470
+ close = document.createElement("button");
471
+ acknowledgement = V("span", "sb-bar-acknowledgement");
472
+ acknowledgementCopy = V("span", "sb-bar-acknowledgement-copy");
473
+ barContent = V("div", "sb-bar-content");
474
+ answers = /* @__PURE__ */ new Map();
475
+ timers = /* @__PURE__ */ new Set();
476
+ observer;
477
+ session;
478
+ stage = "entering";
479
+ expanded = !1;
480
+ destroyed = !1;
481
+ store;
482
+ safeAreaProbe;
483
+ renderCard;
484
+ onReady;
485
+ constructor(e, t, n, r, i, a) {
486
+ this.store = e, this.safeAreaProbe = r, this.renderCard = i, this.onReady = a, this.session = t;
487
+ let o = t.sentimentPresentation === "bar";
488
+ this.root.dataset.presentation = t.sentimentPresentation, this.root.dataset.position = t.barPosition;
489
+ let s = t.survey.questions[t.survey.root_node_id], { imageUrl: c } = m(s, t.survey.fab);
490
+ this.compact.setAttribute("role", "group"), this.compact.setAttribute("aria-label", s.prompt);
491
+ let l = V("span", "sb-snackbar-artwork");
492
+ l.setAttribute("aria-hidden", "true");
493
+ let u = V("span", "sb-fab__badge-artwork");
494
+ for (let e of [
495
+ "center",
496
+ "amber",
497
+ "mint",
498
+ "rose"
499
+ ]) u.append(V("span", `sb-fab__badge-glyph-${e}`));
500
+ if (l.append(u), c) {
501
+ let e = document.createElement("img");
502
+ e.src = c, e.alt = "", e.addEventListener("error", () => e.remove(), { once: !0 }), l.append(e);
503
+ }
504
+ let d = V("p", "sb-snackbar-prompt");
505
+ d.textContent = s.prompt, o && t.barBehavior === "dismiss" && (this.acknowledgement.setAttribute("role", "status"), this.acknowledgement.append(this.acknowledgementCopy));
506
+ let p = V("div", "sb-snackbar-answers");
507
+ for (let n of s.answers ?? []) {
508
+ let r = document.createElement("button");
509
+ r.type = "button", r.className = "sb-snackbar-answer", r.setAttribute("aria-label", n.label), r.innerHTML = f(n) ? R : z, r.addEventListener("click", () => e.answerSnackbar(t.presentationId, n.id)), this.answers.set(n.id, r), p.append(r);
510
+ }
511
+ let h = t.survey.fab?.timerStyle ?? "none", g = null;
512
+ h !== "none" && (g = V("span", `sb-snackbar-timer sb-snackbar-timer--${h}`), g.setAttribute("aria-hidden", "true"), g.append(V("span", "sb-snackbar-timer-fill")), h === "bar" && !o ? d.append(g) : this.compact.append(g)), o || this.compact.append(l), o ? (this.barContent.append(d, p), this.compact.append(this.barContent)) : this.compact.append(d, p), this.overlay.type = "button", this.overlay.className = "sb-snackbar-overlay", this.overlay.tabIndex = -1, this.overlay.setAttribute("aria-hidden", "true"), this.overlay.addEventListener("click", () => void e.closeSurvey()), this.close.type = "button", this.close.className = o ? "sb-bar-dismiss" : "sb-snackbar-close", o ? this.close.textContent = "Not Now" : (this.close.setAttribute("aria-label", "Close survey"), this.close.innerHTML = F), this.close.addEventListener("click", () => void e.closeSurvey()), this.surface.append(this.compact, this.card), this.shell.append(this.surface), o ? this.compact.append(this.close) : this.shell.append(this.close), o && t.barBehavior === "dismiss" && this.compact.append(this.acknowledgement), this.root.append(this.overlay, this.shell), n.append(this.root), this.observer = typeof ResizeObserver > "u" ? null : new ResizeObserver(this.updatePlacement), this.observer?.observe(this.compact), this.observer?.observe(this.card), window.addEventListener("resize", this.updatePlacement), window.visualViewport?.addEventListener("resize", this.updatePlacement), window.visualViewport?.addEventListener("scroll", this.updatePlacement), o && (this.surface.addEventListener("pointerenter", this.onPointerEnter), this.surface.addEventListener("pointerleave", this.onPointerLeave)), this.update(t), this.after(o ? this.reducedMotion() ? E.reduced : ne : this.reducedMotion() ? 0 : h === "none" ? T.entrance : T.timerEntrance, () => {
513
+ this.stage = "compact", this.updateStage(), e.confirmPresentation("expanded_fab", t.presentationId), e.confirmFabEntranceCompleted(t.presentationId), o && this.surface.matches(":hover") && window.matchMedia?.("(hover: hover)").matches && e.setBarTimerPaused(t.presentationId, !0);
514
+ });
515
+ }
516
+ update(e) {
517
+ this.session = e;
518
+ for (let [t, n] of Object.entries(te(e.survey.theme))) this.root.style.setProperty(t, n);
519
+ this.root.style.setProperty("--sb-snackbar-duration", `${e.survey.fab?.expandedTimeout ?? 0}ms`), this.root.style.setProperty("--sb-snackbar-fraction", String(e.snackbar?.frozenFraction ?? 1)), this.root.dataset.counting = String(e.snackbar?.deadline != null || e.snackbar?.pausedRemainingMs != null), this.root.dataset.paused = String(e.snackbar?.pausedRemainingMs != null), this.root.dataset.timed = String((e.survey.fab?.timerStyle === "bar" || e.survey.fab?.timerStyle === "fill") && typeof e.survey.fab.expandedTimeout == "number" && e.survey.fab.expandedTimeout > 0), this.root.dataset.frozen = String(e.snackbar?.frozenFraction != null), this.root.dataset.expanded = String(e.isOpen), this.root.dataset.behavior = e.barBehavior;
520
+ let t = e.sentimentPresentation === "bar" && e.barBehavior === "dismiss" && e.snackbar?.selectedKey != null;
521
+ if (this.root.dataset.rated = String(t), this.barContent.inert = t, this.barContent.toggleAttribute("inert", t), this.barContent.setAttribute("aria-hidden", String(t)), e.sentimentPresentation === "bar" && e.barBehavior === "dismiss") {
522
+ let t = e.survey.questions[e.survey.root_node_id].answers?.find((t) => t.id === e.snackbar?.selectedKey), n = t ? t.comment?.trim() || "Thanks for your feedback." : "";
523
+ this.acknowledgementCopy.textContent !== n && (this.acknowledgementCopy.textContent = n);
524
+ }
525
+ for (let [t, n] of this.answers) n.disabled = !e.fabEntranceCompleted || e.snackbar?.phase !== "question", n.setAttribute("aria-pressed", String(e.snackbar?.selectedKey === t));
526
+ if (e.isOpen) {
527
+ let t = this.renderCard(e);
528
+ this.card.contains(t) || this.card.replaceChildren(t), this.expanded || (this.expanded = !0, this.stage = "widening", this.after(this.reducedMotion() ? 0 : T.widen, () => {
529
+ this.stage = "expanding", this.updateStage();
530
+ }), this.after(this.reducedMotion() ? 0 : T.widen + T.expand, () => {
531
+ this.stage = "ready", this.updateStage(), this.store.confirmPresentation("sheet", e.presentationId), this.store.confirmSnackbarContentReady(e.presentationId), this.onReady();
532
+ }));
533
+ }
534
+ this.updateStage();
535
+ }
536
+ updateStage() {
537
+ this.root.dataset.stage = this.stage, this.compact.inert = this.session.isOpen || this.stage === "entering" || this.stage === "exiting", this.compact.toggleAttribute("inert", this.compact.inert), this.compact.setAttribute("aria-hidden", String(this.compact.inert)), this.card.inert = this.stage !== "ready", this.card.toggleAttribute("inert", this.card.inert), this.card.setAttribute("aria-hidden", String(this.card.inert)), this.overlay.disabled = this.stage !== "ready", this.close.disabled = this.session.isOpen || this.stage === "exiting" || this.root.dataset.rated === "true", this.updatePlacement();
538
+ }
539
+ updatePlacement = () => {
540
+ if (this.stage === "exiting") return;
541
+ let e = window.visualViewport, t = e?.width || window.innerWidth, n = e?.height || window.innerHeight, r = getComputedStyle(this.safeAreaProbe), i = (e) => Number.parseFloat(e) || 0, { survey: a } = this.session, { placement: o } = m(a.questions[a.root_node_id], a.fab), s = {
542
+ viewport: {
543
+ width: t,
544
+ height: n
545
+ },
546
+ safeArea: {
547
+ left: i(r.paddingLeft),
548
+ right: i(r.paddingRight),
549
+ top: i(r.paddingTop),
550
+ bottom: i(r.paddingBottom)
551
+ },
552
+ compactHeight: 64,
553
+ cardHeight: this.card.querySelector(".sb-sheet")?.offsetHeight || 0,
554
+ barPosition: this.session.sentimentPresentation === "bar" ? this.session.barPosition : void 0
555
+ };
556
+ this.root.style.setProperty("--sb-snackbar-compact-width", `${D(o, s).compactWidth}px`);
557
+ let c = this.root.dataset.rated === "true";
558
+ c && (this.compact.style.minHeight = "48px");
559
+ let l = getComputedStyle(this.compact), u = Number.parseFloat(l.height) || this.compact.offsetHeight || (s.barPosition ? 48 : 64), d = c ? Math.max(u, this.acknowledgementCopy.scrollHeight + i(l.paddingTop) + i(l.paddingBottom)) : u;
560
+ c && this.compact.style.removeProperty("min-height");
561
+ let f = D(o, {
562
+ ...s,
563
+ compactHeight: d
564
+ });
565
+ this.root.style.left = `${e?.offsetLeft ?? 0}px`, this.root.style.top = `${e?.offsetTop ?? 0}px`, this.root.style.width = `${t}px`, this.root.style.height = `${n}px`;
566
+ let p = [
567
+ "widening",
568
+ "expanding",
569
+ "ready"
570
+ ].includes(this.stage);
571
+ this.root.style.setProperty("--sb-bar-top", `${p ? f.cardTop : 0}px`);
572
+ let h = ["expanding", "ready"].includes(this.stage), g = {
573
+ left: p ? f.cardLeft : f.compactLeft,
574
+ bottom: p ? f.cardBottom : f.compactBottom,
575
+ width: p ? f.cardWidth : f.compactWidth,
576
+ height: h ? f.cardHeight : d,
577
+ "compact-height": d,
578
+ "card-width": f.cardWidth,
579
+ "compact-width": f.compactWidth,
580
+ "entrance-offset": f.entranceOffset,
581
+ "max-height": f.maxCardHeight
582
+ };
583
+ for (let [e, t] of Object.entries(g)) this.root.style.setProperty(`--sb-snackbar-${e}`, `${t}px`);
584
+ this.shell.style.transformOrigin = f.transformOrigin;
585
+ };
586
+ reducedMotion() {
587
+ return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
588
+ }
589
+ onPointerEnter = (e) => {
590
+ e.pointerType === "mouse" && window.matchMedia?.("(hover: hover)").matches && this.store.setBarTimerPaused(this.session.presentationId, !0);
591
+ };
592
+ onPointerLeave = () => this.store.setBarTimerPaused(this.session.presentationId, !1);
593
+ exit(e) {
594
+ for (let e of this.timers) clearTimeout(e);
595
+ this.timers.clear(), this.stage = "exiting", this.root.dataset.exiting = "true";
596
+ for (let e of this.answers.values()) e.disabled = !0;
597
+ this.updateStage(), this.after(this.reducedMotion() ? E.reduced : E.removal, () => {
598
+ this.destroy(), e();
599
+ });
600
+ }
601
+ after(e, t) {
602
+ let n = setTimeout(() => {
603
+ this.timers.delete(n), this.destroyed || t();
604
+ }, e);
605
+ this.timers.add(n);
606
+ }
607
+ destroy() {
608
+ this.destroyed = !0;
609
+ for (let e of this.timers) clearTimeout(e);
610
+ this.observer?.disconnect(), window.removeEventListener("resize", this.updatePlacement), window.visualViewport?.removeEventListener("resize", this.updatePlacement), window.visualViewport?.removeEventListener("scroll", this.updatePlacement), this.surface.removeEventListener("pointerenter", this.onPointerEnter), this.surface.removeEventListener("pointerleave", this.onPointerLeave), this.root.remove();
611
+ }
612
+ }, H = 1969.207, ie = 2169.207, ae = 856.839, oe = 450;
613
+ function U(e, t) {
614
+ let n = document.createElement(e);
615
+ return t && (n.className = t), n;
616
+ }
617
+ function W(e, t) {
618
+ let n = U("button", e);
619
+ return n.type = "button", t && n.setAttribute("aria-label", t), n;
620
+ }
621
+ var se = 0, ce = class {
622
+ host;
623
+ root;
624
+ store;
625
+ unsubscribe;
626
+ continueButton = null;
627
+ activeFabEl = null;
628
+ activeFabIdentity = null;
629
+ outgoingFabEls = /* @__PURE__ */ new Set();
630
+ fabExitTimers = /* @__PURE__ */ new Set();
631
+ fabEntranceTimer = null;
632
+ fabSettlingTimer = null;
633
+ sheetEl = null;
634
+ sheetRootEl = null;
635
+ sheetExitTimer = null;
636
+ progressTimer = null;
637
+ completionRevealTimer = null;
638
+ renderedProgress = null;
639
+ restoreFocus = null;
640
+ restoreFocusPending = !1;
641
+ safeAreaProbe;
642
+ uiId = ++se;
643
+ snackbarUi = null;
644
+ snackbarIdentity = null;
645
+ outgoingSnackbarUis = /* @__PURE__ */ new Set();
646
+ constructor(e, t = document.body) {
647
+ this.store = e, this.host = U("div"), this.host.setAttribute("data-sideband", ""), this.host.tabIndex = -1;
648
+ let n = this.host.attachShadow({ mode: "open" }), r = document.createElement("style");
649
+ r.textContent = B, n.appendChild(r), this.safeAreaProbe = U("div", "sb-safe-area-probe"), n.appendChild(this.safeAreaProbe), this.root = U("div"), n.appendChild(this.root), t.appendChild(this.host), this.applyTheme(), this.unsubscribe = e.subscribe((e) => {
650
+ if (e === "text") {
651
+ this.updateContinueButton();
652
+ return;
653
+ }
654
+ if (e === "select") {
655
+ let e = this.focusedChoiceValue(), t = this.store.currentQuestion(), n = t ? this.selectedChoice(t) : void 0, r = !!(n && p(n));
656
+ this.render(!1, r);
657
+ let i = this.root.querySelector(".sb-question--other-text .sb-textarea");
658
+ if (i) {
659
+ i.focus();
660
+ return;
661
+ }
662
+ if (e) {
663
+ for (let t of this.root.querySelectorAll("[data-choice-value]")) if (t.dataset.choiceValue === e) {
664
+ t.focus();
665
+ break;
666
+ }
667
+ }
668
+ return;
669
+ }
670
+ this.render(e === "transition");
671
+ }), window.addEventListener("keydown", this.onKeyDown), window.addEventListener("resize", this.onViewportChange), window.addEventListener("orientationchange", this.onViewportChange), window.visualViewport?.addEventListener("resize", this.onViewportChange), window.visualViewport?.addEventListener("scroll", this.onViewportChange), this.render();
672
+ }
673
+ destroy() {
674
+ this.unsubscribe(), this.snackbarUi?.destroy();
675
+ for (let e of this.outgoingSnackbarUis) e.destroy();
676
+ this.outgoingSnackbarUis.clear(), this.clearFabEntranceTimer();
677
+ for (let e of this.fabExitTimers) clearTimeout(e);
678
+ this.fabExitTimers.clear(), this.sheetExitTimer !== null && (clearTimeout(this.sheetExitTimer), this.sheetExitTimer = null), this.progressTimer !== null && clearTimeout(this.progressTimer), this.completionRevealTimer !== null && clearTimeout(this.completionRevealTimer), window.removeEventListener("keydown", this.onKeyDown), window.removeEventListener("resize", this.onViewportChange), window.removeEventListener("orientationchange", this.onViewportChange), window.visualViewport?.removeEventListener("resize", this.onViewportChange), window.visualViewport?.removeEventListener("scroll", this.onViewportChange), this.host.remove();
679
+ }
680
+ onKeyDown = (e) => {
681
+ if (e.key === "Escape" && (this.store.getState()?.isOpen || this.snackbarUi && this.host.shadowRoot?.activeElement)) {
682
+ this.store.closeSurvey();
683
+ return;
684
+ }
685
+ if (e.key !== "Tab" || !this.sheetEl || this.store.getState()?.snackbar?.phase === "awaitingReady") return;
686
+ let t = Array.from(this.sheetEl.querySelectorAll("button:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"));
687
+ if (!t.length) {
688
+ e.preventDefault(), this.sheetEl.querySelector("[tabindex=\"-1\"]")?.focus();
689
+ return;
690
+ }
691
+ let n = this.root.getRootNode(), r = n instanceof ShadowRoot ? n.activeElement : null, i = t.indexOf(r), a = e.shiftKey ? i <= 0 ? t.length - 1 : i - 1 : i === t.length - 1 ? 0 : i + 1;
692
+ e.preventDefault(), t[a]?.focus();
693
+ };
694
+ focusTextArea(e) {
695
+ queueMicrotask(() => {
696
+ e.isConnected && !e.disabled && e.focus();
697
+ });
698
+ }
699
+ selectedChoice(e) {
700
+ let t = this.store.currentDraft()?.answer_key;
701
+ return e.answers?.find((e) => l(e) === t);
702
+ }
703
+ selectedChoiceComment(e) {
704
+ return this.selectedChoice(e)?.comment?.trim() || null;
705
+ }
706
+ estimatedTextWidth(e) {
707
+ let t = 0;
708
+ for (let n of e) t += /[MW@#%&]/.test(n) ? 11 : /[ilI1.,' ]/.test(n) ? 4 : 7.5;
709
+ return Math.ceil(t);
710
+ }
711
+ onViewportChange = () => {
712
+ let e = this.store.getState(), t = this.root.querySelector(".sb-fab");
713
+ e?.fabState === "expanded" && !e.isOpen && t && this.updateFabPlacement(t, e);
714
+ };
715
+ render(e = !1, t = !0) {
716
+ let n = this.store.getState();
717
+ if (this.continueButton = null, n) {
718
+ for (let e of this.outgoingSnackbarUis) e.destroy();
719
+ this.outgoingSnackbarUis.clear(), this.restoreFocusPending = !1, this.applyTheme(n.survey.theme);
720
+ }
721
+ if (this.snackbarUi && this.snackbarIdentity !== n?.presentationId) {
722
+ let e = this.snackbarUi;
723
+ !n && e.root.dataset.presentation === "bar" ? (this.outgoingSnackbarUis.add(e), e.exit(() => {
724
+ this.outgoingSnackbarUis.delete(e), this.restoreFocusWhenAnimationsComplete();
725
+ })) : e.destroy(), this.snackbarUi = null, this.snackbarIdentity = null, this.sheetEl = null, this.sheetRootEl = null;
726
+ }
727
+ if (n?.snackbar) {
728
+ this.snackbarUi ? (this.snackbarUi.update(n), e && n.snackbar.phase === "journey" && this.focusSheet()) : (this.startActiveFabExit(), this.sheetExitTimer !== null && clearTimeout(this.sheetExitTimer), this.sheetRootEl?.remove(), this.sheetEl = null, this.sheetRootEl = null, this.restoreFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.snackbarIdentity = n.presentationId, this.snackbarUi = new re(this.store, n, this.root, this.safeAreaProbe, (e) => this.sheetEl && this.sheetRootEl ? (this.fillSheet(this.sheetEl, e), this.sheetRootEl) : this.renderSheet(e), () => this.focusSheet()));
729
+ return;
730
+ }
731
+ if (n && (n.isOpen || n.completion)) {
732
+ this.startActiveFabExit(), this.sheetRootEl?.classList.contains("sb-sheet-root--exiting") && (this.sheetExitTimer !== null && (clearTimeout(this.sheetExitTimer), this.sheetExitTimer = null), this.sheetRootEl.classList.remove("sb-sheet-root--exiting")), this.sheetEl && this.root.contains(this.sheetEl) ? this.fillSheet(this.sheetEl, n, t) : this.root.appendChild(this.renderSheet(n)), e && this.focusSheet(), this.store.confirmPresentation("sheet");
733
+ return;
734
+ }
735
+ if (this.startSheetExit(), !n) {
736
+ this.startActiveFabExit(), this.restoreFocusPending = !0, this.restoreFocusWhenAnimationsComplete();
737
+ return;
738
+ }
739
+ if (n.fabState !== "hidden") {
740
+ let e = typeof n.survey.impression_id == "string" ? `${n.survey.pulse_id}:${n.survey.version}:${n.survey.impression_id}` : `${n.survey.pulse_id}:${n.survey.version}`;
741
+ if (this.activeFabEl && this.activeFabIdentity === e) {
742
+ this.applyFabPresentation(this.activeFabEl, n);
743
+ return;
744
+ }
745
+ this.startActiveFabExit();
746
+ let t = this.renderFab(n);
747
+ this.activeFabEl = t, this.activeFabIdentity = e, this.root.appendChild(t), this.applyFabPresentation(t, n), this.startFabEntranceConfirmation(t, e);
748
+ }
749
+ }
750
+ updateContinueButton() {
751
+ if (!this.continueButton) return;
752
+ let e = this.store.getState();
753
+ this.continueButton.disabled = !!e?.isBusy || !this.store.canContinue();
754
+ }
755
+ renderFab(e) {
756
+ let { survey: t, fabState: n } = e, r = a(t), i = W(`sb-fab sb-fab--${n} sb-fab--entering`, r);
757
+ i.addEventListener("click", () => {
758
+ this.restoreFocus = i, this.store.openSurvey();
759
+ });
760
+ let o = U("span", "sb-fab__badge");
761
+ if (o.setAttribute("aria-hidden", "true"), t.fab?.imageUrl) {
762
+ let e = U("img", "sb-fab__badge-image");
763
+ e.src = t.fab.imageUrl, e.alt = "", e.addEventListener("error", () => e.remove(), { once: !0 }), o.appendChild(e);
764
+ }
765
+ let s = U("span", "sb-fab__badge-artwork");
766
+ if (s.appendChild(U("span", "sb-fab__badge-glyph-center")), s.appendChild(U("span", "sb-fab__badge-glyph-amber")), s.appendChild(U("span", "sb-fab__badge-glyph-mint")), s.appendChild(U("span", "sb-fab__badge-glyph-rose")), o.appendChild(s), i.appendChild(o), n === "expanded") {
767
+ let e = U("span", "sb-fab__label");
768
+ e.textContent = r, i.appendChild(e);
769
+ }
770
+ return i;
771
+ }
772
+ applyTheme(e) {
773
+ let t = e ? C(e) : ee;
774
+ for (let [e, n] of Object.entries(t)) this.host.style.setProperty(e, n);
775
+ }
776
+ applyFabPresentation(e, t) {
777
+ this.updateFabPlacement(e, t), this.applyFabTimer(e, t);
778
+ }
779
+ updateFabPlacement(e, t) {
780
+ let n = window.visualViewport, r = n && Number.isFinite(n.width) && n.width > 0 ? n.width : window.innerWidth, i = n && Number.isFinite(n.height) && n.height > 0 ? n.height : window.innerHeight, a = n && Number.isFinite(n.offsetLeft) ? n.offsetLeft : 0, o = n && Number.isFinite(n.offsetTop) ? n.offsetTop : 0, s = this.readSafeArea(), c = e.querySelector(".sb-fab__label"), l = c ? c.scrollWidth || c.getBoundingClientRect().width || this.estimatedTextWidth(c.textContent ?? "") : 0, u = Math.max(0, r - s.left - s.right), d = Math.min(u, Math.max(86, 86 + Math.ceil(l))), f = e.getBoundingClientRect(), p = e.offsetHeight || f.height || 60, m = N(t.survey.fab?.placement, {
781
+ viewport: {
782
+ width: r,
783
+ height: i
784
+ },
785
+ element: {
786
+ width: d,
787
+ height: p
788
+ },
789
+ safeArea: s
790
+ });
791
+ e.style.left = `${m.left + a}px`, e.style.top = `${m.top + o}px`, e.style.right = "auto", e.style.bottom = "auto", e.style.transformOrigin = m.transformOrigin, e.style.setProperty("--sb-fab-expanded-width", `${d}px`), e.style.setProperty("--sb-fab-label-width", `${Math.max(0, d - 86)}px`);
792
+ let h = Math.max(0, Math.min(1, t.survey.fab?.placement?.anchor.x ?? 1));
793
+ e.style.setProperty("--sb-fab-anchor-offset", `${(d - 60) * h}px`);
794
+ }
795
+ applyFabTimer(e, t) {
796
+ let n = P(t.survey.fab?.timerStyle, t.survey.fab?.expandedTimeout, "forward"), r = `${n.style}:${n.durationMs ?? "static"}`, i = e.querySelector(".sb-fab__timer");
797
+ e.dataset.timerStyle = n.style;
798
+ for (let [t, r] of Object.entries(n.cssVariables)) e.style.setProperty(t, r);
799
+ if (!n.visible) {
800
+ i?.remove(), delete e.dataset.timerSignature;
801
+ return;
802
+ }
803
+ let a = this.getTextDirection();
804
+ if (e.style.setProperty("--sb-fab-timer-origin", a === "rtl" ? "right" : "left"), e.dataset.timerDirection = a, i && e.dataset.timerSignature === r) return;
805
+ i?.remove();
806
+ let o = U("span", `sb-fab__timer sb-fab__timer--${n.style}`);
807
+ o.setAttribute("aria-hidden", "true"), o.appendChild(U("span", "sb-fab__timer-fill")), e.appendChild(o), e.dataset.timerSignature = r;
808
+ }
809
+ startFabEntranceConfirmation(e, t) {
810
+ this.clearFabEntranceTimer();
811
+ let n = this.prefersReducedMotion();
812
+ this.fabEntranceTimer = setTimeout(() => {
813
+ this.fabEntranceTimer = null, !(this.activeFabEl !== e || this.activeFabIdentity !== t) && (this.store.confirmPresentation("expanded_fab"), this.store.confirmFabEntranceCompleted());
814
+ }, n ? 0 : H);
815
+ let r = e.querySelector(".sb-fab__timer") ? ie : H;
816
+ this.fabSettlingTimer = setTimeout(() => {
817
+ this.fabSettlingTimer = null, this.activeFabEl === e && this.activeFabIdentity === t && e.classList.remove("sb-fab--entering");
818
+ }, n ? 0 : r);
819
+ }
820
+ clearFabEntranceTimer() {
821
+ this.fabEntranceTimer !== null && (clearTimeout(this.fabEntranceTimer), this.fabEntranceTimer = null), this.fabSettlingTimer !== null && (clearTimeout(this.fabSettlingTimer), this.fabSettlingTimer = null);
822
+ }
823
+ startActiveFabExit() {
824
+ let e = this.activeFabEl;
825
+ if (!e) return;
826
+ this.clearFabEntranceTimer();
827
+ let t = getComputedStyle(e), n = Number.parseFloat(t.width) || e.offsetWidth || 314, r = Number.parseFloat(e.style.getPropertyValue("--sb-fab-expanded-width")) || n, i = Number.parseFloat(e.style.getPropertyValue("--sb-fab-anchor-offset")) || 0, a = r === 60 ? 0 : i / (r - 60), o = e.querySelector(".sb-fab__label"), s = e.querySelector(".sb-fab__timer");
828
+ e.style.setProperty("--sb-fab-exit-width", `${n}px`), e.style.setProperty("--sb-fab-exit-offset", `${(r - n) * a}px`), e.style.setProperty("--sb-fab-exit-scale", t.getPropertyValue("scale") || "1"), e.style.setProperty("--sb-fab-exit-label-opacity", o ? getComputedStyle(o).opacity : "0"), e.style.setProperty("--sb-fab-exit-timer-opacity", s ? getComputedStyle(s).opacity : "0"), e.classList.remove("sb-fab--entering"), e.classList.add("sb-fab--exiting"), e.disabled = !0, e.setAttribute("aria-hidden", "true"), e.tabIndex = -1, this.activeFabEl = null, this.activeFabIdentity = null, this.outgoingFabEls.add(e);
829
+ let c = this.prefersReducedMotion() ? 0 : ae, l = setTimeout(() => {
830
+ this.fabExitTimers.delete(l), this.outgoingFabEls.delete(e), e.remove(), this.restoreFocusWhenAnimationsComplete();
831
+ }, c);
832
+ this.fabExitTimers.add(l);
833
+ }
834
+ startSheetExit() {
835
+ let e = this.sheetRootEl;
836
+ if (!e || e.classList.contains("sb-sheet-root--exiting")) return;
837
+ e.classList.add("sb-sheet-root--exiting"), e.setAttribute("aria-hidden", "true"), e.querySelectorAll("button").forEach((e) => {
838
+ e.disabled = !0;
839
+ }), this.sheetEl = null;
840
+ let t = this.prefersReducedMotion() ? 0 : oe;
841
+ this.sheetExitTimer = setTimeout(() => {
842
+ this.sheetExitTimer = null, this.sheetRootEl === e && (e.remove(), this.sheetRootEl = null, this.restoreFocusWhenAnimationsComplete());
843
+ }, t);
844
+ }
845
+ restoreFocusWhenAnimationsComplete() {
846
+ !this.restoreFocusPending || this.activeFabEl || this.outgoingFabEls.size > 0 || this.outgoingSnackbarUis.size > 0 || this.sheetRootEl || (this.restoreFocus?.isConnected ? this.restoreFocus.focus() : this.restoreFocus && this.host.focus(), this.restoreFocus = null, this.restoreFocusPending = !1, this.applyTheme());
847
+ }
848
+ prefersReducedMotion() {
849
+ return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
850
+ }
851
+ focusSheet() {
852
+ (this.sheetEl?.querySelector(".sb-textarea[autofocus]") ?? this.sheetEl?.querySelector(".sb-sheet__body h2, .sb-thanks__copy h2") ?? this.sheetEl?.querySelector(".sb-sheet__close, .sb-thanks__actions .sb-button"))?.focus();
853
+ }
854
+ getTextDirection() {
855
+ return (this.host.getAttribute("dir") || getComputedStyle(this.host).direction) === "rtl" || document.documentElement.dir === "rtl" ? "rtl" : "ltr";
856
+ }
857
+ focusedChoiceValue() {
858
+ let e = this.root.getRootNode(), t = e instanceof ShadowRoot ? e.activeElement : null;
859
+ return t instanceof HTMLElement ? t.dataset.choiceValue : void 0;
860
+ }
861
+ readSafeArea() {
862
+ let e = getComputedStyle(this.safeAreaProbe), t = (e) => {
863
+ let t = Number.parseFloat(e);
864
+ return Number.isFinite(t) ? Math.max(0, t) : 0;
865
+ };
866
+ return {
867
+ top: t(e.paddingTop),
868
+ right: t(e.paddingRight),
869
+ bottom: t(e.paddingBottom),
870
+ left: t(e.paddingLeft)
871
+ };
872
+ }
873
+ renderSheet(e) {
874
+ let t = U("div", "sb-sheet-root"), n = W("sb-sheet-root__overlay", "Dismiss survey");
875
+ n.tabIndex = -1, n.addEventListener("click", () => void this.store.closeSurvey()), t.appendChild(n);
876
+ let r = U("div", "sb-sheet");
877
+ return r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), t.appendChild(r), this.sheetEl = r, this.sheetRootEl = t, this.fillSheet(r, e), t;
878
+ }
879
+ fillSheet(e, t, n = !0) {
880
+ if (this.completionRevealTimer !== null && (clearTimeout(this.completionRevealTimer), this.completionRevealTimer = null), e.classList.toggle("sb-sheet--thanks", !!t.completion), e.classList.toggle("sb-sheet--sentiment", !t.completion && this.store.isSentimentStep()), e.classList.toggle("sb-sheet--completing", t.isCompleting), e.toggleAttribute("aria-busy", t.isCompleting), e.replaceChildren(), t.completion) {
881
+ e.setAttribute("aria-labelledby", `sb-completion-${this.uiId}`), e.setAttribute("aria-describedby", `sb-completion-body-${this.uiId}`);
882
+ let n = this.renderThankYou(t);
883
+ e.appendChild(n), this.completionRevealTimer = setTimeout(() => {
884
+ this.completionRevealTimer = null, n.isConnected && (n.querySelectorAll("[data-reveal-content]").forEach((e) => {
885
+ e.removeAttribute("aria-hidden");
886
+ }), n.querySelectorAll(".sb-button").forEach((e) => {
887
+ e.disabled = !!this.store.getState()?.isBusy;
888
+ }), n.querySelector("h2")?.focus());
889
+ }, this.prefersReducedMotion() ? 0 : 890);
890
+ return;
891
+ }
892
+ let r = this.store.currentQuestion();
893
+ r && (e.setAttribute("aria-labelledby", `sb-question-${this.uiId}`), e.removeAttribute("aria-describedby"), this.renderQuestionSheet(e, t, r, n));
894
+ }
895
+ renderQuestionSheet(e, t, n, r) {
896
+ let i = this.store.isSentimentStep(), a = U("div", "sb-sheet__header");
897
+ if (i) this.renderedProgress = null;
898
+ else {
899
+ let e = U("div", "sb-progress");
900
+ e.setAttribute("aria-hidden", "true");
901
+ let n = U("span", "sb-progress__fill"), r = Math.max(0, Math.min(1, t.isCompleting ? 1 : this.store.progress())), i = this.renderedProgress ?? 0;
902
+ n.style.width = `${i * 100}%`, this.renderedProgress = r, this.progressTimer !== null && clearTimeout(this.progressTimer), this.progressTimer = setTimeout(() => {
903
+ this.progressTimer = null, n.isConnected && (n.style.width = `${r * 100}%`);
904
+ }, i === 0 ? 100 : 0), e.appendChild(n), a.appendChild(e);
905
+ }
906
+ let o = W("sb-sheet__close", "Close survey");
907
+ o.innerHTML = F, o.addEventListener("click", () => void this.store.closeSurvey()), a.appendChild(o), e.appendChild(a);
908
+ let s = U("div", `sb-sheet__body ${r ? "sb-step" : ""} ${i ? "sb-sheet__body--sentiment" : "sb-sheet__body--question"}`), c = U("div", "sb-sheet__copy"), l = i ? this.selectedChoiceComment(n) : null;
909
+ if (i && !l) {
910
+ let e = U("p", "sb-sheet__eyebrow");
911
+ e.textContent = t.survey.title, c.appendChild(e);
912
+ }
913
+ let u = U("h2");
914
+ if (u.id = `sb-question-${this.uiId}`, u.tabIndex = -1, u.textContent = l ?? n.prompt, l && (u.className = "sb-sheet__acknowledgement", u.setAttribute("aria-live", "polite")), c.appendChild(u), s.appendChild(c), s.appendChild(this.renderQuestionView(n, i)), e.appendChild(s), this.store.shouldShowContinue()) {
915
+ let r = U("div", "sb-sheet__footer"), i = this.selectedChoiceComment(n);
916
+ if (i) {
917
+ let e = U("p", "sb-sheet__footer-comment");
918
+ e.textContent = i, e.setAttribute("aria-live", "polite"), r.appendChild(e);
919
+ }
920
+ let a = W("sb-next", "Continue");
921
+ this.selectedChoice(n) && a.classList.add("sb-next--acknowledging"), a.innerHTML = I, a.disabled = t.isBusy || t.isCompleting || !this.store.canContinue(), a.addEventListener("click", () => void this.store.advance()), r.appendChild(a), e.appendChild(r), this.continueButton = a;
922
+ }
923
+ }
924
+ renderQuestionView(e, t) {
925
+ let n = this.store.currentDraft(), r = this.store.getState(), i = !!(r?.isBusy || r?.isCompleting);
926
+ if (t) {
927
+ let e = U("div", "sb-question sb-question--sentiment");
928
+ return this.store.sentimentChoices().forEach((t) => {
929
+ let a = n?.answer_key === l(t), o = W(`sb-sentiment ${a ? "sb-sentiment--selected" : ""}`, t.label);
930
+ o.dataset.choiceValue = l(t), o.disabled = i || !!r?.sentimentSelectionLocked, o.setAttribute("aria-pressed", String(a));
931
+ let s = f(t);
932
+ if (a && s) {
933
+ let e = U("span", "sb-spark-ring");
934
+ e.setAttribute("aria-hidden", "true");
935
+ for (let t = 0; t < 12; t += 1) {
936
+ let n = U("span", "sb-spark-ring__spark");
937
+ n.style.setProperty("--sb-spark-index", String(t)), e.appendChild(n);
938
+ }
939
+ o.appendChild(e);
940
+ }
941
+ let c = U("span", "sb-sentiment__icon");
942
+ c.innerHTML = s ? R : z, o.appendChild(c), o.addEventListener("click", () => void this.store.selectChoice(t)), e.appendChild(o);
943
+ }), e;
944
+ }
945
+ if (e.type === "yes_no" || e.type === "multiple_choice") {
946
+ let t = this.selectedChoice(e);
947
+ if (t && p(t)) return this.renderTextInput(t.label, "Other response", !0, i, !0);
948
+ let r = this.usesTwoColumnChoices(e.answers ?? []), a = r ? Math.ceil((e.answers?.length ?? 0) / 2) : e.answers?.length ?? 0, o = U("div", `sb-question sb-question--choices sb-question--choices-${r ? "grid" : "single"} ${a >= 5 ? "sb-question--choices-scrolling" : ""}`);
949
+ for (let t of e.answers ?? []) {
950
+ let e = n?.answer_key === l(t), r = W(`sb-choice ${e ? "sb-choice--selected" : ""} ${p(t) ? "sb-choice--other" : ""}`, t.label);
951
+ if (r.dataset.choiceValue = l(t), r.disabled = i, r.setAttribute("aria-pressed", String(e)), p(t)) {
952
+ let e = U("span", "sb-choice__other-content");
953
+ e.setAttribute("aria-hidden", "true"), e.appendChild(U("span", "sb-choice__other-caret"));
954
+ let n = U("span", "sb-choice__label sb-choice__other-label");
955
+ n.textContent = t.label, e.appendChild(n), r.appendChild(e);
956
+ } else {
957
+ let e = U("span", "sb-choice__label");
958
+ e.textContent = t.label, r.appendChild(e);
959
+ }
960
+ r.addEventListener("click", () => void this.store.selectChoice(t)), o.appendChild(r);
961
+ }
962
+ return o;
963
+ }
964
+ return this.renderTextInput(e.free_text_placeholder ?? "Please explain more... (Optional)", e.prompt, e.required, i);
965
+ }
966
+ renderTextInput(e, t, n, r, i = !1) {
967
+ let a = U("div", `sb-question sb-question--text ${i ? "sb-question--other sb-question--other-text" : ""}`), o = U("div", "sb-textarea-shell"), s = U("textarea", "sb-textarea");
968
+ return s.value = this.store.currentText(), s.disabled = r, s.placeholder = e, s.setAttribute("aria-label", t), n && (s.autofocus = !0, this.focusTextArea(s)), s.addEventListener("input", () => this.store.setText(s.value)), o.appendChild(s), a.appendChild(o), a;
969
+ }
970
+ usesTwoColumnChoices(e) {
971
+ return e.every((e) => {
972
+ let t = U("span", `sb-choice-measure ${p(e) ? "sb-choice-measure--other" : ""}`);
973
+ t.textContent = e.label.trim(), this.root.appendChild(t);
974
+ let n = t.getBoundingClientRect().width || t.scrollWidth;
975
+ t.remove();
976
+ let r = this.estimatedTextWidth(e.label.trim()) + (p(e) ? 17 : 16);
977
+ return (n || r) < 160;
978
+ });
979
+ }
980
+ renderThankYou(e) {
981
+ let t = e.completion, n = U("div", "sb-thanks"), r = U("div", "sb-thanks__icon-shell");
982
+ r.setAttribute("aria-hidden", "true");
983
+ let i = U("div", "sb-thanks__icon-core");
984
+ i.innerHTML = L, r.appendChild(i), n.appendChild(r);
985
+ let a = U("div", "sb-thanks__copy");
986
+ a.dataset.revealContent = "", a.setAttribute("aria-hidden", "true");
987
+ let o = U("h2");
988
+ o.id = `sb-completion-${this.uiId}`, o.tabIndex = -1, o.textContent = t?.title ?? "";
989
+ let s = U("p");
990
+ if (s.id = `sb-completion-body-${this.uiId}`, s.textContent = t?.body ?? "", a.appendChild(o), a.appendChild(s), n.appendChild(a), t?.actions.length) {
991
+ let e = U("div", "sb-thanks__actions");
992
+ e.dataset.revealContent = "", e.setAttribute("aria-hidden", "true");
993
+ for (let n of t.actions) {
994
+ let t = W(`sb-button sb-button--${n.style === "primary" || n.style === "secondary" ? n.style : "tertiary"}`);
995
+ t.textContent = n.label, t.disabled = !0, t.addEventListener("click", () => void this.store.handleCompletionAction(n)), e.appendChild(t);
996
+ }
997
+ n.appendChild(e);
998
+ }
999
+ return n;
1000
+ }
1001
+ };
1002
+ //#endregion
1003
+ //#region src/index.ts
1004
+ function le(e) {
1005
+ if (typeof document > "u" && e.ui !== !1) return {
1006
+ track: () => {},
1007
+ tagUser: () => {},
1008
+ untagUser: () => {},
1009
+ sync: async () => {
1010
+ throw Error("Sideband UI runtime is unavailable during SSR.");
1011
+ },
1012
+ flush: async () => {},
1013
+ openSurvey: () => {},
1014
+ presentSimulatedPulse: () => !1,
1015
+ closeSurvey: async () => {},
1016
+ getDeviceId: () => "",
1017
+ destroy: () => {}
1018
+ };
1019
+ let t = new n({
1020
+ syncInteraction: async (e) => {
1021
+ r.submitInteraction(e);
1022
+ },
1023
+ trackEvent: (e, t) => r.track(e, t),
1024
+ shouldPresentPulse: e.shouldPresentPulse,
1025
+ onRateApp: e.onRateApp,
1026
+ onError: e.onError
1027
+ }), r = s({
1028
+ ...e,
1029
+ libraryVersion: "1.4.3",
1030
+ onSyncResponse: (e) => t.handleSyncResponse(e)
1031
+ }), i = e.ui === !1 ? null : new ce(t);
1032
+ return r.start(), {
1033
+ track: r.track,
1034
+ tagUser: r.tagUser,
1035
+ untagUser: r.untagUser,
1036
+ sync: r.sync,
1037
+ flush: r.flush,
1038
+ openSurvey: () => t.openSurvey(),
1039
+ presentSimulatedPulse: (e) => t.presentSimulatedPulse(e),
1040
+ closeSurvey: () => t.closeSurvey(),
1041
+ getDeviceId: r.getDeviceId,
1042
+ destroy: () => {
1043
+ r.destroy(), i?.destroy(), t.destroy();
1044
+ }
1045
+ };
1046
+ }
1047
+ var G = null;
1048
+ function K() {
1049
+ if (!G) throw Error("Call Sideband.configure() before using Sideband.");
1050
+ return G;
1051
+ }
1052
+ function q(e) {
1053
+ $();
1054
+ let t = le(e);
1055
+ return G = t, t;
1056
+ }
1057
+ function J(e, t, n) {
1058
+ K().track(e, t, n);
1059
+ }
1060
+ function Y(e) {
1061
+ K().tagUser(e);
1062
+ }
1063
+ function X() {
1064
+ K().untagUser();
1065
+ }
1066
+ function Z() {
1067
+ return K().flush();
1068
+ }
1069
+ function Q(e) {
1070
+ return K().presentSimulatedPulse(e);
1071
+ }
1072
+ function $() {
1073
+ G?.destroy(), G = null;
1074
+ }
1075
+ var ue = {
1076
+ configure: q,
1077
+ track: J,
1078
+ tagUser: Y,
1079
+ untagUser: X,
1080
+ flush: Z,
1081
+ presentSimulatedPulse: Q,
1082
+ destroy: $
1083
+ };
1084
+ //#endregion
1085
+ export { ue as Sideband, e as SidebandApiError, t as SurveySessionStore, r as SyncEngine, i as buildFabTitle, q as configure, o as createSidebandClient, $ as destroy, Z as flush, c as getChoiceValue, u as getDeviceId, d as getSessionId, Q as presentSimulatedPulse, Y as tagUser, J as track, X as untagUser };