@spectosh/browser 0.2.4 → 0.3.0

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.
@@ -0,0 +1,1418 @@
1
+ import { _ as e } from "./src-oKUp2jmR.js";
2
+ //#region src/point/describe.js
3
+ var t = [
4
+ "data-testid",
5
+ "data-test",
6
+ "data-test-id",
7
+ "data-cy",
8
+ "data-qa"
9
+ ], n = [
10
+ "display",
11
+ "visibility",
12
+ "opacity",
13
+ "pointerEvents",
14
+ "zIndex",
15
+ "overflow",
16
+ "cursor",
17
+ "color",
18
+ "background"
19
+ ], r = /* @__PURE__ */ new Set([
20
+ "id",
21
+ "class",
22
+ "role",
23
+ "type",
24
+ "name",
25
+ "href",
26
+ "disabled",
27
+ "aria-disabled",
28
+ "aria-expanded",
29
+ "aria-busy",
30
+ "aria-hidden",
31
+ "aria-pressed",
32
+ "aria-selected",
33
+ "aria-checked",
34
+ "for",
35
+ "data-specto-src",
36
+ ...t
37
+ ]), i = /* @__PURE__ */ new Set([
38
+ "area",
39
+ "base",
40
+ "br",
41
+ "col",
42
+ "embed",
43
+ "hr",
44
+ "img",
45
+ "input",
46
+ "link",
47
+ "meta",
48
+ "source",
49
+ "track",
50
+ "wbr"
51
+ ]), a = (e) => String(e).replace(/\\/g, "\\\\").replace(/"/g, "\\\""), o = (e) => String(e?.tagName || "").toLowerCase(), s = (e, t) => {
52
+ try {
53
+ return e.getAttribute(t);
54
+ } catch {
55
+ return null;
56
+ }
57
+ }, c = (e) => !!e && e.length <= 64 && !/\d{4,}|^:|:r\w*:|^(ember|react|radix|headlessui|mui|rc|el)[-_:]?\d/i.test(e) && /^[A-Za-z][\w-]*$/.test(e), l = (e) => e && !e.startsWith("specto-") && e.length <= 40 && !/\d{3,}|^(css|sc|jsx|emotion|tw)-|__[A-Za-z0-9]{5,}$|^[a-z0-9]{6,}$/i.test(e);
58
+ function u(e, t) {
59
+ if (t) return !0;
60
+ for (let t = e; t && t.nodeType === 1; t = t.parentElement) if (t.classList?.contains("specto-mask") || t.classList?.contains("specto-block")) return !0;
61
+ let n = o(e);
62
+ return n === "input" || n === "textarea" || n === "select" || s(e, "contenteditable") === "true";
63
+ }
64
+ function d(e) {
65
+ for (let n of t) {
66
+ let t = s(e, n);
67
+ if (t) return [n, t];
68
+ }
69
+ return null;
70
+ }
71
+ function f(e) {
72
+ let t = o(e), n = e.id;
73
+ if (c(n)) return {
74
+ sel: `${t}#${n}`,
75
+ anchor: !0
76
+ };
77
+ let r = d(e);
78
+ if (r) return {
79
+ sel: `${t}[${r[0]}="${a(r[1])}"]`,
80
+ anchor: !0
81
+ };
82
+ let i = typeof e.className == "string" ? e.className.trim().split(/\s+/).filter(l).slice(0, 2) : [], s = i.length ? `${t}.${i.join(".")}` : t, u = e.parentElement;
83
+ if (u) {
84
+ let n = Array.from(u.children || []).filter((e) => o(e) === t);
85
+ n.length > 1 && (s += `:nth-of-type(${n.indexOf(e) + 1})`);
86
+ }
87
+ return {
88
+ sel: s,
89
+ anchor: !1
90
+ };
91
+ }
92
+ function p(e, t = 5) {
93
+ let n = [];
94
+ for (let r = e, i = 0; r && r.nodeType === 1 && i < t && o(r) !== "html" && o(r) !== "body"; r = r.parentElement, i++) {
95
+ let e = f(r);
96
+ if (n.unshift(e.sel), e.anchor) break;
97
+ }
98
+ return n.join(" > ") || o(e) || "body";
99
+ }
100
+ function m(t, n) {
101
+ let r = s(t, "aria-label") || s(t, "title") || s(t, "alt");
102
+ if (r && !n) return e(r).trim().slice(0, 80);
103
+ let i = s(t, "aria-labelledby");
104
+ if (i && !n) try {
105
+ let t = document.getElementById(i)?.textContent;
106
+ if (t) return e(t).trim().slice(0, 80);
107
+ } catch {}
108
+ if (n) return "";
109
+ let a = (t.innerText ?? t.textContent ?? "").replace(/\s+/g, " ").trim();
110
+ return e(a).slice(0, 80);
111
+ }
112
+ function h(e) {
113
+ let t = s(e, "role");
114
+ if (t) return t;
115
+ let n = o(e);
116
+ return n === "a" && s(e, "href") != null ? "link" : n === "button" || n === "input" && [
117
+ "submit",
118
+ "button",
119
+ "reset"
120
+ ].includes(s(e, "type")) ? "button" : n === "input" ? s(e, "type") === "checkbox" ? "checkbox" : s(e, "type") === "radio" ? "radio" : "textbox" : n === "select" ? "combobox" : n === "textarea" ? "textbox" : /^h[1-6]$/.test(n) ? "heading" : n === "img" ? "img" : null;
121
+ }
122
+ function g(e, { masked: t } = {}) {
123
+ let n = [], r = d(e);
124
+ r && n.push(`[${r[0]}="${a(r[1])}"]`), c(e.id) && n.push(`#${e.id}`);
125
+ let i = h(e), o = m(e, t);
126
+ return i && o && o.length <= 40 && n.push(`role=${i}[name="${a(o)}"]`), n.push(p(e)), [...new Set(n)].slice(0, 6);
127
+ }
128
+ function _(e) {
129
+ let t = null;
130
+ for (let n = e; n && n.nodeType === 1 && !t; n = n.parentElement) t = s(n, "data-specto-src");
131
+ let n = e && Object.keys(e).find((e) => e.startsWith("__reactFiber$") || e.startsWith("__reactInternalInstance$"));
132
+ if (n) for (let r = e[n], i = 0; r && i < 60; r = r.return, i++) {
133
+ let e = r.type;
134
+ if (!e || typeof e == "string") continue;
135
+ let n = e.displayName || e.name || e.render?.displayName || e.render?.name || e.type?.displayName || e.type?.name;
136
+ if (n && /^[A-Z]/.test(n) && !/^(Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|Context)/.test(n)) {
137
+ let e = r._debugSource;
138
+ return !t && e?.fileName && (t = `${String(e.fileName).replace(/^.*?\/(src|app|pages|components)\//, "$1/")}:${e.lineNumber}`), {
139
+ component: n.slice(0, 120),
140
+ source: t
141
+ };
142
+ }
143
+ }
144
+ for (let n = e, r = 0; n && r < 20; n = n.parentElement, r++) {
145
+ let e = n.__vueParentComponent;
146
+ if (e) {
147
+ let n = e.type?.name || e.type?.__name || e.type?.__file && String(e.type.__file).split("/").pop().replace(/\.vue$/, "");
148
+ if (n) return {
149
+ component: n,
150
+ source: t || (e.type?.__file ? String(e.type.__file).replace(/^.*?\/src\//, "src/") : null)
151
+ };
152
+ }
153
+ let r = n.__svelte_meta;
154
+ if (r?.loc?.file) return {
155
+ component: String(r.loc.file).split("/").pop().replace(/\.svelte$/, ""),
156
+ source: t || `${r.loc.file}:${r.loc.line}`
157
+ };
158
+ }
159
+ return {
160
+ component: null,
161
+ source: t
162
+ };
163
+ }
164
+ function v(t) {
165
+ let n = [];
166
+ for (let r = t.parentElement, i = 0; r && r.nodeType === 1 && i < 25 && n.length < 6; r = r.parentElement, i++) {
167
+ let t = o(r);
168
+ if (t === "body" || t === "html") break;
169
+ let i = s(r, "role"), a = s(r, "aria-label");
170
+ ([
171
+ "main",
172
+ "nav",
173
+ "header",
174
+ "footer",
175
+ "aside",
176
+ "form",
177
+ "dialog",
178
+ "section",
179
+ "table"
180
+ ].includes(t) || [
181
+ "dialog",
182
+ "navigation",
183
+ "form",
184
+ "region",
185
+ "tabpanel",
186
+ "menu"
187
+ ].includes(i) || c(r.id) || d(r)) && n.unshift(`${t}${c(r.id) ? `#${r.id}` : ""}${a ? `[${e(a).slice(0, 30)}]` : ""}`);
188
+ }
189
+ return n;
190
+ }
191
+ function y(e) {
192
+ let t = {}, n = o(e);
193
+ e.disabled === !0 || s(e, "aria-disabled") === "true" ? t.disabled = !0 : [
194
+ "button",
195
+ "input",
196
+ "select",
197
+ "textarea"
198
+ ].includes(n) && (t.disabled = !1), n === "input" && ["checkbox", "radio"].includes(s(e, "type")) && (t.checked = !!e.checked);
199
+ let r = s(e, "aria-expanded");
200
+ return r != null && (t.expanded = r === "true"), s(e, "aria-busy") === "true" && (t.busy = !0), Object.keys(t).length ? t : void 0;
201
+ }
202
+ function b(e) {
203
+ try {
204
+ let t = getComputedStyle(e), r = {};
205
+ for (let e of n) {
206
+ let n = e === "background" ? t.backgroundColor : t[e];
207
+ n != null && n !== "" && (r[e] = String(n).slice(0, 80));
208
+ }
209
+ return r;
210
+ } catch {
211
+ return {};
212
+ }
213
+ }
214
+ function x(t, { strict: n = !1, maxNodes: a = 60, maxDepth: s = 4, maxChars: c = 4e3 } = {}) {
215
+ let l = 0, d = (t, f, p) => {
216
+ if (l++ > a) return "…";
217
+ if (t.nodeType === 3) {
218
+ let n = String(t.textContent || "").replace(/\s+/g, " ");
219
+ return n.trim() ? p ? n.replace(/\S/g, "•").slice(0, 60) : e(n).slice(0, 120).replace(/</g, "&lt;") : n ? " " : "";
220
+ }
221
+ if (t.nodeType !== 1) return "";
222
+ let m = o(t);
223
+ if ([
224
+ "script",
225
+ "style",
226
+ "noscript",
227
+ "template",
228
+ "svg"
229
+ ].includes(m)) return m === "svg" ? "<svg/>" : "";
230
+ let h = p || u(t, n), g = [];
231
+ for (let n of Array.from(t.attributes || [])) {
232
+ if (!r.has(n.name)) continue;
233
+ let t = n.value;
234
+ if (n.name === "href") try {
235
+ t = new URL(t, location.href).pathname;
236
+ } catch {
237
+ t = "";
238
+ }
239
+ n.name === "class" && (t = t.split(/\s+/).filter((e) => e && !e.startsWith("specto-")).slice(0, 4).join(" ")), g.push(t === "" ? n.name : `${n.name}="${e(t).slice(0, 80).replace(/"/g, "&quot;")}"`);
240
+ }
241
+ m === "input" && g.push("value=\"[masked]\"");
242
+ let _ = `<${m}${g.length ? " " + g.join(" ") : ""}>`;
243
+ if (i.has(m)) return _;
244
+ if (f >= s) return `${_}…</${m}>`;
245
+ let v = "";
246
+ for (let e of Array.from(t.childNodes || [])) if (v += d(e, f + 1, h), v.length > c) break;
247
+ return `${_}${v}</${m}>`;
248
+ };
249
+ return d(t, 0, u(t, n)).slice(0, c);
250
+ }
251
+ function S(e, t) {
252
+ let n = d(e);
253
+ return [
254
+ t.component,
255
+ n ? n[1] : null,
256
+ t.name || o(e)
257
+ ].filter(Boolean).slice(0, 2).join(" › ") || o(e);
258
+ }
259
+ function ee(t, { strict: n = !1 } = {}) {
260
+ let r = u(t, n), { component: i, source: a } = _(t), c = m(t, r), l = h(t), d = null;
261
+ try {
262
+ let e = t.getBoundingClientRect();
263
+ d = {
264
+ x: Math.round(e.left),
265
+ y: Math.round(e.top),
266
+ w: Math.round(e.width),
267
+ h: Math.round(e.height)
268
+ };
269
+ } catch {}
270
+ return {
271
+ tag: o(t),
272
+ role: l,
273
+ label: r ? null : s(t, "aria-label") ? e(s(t, "aria-label")).slice(0, 120) : null,
274
+ name: c ? `${c}${l ? ` ${l}` : ""}` : l || o(t),
275
+ component: i,
276
+ source: a,
277
+ selectors: g(t, { masked: r }),
278
+ path: v(t),
279
+ rect: d,
280
+ text: r ? null : c || null,
281
+ state: y(t),
282
+ styles: b(t),
283
+ snapshot: x(t, { strict: n })
284
+ };
285
+ }
286
+ //#endregion
287
+ //#region src/point/context.js
288
+ var C = 1e3, w = 6e3, T = 1e4;
289
+ function E(e, t, n = Date.now()) {
290
+ for (let r = e.length - 1; r >= 0; r--) {
291
+ let i = e[r];
292
+ if (n - i.at > 6e4) break;
293
+ try {
294
+ if (i.el && t(i.el)) return i.at;
295
+ } catch {}
296
+ }
297
+ return null;
298
+ }
299
+ function te({ recent: e, contains: t, now: n = Date.now() }) {
300
+ let r = E(e.clicks || [], t, n), [i, a] = r ? [r - C, r + w] : [n - T, n], o = (e.network || []).filter((e) => e.at >= i && e.at <= a).slice(-20).map((e) => ({
301
+ at: e.at,
302
+ method: e.method,
303
+ url: e.url,
304
+ status: e.status,
305
+ dur: e.dur,
306
+ ...e.error ? { error: !0 } : {}
307
+ })), s = (e.console || []).filter((e) => e.level === "error" || e.level === "warn").slice(-15).map((e) => ({
308
+ at: e.at,
309
+ level: e.level,
310
+ text: e.text
311
+ })), c = (e.event || []).filter((e) => e.type === "error").slice(-5).map((e) => ({
312
+ at: e.at,
313
+ level: "error",
314
+ text: e.message,
315
+ stack: e.stack
316
+ })), l = (e.event || []).filter((e) => [
317
+ "click",
318
+ "nav",
319
+ "rage",
320
+ "dead",
321
+ "custom"
322
+ ].includes(e.type) && e.at <= n && n - e.at < 12e4).slice(-15).map((e) => ({
323
+ at: e.at,
324
+ type: e.type,
325
+ target: e.sel || e.target || null,
326
+ path: e.path || null,
327
+ name: e.name || null
328
+ }));
329
+ return {
330
+ network: o,
331
+ console: [...s, ...c].sort((e, t) => e.at - t.at).slice(-20),
332
+ events: l,
333
+ clickedAt: r
334
+ };
335
+ }
336
+ function ne() {
337
+ let e = navigator.userAgent || "", t = window.innerWidth, n = (navigator.maxTouchPoints || 0) > 0, r = (e) => {
338
+ try {
339
+ return window.matchMedia(e).matches;
340
+ } catch {
341
+ return !1;
342
+ }
343
+ };
344
+ return {
345
+ browser: e.slice(0, 200),
346
+ os: /Windows/.test(e) ? "Windows" : /Mac OS X|Macintosh/.test(e) ? n ? "iPadOS" : "macOS" : /Android/.test(e) ? "Android" : /iPhone|iPad|iOS/.test(e) ? "iOS" : /Linux/.test(e) ? "Linux" : null,
347
+ device: t < 640 ? "phone" : t < 1024 && n ? "tablet" : "desktop",
348
+ locale: navigator.language || null,
349
+ tz: (() => {
350
+ try {
351
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
352
+ } catch {
353
+ return null;
354
+ }
355
+ })(),
356
+ reducedMotion: r("(prefers-reduced-motion: reduce)"),
357
+ colorScheme: r("(prefers-color-scheme: dark)") ? "dark" : "light",
358
+ viewport: {
359
+ w: t,
360
+ h: window.innerHeight
361
+ }
362
+ };
363
+ }
364
+ //#endregion
365
+ //#region src/point/voice.js
366
+ var D = [
367
+ "audio/webm;codecs=opus",
368
+ "audio/ogg;codecs=opus",
369
+ "audio/mp4",
370
+ "audio/webm"
371
+ ], O = .08, k = 700, re = 2e4, ie = () => typeof window < "u" && window.MediaRecorder !== void 0 && !!navigator.mediaDevices?.getUserMedia;
372
+ async function ae({ onPhrase: e = () => {}, keep: t = !1 } = {}) {
373
+ let n = await navigator.mediaDevices.getUserMedia({ audio: {
374
+ channelCount: 1,
375
+ echoCancellation: !0,
376
+ noiseSuppression: !0
377
+ } }), r = D.find((e) => {
378
+ try {
379
+ return MediaRecorder.isTypeSupported(e);
380
+ } catch {
381
+ return !1;
382
+ }
383
+ }) || "", i = {
384
+ ...r ? { mimeType: r } : {},
385
+ audioBitsPerSecond: 16e3
386
+ }, a = Date.now(), o = null, s = null, c = null;
387
+ try {
388
+ s = new (window.AudioContext || window.webkitAudioContext)();
389
+ let e = s.createMediaStreamSource(n);
390
+ o = s.createAnalyser(), o.fftSize = 1024, c = new Uint8Array(o.fftSize), e.connect(o);
391
+ } catch {}
392
+ let l = () => {
393
+ if (!o) return 0;
394
+ o.getByteTimeDomainData(c);
395
+ let e = 0;
396
+ for (let t of c) e += (t - 128) * (t - 128);
397
+ return Math.min(1, Math.sqrt(e / c.length) / 40);
398
+ }, u = null, d = !1, f = () => {
399
+ if (d) return;
400
+ let e = new MediaRecorder(n, i), t = {
401
+ rec: e,
402
+ chunks: [],
403
+ at: Date.now(),
404
+ spoke: !o,
405
+ loudAt: 0
406
+ };
407
+ e.ondataavailable = (e) => {
408
+ e.data?.size && t.chunks.push(e.data);
409
+ }, e.start(), u = t;
410
+ }, p = () => new Promise((t) => {
411
+ let n = u;
412
+ if (u = null, !n) return t();
413
+ n.rec.onstop = () => {
414
+ if (n.spoke && n.chunks.length) {
415
+ let t = n.rec.mimeType || r || "audio/webm";
416
+ try {
417
+ e({
418
+ blob: new Blob(n.chunks, { type: t }),
419
+ mime: t,
420
+ startedAt: n.at,
421
+ endedAt: Date.now()
422
+ });
423
+ } catch {}
424
+ }
425
+ t();
426
+ };
427
+ try {
428
+ n.rec.stop();
429
+ } catch {
430
+ t();
431
+ }
432
+ }), m = () => {
433
+ u && (p(), f());
434
+ };
435
+ f();
436
+ let h = setInterval(() => {
437
+ if (!u) return;
438
+ let e = Date.now();
439
+ o && l() >= O && (u.spoke = !0, u.loudAt = e), u.spoke && (u.loudAt && e - u.loudAt > k || e - u.at > re) && m();
440
+ }, 50), g = null;
441
+ t && (g = {
442
+ rec: new MediaRecorder(n, i),
443
+ chunks: []
444
+ }, g.rec.ondataavailable = (e) => {
445
+ e.data?.size && g.chunks.push(e.data);
446
+ }, g.rec.start(1e3));
447
+ let _ = null;
448
+ return {
449
+ startedAt: a,
450
+ level: l,
451
+ cut: m,
452
+ stop: () => _ || (d = !0, clearInterval(h), _ = (async () => {
453
+ await p();
454
+ let e = null;
455
+ g && (e = await new Promise((e) => {
456
+ let t = g.rec.mimeType || r || "audio/webm", n = () => e({
457
+ blob: new Blob(g.chunks, { type: t }),
458
+ mime: t,
459
+ startedAt: a
460
+ });
461
+ if (g.rec.state === "inactive") return n();
462
+ g.rec.onstop = n;
463
+ try {
464
+ g.rec.stop();
465
+ } catch {
466
+ n();
467
+ }
468
+ }));
469
+ for (let e of n.getTracks()) e.stop();
470
+ try {
471
+ s?.close();
472
+ } catch {}
473
+ return e;
474
+ })(), _)
475
+ };
476
+ }
477
+ function oe(e) {
478
+ return new Promise((t, n) => {
479
+ let r = new FileReader();
480
+ r.onload = () => t(String(r.result).split(",")[1] || ""), r.onerror = () => n(r.error), r.readAsDataURL(e);
481
+ });
482
+ }
483
+ //#endregion
484
+ //#region src/point/entry.js
485
+ var A = "specto-point-used", j = "specto-point-visits", se = "specto-point-visit", M = "specto-point-hint", N = "specto-point-nudged", P = "specto-point-me", F = "specto-point-hidden", I = 12e3, L = "specto-point-receipts", R = 7776e6, z = () => {
486
+ try {
487
+ return (JSON.parse(localStorage.getItem("specto-point-receipts") || "[]") || []).filter((e) => e && e.r && Date.now() - e.at < R);
488
+ } catch {
489
+ return [];
490
+ }
491
+ }, ce = (e) => H.set(localStorage, L, JSON.stringify(e.slice(-20))), B = (e) => {
492
+ let t = z().filter((t) => t.r !== e);
493
+ t.push({
494
+ r: e,
495
+ at: Date.now()
496
+ }), ce(t), H.set(localStorage, `${L}-at`, String(Date.now()));
497
+ }, le = (e) => ce(z().filter((t) => t.r !== e)), ue = 2e3, V = 2592e6, H = {
498
+ get: (e, t) => {
499
+ try {
500
+ return e.getItem(t);
501
+ } catch {
502
+ return null;
503
+ }
504
+ },
505
+ set: (e, t, n) => {
506
+ try {
507
+ e.setItem(t, n);
508
+ } catch {}
509
+ }
510
+ };
511
+ function de(e, t = location.pathname) {
512
+ return !e?.length || e.some((e) => RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`).test(t));
513
+ }
514
+ function fe(e) {
515
+ let t = parseInt(String(e).slice(1), 16);
516
+ if (!Number.isFinite(t)) return "#fff";
517
+ let [n, r, i] = [
518
+ t >> 16,
519
+ t >> 8 & 255,
520
+ t & 255
521
+ ].map((e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4));
522
+ return .2126 * n + .7152 * r + .0722 * i > .4 ? "#0E1320" : "#fff";
523
+ }
524
+ var U = () => /Mac|iPhone|iPad/.test(globalThis.navigator?.platform || "");
525
+ function pe(e, t = U()) {
526
+ return e.trigger === "double-ctrl" ? t ? ["⌘", "⌘"] : ["Ctrl", "Ctrl"] : e.trigger === "chord" ? [
527
+ "Alt",
528
+ "Shift",
529
+ "P"
530
+ ] : e.trigger === "hold-alt" ? [t ? "⌥" : "Alt"] : e.trigger === "hold-ctrl" ? ["Ctrl"] : e.trigger === "custom" ? String(e.shortcut?.label || "").split("+").filter(Boolean) : [];
531
+ }
532
+ function W(e, t = U()) {
533
+ let n = pe(e, t);
534
+ return n.length ? e.trigger.startsWith("hold") ? `hold ${n[0]}` : e.trigger === "double-ctrl" ? n.join(" ") : n.join("+") : "";
535
+ }
536
+ var G = (e) => String(e).replace(/[&<>"]/g, (e) => ({
537
+ "&": "&amp;",
538
+ "<": "&lt;",
539
+ ">": "&gt;",
540
+ "\"": "&quot;"
541
+ })[e]), me = (e, t = "kc") => e.map((e) => `<kbd class="${t}">${G(e)}</kbd>`).join("");
542
+ function he(e) {
543
+ let t = pe(e);
544
+ return t.length ? e.trigger === "double-ctrl" ? `Tap ${t[0] === "⌘" ? "⌘" : "Ctrl"} twice` : e.trigger.startsWith("hold") ? `Hold ${t[0]}` : `Press ${t.join("+")}` : "";
545
+ }
546
+ var ge = [
547
+ "bottom-right",
548
+ "bottom-left",
549
+ "edge"
550
+ ];
551
+ function K(e, t) {
552
+ if (t === !1) return null;
553
+ if (!t || typeof t != "object") return e;
554
+ let n = e || {
555
+ label: "Report a problem",
556
+ position: "bottom-right",
557
+ color: "#0E1320",
558
+ pages: []
559
+ }, r = Array.isArray(t.offset) ? t.offset.slice(0, 2).map((e) => Math.max(0, Math.min(600, Math.round(Number(e) || 0)))) : null;
560
+ return {
561
+ ...n,
562
+ ...ge.includes(t.position) ? { position: t.position } : {},
563
+ ...typeof t.label == "string" && t.label.trim() ? { label: t.label.trim().slice(0, 40) } : {},
564
+ .../^#[0-9a-f]{6}$/i.test(t.color || "") ? { color: t.color } : {},
565
+ ...r && r.length === 2 ? { offset: r } : {}
566
+ };
567
+ }
568
+ function _e(e, { used: t, visits: n, last: r, release: i, now: a = Date.now() }) {
569
+ return !e || t ? !1 : e.when === "monthly" ? !r || a - r.at >= V : e.when === "release" ? !!i && r?.release !== i : n >= 3 && !r;
570
+ }
571
+ function ve(e, t, n) {
572
+ let r = 0;
573
+ if (t.includes("network")) for (let t of e.network || []) t.at > n && (t.error || t.status >= 500) && (r = Math.max(r, t.at));
574
+ for (let i of e.event || []) i.at <= n || (i.type === "error" && t.includes("error") || i.type === "rage" && t.includes("rage") || i.type === "dead" && t.includes("dead")) && (r = Math.max(r, i.at));
575
+ return r;
576
+ }
577
+ function q(e, t, { open: n, may: r, local: i }) {
578
+ let a = e._point, o = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, s = o ? [] : pe(t);
579
+ H.get(sessionStorage, se) || (H.set(sessionStorage, se, "1"), H.set(localStorage, j, String((Number(H.get(localStorage, j)) || 0) + 1)));
580
+ let c = document.createElement("div");
581
+ c.id = "specto-point-entry", c.className = "specto-block", c.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--specto-launcher-z,2147483645)");
582
+ let l = c.attachShadow({ mode: "open" }), u = K(t.launcher, i), d = {};
583
+ try {
584
+ d = JSON.parse(H.get(localStorage, P) || "{}") || {};
585
+ } catch {}
586
+ let f = (e) => {
587
+ d = {
588
+ ...d,
589
+ ...e
590
+ }, H.set(localStorage, P, JSON.stringify(d)), x(), V();
591
+ }, p = () => u?.position === "edge" ? "edge" : d.side || (u?.position === "bottom-left" ? "left" : "right"), m = () => p() === "left" ? "left" : "right";
592
+ l.innerHTML = `<style>${Y}</style>
593
+ <button class="pill" type="button" hidden>
594
+ <svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>
595
+ <span class="lbl"></span>${s.length ? `<span class="keys" aria-hidden="true">${me(s)}</span>` : ""}
596
+ </button>
597
+ <div class="menu lmenu" role="menu" aria-label="Report a problem button" hidden>
598
+ <button class="m-open" type="button" role="menuitem">${G(u?.label || "Report a problem")}</button>
599
+ <hr>
600
+ <button class="m-size" type="button" role="menuitem"></button>
601
+ <button class="m-side" type="button" role="menuitem"></button>
602
+ <button class="m-hide" type="button" role="menuitem">Hide for this visit</button>
603
+ <p class="tip">Or drag it out of the way</p>
604
+ </div>
605
+ <div class="menu cmenu" role="menu" aria-label="Report a problem here" hidden>
606
+ <button class="c-go" type="button" role="menuitem"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>Report a problem here</button>
607
+ <p class="tip">Shift + right-click for the browser’s menu</p>
608
+ </div>
609
+ <div class="card nudge" role="dialog" aria-label="Something didn't work?" hidden>
610
+ <div class="hd"><span class="red" aria-hidden="true"></span><b>That didn’t work?</b></div>
611
+ <p>Show us what happened: point at it and say what you expected. Takes 20 seconds.</p>
612
+ <div class="row"><button class="go" type="button">Show us</button><button class="no" type="button">Not now</button>${s.length ? `<span class="or">or ${me(s)}</span>` : ""}</div>
613
+ </div>
614
+ <div class="card hint" role="dialog" aria-label="Report a problem" hidden>
615
+ <div class="hd">${s.length ? `<span class="big" aria-hidden="true">${me(s, "kc lg")}</span>` : ""}<b>Spot something broken?</b></div>
616
+ <p>${s.length ? `${he(t)}, click` : `${o ? "Tap" : "Click"} “${G(K(t.launcher, i)?.label || "Report a problem")}”, then ${o ? "tap" : "click"}`} what’s wrong and tell us. We see exactly what you saw.</p>
617
+ <div class="row"><button class="go" type="button">Try it now</button><button class="no" type="button">Got it</button></div>
618
+ </div>`;
619
+ let h = (e) => l.querySelector(e);
620
+ document.documentElement.appendChild(c);
621
+ let g = h(".pill"), _ = h(".nudge"), v = h(".hint"), y = h(".lmenu"), b = h(".cmenu");
622
+ function x() {
623
+ g.querySelector(".lbl").textContent = u?.label || "", g.className = `pill ${p()}${d.compact && p() !== "edge" ? " compact" : ""}`, g.setAttribute("aria-label", u?.label || "Report a problem"), g.title = `${u?.label || "Report a problem"}${s.length ? ` (${W(t)})` : ""}`, g.style.setProperty("--bg", u?.color || "#0E1320"), g.style.setProperty("--ink", fe(u?.color || "#0E1320"));
624
+ for (let [e, t] of ["x", "y"].entries()) {
625
+ let n = t === "y" && Number.isFinite(d.y) ? d.y : u?.offset?.[e];
626
+ n == null ? c.style.removeProperty(`--specto-launcher-${t}`) : c.style.setProperty(`--specto-launcher-${t}`, `${n}px`);
627
+ }
628
+ y.querySelector(".m-size").textContent = d.compact ? "Show the label" : "Make it smaller", y.querySelector(".m-side").textContent = p() === "left" ? "Move it to the right" : "Move it to the left", y.querySelector(".m-side").hidden = p() === "edge", y.querySelector(".m-size").hidden = p() === "edge", _.classList.toggle("left", m() === "left"), _.classList.toggle("right", m() === "right");
629
+ let e = t.hint?.where === "launcher" ? m() : t.hint?.where === "bottom-left" ? "left" : "right";
630
+ v.classList.toggle("left", e === "left"), v.classList.toggle("right", e === "right"), v.classList.toggle("by", !!u && u.position !== "edge" && e === m());
631
+ }
632
+ x();
633
+ let S = null, ee = 0, C = !1, w = () => {
634
+ y.hidden = !0, b.hidden = !0, C = !1;
635
+ };
636
+ function T() {
637
+ w();
638
+ let e = g.getBoundingClientRect();
639
+ y.style.bottom = `${Math.max(8, innerHeight - e.top + 8)}px`, y.style.left = p() === "left" ? `${Math.max(8, e.left)}px` : "", y.style.right = p() === "left" ? "" : `${Math.max(8, innerWidth - e.right)}px`, y.hidden = !1, C = !0, y.querySelector("button").focus();
640
+ }
641
+ g.addEventListener("click", (e) => {
642
+ S?.moved ? e.preventDefault() : (g.hidden = !0, n("launcher"));
643
+ }), g.addEventListener("contextmenu", (e) => {
644
+ e.preventDefault(), e.stopPropagation(), T();
645
+ }), g.addEventListener("pointerdown", (e) => {
646
+ e.button === 0 && (S = {
647
+ x: e.clientX,
648
+ y: e.clientY,
649
+ moved: !1
650
+ }, e.pointerType !== "mouse" && (ee = setTimeout(() => {
651
+ S && !S.moved && (S = null, T());
652
+ }, 550)));
653
+ });
654
+ let E = (e) => {
655
+ if (!S || !S.moved && Math.hypot(e.clientX - S.x, e.clientY - S.y) < 6) return;
656
+ clearTimeout(ee), S.moved = !0, g.classList.add("dragging");
657
+ let t = g.getBoundingClientRect(), n = p() === "edge";
658
+ g.style.left = `${n ? innerWidth - t.width : Math.min(innerWidth - t.width - 8, Math.max(8, e.clientX - t.width / 2))}px`, g.style.right = "auto", g.style.top = `${Math.min(innerHeight - t.height - 8, Math.max(8, e.clientY - t.height / 2))}px`, g.style.bottom = "auto", g.style.transform = n ? "rotate(180deg)" : "none";
659
+ }, te = (e) => {
660
+ if (clearTimeout(ee), !S?.moved) {
661
+ S = null;
662
+ return;
663
+ }
664
+ let t = g.getBoundingClientRect();
665
+ g.classList.remove("dragging");
666
+ for (let e of [
667
+ "left",
668
+ "right",
669
+ "top",
670
+ "bottom",
671
+ "transform"
672
+ ]) g.style[e] = "";
673
+ let n = Math.round(Math.min(innerHeight - t.height - 8, Math.max(8, innerHeight - t.bottom)));
674
+ f({
675
+ y: n,
676
+ ...p() === "edge" ? {} : { side: e.clientX < innerWidth / 2 ? "left" : "right" }
677
+ }), setTimeout(() => {
678
+ S = null;
679
+ }, 0);
680
+ };
681
+ window.addEventListener("pointermove", E, !0), window.addEventListener("pointerup", te, !0), y.querySelector(".m-open").addEventListener("click", () => {
682
+ w(), g.hidden = !0, n("launcher");
683
+ }), y.querySelector(".m-size").addEventListener("click", () => {
684
+ w(), f({ compact: !d.compact });
685
+ }), y.querySelector(".m-side").addEventListener("click", () => {
686
+ w(), f({ side: p() === "left" ? "right" : "left" });
687
+ }), y.querySelector(".m-hide").addEventListener("click", () => {
688
+ w(), H.set(sessionStorage, F, "1"), V();
689
+ });
690
+ let ne = null, D = (e) => !!e.closest("a[href],input,textarea,select,img,video,[contenteditable=\"\"],[contenteditable=\"true\"]") || !!String(getSelection?.() || "").trim(), O = (e) => {
691
+ if (!t.context || t.context === "off" || e.composedPath?.().includes(c) || document.getElementById("specto-point") || !r()) return;
692
+ let i = e.target instanceof Element ? e.target : null;
693
+ if (i) {
694
+ if (e.shiftKey || e.altKey) {
695
+ if (t.context === "menu" && e.shiftKey) return;
696
+ e.preventDefault(), w(), n("context", i);
697
+ } else t.context !== "menu" || D(i) || (e.preventDefault(), w(), ne = i, b.style.left = `${Math.min(e.clientX, innerWidth - 250)}px`, b.style.top = `${Math.min(e.clientY, innerHeight - 90)}px`, b.hidden = !1, C = !0, b.querySelector("button").focus());
698
+ }
699
+ };
700
+ b.querySelector(".c-go").addEventListener("click", () => {
701
+ let e = ne;
702
+ w(), e?.isConnected && n("context", e);
703
+ }), window.addEventListener("contextmenu", O, !0);
704
+ let k = (e) => {
705
+ C && !e.composedPath?.().includes(c) && w();
706
+ }, re = (e) => {
707
+ C && e.key === "Escape" && (w(), g.focus?.());
708
+ };
709
+ window.addEventListener("pointerdown", k, !0), window.addEventListener("keydown", re, !0), window.addEventListener("scroll", w, {
710
+ passive: !0,
711
+ capture: !0
712
+ });
713
+ let ie = 0, ae = 0, oe = Date.now(), L = () => {
714
+ ie = Date.now();
715
+ };
716
+ window.addEventListener("keydown", L, !0);
717
+ let R = () => {
718
+ _.hidden = !0;
719
+ };
720
+ _.querySelector(".go").addEventListener("click", () => {
721
+ R(), n("nudge");
722
+ }), _.querySelector(".no").addEventListener("click", R);
723
+ let z = null;
724
+ try {
725
+ z = JSON.parse(H.get(localStorage, M) || "null");
726
+ } catch {}
727
+ let ce = () => H.get(localStorage, A) === "1", B = () => {
728
+ v.hidden = !0;
729
+ };
730
+ v.querySelector(".go").addEventListener("click", () => {
731
+ B(), n("hint");
732
+ }), v.querySelector(".no").addEventListener("click", B);
733
+ let le = !1, V = () => {
734
+ let e = !!document.getElementById("specto-point"), n = r() && !e, i = !!document.getElementById("specto-feedback-host"), o = H.get(sessionStorage, F) === "1";
735
+ if (g.hidden = !(u && n && !i && !o && de(u.pages)), g.hidden && !y.hidden && w(), e && (R(), B()), t.nudge && n && !ae && !H.get(sessionStorage, N)) {
736
+ let e = ve(a.recent(), t.nudge, oe), n = Date.now() - ie < ue || /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName || "") || document.activeElement?.isContentEditable;
737
+ e && !n && (ae = Date.now(), H.set(sessionStorage, N, "1"), B(), _.hidden = !1, setTimeout(R, I)), e && (oe = e);
738
+ }
739
+ if (t.hint && n && !le) {
740
+ le = !0;
741
+ let e = Number(H.get(localStorage, j)) || 0;
742
+ _e(t.hint, {
743
+ used: ce(),
744
+ visits: e,
745
+ last: z,
746
+ release: a.release
747
+ }) && (H.set(localStorage, M, JSON.stringify({
748
+ at: Date.now(),
749
+ release: a.release || null
750
+ })), setTimeout(() => {
751
+ _.hidden && !document.getElementById("specto-point") && (v.hidden = !1);
752
+ }, 1500));
753
+ }
754
+ };
755
+ V();
756
+ let U = setInterval(V, 1e3), ge = new MutationObserver(V);
757
+ return ge.observe(document.documentElement, { childList: !0 }), {
758
+ launcher(e) {
759
+ u = K(t.launcher, e), x(), V();
760
+ },
761
+ stop() {
762
+ clearInterval(U), ge.disconnect(), window.removeEventListener("keydown", L, !0), window.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", te, !0), window.removeEventListener("contextmenu", O, !0), window.removeEventListener("pointerdown", k, !0), window.removeEventListener("keydown", re, !0), window.removeEventListener("scroll", w, !0), c.remove();
763
+ }
764
+ };
765
+ }
766
+ function ye(e, { open: t } = {}) {
767
+ let n = (e || []).filter((e) => e && e.title).slice(0, 3);
768
+ if (!n.length || document.getElementById("specto-point-fixed")) return null;
769
+ let r = document.createElement("div");
770
+ r.id = "specto-point-fixed", r.className = "specto-block", r.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646");
771
+ let i = r.attachShadow({ mode: "open" }), a = n[0];
772
+ i.innerHTML = `<style>${Y}${J}</style>
773
+ <div class="card fixed" role="status" aria-live="polite">
774
+ <button class="x" type="button" aria-label="Dismiss"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3l-6 6"/></svg></button>
775
+ <div class="hd"><span class="okc" aria-hidden="true"><svg viewBox="0 0 12 12"><path d="M2.5 6.2 5 8.5 9.5 3.5"/></svg></span><b></b></div>
776
+ <p class="msg"></p>${n.length > 1 ? `<p class="more">And ${n.length - 1} more you reported ${n.length > 2 ? "are" : "is"} fixed too.</p>` : ""}
777
+ <div class="row"><button class="go" type="button">Got it</button><button class="no still" type="button">Still happening?</button></div>
778
+ </div>`, i.querySelector("b").textContent = `Fixed: ${a.title}`, i.querySelector(".msg").textContent = a.message || "The fix is live. Thank you, it helped.";
779
+ let o = () => r.remove();
780
+ return i.querySelector(".x").addEventListener("click", o), i.querySelector(".go").addEventListener("click", o), i.querySelector(".still").addEventListener("click", () => {
781
+ o(), t?.("fixed", null, a.receipt);
782
+ }), document.documentElement.appendChild(r), { close: o };
783
+ }
784
+ var J = "\n.card.fixed{top:20px;right:20px;bottom:auto;width:340px;padding:16px 16px 14px}\n.fixed .hd{align-items:flex-start;padding-right:22px}\n.fixed .hd b{line-height:1.4}\n.okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}\n.okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.fixed .more{font-size:12px;color:#8A93A6}\n.fixed .row{margin-top:2px}\n.x{position:absolute;top:8px;right:8px;width:28px;height:28px;border:0;border-radius:6px;background:none;color:#8A93A6;display:flex;align-items:center;justify-content:center;cursor:pointer}\n.x svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}\n.x:hover{color:#F4F5F8}\n@media (max-width:480px){.card.fixed{left:12px;right:12px;width:auto}}\n", Y = "\n:host{all:initial}\n*{-webkit-user-select:none;user-select:none}\ninput,textarea{-webkit-user-select:text;user-select:text}\n*{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n[hidden]{display:none!important}\n.kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap}\n.kc.lg{min-width:34px;height:26px;padding:0 8px;font-size:12.5px;border-bottom-width:3px;border-radius:6px}\n.keys,.or,.big{display:inline-flex;align-items:center;gap:3px}\n.pill{position:fixed;bottom:var(--specto-launcher-y,20px);display:inline-flex;align-items:center;gap:10px;height:40px;padding:0 12px 0 11px;border:0;border-radius:999px;background:var(--bg,#0E1320);color:var(--ink,#fff);font:600 13px/1 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif;cursor:pointer;box-shadow:0 8px 22px rgba(7,10,16,.28);white-space:nowrap}\n.pill.right{right:var(--specto-launcher-x,20px)}.pill.left{left:var(--specto-launcher-x,20px)}\n.pill .ic{width:16px;height:16px;flex:none;fill:none;stroke:#A9A0FF;stroke-width:1.6}\n.pill .ic .d{fill:#A9A0FF;stroke:none}\n.pill .keys{opacity:.7}\n.pill .kc{height:18px;min-width:18px;border-color:currentColor;background:transparent;opacity:.85}\n.pill.edge{right:0;bottom:auto;top:calc(50% + var(--specto-launcher-y,0px) - 20px);height:auto;padding:14px 9px;gap:8px;border-radius:10px 0 0 10px;writing-mode:vertical-rl;transform:translateY(-50%) rotate(180deg)}\n.pill.edge .keys{display:none}\n.pill:hover{filter:brightness(1.12)}\n.pill:focus-visible,.card button:focus-visible{outline:2px solid #5B4BF0;outline-offset:2px}\n.card{position:fixed;bottom:calc(var(--specto-launcher-y,20px) + 52px);width:330px;background:#0E1320;color:#F4F5F8;border-radius:12px;padding:14px 16px;box-shadow:0 12px 32px rgba(7,10,16,.35);font-size:13px;display:flex;flex-direction:column;gap:10px}\n.card.right{right:var(--specto-launcher-x,20px)}.card.left{left:var(--specto-launcher-x,20px)}\n.card.hint:not(.by){bottom:24px}\n.hd{display:flex;align-items:center;gap:10px}\n.hd b{font-size:14px;font-weight:600}\n.red{width:8px;height:8px;border-radius:50%;background:#F87171;flex:none}\n.card p{margin:0;line-height:1.5;color:#C3C8D4}\n.row{display:flex;align-items:center;gap:10px}\n.go{height:34px;padding:0 14px;background:#5B4BF0;border:0;color:#fff;border-radius:8px;font-weight:600;font-size:13px;cursor:pointer}\n.no{height:34px;padding:0 10px;background:none;border:0;color:#8A93A6;font-size:13px;cursor:pointer}\n.or{margin-left:auto;gap:4px;font-size:11px;color:#8A93A6}\n.pill.compact{width:44px;height:44px;padding:0;justify-content:center;gap:0}\n.pill.compact .lbl,.pill.compact .keys{display:none}\n.pill.compact .ic{width:20px;height:20px}\n.pill.compact::after{content:\"\";position:absolute;inset:-4px;border-radius:50%;border:2px solid rgba(169,160,255,.55);animation:sp-pulse 2.4s ease-out 2;pointer-events:none}\n@keyframes sp-pulse{0%{transform:scale(.85);opacity:1}100%{transform:scale(1.35);opacity:0}}\n.pill.dragging{cursor:grabbing;transition:none;box-shadow:0 14px 34px rgba(7,10,16,.4)}\n.menu{position:fixed;min-width:210px;background:#0E1320;color:#F4F5F8;border:1px solid #2a3346;border-radius:10px;padding:5px;box-shadow:0 12px 32px rgba(7,10,16,.4);font-size:13px;display:flex;flex-direction:column}\n.menu button{display:flex;align-items:center;gap:8px;text-align:left;background:none;border:0;color:inherit;font:inherit;padding:8px 10px;border-radius:7px;cursor:pointer}\n.menu button:hover,.menu button:focus-visible{background:rgba(91,75,240,.22);outline:none}\n.menu .m-open,.menu .c-go{font-weight:600}\n.menu .ic{width:16px;height:16px;fill:none;stroke:#A9A0FF;stroke-width:1.6}\n.menu .ic .d{fill:#A9A0FF;stroke:none}\n.menu hr{border:0;border-top:1px solid #232c40;margin:4px 2px}\n.menu .tip{margin:4px 10px 6px;font-size:11px;color:#8A93A6}\n@media (prefers-reduced-motion:reduce){.pill.compact::after{animation:none;opacity:0}}\n@media (max-width:480px){.card{width:calc(100vw - 40px)}}\n", be = [
785
+ "broken",
786
+ "wrong",
787
+ "slow",
788
+ "confusing",
789
+ "idea"
790
+ ], xe = "specto-point-voice", Se = "specto-point-sent", Ce = "specto-point-used", we = 2, Te = 6e3, Ee = [
791
+ "",
792
+ "①",
793
+ "②",
794
+ "③",
795
+ "④",
796
+ "⑤",
797
+ "⑥",
798
+ "⑦",
799
+ "⑧",
800
+ "⑨",
801
+ "⑩"
802
+ ], De = "<svg viewBox=\"0 0 18 18\" aria-hidden=\"true\"><rect x=\"6.5\" y=\"2\" width=\"5\" height=\"9\" rx=\"2.5\"/><path d=\"M3.5 8.5a5.5 5.5 0 0 0 11 0M9 14v2.5\"/></svg>", Oe = "<svg viewBox=\"0 0 12 12\" aria-hidden=\"true\"><path d=\"M2.5 6.2 5 8.5 9.5 3.5\"/></svg>", X = {
803
+ get: (e) => {
804
+ try {
805
+ return localStorage.getItem(e);
806
+ } catch {
807
+ return null;
808
+ }
809
+ },
810
+ set: (e, t) => {
811
+ try {
812
+ localStorage.setItem(e, t);
813
+ } catch {}
814
+ }
815
+ }, ke = {
816
+ broken: "#F43F5E",
817
+ wrong: "#F59E0B",
818
+ slow: "#8B5CF6",
819
+ confusing: "#0EA5E9",
820
+ idea: "#10B981"
821
+ }, Ae = {
822
+ broken: "Broken",
823
+ wrong: "Wrong",
824
+ slow: "Slow",
825
+ confusing: "Confusing",
826
+ idea: "Idea"
827
+ }, je = "specto-point-howto", Me = 20, Ne = 8, Pe = {
828
+ "double-ctrl": "Double-tap Ctrl",
829
+ "hold-alt": "Hold Alt",
830
+ "hold-ctrl": "Hold Ctrl",
831
+ chord: "Alt + Shift + P"
832
+ }, Fe = [
833
+ "pointerdown",
834
+ "pointerup",
835
+ "mousedown",
836
+ "mouseup",
837
+ "click",
838
+ "dblclick",
839
+ "auxclick",
840
+ "contextmenu",
841
+ "touchstart",
842
+ "touchend"
843
+ ];
844
+ function Z(e, t = {}) {
845
+ if (document.getElementById("specto-point")) return null;
846
+ let n = e._point, r = () => n.strict(), i = [], a = "armed", o = null, s = null, c = null, l = null, d = null, f = null, p = 0, h = [], g = 0, v = !1, y = !1, b = 0, x = !1, C = !1, w = document.createElement("div");
847
+ w.id = "specto-point", w.className = "specto-block", w.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646");
848
+ let T = w.attachShadow({ mode: "open" });
849
+ T.innerHTML = `<style>${Ie}</style>
850
+ <div class="ring" data-state="armed" aria-hidden="true"><span class="badge"></span><span class="dot"></span></div>
851
+ <div class="outline" aria-hidden="true"><span class="chip"></span></div>
852
+ <div class="frame" aria-hidden="true"></div>
853
+ <div class="marks"></div>
854
+ <section class="rail" role="region" aria-label="Specto Point — report what is wrong">
855
+ <header><b>Point</b><span class="hint"></span><button class="x" aria-label="Leave Point" title="Leave (Esc)">×</button></header>
856
+ <ol class="list"></ol>
857
+ <p class="empty">Click what is wrong. Drag to frame an area.</p>
858
+ <div class="vcard" hidden>
859
+ <b>Tell us like you’d tell a friend</b>
860
+ <p>Point at things and just talk: “this button does nothing”. Your words show up here as you go.</p>
861
+ <p class="fine">Your browser will ask to use the microphone. We only turn your voice into text; the recording is deleted.</p>
862
+ <button class="vstart" type="button">${De}Start talking</button>
863
+ <p class="fine c">Rather type? Just start typing.</p>
864
+ </div>
865
+ <div class="listening" hidden>
866
+ <div class="lh"><span class="rd" aria-hidden="true"></span>Listening<span class="bars" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span></div>
867
+ <p class="cap" aria-live="polite"></p>
868
+ <p class="fine">Each phrase shows up a moment after you pause, on the marker you were pointing at.</p>
869
+ </div>
870
+ <details class="exp"><summary>Expected / what happened</summary>
871
+ <input class="expected" maxlength="500" placeholder="What did you expect?" aria-label="What did you expect?">
872
+ <input class="actual" maxlength="500" placeholder="What happened instead?" aria-label="What happened instead?">
873
+ </details>
874
+ <label class="keep" hidden><input type="checkbox"> Also send my voice recording (kept 30 days)</label>
875
+ <button class="flowbtn" type="button" title="F — use the page normally while Specto brackets this stretch of the recording">Record a flow</button>
876
+ <div class="row bottom">
877
+ <button class="mic" type="button" hidden aria-label="Talk" title="M — talk instead of typing; your words appear as you go">${De}</button>
878
+ <button class="typei" type="button" hidden>Type instead</button>
879
+ <button class="send" type="button" disabled>Send</button>
880
+ </div>
881
+ <p class="status" role="status" aria-live="polite"></p>
882
+ </section>
883
+ <div class="howto" hidden role="dialog" aria-label="How Point works"></div>`;
884
+ let E = (e) => T.querySelector(e), D = E(".ring"), O = E(".outline"), k = E(".frame"), re = E(".marks"), A = E(".rail"), j = E(".list"), se = E(".status"), M = E(".hint");
885
+ document.documentElement.appendChild(w);
886
+ let N = document.createElement("style");
887
+ N.id = "specto-point-cursor", N.textContent = "html.specto-point-on,html.specto-point-on *{cursor:none!important}", document.head?.appendChild(N);
888
+ let P = (e) => document.documentElement.classList.toggle("specto-point-on", e);
889
+ P(!0), n.active(!0);
890
+ let F = (e) => e.composedPath?.().includes(w), I = (e, t) => {
891
+ se.textContent = e || "", se.classList.toggle("bad", !!t);
892
+ };
893
+ function L(e) {
894
+ a = e, D.dataset.state = l ? `${e} listening` : e;
895
+ let t = e === "flow";
896
+ P(!t && e !== "sent"), n.active(!t && e !== "sent"), O.style.display = t ? "none" : "", M.textContent = e === "flow" ? "Use the page — F ends the flow" : "Esc to cancel", E(".flowbtn").textContent = c && !c.end ? "End the flow" : c?.end ? "Flow recorded ✓" : "Record a flow", E(".flowbtn").classList.toggle("on", e === "flow"), E(".send").disabled = y || !(i.length || c?.end || E(".expected").value.trim() || E(".actual").value.trim()), E(".empty").hidden = i.length > 0, D.querySelector(".badge").textContent = e === "marking" || e === "armed" ? String(i.length + 1) : "";
897
+ }
898
+ function R(e) {
899
+ e !== g && (l && (l.cut(), h.push({
900
+ at: Date.now(),
901
+ marker: e
902
+ })), g = e);
903
+ }
904
+ function z(e, t) {
905
+ if (i.length >= Me) {
906
+ I(`At most ${Me} markers in one report`, !0);
907
+ return;
908
+ }
909
+ Xe();
910
+ let a = Date.now(), o = ee(e, { strict: r() }), s = te({
911
+ recent: n.recent(),
912
+ contains: (t) => e === t || e.contains(t) || t.contains?.(e),
913
+ now: a
914
+ }), c = {
915
+ n: i.length + 1,
916
+ el: e,
917
+ kind: t ? "region" : "element",
918
+ flag: "broken",
919
+ note: "",
920
+ at: a,
921
+ desc: o,
922
+ ctx: s,
923
+ region: t ? {
924
+ x: t.x + scrollX,
925
+ y: t.y + scrollY,
926
+ w: t.w,
927
+ h: t.h
928
+ } : null
929
+ };
930
+ t && (c.desc.rect = {
931
+ x: Math.round(t.x),
932
+ y: Math.round(t.y),
933
+ w: Math.round(t.w),
934
+ h: Math.round(t.h)
935
+ }), i.push(c), R(c.n), H(), L("marking"), tt || ce(e, t);
936
+ }
937
+ function ce(e, t) {
938
+ if (innerWidth <= 560) return;
939
+ let n;
940
+ try {
941
+ n = t || e.getBoundingClientRect();
942
+ } catch {
943
+ return;
944
+ }
945
+ let r = A.getBoundingClientRect();
946
+ n.x < r.right && n.x + (n.w ?? n.width) > r.left && n.y < r.bottom && n.y + (n.h ?? n.height) > r.top && A.classList.toggle("left");
947
+ }
948
+ function ue(e) {
949
+ i.splice(e, 1), i.forEach((e, t) => {
950
+ e.n = t + 1;
951
+ }), R(i.length ? i[i.length - 1].n : 0), H(), L(i.length ? "marking" : "armed");
952
+ }
953
+ let V = (e) => {
954
+ e.flag = be[(be.indexOf(e.flag) + 1) % be.length], H();
955
+ };
956
+ function H() {
957
+ j.replaceChildren(...i.map((e, t) => {
958
+ let n = document.createElement("li");
959
+ return n.innerHTML = `<button class="num" type="button" title="Change the flag" style="--c:${ke[e.flag]}">${e.n}</button>
960
+ <span class="what"><span class="name"></span><button class="flag" type="button" style="--c:${ke[e.flag]}">${Ae[e.flag]}</button></span>
961
+ <textarea class="note" rows="1" maxlength="1000" placeholder="${l ? "Talk, or type here" : "Note (optional)"}" aria-label="Note for marker ${e.n}"></textarea>
962
+ <button class="rm" type="button" aria-label="Remove marker ${e.n}">×</button>`, n.dataset.n = String(e.n), n.querySelector(".name").textContent = e.desc.component ? `${e.desc.component} · ${e.desc.name}` : e.desc.name, n.querySelector(".note").value = e.note, n.querySelector(".note").addEventListener("input", (t) => {
963
+ e.note = t.target.value;
964
+ }), n.querySelector(".note").addEventListener("focus", () => R(e.n)), n.querySelector(".num").addEventListener("click", () => V(e)), n.querySelector(".flag").addEventListener("click", () => V(e)), n.querySelector(".rm").addEventListener("click", () => ue(t)), n.addEventListener("pointerenter", () => R(e.n)), n;
965
+ })), re.replaceChildren(...i.map((e) => {
966
+ let t = document.createElement("div");
967
+ return t.className = `mk ${e.kind}`, t.style.setProperty("--c", ke[e.flag]), t.innerHTML = `<button class="pin" type="button" aria-label="Marker ${e.n}: ${Ae[e.flag]} — click to change">${e.n}</button>`, t.querySelector(".pin").addEventListener("click", (t) => {
968
+ t.stopPropagation(), V(e);
969
+ }), e.node = t, t;
970
+ })), de();
971
+ }
972
+ function de() {
973
+ for (let e of i) {
974
+ if (!e.node) continue;
975
+ let t;
976
+ if (e.region) t = {
977
+ left: e.region.x - scrollX,
978
+ top: e.region.y - scrollY,
979
+ width: e.region.w,
980
+ height: e.region.h
981
+ };
982
+ else try {
983
+ t = e.el.getBoundingClientRect();
984
+ } catch {
985
+ t = null;
986
+ }
987
+ !t || !e.region && !e.el.isConnected ? e.node.style.display = "none" : (e.node.style.display = "", e.node.style.transform = `translate(${t.left}px, ${t.top}px)`, e.node.style.width = `${Math.max(4, t.width)}px`, e.node.style.height = `${Math.max(4, t.height)}px`);
988
+ }
989
+ }
990
+ let fe = () => {
991
+ if (!x) {
992
+ if (de(), l) {
993
+ let e = l.level();
994
+ D.style.setProperty("--lv", e.toFixed(2)), E(".bars").style.setProperty("--lv", Math.min(1, e * 2.5).toFixed(2));
995
+ }
996
+ b = requestAnimationFrame(fe);
997
+ }
998
+ };
999
+ b = requestAnimationFrame(fe);
1000
+ let U = (e, t) => {
1001
+ let n = document.elementFromPoint(e, t);
1002
+ return n && n !== w && n !== document.documentElement ? n : null;
1003
+ };
1004
+ function W(e) {
1005
+ if (!e) {
1006
+ O.style.opacity = "0";
1007
+ return;
1008
+ }
1009
+ let t;
1010
+ try {
1011
+ t = e.getBoundingClientRect();
1012
+ } catch {
1013
+ return;
1014
+ }
1015
+ if (O.style.opacity = "1", O.style.transform = `translate(${t.left}px, ${t.top}px)`, O.style.width = `${t.width}px`, O.style.height = `${t.height}px`, o !== e) {
1016
+ let n = u(e, r()), { component: i } = _(e), a = S(e, {
1017
+ component: i,
1018
+ name: m(e, n).slice(0, 30)
1019
+ });
1020
+ O.querySelector(".chip").textContent = a, O.classList.toggle("below", t.top < 24);
1021
+ }
1022
+ }
1023
+ let G = (e) => {
1024
+ if (D.style.transform = `translate(${e.clientX}px, ${e.clientY}px)`, D.classList.add("seen"), a === "flow" || a === "sent") return;
1025
+ if (F(e)) {
1026
+ W(null), o = null;
1027
+ return;
1028
+ }
1029
+ if (s && (Math.abs(e.clientX - s.x) > Ne || Math.abs(e.clientY - s.y) > Ne)) {
1030
+ s.region = {
1031
+ x: Math.min(s.x, e.clientX),
1032
+ y: Math.min(s.y, e.clientY),
1033
+ w: Math.abs(e.clientX - s.x),
1034
+ h: Math.abs(e.clientY - s.y)
1035
+ }, Object.assign(k.style, {
1036
+ display: "block",
1037
+ transform: `translate(${s.region.x}px, ${s.region.y}px)`,
1038
+ width: `${s.region.w}px`,
1039
+ height: `${s.region.h}px`
1040
+ }), W(null);
1041
+ return;
1042
+ }
1043
+ let t = U(e.clientX, e.clientY);
1044
+ W(t), o = t;
1045
+ let n = t && i.find((e) => e.el === t || e.el.contains?.(t));
1046
+ n && R(n.n);
1047
+ }, he = (e) => {
1048
+ if (!(x || a === "flow" || a === "sent" || F(e)) && (e.preventDefault(), e.stopImmediatePropagation(), e.type === "pointerdown" && e.button === 0 && (s = {
1049
+ x: e.clientX,
1050
+ y: e.clientY,
1051
+ el: U(e.clientX, e.clientY),
1052
+ region: null
1053
+ }), e.type === "pointerup" && s)) {
1054
+ let e = s;
1055
+ if (s = null, k.style.display = "none", e.region && e.region.w > Ne && e.region.h > Ne) {
1056
+ let t = e.region.x + e.region.w / 2, n = e.region.y + e.region.h / 2;
1057
+ z(U(t, n) || document.body, e.region);
1058
+ } else e.el && z(e.el, null);
1059
+ }
1060
+ }, ge = (e) => {
1061
+ let t = e.composedPath?.()[0];
1062
+ return t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA") && F(e);
1063
+ }, K = (e) => {
1064
+ if (x || a === "sent") return;
1065
+ if (ge(e)) {
1066
+ e.key === "Escape" ? (e.target.blur?.(), A.focus?.()) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Q());
1067
+ return;
1068
+ }
1069
+ let t = e.key;
1070
+ if ((!Y.hidden || l) && t.length === 1 && t !== "?" && !e.ctrlKey && !e.metaKey && !e.altKey && a !== "flow") Ze(e);
1071
+ else if ((e.ctrlKey || e.metaKey) && (t === "a" || t === "A")) e.preventDefault();
1072
+ else if ([
1073
+ "Escape",
1074
+ "Enter",
1075
+ "Backspace",
1076
+ "f",
1077
+ "F",
1078
+ "m",
1079
+ "M",
1080
+ "?",
1081
+ "Tab"
1082
+ ].includes(t) && (a !== "flow" || [
1083
+ "f",
1084
+ "F",
1085
+ "Escape"
1086
+ ].includes(t))) {
1087
+ if (e.preventDefault(), e.stopImmediatePropagation(), t === "Escape") {
1088
+ if (a === "flow") {
1089
+ q();
1090
+ return;
1091
+ }
1092
+ if (i.length && !v) {
1093
+ v = !0, I("Press Esc again to discard this report"), setTimeout(() => {
1094
+ v = !1;
1095
+ }, 3e3);
1096
+ return;
1097
+ }
1098
+ $();
1099
+ } else t === "Enter" ? o && !i.some((e) => e.el === o) && _e.active ? z(o, null) : Q() : t === "Backspace" ? i.length && ue(i.length - 1) : t === "f" || t === "F" ? a === "flow" ? q() : ve() : t === "m" || t === "M" ? Je() : t === "?" ? Qe(!0) : t === "Tab" && _e.next(e.shiftKey);
1100
+ }
1101
+ }, _e = {
1102
+ active: !1,
1103
+ i: -1,
1104
+ next(e) {
1105
+ let t = Array.from(document.querySelectorAll("a[href],button,input,select,textarea,summary,[tabindex]:not([tabindex=\"-1\"]),[role=button],[role=link]")).filter((e) => {
1106
+ let t = e.getBoundingClientRect();
1107
+ return t.width > 0 && t.height > 0 && !w.contains(e);
1108
+ });
1109
+ if (t.length) {
1110
+ this.active = !0, this.i = (this.i + (e ? -1 : 1) + t.length) % t.length, o = t[this.i];
1111
+ try {
1112
+ o.scrollIntoView({ block: "nearest" });
1113
+ } catch {}
1114
+ W(o);
1115
+ }
1116
+ }
1117
+ };
1118
+ function ve() {
1119
+ c?.end && (c = null), c = {
1120
+ start: Date.now(),
1121
+ end: null
1122
+ }, W(null), L("flow"), ye();
1123
+ }
1124
+ function q() {
1125
+ c && !c.end && (c.end = Date.now(), L(i.length ? "marking" : "armed"), I(`Flow recorded (${Math.round((c.end - c.start) / 1e3)} s)`));
1126
+ }
1127
+ function ye() {
1128
+ if (x || !c || c.end) return;
1129
+ let e = Math.round((Date.now() - c.start) / 1e3);
1130
+ M.textContent = `Recording the flow ${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")} — F ends it`, setTimeout(ye, 500);
1131
+ }
1132
+ let J = E(".mic"), Y = E(".vcard"), Z = !!t.voice && ie(), Le = t.voiceLang && t.voiceLang !== "auto" ? t.voiceLang : String(navigator.language || "").slice(0, 2).toLowerCase(), Re = String(n.endpoint).replace(/\/api\/point$/, "/api/point-transcribe");
1133
+ Z && (J.hidden = !1), Z && t.keepAudio && (E(".keep").hidden = !1);
1134
+ let ze = (e) => {
1135
+ let t = 0;
1136
+ for (let n of h) if (n.at <= e) t = n.marker;
1137
+ else break;
1138
+ return t;
1139
+ };
1140
+ function Be(e) {
1141
+ let t = e && j.querySelector(`li[data-n="${e}"]`);
1142
+ return t ? t.querySelector(".note") : (E(".exp").open = !0, E(".actual"));
1143
+ }
1144
+ async function Ve(e) {
1145
+ let t = ze(e.startedAt), r = Date.now();
1146
+ p++, L(a);
1147
+ try {
1148
+ let a = await fetch(Re, {
1149
+ method: "POST",
1150
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1151
+ credentials: "omit",
1152
+ body: JSON.stringify({
1153
+ key: n.key,
1154
+ mime: e.mime,
1155
+ data: await oe(e.blob),
1156
+ lang: Le
1157
+ })
1158
+ }), o = await a.json().catch(() => ({})), s = a.ok ? String(o.text || "").trim() : "";
1159
+ if (s) {
1160
+ We(t, s, e.startedAt, r);
1161
+ let n = i.find((e) => e.n === t), a = Be(n ? t : 0);
1162
+ n && (n.note = `${n.note ? `${n.note} ` : ""}${s}`.slice(0, 1e3)), a && (a.value = n ? n.note : `${a.value ? `${a.value} ` : ""}${s}`.slice(0, 500), a.dispatchEvent(new Event("input")));
1163
+ } else a.ok || I("Some of what you said couldn’t be written down — type it if it’s missing", !0);
1164
+ } catch {
1165
+ I("Some of what you said couldn’t be written down — type it if it’s missing", !0);
1166
+ }
1167
+ p--, L(a);
1168
+ }
1169
+ let He = E(".cap"), Ue = [];
1170
+ function We(e, t, n, r) {
1171
+ Ue.push({
1172
+ n: e,
1173
+ words: t,
1174
+ at: n,
1175
+ end: r
1176
+ }), He.replaceChildren(...Ue.slice(-4).map((e) => {
1177
+ let t = document.createElement("span"), n = i.find((t) => t.n === e.n);
1178
+ return n && (t.className = "said", t.style.setProperty("--c", ke[n.flag])), t.textContent = `${e.words}${n ? ` ${Ee[n.n] || `(${n.n})`}` : ""} `, t;
1179
+ }));
1180
+ }
1181
+ function Ge(e) {
1182
+ J.classList.toggle("on", e), J.setAttribute("aria-label", e ? "Stop talking" : "Talk"), E(".typei").hidden = !e, E(".listening").hidden = !e;
1183
+ }
1184
+ async function Ke() {
1185
+ if (!l) return;
1186
+ let e = l;
1187
+ l = null, Ge(!1), L(a), d = await e.stop();
1188
+ }
1189
+ async function qe() {
1190
+ if (Z && !l) {
1191
+ Y.hidden = !0, J.hidden = !1;
1192
+ try {
1193
+ l = await ae({
1194
+ onPhrase: Ve,
1195
+ keep: !!t.keepAudio
1196
+ }), f ||= { startedAt: l.startedAt }, X.set(xe, "yes"), h.push({
1197
+ at: l.startedAt,
1198
+ marker: g
1199
+ }), Ue.length || (He.textContent = "Say what you see…"), Ge(!0), L(a);
1200
+ } catch (e) {
1201
+ l = null, e?.name === "NotAllowedError" && X.set(xe, "no"), I(e?.name === "NotAllowedError" ? "The microphone is blocked for this site — type instead" : "The microphone could not start — type instead", !0);
1202
+ }
1203
+ }
1204
+ }
1205
+ let Je = () => l ? Ke() : qe(), Ye = !1;
1206
+ function Xe() {
1207
+ Ye || !Z || l || X.get(xe) || (Ye = !0, Y.hidden = !1, J.hidden = !0);
1208
+ }
1209
+ E(".typei").addEventListener("click", () => {
1210
+ Ke(), Be(g)?.focus();
1211
+ });
1212
+ function Ze(e) {
1213
+ Y.hidden = !0, J.hidden = !Z, l && Ke();
1214
+ let t = Be(g);
1215
+ t && (e.preventDefault(), e.stopImmediatePropagation(), t.focus(), t.value += e.key, t.dispatchEvent(new Event("input")));
1216
+ }
1217
+ function Qe(e) {
1218
+ let n = !1;
1219
+ try {
1220
+ n = localStorage.getItem(je) === "1";
1221
+ } catch {}
1222
+ if (n && !e) return;
1223
+ try {
1224
+ localStorage.setItem(je, "1");
1225
+ } catch {}
1226
+ C = !0;
1227
+ let r = E(".howto");
1228
+ r.innerHTML = `<div class="scene" aria-hidden="true"><div class="page"><i></i><i></i><b class="btn">Pay</b></div><span class="cur"></span><span class="pinh">1</span><span class="wave"></span></div>
1229
+ <ol><li><b>${Pe[t.trigger] || "Use the shortcut"}</b> to point</li><li><b>Click</b> what is wrong</li>${t.voice ? "<li><b>Say</b> what you see</li>" : "<li><b>Add a note</b> if you like</li>"}<li><b>Enter</b> sends it</li></ol>
1230
+ <button class="ok" type="button">Got it</button>`, r.hidden = !1;
1231
+ let i = () => {
1232
+ r.hidden || (r.hidden = !0, Xe());
1233
+ };
1234
+ r.querySelector(".ok").addEventListener("click", i), setTimeout(i, 9e3);
1235
+ }
1236
+ async function Q() {
1237
+ if (y) return;
1238
+ c && !c.end && q();
1239
+ let r = E(".expected").value.trim(), o = E(".actual").value.trim();
1240
+ if (!i.length && !c?.end && !r && !o) {
1241
+ I("Mark something first — click what is wrong", !0);
1242
+ return;
1243
+ }
1244
+ y = !0, L(a);
1245
+ let s = E(".send");
1246
+ s.innerHTML = "<span class=\"spin\" aria-hidden=\"true\"></span>Sending…", A.classList.add("busy"), I("");
1247
+ try {
1248
+ l && await Ke(), p > 0 && I("Writing down the last of what you said…");
1249
+ for (let e = Date.now() + Te; p > 0 && Date.now() < e;) await new Promise((e) => setTimeout(e, 100));
1250
+ I("");
1251
+ let a = !!(t.keepAudio && E(".keep input").checked && d?.blob?.size), s = {
1252
+ page: location.pathname,
1253
+ release: n.release || void 0,
1254
+ expected: r || void 0,
1255
+ actual: o || void 0,
1256
+ markers: i.map((e) => ({
1257
+ n: e.n,
1258
+ kind: e.kind,
1259
+ flag: e.flag,
1260
+ note: e.note.trim() || void 0,
1261
+ at: e.at,
1262
+ ...e.desc,
1263
+ viewport: {
1264
+ w: innerWidth,
1265
+ h: innerHeight
1266
+ },
1267
+ scroll: {
1268
+ x: Math.round(scrollX),
1269
+ y: Math.round(scrollY)
1270
+ },
1271
+ dpr: devicePixelRatio || 1,
1272
+ events: e.ctx.events,
1273
+ network: e.ctx.network,
1274
+ console: e.ctx.console
1275
+ })),
1276
+ flow: c?.end ? c : void 0,
1277
+ env: ne(),
1278
+ voice: f ? {
1279
+ live: !0,
1280
+ startedAt: f.startedAt,
1281
+ timeline: h,
1282
+ lang: Le || void 0,
1283
+ keep: a,
1284
+ phrases: Ue.map((e) => ({
1285
+ at: e.at,
1286
+ end: e.end,
1287
+ marker: i.some((t) => t.n === e.n) ? e.n : 0,
1288
+ text: e.words
1289
+ }))
1290
+ } : void 0,
1291
+ via: t.via || void 0
1292
+ }, u = {
1293
+ key: n.key,
1294
+ sessionId: e.sessionId || null,
1295
+ report: s,
1296
+ notify: { on: !!t.notify?.tick },
1297
+ ...t.about ? { about: t.about } : {}
1298
+ };
1299
+ a && (u.audio = {
1300
+ mime: d.mime,
1301
+ data: await oe(d.blob)
1302
+ });
1303
+ let m = await fetch(n.endpoint, {
1304
+ method: "POST",
1305
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1306
+ credentials: "omit",
1307
+ body: JSON.stringify(u)
1308
+ }), g = await m.json().catch(() => ({}));
1309
+ if (!m.ok) throw Error(g.error || `HTTP ${m.status}`);
1310
+ $e(g.bug, g.receipt, g.reopened);
1311
+ } catch (e) {
1312
+ y = !1, s.textContent = "Send", A.classList.remove("busy"), L(a), I(`Couldn't send: ${String(e?.message || e).slice(0, 80)} — try again`, !0);
1313
+ }
1314
+ }
1315
+ function $e(e, r = null, i = !1) {
1316
+ L("sent"), n.active(!1), P(!1), W(null), A.classList.add("done");
1317
+ let a = Math.floor(Number(e)) || 0, o = t.thanks?.message ? t.thanks.message.replace(/\{number\}/g, a ? String(a) : "") : i ? `Thanks — bug #${a} is open again, and the team can see what you saw.` : a ? `Sent as bug #${a} — thank you.` : "Sent — thank you.", s = document.createElement("div");
1318
+ s.className = "thanks", s.innerHTML = `<div class="th"><span class="okc" aria-hidden="true">${Oe}</span><b></b></div>`, s.querySelector("b").textContent = o;
1319
+ let c = (Number(X.get(Se)) || 0) + 1;
1320
+ X.set(Se, String(c));
1321
+ let l = pe(t), u = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, d = t.thanks?.teach !== !1 && l.length > 0 && !u && t.via !== "shortcut" && c <= we;
1322
+ if (d) {
1323
+ let e = document.createElement("p");
1324
+ e.className = "teach", e.innerHTML = `Next time, from any page: ${t.trigger === "double-ctrl" ? "tap " : ""}<span class="caps">${me(l)}</span> and click what’s wrong.`, s.append(e);
1325
+ }
1326
+ let f = t.notify && r ? et(r) : null;
1327
+ f && s.append(f), A.replaceChildren(s), t.onSent?.(e);
1328
+ let p = null, m = (e) => {
1329
+ clearTimeout(p), p = setTimeout($, e);
1330
+ };
1331
+ s.addEventListener("pointerenter", () => clearTimeout(p)), s.addEventListener("focusin", () => clearTimeout(p)), s.addEventListener("pointerleave", () => {
1332
+ s.contains(s.getRootNode().activeElement) || m(2500);
1333
+ }), s.addEventListener("focusout", () => m(2500)), m(f ? 6500 : d ? 5200 : 2600);
1334
+ }
1335
+ function et(e) {
1336
+ let r = n.endpoint.replace(/\/api\/point$/, "/api/point-notify"), i = (t) => fetch(r, {
1337
+ method: "POST",
1338
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1339
+ credentials: "omit",
1340
+ body: JSON.stringify({
1341
+ key: n.key,
1342
+ receipt: e,
1343
+ ...t
1344
+ })
1345
+ }), a = !!n.identified?.(), o = document.createElement("div");
1346
+ o.className = "tell", o.innerHTML = "<label class=\"tick\"><input type=\"checkbox\"><span><b>Tell me when it’s fixed</b><small></small></span></label>";
1347
+ let s = o.querySelector("input"), c = o.querySelector("small");
1348
+ s.checked = !!t.notify.tick, c.textContent = a && t.notify.email ? "Here, and by email" : "We’ll show it here next time you visit", s.checked && B(e);
1349
+ let l = null;
1350
+ return t.notify.email && !a && (l = document.createElement("form"), l.className = "mail", l.innerHTML = "<label for=\"sp-mail\">Email me too (optional)</label><div><input id=\"sp-mail\" type=\"email\" autocomplete=\"email\" placeholder=\"you@example.com\" maxlength=\"254\"><button type=\"submit\">Save</button></div><p class=\"mailmsg\" role=\"status\"></p>", l.hidden = !s.checked, l.addEventListener("submit", async (e) => {
1351
+ e.preventDefault();
1352
+ let t = l.querySelector("input"), n = l.querySelector(".mailmsg"), r = t.value.trim();
1353
+ if (r) {
1354
+ n.textContent = "Saving…";
1355
+ try {
1356
+ let e = await i({
1357
+ on: !0,
1358
+ email: r
1359
+ }), a = await e.json().catch(() => ({}));
1360
+ n.textContent = e.ok ? "Saved — one email when it’s fixed, then we delete it" : a.error || "Couldn’t save it", e.ok && (t.disabled = !0);
1361
+ } catch {
1362
+ n.textContent = "Couldn’t save it";
1363
+ }
1364
+ }
1365
+ }), o.append(l)), s.addEventListener("change", () => {
1366
+ let t = s.checked;
1367
+ t ? B(e) : le(e), l && (l.hidden = !t), i({ on: t }).catch(() => {});
1368
+ }), o;
1369
+ }
1370
+ function $() {
1371
+ if (!x) {
1372
+ x = !0, cancelAnimationFrame(b), l && l.stop(), n.active(!1), P(!1);
1373
+ for (let e of Fe) window.removeEventListener(e, he, !0);
1374
+ window.removeEventListener("pointermove", G, !0), window.removeEventListener("keydown", K, !0), w.remove(), N.remove(), t.onClose?.();
1375
+ }
1376
+ }
1377
+ for (let e of Fe) window.addEventListener(e, he, {
1378
+ capture: !0,
1379
+ passive: !1
1380
+ });
1381
+ try {
1382
+ getSelection()?.removeAllRanges();
1383
+ } catch {}
1384
+ window.addEventListener("pointermove", G, !0), window.addEventListener("keydown", K, !0), E(".x").addEventListener("click", $);
1385
+ let tt = !1, nt = (e, t) => {
1386
+ let n = A.offsetWidth, r = A.offsetHeight;
1387
+ A.style.left = `${Math.min(innerWidth - n - 8, Math.max(8, e))}px`, A.style.top = `${Math.min(innerHeight - Math.min(r, 120), Math.max(8, t))}px`, A.style.right = "auto", A.style.bottom = "auto", tt = !0;
1388
+ }, rt = A.querySelector("header");
1389
+ rt.title = "Drag to move", rt.addEventListener("pointerdown", (e) => {
1390
+ if (e.button !== 0 || e.target.closest("button") || innerWidth <= 560) return;
1391
+ let t = A.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
1392
+ A.classList.add("moving");
1393
+ let i = (e) => nt(e.clientX - n, e.clientY - r), a = () => {
1394
+ A.classList.remove("moving"), window.removeEventListener("pointermove", i, !0), window.removeEventListener("pointerup", a, !0);
1395
+ };
1396
+ window.addEventListener("pointermove", i, !0), window.addEventListener("pointerup", a, !0), e.preventDefault();
1397
+ }), E(".send").addEventListener("click", Q), E(".flowbtn").addEventListener("click", () => c && !c.end ? q() : ve()), J.addEventListener("click", Je), E(".vstart").addEventListener("click", qe);
1398
+ for (let e of [".expected", ".actual"]) E(e).addEventListener("input", () => L(a));
1399
+ L("armed"), X.set(Ce, "1");
1400
+ let it = X.get(xe);
1401
+ return Z && it === "yes" && qe(), Qe(!1), C || Xe(), t.target?.isConnected && !w.contains(t.target) && z(t.target, null), {
1402
+ toggle: () => i.length || c?.end ? Q() : $(),
1403
+ released: () => {
1404
+ !i.length && !c && !C && a === "armed" && $();
1405
+ },
1406
+ close: $,
1407
+ send: Q,
1408
+ get markers() {
1409
+ return i.length;
1410
+ },
1411
+ get state() {
1412
+ return a;
1413
+ }
1414
+ };
1415
+ }
1416
+ var Ie = "\n:host{all:initial}\n*{-webkit-user-select:none;user-select:none}\ninput,textarea{-webkit-user-select:text;user-select:text}\n*{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n[hidden]{display:none!important}\n.ring{position:fixed;left:0;top:0;width:24px;height:24px;margin:-12px 0 0 -12px;border-radius:50%;border:2px solid #94A3B8;background:rgba(148,163,184,.12);pointer-events:none;z-index:4;transition:border-color .15s,background .15s;will-change:transform}\n.ring .dot{position:absolute;left:50%;top:50%;width:4px;height:4px;margin:-2px;border-radius:50%;background:#94A3B8}\n.ring .badge{position:absolute;left:16px;top:-12px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#0E1320;color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;display:none}\n.ring[data-state~=\"marking\"]{border-color:#5B4BF0;background:rgba(91,75,240,.16)}\n.ring[data-state~=\"marking\"] .dot{background:#5B4BF0}\n.ring[data-state~=\"armed\"] .badge,.ring[data-state~=\"marking\"] .badge{display:block}\n.ring[data-state~=\"listening\"]{box-shadow:0 0 0 calc(2px + var(--lv,0) * 10px) rgba(91,75,240,.35)}\n.ring[data-state~=\"flow\"]{width:14px;height:14px;margin:-7px 0 0 -7px;border-color:#F43F5E;background:#F43F5E;opacity:.9}\n.ring[data-state~=\"flow\"] .dot{display:none}\n.ring[data-state~=\"sent\"]{display:none}\n.ring:not(.seen){opacity:0}\n@media (prefers-reduced-motion:reduce){.ring{transition:none}}\n.outline{position:fixed;left:0;top:0;border:1.5px solid #5B4BF0;border-radius:3px;background:rgba(91,75,240,.06);pointer-events:none;opacity:0;z-index:2}\n.outline .chip{position:absolute;left:-1px;bottom:100%;margin-bottom:4px;max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#0E1320;color:#fff;font-size:11px;font-weight:600;padding:3px 7px;border-radius:5px}\n.outline.below .chip{bottom:auto;top:100%;margin:4px 0 0}\n.frame{position:fixed;left:0;top:0;display:none;border:1.5px dashed #5B4BF0;background:rgba(91,75,240,.08);pointer-events:none;z-index:2}\n.marks{position:fixed;left:0;top:0;width:0;height:0;z-index:3}\n.mk{position:fixed;left:0;top:0;border:2px solid var(--c);border-radius:4px;pointer-events:none}\n.mk.region{border-style:dashed}\n.mk .pin{position:absolute;left:-11px;top:-11px;width:22px;height:22px;border-radius:50%;border:2px solid #fff;background:var(--c);color:#fff;font:700 11px/18px ui-sans-serif,system-ui;text-align:center;pointer-events:auto;cursor:pointer;padding:0;box-shadow:0 2px 8px rgba(0,0,0,.35)}\n.rail{position:fixed;top:16px;right:16px;width:320px;max-height:calc(100vh - 32px);overflow:auto;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:12px;padding:12px;box-shadow:0 12px 40px rgba(0,0,0,.45);font-size:13px;z-index:5;cursor:default}\n.rail *{cursor:auto}\n.rail header,.rail header *:not(button){cursor:grab}\n.rail.moving,.rail.moving *{cursor:grabbing!important;user-select:none}\n.rail.left{right:auto;left:16px}\n.rail button{cursor:pointer}\n.rail header{display:flex;align-items:center;gap:8px;margin-bottom:8px}\n.rail header b{font-size:14px}\n.hint{flex:1;color:#94A3B8;font-size:11.5px}\n.x{background:none;border:0;color:#94A3B8;font-size:18px;line-height:1;padding:2px 6px}\n.list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}\n.list li{display:grid;grid-template-columns:22px 1fr 18px;gap:4px 8px;align-items:center;background:#151B2B;border:1px solid #232c40;border-radius:8px;padding:6px 8px}\n.num{width:22px;height:22px;border-radius:50%;border:0;background:var(--c);color:#fff;font-weight:700;font-size:11px;padding:0}\n.what{display:flex;align-items:center;gap:6px;min-width:0}\n.name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}\n.flag{border:1px solid var(--c);color:var(--c);background:transparent;border-radius:999px;font-size:10.5px;font-weight:700;padding:1px 7px}\n.note{grid-column:2/4;grid-row:2;width:100%;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:5px 8px;font-size:12.5px;outline:none;resize:none;min-height:28px;field-sizing:content;max-height:120px;line-height:1.45}\n.vcard{margin-top:10px;background:#151B2B;border:1px solid #3b3a7a;border-radius:10px;padding:12px}\n.vcard b{font-size:13.5px}\n.vcard p{margin:6px 0;color:#C3C8D4;font-size:12.5px;line-height:1.5}\n.vcard .fine{color:#94A3B8;font-size:11.5px}\n.vcard .c{text-align:center;margin-bottom:0}\n.kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace}\n.caps{display:inline-flex;gap:3px;vertical-align:middle;margin:0 2px}\n.vstart{width:100%;height:44px;margin-top:6px;display:flex;align-items:center;justify-content:center;gap:8px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;font-size:13.5px}\n.vstart svg,.mic svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}\n.listening{margin-top:10px;background:rgba(255,255,255,.04);border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:8px}\n.lh{display:flex;align-items:center;gap:8px;font-size:12px;color:#C3C8D4}\n.rd{width:8px;height:8px;border-radius:50%;background:#F87171;box-shadow:0 0 0 4px rgba(248,113,113,.2)}\n.bars{margin-left:auto;display:flex;align-items:flex-end;gap:2px;height:14px}\n.bars i{display:block;width:3px;border-radius:2px;background:#14C8A6;height:calc(3px + var(--lv,0) * 11px)}\n.bars i:nth-child(2){height:calc(5px + var(--lv,0) * 9px)}.bars i:nth-child(3){height:calc(3px + var(--lv,0) * 8px)}.bars i:nth-child(4){height:calc(6px + var(--lv,0) * 8px)}.bars i:nth-child(5){height:calc(2px + var(--lv,0) * 6px)}\n.cap{margin:0;font-size:14px;line-height:1.6;color:#F4F5F8;min-height:1.6em}\n.cap .said{color:var(--c);font-weight:600}\n.listening .fine{margin:0;font-size:11px;color:#8A93A6;line-height:1.5}\n.flowbtn{margin-top:10px;width:100%;background:#151B2B;border:1px solid #2a3346;color:#E6E8EE;border-radius:8px;padding:7px 8px;font-size:12px;font-weight:600}\n.flowbtn.on{border-color:#F43F5E;color:#FDA4AF}\n.bottom{gap:8px}\n.mic{flex:none;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:transparent;border:1px solid rgba(169,160,255,.5);color:#A9A0FF;padding:0}\n.mic.on{background:#F87171;border-color:#F87171;color:#0E1320}\n.typei{height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.12);border-radius:10px;background:transparent;color:#C3C8D4;font-size:13px}\n.send{flex:1;height:44px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;padding:0 16px;font-size:14px}\n.send:disabled{opacity:.45;cursor:default}\n.rail.busy .send:disabled{opacity:1}\n.rail.busy .list,.rail.busy .exp,.rail.busy .flowbtn,.rail.busy .mic,.rail.busy .typei,.rail.busy .listening{opacity:.5;pointer-events:none}\n.send{display:flex;align-items:center;justify-content:center;gap:8px}\n.spin{width:15px;height:15px;border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;animation:sp-spin .7s linear infinite}\n@keyframes sp-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:2s}}\n@media (max-width:560px){.rail{top:auto;left:8px;right:8px;bottom:8px;width:auto;max-height:55vh;border-radius:14px}.howto{width:calc(100vw - 24px);bottom:auto;top:12px}}\n.rail.done{width:auto;max-width:360px;padding:14px 16px}\n.thanks{margin:0;color:#F4F5F8;display:flex;flex-direction:column;gap:8px}\n.th{display:flex;align-items:center;gap:10px}\n.th b{font-size:14px;font-weight:600}\n.okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}\n.okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.teach{margin:0;font-size:13px;line-height:1.7;color:#C3C8D4}\n.tell{border-top:1px solid rgba(255,255,255,.1);padding-top:12px;display:flex;flex-direction:column;gap:10px}\n.tick{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.5;color:#C3C8D4;cursor:pointer}\n.tick input{width:16px;height:16px;margin:2px 0 0;flex:none;accent-color:#14C8A6;cursor:pointer}\n.tick b{display:block;color:#F4F5F8;font-weight:600}\n.tick small{font-size:13px}\n.mail{display:flex;flex-direction:column;gap:6px;padding-left:26px;margin:0}\n.mail label{font-size:12px;color:#C3C8D4}\n.mail div{display:flex;gap:8px}\n.mail input{flex:1;min-width:0;height:34px;border-radius:8px;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.06);color:#F4F5F8;padding:0 10px;font:inherit;font-size:13px}\n.mail input:disabled{opacity:.6}\n.mail button{height:34px;padding:0 14px;border:0;border-radius:8px;background:#F4F5F8;color:#0E1320;font:inherit;font-size:13px;font-weight:600;cursor:pointer}\n.mailmsg{margin:0;font-size:12px;color:#8A93A6}\n.mailmsg:empty{display:none}\n.keep{display:flex;gap:6px;align-items:center;margin-top:10px;font-size:12px;color:#C3C8D4}\n.note:focus,.exp input:focus{border-color:#5B4BF0}\n.rm{grid-column:3;grid-row:1;background:none;border:0;color:#64748B;font-size:15px;padding:0}\n.empty{color:#94A3B8;margin:6px 0 8px;font-size:12.5px}\n.row{display:flex;align-items:center;gap:8px;margin-top:10px}\n.exp{margin-top:10px;color:#94A3B8;font-size:12px}\n.exp summary{cursor:pointer}\n.exp input{display:block;width:100%;margin-top:6px;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:6px 8px;font-size:12.5px;outline:none}\n.status{margin:8px 0 0;font-size:12px;color:#94A3B8;min-height:1em}\n.status:empty{display:none}\n.status.bad{color:#FCA5A5}\n.howto{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);width:360px;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:14px;padding:14px;box-shadow:0 16px 50px rgba(0,0,0,.5);z-index:6;font-size:13px}\n.howto ol{margin:10px 0 8px;padding-left:20px;line-height:1.7}\n.howto .ok{background:#5B4BF0;border:0;color:#fff;border-radius:8px;padding:6px 12px;font-weight:700;cursor:pointer}\n.scene{position:relative;height:96px;border-radius:9px;background:#151B2B;overflow:hidden}\n.scene .page{position:absolute;inset:12px 14px}\n.scene .page i{display:block;height:8px;border-radius:4px;background:#232c40;margin-bottom:8px;width:70%}\n.scene .page i+i{width:45%}\n.scene .btn{position:absolute;right:10px;bottom:6px;background:#2E86F0;color:#fff;font-size:11px;padding:5px 14px;border-radius:6px}\n.scene .cur{position:absolute;left:30px;top:20px;width:18px;height:18px;margin:-9px;border-radius:50%;border:2px solid #94A3B8;animation:sp-move 8s infinite}\n.scene .pinh{position:absolute;right:62px;bottom:20px;width:18px;height:18px;border-radius:50%;background:#F43F5E;color:#fff;font:700 10px/18px ui-sans-serif,system-ui;text-align:center;opacity:0;animation:sp-pin 8s infinite}\n.scene .wave{position:absolute;left:20px;bottom:16px;width:40px;height:10px;border-radius:5px;background:linear-gradient(90deg,#5B4BF0,#2E86F0);opacity:0;animation:sp-wave 8s infinite}\n@keyframes sp-move{0%,8%{transform:translate(0,0);border-color:#94A3B8}30%,100%{transform:translate(250px,52px);border-color:#5B4BF0}}\n@keyframes sp-pin{0%,34%{opacity:0;transform:scale(.4)}40%,100%{opacity:1;transform:scale(1)}}\n@keyframes sp-wave{0%,48%{opacity:0;transform:scaleX(.3)}55%,60%{opacity:1;transform:scaleX(1)}65%,70%{opacity:1;transform:scaleX(.5)}75%,85%{opacity:1;transform:scaleX(1)}92%,100%{opacity:0}}\n@media (prefers-reduced-motion:reduce){.scene .cur,.scene .pinh,.scene .wave{animation:none}.scene .pinh,.scene .wave{opacity:1}.scene .cur{transform:translate(250px,52px)}}\n";
1417
+ //#endregion
1418
+ export { be as FLAGS, q as mountEntry, Z as openPoint, ye as showFixed };