makethisbetter 1.28.3 → 1.28.4
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/makethisbetter.cjs +10 -10
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +277 -276
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +11 -11
- package/dist/makethisbetter.js.map +1 -1
- package/dist/makethisbetter.standalone.js +269 -268
- package/dist/makethisbetter.standalone.js.map +1 -1
- package/dist/screenshot/capture.d.ts.map +1 -1
- package/dist/widget/submission-lifecycle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screenshot/capture.ts +0 -5
- package/src/widget/submission-lifecycle.ts +6 -0
|
@@ -9,25 +9,25 @@ function V(i, t) {
|
|
|
9
9
|
function d(i) {
|
|
10
10
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function kt(i) {
|
|
13
13
|
return i.isComposing || i.keyCode === 229;
|
|
14
14
|
}
|
|
15
15
|
const Se = /^(script|style|noscript|template)$/i;
|
|
16
|
-
function
|
|
16
|
+
function Zt(i, t = 80) {
|
|
17
17
|
let e = "";
|
|
18
18
|
for (const r of Array.from(i.childNodes)) {
|
|
19
19
|
if (e.length >= t) break;
|
|
20
|
-
r.nodeType === 3 ? e += r.nodeValue ?? "" : r instanceof Element && !Se.test(r.tagName) && (e +=
|
|
20
|
+
r.nodeType === 3 ? e += r.nodeValue ?? "" : r instanceof Element && !Se.test(r.tagName) && (e += Zt(r, t - e.length));
|
|
21
21
|
}
|
|
22
22
|
return e;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Et(i) {
|
|
25
25
|
if (i instanceof HTMLElement) {
|
|
26
26
|
const t = i.getAttribute("aria-label");
|
|
27
27
|
if (t) return t;
|
|
28
28
|
const e = i.getAttribute("title");
|
|
29
29
|
if (e) return e;
|
|
30
|
-
const r =
|
|
30
|
+
const r = Zt(i).trim().slice(0, 40);
|
|
31
31
|
if (r) return r;
|
|
32
32
|
const n = i.placeholder;
|
|
33
33
|
if (n) return n;
|
|
@@ -38,7 +38,7 @@ function kt(i) {
|
|
|
38
38
|
}
|
|
39
39
|
return i.tagName.toLowerCase();
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Jt(i) {
|
|
42
42
|
const t = [];
|
|
43
43
|
let e = i;
|
|
44
44
|
for (; e && e !== document.body && t.length < 5; ) {
|
|
@@ -111,7 +111,7 @@ B.HOST_INTERACTION_EVENTS = [
|
|
|
111
111
|
"touchcancel",
|
|
112
112
|
"click"
|
|
113
113
|
];
|
|
114
|
-
let
|
|
114
|
+
let gt = B;
|
|
115
115
|
class _e {
|
|
116
116
|
constructor(t, e, r, n, s) {
|
|
117
117
|
this.active = !1, this.preserveHostFocus = (o) => {
|
|
@@ -148,7 +148,7 @@ class Te {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
const Ae = 400;
|
|
151
|
-
class
|
|
151
|
+
class Lt {
|
|
152
152
|
constructor(t, e, r = () => Date.now()) {
|
|
153
153
|
this.bornAt = Date.now(), this.bornAt = r(), this.onClick = () => {
|
|
154
154
|
r() - this.bornAt < Ae || e();
|
|
@@ -183,7 +183,7 @@ class Le {
|
|
|
183
183
|
return this.applied;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const Pt = ["wheel", "touchmove"], Pe = /* @__PURE__ */ new Set([
|
|
187
187
|
"ArrowUp",
|
|
188
188
|
"ArrowDown",
|
|
189
189
|
"ArrowLeft",
|
|
@@ -215,11 +215,11 @@ function Re() {
|
|
|
215
215
|
const r = e.composedPath()[0];
|
|
216
216
|
r instanceof Element && Me(r, e.key) || e.cancelable && e.preventDefault();
|
|
217
217
|
};
|
|
218
|
-
for (const e of
|
|
218
|
+
for (const e of Pt)
|
|
219
219
|
window.addEventListener(e, i, { capture: !0, passive: !1 });
|
|
220
220
|
return window.addEventListener("keydown", t, { capture: !0 }), {
|
|
221
221
|
release() {
|
|
222
|
-
for (const e of
|
|
222
|
+
for (const e of Pt)
|
|
223
223
|
window.removeEventListener(e, i, { capture: !0 });
|
|
224
224
|
window.removeEventListener("keydown", t, { capture: !0 });
|
|
225
225
|
}
|
|
@@ -230,8 +230,8 @@ class He {
|
|
|
230
230
|
constructor(t, e, r, n, s = "right", o = !0) {
|
|
231
231
|
this.currentMode = "markup", this.handlePointerMove = (a) => {
|
|
232
232
|
if (a.pointerType !== "mouse") return;
|
|
233
|
-
const
|
|
234
|
-
this.hintBarEl.classList.toggle("mtb-hint-bar--under-pointer",
|
|
233
|
+
const l = this.hintBarEl.getBoundingClientRect(), c = a.clientX >= l.left && a.clientX <= l.right && a.clientY >= l.top && a.clientY <= l.bottom;
|
|
234
|
+
this.hintBarEl.classList.toggle("mtb-hint-bar--under-pointer", c);
|
|
235
235
|
}, this.touchHintDismissListening = !1, this.dismissTouchHint = () => {
|
|
236
236
|
this.hintBarEl.classList.add("mtb-hint-bar--dismissed"), this.stopTouchHintDismissListening();
|
|
237
237
|
}, this.messages = e, this.touch = S(), this.hintBarEl = t.el("div", "mtb-hint-bar"), this.hintBarEl.innerHTML = `<span class="mtb-toolbar-hint">${d(this.idleHint())}</span>`, this.touch && !o && this.hintBarEl.classList.add("mtb-hint-bar--dismissed"), this.el = t.el("div", "mtb-toolbar"), s === "left" && this.el.classList.add("left"), this.el.innerHTML = this.buildHTML(e), t.append(this.hintBarEl, this.el), this.host = t.host, this.host.setAttribute("data-mtb-toolbar", ""), this.hintTextEl = this.hintBarEl.querySelector(".mtb-toolbar-hint"), this.markupBtn = this.el.querySelector(".mtb-toolbar-mode-markup"), this.recordBtn = this.el.querySelector(".mtb-toolbar-mode-record"), this.markupBtn.addEventListener("click", () => {
|
|
@@ -326,7 +326,7 @@ class Fe {
|
|
|
326
326
|
this.highlightEl.style.top = `${e.top - 2}px`, this.highlightEl.style.left = `${e.left - 2}px`, this.highlightEl.style.width = `${e.width + 4}px`, this.highlightEl.style.height = `${e.height + 4}px`, this.highlightEl.style.display = "block", this.showTooltip(t, e);
|
|
327
327
|
}
|
|
328
328
|
showTooltip(t, e) {
|
|
329
|
-
this.tooltipEl.textContent =
|
|
329
|
+
this.tooltipEl.textContent = Et(t);
|
|
330
330
|
const r = e.top < 30;
|
|
331
331
|
this.tooltipEl.classList.toggle("below", r), this.tooltipEl.style.left = `${e.left + e.width / 2}px`, this.tooltipEl.style.top = r ? `${e.bottom + 8}px` : `${e.top - 8}px`, this.tooltipEl.style.display = "block";
|
|
332
332
|
}
|
|
@@ -371,15 +371,15 @@ function Ue(i, t) {
|
|
|
371
371
|
function $(i) {
|
|
372
372
|
let t = 0, e = 0, r = i;
|
|
373
373
|
for (; r && r !== document.body; )
|
|
374
|
-
r instanceof HTMLElement && (t += r.scrollLeft, e += r.scrollTop), r =
|
|
374
|
+
r instanceof HTMLElement && (t += r.scrollLeft, e += r.scrollTop), r = Qt(r);
|
|
375
375
|
return { x: t, y: e };
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Qt(i) {
|
|
378
378
|
if (i.parentElement) return i.parentElement;
|
|
379
379
|
const t = i.getRootNode();
|
|
380
380
|
return t instanceof ShadowRoot ? t.host : null;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Dt(i) {
|
|
383
383
|
const t = $(i);
|
|
384
384
|
return { x: t.x + window.scrollX, y: t.y + window.scrollY };
|
|
385
385
|
}
|
|
@@ -399,7 +399,7 @@ class $e {
|
|
|
399
399
|
this.clearAll();
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const te = "#059669", T = {
|
|
403
403
|
color: "var(--mtb-brand-primary)",
|
|
404
404
|
width: "3.5",
|
|
405
405
|
linecap: "round",
|
|
@@ -414,7 +414,7 @@ class je {
|
|
|
414
414
|
this.isDrawing = !0, this.currentPoints = [[t, e]], this.currentAnchor = We(t, e), this.currentPath = this.createPath(), this.svg.appendChild(this.currentPath);
|
|
415
415
|
}
|
|
416
416
|
continueDraw(t, e) {
|
|
417
|
-
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d",
|
|
417
|
+
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d", ct(this.currentPoints)));
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* How far the pointer has wandered from where it went down, in pixels.
|
|
@@ -437,7 +437,7 @@ class je {
|
|
|
437
437
|
commitStroke() {
|
|
438
438
|
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({
|
|
439
439
|
path: this.currentPath,
|
|
440
|
-
d:
|
|
440
|
+
d: ct(this.currentPoints),
|
|
441
441
|
points: this.currentPoints,
|
|
442
442
|
anchor: this.currentAnchor
|
|
443
443
|
}), this.redoStack = [], this.currentPath = null, this.currentPoints = [], !0);
|
|
@@ -475,7 +475,7 @@ class je {
|
|
|
475
475
|
type: "draw",
|
|
476
476
|
x: r,
|
|
477
477
|
y: n,
|
|
478
|
-
drawPath: e.map(
|
|
478
|
+
drawPath: e.map(ct).join(" "),
|
|
479
479
|
captureOffsetX: t.anchor.offset.x,
|
|
480
480
|
captureOffsetY: t.anchor.offset.y
|
|
481
481
|
};
|
|
@@ -507,7 +507,7 @@ class je {
|
|
|
507
507
|
return t.setAttribute("fill", "none"), t.setAttribute("stroke", T.color), t.setAttribute("stroke-width", T.width), t.setAttribute("stroke-linecap", T.linecap), t.setAttribute("stroke-linejoin", T.linejoin), t.setAttribute("style", `filter:${T.filter}`), t;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function ct(i) {
|
|
511
511
|
if (i.length === 0) return "";
|
|
512
512
|
const [t, e] = i[0];
|
|
513
513
|
let r = `M ${t} ${e}`;
|
|
@@ -538,23 +538,23 @@ const nt = "rr-block", O = "rr-mask", Xe = `.${nt}, .${O}`;
|
|
|
538
538
|
function st(i) {
|
|
539
539
|
return i.closest(Xe) !== null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function St(i) {
|
|
542
542
|
const t = i.getAttribute("role")?.trim().split(/\s+/)[0];
|
|
543
543
|
return t && /^[a-z][a-z0-9-]*$/i.test(t) ? t : i.tagName.toLowerCase();
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ee(i) {
|
|
546
546
|
return i.tagName.toLowerCase();
|
|
547
547
|
}
|
|
548
548
|
const Ke = 10;
|
|
549
|
-
function
|
|
549
|
+
function Mt(i) {
|
|
550
550
|
return st(i) ? {
|
|
551
|
-
name:
|
|
551
|
+
name: St(i),
|
|
552
552
|
text: "",
|
|
553
|
-
selector:
|
|
553
|
+
selector: ee(i)
|
|
554
554
|
} : {
|
|
555
|
-
name:
|
|
555
|
+
name: Et(i),
|
|
556
556
|
text: i.textContent?.trim().slice(0, 200) ?? "",
|
|
557
|
-
selector:
|
|
557
|
+
selector: Jt(i)
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
class Ge {
|
|
@@ -603,7 +603,7 @@ class Ge {
|
|
|
603
603
|
return;
|
|
604
604
|
}
|
|
605
605
|
if (this.drawLayer.cancelCurrentDraw(), this.touch || this.drawLayer.hasStrokes() || !t) return;
|
|
606
|
-
const e = V(t.clientX, t.clientY), r = e ?
|
|
606
|
+
const e = V(t.clientX, t.clientY), r = e ? Mt(e) : null, n = r?.name ?? this.messages.annotation.element, s = e?.getBoundingClientRect(), o = Dt(e), a = {
|
|
607
607
|
type: "pin",
|
|
608
608
|
x: t.clientX,
|
|
609
609
|
y: t.clientY,
|
|
@@ -646,12 +646,12 @@ class Ge {
|
|
|
646
646
|
if (!t) return null;
|
|
647
647
|
const e = this.drawLayer.viewportDrift(), r = V(t.x - e.x, t.y - e.y);
|
|
648
648
|
if (!r) return t;
|
|
649
|
-
const n = r.getBoundingClientRect(), s =
|
|
649
|
+
const n = r.getBoundingClientRect(), s = Dt(r), o = s.x - (t.captureOffsetX ?? 0), a = s.y - (t.captureOffsetY ?? 0), l = Mt(r);
|
|
650
650
|
return {
|
|
651
651
|
...t,
|
|
652
|
-
targetSelector:
|
|
653
|
-
targetText:
|
|
654
|
-
targetName:
|
|
652
|
+
targetSelector: l.selector,
|
|
653
|
+
targetText: l.text,
|
|
654
|
+
targetName: l.name,
|
|
655
655
|
targetRect: {
|
|
656
656
|
top: n.top + a,
|
|
657
657
|
left: n.left + o,
|
|
@@ -708,7 +708,7 @@ const Qe = 480;
|
|
|
708
708
|
function ti() {
|
|
709
709
|
return window.innerWidth <= Qe;
|
|
710
710
|
}
|
|
711
|
-
class
|
|
711
|
+
class ie {
|
|
712
712
|
constructor(t) {
|
|
713
713
|
this.el = t, this.inset = new Je();
|
|
714
714
|
}
|
|
@@ -735,8 +735,8 @@ class ee {
|
|
|
735
735
|
}
|
|
736
736
|
class ei {
|
|
737
737
|
constructor(t, e) {
|
|
738
|
-
this.onSubmit = e.onSubmit, this.submitLabel = e.messages.draw.submit, this.messages = e.messages, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.sheet = new
|
|
739
|
-
|
|
738
|
+
this.onSubmit = e.onSubmit, this.submitLabel = e.messages.draw.submit, this.messages = e.messages, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.sheet = new ie(this.el), this.sheet.apply(), this.input = this.el.querySelector(".mtb-draw-input"), this.undoBtn = this.el.querySelector(".mtb-draw-undo"), this.redoBtn = this.el.querySelector(".mtb-draw-redo"), this.submitBtn = this.el.querySelector(".mtb-draw-submit"), this.undoBtn.addEventListener("click", e.onUndo), this.redoBtn.addEventListener("click", e.onRedo), this.el.querySelector(".mtb-draw-cancel").addEventListener("click", e.onCancel), this.submitBtn.addEventListener("click", () => this.submit()), e.onActivity && this.input.addEventListener("input", e.onActivity), this.input.addEventListener("keydown", (r) => {
|
|
739
|
+
kt(r) || r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.submit());
|
|
740
740
|
}), this.input.focus({ preventScroll: !0 });
|
|
741
741
|
}
|
|
742
742
|
buildHTML(t) {
|
|
@@ -769,18 +769,18 @@ class ei {
|
|
|
769
769
|
this.sheet.release(), this.el.remove();
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
const J = 12,
|
|
772
|
+
const J = 12, vt = 32;
|
|
773
773
|
function ii(i) {
|
|
774
774
|
const t = window.innerWidth, e = window.innerHeight;
|
|
775
775
|
return {
|
|
776
776
|
vw: t,
|
|
777
777
|
vh: e,
|
|
778
|
-
minLeft: J + (i === "left" ?
|
|
779
|
-
maxRight: t - J - (i === "right" ?
|
|
778
|
+
minLeft: J + (i === "left" ? vt : 0),
|
|
779
|
+
maxRight: t - J - (i === "right" ? vt : 0)
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
782
|
function ri(i, t) {
|
|
783
|
-
return Math.min(i, t.vw - 2 * J -
|
|
783
|
+
return Math.min(i, t.vw - 2 * J - vt);
|
|
784
784
|
}
|
|
785
785
|
const ni = [
|
|
786
786
|
"button:not([disabled])",
|
|
@@ -790,13 +790,13 @@ const ni = [
|
|
|
790
790
|
"a[href]",
|
|
791
791
|
'[tabindex]:not([tabindex="-1"])'
|
|
792
792
|
].join(", ");
|
|
793
|
-
function
|
|
793
|
+
function re(i) {
|
|
794
794
|
const t = document.activeElement instanceof HTMLElement ? document.activeElement : null, e = (r) => {
|
|
795
795
|
if (r.key !== "Tab") return;
|
|
796
|
-
const n = Array.from(i.querySelectorAll(ni)).filter((
|
|
796
|
+
const n = Array.from(i.querySelectorAll(ni)).filter((c) => !c.hidden);
|
|
797
797
|
if (n.length === 0) return;
|
|
798
|
-
const s = n[0], o = n[n.length - 1],
|
|
799
|
-
r.shiftKey ? (
|
|
798
|
+
const s = n[0], o = n[n.length - 1], l = i.getRootNode().activeElement ?? document.activeElement;
|
|
799
|
+
r.shiftKey ? (l === s || !i.contains(l)) && (r.preventDefault(), o.focus({ preventScroll: !0 })) : (l === o || !i.contains(l)) && (r.preventDefault(), s.focus({ preventScroll: !0 }));
|
|
800
800
|
};
|
|
801
801
|
return i.addEventListener("keydown", e), {
|
|
802
802
|
release() {
|
|
@@ -807,10 +807,10 @@ function ie(i) {
|
|
|
807
807
|
}
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
|
-
const si = 320,
|
|
811
|
-
class
|
|
810
|
+
const si = 320, Rt = 5e3, oi = "https://makethisbetter.dev", j = '<svg viewBox="0 0 512 512" fill="none"><defs><linearGradient id="mtb-bg" x1=".3" y1="0" x2=".7" y2="1"><stop offset="0%" stop-color="var(--mtb-chat-logo-start, #10b981)"/><stop offset="100%" stop-color="var(--mtb-chat-logo-end, #059669)"/></linearGradient></defs><rect width="512" height="512" rx="96" fill="url(#mtb-bg)"/><g transform="translate(89,89) scale(13.9)" stroke="var(--mtb-chat-logo-fg, #fff)" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M21 13a9 9 0 1 1-3-7.7L21 8"/><circle cx="12" cy="12" r="2.2" fill="var(--mtb-chat-logo-fg, #fff)" stroke="none"/></g></svg>', ai = '<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8.9 8l3.3-3.3-.9-.9L8 7.1 4.7 3.8l-.9.9L7.1 8l-3.3 3.3.9.9L8 8.9l3.3 3.3.9-.9z"/></svg>', li = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M6.2 2.6h3.6l.9 1.4H14a1 1 0 011 1v7.4a1 1 0 01-1 1H2a1 1 0 01-1-1V5a1 1 0 011-1h3.3l.9-1.4z"/><circle cx="8" cy="9" r="2.5" class="mtb-chat-icon-lens"/></svg>', ci = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="6.6"/><polygon points="6.4,5.2 11,8 6.4,10.8" class="mtb-chat-icon-lens"/></svg>', hi = '<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="M8.1 14.6L3.8 10.3l1.5-1.5 2.8 2.8 6.6-6.6 1.5 1.5z"/></svg>';
|
|
811
|
+
class ht {
|
|
812
812
|
constructor(t, e) {
|
|
813
|
-
this.state = "idle", this.autoCloseTimer = null, this.session = null, this.clarifyAbort = null, this.streamingBubbleEl = null, this.opts = e, this.i18n = e.messages, this.el = t.el("div", "mtb-chat"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-modal", "true"), this.el.setAttribute("aria-label", e.targetName), this.el.innerHTML = this.buildHTML(), t.append(this.el), this.focusTrap =
|
|
813
|
+
this.state = "idle", this.autoCloseTimer = null, this.session = null, this.clarifyAbort = null, this.streamingBubbleEl = null, this.opts = e, this.i18n = e.messages, this.el = t.el("div", "mtb-chat"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-modal", "true"), this.el.setAttribute("aria-label", e.targetName), this.el.innerHTML = this.buildHTML(), t.append(this.el), this.focusTrap = re(this.el), this.sheet = new ie(this.el), this.sheet.apply() || this.positionCard(e.x, e.y, e.targetRect, e.position ?? "right"), this.messagesEl = this.el.querySelector(".mtb-chat-messages"), this.composerEl = this.el.querySelector(".mtb-chat-composer"), this.actionsEl = this.el.querySelector(".mtb-chat-actions"), this.inputEl = this.el.querySelector(".mtb-chat-input"), this.sendBtn = this.el.querySelector(".mtb-chat-send"), this.quickRepliesEl = this.el.querySelector(".mtb-chat-quick-replies"), this.bindEvents(), this.handleEscape = this.handleEscape.bind(this), window.addEventListener("keydown", this.handleEscape), this.inputEl.focus({ preventScroll: !0 });
|
|
814
814
|
}
|
|
815
815
|
handleEscape(t) {
|
|
816
816
|
if (t.key === "Escape" && (t.preventDefault(), t.stopPropagation(), this.state !== "sending")) {
|
|
@@ -858,7 +858,7 @@ class ct {
|
|
|
858
858
|
}), this.inputEl.addEventListener("input", () => {
|
|
859
859
|
this.sendBtn.disabled = !this.inputEl.value.trim(), this.opts.onActivity?.();
|
|
860
860
|
}), this.inputEl.addEventListener("keydown", (e) => {
|
|
861
|
-
if (!
|
|
861
|
+
if (!kt(e) && e.key === "Enter" && !e.shiftKey) {
|
|
862
862
|
e.preventDefault();
|
|
863
863
|
const r = this.inputEl.value.trim();
|
|
864
864
|
r ? this.sendMessage(r) : this.state === "clarifying" && this.skipAndSend();
|
|
@@ -978,7 +978,7 @@ class ct {
|
|
|
978
978
|
s.preventDefault(), e();
|
|
979
979
|
}));
|
|
980
980
|
const n = this.opts.resolveEmailCapture?.();
|
|
981
|
-
n && !t.querySelector(".mtb-chat-email-card") ? (this.autoCloseTimer && (clearTimeout(this.autoCloseTimer), this.autoCloseTimer = null), t.classList.remove("mtb-chat-success-simple"), t.appendChild(this.buildEmailCard(n))) : !n && !this.autoCloseTimer && !t.querySelector(".mtb-chat-email-card") && (this.autoCloseTimer = setTimeout(() => this.destroy(),
|
|
981
|
+
n && !t.querySelector(".mtb-chat-email-card") ? (this.autoCloseTimer && (clearTimeout(this.autoCloseTimer), this.autoCloseTimer = null), t.classList.remove("mtb-chat-success-simple"), t.appendChild(this.buildEmailCard(n))) : !n && !this.autoCloseTimer && !t.querySelector(".mtb-chat-email-card") && (this.autoCloseTimer = setTimeout(() => this.destroy(), Rt));
|
|
982
982
|
}
|
|
983
983
|
finalizeInBackground() {
|
|
984
984
|
Promise.resolve(this.opts.onFinalize()).then(() => this.attachHandoff()).catch(() => {
|
|
@@ -995,12 +995,12 @@ class ct {
|
|
|
995
995
|
o.className = "mtb-chat-email-input", o.type = "email", o.placeholder = e.email_cta, s.appendChild(o);
|
|
996
996
|
const a = document.createElement("button");
|
|
997
997
|
a.className = "mtb-chat-email-submit", a.type = "button", a.textContent = e.notify, a.disabled = !0;
|
|
998
|
-
const
|
|
999
|
-
const
|
|
1000
|
-
if (!
|
|
1001
|
-
if (a.disabled = !0, o.disabled = !0, await t.onSubmit(
|
|
998
|
+
const l = async () => {
|
|
999
|
+
const c = o.value.trim();
|
|
1000
|
+
if (!c) return;
|
|
1001
|
+
if (a.disabled = !0, o.disabled = !0, await t.onSubmit(c)) {
|
|
1002
1002
|
const b = document.createElement("div");
|
|
1003
|
-
b.className = "mtb-chat-email-note", b.textContent = e.email_saved, r.replaceChildren(b), this.autoCloseTimer = setTimeout(() => this.destroy(),
|
|
1003
|
+
b.className = "mtb-chat-email-note", b.textContent = e.email_saved, r.replaceChildren(b), this.autoCloseTimer = setTimeout(() => this.destroy(), Rt);
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
1006
|
o.disabled = !1, a.disabled = !1;
|
|
@@ -1009,9 +1009,9 @@ class ct {
|
|
|
1009
1009
|
};
|
|
1010
1010
|
return o.addEventListener("input", () => {
|
|
1011
1011
|
a.disabled = !o.value.trim();
|
|
1012
|
-
}), o.addEventListener("keydown", (
|
|
1013
|
-
|
|
1014
|
-
}), a.addEventListener("click", () => void
|
|
1012
|
+
}), o.addEventListener("keydown", (c) => {
|
|
1013
|
+
c.key === "Enter" && o.value.trim() && l();
|
|
1014
|
+
}), a.addEventListener("click", () => void l()), n.appendChild(s), n.appendChild(a), r.appendChild(n), r;
|
|
1015
1015
|
}
|
|
1016
1016
|
appendUserBubble(t) {
|
|
1017
1017
|
const e = document.createElement("div");
|
|
@@ -1084,10 +1084,10 @@ class ct {
|
|
|
1084
1084
|
this.inputEl.disabled = t, this.sendBtn.disabled = t, this.composerEl.classList.toggle("mtb-chat-composer-disabled", t);
|
|
1085
1085
|
}
|
|
1086
1086
|
positionCard(t, e, r, n) {
|
|
1087
|
-
const s = ii(n), { vw: o, vh: a, minLeft:
|
|
1087
|
+
const s = ii(n), { vw: o, vh: a, minLeft: l, maxRight: c } = s, h = J, u = 8, b = ri(si, s), g = (this.el.offsetHeight || 280) + 80;
|
|
1088
1088
|
let f, m;
|
|
1089
|
-
const
|
|
1090
|
-
r &&
|
|
1089
|
+
const lt = r && r.width < o * 0.6 && r.height < a * 0.6;
|
|
1090
|
+
r && lt ? (f = r.left, m = r.bottom + u, m + g > a - h && (m = r.top - g - u), m < h && (m = Math.min(r.bottom + u, a - g - h))) : (f = t + 12, m = e + 12), f + b > c && (f = c - b), f < l && (f = l), m < h && (m = h), m + g > a - h && (m = a - g - h), m < h && (m = h), this.el.style.left = `${f}px`, this.el.style.top = `${m}px`, this.el.style.maxHeight = `${a - m - h}px`;
|
|
1091
1091
|
}
|
|
1092
1092
|
submit(t) {
|
|
1093
1093
|
this.sendMessage(t);
|
|
@@ -1107,16 +1107,16 @@ class mi {
|
|
|
1107
1107
|
this.el = t.el("div", "mtb-chat mtb-chat-receipt"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-modal", "true"), this.el.setAttribute("aria-label", o);
|
|
1108
1108
|
const a = document.createElement("div");
|
|
1109
1109
|
a.className = "mtb-chat-success mtb-chat-success-simple";
|
|
1110
|
-
const c = document.createElement("div");
|
|
1111
|
-
c.className = "mtb-chat-success-icon", c.innerHTML = ui, a.appendChild(c);
|
|
1112
1110
|
const l = document.createElement("div");
|
|
1113
|
-
|
|
1111
|
+
l.className = "mtb-chat-success-icon", l.innerHTML = ui, a.appendChild(l);
|
|
1112
|
+
const c = document.createElement("div");
|
|
1113
|
+
if (c.className = "mtb-chat-success-title", c.textContent = o, a.appendChild(c), n?.onViewFeedback) {
|
|
1114
1114
|
const h = document.createElement("a");
|
|
1115
1115
|
h.className = "mtb-chat-success-link", h.href = "#", h.textContent = s.track_feedback, h.addEventListener("click", (u) => {
|
|
1116
1116
|
u.preventDefault(), n.onViewFeedback();
|
|
1117
1117
|
}), a.appendChild(h);
|
|
1118
1118
|
}
|
|
1119
|
-
this.el.appendChild(a), t.append(this.el), this.focusTrap =
|
|
1119
|
+
this.el.appendChild(a), t.append(this.el), this.focusTrap = re(this.el), this.autoCloseTimer = setTimeout(r, di);
|
|
1120
1120
|
}
|
|
1121
1121
|
destroy() {
|
|
1122
1122
|
clearTimeout(this.autoCloseTimer), this.focusTrap.release(), this.el.remove(), this.focusTrap.restoreFocus();
|
|
@@ -1153,11 +1153,11 @@ function U(i) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
function Q(i, t) {
|
|
1156
|
-
if (t &&
|
|
1156
|
+
if (t && ne(t) && i != null) return p;
|
|
1157
1157
|
if (typeof i == "string") return C(i);
|
|
1158
1158
|
if (Array.isArray(i)) return i.map((e) => Q(e));
|
|
1159
1159
|
if (i && typeof i == "object") {
|
|
1160
|
-
const e =
|
|
1160
|
+
const e = se(i);
|
|
1161
1161
|
return Object.fromEntries(
|
|
1162
1162
|
Object.entries(i).map(([n, s]) => {
|
|
1163
1163
|
const o = e && yi.has(R(n)) && s != null ? p : Q(s, n);
|
|
@@ -1167,14 +1167,14 @@ function Q(i, t) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
return i;
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function ne(i) {
|
|
1171
1171
|
return Ei.test(R(i));
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1173
|
+
function se(i) {
|
|
1174
1174
|
return Object.entries(i).some(([t, e]) => {
|
|
1175
1175
|
if (typeof e != "string") return !1;
|
|
1176
1176
|
const r = R(t);
|
|
1177
|
-
return wi.has(r) ? r === "type" ? xi.has(R(e)) : r === "autocomplete" ? e.split(/\s+/).some((n) => ki.has(R(n))) :
|
|
1177
|
+
return wi.has(r) ? r === "type" ? xi.has(R(e)) : r === "autocomplete" ? e.split(/\s+/).some((n) => ki.has(R(n))) : ne(e) : !1;
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
function R(i) {
|
|
@@ -1190,8 +1190,8 @@ function Si(i) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
return e % 10 === 0;
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1193
|
+
function oe(i) {
|
|
1194
|
+
return se({
|
|
1195
1195
|
type: i.getAttribute("type"),
|
|
1196
1196
|
autocomplete: i.getAttribute("autocomplete"),
|
|
1197
1197
|
name: i.getAttribute("name"),
|
|
@@ -1201,29 +1201,29 @@ function se(i) {
|
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
1203
|
function tt(i, t) {
|
|
1204
|
-
return i && (
|
|
1204
|
+
return i && (oe(t) ? p : C(i));
|
|
1205
1205
|
}
|
|
1206
1206
|
const _i = 512;
|
|
1207
|
-
function
|
|
1207
|
+
function ae() {
|
|
1208
1208
|
return /* @__PURE__ */ new WeakMap();
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function le(i, t) {
|
|
1211
1211
|
let e = i.parentElement;
|
|
1212
1212
|
for (; e && e !== document.body && e !== document.documentElement; ) {
|
|
1213
|
-
const r =
|
|
1213
|
+
const r = ce(e, t);
|
|
1214
1214
|
if (r === "sensitive") return !0;
|
|
1215
1215
|
if (r === "contains-sensitive-child" || r === "too-large") return !1;
|
|
1216
1216
|
e = e.parentElement;
|
|
1217
1217
|
}
|
|
1218
1218
|
return !1;
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function ce(i, t) {
|
|
1221
1221
|
const e = t.get(i);
|
|
1222
1222
|
if (e) return e;
|
|
1223
1223
|
const r = i.textContent ?? "";
|
|
1224
1224
|
let n = "none";
|
|
1225
1225
|
return r.length > _i ? n = "too-large" : C(r) !== r && (n = Array.from(i.children).some((o) => {
|
|
1226
|
-
const a =
|
|
1226
|
+
const a = ce(o, t);
|
|
1227
1227
|
return a === "sensitive" || a === "contains-sensitive-child";
|
|
1228
1228
|
}) ? "contains-sensitive-child" : "sensitive"), t.set(i, n), n;
|
|
1229
1229
|
}
|
|
@@ -1233,7 +1233,7 @@ function Ci(i) {
|
|
|
1233
1233
|
e.onload = () => t(e), e.onerror = () => t(null), e.src = i;
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function he(i) {
|
|
1237
1237
|
const t = [];
|
|
1238
1238
|
let e = null;
|
|
1239
1239
|
const r = i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g) ?? [];
|
|
@@ -1244,29 +1244,29 @@ function ce(i) {
|
|
|
1244
1244
|
return t;
|
|
1245
1245
|
}
|
|
1246
1246
|
function Ti(i, t, e) {
|
|
1247
|
-
return
|
|
1247
|
+
return he(i).map(
|
|
1248
1248
|
(r) => r.map(([n, s], o) => `${o === 0 ? "M" : "L"} ${n + t} ${s + e}`).join(" ")
|
|
1249
1249
|
).join(" ");
|
|
1250
1250
|
}
|
|
1251
1251
|
let A = null;
|
|
1252
|
-
function
|
|
1252
|
+
function de() {
|
|
1253
1253
|
return A || (A = import("./html-to-image.js").catch((i) => {
|
|
1254
1254
|
throw A = null, i;
|
|
1255
1255
|
}), A);
|
|
1256
1256
|
}
|
|
1257
|
-
let
|
|
1258
|
-
function
|
|
1259
|
-
return
|
|
1260
|
-
|
|
1261
|
-
})),
|
|
1257
|
+
let dt, ut = null;
|
|
1258
|
+
function _t() {
|
|
1259
|
+
return dt !== void 0 ? Promise.resolve(dt) : (ut ?? (ut = de().then(({ getFontEmbedCSS: i }) => i(document.body)).then((i) => (dt = i, i)).catch(() => {
|
|
1260
|
+
ut = null;
|
|
1261
|
+
})), ut);
|
|
1262
1262
|
}
|
|
1263
1263
|
const Ai = 200, Li = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
1264
1264
|
async function Pi(i, t) {
|
|
1265
1265
|
try {
|
|
1266
1266
|
if (t?.aborted) return null;
|
|
1267
|
-
const [{ toJpeg: e }, r] = await Promise.all([
|
|
1268
|
-
if (
|
|
1269
|
-
const n = document.body.getBoundingClientRect(), s = Oe(), o = { x: window.scrollX, y: window.scrollY }, a = Ni(document.body),
|
|
1267
|
+
const [{ toJpeg: e }, r] = await Promise.all([de(), _t()]);
|
|
1268
|
+
if (t?.aborted) return null;
|
|
1269
|
+
const n = document.body.getBoundingClientRect(), s = Oe(), o = { x: window.scrollX, y: window.scrollY }, a = Ni(document.body), l = await e(document.body, {
|
|
1270
1270
|
quality: 0.85,
|
|
1271
1271
|
imagePlaceholder: Li,
|
|
1272
1272
|
resourceUrlResolver: i,
|
|
@@ -1285,14 +1285,14 @@ async function Pi(i, t) {
|
|
|
1285
1285
|
transform: `translate(${n.left}px, ${n.top}px)`,
|
|
1286
1286
|
transformOrigin: "top left"
|
|
1287
1287
|
},
|
|
1288
|
-
filter: (
|
|
1289
|
-
if (
|
|
1290
|
-
if (!(
|
|
1291
|
-
const h =
|
|
1288
|
+
filter: (c) => {
|
|
1289
|
+
if (c instanceof HTMLElement && c.id === w) return !1;
|
|
1290
|
+
if (!(c instanceof Element)) return !0;
|
|
1291
|
+
const h = c.getBoundingClientRect();
|
|
1292
1292
|
return h.width === 0 && h.height === 0 ? !0 : h.top + window.scrollY - o.y <= s.height + Ai;
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
|
-
return t?.aborted ? null : { dataUrl:
|
|
1295
|
+
return t?.aborted ? null : { dataUrl: l, metrics: s, redactions: a, pageScroll: o };
|
|
1296
1296
|
} catch {
|
|
1297
1297
|
return null;
|
|
1298
1298
|
}
|
|
@@ -1343,17 +1343,17 @@ async function Hi(i, t, e, r, n) {
|
|
|
1343
1343
|
const a = await Ci(i);
|
|
1344
1344
|
if (!a) return null;
|
|
1345
1345
|
s.width = a.naturalWidth || window.innerWidth, s.height = a.naturalHeight || window.innerHeight, o.drawImage(a, 0, 0);
|
|
1346
|
-
const
|
|
1346
|
+
const l = Be(e, s.width, s.height);
|
|
1347
1347
|
o.fillStyle = "#e5e7eb";
|
|
1348
|
-
for (const
|
|
1349
|
-
const h = ze(
|
|
1348
|
+
for (const c of r) {
|
|
1349
|
+
const h = ze(l, c);
|
|
1350
1350
|
o.fillRect(h.left, h.top, h.width, h.height);
|
|
1351
1351
|
}
|
|
1352
|
-
for (const
|
|
1353
|
-
|
|
1352
|
+
for (const c of t)
|
|
1353
|
+
c.type === "draw" && c.drawPath ? Bi(o, c.drawPath, l, n?.primary) : c.type === "pin" && Oi(
|
|
1354
1354
|
o,
|
|
1355
|
-
G(
|
|
1356
|
-
Z(
|
|
1355
|
+
G(l, c.x),
|
|
1356
|
+
Z(l, c.y),
|
|
1357
1357
|
n
|
|
1358
1358
|
);
|
|
1359
1359
|
return Ui(s);
|
|
@@ -1361,37 +1361,37 @@ async function Hi(i, t, e, r, n) {
|
|
|
1361
1361
|
function Ni(i) {
|
|
1362
1362
|
const t = [];
|
|
1363
1363
|
for (const s of Fi(i, `.${nt}`))
|
|
1364
|
-
|
|
1364
|
+
mt(t, s.getBoundingClientRect(), It(s));
|
|
1365
1365
|
for (const s of i.querySelectorAll("input, textarea, select")) {
|
|
1366
|
-
if (
|
|
1367
|
-
const o = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? s.value : "", a = s.closest(`.${O}`) !== null,
|
|
1368
|
-
!a && !
|
|
1366
|
+
if (Ht(s)) continue;
|
|
1367
|
+
const o = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? s.value : "", a = s.closest(`.${O}`) !== null, l = oe(s) || tt(o, s) !== o;
|
|
1368
|
+
!a && !l || mt(t, s.getBoundingClientRect(), It(s), Ft);
|
|
1369
1369
|
}
|
|
1370
|
-
const e = document.createTreeWalker(i, NodeFilter.SHOW_TEXT), r =
|
|
1370
|
+
const e = document.createTreeWalker(i, NodeFilter.SHOW_TEXT), r = ae();
|
|
1371
1371
|
let n = e.nextNode();
|
|
1372
1372
|
for (; n; ) {
|
|
1373
|
-
const s = n.parentElement, o = n.textContent ?? "", a = s?.closest(`.${O}`) !== null,
|
|
1374
|
-
if (s && !
|
|
1375
|
-
const
|
|
1373
|
+
const s = n.parentElement, o = n.textContent ?? "", a = s?.closest(`.${O}`) !== null, l = C(o) !== o || le(n, r);
|
|
1374
|
+
if (s && !Ht(s) && (a || l)) {
|
|
1375
|
+
const c = $(s), h = document.createRange();
|
|
1376
1376
|
h.selectNodeContents(n);
|
|
1377
1377
|
for (const u of Array.from(h.getClientRects()))
|
|
1378
|
-
|
|
1378
|
+
mt(t, u, c, Ft);
|
|
1379
1379
|
}
|
|
1380
1380
|
n = e.nextNode();
|
|
1381
1381
|
}
|
|
1382
1382
|
return t;
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1385
|
-
return $(
|
|
1384
|
+
function It(i) {
|
|
1385
|
+
return $(Qt(i));
|
|
1386
1386
|
}
|
|
1387
1387
|
function Fi(i, t) {
|
|
1388
1388
|
const e = Array.from(i.querySelectorAll(t));
|
|
1389
1389
|
return i.matches(t) ? [i, ...e] : e;
|
|
1390
1390
|
}
|
|
1391
|
-
function
|
|
1391
|
+
function Ht(i) {
|
|
1392
1392
|
return i.closest(`#${w}`) !== null || i.closest(`.${nt}`) !== null;
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function mt(i, t, e, r = 0) {
|
|
1395
1395
|
if (![t.left, t.top, t.width, t.height].every(Number.isFinite))
|
|
1396
1396
|
throw new Error("Invalid privacy redaction geometry");
|
|
1397
1397
|
t.width <= 0 || t.height <= 0 || i.push({
|
|
@@ -1401,9 +1401,9 @@ function ut(i, t, e, r = 0) {
|
|
|
1401
1401
|
height: t.height + r * 2
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
|
-
function Bi(i, t, e, r =
|
|
1404
|
+
function Bi(i, t, e, r = te) {
|
|
1405
1405
|
i.save(), i.lineCap = "round", i.lineJoin = "round";
|
|
1406
|
-
for (const n of
|
|
1406
|
+
for (const n of he(t))
|
|
1407
1407
|
if (n.length !== 0) {
|
|
1408
1408
|
i.beginPath(), i.moveTo(
|
|
1409
1409
|
G(e, n[0][0]),
|
|
@@ -1418,13 +1418,13 @@ function Bi(i, t, e, r = Qt) {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
i.restore();
|
|
1420
1420
|
}
|
|
1421
|
-
const
|
|
1421
|
+
const Nt = 16e6, Ft = 2;
|
|
1422
1422
|
function zi(i) {
|
|
1423
1423
|
const t = i.width * i.height;
|
|
1424
|
-
return !Number.isFinite(t) || t <=
|
|
1424
|
+
return !Number.isFinite(t) || t <= Nt ? 1 : Math.sqrt(Nt / t);
|
|
1425
1425
|
}
|
|
1426
1426
|
function Oi(i, t, e, r) {
|
|
1427
|
-
const n = r?.primary ??
|
|
1427
|
+
const n = r?.primary ?? te;
|
|
1428
1428
|
i.save(), i.shadowColor = "rgba(15, 23, 42, 0.68)", i.shadowOffsetY = 2, i.shadowBlur = 8, i.fillStyle = n, i.beginPath(), i.arc(t, e, 11, 0, Math.PI * 2), i.fill(), i.shadowColor = "transparent", i.lineWidth = 2, i.strokeStyle = "#ffffff", i.stroke(), i.restore();
|
|
1429
1429
|
}
|
|
1430
1430
|
function Ui(i) {
|
|
@@ -1458,11 +1458,11 @@ class $i {
|
|
|
1458
1458
|
for (const e of this.listeners) e(t);
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
const
|
|
1461
|
+
const Ct = new $i();
|
|
1462
1462
|
function ji(i) {
|
|
1463
1463
|
return !i || typeof i != "object" || !("name" in i) ? void 0 : String(i.name) || void 0;
|
|
1464
1464
|
}
|
|
1465
|
-
function
|
|
1465
|
+
function ue(i) {
|
|
1466
1466
|
const t = qi(i.name) || Wi(i.message), e = Yi(i);
|
|
1467
1467
|
return e ? `${t} (${e})` : t;
|
|
1468
1468
|
}
|
|
@@ -1487,10 +1487,10 @@ class Xi {
|
|
|
1487
1487
|
this.errors = [], this.unsubscribe = null;
|
|
1488
1488
|
}
|
|
1489
1489
|
start() {
|
|
1490
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1490
|
+
this.unsubscribe || (this.unsubscribe = Ct.subscribe((t) => this.record(t)));
|
|
1491
1491
|
}
|
|
1492
1492
|
record(t) {
|
|
1493
|
-
this.addError(
|
|
1493
|
+
this.addError(ue(t));
|
|
1494
1494
|
}
|
|
1495
1495
|
addError(t) {
|
|
1496
1496
|
this.errors.length >= Vi || this.errors.includes(t) || this.errors.push(t);
|
|
@@ -1504,14 +1504,14 @@ class Xi {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
const X = /* @__PURE__ */ new Set();
|
|
1506
1506
|
let I = null, H = null, N = null, et = null, F = null, it = null;
|
|
1507
|
-
function
|
|
1507
|
+
function me(i) {
|
|
1508
1508
|
X.add(i), Ki();
|
|
1509
1509
|
let t = !1;
|
|
1510
1510
|
return () => {
|
|
1511
1511
|
t || (t = !0, X.delete(i), X.size === 0 && Gi());
|
|
1512
1512
|
};
|
|
1513
1513
|
}
|
|
1514
|
-
function
|
|
1514
|
+
function bt(i, t) {
|
|
1515
1515
|
const e = { type: i, fromUrl: t, toUrl: location.href };
|
|
1516
1516
|
it = e.toUrl;
|
|
1517
1517
|
for (const r of [...X])
|
|
@@ -1522,14 +1522,14 @@ function mt(i, t) {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
function Ki() {
|
|
1524
1524
|
if (N) return;
|
|
1525
|
-
it = location.href, F = () =>
|
|
1525
|
+
it = location.href, F = () => bt("pop", it ?? location.href), window.addEventListener("popstate", F), I = history.pushState, H = history.replaceState;
|
|
1526
1526
|
const i = I, t = H;
|
|
1527
1527
|
N = function(e, r, n) {
|
|
1528
1528
|
const s = location.href;
|
|
1529
|
-
i.call(history, e, r, n),
|
|
1529
|
+
i.call(history, e, r, n), bt("push", s);
|
|
1530
1530
|
}, et = function(e, r, n) {
|
|
1531
1531
|
const s = location.href;
|
|
1532
|
-
t.call(history, e, r, n),
|
|
1532
|
+
t.call(history, e, r, n), bt("replace", s);
|
|
1533
1533
|
}, history.pushState = N, history.replaceState = et;
|
|
1534
1534
|
}
|
|
1535
1535
|
function Gi() {
|
|
@@ -1537,17 +1537,17 @@ function Gi() {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
const Zi = 20;
|
|
1539
1539
|
function Ji(i) {
|
|
1540
|
-
return st(i) ?
|
|
1540
|
+
return st(i) ? St(i) : Et(i);
|
|
1541
1541
|
}
|
|
1542
1542
|
function Qi(i) {
|
|
1543
|
-
return st(i) ?
|
|
1543
|
+
return st(i) ? ee(i) : Jt(i);
|
|
1544
1544
|
}
|
|
1545
1545
|
class tr {
|
|
1546
1546
|
constructor() {
|
|
1547
1547
|
this.breadcrumbs = [], this.active = !1, this.unsubscribeErrors = null, this.unsubscribeNavigation = null, this.lastUrl = "", this.boundClickHandler = (t) => this.handleClick(t), this.boundChangeHandler = (t) => this.handleChange(t);
|
|
1548
1548
|
}
|
|
1549
1549
|
start() {
|
|
1550
|
-
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors =
|
|
1550
|
+
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors = Ct.subscribe((t) => this.recordError(t)), this.unsubscribeNavigation = me(() => this.handleNavigation()));
|
|
1551
1551
|
}
|
|
1552
1552
|
stop() {
|
|
1553
1553
|
this.active && (this.active = !1, document.removeEventListener("click", this.boundClickHandler, !0), document.removeEventListener("change", this.boundChangeHandler, !0), this.unsubscribeErrors?.(), this.unsubscribeErrors = null, this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null);
|
|
@@ -1576,7 +1576,7 @@ class tr {
|
|
|
1576
1576
|
const e = t.target;
|
|
1577
1577
|
if (e && !k(e))
|
|
1578
1578
|
try {
|
|
1579
|
-
const r = e, n = st(e) ?
|
|
1579
|
+
const r = e, n = st(e) ? St(e) : r.name || r.placeholder || e.getAttribute("aria-label") || e.tagName;
|
|
1580
1580
|
this.add({
|
|
1581
1581
|
type: "ui",
|
|
1582
1582
|
category: "ui.input",
|
|
@@ -1588,7 +1588,7 @@ class tr {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
recordError(t) {
|
|
1591
|
-
const e =
|
|
1591
|
+
const e = ue(t);
|
|
1592
1592
|
this.add({
|
|
1593
1593
|
type: "console",
|
|
1594
1594
|
category: "console.error",
|
|
@@ -1612,21 +1612,21 @@ class tr {
|
|
|
1612
1612
|
});
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
1615
|
-
const
|
|
1616
|
-
let
|
|
1615
|
+
const be = "mtb_frustration_state";
|
|
1616
|
+
let wt = null;
|
|
1617
1617
|
function rt() {
|
|
1618
1618
|
try {
|
|
1619
|
-
const i = window.sessionStorage.getItem(
|
|
1620
|
-
return K(i ? JSON.parse(i) :
|
|
1619
|
+
const i = window.sessionStorage.getItem(be);
|
|
1620
|
+
return K(i ? JSON.parse(i) : wt);
|
|
1621
1621
|
} catch {
|
|
1622
|
-
return K(
|
|
1622
|
+
return K(wt);
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function pe(i) {
|
|
1626
1626
|
const t = K(i);
|
|
1627
|
-
|
|
1627
|
+
wt = t;
|
|
1628
1628
|
try {
|
|
1629
|
-
window.sessionStorage.setItem(
|
|
1629
|
+
window.sessionStorage.setItem(be, JSON.stringify(t));
|
|
1630
1630
|
} catch {
|
|
1631
1631
|
}
|
|
1632
1632
|
}
|
|
@@ -1634,7 +1634,7 @@ function er() {
|
|
|
1634
1634
|
return rt().dismissedByUser;
|
|
1635
1635
|
}
|
|
1636
1636
|
function ir() {
|
|
1637
|
-
|
|
1637
|
+
pe({ ...rt(), dismissedByUser: !0 });
|
|
1638
1638
|
}
|
|
1639
1639
|
function K(i) {
|
|
1640
1640
|
const t = i ?? {};
|
|
@@ -1645,7 +1645,7 @@ function K(i) {
|
|
|
1645
1645
|
dismissedByUser: t.dismissedByUser === !0
|
|
1646
1646
|
};
|
|
1647
1647
|
}
|
|
1648
|
-
const rr = 4, nr = 1500, sr = 3, or = 5e3,
|
|
1648
|
+
const rr = 4, nr = 1500, sr = 3, or = 5e3, pt = 500, ar = 2, lr = 3e4, cr = 2e3, hr = 1e3, dr = 300, ur = /* @__PURE__ */ new Set([
|
|
1649
1649
|
"A",
|
|
1650
1650
|
"BUTTON",
|
|
1651
1651
|
"INPUT",
|
|
@@ -1668,7 +1668,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1668
1668
|
"listbox",
|
|
1669
1669
|
"slider",
|
|
1670
1670
|
"spinbutton"
|
|
1671
|
-
]), br = /* @__PURE__ */ new Set(["A", "BUTTON", "SUMMARY"]), pr = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem"]),
|
|
1671
|
+
]), br = /* @__PURE__ */ new Set(["A", "BUTTON", "SUMMARY"]), pr = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem"]), Bt = [
|
|
1672
1672
|
/\bnot found\b/,
|
|
1673
1673
|
/\bserver error\b/,
|
|
1674
1674
|
/^\s*(?:http\s*)?[45]\d{2}\s*$/,
|
|
@@ -1679,7 +1679,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1679
1679
|
this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.lastInteraction = null, this.cooldownUntil = 0, this.navTimestamps = [], this.unsubscribeNavigation = null, this.boundPageLeaveHandler = null, this.boundTurboNavigationHandler = null, this.lastNavigationAt = -1, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.recentSubmitForms = /* @__PURE__ */ new WeakSet(), this.recentFailedForms = /* @__PURE__ */ new WeakSet(), this.formFailureTimestamps = /* @__PURE__ */ new WeakMap(), this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.pendingTimers = /* @__PURE__ */ new Set(), this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
|
|
1680
1680
|
}
|
|
1681
1681
|
start() {
|
|
1682
|
-
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1682
|
+
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = Ct.subscribe(() => {
|
|
1683
1683
|
const t = Date.now();
|
|
1684
1684
|
if (!this.lastInteraction || t - this.lastInteraction.time > cr) return;
|
|
1685
1685
|
const e = this.lastInteraction;
|
|
@@ -1705,7 +1705,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1705
1705
|
this.pendingTimers.clear();
|
|
1706
1706
|
}
|
|
1707
1707
|
startNavigationTracking() {
|
|
1708
|
-
this.unsubscribeNavigation =
|
|
1708
|
+
this.unsubscribeNavigation = me((t) => this.handleNavigation(t)), this.boundPageLeaveHandler = () => this.noteNavigationStarted(), window.addEventListener("beforeunload", this.boundPageLeaveHandler), window.addEventListener("pagehide", this.boundPageLeaveHandler), this.boundTurboNavigationHandler = () => this.noteNavigationStarted(), document.addEventListener("turbo:before-visit", this.boundTurboNavigationHandler), document.addEventListener("turbo:submit-start", this.boundTurboNavigationHandler), document.addEventListener("turbo:before-fetch-request", this.boundTurboNavigationHandler);
|
|
1709
1709
|
}
|
|
1710
1710
|
stopNavigationTracking() {
|
|
1711
1711
|
this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null, this.navTimestamps = [], this.boundPageLeaveHandler && (window.removeEventListener("beforeunload", this.boundPageLeaveHandler), window.removeEventListener("pagehide", this.boundPageLeaveHandler), this.boundPageLeaveHandler = null), this.boundTurboNavigationHandler && (document.removeEventListener("turbo:before-visit", this.boundTurboNavigationHandler), document.removeEventListener("turbo:submit-start", this.boundTurboNavigationHandler), document.removeEventListener("turbo:before-fetch-request", this.boundTurboNavigationHandler), this.boundTurboNavigationHandler = null), this.lastNavigationAt = -1;
|
|
@@ -1723,7 +1723,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1723
1723
|
}
|
|
1724
1724
|
persistState() {
|
|
1725
1725
|
const t = rt();
|
|
1726
|
-
|
|
1726
|
+
pe({
|
|
1727
1727
|
...t,
|
|
1728
1728
|
navTimestamps: this.navTimestamps,
|
|
1729
1729
|
cooldownUntil: this.cooldownUntil,
|
|
@@ -1771,7 +1771,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1771
1771
|
const e = t.target;
|
|
1772
1772
|
e instanceof HTMLFormElement && (k(e) || (this.rememberSubmitAttempt(e), this.schedule(() => {
|
|
1773
1773
|
this.active && e.querySelector('[aria-invalid="true"], .is-invalid') && this.recordFormFailure(e);
|
|
1774
|
-
},
|
|
1774
|
+
}, pt)));
|
|
1775
1775
|
}
|
|
1776
1776
|
trackFormSubmitIntent(t) {
|
|
1777
1777
|
const e = t.closest("button, input");
|
|
@@ -1785,11 +1785,11 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1785
1785
|
rememberSubmitAttempt(t) {
|
|
1786
1786
|
this.recentSubmitForms.add(t), this.schedule(() => {
|
|
1787
1787
|
this.recentSubmitForms.delete(t);
|
|
1788
|
-
},
|
|
1788
|
+
}, pt);
|
|
1789
1789
|
}
|
|
1790
1790
|
recordFormFailure(t) {
|
|
1791
1791
|
if (this.recentFailedForms.has(t)) return;
|
|
1792
|
-
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t),
|
|
1792
|
+
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t), pt);
|
|
1793
1793
|
const e = Date.now(), r = e - lr, n = (this.formFailureTimestamps.get(t) ?? []).filter((s) => s > r);
|
|
1794
1794
|
n.push(e), this.formFailureTimestamps.set(t, n), !(n.length < ar) && (this.formFailureTimestamps.set(t, []), this.emitIfReady({
|
|
1795
1795
|
signal: "form_failure",
|
|
@@ -1807,7 +1807,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1807
1807
|
const t = location.href;
|
|
1808
1808
|
if (this.errorPageUrls.has(t)) return;
|
|
1809
1809
|
const e = document.title.toLowerCase();
|
|
1810
|
-
if (
|
|
1810
|
+
if (Bt.some((n) => n.test(e))) {
|
|
1811
1811
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1812
1812
|
signal: "error_page",
|
|
1813
1813
|
detail: document.title,
|
|
@@ -1820,7 +1820,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1820
1820
|
);
|
|
1821
1821
|
for (const n of r) {
|
|
1822
1822
|
const s = n.textContent ?? "";
|
|
1823
|
-
if (s.length < 200 &&
|
|
1823
|
+
if (s.length < 200 && Bt.some((o) => o.test(s.toLowerCase()))) {
|
|
1824
1824
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1825
1825
|
signal: "error_page",
|
|
1826
1826
|
detail: s.trim().slice(0, 60),
|
|
@@ -1893,7 +1893,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1893
1893
|
}
|
|
1894
1894
|
};
|
|
1895
1895
|
z.COOLDOWN_MS = 6e4;
|
|
1896
|
-
let
|
|
1896
|
+
let yt = z;
|
|
1897
1897
|
function q(i) {
|
|
1898
1898
|
const t = i.tagName.toLowerCase(), e = i.id ? `#${i.id}` : "", r = i.className && typeof i.className == "string" ? "." + i.className.trim().split(/\s+/).slice(0, 2).join(".") : "", n = i.textContent?.trim().slice(0, 30) ?? "";
|
|
1899
1899
|
return `<${t}${e}${r}>${n ? ` "${n}"` : ""}`;
|
|
@@ -1916,7 +1916,7 @@ class yr {
|
|
|
1916
1916
|
try {
|
|
1917
1917
|
const o = new URL(r, window.location.href);
|
|
1918
1918
|
if (!["http:", "https:"].includes(o.protocol) || o.origin === window.location.origin) return;
|
|
1919
|
-
const a = await this.submissionHeaders(e, "application/json"),
|
|
1919
|
+
const a = await this.submissionHeaders(e, "application/json"), c = await (await this.fetchWithRetry(
|
|
1920
1920
|
`${this.apiUrl}/widget/feedback_submission_sessions/${t}/image_proxy_url`,
|
|
1921
1921
|
{
|
|
1922
1922
|
method: "POST",
|
|
@@ -1925,7 +1925,7 @@ class yr {
|
|
|
1925
1925
|
signal: s
|
|
1926
1926
|
}
|
|
1927
1927
|
)).json();
|
|
1928
|
-
return typeof
|
|
1928
|
+
return typeof c.url == "string" ? c.url : void 0;
|
|
1929
1929
|
} catch {
|
|
1930
1930
|
return;
|
|
1931
1931
|
}
|
|
@@ -1941,12 +1941,12 @@ class yr {
|
|
|
1941
1941
|
async createSubmissionSession(t, e) {
|
|
1942
1942
|
const r = Er(), n = new FormData();
|
|
1943
1943
|
if (n.append("feedback[description]", t.description), n.append("feedback[page_url]", t.page_url), n.append("feedback[user_agent]", t.user_agent), n.append("feedback[browser]", t.browser), n.append("feedback[os]", t.os), n.append("feedback[screen_width]", String(t.screen_width)), n.append("feedback[screen_height]", String(t.screen_height)), n.append("feedback[console_errors]", JSON.stringify(t.console_errors)), n.append("feedback[annotations]", JSON.stringify(t.annotations)), t.target_element && n.append("feedback[target_element]", JSON.stringify(t.target_element)), t.user_id && n.append("feedback[user_id]", t.user_id), t.reporter_external_id && n.append("feedback[reporter_external_id]", t.reporter_external_id), t.reporter_email && n.append("feedback[reporter_email]", t.reporter_email), t.user_email && n.append("feedback[user_email]", t.user_email), t.user_name && n.append("feedback[user_name]", t.user_name), t.breadcrumbs && t.breadcrumbs.length > 0 && n.append("feedback[breadcrumbs]", JSON.stringify(t.breadcrumbs)), t.recording_events && t.recording_events.length > 0) {
|
|
1944
|
-
const
|
|
1945
|
-
n.append("feedback[recording]",
|
|
1944
|
+
const l = JSON.stringify(t.recording_events), c = new Blob([l], { type: "application/json" });
|
|
1945
|
+
n.append("feedback[recording]", c, "interaction-replay.json"), n.append("feedback[recording_duration]", String(t.recording_duration ?? 0));
|
|
1946
1946
|
}
|
|
1947
1947
|
if (e) {
|
|
1948
|
-
const
|
|
1949
|
-
n.append("feedback[screenshot]", e, `screenshot.${
|
|
1948
|
+
const l = e.type === "image/jpeg" ? "jpg" : "png";
|
|
1949
|
+
n.append("feedback[screenshot]", e, `screenshot.${l}`);
|
|
1950
1950
|
}
|
|
1951
1951
|
const s = await this.authHeaders();
|
|
1952
1952
|
return s["X-Submission-Token"] = r, s["X-MTB-Capture-Policy"] = wr, s["X-Idempotency-Key"] = kr(), { ...(await (await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions`, {
|
|
@@ -2049,27 +2049,27 @@ class yr {
|
|
|
2049
2049
|
n = await fetch(t, e);
|
|
2050
2050
|
} catch (s) {
|
|
2051
2051
|
if (r > 0 && !e.signal?.aborted)
|
|
2052
|
-
return await
|
|
2052
|
+
return await zt(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
2053
2053
|
throw s;
|
|
2054
2054
|
}
|
|
2055
2055
|
if (n.ok) return n;
|
|
2056
2056
|
if (n.status >= 500 && r > 0)
|
|
2057
|
-
return await
|
|
2057
|
+
return await zt(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
2058
2058
|
throw new fr(n.status);
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
function
|
|
2061
|
+
function zt(i) {
|
|
2062
2062
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
2063
2063
|
}
|
|
2064
2064
|
async function xr(i, t) {
|
|
2065
2065
|
const e = i.getReader(), r = new TextDecoder();
|
|
2066
2066
|
let n = "", s = null;
|
|
2067
2067
|
const o = (a) => {
|
|
2068
|
-
const
|
|
2069
|
-
`).find((b) => b.startsWith("event:")),
|
|
2068
|
+
const l = a.split(`
|
|
2069
|
+
`).find((b) => b.startsWith("event:")), c = a.split(`
|
|
2070
2070
|
`).find((b) => b.startsWith("data:"));
|
|
2071
|
-
if (!
|
|
2072
|
-
const h =
|
|
2071
|
+
if (!c) return;
|
|
2072
|
+
const h = l?.slice(6).trim(), u = JSON.parse(c.slice(5).trim());
|
|
2073
2073
|
h === "delta" && typeof u.text == "string" ? t(u.text) : h === "done" && (s = {
|
|
2074
2074
|
messages: Array.isArray(u.messages) ? u.messages : [],
|
|
2075
2075
|
suggestions: Array.isArray(u.suggestions) ? u.suggestions.filter((b) => typeof b == "string") : [],
|
|
@@ -2078,15 +2078,15 @@ async function xr(i, t) {
|
|
|
2078
2078
|
});
|
|
2079
2079
|
};
|
|
2080
2080
|
for (; ; ) {
|
|
2081
|
-
const { done: a, value:
|
|
2081
|
+
const { done: a, value: l } = await e.read();
|
|
2082
2082
|
if (a) break;
|
|
2083
|
-
n += r.decode(
|
|
2084
|
-
let
|
|
2085
|
-
for (; (
|
|
2083
|
+
n += r.decode(l, { stream: !0 });
|
|
2084
|
+
let c;
|
|
2085
|
+
for (; (c = n.indexOf(`
|
|
2086
2086
|
|
|
2087
2087
|
`)) !== -1; ) {
|
|
2088
|
-
const h = n.slice(0,
|
|
2089
|
-
n = n.slice(
|
|
2088
|
+
const h = n.slice(0, c);
|
|
2089
|
+
n = n.slice(c + 2);
|
|
2090
2090
|
try {
|
|
2091
2091
|
o(h);
|
|
2092
2092
|
} catch {
|
|
@@ -2110,47 +2110,47 @@ function Er() {
|
|
|
2110
2110
|
const i = crypto.getRandomValues(new Uint8Array(32));
|
|
2111
2111
|
return Array.from(i, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
2112
2112
|
}
|
|
2113
|
-
const
|
|
2114
|
-
let
|
|
2115
|
-
function
|
|
2113
|
+
const Ot = "mtb_anon_id", fe = "mtb_reporter_email", ge = "mtb_board_url";
|
|
2114
|
+
let Ut = null, ve = null, we = null;
|
|
2115
|
+
function ye() {
|
|
2116
2116
|
try {
|
|
2117
|
-
const i = window.localStorage.getItem(
|
|
2117
|
+
const i = window.localStorage.getItem(Ot);
|
|
2118
2118
|
if (i?.startsWith("anon_")) return i;
|
|
2119
|
-
const t =
|
|
2120
|
-
return window.localStorage.setItem(
|
|
2119
|
+
const t = $t();
|
|
2120
|
+
return window.localStorage.setItem(Ot, t), t;
|
|
2121
2121
|
} catch {
|
|
2122
|
-
return
|
|
2122
|
+
return Ut ?? (Ut = $t()), Ut;
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
|
-
function
|
|
2125
|
+
function xe() {
|
|
2126
2126
|
try {
|
|
2127
|
-
return window.localStorage.getItem(
|
|
2127
|
+
return window.localStorage.getItem(fe) ?? void 0;
|
|
2128
2128
|
} catch {
|
|
2129
|
-
return
|
|
2129
|
+
return ve ?? void 0;
|
|
2130
2130
|
}
|
|
2131
2131
|
}
|
|
2132
2132
|
function Sr(i) {
|
|
2133
|
-
|
|
2133
|
+
ve = i;
|
|
2134
2134
|
try {
|
|
2135
|
-
window.localStorage.setItem(
|
|
2135
|
+
window.localStorage.setItem(fe, i);
|
|
2136
2136
|
} catch {
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
function _r() {
|
|
2140
2140
|
try {
|
|
2141
|
-
return window.localStorage.getItem(
|
|
2141
|
+
return window.localStorage.getItem(ge) ?? void 0;
|
|
2142
2142
|
} catch {
|
|
2143
|
-
return
|
|
2143
|
+
return we ?? void 0;
|
|
2144
2144
|
}
|
|
2145
2145
|
}
|
|
2146
2146
|
function L(i) {
|
|
2147
|
-
|
|
2147
|
+
we = i;
|
|
2148
2148
|
try {
|
|
2149
|
-
window.localStorage.setItem(
|
|
2149
|
+
window.localStorage.setItem(ge, i);
|
|
2150
2150
|
} catch {
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
|
-
function
|
|
2153
|
+
function $t() {
|
|
2154
2154
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
2155
2155
|
}
|
|
2156
2156
|
const Cr = {
|
|
@@ -2778,12 +2778,12 @@ const Cr = {
|
|
|
2778
2778
|
fr: Dr,
|
|
2779
2779
|
de: Mr
|
|
2780
2780
|
};
|
|
2781
|
-
function
|
|
2781
|
+
function jt(i) {
|
|
2782
2782
|
if (P[i]) return P[i];
|
|
2783
2783
|
const t = i.split("-")[0];
|
|
2784
2784
|
return P[t] ? P[t] : P.en;
|
|
2785
2785
|
}
|
|
2786
|
-
const Rr = 60,
|
|
2786
|
+
const Rr = 60, qt = ["value", "content"], Ir = Object.fromEntries([
|
|
2787
2787
|
"button",
|
|
2788
2788
|
"checkbox",
|
|
2789
2789
|
"color",
|
|
@@ -2817,44 +2817,44 @@ function Fr() {
|
|
|
2817
2817
|
}
|
|
2818
2818
|
function Br(i, t) {
|
|
2819
2819
|
const e = Q(i);
|
|
2820
|
-
return
|
|
2820
|
+
return xt(e, t, ae()), e;
|
|
2821
2821
|
}
|
|
2822
|
-
function
|
|
2822
|
+
function xt(i, t, e) {
|
|
2823
2823
|
if (Array.isArray(i)) {
|
|
2824
|
-
i.forEach((a) =>
|
|
2824
|
+
i.forEach((a) => xt(a, t, e));
|
|
2825
2825
|
return;
|
|
2826
2826
|
}
|
|
2827
|
-
if (!
|
|
2828
|
-
const r =
|
|
2827
|
+
if (!Wt(i)) return;
|
|
2828
|
+
const r = Wt(i.attributes) ? i.attributes : null, n = r && qt.some((a) => typeof r[a] == "string"), o = (typeof i.text == "string" || typeof i.textContent == "string" || typeof i.value == "string" || n) && typeof i.id == "number" ? t.mirror.getNode(i.id) : null;
|
|
2829
2829
|
if (o instanceof Element) {
|
|
2830
2830
|
if (typeof i.text == "string" && (i.text = tt(i.text, o)), r)
|
|
2831
|
-
for (const a of
|
|
2832
|
-
const
|
|
2833
|
-
typeof
|
|
2831
|
+
for (const a of qt) {
|
|
2832
|
+
const l = r[a];
|
|
2833
|
+
typeof l == "string" && (r[a] = tt(l, o));
|
|
2834
2834
|
}
|
|
2835
|
-
} else o?.nodeType === Node.TEXT_NODE &&
|
|
2836
|
-
Object.values(i).forEach((a) =>
|
|
2835
|
+
} else o?.nodeType === Node.TEXT_NODE && le(o, e) && (typeof i.textContent == "string" && (i.textContent = p), typeof i.value == "string" && (i.value = p));
|
|
2836
|
+
Object.values(i).forEach((a) => xt(a, t, e));
|
|
2837
2837
|
}
|
|
2838
|
-
function
|
|
2838
|
+
function Wt(i) {
|
|
2839
2839
|
return !!i && typeof i == "object" && !Array.isArray(i);
|
|
2840
2840
|
}
|
|
2841
2841
|
async function zr() {
|
|
2842
2842
|
return (await import("@rrweb/record")).record;
|
|
2843
2843
|
}
|
|
2844
|
-
function
|
|
2844
|
+
function Yt() {
|
|
2845
2845
|
const i = globalThis;
|
|
2846
2846
|
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
2847
2847
|
}
|
|
2848
2848
|
function Or() {
|
|
2849
2849
|
return new Promise((i, t) => {
|
|
2850
|
-
const e =
|
|
2850
|
+
const e = Yt();
|
|
2851
2851
|
if (e) {
|
|
2852
2852
|
i(e);
|
|
2853
2853
|
return;
|
|
2854
2854
|
}
|
|
2855
2855
|
const r = document.createElement("script");
|
|
2856
2856
|
r.src = Hr, r.integrity = Nr, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2857
|
-
const n =
|
|
2857
|
+
const n = Yt();
|
|
2858
2858
|
n ? i(n) : t(new Error("rrweb record global not found after script load"));
|
|
2859
2859
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
2860
2860
|
});
|
|
@@ -2975,7 +2975,7 @@ function Yr() {
|
|
|
2975
2975
|
return /Windows NT 10/.test(i) ? "Windows 10/11" : /Windows NT/.test(i) ? "Windows" : /Mac OS X 10_15|macOS 1[56789]/.test(i) || /Mac OS X/.test(i) ? "macOS" : /Android/.test(i) ? `Android ${i.match(/Android (\d+)/)?.[1] ?? ""}` : /iPhone|iPad|iPod/.test(i) ? "iOS" : /Linux/.test(i) ? "Linux" : "Unknown";
|
|
2976
2976
|
}
|
|
2977
2977
|
function Vr(i) {
|
|
2978
|
-
const { description: t, pageContext: e, consoleErrors: r, annotation: n, user: s, recording: o, anonId: a, anonEmail:
|
|
2978
|
+
const { description: t, pageContext: e, consoleErrors: r, annotation: n, user: s, recording: o, anonId: a, anonEmail: l, breadcrumbs: c } = i;
|
|
2979
2979
|
return {
|
|
2980
2980
|
...Q({
|
|
2981
2981
|
description: t,
|
|
@@ -2990,7 +2990,7 @@ function Vr(i) {
|
|
|
2990
2990
|
} : void 0,
|
|
2991
2991
|
recording_events: o?.events,
|
|
2992
2992
|
recording_duration: o?.duration,
|
|
2993
|
-
breadcrumbs:
|
|
2993
|
+
breadcrumbs: c
|
|
2994
2994
|
}),
|
|
2995
2995
|
user_id: s?.id,
|
|
2996
2996
|
user_email: s?.email,
|
|
@@ -2999,7 +2999,7 @@ function Vr(i) {
|
|
|
2999
2999
|
// for who the reporter is, so attaching the stored anon id/email would tie
|
|
3000
3000
|
// that account to a stranger's earlier anonymous submissions.
|
|
3001
3001
|
reporter_external_id: s ? void 0 : a,
|
|
3002
|
-
reporter_email: s ? void 0 :
|
|
3002
|
+
reporter_email: s ? void 0 : l
|
|
3003
3003
|
};
|
|
3004
3004
|
}
|
|
3005
3005
|
const Xr = 300, Kr = 5e3;
|
|
@@ -3042,14 +3042,14 @@ class Gr {
|
|
|
3042
3042
|
// Load the screenshot dependency and font CSS ahead of submit. Bitmap capture
|
|
3043
3043
|
// starts alongside Session creation; only cross-origin fallback waits for it.
|
|
3044
3044
|
warmScreenshotDeps() {
|
|
3045
|
-
this.screenshotEnabled &&
|
|
3045
|
+
this.screenshotEnabled && _t();
|
|
3046
3046
|
}
|
|
3047
3047
|
start(t, e, r) {
|
|
3048
3048
|
const n = ++this.submissionAttempt, s = this.createSubmission(t, e, r, n);
|
|
3049
3049
|
return this.pendingSubmissionRequest = s, s;
|
|
3050
3050
|
}
|
|
3051
3051
|
async createSubmission(t, e, r, n) {
|
|
3052
|
-
if (await
|
|
3052
|
+
if (await Vt(), n !== this.submissionAttempt) return null;
|
|
3053
3053
|
const s = qr(), o = Vr({
|
|
3054
3054
|
description: t,
|
|
3055
3055
|
pageContext: s,
|
|
@@ -3057,8 +3057,8 @@ class Gr {
|
|
|
3057
3057
|
annotation: e,
|
|
3058
3058
|
user: this.deps.user(),
|
|
3059
3059
|
recording: r,
|
|
3060
|
-
anonId:
|
|
3061
|
-
anonEmail:
|
|
3060
|
+
anonId: ye(),
|
|
3061
|
+
anonEmail: xe(),
|
|
3062
3062
|
breadcrumbs: this.deps.breadcrumbCollector.getBreadcrumbs()
|
|
3063
3063
|
});
|
|
3064
3064
|
let a;
|
|
@@ -3067,46 +3067,47 @@ class Gr {
|
|
|
3067
3067
|
} catch {
|
|
3068
3068
|
return null;
|
|
3069
3069
|
}
|
|
3070
|
-
let
|
|
3070
|
+
let l = null;
|
|
3071
3071
|
if (this.screenshotEnabled) {
|
|
3072
3072
|
const h = new AbortController();
|
|
3073
|
-
|
|
3073
|
+
l = h, this.screenshotAbortController?.abort(), this.screenshotAbortController = h;
|
|
3074
3074
|
const b = (async () => {
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
const
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3075
|
+
if (await new Promise((at) => setTimeout(at, 0)), !(h.signal.aborted || n !== this.submissionAttempt))
|
|
3076
|
+
try {
|
|
3077
|
+
const g = await Pi(async (lt, ke) => {
|
|
3078
|
+
const At = await a;
|
|
3079
|
+
if (!(h.signal.aborted || n !== this.submissionAttempt))
|
|
3080
|
+
return this.deps.apiClient.resolveScreenshotResourceUrl(
|
|
3081
|
+
At.id,
|
|
3082
|
+
At.token,
|
|
3083
|
+
lt,
|
|
3084
|
+
ke,
|
|
3085
|
+
h.signal
|
|
3086
|
+
);
|
|
3087
|
+
}, h.signal);
|
|
3088
|
+
if (h.signal.aborted || n !== this.submissionAttempt || !g) return;
|
|
3089
|
+
const f = await Di(g, e ? [e] : [], this.deps.brandColors);
|
|
3090
|
+
if (h.signal.aborted || n !== this.submissionAttempt || !f) return;
|
|
3091
|
+
const m = await a;
|
|
3092
|
+
if (h.signal.aborted || n !== this.submissionAttempt) return;
|
|
3093
|
+
await this.deps.apiClient.uploadScreenshot(m.id, m.token, f, h.signal);
|
|
3094
|
+
} catch {
|
|
3095
|
+
}
|
|
3095
3096
|
})().finally(() => {
|
|
3096
3097
|
this.pendingScreenshotTask === b && (this.pendingScreenshotTask = null), this.screenshotAbortController === h && (this.screenshotAbortController = null);
|
|
3097
3098
|
});
|
|
3098
3099
|
this.pendingScreenshotTask = b;
|
|
3099
3100
|
}
|
|
3100
|
-
let
|
|
3101
|
+
let c;
|
|
3101
3102
|
try {
|
|
3102
|
-
if (
|
|
3103
|
-
return
|
|
3103
|
+
if (c = await a, n !== this.submissionAttempt)
|
|
3104
|
+
return l?.abort(), await this.deps.apiClient.abandonSubmissionSession(c.id, c.token).catch(() => {
|
|
3104
3105
|
}), null;
|
|
3105
|
-
this.activeSubmission =
|
|
3106
|
+
this.activeSubmission = c;
|
|
3106
3107
|
} catch {
|
|
3107
|
-
return
|
|
3108
|
+
return l?.abort(), null;
|
|
3108
3109
|
}
|
|
3109
|
-
return
|
|
3110
|
+
return c;
|
|
3110
3111
|
}
|
|
3111
3112
|
async finalize() {
|
|
3112
3113
|
const t = this.submissionAttempt;
|
|
@@ -3126,7 +3127,7 @@ class Gr {
|
|
|
3126
3127
|
if (e) return this.showFinalizeFailure({ canRetry: !0 });
|
|
3127
3128
|
throw o;
|
|
3128
3129
|
}
|
|
3129
|
-
await Promise.all([n,
|
|
3130
|
+
await Promise.all([n, Vt()]), !(t !== this.submissionAttempt || this.activeSubmission !== r) && (this.activeSubmission = null, this.pendingSubmissionRequest = null, this.host.onFinalized(s, r));
|
|
3130
3131
|
}
|
|
3131
3132
|
async waitForScreenshot() {
|
|
3132
3133
|
const t = this.pendingScreenshotTask;
|
|
@@ -3157,7 +3158,7 @@ class Gr {
|
|
|
3157
3158
|
});
|
|
3158
3159
|
}
|
|
3159
3160
|
}
|
|
3160
|
-
function
|
|
3161
|
+
function Vt() {
|
|
3161
3162
|
return new Promise((i) => requestAnimationFrame(() => setTimeout(i, 0)));
|
|
3162
3163
|
}
|
|
3163
3164
|
function ot(i) {
|
|
@@ -3218,13 +3219,13 @@ class x extends y {
|
|
|
3218
3219
|
ot(t), this.host.exitAll();
|
|
3219
3220
|
}
|
|
3220
3221
|
handleToolbarModeChange(t) {
|
|
3221
|
-
t === "record" ? this.host.transitionTo(new
|
|
3222
|
+
t === "record" ? this.host.transitionTo(new Tt(this.host)) : this.host.transitionTo(new x(this.host));
|
|
3222
3223
|
}
|
|
3223
3224
|
handleDrawStroke() {
|
|
3224
3225
|
this.host.transitionTo(new Zr(this.host, S() ? "sheet" : "bar"));
|
|
3225
3226
|
}
|
|
3226
3227
|
}
|
|
3227
|
-
class
|
|
3228
|
+
class Tt extends y {
|
|
3228
3229
|
constructor() {
|
|
3229
3230
|
super(...arguments), this.kind = "recording";
|
|
3230
3231
|
}
|
|
@@ -3251,13 +3252,13 @@ class Zr extends y {
|
|
|
3251
3252
|
ot(t), this.host.cancelDraw();
|
|
3252
3253
|
}
|
|
3253
3254
|
handleToolbarModeChange(t) {
|
|
3254
|
-
t === "record" ? this.host.transitionTo(new
|
|
3255
|
+
t === "record" ? this.host.transitionTo(new Tt(this.host)) : this.host.transitionTo(new x(this.host));
|
|
3255
3256
|
}
|
|
3256
3257
|
handleDrawStroke() {
|
|
3257
3258
|
this.surface === "bar" && this.host.refreshDrawBar();
|
|
3258
3259
|
}
|
|
3259
3260
|
}
|
|
3260
|
-
class
|
|
3261
|
+
class Xt extends y {
|
|
3261
3262
|
constructor(t, e) {
|
|
3262
3263
|
super(t), this.opts = e, this.kind = "popup";
|
|
3263
3264
|
}
|
|
@@ -3268,10 +3269,10 @@ class Vt extends y {
|
|
|
3268
3269
|
ot(t), this.host.exitAll();
|
|
3269
3270
|
}
|
|
3270
3271
|
handleToolbarModeChange(t) {
|
|
3271
|
-
t === "record" ? this.host.transitionTo(new
|
|
3272
|
+
t === "record" ? this.host.transitionTo(new Tt(this.host)) : (this.host.dismissNotePopup(), this.host.transitionTo(new x(this.host)));
|
|
3272
3273
|
}
|
|
3273
3274
|
}
|
|
3274
|
-
class
|
|
3275
|
+
class ft extends y {
|
|
3275
3276
|
constructor() {
|
|
3276
3277
|
super(...arguments), this.kind = "clarifying";
|
|
3277
3278
|
}
|
|
@@ -3296,33 +3297,33 @@ class Y extends y {
|
|
|
3296
3297
|
}
|
|
3297
3298
|
const Jr = /^#[0-9a-f]{6}$/i;
|
|
3298
3299
|
function Qr(i) {
|
|
3299
|
-
return i === void 0 ? void 0 : typeof i != "object" || i === null || ![i.primary, i.hover, i.active, i.onPrimary].every((e) => typeof e == "string" && Jr.test(e)) ?
|
|
3300
|
+
return i === void 0 ? void 0 : typeof i != "object" || i === null || ![i.primary, i.hover, i.active, i.onPrimary].every((e) => typeof e == "string" && Jr.test(e)) ? Kt() : {
|
|
3300
3301
|
primary: i.primary.toLowerCase(),
|
|
3301
3302
|
hover: i.hover.toLowerCase(),
|
|
3302
3303
|
active: i.active.toLowerCase(),
|
|
3303
3304
|
onPrimary: i.onPrimary.toLowerCase()
|
|
3304
3305
|
};
|
|
3305
3306
|
}
|
|
3306
|
-
function
|
|
3307
|
+
function Kt() {
|
|
3307
3308
|
console.warn(
|
|
3308
3309
|
"[MakeThisBetter] brandColors requires primary, hover, active, and onPrimary as six-digit hex colors."
|
|
3309
3310
|
);
|
|
3310
3311
|
}
|
|
3311
|
-
function
|
|
3312
|
+
function Gt() {
|
|
3312
3313
|
const { hostname: i } = window.location;
|
|
3313
3314
|
return i === "localhost" || i === "127.0.0.1" || i === "[::1]" || i.endsWith(".localhost") || i.endsWith(".local") || i.endsWith(".test");
|
|
3314
3315
|
}
|
|
3315
3316
|
class tn {
|
|
3316
3317
|
constructor(t) {
|
|
3317
3318
|
this.tab = null, this.toolbar = null, this.session = null, this.drawBar = null, this.dim = null, this.pageOffset = new Le(), this.chatPopup = null, this.scrollLock = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.state = new W(this), this.via = "pin", this.currentAnnotation = null, this.lastPopupPos = null, this.recordingManager = null, this.touchHintShown = !1, this.lastHandoff = {}, this.handleKeydown = (e) => {
|
|
3318
|
-
e.key === "Escape" && (
|
|
3319
|
+
e.key === "Escape" && (kt(e) || this.state.handleEscape(e));
|
|
3319
3320
|
}, this.stopRecordingIntoNote = () => {
|
|
3320
|
-
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.transitionTo(new
|
|
3321
|
+
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.transitionTo(new Xt(this, {
|
|
3321
3322
|
x: window.innerWidth / 2,
|
|
3322
3323
|
y: window.innerHeight / 2,
|
|
3323
3324
|
targetName: this.messages.record.timer_label
|
|
3324
3325
|
})));
|
|
3325
|
-
}, this.config = t, t.projectKey || console.warn("[MakeThisBetter] projectKey is missing. Feedback submission will be rejected."), this.brandColors = Qr(t.brandColors), this.messages =
|
|
3326
|
+
}, this.config = t, t.projectKey || console.warn("[MakeThisBetter] projectKey is missing. Feedback submission will be rejected."), this.brandColors = Qr(t.brandColors), this.messages = jt(t.locale ?? document.documentElement.lang ?? "en"), this.apiClient = new yr({
|
|
3326
3327
|
projectKey: t.projectKey,
|
|
3327
3328
|
apiUrl: t.apiUrl,
|
|
3328
3329
|
userToken: t.userToken,
|
|
@@ -3350,7 +3351,7 @@ class tn {
|
|
|
3350
3351
|
this.consoleCollector.stop(), this.breadcrumbCollector.stop(), console.warn("[MakeThisBetter] Widget failed to start:", e);
|
|
3351
3352
|
return;
|
|
3352
3353
|
}
|
|
3353
|
-
t.frustrationDetection !== !1 && (this.frustrationDetector = new
|
|
3354
|
+
t.frustrationDetection !== !1 && (this.frustrationDetector = new yt(() => this.handleFrustration()), this.frustrationDetector.start()), document.addEventListener("keydown", this.handleKeydown, !0);
|
|
3354
3355
|
}
|
|
3355
3356
|
/**
|
|
3356
3357
|
* The single mutation point of the mode machine: the outgoing state exits,
|
|
@@ -3361,14 +3362,14 @@ class tn {
|
|
|
3361
3362
|
this.state = t, e.exit(), t.enter(), this.tab?.setActive(t.launcherLit);
|
|
3362
3363
|
}
|
|
3363
3364
|
buildUI() {
|
|
3364
|
-
if (this.shadow = new
|
|
3365
|
-
|
|
3365
|
+
if (this.shadow = new gt(this.config.theme ?? "auto", this.brandColors), this.config.entryMode === "api") {
|
|
3366
|
+
Gt() && console.warn(
|
|
3366
3367
|
'[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI.'
|
|
3367
3368
|
);
|
|
3368
3369
|
return;
|
|
3369
3370
|
}
|
|
3370
3371
|
if (S()) {
|
|
3371
|
-
|
|
3372
|
+
Gt() && console.warn(
|
|
3372
3373
|
"[MakeThisBetter] No launcher is rendered on touch devices. Call MakeThisBetter.open() from your own mobile UI."
|
|
3373
3374
|
);
|
|
3374
3375
|
return;
|
|
@@ -3401,7 +3402,7 @@ class tn {
|
|
|
3401
3402
|
// the language they were opened in rather than being re-rendered underneath a
|
|
3402
3403
|
// reporter who may be mid-sentence.
|
|
3403
3404
|
setLocale(t) {
|
|
3404
|
-
this.config.locale = t, this.messages =
|
|
3405
|
+
this.config.locale = t, this.messages = jt(t), this.tab?.setMessages(this.messages);
|
|
3405
3406
|
}
|
|
3406
3407
|
handleFrustration() {
|
|
3407
3408
|
!this.state.acceptsFrustrationPrompt || this.frustrationPrompt || er() || (this.frustrationPrompt = new Te(this.shadow, this.messages, {
|
|
@@ -3426,7 +3427,7 @@ class tn {
|
|
|
3426
3427
|
return this.toolbar !== null;
|
|
3427
3428
|
}
|
|
3428
3429
|
mountAnnotationChrome() {
|
|
3429
|
-
|
|
3430
|
+
_t();
|
|
3430
3431
|
const t = S();
|
|
3431
3432
|
this.toolbar = new He(
|
|
3432
3433
|
this.shadow,
|
|
@@ -3443,7 +3444,7 @@ class tn {
|
|
|
3443
3444
|
ensureSession() {
|
|
3444
3445
|
this.session || (this.session = new Ge(this.shadow, this.messages, {
|
|
3445
3446
|
onPin: (t, e) => {
|
|
3446
|
-
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new
|
|
3447
|
+
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new Xt(this, {
|
|
3447
3448
|
x: t.x,
|
|
3448
3449
|
y: t.y,
|
|
3449
3450
|
targetName: e,
|
|
@@ -3491,7 +3492,7 @@ class tn {
|
|
|
3491
3492
|
mountDrawSheet() {
|
|
3492
3493
|
this.engageScrollLock();
|
|
3493
3494
|
let t = !1;
|
|
3494
|
-
this.chatPopup = new
|
|
3495
|
+
this.chatPopup = new ht(this.shadow, {
|
|
3495
3496
|
targetName: this.messages.annotation.drawing,
|
|
3496
3497
|
x: window.innerWidth / 2,
|
|
3497
3498
|
y: window.innerHeight / 2,
|
|
@@ -3513,7 +3514,7 @@ class tn {
|
|
|
3513
3514
|
onAnswer: (e, r, n) => this.apiClient.answerClarification(e, r, n),
|
|
3514
3515
|
onFinalize: () => (this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3515
3516
|
onCancel: () => t ? this.exitAll() : this.cancelDraw(),
|
|
3516
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3517
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3517
3518
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3518
3519
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3519
3520
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
@@ -3542,7 +3543,7 @@ class tn {
|
|
|
3542
3543
|
this.teardownDrawBar(), this.releaseScrollLock(), this.dim?.destroy(), this.dim = null, this.mountChatAfterSubmit(r, e, n);
|
|
3543
3544
|
}
|
|
3544
3545
|
mountChatAfterSubmit(t, e, r) {
|
|
3545
|
-
this.dim = new
|
|
3546
|
+
this.dim = new Lt(this.shadow, () => this.exitAll()), this.engageScrollLock(), this.chatPopup = new ht(this.shadow, {
|
|
3546
3547
|
targetName: e?.targetName ?? this.messages.annotation.drawing,
|
|
3547
3548
|
x: this.lastPopupPos?.x ?? window.innerWidth / 2,
|
|
3548
3549
|
y: this.lastPopupPos?.y ?? window.innerHeight / 2,
|
|
@@ -3556,41 +3557,41 @@ class tn {
|
|
|
3556
3557
|
onAnswer: (n, s, o) => this.apiClient.answerClarification(n, s, o),
|
|
3557
3558
|
onFinalize: () => (this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3558
3559
|
onCancel: () => this.exitAll(),
|
|
3559
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3560
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3560
3561
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3561
3562
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
3562
3563
|
}), this.chatPopup.submit(t);
|
|
3563
3564
|
}
|
|
3564
3565
|
mountNotePopup({ x: t, y: e, targetName: r, targetRect: n }) {
|
|
3565
|
-
this.lastPopupPos = { x: t, y: e }, this.teardownDrawBar(), this.session?.dismissInteraction(), this.chatPopup?.destroy(), this.chatPopup = null, this.dim?.destroy(), this.dim = null, this.dim = new
|
|
3566
|
+
this.lastPopupPos = { x: t, y: e }, this.teardownDrawBar(), this.session?.dismissInteraction(), this.chatPopup?.destroy(), this.chatPopup = null, this.dim?.destroy(), this.dim = null, this.dim = new Lt(this.shadow, () => this.exitAll());
|
|
3566
3567
|
const s = this.recordingManager?.getRecording();
|
|
3567
3568
|
s && this.lifecycle.setScreenshotEnabled(!0);
|
|
3568
3569
|
const o = this.currentAnnotation, a = this.recordingManager?.getRecording() ?? void 0;
|
|
3569
|
-
this.chatPopup = new
|
|
3570
|
+
this.chatPopup = new ht(this.shadow, {
|
|
3570
3571
|
targetName: r,
|
|
3571
3572
|
x: t,
|
|
3572
3573
|
y: e,
|
|
3573
3574
|
targetRect: n,
|
|
3574
3575
|
messages: this.messages,
|
|
3575
3576
|
position: this.config.position ?? "right",
|
|
3576
|
-
onSubmit: async (
|
|
3577
|
+
onSubmit: async (l) => {
|
|
3577
3578
|
this.currentAnnotation = o ?? this.currentAnnotation;
|
|
3578
|
-
const
|
|
3579
|
-
return
|
|
3579
|
+
const c = await this.lifecycle.start(l, this.currentAnnotation, a);
|
|
3580
|
+
return c?.board_url && L(c.board_url), c;
|
|
3580
3581
|
},
|
|
3581
|
-
onClarify: async (
|
|
3582
|
-
onAnswer: (
|
|
3582
|
+
onClarify: async (l, c, h, u) => this.apiClient.streamClarification(l, c, h, u),
|
|
3583
|
+
onAnswer: (l, c, h) => this.apiClient.answerClarification(l, c, h),
|
|
3583
3584
|
// The chat card turns into a receipt at this point: the pin, the scrim
|
|
3584
3585
|
// and the scroll lock have nothing left to hold. A finalization failure
|
|
3585
3586
|
// remains in this card as a retryable receipt state.
|
|
3586
3587
|
onFinalize: () => (this.teardownSubmittingUi(), this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3587
3588
|
onCancel: () => this.exitAll(),
|
|
3588
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3589
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3589
3590
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3590
3591
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3591
3592
|
resolveEmailCapture: () => this.buildEmailCapture(),
|
|
3592
3593
|
...s ? { recordingSeconds: s.duration } : {
|
|
3593
|
-
onScreenshotToggle: (
|
|
3594
|
+
onScreenshotToggle: (l) => this.lifecycle.setScreenshotEnabled(l),
|
|
3594
3595
|
screenshotEnabled: this.lifecycle.isScreenshotEnabled()
|
|
3595
3596
|
}
|
|
3596
3597
|
}), this.engageScrollLock(), this.lifecycle.warmScreenshotDeps();
|
|
@@ -3613,7 +3614,7 @@ class tn {
|
|
|
3613
3614
|
buildMyFeedbackHandler() {
|
|
3614
3615
|
if (!this.config.user && _r())
|
|
3615
3616
|
return async () => {
|
|
3616
|
-
const t = await this.apiClient.createIdentityToken(
|
|
3617
|
+
const t = await this.apiClient.createIdentityToken(ye());
|
|
3617
3618
|
!t?.identity_token || !t.board_url || (L(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
|
|
3618
3619
|
};
|
|
3619
3620
|
}
|
|
@@ -3647,7 +3648,7 @@ class tn {
|
|
|
3647
3648
|
buildEmailCapture() {
|
|
3648
3649
|
if (this.config.user) return;
|
|
3649
3650
|
const { feedbackId: t, identityToken: e } = this.lastHandoff;
|
|
3650
|
-
if (!(!t || !e) && !
|
|
3651
|
+
if (!(!t || !e) && !xe())
|
|
3651
3652
|
return {
|
|
3652
3653
|
onSubmit: async (r) => {
|
|
3653
3654
|
const n = await this.apiClient.updateReporter(t, r, e);
|