@fixback/sdk 0.1.0 → 0.2.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.
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- function me(e) {
1
+ function Rt(e) {
2
2
  return `${e.replace(/\/+$/, "")}/api/ingest/boot`;
3
3
  }
4
- function ge(e) {
4
+ function $t(e) {
5
5
  if (typeof e != "object" || e === null) return !1;
6
6
  const t = e;
7
7
  return typeof t.originAllowed == "boolean" && typeof t.canSubmit == "boolean" && typeof t.gate == "string" && (t.tier === null || typeof t.tier == "string");
8
8
  }
9
- async function xe(e, t, o = fetch) {
9
+ async function Nt(e, t, o = fetch) {
10
10
  let n;
11
11
  try {
12
- n = await o(me(e), {
12
+ n = await o(Rt(e), {
13
13
  method: "POST",
14
14
  headers: { "content-type": "application/json" },
15
15
  body: JSON.stringify(t)
@@ -24,30 +24,1062 @@ async function xe(e, t, o = fetch) {
24
24
  } catch {
25
25
  return null;
26
26
  }
27
- return ge(i) ? i : null;
27
+ return $t(i) ? i : null;
28
28
  }
29
- var J = "fixback.anonymousId";
30
- function Z() {
29
+ var tt = ["data-fixback-root", "data-fixback-overlay"], Bt = tt.map((e) => `[${e}]`).join(",");
30
+ function _e(e) {
31
+ let t = e instanceof Node ? e : null;
32
+ for (; t; ) {
33
+ if (t instanceof Element) {
34
+ for (const n of tt) if (t.hasAttribute(n)) return !0;
35
+ }
36
+ const o = t.getRootNode();
37
+ if (o instanceof ShadowRoot && o !== t) {
38
+ t = o.host;
39
+ continue;
40
+ }
41
+ t = t.parentNode;
42
+ }
43
+ return !1;
44
+ }
45
+ function Pt(e) {
46
+ for (const t of Array.from(e.querySelectorAll(Bt))) t.remove();
47
+ }
48
+ function je(e) {
49
+ const t = globalThis.CSS;
50
+ return t != null && t.escape ? t.escape(e) : e.replace(/[^\w-]/g, (o) => `\\${o}`);
51
+ }
52
+ function Ot(e) {
53
+ let t = 1, o = e.previousElementSibling;
54
+ for (; o; )
55
+ o.tagName === e.tagName && (t += 1), o = o.previousElementSibling;
56
+ return t;
57
+ }
58
+ function ot(e) {
59
+ if (e.id) return `#${je(e.id)}`;
60
+ const t = [];
61
+ let o = e;
62
+ for (; o && o.tagName.toLowerCase() !== "html"; ) {
63
+ if (o.id) {
64
+ t.unshift(`#${je(o.id)}`);
65
+ break;
66
+ }
67
+ const n = o.tagName.toLowerCase(), i = o.parentElement;
68
+ if (i) {
69
+ const r = Array.from(i.children).filter((s) => s.tagName === o.tagName);
70
+ t.unshift(r.length > 1 ? `${n}:nth-of-type(${Ot(o)})` : n);
71
+ } else t.unshift(n);
72
+ o = i;
73
+ }
74
+ return t.join(" > ");
75
+ }
76
+ function Ut(e) {
77
+ const t = e.tagName.toLowerCase();
78
+ if (e.id) return `${t}#${e.id}`;
79
+ const o = e.classList[0];
80
+ return o ? `${t}.${o}` : t;
81
+ }
82
+ function zt(e) {
83
+ const t = [];
84
+ let o = e;
85
+ for (; o; )
86
+ t.unshift(Ut(o)), o = o.parentElement;
87
+ return t.join(" > ");
88
+ }
89
+ function Dt(e) {
90
+ const t = e.getBoundingClientRect();
91
+ return {
92
+ x: Math.round(t.x),
93
+ y: Math.round(t.y),
94
+ width: Math.round(t.width),
95
+ height: Math.round(t.height)
96
+ };
97
+ }
98
+ function jt(e) {
99
+ return {
100
+ selector: ot(e),
101
+ domPath: zt(e),
102
+ tag: e.tagName.toLowerCase(),
103
+ rect: Dt(e)
104
+ };
105
+ }
106
+ function Ft(e) {
107
+ var t, o;
108
+ const n = (t = e.doc) !== null && t !== void 0 ? t : document, i = (o = e.ignore) !== null && o !== void 0 ? o : _e;
109
+ let r = null, s = !1;
110
+ function f(b) {
111
+ var u;
112
+ const m = (u = (typeof b.composedPath == "function" ? b.composedPath() : [])[0]) !== null && u !== void 0 ? u : b.target;
113
+ return m instanceof Element ? i(m) ? null : m : null;
114
+ }
115
+ function l(b) {
116
+ var u;
117
+ s || (r = f(b), (u = e.onHover) === null || u === void 0 || u.call(e, r));
118
+ }
119
+ function d(b) {
120
+ var u;
121
+ if (s) return;
122
+ const m = (u = f(b)) !== null && u !== void 0 ? u : r;
123
+ m && (b.preventDefault(), b.stopPropagation(), a(), e.onPick(m));
124
+ }
125
+ function h(b) {
126
+ if (!s && b.key === "Escape") {
127
+ var u;
128
+ b.preventDefault(), a(), (u = e.onCancel) === null || u === void 0 || u.call(e);
129
+ }
130
+ }
131
+ function a() {
132
+ s || (s = !0, n.removeEventListener("mouseover", l, !0), n.removeEventListener("click", d, !0), n.removeEventListener("keydown", h, !0), r = null);
133
+ }
134
+ return n.addEventListener("mouseover", l, !0), n.addEventListener("click", d, !0), n.addEventListener("keydown", h, !0), { stop: a };
135
+ }
136
+ var Ht = 7, Vt = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, Xt = new RegExp(`\\d{${Ht},}`, "g"), Gt = /\b(bearer|token)\s+[\w.\-~+/]+=*/gi, Yt = /\bhttps?:\/\/[^\s"'<>]+/gi;
137
+ function Kt(e) {
138
+ return typeof e != "string" || e.length === 0 ? e : e.replace(Vt, "[redacted-email]").replace(Gt, (t, o) => `${o} [redacted]`).replace(Xt, "[redacted-number]");
139
+ }
140
+ function X(e) {
141
+ if (typeof e != "string" || e.length === 0) return e;
142
+ let t = e;
143
+ return t = t.replace(/(^[a-z][a-z0-9+.-]*:\/\/)[^/@?#]*@/i, "$1"), t = t.replace(/\?[^#]*/, ""), t = t.replace(/#.*$/, (o) => o.includes("=") ? "" : o), t;
144
+ }
145
+ function qt(e) {
146
+ const t = { ...e };
147
+ return typeof t.url == "string" && (t.url = X(t.url)), typeof t.from == "string" && (t.from = X(t.from)), typeof t.to == "string" && (t.to = X(t.to)), t;
148
+ }
149
+ function Wt(e) {
150
+ return Kt(e.replace(Yt, (t) => X(t)));
151
+ }
152
+ function Zt(e) {
153
+ const t = { ...e };
154
+ return typeof t.message == "string" && (t.message = Wt(t.message)), t.data && (t.data = qt(t.data)), t;
155
+ }
156
+ function Jt(e) {
157
+ const t = { ...e };
158
+ return typeof t.url == "string" && (t.url = X(t.url)), t.trace && t.trace.length > 0 && (t.trace = t.trace.map(Zt)), t;
159
+ }
160
+ function nt(e, t = {}) {
161
+ const o = t.scrub === !1 ? e : Jt(e), n = t.hook;
162
+ if (!n) return o;
163
+ try {
164
+ const i = n(o);
165
+ return i != null ? i : null;
166
+ } catch {
167
+ return o;
168
+ }
169
+ }
170
+ var Qt = [
171
+ "warn",
172
+ "error",
173
+ "assert"
174
+ ];
175
+ function eo(e) {
176
+ return typeof e != "number" || !Number.isFinite(e) || e < 1 ? 30 : Math.floor(e);
177
+ }
178
+ function to(e = {}) {
179
+ var t;
180
+ const o = eo(e.maxBreadcrumbs), n = e.maxAgeMs, i = e.beforeBreadcrumb, r = (t = e.now) !== null && t !== void 0 ? t : Date.now;
181
+ let s = [];
182
+ function f() {
183
+ if (typeof n == "number" && n > 0 && s.length > 0) {
184
+ const l = r() - n;
185
+ s = s.filter((d) => d.timestamp >= l);
186
+ }
187
+ }
188
+ return {
189
+ add(l) {
190
+ let d = l;
191
+ if (i) try {
192
+ d = i(l);
193
+ } catch {
194
+ d = l;
195
+ }
196
+ d && (s.push(d), f(), s.length > o && (s = s.slice(-o)));
197
+ },
198
+ snapshot() {
199
+ return f(), s.slice();
200
+ },
201
+ clear() {
202
+ s = [];
203
+ }
204
+ };
205
+ }
206
+ var Fe = 300;
207
+ function rt(e) {
208
+ if (typeof e == "string") return e;
209
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
210
+ if (e == null || typeof e == "number" || typeof e == "boolean") return String(e);
211
+ try {
212
+ var t;
213
+ return (t = JSON.stringify(e)) !== null && t !== void 0 ? t : String(e);
214
+ } catch {
215
+ return "[object]";
216
+ }
217
+ }
218
+ function oo(e) {
219
+ const t = e.map(rt).join(" ");
220
+ return t.length > Fe ? `${t.slice(0, Fe)}…` : t;
221
+ }
222
+ function He(e, t, o) {
223
+ return {
224
+ category: "console",
225
+ level: e,
226
+ message: oo(t),
227
+ timestamp: o
228
+ };
229
+ }
230
+ function no(e, t, o) {
231
+ const n = X(e), i = X(t);
232
+ return {
233
+ category: "navigation",
234
+ message: `${n} → ${i}`,
235
+ timestamp: o,
236
+ data: {
237
+ from: n,
238
+ to: i
239
+ }
240
+ };
241
+ }
242
+ function it(e, t, o, n, i) {
243
+ const r = X(o), s = n ? {
244
+ method: t,
245
+ url: r,
246
+ status: n
247
+ } : {
248
+ method: t,
249
+ url: r
250
+ };
251
+ return {
252
+ category: e,
253
+ message: `${t} ${r}${n ? ` [${n}]` : ""}`,
254
+ timestamp: i,
255
+ data: s
256
+ };
257
+ }
258
+ function Ve(e, t, o, n) {
259
+ return it("fetch", e, t, o, n);
260
+ }
261
+ function ro(e, t, o, n) {
262
+ return it("xhr", e, t, o, n);
263
+ }
264
+ function at(e) {
265
+ try {
266
+ return ot(e);
267
+ } catch {
268
+ return e.tagName ? e.tagName.toLowerCase() : "unknown";
269
+ }
270
+ }
271
+ function io(e, t) {
272
+ const o = at(e);
273
+ return {
274
+ category: "ui.click",
275
+ message: `click ${o}`,
276
+ timestamp: t,
277
+ data: { target: o }
278
+ };
279
+ }
280
+ function ao(e, t) {
281
+ const o = at(e);
282
+ return {
283
+ category: "ui.input",
284
+ message: `input ${o}`,
285
+ timestamp: t,
286
+ data: { target: o }
287
+ };
288
+ }
289
+ function so(e) {
290
+ return e instanceof Error ? {
291
+ name: e.name || "Error",
292
+ message: e.message
293
+ } : typeof e == "string" ? {
294
+ name: "Error",
295
+ message: e
296
+ } : {
297
+ name: "Error",
298
+ message: rt(e)
299
+ };
300
+ }
301
+ function lo(e, t) {
302
+ const { name: o, message: n } = so(e);
303
+ return {
304
+ category: "error",
305
+ level: "error",
306
+ message: n ? `${o}: ${n}` : o,
307
+ timestamp: t,
308
+ data: { errorType: o }
309
+ };
310
+ }
311
+ function Te() {
312
+ }
313
+ function co(e, t, o, n) {
314
+ const i = [];
315
+ for (const r of o) {
316
+ const s = t[r];
317
+ if (typeof s != "function") continue;
318
+ const f = (...l) => {
319
+ try {
320
+ r === "assert" ? l[0] || e.add(He("assert", l.slice(1), n())) : e.add(He(r, l, n()));
321
+ } catch {
322
+ }
323
+ return s.apply(t, l);
324
+ };
325
+ t[r] = f, i.push(() => {
326
+ t[r] = s;
327
+ });
328
+ }
329
+ return () => {
330
+ for (const r of i) r();
331
+ };
332
+ }
333
+ function uo(e) {
334
+ return typeof e == "string" ? e : e instanceof URL ? e.toString() : e.url;
335
+ }
336
+ function fo(e, t) {
337
+ var o, n;
338
+ return ((o = (n = t == null ? void 0 : t.method) !== null && n !== void 0 ? n : typeof e == "object" && "method" in e ? e.method : void 0) !== null && o !== void 0 ? o : "GET").toUpperCase();
339
+ }
340
+ function bo(e, t, o, n) {
341
+ const i = t.fetch;
342
+ if (typeof i != "function") return Te;
343
+ const r = (s, f) => {
344
+ const l = uo(s), d = fo(s, f), h = i.call(t, s, f);
345
+ return o(l) ? h : h.then((a) => {
346
+ try {
347
+ e.add(Ve(d, l, a.status, n()));
348
+ } catch {
349
+ }
350
+ return a;
351
+ }, (a) => {
352
+ try {
353
+ e.add(Ve(d, l, void 0, n()));
354
+ } catch {
355
+ }
356
+ throw a;
357
+ });
358
+ };
359
+ return t.fetch = r, () => {
360
+ t.fetch = i;
361
+ };
362
+ }
363
+ function po(e, t, o, n) {
364
+ const i = t.XMLHttpRequest;
365
+ if (typeof i != "function") return Te;
366
+ const r = i.prototype, s = r.open, f = r.send;
367
+ return r.open = function(l, d, ...h) {
368
+ return this.__fixbackMeta = {
369
+ method: String(l).toUpperCase(),
370
+ url: String(d)
371
+ }, s.call(this, l, d, ...h);
372
+ }, r.send = function(l) {
373
+ const d = this.__fixbackMeta;
374
+ if (d && !o(d.url)) {
375
+ const h = () => {
376
+ try {
377
+ e.add(ro(d.method, d.url, this.status || void 0, n()));
378
+ } catch {
379
+ }
380
+ this.removeEventListener("loadend", h);
381
+ };
382
+ this.addEventListener("loadend", h);
383
+ }
384
+ return f.call(this, l);
385
+ }, () => {
386
+ r.open = s, r.send = f;
387
+ };
388
+ }
389
+ function ho(e, t, o) {
390
+ const n = t.history, i = t.location;
391
+ if (!n || !i) return Te;
392
+ let r = i.href;
393
+ const s = (a) => {
394
+ try {
395
+ e.add(no(r, a, o()));
396
+ } catch {
397
+ }
398
+ r = a;
399
+ }, f = n.pushState, l = n.replaceState;
400
+ n.pushState = function(a, b, u) {
401
+ const m = f.call(this, a, b, u);
402
+ return s(i.href), m;
403
+ }, n.replaceState = function(a, b, u) {
404
+ const m = l.call(this, a, b, u);
405
+ return s(i.href), m;
406
+ };
407
+ const d = () => s(i.href), h = () => s(i.href);
408
+ return t.addEventListener("popstate", d), t.addEventListener("hashchange", h), () => {
409
+ n.pushState = f, n.replaceState = l, t.removeEventListener("popstate", d), t.removeEventListener("hashchange", h);
410
+ };
411
+ }
412
+ function Xe(e) {
413
+ var t;
414
+ const o = (t = (typeof e.composedPath == "function" ? e.composedPath() : [])[0]) !== null && t !== void 0 ? t : e.target;
415
+ return o instanceof Element ? o : null;
416
+ }
417
+ function vo(e, t, o) {
418
+ const n = (r) => {
419
+ const s = Xe(r);
420
+ if (!(!s || _e(s)))
421
+ try {
422
+ e.add(io(s, o()));
423
+ } catch {
424
+ }
425
+ }, i = (r) => {
426
+ const s = Xe(r);
427
+ if (!(!s || _e(s)))
428
+ try {
429
+ e.add(ao(s, o()));
430
+ } catch {
431
+ }
432
+ };
433
+ return t.addEventListener("click", n, !0), t.addEventListener("input", i, !0), () => {
434
+ t.removeEventListener("click", n, !0), t.removeEventListener("input", i, !0);
435
+ };
436
+ }
437
+ function mo(e, t = {}) {
438
+ var o, n, i, r, s, f;
439
+ const l = (o = t.win) !== null && o !== void 0 ? o : globalThis, d = (n = t.doc) !== null && n !== void 0 ? n : typeof document != "undefined" ? document : void 0, h = (i = t.consoleObj) !== null && i !== void 0 ? i : typeof console != "undefined" ? console : void 0, a = (r = t.consoleLevels) !== null && r !== void 0 ? r : Qt, b = (s = t.ignoreUrl) !== null && s !== void 0 ? s : (() => !1), u = (f = t.now) !== null && f !== void 0 ? f : Date.now, m = [];
440
+ return h && m.push(co(e, h, a, u)), l && (m.push(bo(e, l, b, u)), m.push(po(e, l, b, u)), m.push(ho(e, l, u))), d && m.push(vo(e, d, u)), () => {
441
+ for (const p of m) try {
442
+ p();
443
+ } catch {
444
+ }
445
+ };
446
+ }
447
+ var go = "#e5484d";
448
+ function Ge(e, t, o, n) {
449
+ return {
450
+ x: Math.round(Math.min(e, o)),
451
+ y: Math.round(Math.min(t, n)),
452
+ width: Math.round(Math.abs(o - e)),
453
+ height: Math.round(Math.abs(n - t))
454
+ };
455
+ }
456
+ function xo(e, t, o, n, i = 14) {
457
+ const r = Math.atan2(n - t, o - e);
458
+ return [
459
+ {
460
+ x: o,
461
+ y: n
462
+ },
463
+ {
464
+ x: o - i * Math.cos(r - Math.PI / 6),
465
+ y: n - i * Math.sin(r - Math.PI / 6)
466
+ },
467
+ {
468
+ x: o - i * Math.cos(r + Math.PI / 6),
469
+ y: n - i * Math.sin(r + Math.PI / 6)
470
+ }
471
+ ];
472
+ }
473
+ function yo(e) {
474
+ const t = {};
475
+ return e.element && (t.element = e.element), e.region && (t.region = e.region), e.marks && e.marks.length > 0 && (t.marks = e.marks.slice()), Object.keys(t).length > 0 ? t : void 0;
476
+ }
477
+ function st(e, t) {
478
+ var o;
479
+ const n = {}, i = e.innerWidth;
480
+ typeof i == "number" && i > 0 && (n.viewportWidth = Math.round(i));
481
+ const r = e.innerHeight;
482
+ typeof r == "number" && r > 0 && (n.viewportHeight = Math.round(r));
483
+ const s = (o = e.navigator) === null || o === void 0 ? void 0 : o.userAgent;
484
+ return typeof s == "string" && s.length > 0 && (n.browser = s), t.length > 0 && (n.sdkVersion = t), n;
485
+ }
486
+ function lt(e) {
487
+ var t;
488
+ const o = {};
489
+ e.kind && (o.kind = e.kind);
490
+ const n = (t = e.comment) === null || t === void 0 ? void 0 : t.trim();
491
+ n && (o.comment = n), e.url && (o.url = e.url), e.environment && Object.keys(e.environment).length > 0 && (o.environment = e.environment);
492
+ const i = yo({
493
+ element: e.element,
494
+ region: e.region,
495
+ marks: e.marks
496
+ });
497
+ return i && (o.annotation = i), e.trace && e.trace.length > 0 && (o.trace = e.trace), o;
498
+ }
499
+ var wo = 32, ko = /* @__PURE__ */ new Set([
500
+ "button",
501
+ "submit",
502
+ "reset",
503
+ "checkbox",
504
+ "radio",
505
+ "range",
506
+ "color",
507
+ "file",
508
+ "image",
509
+ "hidden"
510
+ ]);
511
+ function ye(e) {
512
+ const t = Math.min(Math.max(e, 1), wo);
513
+ return "•".repeat(t);
514
+ }
515
+ function Eo(e) {
516
+ for (const n of Array.from(e.querySelectorAll("input"))) {
517
+ var t;
518
+ const i = ((t = n.getAttribute("type")) !== null && t !== void 0 ? t : "text").toLowerCase();
519
+ if (ko.has(i)) continue;
520
+ const r = n.value;
521
+ if (!r) continue;
522
+ const s = ye(r.length);
523
+ n.value = s, n.setAttribute("value", s);
524
+ }
525
+ for (const n of Array.from(e.querySelectorAll("textarea"))) {
526
+ const i = n.value || n.textContent || "";
527
+ if (!i) continue;
528
+ const r = ye(i.length);
529
+ n.value = r, n.textContent = r;
530
+ }
531
+ for (const n of Array.from(e.querySelectorAll("[contenteditable]"))) {
532
+ var o;
533
+ if (n.getAttribute("contenteditable") === "false") continue;
534
+ const i = (o = n.textContent) !== null && o !== void 0 ? o : "";
535
+ i.trim() && (n.textContent = ye(i.length));
536
+ }
537
+ }
538
+ var _o = {
539
+ "image/png": "png",
540
+ "image/jpeg": "jpg",
541
+ "image/webp": "webp",
542
+ "image/gif": "gif"
543
+ };
544
+ function ct(e) {
545
+ var t;
546
+ return (t = _o[e]) !== null && t !== void 0 ? t : "png";
547
+ }
548
+ function Ye(e, t, o) {
549
+ const n = e == null ? void 0 : e[`inner${o}`], i = t.documentElement[`client${o}`];
550
+ return Math.max(1, Math.round((typeof n == "number" && n > 0 ? n : i) || 0) || 1);
551
+ }
552
+ function So(e, t, o) {
553
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${o}"><foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(e)}</div></foreignObject></svg>`;
554
+ }
555
+ var To = 4e3, Co = (e, { width: t, height: o, type: n }) => new Promise((i) => {
556
+ let r = !1;
557
+ const s = (f) => {
558
+ r || (r = !0, i(f));
559
+ };
560
+ try {
561
+ const f = new Image(), l = setTimeout(() => s(null), To);
562
+ f.onload = () => {
563
+ try {
564
+ const d = document.createElement("canvas");
565
+ d.width = t, d.height = o;
566
+ const h = d.getContext("2d");
567
+ if (!h) {
568
+ clearTimeout(l), s(null);
569
+ return;
570
+ }
571
+ h.drawImage(f, 0, 0), d.toBlob((a) => {
572
+ clearTimeout(l), s(a);
573
+ }, n);
574
+ } catch {
575
+ clearTimeout(l), s(null);
576
+ }
577
+ }, f.onerror = () => {
578
+ clearTimeout(l), s(null);
579
+ }, f.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
580
+ } catch {
581
+ s(null);
582
+ }
583
+ });
584
+ async function dt(e = {}) {
585
+ try {
586
+ var t, o, n, i, r, s;
587
+ const f = (t = e.doc) !== null && t !== void 0 ? t : document, l = (o = (n = e.win) !== null && n !== void 0 ? n : f.defaultView) !== null && o !== void 0 ? o : void 0, d = (i = e.target) !== null && i !== void 0 ? i : f.documentElement, h = (r = e.type) !== null && r !== void 0 ? r : "image/png", a = Ye(l, f, "Width"), b = Ye(l, f, "Height"), u = d.cloneNode(!0);
588
+ Pt(u), Eo(u);
589
+ const m = So(u, a, b), p = await ((s = e.rasterize) !== null && s !== void 0 ? s : Co)(m, {
590
+ width: a,
591
+ height: b,
592
+ type: h
593
+ });
594
+ return p ? {
595
+ blob: p,
596
+ width: a,
597
+ height: b,
598
+ type: h
599
+ } : null;
600
+ } catch {
601
+ return null;
602
+ }
603
+ }
604
+ function ne(e) {
605
+ "@babel/helpers - typeof";
606
+ return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
607
+ return typeof t;
608
+ } : function(t) {
609
+ return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
610
+ }, ne(e);
611
+ }
612
+ function Lo(e, t) {
613
+ if (ne(e) != "object" || !e) return e;
614
+ var o = e[Symbol.toPrimitive];
615
+ if (o !== void 0) {
616
+ var n = o.call(e, t || "default");
617
+ if (ne(n) != "object") return n;
618
+ throw new TypeError("@@toPrimitive must return a primitive value.");
619
+ }
620
+ return (t === "string" ? String : Number)(e);
621
+ }
622
+ function Mo(e) {
623
+ var t = Lo(e, "string");
624
+ return ne(t) == "symbol" ? t : t + "";
625
+ }
626
+ function W(e, t, o) {
627
+ return (t = Mo(t)) in e ? Object.defineProperty(e, t, {
628
+ value: o,
629
+ enumerable: !0,
630
+ configurable: !0,
631
+ writable: !0
632
+ }) : e[t] = o, e;
633
+ }
634
+ function Ao(e, t) {
635
+ if (e == null) return 60;
636
+ const o = e.trim();
637
+ if (o === "") return 60;
638
+ if (/^\d+$/.test(o)) return Number(o);
639
+ const n = Date.parse(o);
640
+ return Number.isNaN(n) ? 60 : Math.max(0, Math.ceil((n - t) / 1e3));
641
+ }
642
+ var Io = class {
643
+ constructor(e = Date.now) {
644
+ W(this, "now", void 0), W(this, "pausedUntil", 0), this.now = e;
645
+ }
646
+ isPaused() {
647
+ return this.now() < this.pausedUntil;
648
+ }
649
+ retryAfterSeconds() {
650
+ return Math.max(0, Math.ceil((this.pausedUntil - this.now()) / 1e3));
651
+ }
652
+ hold(e) {
653
+ const t = this.now(), o = Ao(e, t), n = t + o * 1e3;
654
+ return n > this.pausedUntil && (this.pausedUntil = n), o;
655
+ }
656
+ }, Ro = "screenshot", $o = new Io();
657
+ function No(e) {
658
+ return `${e.replace(/\/+$/, "")}/api/ingest/feedback`;
659
+ }
660
+ function Bo(e) {
661
+ if (!e) return {};
662
+ const t = {};
663
+ return e.signedIdentity && (t.signedIdentity = e.signedIdentity), e.reporterId && (t.reporterId = e.reporterId), e.anonymousId && (t.anonymousId = e.anonymousId), t;
664
+ }
665
+ async function ut(e, t, o = fetch, n = $o) {
666
+ var i, r;
667
+ const s = (i = t.content.source) !== null && i !== void 0 ? i : "reporter", f = s === "auto";
668
+ if (f && n.isPaused()) return {
669
+ ok: !1,
670
+ reason: "backpressure",
671
+ retryAfterSeconds: n.retryAfterSeconds()
672
+ };
673
+ const l = {
674
+ key: t.key,
675
+ ...Bo(t.identity),
676
+ ...t.content,
677
+ source: s
678
+ }, d = new FormData();
679
+ if (d.append("payload", JSON.stringify(l)), !((r = t.screenshot) === null || r === void 0) && r.blob) {
680
+ var h;
681
+ d.append(Ro, t.screenshot.blob, (h = t.screenshot.filename) !== null && h !== void 0 ? h : "screenshot.png");
682
+ }
683
+ let a;
684
+ try {
685
+ a = await o(No(e), {
686
+ method: "POST",
687
+ body: d
688
+ });
689
+ } catch {
690
+ return {
691
+ ok: !1,
692
+ reason: "unreachable"
693
+ };
694
+ }
695
+ if (!a.ok)
696
+ return f && a.status === 429 ? {
697
+ ok: !1,
698
+ reason: "backpressure",
699
+ retryAfterSeconds: n.hold(a.headers.get("Retry-After"))
700
+ } : {
701
+ ok: !1,
702
+ reason: "refused",
703
+ status: a.status
704
+ };
705
+ try {
706
+ return {
707
+ ok: !0,
708
+ feedback: await a.json()
709
+ };
710
+ } catch {
711
+ return {
712
+ ok: !0,
713
+ feedback: null
714
+ };
715
+ }
716
+ }
717
+ var de = "0.1.0";
718
+ var Po = 2e3;
719
+ var Oo = 5, Uo = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, zo = /\bhttps?:\/\/[^\s"')]+/gi, Do = /\b0x[0-9a-f]+\b/gi, jo = /\b[0-9a-f]{8,}\b/gi, Fo = /\d{4,}/g;
720
+ function Ho(e) {
721
+ return typeof e != "string" || e.length === 0 ? "" : e.replace(Uo, "<uuid>").replace(zo, "<url>").replace(Do, "<hex>").replace(jo, "<hex>").replace(Fo, "<n>").trim();
722
+ }
723
+ function Vo(e) {
724
+ let t = 2166136261;
725
+ for (let o = 0; o < e.length; o++)
726
+ t ^= e.charCodeAt(o), t = Math.imul(t, 16777619);
727
+ return (t >>> 0).toString(36);
728
+ }
729
+ function we(e) {
730
+ const t = e.replace(/\?[^:]*/, ""), o = t.lastIndexOf("/");
731
+ return o >= 0 ? t.slice(o + 1) : t;
732
+ }
733
+ function Xo(e) {
734
+ var t, o, n;
735
+ const i = e.match(/^at\s+(.+?)\s+\((.+)\)$/);
736
+ if (i) return `${(t = i[1]) !== null && t !== void 0 ? t : ""}@${we((o = i[2]) !== null && o !== void 0 ? o : "")}`;
737
+ const r = e.match(/^at\s+(.+)$/);
738
+ if (r) return `@${we((n = r[1]) !== null && n !== void 0 ? n : "")}`;
739
+ const s = e.indexOf("@");
740
+ return s >= 0 ? `${e.slice(0, s)}@${we(e.slice(s + 1))}` : null;
741
+ }
742
+ function Go(e, t = Oo) {
743
+ if (typeof e != "string" || e.length === 0) return "";
744
+ const o = [];
745
+ for (const n of e.split(`
746
+ `)) {
747
+ const i = Xo(n.trim());
748
+ if (i && (o.push(i), o.length >= t))
749
+ break;
750
+ }
751
+ return o.join(" < ");
752
+ }
753
+ function Yo(e, t, o) {
754
+ return Vo(`${e}|${Ho(t)}|${Go(o)}`);
755
+ }
756
+ var Ko = class {
757
+ constructor(e) {
758
+ var t;
759
+ W(this, "options", void 0), W(this, "tokens", void 0), W(this, "last", void 0), W(this, "now", void 0), this.options = e, this.now = (t = e.now) !== null && t !== void 0 ? t : Date.now, this.tokens = Math.max(0, e.capacity), this.last = this.now();
760
+ }
761
+ take() {
762
+ const e = this.now(), { capacity: t, refillIntervalMs: o } = this.options;
763
+ if (o > 0 && e > this.last) {
764
+ const n = Math.floor((e - this.last) / o);
765
+ n > 0 && (this.tokens = Math.min(t, this.tokens + n), this.last += n * o);
766
+ }
767
+ return this.tokens >= 1 ? (this.tokens -= 1, !0) : !1;
768
+ }
769
+ };
770
+ function V(e) {
771
+ if (typeof e == "string") return e;
772
+ if (e == null) return "";
773
+ try {
774
+ return String(e);
775
+ } catch {
776
+ return "";
777
+ }
778
+ }
779
+ function qo(e) {
780
+ const t = e, o = t.error;
781
+ if (o && typeof o == "object") {
782
+ const i = o;
783
+ return {
784
+ type: V(i.name) || "Error",
785
+ value: V(i.message) || V(t.message),
786
+ stack: typeof i.stack == "string" ? i.stack : void 0,
787
+ original: o
788
+ };
789
+ }
790
+ const n = V(t.message);
791
+ return n ? {
792
+ type: "Error",
793
+ value: n,
794
+ original: n
795
+ } : null;
796
+ }
797
+ function Wo(e) {
798
+ const t = e.reason;
799
+ if (t && typeof t == "object") {
800
+ const n = t;
801
+ return {
802
+ type: V(n.name) || "UnhandledRejection",
803
+ value: V(n.message) || V(t),
804
+ stack: typeof n.stack == "string" ? n.stack : void 0,
805
+ original: t
806
+ };
807
+ }
808
+ const o = V(t);
809
+ return {
810
+ type: "UnhandledRejection",
811
+ value: o,
812
+ original: t != null ? t : o
813
+ };
814
+ }
815
+ var Zo = {
816
+ destroy: () => {
817
+ },
818
+ droppedCount: () => 0
819
+ };
820
+ function Jo(e) {
821
+ var t, o, n, i, r, s, f, l, d, h, a, b;
822
+ const u = (t = e.win) !== null && t !== void 0 ? t : typeof window != "undefined" ? window : void 0;
823
+ if (!u) return Zo;
824
+ const m = u, p = (o = (n = e.doc) !== null && n !== void 0 ? n : m.document) !== null && o !== void 0 ? o : typeof document != "undefined" ? document : void 0, c = (i = e.now) !== null && i !== void 0 ? i : Date.now, T = (r = e.sdkVersion) !== null && r !== void 0 ? r : de, C = (s = e.maxDistinct) !== null && s !== void 0 ? s : 20, w = (f = (l = e.deps) === null || l === void 0 ? void 0 : l.captureView) !== null && f !== void 0 ? f : dt, _ = (d = (h = e.deps) === null || h === void 0 ? void 0 : h.submitReport) !== null && d !== void 0 ? d : ut, N = new Ko({
825
+ capacity: (a = e.burstCapacity) !== null && a !== void 0 ? a : 5,
826
+ refillIntervalMs: (b = e.burstRefillMs) !== null && b !== void 0 ? b : Po,
827
+ now: c
828
+ }), M = /* @__PURE__ */ new Map();
829
+ let A = 0;
830
+ function y(I, L, O) {
831
+ var R, z;
832
+ return {
833
+ ...lt({
834
+ kind: "bug",
835
+ url: (R = m.location) === null || R === void 0 ? void 0 : R.href,
836
+ environment: st(m, T),
837
+ trace: O.trace ? (z = e.buffer) === null || z === void 0 ? void 0 : z.snapshot() : void 0
838
+ }),
839
+ source: "auto",
840
+ errorSignature: I,
841
+ occurrences: L
842
+ };
843
+ }
844
+ async function D(I, L, O) {
845
+ const R = M.get(I);
846
+ if (!R) return;
847
+ const z = R.sentCount;
848
+ R.sentCount = L;
849
+ try {
850
+ const fe = y(I, L, O), J = nt(fe, {
851
+ hook: e.beforeSend,
852
+ scrub: e.scrub
853
+ });
854
+ if (!J) return;
855
+ let Q = null;
856
+ if (O.screenshot) {
857
+ const G = await w({
858
+ doc: p,
859
+ win: m
860
+ });
861
+ Q = G ? {
862
+ blob: G.blob,
863
+ filename: `screenshot.${ct(G.type)}`
864
+ } : null;
865
+ }
866
+ !(await _(e.apiUrl, {
867
+ key: e.key,
868
+ identity: e.identity,
869
+ content: J,
870
+ screenshot: Q
871
+ })).ok && R.sentCount === L && (R.sentCount = z);
872
+ } catch {
873
+ R.sentCount === L && (R.sentCount = z);
874
+ }
875
+ }
876
+ function v(I) {
877
+ const L = Yo(I.type, I.value, I.stack), O = M.get(L);
878
+ if (O) {
879
+ O.count += 1, O.lastAt = c();
880
+ return;
881
+ }
882
+ if (!N.take()) {
883
+ A += 1;
884
+ return;
885
+ }
886
+ if (M.size >= C) {
887
+ A += 1;
888
+ return;
889
+ }
890
+ const R = c();
891
+ M.set(L, {
892
+ count: 1,
893
+ firstAt: R,
894
+ lastAt: R,
895
+ sentCount: 0
896
+ });
897
+ try {
898
+ var z;
899
+ (z = e.buffer) === null || z === void 0 || z.add(lo(I.original, R));
900
+ } catch {
901
+ }
902
+ D(L, 1, {
903
+ screenshot: !0,
904
+ trace: !0
905
+ });
906
+ }
907
+ const S = (I) => {
908
+ try {
909
+ const L = qo(I);
910
+ L && v(L);
911
+ } catch {
912
+ }
913
+ }, U = (I) => {
914
+ try {
915
+ const L = Wo(I);
916
+ L && v(L);
917
+ } catch {
918
+ }
919
+ }, $ = () => {
920
+ try {
921
+ for (const [I, L] of M) L.count > L.sentCount && D(I, L.count, {
922
+ screenshot: !1,
923
+ trace: !1
924
+ });
925
+ } catch {
926
+ }
927
+ }, Z = () => {
928
+ (p == null ? void 0 : p.visibilityState) === "hidden" && $();
929
+ };
930
+ return m.addEventListener("error", S, !0), m.addEventListener("unhandledrejection", U, !0), m.addEventListener("pagehide", $), p == null || p.addEventListener("visibilitychange", Z), {
931
+ destroy: () => {
932
+ m.removeEventListener("error", S, !0), m.removeEventListener("unhandledrejection", U, !0), m.removeEventListener("pagehide", $), p == null || p.removeEventListener("visibilitychange", Z);
933
+ },
934
+ droppedCount: () => A
935
+ };
936
+ }
937
+ var Ke = "fixback.anonymousId";
938
+ function qe() {
31
939
  const e = globalThis.crypto;
32
940
  return e && typeof e.randomUUID == "function" ? e.randomUUID() : `fb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
33
941
  }
34
- function ye() {
942
+ function Qo() {
943
+ try {
944
+ const e = globalThis.localStorage, t = e.getItem(Ke);
945
+ if (t) return t;
946
+ const o = qe();
947
+ return e.setItem(Ke, o), o;
948
+ } catch {
949
+ return qe();
950
+ }
951
+ }
952
+ var ft = "fixback_invite", en = "fixback:reporter:";
953
+ function tn(e) {
954
+ try {
955
+ const t = new URL(e).searchParams.get(ft);
956
+ return t && t.length > 0 ? t : null;
957
+ } catch {
958
+ return null;
959
+ }
960
+ }
961
+ function on(e) {
962
+ try {
963
+ const t = new URL(e.location.href);
964
+ if (!t.searchParams.has("fixback_invite")) return;
965
+ t.searchParams.delete(ft);
966
+ const o = t.searchParams.toString(), n = `${t.pathname}${o ? `?${o}` : ""}${t.hash}`;
967
+ e.history.replaceState(e.history.state, "", n);
968
+ } catch {
969
+ }
970
+ }
971
+ function bt(e) {
972
+ return `${en}${e}`;
973
+ }
974
+ function pt() {
975
+ try {
976
+ var e;
977
+ return (e = globalThis.localStorage) !== null && e !== void 0 ? e : null;
978
+ } catch {
979
+ return null;
980
+ }
981
+ }
982
+ function ue(e) {
983
+ if (typeof e != "string") return;
984
+ const t = e.trim();
985
+ return t.length > 0 ? t : void 0;
986
+ }
987
+ function nn(e, t, o = pt()) {
988
+ if (!o) return;
989
+ const n = ue(t.name), i = ue(t.email), r = {
990
+ reporterId: t.reporterId,
991
+ ...n ? { name: n } : {},
992
+ ...i ? { email: i } : {}
993
+ };
994
+ try {
995
+ o.setItem(bt(e), JSON.stringify(r));
996
+ } catch {
997
+ }
998
+ }
999
+ function We(e, t = pt()) {
1000
+ if (!t) return null;
35
1001
  try {
36
- const e = globalThis.localStorage, t = e.getItem(J);
37
- if (t) return t;
38
- const o = Z();
39
- return e.setItem(J, o), o;
1002
+ const o = t.getItem(bt(e));
1003
+ if (!o) return null;
1004
+ const n = JSON.parse(o);
1005
+ if (typeof (n == null ? void 0 : n.reporterId) != "string" || n.reporterId.length === 0) return null;
1006
+ const i = ue(n.name), r = ue(n.email);
1007
+ return {
1008
+ reporterId: n.reporterId,
1009
+ ...i ? { name: i } : {},
1010
+ ...r ? { email: r } : {}
1011
+ };
1012
+ } catch {
1013
+ return null;
1014
+ }
1015
+ }
1016
+ function ht(e, t) {
1017
+ return `${e.replace(/\/+$/, "")}/api/invites/${encodeURIComponent(t)}`;
1018
+ }
1019
+ function rn(e, t) {
1020
+ return `${ht(e, t)}/redeem`;
1021
+ }
1022
+ var vt = /* @__PURE__ */ new Set([
1023
+ "revoked",
1024
+ "expired",
1025
+ "exhausted",
1026
+ "not_found"
1027
+ ]);
1028
+ function mt(e) {
1029
+ return e === "public" || e === "invited" || e === "internal";
1030
+ }
1031
+ function an(e) {
1032
+ if (typeof e != "object" || e === null) return !1;
1033
+ const t = e;
1034
+ return t.status === "pending" ? typeof t.projectId == "string" && (t.kind === "targeted" || t.kind === "shared") && mt(t.tier) : typeof t.status == "string" && vt.has(t.status);
1035
+ }
1036
+ function sn(e) {
1037
+ if (typeof e != "object" || e === null) return !1;
1038
+ const t = e;
1039
+ return t.status === "redeemed" ? typeof t.reporterId == "string" && typeof t.projectId == "string" && mt(t.tier) : typeof t.status == "string" && vt.has(t.status);
1040
+ }
1041
+ async function gt(e) {
1042
+ try {
1043
+ return await e.json();
1044
+ } catch {
1045
+ return null;
1046
+ }
1047
+ }
1048
+ async function ln(e, t, o = fetch) {
1049
+ let n;
1050
+ try {
1051
+ n = await o(ht(e, t), {
1052
+ method: "GET",
1053
+ headers: { accept: "application/json" }
1054
+ });
1055
+ } catch {
1056
+ return null;
1057
+ }
1058
+ const i = await gt(n);
1059
+ return an(i) ? i : null;
1060
+ }
1061
+ async function cn(e, t, o = fetch) {
1062
+ let n;
1063
+ try {
1064
+ n = await o(rn(e, t), {
1065
+ method: "POST",
1066
+ headers: { accept: "application/json" }
1067
+ });
40
1068
  } catch {
41
- return Z();
1069
+ return null;
42
1070
  }
1071
+ const i = await gt(n);
1072
+ return sn(i) ? i : null;
43
1073
  }
44
- var ke = `
1074
+ var dn = `
45
1075
  :host {
46
1076
  /* Vendored Signal tokens (packages/ui/src/tokens.css). */
47
1077
  --fb-color-accent: #2f6fed;
48
1078
  --fb-color-accent-hover: #245fd0;
49
1079
  --fb-color-on-emphasis: #ffffff;
50
1080
  --fb-color-text: #0f1720;
1081
+ /* Inverse (dark) surface for the toasts — Signal --fb-ink-900. */
1082
+ --fb-color-surface-inverse: #0f1720;
51
1083
  --fb-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
52
1084
  Helvetica, Arial, sans-serif;
53
1085
 
@@ -59,42 +1091,55 @@ var ke = `
59
1091
  -webkit-font-smoothing: antialiased;
60
1092
  }
61
1093
 
1094
+ /* The pill: Feedback button + divider + tuck control, anchored bottom-right. */
62
1095
  .fb-launcher {
1096
+ position: fixed;
1097
+ right: 20px;
1098
+ bottom: 20px;
1099
+ z-index: 2;
63
1100
  display: inline-flex;
64
- align-items: center;
65
- gap: 8px;
1101
+ align-items: stretch;
66
1102
  box-sizing: border-box;
67
1103
  height: 40px;
68
1104
  margin: 0;
69
- padding: 0 16px;
70
- border: 0;
71
1105
  border-radius: 999px;
72
1106
  background: var(--fb-color-accent);
73
- color: var(--fb-color-on-emphasis);
74
- font-family: inherit;
75
- font-size: 13px;
76
- font-weight: 600;
77
- letter-spacing: 0.01em;
78
- cursor: pointer;
79
1107
  box-shadow:
80
1108
  0 6px 18px rgba(15, 23, 32, 0.16),
81
1109
  0 1px 2px rgba(15, 23, 32, 0.12);
1110
+ transform: translateX(0);
82
1111
  transition:
83
- background-color 120ms ease,
84
- transform 120ms ease;
1112
+ transform 340ms cubic-bezier(0.2, 0.8, 0.3, 1),
1113
+ background-color 120ms ease;
85
1114
  }
86
1115
 
87
1116
  .fb-launcher:hover {
88
1117
  background: var(--fb-color-accent-hover);
89
1118
  }
90
1119
 
91
- .fb-launcher:active {
92
- transform: translateY(1px);
1120
+ .fb-launcher__button {
1121
+ display: inline-flex;
1122
+ align-items: center;
1123
+ gap: 8px;
1124
+ box-sizing: border-box;
1125
+ height: 100%;
1126
+ margin: 0;
1127
+ padding: 0 6px 0 16px;
1128
+ border: 0;
1129
+ background: transparent;
1130
+ color: var(--fb-color-on-emphasis);
1131
+ font-family: inherit;
1132
+ font-size: 13px;
1133
+ font-weight: 600;
1134
+ letter-spacing: 0.01em;
1135
+ cursor: pointer;
93
1136
  }
94
1137
 
95
- .fb-launcher:focus-visible {
96
- outline: 2px solid var(--fb-color-accent);
97
- outline-offset: 2px;
1138
+ .fb-launcher__button:focus-visible,
1139
+ .fb-launcher__tuck:focus-visible {
1140
+ outline: 2px solid var(--fb-color-on-emphasis);
1141
+ outline-offset: -3px;
1142
+ border-radius: 999px;
98
1143
  }
99
1144
 
100
1145
  .fb-launcher__icon {
@@ -108,154 +1153,731 @@ var ke = `
108
1153
  white-space: nowrap;
109
1154
  }
110
1155
 
1156
+ .fb-launcher__divider {
1157
+ width: 1px;
1158
+ margin: 9px 0;
1159
+ flex: none;
1160
+ background: rgba(255, 255, 255, 0.28);
1161
+ }
1162
+
1163
+ .fb-launcher__tuck {
1164
+ display: inline-flex;
1165
+ align-items: center;
1166
+ justify-content: center;
1167
+ box-sizing: border-box;
1168
+ width: 32px;
1169
+ height: 100%;
1170
+ padding: 0;
1171
+ border: 0;
1172
+ background: transparent;
1173
+ color: rgba(255, 255, 255, 0.82);
1174
+ cursor: pointer;
1175
+ }
1176
+
1177
+ .fb-launcher__tuck:hover {
1178
+ color: var(--fb-color-on-emphasis);
1179
+ }
1180
+
1181
+ .fb-launcher__tuck-icon {
1182
+ display: block;
1183
+ width: 14px;
1184
+ height: 14px;
1185
+ }
1186
+
1187
+ /* The corner hover-zone that peeks a tucked launcher back — inert until tucked,
1188
+ * so it never swallows the host page's own bottom-right clicks. */
1189
+ .fb-launcher__peekzone {
1190
+ position: fixed;
1191
+ right: 0;
1192
+ bottom: 0;
1193
+ z-index: 1;
1194
+ width: 160px;
1195
+ height: 160px;
1196
+ pointer-events: none;
1197
+ }
1198
+
1199
+ /* The edge nub: the visible re-reveal affordance, hidden until tucked. */
1200
+ .fb-launcher__nub {
1201
+ position: fixed;
1202
+ right: 0;
1203
+ bottom: 22px;
1204
+ z-index: 2;
1205
+ width: 13px;
1206
+ height: 42px;
1207
+ border-radius: 9px 0 0 9px;
1208
+ background: var(--fb-color-accent);
1209
+ box-shadow: -6px 5px 18px rgba(47, 111, 237, 0.4);
1210
+ cursor: pointer;
1211
+ opacity: 0;
1212
+ transform: translateX(10px);
1213
+ pointer-events: none;
1214
+ transition:
1215
+ opacity 220ms ease,
1216
+ transform 220ms ease;
1217
+ }
1218
+
1219
+ /* Tucked and not peeking: slide the pill off, reveal the nub, arm the zone. */
1220
+ :host([data-fb-hidden]:not([data-fb-peeking])) .fb-launcher {
1221
+ transform: translateX(calc(100% + 30px));
1222
+ }
1223
+
1224
+ :host([data-fb-hidden]:not([data-fb-peeking])) .fb-launcher__nub {
1225
+ opacity: 1;
1226
+ transform: none;
1227
+ pointer-events: auto;
1228
+ }
1229
+
1230
+ :host([data-fb-hidden]) .fb-launcher__peekzone {
1231
+ pointer-events: auto;
1232
+ }
1233
+
1234
+ /* Toasts: the first-visit welcome (above the pill) and the tuck-away hint. */
1235
+ .fb-launcher__welcome,
1236
+ .fb-launcher__hint {
1237
+ position: fixed;
1238
+ right: 20px;
1239
+ z-index: 5;
1240
+ box-sizing: border-box;
1241
+ color: #fff;
1242
+ font-size: 12px;
1243
+ line-height: 1.45;
1244
+ background: var(--fb-color-surface-inverse);
1245
+ border-radius: 10px;
1246
+ box-shadow: 0 12px 30px rgba(15, 40, 70, 0.32);
1247
+ animation: fbToast 300ms ease both;
1248
+ }
1249
+
1250
+ .fb-launcher__welcome {
1251
+ bottom: 70px;
1252
+ max-width: 210px;
1253
+ padding: 9px 13px;
1254
+ }
1255
+
1256
+ .fb-launcher__welcome strong {
1257
+ color: #8fc0ff;
1258
+ font-weight: 600;
1259
+ }
1260
+
1261
+ .fb-launcher__hint {
1262
+ bottom: 20px;
1263
+ max-width: 232px;
1264
+ padding: 10px 13px;
1265
+ }
1266
+
1267
+ /* The pulse that draws the eye while the welcome shows. */
1268
+ .fb-launcher--pulse {
1269
+ animation: fbPulse 1.8s ease-in-out 2;
1270
+ }
1271
+
1272
+ @keyframes fbPulse {
1273
+ 0%,
1274
+ 100% {
1275
+ box-shadow:
1276
+ 0 6px 18px rgba(15, 23, 32, 0.16),
1277
+ 0 0 0 0 rgba(47, 111, 237, 0.45);
1278
+ }
1279
+ 50% {
1280
+ box-shadow:
1281
+ 0 6px 18px rgba(15, 23, 32, 0.16),
1282
+ 0 0 0 12px rgba(47, 111, 237, 0);
1283
+ }
1284
+ }
1285
+
1286
+ @keyframes fbToast {
1287
+ from {
1288
+ opacity: 0;
1289
+ transform: translateY(14px);
1290
+ }
1291
+ to {
1292
+ opacity: 1;
1293
+ transform: none;
1294
+ }
1295
+ }
1296
+
1297
+ /* Reduce motion — the explicit opt-in and the OS setting both still it all. */
1298
+ :host([data-fb-reduce-motion]) .fb-launcher,
1299
+ :host([data-fb-reduce-motion]) .fb-launcher__nub {
1300
+ transition: none;
1301
+ }
1302
+
1303
+ :host([data-fb-reduce-motion]) .fb-launcher--pulse,
1304
+ :host([data-fb-reduce-motion]) .fb-launcher__welcome,
1305
+ :host([data-fb-reduce-motion]) .fb-launcher__hint {
1306
+ animation: none;
1307
+ }
1308
+
111
1309
  @media (prefers-reduced-motion: reduce) {
112
- .fb-launcher {
1310
+ .fb-launcher,
1311
+ .fb-launcher__nub {
113
1312
  transition: none;
114
1313
  }
1314
+ .fb-launcher--pulse,
1315
+ .fb-launcher__welcome,
1316
+ .fb-launcher__hint {
1317
+ animation: none;
1318
+ }
1319
+ }
1320
+ `, Ze = "data-fixback-root", Se = "fixback:launch", un = "fixback:welcomed:", fn = 5e3, bn = 4400, pn = 280, hn = '<svg class="fb-launcher__icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M3.25 2h9.5A1.25 1.25 0 0 1 14 3.25v6.5A1.25 1.25 0 0 1 12.75 11H7.6l-3.19 2.55A.6.6 0 0 1 3.4 13.1V11h-.15A1.25 1.25 0 0 1 2 9.75v-6.5A1.25 1.25 0 0 1 3.25 2Z"/></svg>', vn = '<svg class="fb-launcher__tuck-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6l4 4 4-4"/></svg>';
1321
+ function mn(e, t) {
1322
+ const o = un + (t != null ? t : "default");
1323
+ try {
1324
+ const n = e == null ? void 0 : e.localStorage;
1325
+ return n ? n.getItem(o) === "1" ? !1 : (n.setItem(o, "1"), !0) : !0;
1326
+ } catch {
1327
+ return !0;
1328
+ }
115
1329
  }
116
- `, Q = "data-fixback-root", U = "fixback:launch", we = '<svg class="fb-launcher__icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M3.25 2h9.5A1.25 1.25 0 0 1 14 3.25v6.5A1.25 1.25 0 0 1 12.75 11H7.6l-3.19 2.55A.6.6 0 0 1 3.4 13.1V11h-.15A1.25 1.25 0 0 1 2 9.75v-6.5A1.25 1.25 0 0 1 3.25 2Z"/></svg>';
117
- function Ee(e) {
118
- const t = e.ownerDocument, o = t.querySelector(`[${Q}]`);
119
- o && o.remove();
120
- const n = t.createElement("div");
121
- n.setAttribute(Q, ""), n.style.cssText = "position:fixed;right:20px;bottom:20px;z-index:2147483000;margin:0;padding:0;border:0;";
122
- const i = n.attachShadow({ mode: "open" }), l = t.createElement("style");
123
- l.textContent = ke, i.appendChild(l);
124
- const a = t.createElement("button");
125
- return a.type = "button", a.className = "fb-launcher", a.setAttribute("aria-haspopup", "dialog"), a.setAttribute("aria-label", "Give feedback"), a.innerHTML = `${we}<span class="fb-launcher__label">Feedback</span>`, a.addEventListener("click", () => {
126
- n.dispatchEvent(new CustomEvent(U, {
1330
+ function gn(e, t = {}) {
1331
+ const o = e.ownerDocument, n = o.defaultView, i = o.querySelector(`[${Ze}]`);
1332
+ i && i.remove();
1333
+ const r = o.createElement("div");
1334
+ r.setAttribute(Ze, ""), r.style.cssText = "position:fixed;right:20px;bottom:20px;z-index:2147483000;margin:0;padding:0;border:0;", t.reduceMotion && r.setAttribute("data-fb-reduce-motion", "true");
1335
+ const s = r.attachShadow({ mode: "open" }), f = o.createElement("style");
1336
+ f.textContent = dn, s.appendChild(f);
1337
+ const l = o.createElement("div");
1338
+ l.className = "fb-launcher";
1339
+ const d = o.createElement("button");
1340
+ d.type = "button", d.className = "fb-launcher__button", d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-label", "Give feedback"), d.innerHTML = `${hn}<span class="fb-launcher__label">Feedback</span>`, d.addEventListener("click", () => {
1341
+ r.dispatchEvent(new CustomEvent(Se, {
127
1342
  bubbles: !0,
128
1343
  composed: !0
129
1344
  }));
130
- }), i.appendChild(a), e.appendChild(n), { host: n };
1345
+ });
1346
+ const h = o.createElement("span");
1347
+ h.className = "fb-launcher__divider", h.setAttribute("aria-hidden", "true");
1348
+ const a = o.createElement("button");
1349
+ a.type = "button", a.className = "fb-launcher__tuck", a.setAttribute("data-fb-tuck", ""), a.setAttribute("aria-label", "Hide feedback button"), a.title = "Tuck away — hover the corner to bring it back", a.innerHTML = vn, l.append(d, h, a);
1350
+ const b = o.createElement("div");
1351
+ b.className = "fb-launcher__peekzone", b.setAttribute("aria-hidden", "true");
1352
+ const u = o.createElement("div");
1353
+ u.className = "fb-launcher__nub", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", "Show feedback button"), s.append(l, b, u);
1354
+ let m = !1, p = !1, c, T, C, w, _;
1355
+ const N = () => {
1356
+ m ? r.setAttribute("data-fb-hidden", "true") : r.removeAttribute("data-fb-hidden"), m && p ? r.setAttribute("data-fb-peeking", "true") : r.removeAttribute("data-fb-peeking");
1357
+ }, M = () => {
1358
+ T !== void 0 && (clearTimeout(T), T = void 0), l.classList.remove("fb-launcher--pulse"), w == null || w.remove(), w = void 0;
1359
+ }, A = () => {
1360
+ C !== void 0 && (clearTimeout(C), C = void 0), _ == null || _.remove(), _ = void 0;
1361
+ }, y = () => {
1362
+ c !== void 0 && (clearTimeout(c), c = void 0), p || (p = !0, N());
1363
+ }, D = () => {
1364
+ c !== void 0 && clearTimeout(c), c = setTimeout(() => {
1365
+ c = void 0, p = !1, N();
1366
+ }, pn);
1367
+ };
1368
+ for (const $ of [
1369
+ l,
1370
+ b,
1371
+ u
1372
+ ])
1373
+ $.addEventListener("mouseenter", y), $.addEventListener("mouseleave", D);
1374
+ const v = () => {
1375
+ c !== void 0 && (clearTimeout(c), c = void 0), m = !1, p = !1, N(), A();
1376
+ }, S = () => {
1377
+ M(), m = !0, p = !1, N(), A(), _ = o.createElement("div"), _.className = "fb-launcher__hint", _.setAttribute("role", "status"), _.textContent = "Tucked away down here. Hover the bottom-right corner and I'll bring it back.", s.appendChild(_), C = setTimeout(A, bn);
1378
+ };
1379
+ return a.addEventListener("click", S), u.addEventListener("click", v), u.addEventListener("keydown", ($) => {
1380
+ ($.key === "Enter" || $.key === " " || $.key === "Spacebar") && ($.preventDefault(), v());
1381
+ }), mn(n, t.key) && (w = o.createElement("div"), w.className = "fb-launcher__welcome", w.setAttribute("role", "status"), w.innerHTML = "You're all set — tap <strong>Feedback</strong> any time to report something.", s.appendChild(w), t.reduceMotion || l.classList.add("fb-launcher--pulse"), T = setTimeout(M, fn)), e.appendChild(r), {
1382
+ host: r,
1383
+ dispose: () => {
1384
+ c !== void 0 && clearTimeout(c), T !== void 0 && clearTimeout(T), C !== void 0 && clearTimeout(C);
1385
+ }
1386
+ };
131
1387
  }
132
- function Se(e) {
133
- e.host.remove();
1388
+ function xn(e) {
1389
+ e.dispose(), e.host.remove();
134
1390
  }
135
- var ne = ["data-fixback-root", "data-fixback-overlay"], Ce = ne.map((e) => `[${e}]`).join(",");
136
- function Te(e) {
137
- let t = e instanceof Node ? e : null;
138
- for (; t; ) {
139
- if (t instanceof Element) {
140
- for (const n of ne) if (t.hasAttribute(n)) return !0;
141
- }
142
- const o = t.getRootNode();
143
- if (o instanceof ShadowRoot && o !== t) {
144
- t = o.host;
145
- continue;
146
- }
147
- t = t.parentNode;
148
- }
149
- return !1;
1391
+ var yn = `
1392
+ :host {
1393
+ --fb-color-accent: #2f6fed;
1394
+ --fb-color-accent-hover: #245fd0;
1395
+ --fb-color-on-emphasis: #ffffff;
1396
+ --fb-color-ink: #0f1720;
1397
+ --fb-color-text: #1a2530;
1398
+ --fb-color-muted: #5a6875;
1399
+ --fb-color-faint: #9aa7b2;
1400
+ --fb-color-hint: #b7c1cb;
1401
+ --fb-color-border: #dce3ea;
1402
+ --fb-color-border-soft: #e6ebf0;
1403
+ --fb-color-surface: #ffffff;
1404
+ --fb-color-card: #f6f8fa;
1405
+ --fb-color-accent-bg: #eaf1fe;
1406
+ --fb-color-success: #2f9e5b;
1407
+ --fb-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
1408
+ Helvetica, Arial, sans-serif;
1409
+ --fb-font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas,
1410
+ monospace;
1411
+ all: initial;
150
1412
  }
151
- function Ie(e) {
152
- for (const t of Array.from(e.querySelectorAll(Ce))) t.remove();
1413
+
1414
+ *, *::before, *::after { box-sizing: border-box; }
1415
+
1416
+ .fb-ob-backdrop {
1417
+ position: fixed;
1418
+ inset: 0;
1419
+ z-index: 2147483010;
1420
+ display: flex;
1421
+ align-items: center;
1422
+ justify-content: center;
1423
+ padding: 24px;
1424
+ background: rgba(15, 23, 32, 0.55);
1425
+ backdrop-filter: blur(3px);
1426
+ font-family: var(--fb-font-sans);
1427
+ color: var(--fb-color-text);
1428
+ animation: fb-ob-fade 0.25s ease both;
153
1429
  }
154
- function ee(e) {
155
- const t = globalThis.CSS;
156
- return t != null && t.escape ? t.escape(e) : e.replace(/[^\w-]/g, (o) => `\\${o}`);
1430
+
1431
+ .fb-ob-panel {
1432
+ width: 400px;
1433
+ max-width: 100%;
1434
+ background: var(--fb-color-surface);
1435
+ border-radius: 16px;
1436
+ box-shadow: 0 30px 70px rgba(15, 40, 70, 0.4);
1437
+ overflow: hidden;
1438
+ animation: fb-ob-pop 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both;
157
1439
  }
158
- function Le(e) {
159
- let t = 1, o = e.previousElementSibling;
160
- for (; o; )
161
- o.tagName === e.tagName && (t += 1), o = o.previousElementSibling;
162
- return t;
1440
+
1441
+ .fb-ob-head {
1442
+ padding: 22px 24px 0;
1443
+ display: flex;
1444
+ align-items: center;
1445
+ gap: 10px;
163
1446
  }
164
- function Ae(e) {
165
- if (e.id) return `#${ee(e.id)}`;
166
- const t = [];
167
- let o = e;
168
- for (; o && o.tagName.toLowerCase() !== "html"; ) {
169
- if (o.id) {
170
- t.unshift(`#${ee(o.id)}`);
171
- break;
172
- }
173
- const n = o.tagName.toLowerCase(), i = o.parentElement;
174
- if (i) {
175
- const l = Array.from(i.children).filter((a) => a.tagName === o.tagName);
176
- t.unshift(l.length > 1 ? `${n}:nth-of-type(${Le(o)})` : n);
177
- } else t.unshift(n);
178
- o = i;
179
- }
180
- return t.join(" > ");
1447
+ .fb-ob-mark {
1448
+ width: 22px;
1449
+ height: 22px;
1450
+ border-radius: 6px;
1451
+ background: var(--fb-color-accent);
1452
+ flex: none;
1453
+ display: flex;
1454
+ align-items: center;
1455
+ justify-content: center;
181
1456
  }
182
- function Ne(e) {
183
- const t = e.tagName.toLowerCase();
184
- if (e.id) return `${t}#${e.id}`;
185
- const o = e.classList[0];
186
- return o ? `${t}.${o}` : t;
1457
+ .fb-ob-mark::after {
1458
+ content: "";
1459
+ width: 7px;
1460
+ height: 7px;
1461
+ border-radius: 2px;
1462
+ background: #fff;
187
1463
  }
188
- function _e(e) {
189
- const t = [];
190
- let o = e;
191
- for (; o; )
192
- t.unshift(Ne(o)), o = o.parentElement;
193
- return t.join(" > ");
1464
+ .fb-ob-brand { font-size: 15px; font-weight: 600; color: var(--fb-color-ink); }
1465
+ .fb-ob-chip {
1466
+ margin-left: auto;
1467
+ font-family: var(--fb-font-mono);
1468
+ font-size: 10px;
1469
+ color: #8a97a3;
1470
+ border: 1px solid var(--fb-color-border-soft);
1471
+ border-radius: 6px;
1472
+ padding: 2px 7px;
1473
+ }
1474
+
1475
+ .fb-ob-body { padding: 16px 24px 8px; }
1476
+ .fb-ob-title {
1477
+ font-size: 19px;
1478
+ font-weight: 700;
1479
+ color: var(--fb-color-ink);
1480
+ letter-spacing: -0.01em;
1481
+ }
1482
+ .fb-ob-lede {
1483
+ font-size: 13.5px;
1484
+ color: var(--fb-color-muted);
1485
+ line-height: 1.5;
1486
+ margin: 7px 0 0;
1487
+ }
1488
+ .fb-ob-lede strong { color: var(--fb-color-text); }
1489
+
1490
+ .fb-ob-card {
1491
+ margin: 16px 0;
1492
+ padding: 13px 14px;
1493
+ background: var(--fb-color-card);
1494
+ border: 1px solid var(--fb-color-border-soft);
1495
+ border-radius: 10px;
1496
+ display: flex;
1497
+ flex-direction: column;
1498
+ gap: 10px;
1499
+ }
1500
+ .fb-ob-row { display: flex; align-items: center; gap: 10px; }
1501
+ .fb-ob-row + .fb-ob-row {
1502
+ border-top: 1px solid #eef2f6;
1503
+ padding-top: 10px;
1504
+ }
1505
+ .fb-ob-rowlabel {
1506
+ font-family: var(--fb-font-mono);
1507
+ font-size: 10px;
1508
+ color: var(--fb-color-faint);
1509
+ width: 70px;
1510
+ flex: none;
1511
+ }
1512
+ .fb-ob-site { font-size: 13px; color: var(--fb-color-text); font-weight: 500; }
1513
+ .fb-ob-tier {
1514
+ font-size: 11px;
1515
+ font-weight: 600;
1516
+ color: var(--fb-color-accent);
1517
+ background: var(--fb-color-accent-bg);
1518
+ padding: 3px 9px;
1519
+ border-radius: 6px;
1520
+ }
1521
+ .fb-ob-tiernote { font-size: 11.5px; color: #8a97a3; }
1522
+
1523
+ .fb-ob-fieldlabel {
1524
+ display: block;
1525
+ font-family: var(--fb-font-mono);
1526
+ font-size: 10px;
1527
+ letter-spacing: 0.05em;
1528
+ text-transform: uppercase;
1529
+ color: var(--fb-color-faint);
1530
+ margin-bottom: 6px;
1531
+ }
1532
+ .fb-ob-fields { display: flex; gap: 8px; }
1533
+ .fb-ob-input {
1534
+ height: 38px;
1535
+ padding: 0 12px;
1536
+ border: 1px solid var(--fb-color-border);
1537
+ border-radius: 9px;
1538
+ font-family: inherit;
1539
+ font-size: 13px;
1540
+ color: var(--fb-color-text);
1541
+ outline: none;
1542
+ min-width: 0;
1543
+ }
1544
+ .fb-ob-input:focus { border-color: var(--fb-color-accent); }
1545
+ .fb-ob-name { flex: 1; }
1546
+ .fb-ob-email { flex: 1.3; font-family: var(--fb-font-mono); font-size: 12.5px; color: var(--fb-color-muted); }
1547
+
1548
+ .fb-ob-privacy {
1549
+ display: flex;
1550
+ align-items: flex-start;
1551
+ gap: 8px;
1552
+ margin-top: 14px;
1553
+ font-size: 11.5px;
1554
+ color: #8a97a3;
1555
+ line-height: 1.5;
1556
+ }
1557
+ .fb-ob-privacy svg { flex: none; margin-top: 1px; }
1558
+ .fb-ob-privacy strong { color: var(--fb-color-muted); }
1559
+
1560
+ .fb-ob-foot { padding: 16px 24px 22px; }
1561
+ .fb-ob-confirm {
1562
+ width: 100%;
1563
+ height: 44px;
1564
+ border: 0;
1565
+ border-radius: 11px;
1566
+ background: var(--fb-color-accent);
1567
+ color: var(--fb-color-on-emphasis);
1568
+ font-family: inherit;
1569
+ font-size: 14px;
1570
+ font-weight: 600;
1571
+ cursor: pointer;
1572
+ }
1573
+ .fb-ob-confirm:hover { background: var(--fb-color-accent-hover); }
1574
+ .fb-ob-confirm:disabled { opacity: 0.6; cursor: default; }
1575
+
1576
+ @keyframes fb-ob-fade { from { opacity: 0; } to { opacity: 1; } }
1577
+ @keyframes fb-ob-pop {
1578
+ from { opacity: 0; transform: translateY(8px) scale(0.98); }
1579
+ to { opacity: 1; transform: none; }
1580
+ }
1581
+
1582
+ @media (prefers-reduced-motion: reduce) {
1583
+ .fb-ob-backdrop, .fb-ob-panel { animation: none; }
1584
+ }
1585
+ `, wn = "data-fixback-onboard", kn = {
1586
+ invited: "Invited tester",
1587
+ internal: "Internal",
1588
+ public: "Public"
1589
+ }, En = {
1590
+ invited: "reviewed before it ships",
1591
+ internal: "ships straight through",
1592
+ public: "tracked, not auto-shipped"
1593
+ }, _n = '<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#2f9e5b" stroke-width="1.5" aria-hidden="true"><path d="M8 1.8 13.5 4v3.5c0 3.6-2.4 5.6-5.5 6.7C4.9 13.1 2.5 11.1 2.5 7.5V4z"/><path d="M5.8 8 7.3 9.5 10.3 6.2"/></svg>';
1594
+ function E(e, t, o = {}, n = []) {
1595
+ const i = e.createElement(t);
1596
+ for (const [r, s] of Object.entries(o)) s !== void 0 && i.setAttribute(r, s);
1597
+ for (const r of n) i.appendChild(typeof r == "string" ? e.createTextNode(r) : r);
1598
+ return i;
194
1599
  }
195
- function Oe(e) {
196
- const t = e.getBoundingClientRect();
197
- return {
198
- x: Math.round(t.x),
199
- y: Math.round(t.y),
200
- width: Math.round(t.width),
201
- height: Math.round(t.height)
202
- };
1600
+ function ce(e) {
1601
+ const t = e.trim();
1602
+ return t.length > 0 ? t : void 0;
203
1603
  }
204
- function Re(e) {
205
- return {
206
- selector: Ae(e),
207
- domPath: _e(e),
208
- tag: e.tagName.toLowerCase(),
209
- rect: Oe(e)
1604
+ function Sn(e) {
1605
+ var t, o, n, i, r, s;
1606
+ const f = (t = e.target) !== null && t !== void 0 ? t : document.body, l = (o = e.doc) !== null && o !== void 0 ? o : f.ownerDocument;
1607
+ (n = l.querySelector("[data-fixback-onboard]")) === null || n === void 0 || n.remove();
1608
+ const d = E(l, "div", { [wn]: "" }), h = d.attachShadow({ mode: "open" }), a = l.createElement("style");
1609
+ a.textContent = yn, h.appendChild(a);
1610
+ const b = E(l, "div", { class: "fb-ob-head" }, [
1611
+ E(l, "span", { class: "fb-ob-mark" }),
1612
+ E(l, "span", { class: "fb-ob-brand" }, ["Fixback"]),
1613
+ E(l, "span", { class: "fb-ob-chip" }, ["invite link"])
1614
+ ]), u = E(l, "p", { class: "fb-ob-lede" }, [
1615
+ "You've been invited to give feedback on ",
1616
+ E(l, "strong", {}, [e.origin]),
1617
+ ". Point, mark up, send."
1618
+ ]), m = E(l, "div", { class: "fb-ob-card" }, [E(l, "div", { class: "fb-ob-row" }, [E(l, "span", { class: "fb-ob-rowlabel" }, ["SITE"]), E(l, "span", { class: "fb-ob-site" }, [e.origin])]), E(l, "div", { class: "fb-ob-row" }, [
1619
+ E(l, "span", { class: "fb-ob-rowlabel" }, ["ACCESS"]),
1620
+ E(l, "span", { class: "fb-ob-tier" }, [kn[e.tier]]),
1621
+ E(l, "span", { class: "fb-ob-tiernote" }, [En[e.tier]])
1622
+ ])]), p = E(l, "input", {
1623
+ class: "fb-ob-input fb-ob-name",
1624
+ type: "text",
1625
+ "aria-label": "Name",
1626
+ placeholder: "Name"
1627
+ }), c = E(l, "input", {
1628
+ class: "fb-ob-input fb-ob-email",
1629
+ type: "email",
1630
+ "aria-label": "Email",
1631
+ placeholder: "email@example.com"
1632
+ });
1633
+ !((i = e.defaults) === null || i === void 0) && i.name && (p.value = e.defaults.name), !((r = e.defaults) === null || r === void 0) && r.email && (c.value = e.defaults.email);
1634
+ const T = E(l, "div", { class: "fb-ob-privacy" }), C = E(l, "span");
1635
+ C.innerHTML = _n, T.appendChild((s = C.firstChild) !== null && s !== void 0 ? s : l.createTextNode("")), T.appendChild(E(l, "span", {}, [E(l, "strong", {}, ["Private by default."]), " Anything you type is masked before it leaves your browser."]));
1636
+ const w = E(l, "div", { class: "fb-ob-body" }, [
1637
+ E(l, "div", { class: "fb-ob-title" }, ["You're invited to give feedback"]),
1638
+ u,
1639
+ m,
1640
+ E(l, "label", {
1641
+ class: "fb-ob-fieldlabel",
1642
+ for: "fb-ob-name-input"
1643
+ }, ["Continue as"]),
1644
+ E(l, "div", { class: "fb-ob-fields" }, [p, c]),
1645
+ T
1646
+ ]);
1647
+ p.id = "fb-ob-name-input";
1648
+ const _ = E(l, "button", {
1649
+ type: "button",
1650
+ class: "fb-ob-confirm"
1651
+ }, ["Start giving feedback"]), N = E(l, "div", { class: "fb-ob-backdrop" }, [E(l, "div", {
1652
+ class: "fb-ob-panel",
1653
+ role: "dialog",
1654
+ "aria-modal": "true",
1655
+ "aria-label": "Fixback invite"
1656
+ }, [
1657
+ b,
1658
+ w,
1659
+ E(l, "div", { class: "fb-ob-foot" }, [_])
1660
+ ])]);
1661
+ h.appendChild(N);
1662
+ let M = !1;
1663
+ return _.addEventListener("click", () => {
1664
+ if (M) return;
1665
+ M = !0, _.disabled = !0;
1666
+ const A = {
1667
+ ...ce(p.value) ? { name: ce(p.value) } : {},
1668
+ ...ce(c.value) ? { email: ce(c.value) } : {}
1669
+ };
1670
+ e.onConfirm(A);
1671
+ }), f.appendChild(d), {
1672
+ host: d,
1673
+ destroy: () => d.remove()
210
1674
  };
211
1675
  }
212
- function Me(e) {
1676
+ var Tn = "http://www.w3.org/2000/svg", ke = "3", Je = 4, Cn = '600 16px "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
1677
+ function Ln(e) {
213
1678
  var t, o;
214
- const n = (t = e.doc) !== null && t !== void 0 ? t : document, i = (o = e.ignore) !== null && o !== void 0 ? o : Te;
215
- let l = null, a = !1;
216
- function c(u) {
217
- var f;
218
- const y = (f = (typeof u.composedPath == "function" ? u.composedPath() : [])[0]) !== null && f !== void 0 ? f : u.target;
219
- return y instanceof Element ? i(y) ? null : y : null;
1679
+ const n = (t = e.doc) !== null && t !== void 0 ? t : document, { svg: i, textInput: r } = e, s = (o = e.color) !== null && o !== void 0 ? o : go;
1680
+ let f = "arrow", l = e.initialMarks ? e.initialMarks.slice() : [], d = null, h = !1, a = null, b = !1;
1681
+ function u() {
1682
+ var v;
1683
+ (v = e.onChange) === null || v === void 0 || v.call(e, l.slice());
1684
+ }
1685
+ function m(v) {
1686
+ return {
1687
+ x: Math.round(v.clientX),
1688
+ y: Math.round(v.clientY)
1689
+ };
220
1690
  }
221
- function b(u) {
222
- var f;
223
- a || (l = c(u), (f = e.onHover) === null || f === void 0 || f.call(e, l));
1691
+ function p(v) {
1692
+ const S = typeof v.composedPath == "function" ? v.composedPath() : [v.target];
1693
+ for (const U of S) {
1694
+ if (U === n) break;
1695
+ if (U instanceof Element) {
1696
+ const $ = U.tagName;
1697
+ if ($ === "BUTTON" || $ === "INPUT" || $ === "TEXTAREA") return !0;
1698
+ }
1699
+ }
1700
+ return !1;
224
1701
  }
225
- function p(u) {
226
- var f;
227
- if (a) return;
228
- const y = (f = c(u)) !== null && f !== void 0 ? f : l;
229
- y && (u.preventDefault(), u.stopPropagation(), s(), e.onPick(y));
1702
+ function c(v) {
1703
+ return v.type === "pen" ? v.points.length > 1 : v.type === "text" ? v.text.trim().length > 0 : Math.abs(v.x1 - v.x0) > Je || Math.abs(v.y1 - v.y0) > Je;
230
1704
  }
231
- function g(u) {
232
- if (!a && u.key === "Escape") {
233
- var f;
234
- u.preventDefault(), s(), (f = e.onCancel) === null || f === void 0 || f.call(e);
1705
+ function T(v) {
1706
+ if (b || h || p(v)) return;
1707
+ const S = m(v);
1708
+ if (f === "text") {
1709
+ _(S);
1710
+ return;
235
1711
  }
1712
+ v.cancelable && v.preventDefault(), h = !0, d = f === "pen" ? {
1713
+ type: "pen",
1714
+ points: [S],
1715
+ color: s
1716
+ } : {
1717
+ type: f,
1718
+ x0: S.x,
1719
+ y0: S.y,
1720
+ x1: S.x,
1721
+ y1: S.y,
1722
+ color: s
1723
+ }, y();
1724
+ }
1725
+ function C(v) {
1726
+ if (b || !h || !d) return;
1727
+ const S = m(v);
1728
+ d.type === "pen" ? d = {
1729
+ type: "pen",
1730
+ points: [...d.points, S],
1731
+ color: d.color
1732
+ } : d = {
1733
+ ...d,
1734
+ x1: S.x,
1735
+ y1: S.y
1736
+ }, y();
1737
+ }
1738
+ function w() {
1739
+ if (b || !h) return;
1740
+ h = !1;
1741
+ const v = d;
1742
+ d = null, v && c(v) && (l = [...l, v], u()), y();
1743
+ }
1744
+ function _(v) {
1745
+ a = v, r.value = "", r.style.display = "block", r.style.left = `${v.x}px`, r.style.top = `${v.y}px`, r.onkeydown = N, r.onblur = M, setTimeout(() => {
1746
+ try {
1747
+ r.focus();
1748
+ } catch {
1749
+ }
1750
+ }, 0);
1751
+ }
1752
+ function N(v) {
1753
+ v.key === "Enter" ? (v.preventDefault(), v.stopPropagation(), M()) : v.key === "Escape" && (v.preventDefault(), v.stopPropagation(), A());
1754
+ }
1755
+ function M() {
1756
+ if (!a) return;
1757
+ const v = r.value.trim(), S = a;
1758
+ A(), v.length > 0 && (l = [...l, {
1759
+ type: "text",
1760
+ x: S.x,
1761
+ y: S.y,
1762
+ text: v,
1763
+ color: s
1764
+ }], u(), y());
1765
+ }
1766
+ function A() {
1767
+ a = null, r.onkeydown = null, r.onblur = null, r.value = "", r.style.display = "none";
236
1768
  }
237
- function s() {
238
- a || (a = !0, n.removeEventListener("mouseover", b, !0), n.removeEventListener("click", p, !0), n.removeEventListener("keydown", g, !0), l = null);
1769
+ function y() {
1770
+ for (; i.firstChild; ) i.removeChild(i.firstChild);
1771
+ for (const v of l) i.appendChild(Qe(n, v));
1772
+ d && i.appendChild(Qe(n, d));
239
1773
  }
240
- return n.addEventListener("mouseover", b, !0), n.addEventListener("click", p, !0), n.addEventListener("keydown", g, !0), { stop: s };
1774
+ function D() {
1775
+ b || (b = !0, n.removeEventListener("mousedown", T, !0), n.removeEventListener("mousemove", C, !0), n.removeEventListener("mouseup", w, !0), A());
1776
+ }
1777
+ return n.addEventListener("mousedown", T, !0), n.addEventListener("mousemove", C, !0), n.addEventListener("mouseup", w, !0), y(), {
1778
+ setTool: (v) => {
1779
+ f = v;
1780
+ },
1781
+ getTool: () => f,
1782
+ undo: () => {
1783
+ l.length !== 0 && (l = l.slice(0, -1), u(), y());
1784
+ },
1785
+ marks: () => l.slice(),
1786
+ stop: D
1787
+ };
241
1788
  }
242
- function Be(e, t) {
243
- var o;
244
- const n = {}, i = e.innerWidth;
245
- typeof i == "number" && i > 0 && (n.viewportWidth = Math.round(i));
246
- const l = e.innerHeight;
247
- typeof l == "number" && l > 0 && (n.viewportHeight = Math.round(l));
248
- const a = (o = e.navigator) === null || o === void 0 ? void 0 : o.userAgent;
249
- return typeof a == "string" && a.length > 0 && (n.browser = a), t.length > 0 && (n.sdkVersion = t), n;
1789
+ function Qe(e, t) {
1790
+ switch (t.type) {
1791
+ case "box":
1792
+ return q(e, "rect", {
1793
+ x: String(Math.min(t.x0, t.x1)),
1794
+ y: String(Math.min(t.y0, t.y1)),
1795
+ width: String(Math.abs(t.x1 - t.x0)),
1796
+ height: String(Math.abs(t.y1 - t.y0)),
1797
+ rx: "2",
1798
+ fill: "none",
1799
+ stroke: t.color,
1800
+ "stroke-width": ke
1801
+ });
1802
+ case "pen":
1803
+ return q(e, "polyline", {
1804
+ points: t.points.map((o) => `${o.x},${o.y}`).join(" "),
1805
+ fill: "none",
1806
+ stroke: t.color,
1807
+ "stroke-width": ke,
1808
+ "stroke-linecap": "round",
1809
+ "stroke-linejoin": "round"
1810
+ });
1811
+ case "text": {
1812
+ const o = q(e, "text", {
1813
+ x: String(t.x),
1814
+ y: String(t.y),
1815
+ fill: t.color,
1816
+ style: `font:${Cn}`
1817
+ });
1818
+ return o.textContent = t.text, o;
1819
+ }
1820
+ case "arrow": {
1821
+ const o = q(e, "g", {});
1822
+ o.appendChild(q(e, "line", {
1823
+ x1: String(t.x0),
1824
+ y1: String(t.y0),
1825
+ x2: String(t.x1),
1826
+ y2: String(t.y1),
1827
+ stroke: t.color,
1828
+ "stroke-width": ke,
1829
+ "stroke-linecap": "round"
1830
+ }));
1831
+ const n = xo(t.x0, t.y0, t.x1, t.y1);
1832
+ return o.appendChild(q(e, "polygon", {
1833
+ points: n.map((i) => `${i.x},${i.y}`).join(" "),
1834
+ fill: t.color
1835
+ })), o;
1836
+ }
1837
+ }
250
1838
  }
251
- function ze(e) {
252
- var t;
253
- const o = {};
254
- e.kind && (o.kind = e.kind);
255
- const n = (t = e.comment) === null || t === void 0 ? void 0 : t.trim();
256
- return n && (o.comment = n), e.url && (o.url = e.url), e.environment && Object.keys(e.environment).length > 0 && (o.environment = e.environment), e.element && (o.annotation = e.element), o;
1839
+ function q(e, t, o) {
1840
+ const n = e.createElementNS(Tn, t);
1841
+ for (const [i, r] of Object.entries(o)) n.setAttribute(i, r);
1842
+ return n;
1843
+ }
1844
+ var Mn = 12;
1845
+ function An(e) {
1846
+ var t, o;
1847
+ const n = (t = e.doc) !== null && t !== void 0 ? t : document, i = (o = e.minSize) !== null && o !== void 0 ? o : Mn;
1848
+ let r = null, s = !1;
1849
+ function f(b) {
1850
+ s || r || (r = {
1851
+ x: b.clientX,
1852
+ y: b.clientY
1853
+ }, b.cancelable && b.preventDefault());
1854
+ }
1855
+ function l(b) {
1856
+ var u;
1857
+ s || !r || (u = e.onProgress) === null || u === void 0 || u.call(e, Ge(r.x, r.y, b.clientX, b.clientY));
1858
+ }
1859
+ function d(b) {
1860
+ if (s || !r) return;
1861
+ const u = Ge(r.x, r.y, b.clientX, b.clientY);
1862
+ if (r = null, a(), u.width < i || u.height < i) {
1863
+ var m;
1864
+ (m = e.onCancel) === null || m === void 0 || m.call(e);
1865
+ return;
1866
+ }
1867
+ e.onComplete(u);
1868
+ }
1869
+ function h(b) {
1870
+ if (!s && b.key === "Escape") {
1871
+ var u;
1872
+ b.preventDefault(), a(), (u = e.onCancel) === null || u === void 0 || u.call(e);
1873
+ }
1874
+ }
1875
+ function a() {
1876
+ s || (s = !0, n.removeEventListener("mousedown", f, !0), n.removeEventListener("mousemove", l, !0), n.removeEventListener("mouseup", d, !0), n.removeEventListener("keydown", h, !0), r = null);
1877
+ }
1878
+ return n.addEventListener("mousedown", f, !0), n.addEventListener("mousemove", l, !0), n.addEventListener("mouseup", d, !0), n.addEventListener("keydown", h, !0), { stop: a };
257
1879
  }
258
- var Pe = `
1880
+ var In = `
259
1881
  :host {
260
1882
  --fb-color-accent: #2f6fed;
261
1883
  --fb-color-accent-hover: #245fd0;
@@ -314,6 +1936,15 @@ var Pe = `
314
1936
  flex: none;
315
1937
  }
316
1938
  .fb-ov-brand { font-size: 14px; font-weight: 600; color: var(--fb-color-ink); }
1939
+ .fb-ov-tier {
1940
+ flex: none;
1941
+ font-family: var(--fb-font-mono);
1942
+ font-size: 9.5px;
1943
+ color: var(--fb-color-faint);
1944
+ border: 1px solid var(--fb-color-border-soft);
1945
+ border-radius: 5px;
1946
+ padding: 1px 6px;
1947
+ }
317
1948
  .fb-ov-close {
318
1949
  margin-left: auto;
319
1950
  border: 0;
@@ -400,8 +2031,9 @@ var Pe = `
400
2031
  .fb-ov-status { padding: 0 14px; font-size: 11px; min-height: 0; }
401
2032
  .fb-ov-status.is-error { color: var(--fb-color-bug); }
402
2033
 
403
- .fb-ov-tools { display: flex; align-items: center; gap: 8px; padding: 8px 14px 14px; }
404
- .fb-ov-pickbtn {
2034
+ .fb-ov-tools { display: flex; align-items: center; gap: 7px; padding: 8px 14px 14px; }
2035
+ .fb-ov-pickbtn,
2036
+ .fb-ov-capturebtn {
405
2037
  display: inline-flex;
406
2038
  align-items: center;
407
2039
  gap: 6px;
@@ -414,13 +2046,18 @@ var Pe = `
414
2046
  padding: 8px 11px;
415
2047
  cursor: pointer;
416
2048
  }
417
- .fb-ov-pickbtn:hover { border-color: #cfd8e2; }
418
- .fb-ov-pickbtn.is-active {
2049
+ .fb-ov-capturebtn { padding: 8px 9px; }
2050
+ .fb-ov-pickbtn:hover,
2051
+ .fb-ov-capturebtn:hover { border-color: #cfd8e2; }
2052
+ .fb-ov-pickbtn.is-active,
2053
+ .fb-ov-capturebtn.is-active,
2054
+ .fb-ov-capturebtn.is-attached {
419
2055
  color: var(--fb-color-accent);
420
2056
  border-color: var(--fb-color-accent);
421
2057
  background: var(--fb-color-impr-bg);
422
2058
  }
423
2059
  .fb-ov-pickbtn__glyph { font-size: 14px; line-height: 1; }
2060
+ .fb-ov-icon { display: block; }
424
2061
 
425
2062
  .fb-ov-send {
426
2063
  margin-left: auto;
@@ -450,9 +2087,18 @@ var Pe = `
450
2087
  .fb-ov-done__title { font-size: 15px; font-weight: 600; color: var(--fb-color-ink); }
451
2088
  .fb-ov-done__sub { font-size: 12px; color: var(--fb-color-muted); margin-top: 4px; }
452
2089
 
453
- .fb-ov-pick { position: fixed; inset: 0; pointer-events: none; z-index: 2147483002; display: none; }
454
- .fb-ov-panel.is-picking + .fb-ov-pick { display: block; }
455
- .fb-ov-panel.is-picking { visibility: hidden; }
2090
+ /* The panel is hidden while any full-screen marking layer is active. */
2091
+ .fb-ov-panel.is-marking { visibility: hidden; }
2092
+
2093
+ .fb-ov-pick,
2094
+ .fb-ov-capture,
2095
+ .fb-ov-draw { position: fixed; inset: 0; z-index: 2147483002; display: none; }
2096
+ .fb-ov-pick.is-visible,
2097
+ .fb-ov-capture.is-visible,
2098
+ .fb-ov-draw.is-visible { display: block; }
2099
+
2100
+ /* Element-pick highlight layer — visual only, never intercepts host events. */
2101
+ .fb-ov-pick { pointer-events: none; }
456
2102
  .fb-ov-highlight {
457
2103
  position: absolute;
458
2104
  border: 2px dashed var(--fb-color-accent);
@@ -474,155 +2120,113 @@ var Pe = `
474
2120
  box-shadow: 0 8px 20px rgba(20, 40, 70, 0.25);
475
2121
  }
476
2122
 
477
- @media (prefers-reduced-motion: reduce) {
478
- .fb-ov-highlight { transition: none; }
2123
+ /* Region-capture layer — a dim wash with a live selection box. */
2124
+ .fb-ov-capture { cursor: crosshair; }
2125
+ .fb-ov-capture-dim { position: absolute; inset: 0; background: rgba(15, 23, 32, 0.28); }
2126
+ .fb-ov-capture-sel {
2127
+ position: absolute;
2128
+ border: 2px solid var(--fb-color-accent);
2129
+ border-radius: 4px;
2130
+ box-shadow: 0 0 0 100vmax rgba(15, 23, 32, 0.32);
479
2131
  }
480
- `;
481
- var $e = 32, He = /* @__PURE__ */ new Set([
482
- "button",
483
- "submit",
484
- "reset",
485
- "checkbox",
486
- "radio",
487
- "range",
488
- "color",
489
- "file",
490
- "image",
491
- "hidden"
492
- ]);
493
- function V(e) {
494
- const t = Math.min(Math.max(e, 1), $e);
495
- return "•".repeat(t);
2132
+
2133
+ /* Draw layer — the mark SVG, the region frame, the label input, and the toolbar. */
2134
+ .fb-ov-draw-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
2135
+ .fb-ov-draw-frame {
2136
+ position: absolute;
2137
+ border: 1px solid rgba(47, 111, 237, 0.5);
2138
+ border-radius: 4px;
2139
+ box-shadow: 0 0 0 100vmax rgba(15, 23, 32, 0.18);
2140
+ pointer-events: none;
496
2141
  }
497
- function Ve(e) {
498
- for (const n of Array.from(e.querySelectorAll("input"))) {
499
- var t;
500
- const i = ((t = n.getAttribute("type")) !== null && t !== void 0 ? t : "text").toLowerCase();
501
- if (He.has(i)) continue;
502
- const l = n.value;
503
- if (!l) continue;
504
- const a = V(l.length);
505
- n.value = a, n.setAttribute("value", a);
506
- }
507
- for (const n of Array.from(e.querySelectorAll("textarea"))) {
508
- const i = n.value || n.textContent || "";
509
- if (!i) continue;
510
- const l = V(i.length);
511
- n.value = l, n.textContent = l;
512
- }
513
- for (const n of Array.from(e.querySelectorAll("[contenteditable]"))) {
514
- var o;
515
- if (n.getAttribute("contenteditable") === "false") continue;
516
- const i = (o = n.textContent) !== null && o !== void 0 ? o : "";
517
- i.trim() && (n.textContent = V(i.length));
518
- }
2142
+ .fb-ov-draw-text {
2143
+ position: absolute;
2144
+ display: none;
2145
+ font-family: var(--fb-font-sans);
2146
+ font-size: 15px;
2147
+ font-weight: 600;
2148
+ color: var(--fb-color-bug);
2149
+ background: rgba(255, 255, 255, 0.92);
2150
+ border: 1px dashed var(--fb-color-bug);
2151
+ border-radius: 4px;
2152
+ padding: 2px 6px;
2153
+ outline: none;
2154
+ z-index: 3;
519
2155
  }
520
- function te(e, t, o) {
521
- const n = e == null ? void 0 : e[`inner${o}`], i = t.documentElement[`client${o}`];
522
- return Math.max(1, Math.round((typeof n == "number" && n > 0 ? n : i) || 0) || 1);
2156
+ .fb-ov-draw-toolbar {
2157
+ position: fixed;
2158
+ left: 50%;
2159
+ bottom: 26px;
2160
+ transform: translateX(-50%);
2161
+ display: flex;
2162
+ align-items: center;
2163
+ gap: 5px;
2164
+ background: var(--fb-color-ink);
2165
+ border-radius: 12px;
2166
+ padding: 7px;
2167
+ box-shadow: 0 16px 40px rgba(15, 40, 70, 0.4);
523
2168
  }
524
- function Ue(e, t, o) {
525
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${o}"><foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(e)}</div></foreignObject></svg>`;
2169
+ .fb-ov-drawtool {
2170
+ width: 34px;
2171
+ height: 34px;
2172
+ display: flex;
2173
+ align-items: center;
2174
+ justify-content: center;
2175
+ border: 0;
2176
+ border-radius: 8px;
2177
+ background: transparent;
2178
+ color: #c4ccd4;
2179
+ cursor: pointer;
2180
+ font-family: inherit;
526
2181
  }
527
- var je = 4e3, Fe = (e, { width: t, height: o, type: n }) => new Promise((i) => {
528
- let l = !1;
529
- const a = (c) => {
530
- l || (l = !0, i(c));
531
- };
532
- try {
533
- const c = new Image(), b = setTimeout(() => a(null), je);
534
- c.onload = () => {
535
- try {
536
- const p = document.createElement("canvas");
537
- p.width = t, p.height = o;
538
- const g = p.getContext("2d");
539
- if (!g) {
540
- clearTimeout(b), a(null);
541
- return;
542
- }
543
- g.drawImage(c, 0, 0), p.toBlob((s) => {
544
- clearTimeout(b), a(s);
545
- }, n);
546
- } catch {
547
- clearTimeout(b), a(null);
548
- }
549
- }, c.onerror = () => {
550
- clearTimeout(b), a(null);
551
- }, c.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
552
- } catch {
553
- a(null);
554
- }
555
- });
556
- async function De(e = {}) {
557
- try {
558
- var t, o, n, i, l, a;
559
- const c = (t = e.doc) !== null && t !== void 0 ? t : document, b = (o = (n = e.win) !== null && n !== void 0 ? n : c.defaultView) !== null && o !== void 0 ? o : void 0, p = (i = e.target) !== null && i !== void 0 ? i : c.documentElement, g = (l = e.type) !== null && l !== void 0 ? l : "image/png", s = te(b, c, "Width"), u = te(b, c, "Height"), f = p.cloneNode(!0);
560
- Ie(f), Ve(f);
561
- const y = Ue(f, s, u), h = await ((a = e.rasterize) !== null && a !== void 0 ? a : Fe)(y, {
562
- width: s,
563
- height: u,
564
- type: g
565
- });
566
- return h ? {
567
- blob: h,
568
- width: s,
569
- height: u,
570
- type: g
571
- } : null;
572
- } catch {
573
- return null;
574
- }
2182
+ .fb-ov-drawtool:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
2183
+ .fb-ov-drawtool.is-active { background: var(--fb-color-accent); color: var(--fb-color-on-emphasis); }
2184
+ .fb-ov-drawtool__t { font-weight: 700; font-size: 14px; line-height: 1; }
2185
+ .fb-ov-draw-divider { width: 1px; height: 22px; background: #2a343e; margin: 0 3px; }
2186
+ .fb-ov-draw-undo {
2187
+ width: 34px;
2188
+ height: 34px;
2189
+ display: flex;
2190
+ align-items: center;
2191
+ justify-content: center;
2192
+ border: 0;
2193
+ border-radius: 8px;
2194
+ background: transparent;
2195
+ color: #c4ccd4;
2196
+ cursor: pointer;
575
2197
  }
576
- var Ke = "screenshot";
577
- function qe(e) {
578
- return `${e.replace(/\/+$/, "")}/api/ingest/feedback`;
2198
+ .fb-ov-draw-undo:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: #fff; }
2199
+ .fb-ov-draw-undo:disabled { opacity: 0.4; cursor: default; }
2200
+ .fb-ov-draw-cancel {
2201
+ height: 34px;
2202
+ padding: 0 12px;
2203
+ border: 0;
2204
+ border-radius: 8px;
2205
+ background: transparent;
2206
+ color: var(--fb-color-faint);
2207
+ font-family: inherit;
2208
+ font-size: 12.5px;
2209
+ cursor: pointer;
579
2210
  }
580
- function Xe(e) {
581
- if (!e) return {};
582
- const t = {};
583
- return e.signedIdentity && (t.signedIdentity = e.signedIdentity), e.reporterId && (t.reporterId = e.reporterId), e.anonymousId && (t.anonymousId = e.anonymousId), t;
2211
+ .fb-ov-draw-cancel:hover { color: #fff; }
2212
+ .fb-ov-draw-attach {
2213
+ height: 34px;
2214
+ padding: 0 15px;
2215
+ border: 0;
2216
+ border-radius: 8px;
2217
+ background: var(--fb-color-accent);
2218
+ color: var(--fb-color-on-emphasis);
2219
+ font-family: inherit;
2220
+ font-size: 12.5px;
2221
+ font-weight: 600;
2222
+ cursor: pointer;
584
2223
  }
585
- async function Ye(e, t, o = fetch) {
586
- var n;
587
- const i = {
588
- key: t.key,
589
- ...Xe(t.identity),
590
- ...t.content
591
- }, l = new FormData();
592
- if (l.append("payload", JSON.stringify(i)), !((n = t.screenshot) === null || n === void 0) && n.blob) {
593
- var a;
594
- l.append(Ke, t.screenshot.blob, (a = t.screenshot.filename) !== null && a !== void 0 ? a : "screenshot.png");
595
- }
596
- let c;
597
- try {
598
- c = await o(qe(e), {
599
- method: "POST",
600
- body: l
601
- });
602
- } catch {
603
- return {
604
- ok: !1,
605
- reason: "unreachable"
606
- };
607
- }
608
- if (!c.ok) return {
609
- ok: !1,
610
- reason: "refused",
611
- status: c.status
612
- };
613
- try {
614
- return {
615
- ok: !0,
616
- feedback: await c.json()
617
- };
618
- } catch {
619
- return {
620
- ok: !0,
621
- feedback: null
622
- };
623
- }
2224
+ .fb-ov-draw-attach:hover { background: var(--fb-color-accent-hover); }
2225
+
2226
+ @media (prefers-reduced-motion: reduce) {
2227
+ .fb-ov-highlight { transition: none; }
624
2228
  }
625
- var re = "0.1.0", Ge = "data-fixback-overlay", We = [
2229
+ `, Rn = "data-fixback-overlay", $n = "http://www.w3.org/2000/svg", Nn = [
626
2230
  {
627
2231
  value: "bug",
628
2232
  label: "Bug"
@@ -635,257 +2239,588 @@ var re = "0.1.0", Ge = "data-fixback-overlay", We = [
635
2239
  value: "idea",
636
2240
  label: "Idea"
637
2241
  }
638
- ], Je = 1800;
639
- function d(e, t, o = {}, n = []) {
2242
+ ], Bn = [
2243
+ {
2244
+ tool: "arrow",
2245
+ label: "Arrow"
2246
+ },
2247
+ {
2248
+ tool: "box",
2249
+ label: "Box"
2250
+ },
2251
+ {
2252
+ tool: "pen",
2253
+ label: "Pen"
2254
+ },
2255
+ {
2256
+ tool: "text",
2257
+ label: "Text label"
2258
+ }
2259
+ ], et = 1800;
2260
+ function x(e, t, o = {}, n = []) {
640
2261
  const i = e.createElement(t);
641
- for (const [l, a] of Object.entries(o)) a !== void 0 && i.setAttribute(l, a);
642
- for (const l of n) i.appendChild(typeof l == "string" ? e.createTextNode(l) : l);
2262
+ for (const [r, s] of Object.entries(o)) s !== void 0 && i.setAttribute(r, s);
2263
+ for (const r of n) i.appendChild(typeof r == "string" ? e.createTextNode(r) : r);
643
2264
  return i;
644
2265
  }
645
- var Ze = {
646
- "image/png": "png",
647
- "image/jpeg": "jpg",
648
- "image/webp": "webp",
649
- "image/gif": "gif"
650
- };
651
- function Qe(e) {
652
- var t;
653
- return (t = Ze[e]) !== null && t !== void 0 ? t : "png";
2266
+ function j(e, t, o = {}, n = []) {
2267
+ const i = e.createElementNS($n, t);
2268
+ for (const [r, s] of Object.entries(o)) i.setAttribute(r, s);
2269
+ for (const r of n) i.appendChild(r);
2270
+ return i;
654
2271
  }
655
- function et(e) {
656
- var t, o, n, i, l, a, c, b, p, g;
657
- const s = (t = e.doc) !== null && t !== void 0 ? t : document, u = (o = (n = e.win) !== null && n !== void 0 ? n : s.defaultView) !== null && o !== void 0 ? o : window, f = (i = e.sdkVersion) !== null && i !== void 0 ? i : re, y = {
658
- captureView: (l = (a = e.deps) === null || a === void 0 ? void 0 : a.captureView) !== null && l !== void 0 ? l : De,
659
- submitReport: (c = (b = e.deps) === null || b === void 0 ? void 0 : b.submitReport) !== null && c !== void 0 ? c : Ye,
660
- startElementPicker: (p = (g = e.deps) === null || g === void 0 ? void 0 : g.startElementPicker) !== null && p !== void 0 ? p : Me
2272
+ function Pn(e) {
2273
+ var t, o, n, i, r, s, f, l, d, h;
2274
+ const a = (t = e.doc) !== null && t !== void 0 ? t : document, b = (o = (n = e.win) !== null && n !== void 0 ? n : a.defaultView) !== null && o !== void 0 ? o : window, u = (i = e.sdkVersion) !== null && i !== void 0 ? i : de, m = {
2275
+ captureView: (r = (s = e.deps) === null || s === void 0 ? void 0 : s.captureView) !== null && r !== void 0 ? r : dt,
2276
+ submitReport: (f = (l = e.deps) === null || l === void 0 ? void 0 : l.submitReport) !== null && f !== void 0 ? f : ut,
2277
+ startElementPicker: (d = (h = e.deps) === null || h === void 0 ? void 0 : h.startElementPicker) !== null && d !== void 0 ? d : Ft
661
2278
  };
662
- let h = null, r = null, E = null, T = null, I = !1;
663
- const x = {
2279
+ let p = null, c = null, T = null, C = null, w = null, _ = null, N = null, M = !1, A = "compose";
2280
+ const y = {
664
2281
  kind: "bug",
665
2282
  selectedElement: null,
2283
+ region: null,
2284
+ marks: [],
666
2285
  phase: "compose"
667
2286
  };
668
- function L(v, m) {
669
- r && (r.status.textContent = v, r.status.classList.toggle("is-error", m));
2287
+ function D(g, k) {
2288
+ c && (c.status.textContent = g, c.status.classList.toggle("is-error", k));
670
2289
  }
671
- function j(v) {
672
- if (x.kind = v, !!r)
673
- for (const [m, w] of r.tabs) {
674
- const k = m === v;
675
- w.classList.toggle("is-active", k), w.setAttribute("aria-pressed", String(k));
2290
+ function v(g) {
2291
+ if (y.kind = g, !!c)
2292
+ for (const [k, B] of c.tabs) {
2293
+ const P = k === g;
2294
+ B.classList.toggle("is-active", P), B.setAttribute("aria-pressed", String(P));
676
2295
  }
677
2296
  }
678
- function F() {
679
- r && (x.selectedElement ? (r.mark.classList.add("has-element"), r.selector.textContent = x.selectedElement.selector, r.caption.textContent = "Element selected · masked screenshot on Send", r.pickBtn.textContent = "", r.pickBtn.append(oe(s), s.createTextNode("Change element"))) : (r.mark.classList.remove("has-element"), r.selector.textContent = "", r.caption.textContent = "Masked screenshot attached on Send", r.pickBtn.textContent = "", r.pickBtn.append(oe(s), s.createTextNode("Pick element"))));
2297
+ function S(g) {
2298
+ if (A = g, !c) return;
2299
+ const k = g !== "compose";
2300
+ c.panel.classList.toggle("is-marking", k), c.pickLayer.classList.toggle("is-visible", g === "picking"), c.captureLayer.classList.toggle("is-visible", g === "capturing"), c.drawLayer.classList.toggle("is-visible", g === "drawing"), c.pickBtn.classList.toggle("is-active", g === "picking"), c.captureBtn.classList.toggle("is-active", g === "capturing" || g === "drawing");
2301
+ }
2302
+ function U() {
2303
+ if (!c) return;
2304
+ const g = !!y.selectedElement, k = !!y.region, B = y.marks.length;
2305
+ c.mark.classList.toggle("has-element", g), c.selector.textContent = g ? y.selectedElement.selector : "", c.pickBtn.textContent = "", c.pickBtn.append(On(a), a.createTextNode(g ? "Change element" : "Pick element")), c.captureBtn.classList.toggle("is-attached", k || B > 0);
2306
+ const P = [];
2307
+ g && P.push("Element"), k && P.push("Region"), B > 0 && P.push(`${B} mark${B === 1 ? "" : "s"}`), c.caption.textContent = P.length ? `${P.join(" · ")} · masked screenshot on Send` : "Masked screenshot attached on Send";
680
2308
  }
681
- function ie(v) {
682
- if (!r) return;
683
- if (!v) {
684
- r.highlight.style.display = "none";
2309
+ function $(g) {
2310
+ if (!c) return;
2311
+ if (!g) {
2312
+ c.highlight.style.display = "none";
685
2313
  return;
686
2314
  }
687
- const m = v.getBoundingClientRect();
688
- r.highlight.style.display = "block", r.highlight.style.left = `${m.left}px`, r.highlight.style.top = `${m.top}px`, r.highlight.style.width = `${m.width}px`, r.highlight.style.height = `${m.height}px`;
2315
+ const k = g.getBoundingClientRect();
2316
+ c.highlight.style.display = "block", c.highlight.style.left = `${k.left}px`, c.highlight.style.top = `${k.top}px`, c.highlight.style.width = `${k.width}px`, c.highlight.style.height = `${k.height}px`;
2317
+ }
2318
+ function Z() {
2319
+ T == null || T.stop(), T = null;
2320
+ }
2321
+ function I() {
2322
+ c && (c.highlight.style.display = "none"), Z(), A === "picking" && S("compose");
689
2323
  }
690
- function N() {
691
- E == null || E.stop(), E = null;
2324
+ function L() {
2325
+ c && (Y(), S("picking"), T = m.startElementPicker({
2326
+ doc: a,
2327
+ onHover: $,
2328
+ onPick: (g) => {
2329
+ y.selectedElement = jt(g), I(), U();
2330
+ },
2331
+ onCancel: I
2332
+ }));
2333
+ }
2334
+ function O(g) {
2335
+ if (!c) return;
2336
+ const k = c.selBox;
2337
+ if (!g) {
2338
+ k.style.display = "none";
2339
+ return;
2340
+ }
2341
+ k.style.display = "block", k.style.left = `${g.x}px`, k.style.top = `${g.y}px`, k.style.width = `${g.width}px`, k.style.height = `${g.height}px`;
692
2342
  }
693
- function S() {
694
- r && (r.panel.classList.remove("is-picking"), r.pickBtn.classList.remove("is-active"), r.highlight.style.display = "none"), N();
2343
+ function R() {
2344
+ C == null || C.stop(), C = null;
695
2345
  }
696
- function ae() {
697
- r && (N(), r.panel.classList.add("is-picking"), r.pickBtn.classList.add("is-active"), E = y.startElementPicker({
698
- doc: s,
699
- onHover: ie,
700
- onPick: (v) => {
701
- x.selectedElement = Re(v), S(), F();
2346
+ function z() {
2347
+ c && (Y(), O(null), S("capturing"), C = An({
2348
+ doc: a,
2349
+ onProgress: O,
2350
+ onComplete: (g) => {
2351
+ R(), O(null), yt(g);
702
2352
  },
703
- onCancel: S
2353
+ onCancel: () => {
2354
+ R(), O(null), S("compose");
2355
+ }
704
2356
  }));
705
2357
  }
706
- function _() {
707
- T !== null && (clearTimeout(T), T = null);
2358
+ function fe(g) {
2359
+ c && (c.drawFrame.style.left = `${g.x}px`, c.drawFrame.style.top = `${g.y}px`, c.drawFrame.style.width = `${g.width}px`, c.drawFrame.style.height = `${g.height}px`);
2360
+ }
2361
+ function J(g) {
2362
+ if (w == null || w.setTool(g), !!c)
2363
+ for (const [k, B] of c.drawTools) B.classList.toggle("is-active", k === g);
2364
+ }
2365
+ function Q(g) {
2366
+ c && (c.undoBtn.disabled = g.length === 0);
2367
+ }
2368
+ function G() {
2369
+ w == null || w.stop(), w = null;
2370
+ }
2371
+ function yt(g) {
2372
+ c && (_ = g, fe(g), S("drawing"), w = Ln({
2373
+ doc: a,
2374
+ svg: c.drawSvg,
2375
+ textInput: c.drawText,
2376
+ initialMarks: y.marks,
2377
+ onChange: Q
2378
+ }), J("arrow"), Q(y.marks));
2379
+ }
2380
+ function wt() {
2381
+ w && (y.marks = w.marks().slice(), _ && (y.region = _)), Ce(), U();
708
2382
  }
709
- async function se() {
710
- if (!(!r || x.phase === "sending")) {
711
- x.phase = "sending", r.sendBtn.disabled = !0, r.sendBtn.textContent = "Sending…", L("", !1);
2383
+ function kt() {
2384
+ Ce(), U();
2385
+ }
2386
+ function Ce() {
2387
+ G(), _ = null, A === "drawing" && S("compose");
2388
+ }
2389
+ function Y() {
2390
+ Z(), R(), G(), _ = null, O(null), c && (c.highlight.style.display = "none"), A !== "compose" && S("compose");
2391
+ }
2392
+ function be() {
2393
+ N !== null && (clearTimeout(N), N = null);
2394
+ }
2395
+ async function Et() {
2396
+ if (!(!c || y.phase === "sending")) {
2397
+ Y(), y.phase = "sending", c.sendBtn.disabled = !0, c.sendBtn.textContent = "Sending…", D("", !1);
712
2398
  try {
713
- var v, m;
714
- const w = ze({
715
- kind: x.kind,
716
- comment: r.comment.value,
717
- element: (v = x.selectedElement) !== null && v !== void 0 ? v : void 0,
718
- url: (m = u.location) === null || m === void 0 ? void 0 : m.href,
719
- environment: Be(u, f)
720
- }), k = await y.captureView({
721
- doc: s,
722
- win: u
723
- }), M = k ? {
724
- blob: k.blob,
725
- filename: `screenshot.${Qe(k.type)}`
726
- } : null, C = await y.submitReport(e.apiUrl, {
2399
+ var g, k, B, P;
2400
+ const ee = lt({
2401
+ kind: y.kind,
2402
+ comment: c.comment.value,
2403
+ element: (g = y.selectedElement) !== null && g !== void 0 ? g : void 0,
2404
+ region: (k = y.region) !== null && k !== void 0 ? k : void 0,
2405
+ marks: y.marks.length > 0 ? y.marks : void 0,
2406
+ url: (B = b.location) === null || B === void 0 ? void 0 : B.href,
2407
+ environment: st(b, u),
2408
+ trace: (P = e.buffer) === null || P === void 0 ? void 0 : P.snapshot()
2409
+ }), te = nt(ee, {
2410
+ hook: e.beforeSend,
2411
+ scrub: e.scrub
2412
+ });
2413
+ if (!te) {
2414
+ y.phase = "sent", c.panel.classList.add("is-sent"), N = setTimeout(re, et);
2415
+ return;
2416
+ }
2417
+ const K = await m.captureView({
2418
+ doc: a,
2419
+ win: b
2420
+ }), ie = K ? {
2421
+ blob: K.blob,
2422
+ filename: `screenshot.${ct(K.type)}`
2423
+ } : null, oe = await m.submitReport(e.apiUrl, {
727
2424
  key: e.key,
728
2425
  identity: e.identity,
729
- content: w,
730
- screenshot: M
2426
+ content: te,
2427
+ screenshot: ie
731
2428
  });
732
- C.ok ? (x.phase = "sent", r.panel.classList.add("is-sent"), T = setTimeout(R, Je)) : (O(), L(C.reason === "unreachable" ? "Couldn't reach Fixback — try again." : "Fixback couldn't accept this report.", !0));
2429
+ oe.ok ? (y.phase = "sent", c.panel.classList.add("is-sent"), N = setTimeout(re, et)) : (pe(), D(oe.reason === "unreachable" ? "Couldn't reach Fixback — try again." : "Fixback couldn't accept this report.", !0));
733
2430
  } catch {
734
- O(), L("Something went wrong — try again.", !0);
2431
+ pe(), D("Something went wrong — try again.", !0);
735
2432
  }
736
2433
  }
737
2434
  }
738
- function O() {
739
- x.phase = "compose", r && (r.sendBtn.disabled = !1, r.sendBtn.textContent = "Send");
2435
+ function pe() {
2436
+ y.phase = "compose", c && (c.sendBtn.disabled = !1, c.sendBtn.textContent = "Send");
740
2437
  }
741
- function le() {
742
- var v;
743
- h = d(s, "div", { [Ge]: "" }), h.style.cssText = "position:fixed;right:20px;bottom:84px;z-index:2147483001;margin:0;padding:0;border:0;display:none;";
744
- const m = h.attachShadow({ mode: "open" }), w = s.createElement("style");
745
- w.textContent = Pe, m.appendChild(w);
746
- const k = d(s, "button", {
2438
+ function _t() {
2439
+ var g;
2440
+ p = x(a, "div", { [Rn]: "" }), p.style.cssText = "position:fixed;right:20px;bottom:84px;z-index:2147483001;margin:0;padding:0;border:0;display:none;";
2441
+ const k = p.attachShadow({ mode: "open" }), B = a.createElement("style");
2442
+ B.textContent = In, k.appendChild(B);
2443
+ const P = x(a, "button", {
747
2444
  type: "button",
748
2445
  class: "fb-ov-close",
749
2446
  "aria-label": "Close"
750
- }, ["✕"]), M = d(s, "div", { class: "fb-ov-head" }, [
751
- d(s, "span", { class: "fb-ov-mark-sq" }),
752
- d(s, "span", { class: "fb-ov-brand" }, ["Fixback"]),
753
- k
754
- ]), C = /* @__PURE__ */ new Map(), D = d(s, "div", { class: "fb-ov-tabs" });
755
- for (const { value: $, label: he } of We) {
756
- const H = d(s, "button", {
2447
+ }, ["✕"]), ee = x(a, "div", { class: "fb-ov-head" }, [x(a, "span", { class: "fb-ov-mark-sq" }), x(a, "span", { class: "fb-ov-brand" }, ["Fixback"])]);
2448
+ e.tier != null && ee.appendChild(x(a, "span", {
2449
+ class: "fb-ov-tier",
2450
+ "aria-label": `Trust tier: ${e.tier}`
2451
+ }, [e.tier])), ee.appendChild(P);
2452
+ const te = /* @__PURE__ */ new Map(), K = x(a, "div", { class: "fb-ov-tabs" });
2453
+ for (const { value: F, label: le } of Nn) {
2454
+ const H = x(a, "button", {
757
2455
  type: "button",
758
2456
  class: "fb-ov-tab",
759
- "data-kind": $
760
- }, [he]);
761
- H.addEventListener("click", () => j($)), C.set($, H), D.appendChild(H);
2457
+ "data-kind": F
2458
+ }, [le]);
2459
+ H.addEventListener("click", () => v(F)), te.set(F, H), K.appendChild(H);
762
2460
  }
763
- const K = d(s, "span", { class: "fb-ov-selector" }), q = d(s, "span", { class: "fb-ov-mark-caption" }), X = d(s, "div", { class: "fb-ov-mark" }, [K, q]), Y = d(s, "textarea", {
2461
+ const ie = x(a, "span", { class: "fb-ov-selector" }), oe = x(a, "span", { class: "fb-ov-mark-caption" }), Le = x(a, "div", { class: "fb-ov-mark" }, [ie, oe]), Me = x(a, "textarea", {
764
2462
  class: "fb-ov-comment",
765
2463
  placeholder: "Describe what you saw or want…",
766
2464
  "aria-label": "Comment"
767
- }), G = d(s, "div", {
2465
+ }), Ae = x(a, "div", {
768
2466
  class: "fb-ov-status",
769
2467
  role: "status",
770
2468
  "aria-live": "polite"
771
- }), B = d(s, "button", {
2469
+ }), he = x(a, "button", {
772
2470
  type: "button",
773
- class: "fb-ov-pickbtn"
2471
+ class: "fb-ov-pickbtn",
2472
+ title: "Point at an element"
774
2473
  });
775
- B.addEventListener("click", () => {
776
- x.phase !== "sending" && (r != null && r.panel.classList.contains("is-picking") ? S() : ae());
2474
+ he.addEventListener("click", () => {
2475
+ y.phase !== "sending" && (A === "picking" ? I() : L());
777
2476
  });
778
- const z = d(s, "button", {
2477
+ const ae = x(a, "button", {
2478
+ type: "button",
2479
+ class: "fb-ov-capturebtn",
2480
+ title: "Capture a region and draw",
2481
+ "aria-label": "Capture a region and draw"
2482
+ });
2483
+ ae.appendChild(Un(a)), ae.addEventListener("click", () => {
2484
+ y.phase !== "sending" && z();
2485
+ });
2486
+ const ve = x(a, "button", {
779
2487
  type: "button",
780
2488
  class: "fb-ov-send"
781
2489
  }, ["Send"]);
782
- z.addEventListener("click", () => {
783
- se();
2490
+ ve.addEventListener("click", () => {
2491
+ Et();
784
2492
  });
785
- const ue = d(s, "div", { class: "fb-ov-tools" }, [B, z]), be = d(s, "div", { class: "fb-ov-form" }, [
786
- D,
787
- X,
788
- Y,
789
- G,
790
- ue
791
- ]), pe = d(s, "div", { class: "fb-ov-done" }, [
792
- d(s, "div", { class: "fb-ov-done__check" }, ["✓"]),
793
- d(s, "div", { class: "fb-ov-done__title" }, ["Report sent"]),
794
- d(s, "div", { class: "fb-ov-done__sub" }, ["Thanks — the team can see it now."])
795
- ]), W = d(s, "div", {
2493
+ const Lt = x(a, "div", { class: "fb-ov-tools" }, [
2494
+ he,
2495
+ ae,
2496
+ ve
2497
+ ]), Mt = x(a, "div", { class: "fb-ov-form" }, [
2498
+ K,
2499
+ Le,
2500
+ Me,
2501
+ Ae,
2502
+ Lt
2503
+ ]), At = x(a, "div", { class: "fb-ov-done" }, [
2504
+ x(a, "div", { class: "fb-ov-done__check" }, ["✓"]),
2505
+ x(a, "div", { class: "fb-ov-done__title" }, ["Report sent"]),
2506
+ x(a, "div", { class: "fb-ov-done__sub" }, ["Thanks — the team can see it now."])
2507
+ ]), Ie = x(a, "div", {
796
2508
  class: "fb-ov-panel",
797
2509
  role: "dialog",
798
2510
  "aria-label": "Fixback feedback"
799
2511
  }, [
800
- M,
801
- be,
802
- pe
803
- ]), P = d(s, "div", { class: "fb-ov-highlight" });
804
- P.style.display = "none";
805
- const ve = d(s, "div", { class: "fb-ov-pick" }, [d(s, "div", { class: "fb-ov-hint" }, ["Click the element you mean · Esc to cancel"]), P]);
806
- m.appendChild(W), m.appendChild(ve), k.addEventListener("click", R), ((v = e.target) !== null && v !== void 0 ? v : s.body).appendChild(h), r = {
807
- panel: W,
808
- tabs: C,
809
- mark: X,
810
- selector: K,
811
- caption: q,
812
- comment: Y,
813
- status: G,
814
- pickBtn: B,
815
- sendBtn: z,
816
- highlight: P
2512
+ ee,
2513
+ Mt,
2514
+ At
2515
+ ]), me = x(a, "div", { class: "fb-ov-highlight" });
2516
+ me.style.display = "none";
2517
+ const Re = x(a, "div", { class: "fb-ov-pick" }, [x(a, "div", { class: "fb-ov-hint" }, ["Click the element you mean · Esc to cancel"]), me]), ge = x(a, "div", { class: "fb-ov-capture-sel" });
2518
+ ge.style.display = "none";
2519
+ const $e = x(a, "div", { class: "fb-ov-capture" }, [
2520
+ x(a, "div", { class: "fb-ov-capture-dim" }),
2521
+ x(a, "div", { class: "fb-ov-hint" }, ["Drag to capture an area · Esc to cancel"]),
2522
+ ge
2523
+ ]), Ne = j(a, "svg", {
2524
+ class: "fb-ov-draw-svg",
2525
+ width: "100%",
2526
+ height: "100%"
2527
+ }), xe = x(a, "input", {
2528
+ class: "fb-ov-draw-text",
2529
+ placeholder: "label…",
2530
+ "aria-label": "Mark label"
2531
+ });
2532
+ xe.style.display = "none";
2533
+ const Be = x(a, "div", { class: "fb-ov-draw-frame" }), Pe = /* @__PURE__ */ new Map(), Oe = [];
2534
+ for (const { tool: F, label: le } of Bn) {
2535
+ const H = x(a, "button", {
2536
+ type: "button",
2537
+ class: "fb-ov-drawtool",
2538
+ "data-tool": F,
2539
+ title: le,
2540
+ "aria-label": le
2541
+ });
2542
+ H.appendChild(Dn(a, F)), H.addEventListener("click", () => J(F)), Pe.set(F, H), Oe.push(H);
2543
+ }
2544
+ const se = x(a, "button", {
2545
+ type: "button",
2546
+ class: "fb-ov-draw-undo",
2547
+ title: "Undo",
2548
+ "aria-label": "Undo"
2549
+ });
2550
+ se.appendChild(zn(a)), se.addEventListener("click", () => w == null ? void 0 : w.undo());
2551
+ const Ue = x(a, "button", {
2552
+ type: "button",
2553
+ class: "fb-ov-draw-cancel"
2554
+ }, ["Cancel"]);
2555
+ Ue.addEventListener("click", () => kt());
2556
+ const ze = x(a, "button", {
2557
+ type: "button",
2558
+ class: "fb-ov-draw-attach"
2559
+ }, ["Attach"]);
2560
+ ze.addEventListener("click", () => wt());
2561
+ const It = x(a, "div", { class: "fb-ov-draw-toolbar" }, [
2562
+ ...Oe,
2563
+ x(a, "span", { class: "fb-ov-draw-divider" }),
2564
+ se,
2565
+ Ue,
2566
+ ze
2567
+ ]), De = x(a, "div", { class: "fb-ov-draw" }, [
2568
+ Be,
2569
+ Ne,
2570
+ xe,
2571
+ It
2572
+ ]);
2573
+ k.append(Ie, Re, $e, De), P.addEventListener("click", re), ((g = e.target) !== null && g !== void 0 ? g : a.body).appendChild(p), c = {
2574
+ panel: Ie,
2575
+ tabs: te,
2576
+ mark: Le,
2577
+ selector: ie,
2578
+ caption: oe,
2579
+ comment: Me,
2580
+ status: Ae,
2581
+ pickBtn: he,
2582
+ captureBtn: ae,
2583
+ sendBtn: ve,
2584
+ highlight: me,
2585
+ pickLayer: Re,
2586
+ captureLayer: $e,
2587
+ selBox: ge,
2588
+ drawLayer: De,
2589
+ drawSvg: Ne,
2590
+ drawText: xe,
2591
+ drawFrame: Be,
2592
+ drawTools: Pe,
2593
+ undoBtn: se
817
2594
  };
818
2595
  }
819
- function ce() {
820
- (!h || !r) && le();
2596
+ function St() {
2597
+ (!p || !c) && _t();
821
2598
  }
822
- function de() {
823
- if (ce(), !(!h || !r)) {
824
- _(), S(), x.phase = "compose", x.selectedElement = null, r.panel.classList.remove("is-sent"), r.comment.value = "", O(), L("", !1), j("bug"), F(), h.style.display = "block", I = !0;
2599
+ function Tt() {
2600
+ if (St(), !(!p || !c)) {
2601
+ be(), Y(), y.phase = "compose", y.selectedElement = null, y.region = null, y.marks = [], c.panel.classList.remove("is-sent"), c.comment.value = "", pe(), D("", !1), v("bug"), U(), p.style.display = "block", M = !0;
825
2602
  try {
826
- r.comment.focus();
2603
+ c.comment.focus();
827
2604
  } catch {
828
2605
  }
829
2606
  }
830
2607
  }
831
- function R() {
832
- _(), S(), h && (h.style.display = "none"), I = !1;
2608
+ function re() {
2609
+ be(), Y(), p && (p.style.display = "none"), M = !1;
833
2610
  }
834
- function fe() {
835
- _(), N(), h == null || h.remove(), h = null, r = null, I = !1;
2611
+ function Ct() {
2612
+ be(), Y(), p == null || p.remove(), p = null, c = null, M = !1;
836
2613
  }
837
2614
  return {
838
- open: de,
839
- close: R,
840
- destroy: fe,
2615
+ open: Tt,
2616
+ close: re,
2617
+ destroy: Ct,
841
2618
  get isOpen() {
842
- return I;
2619
+ return M;
843
2620
  }
844
2621
  };
845
2622
  }
846
- function oe(e) {
847
- return d(e, "span", {
2623
+ function On(e) {
2624
+ return x(e, "span", {
848
2625
  class: "fb-ov-pickbtn__glyph",
849
2626
  "aria-hidden": "true"
850
2627
  }, ["⌖"]);
851
2628
  }
852
- var tt = "https://api.fixback.dev", A = { destroy() {
2629
+ function Un(e) {
2630
+ return j(e, "svg", {
2631
+ class: "fb-ov-icon",
2632
+ width: "14",
2633
+ height: "14",
2634
+ viewBox: "0 0 16 16",
2635
+ fill: "none",
2636
+ stroke: "currentColor",
2637
+ "stroke-width": "1.5",
2638
+ "aria-hidden": "true"
2639
+ }, [j(e, "path", { d: "M2 5V2h3M14 5V2h-3M2 11v3h3M14 11v3h-3" })]);
2640
+ }
2641
+ function zn(e) {
2642
+ return j(e, "svg", {
2643
+ class: "fb-ov-icon",
2644
+ width: "15",
2645
+ height: "15",
2646
+ viewBox: "0 0 16 16",
2647
+ fill: "none",
2648
+ stroke: "currentColor",
2649
+ "stroke-width": "1.6",
2650
+ "aria-hidden": "true"
2651
+ }, [j(e, "path", { d: "M6 4 3 7l3 3M3 7h6a4 4 0 0 1 0 8H7" })]);
2652
+ }
2653
+ function Dn(e, t) {
2654
+ return t === "text" ? x(e, "span", {
2655
+ class: "fb-ov-drawtool__t",
2656
+ "aria-hidden": "true"
2657
+ }, ["T"]) : j(e, "svg", {
2658
+ class: "fb-ov-icon",
2659
+ width: "15",
2660
+ height: "15",
2661
+ viewBox: "0 0 16 16",
2662
+ fill: "none",
2663
+ stroke: "currentColor",
2664
+ "stroke-width": "1.6",
2665
+ "aria-hidden": "true"
2666
+ }, [{
2667
+ arrow: j(e, "path", { d: "M3 13 13 3M7 3h6v6" }),
2668
+ box: j(e, "rect", {
2669
+ x: "2.5",
2670
+ y: "3.5",
2671
+ width: "11",
2672
+ height: "9",
2673
+ rx: "1"
2674
+ }),
2675
+ pen: j(e, "path", { d: "M3 13l1-3 6-6 2 2-6 6-3 1Z" })
2676
+ }[t]]);
2677
+ }
2678
+ var jn = "https://api.fixback.dev", Ee = { destroy() {
853
2679
  } };
854
- async function ot(e) {
2680
+ function Fn() {
2681
+ try {
2682
+ const e = window.location;
2683
+ return e.host || e.hostname || "this site";
2684
+ } catch {
2685
+ return "this site";
2686
+ }
2687
+ }
2688
+ function Hn() {
855
2689
  try {
856
- var t, o, n;
857
- if (typeof document == "undefined") return A;
858
- const i = e == null ? void 0 : e.key;
859
- if (typeof i != "string" || i.length === 0) return A;
860
- const l = (t = e.apiUrl) !== null && t !== void 0 ? t : tt, a = (o = e.anonymousId) !== null && o !== void 0 ? o : ye(), c = await xe(l, {
861
- key: i,
862
- signedIdentity: e.signedIdentity,
863
- reporterId: e.reporterId,
864
- anonymousId: a
2690
+ return window.location.href;
2691
+ } catch {
2692
+ return "";
2693
+ }
2694
+ }
2695
+ function Vn(e) {
2696
+ const { options: t, apiUrl: o, key: n, identity: i, target: r, answer: s } = e, f = gn(r, {
2697
+ key: n,
2698
+ reduceMotion: t.reduceMotion
2699
+ }), l = o.replace(/\/+$/, "");
2700
+ let d = null, h = () => {
2701
+ };
2702
+ if (t.trace !== !1) {
2703
+ var a;
2704
+ const p = (a = t.trace) !== null && a !== void 0 ? a : {};
2705
+ d = to({
2706
+ maxBreadcrumbs: p.maxBreadcrumbs,
2707
+ maxAgeMs: p.maxAgeMs,
2708
+ beforeBreadcrumb: p.beforeBreadcrumb
2709
+ }), h = mo(d, {
2710
+ consoleLevels: p.consoleLevels,
2711
+ ignoreUrl: (c) => c.startsWith(l)
865
2712
  });
866
- if (!(c != null && c.canSubmit)) return A;
867
- const b = (n = e.target) !== null && n !== void 0 ? n : document.body, p = Ee(b), g = et({
868
- apiUrl: l,
869
- key: i,
870
- identity: {
2713
+ }
2714
+ const b = Pn({
2715
+ apiUrl: o,
2716
+ key: n,
2717
+ identity: i,
2718
+ gate: s.gate,
2719
+ tier: s.tier,
2720
+ sdkVersion: de,
2721
+ target: r,
2722
+ buffer: d,
2723
+ beforeSend: t.beforeSend,
2724
+ scrub: t.scrub
2725
+ }), u = () => b.open();
2726
+ f.host.addEventListener(Se, u);
2727
+ let m = () => {
2728
+ };
2729
+ return t.autoCapture !== !1 && (m = Jo({
2730
+ apiUrl: o,
2731
+ key: n,
2732
+ identity: i,
2733
+ sdkVersion: de,
2734
+ buffer: d,
2735
+ beforeSend: t.beforeSend,
2736
+ scrub: t.scrub
2737
+ }).destroy), () => {
2738
+ f.host.removeEventListener(Se, u), b.destroy(), xn(f), h(), m();
2739
+ };
2740
+ }
2741
+ async function xt(e, t) {
2742
+ try {
2743
+ var o, n, i;
2744
+ if (typeof document == "undefined") return Ee;
2745
+ const r = e == null ? void 0 : e.key;
2746
+ if (typeof r != "string" || r.length === 0) return Ee;
2747
+ const s = (o = e.apiUrl) !== null && o !== void 0 ? o : jn, f = (n = e.anonymousId) !== null && n !== void 0 ? n : Qo(), l = (i = e.target) !== null && i !== void 0 ? i : document.body;
2748
+ let d = !1, h = () => {
2749
+ }, a = () => {
2750
+ };
2751
+ const b = { destroy: () => {
2752
+ d = !0, a(), a = () => {
2753
+ }, h(), h = () => {
2754
+ };
2755
+ } }, u = () => {
2756
+ var p;
2757
+ const c = We(r);
2758
+ return {
871
2759
  signedIdentity: e.signedIdentity,
872
- reporterId: e.reporterId,
873
- anonymousId: a
874
- },
875
- sdkVersion: re,
876
- target: b
877
- }), s = () => g.open();
878
- return p.host.addEventListener(U, s), { destroy: () => {
879
- p.host.removeEventListener(U, s), g.destroy(), Se(p);
880
- } };
2760
+ reporterId: (p = e.reporterId) !== null && p !== void 0 ? p : c == null ? void 0 : c.reporterId,
2761
+ anonymousId: f
2762
+ };
2763
+ }, m = async (p) => {
2764
+ const c = await Nt(s, {
2765
+ key: r,
2766
+ ...p
2767
+ });
2768
+ d || !(c != null && c.canSubmit) || (h = Vn({
2769
+ options: e,
2770
+ apiUrl: s,
2771
+ key: r,
2772
+ identity: p,
2773
+ target: l,
2774
+ answer: c
2775
+ }));
2776
+ };
2777
+ if (t) {
2778
+ const p = await ln(s, t);
2779
+ if (d) return b;
2780
+ if (p && p.status === "pending") {
2781
+ const c = We(r), T = async (w) => {
2782
+ const _ = await cn(s, t);
2783
+ d || (a(), a = () => {
2784
+ }, _ && _.status === "redeemed" ? (nn(r, {
2785
+ reporterId: _.reporterId,
2786
+ name: w.name,
2787
+ email: w.email
2788
+ }), on(window), await m({
2789
+ signedIdentity: e.signedIdentity,
2790
+ reporterId: _.reporterId,
2791
+ anonymousId: f
2792
+ })) : await m(u()));
2793
+ }, C = Sn({
2794
+ origin: Fn(),
2795
+ tier: p.tier,
2796
+ defaults: c ? {
2797
+ name: c.name,
2798
+ email: c.email
2799
+ } : void 0,
2800
+ target: l,
2801
+ onConfirm: (w) => {
2802
+ T(w);
2803
+ }
2804
+ });
2805
+ return a = () => C.destroy(), b;
2806
+ }
2807
+ }
2808
+ return await m(u()), b;
881
2809
  } catch {
882
- return A;
2810
+ return Ee;
883
2811
  }
884
2812
  }
2813
+ function Xn(e) {
2814
+ return xt(e, typeof window != "undefined" ? tn(Hn()) : null);
2815
+ }
2816
+ function Gn(e) {
2817
+ return xt(e, typeof (e == null ? void 0 : e.token) == "string" && e.token.length > 0 ? e.token : null);
2818
+ }
885
2819
  export {
886
- tt as DEFAULT_API_URL,
887
- U as LAUNCH_EVENT,
888
- ot as init
2820
+ jn as DEFAULT_API_URL,
2821
+ Se as LAUNCH_EVENT,
2822
+ Xn as init,
2823
+ Gn as redeem
889
2824
  };
890
2825
 
891
2826
  //# sourceMappingURL=index.mjs.map