makethisbetter 1.28.2 → 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 +8 -8
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +210 -207
- 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 +270 -267
- 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 +1 -0
- 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
|
}
|
|
@@ -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,7 +646,7 @@ 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
652
|
targetSelector: l.selector,
|
|
@@ -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,7 +790,7 @@ 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
796
|
const n = Array.from(i.querySelectorAll(ni)).filter((c) => !c.hidden);
|
|
@@ -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(() => {
|
|
@@ -1000,7 +1000,7 @@ class ct {
|
|
|
1000
1000
|
if (!c) return;
|
|
1001
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;
|
|
@@ -1086,8 +1086,8 @@ class ct {
|
|
|
1086
1086
|
positionCard(t, e, r, n) {
|
|
1087
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);
|
|
@@ -1116,7 +1116,7 @@ class mi {
|
|
|
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,27 +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([
|
|
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, {
|
|
1268
1270
|
quality: 0.85,
|
|
1269
1271
|
imagePlaceholder: Li,
|
|
1270
1272
|
resourceUrlResolver: i,
|
|
@@ -1359,37 +1361,37 @@ async function Hi(i, t, e, r, n) {
|
|
|
1359
1361
|
function Ni(i) {
|
|
1360
1362
|
const t = [];
|
|
1361
1363
|
for (const s of Fi(i, `.${nt}`))
|
|
1362
|
-
|
|
1364
|
+
mt(t, s.getBoundingClientRect(), It(s));
|
|
1363
1365
|
for (const s of i.querySelectorAll("input, textarea, select")) {
|
|
1364
|
-
if (
|
|
1365
|
-
const o = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? s.value : "", a = s.closest(`.${O}`) !== null, l =
|
|
1366
|
-
!a && !l ||
|
|
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);
|
|
1367
1369
|
}
|
|
1368
|
-
const e = document.createTreeWalker(i, NodeFilter.SHOW_TEXT), r =
|
|
1370
|
+
const e = document.createTreeWalker(i, NodeFilter.SHOW_TEXT), r = ae();
|
|
1369
1371
|
let n = e.nextNode();
|
|
1370
1372
|
for (; n; ) {
|
|
1371
|
-
const s = n.parentElement, o = n.textContent ?? "", a = s?.closest(`.${O}`) !== null, l = C(o) !== o ||
|
|
1372
|
-
if (s && !
|
|
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)) {
|
|
1373
1375
|
const c = $(s), h = document.createRange();
|
|
1374
1376
|
h.selectNodeContents(n);
|
|
1375
1377
|
for (const u of Array.from(h.getClientRects()))
|
|
1376
|
-
|
|
1378
|
+
mt(t, u, c, Ft);
|
|
1377
1379
|
}
|
|
1378
1380
|
n = e.nextNode();
|
|
1379
1381
|
}
|
|
1380
1382
|
return t;
|
|
1381
1383
|
}
|
|
1382
|
-
function
|
|
1383
|
-
return $(
|
|
1384
|
+
function It(i) {
|
|
1385
|
+
return $(Qt(i));
|
|
1384
1386
|
}
|
|
1385
1387
|
function Fi(i, t) {
|
|
1386
1388
|
const e = Array.from(i.querySelectorAll(t));
|
|
1387
1389
|
return i.matches(t) ? [i, ...e] : e;
|
|
1388
1390
|
}
|
|
1389
|
-
function
|
|
1391
|
+
function Ht(i) {
|
|
1390
1392
|
return i.closest(`#${w}`) !== null || i.closest(`.${nt}`) !== null;
|
|
1391
1393
|
}
|
|
1392
|
-
function
|
|
1394
|
+
function mt(i, t, e, r = 0) {
|
|
1393
1395
|
if (![t.left, t.top, t.width, t.height].every(Number.isFinite))
|
|
1394
1396
|
throw new Error("Invalid privacy redaction geometry");
|
|
1395
1397
|
t.width <= 0 || t.height <= 0 || i.push({
|
|
@@ -1399,9 +1401,9 @@ function ut(i, t, e, r = 0) {
|
|
|
1399
1401
|
height: t.height + r * 2
|
|
1400
1402
|
});
|
|
1401
1403
|
}
|
|
1402
|
-
function Bi(i, t, e, r =
|
|
1404
|
+
function Bi(i, t, e, r = te) {
|
|
1403
1405
|
i.save(), i.lineCap = "round", i.lineJoin = "round";
|
|
1404
|
-
for (const n of
|
|
1406
|
+
for (const n of he(t))
|
|
1405
1407
|
if (n.length !== 0) {
|
|
1406
1408
|
i.beginPath(), i.moveTo(
|
|
1407
1409
|
G(e, n[0][0]),
|
|
@@ -1416,13 +1418,13 @@ function Bi(i, t, e, r = Qt) {
|
|
|
1416
1418
|
}
|
|
1417
1419
|
i.restore();
|
|
1418
1420
|
}
|
|
1419
|
-
const
|
|
1421
|
+
const Nt = 16e6, Ft = 2;
|
|
1420
1422
|
function zi(i) {
|
|
1421
1423
|
const t = i.width * i.height;
|
|
1422
|
-
return !Number.isFinite(t) || t <=
|
|
1424
|
+
return !Number.isFinite(t) || t <= Nt ? 1 : Math.sqrt(Nt / t);
|
|
1423
1425
|
}
|
|
1424
1426
|
function Oi(i, t, e, r) {
|
|
1425
|
-
const n = r?.primary ??
|
|
1427
|
+
const n = r?.primary ?? te;
|
|
1426
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();
|
|
1427
1429
|
}
|
|
1428
1430
|
function Ui(i) {
|
|
@@ -1456,11 +1458,11 @@ class $i {
|
|
|
1456
1458
|
for (const e of this.listeners) e(t);
|
|
1457
1459
|
}
|
|
1458
1460
|
}
|
|
1459
|
-
const
|
|
1461
|
+
const Ct = new $i();
|
|
1460
1462
|
function ji(i) {
|
|
1461
1463
|
return !i || typeof i != "object" || !("name" in i) ? void 0 : String(i.name) || void 0;
|
|
1462
1464
|
}
|
|
1463
|
-
function
|
|
1465
|
+
function ue(i) {
|
|
1464
1466
|
const t = qi(i.name) || Wi(i.message), e = Yi(i);
|
|
1465
1467
|
return e ? `${t} (${e})` : t;
|
|
1466
1468
|
}
|
|
@@ -1485,10 +1487,10 @@ class Xi {
|
|
|
1485
1487
|
this.errors = [], this.unsubscribe = null;
|
|
1486
1488
|
}
|
|
1487
1489
|
start() {
|
|
1488
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1490
|
+
this.unsubscribe || (this.unsubscribe = Ct.subscribe((t) => this.record(t)));
|
|
1489
1491
|
}
|
|
1490
1492
|
record(t) {
|
|
1491
|
-
this.addError(
|
|
1493
|
+
this.addError(ue(t));
|
|
1492
1494
|
}
|
|
1493
1495
|
addError(t) {
|
|
1494
1496
|
this.errors.length >= Vi || this.errors.includes(t) || this.errors.push(t);
|
|
@@ -1502,14 +1504,14 @@ class Xi {
|
|
|
1502
1504
|
}
|
|
1503
1505
|
const X = /* @__PURE__ */ new Set();
|
|
1504
1506
|
let I = null, H = null, N = null, et = null, F = null, it = null;
|
|
1505
|
-
function
|
|
1507
|
+
function me(i) {
|
|
1506
1508
|
X.add(i), Ki();
|
|
1507
1509
|
let t = !1;
|
|
1508
1510
|
return () => {
|
|
1509
1511
|
t || (t = !0, X.delete(i), X.size === 0 && Gi());
|
|
1510
1512
|
};
|
|
1511
1513
|
}
|
|
1512
|
-
function
|
|
1514
|
+
function bt(i, t) {
|
|
1513
1515
|
const e = { type: i, fromUrl: t, toUrl: location.href };
|
|
1514
1516
|
it = e.toUrl;
|
|
1515
1517
|
for (const r of [...X])
|
|
@@ -1520,14 +1522,14 @@ function mt(i, t) {
|
|
|
1520
1522
|
}
|
|
1521
1523
|
function Ki() {
|
|
1522
1524
|
if (N) return;
|
|
1523
|
-
it = location.href, F = () =>
|
|
1525
|
+
it = location.href, F = () => bt("pop", it ?? location.href), window.addEventListener("popstate", F), I = history.pushState, H = history.replaceState;
|
|
1524
1526
|
const i = I, t = H;
|
|
1525
1527
|
N = function(e, r, n) {
|
|
1526
1528
|
const s = location.href;
|
|
1527
|
-
i.call(history, e, r, n),
|
|
1529
|
+
i.call(history, e, r, n), bt("push", s);
|
|
1528
1530
|
}, et = function(e, r, n) {
|
|
1529
1531
|
const s = location.href;
|
|
1530
|
-
t.call(history, e, r, n),
|
|
1532
|
+
t.call(history, e, r, n), bt("replace", s);
|
|
1531
1533
|
}, history.pushState = N, history.replaceState = et;
|
|
1532
1534
|
}
|
|
1533
1535
|
function Gi() {
|
|
@@ -1535,17 +1537,17 @@ function Gi() {
|
|
|
1535
1537
|
}
|
|
1536
1538
|
const Zi = 20;
|
|
1537
1539
|
function Ji(i) {
|
|
1538
|
-
return st(i) ?
|
|
1540
|
+
return st(i) ? St(i) : Et(i);
|
|
1539
1541
|
}
|
|
1540
1542
|
function Qi(i) {
|
|
1541
|
-
return st(i) ?
|
|
1543
|
+
return st(i) ? ee(i) : Jt(i);
|
|
1542
1544
|
}
|
|
1543
1545
|
class tr {
|
|
1544
1546
|
constructor() {
|
|
1545
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);
|
|
1546
1548
|
}
|
|
1547
1549
|
start() {
|
|
1548
|
-
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()));
|
|
1549
1551
|
}
|
|
1550
1552
|
stop() {
|
|
1551
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);
|
|
@@ -1574,7 +1576,7 @@ class tr {
|
|
|
1574
1576
|
const e = t.target;
|
|
1575
1577
|
if (e && !k(e))
|
|
1576
1578
|
try {
|
|
1577
|
-
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;
|
|
1578
1580
|
this.add({
|
|
1579
1581
|
type: "ui",
|
|
1580
1582
|
category: "ui.input",
|
|
@@ -1586,7 +1588,7 @@ class tr {
|
|
|
1586
1588
|
}
|
|
1587
1589
|
}
|
|
1588
1590
|
recordError(t) {
|
|
1589
|
-
const e =
|
|
1591
|
+
const e = ue(t);
|
|
1590
1592
|
this.add({
|
|
1591
1593
|
type: "console",
|
|
1592
1594
|
category: "console.error",
|
|
@@ -1610,21 +1612,21 @@ class tr {
|
|
|
1610
1612
|
});
|
|
1611
1613
|
}
|
|
1612
1614
|
}
|
|
1613
|
-
const
|
|
1614
|
-
let
|
|
1615
|
+
const be = "mtb_frustration_state";
|
|
1616
|
+
let wt = null;
|
|
1615
1617
|
function rt() {
|
|
1616
1618
|
try {
|
|
1617
|
-
const i = window.sessionStorage.getItem(
|
|
1618
|
-
return K(i ? JSON.parse(i) :
|
|
1619
|
+
const i = window.sessionStorage.getItem(be);
|
|
1620
|
+
return K(i ? JSON.parse(i) : wt);
|
|
1619
1621
|
} catch {
|
|
1620
|
-
return K(
|
|
1622
|
+
return K(wt);
|
|
1621
1623
|
}
|
|
1622
1624
|
}
|
|
1623
|
-
function
|
|
1625
|
+
function pe(i) {
|
|
1624
1626
|
const t = K(i);
|
|
1625
|
-
|
|
1627
|
+
wt = t;
|
|
1626
1628
|
try {
|
|
1627
|
-
window.sessionStorage.setItem(
|
|
1629
|
+
window.sessionStorage.setItem(be, JSON.stringify(t));
|
|
1628
1630
|
} catch {
|
|
1629
1631
|
}
|
|
1630
1632
|
}
|
|
@@ -1632,7 +1634,7 @@ function er() {
|
|
|
1632
1634
|
return rt().dismissedByUser;
|
|
1633
1635
|
}
|
|
1634
1636
|
function ir() {
|
|
1635
|
-
|
|
1637
|
+
pe({ ...rt(), dismissedByUser: !0 });
|
|
1636
1638
|
}
|
|
1637
1639
|
function K(i) {
|
|
1638
1640
|
const t = i ?? {};
|
|
@@ -1643,7 +1645,7 @@ function K(i) {
|
|
|
1643
1645
|
dismissedByUser: t.dismissedByUser === !0
|
|
1644
1646
|
};
|
|
1645
1647
|
}
|
|
1646
|
-
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([
|
|
1647
1649
|
"A",
|
|
1648
1650
|
"BUTTON",
|
|
1649
1651
|
"INPUT",
|
|
@@ -1666,7 +1668,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1666
1668
|
"listbox",
|
|
1667
1669
|
"slider",
|
|
1668
1670
|
"spinbutton"
|
|
1669
|
-
]), 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 = [
|
|
1670
1672
|
/\bnot found\b/,
|
|
1671
1673
|
/\bserver error\b/,
|
|
1672
1674
|
/^\s*(?:http\s*)?[45]\d{2}\s*$/,
|
|
@@ -1677,7 +1679,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1677
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);
|
|
1678
1680
|
}
|
|
1679
1681
|
start() {
|
|
1680
|
-
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(() => {
|
|
1681
1683
|
const t = Date.now();
|
|
1682
1684
|
if (!this.lastInteraction || t - this.lastInteraction.time > cr) return;
|
|
1683
1685
|
const e = this.lastInteraction;
|
|
@@ -1703,7 +1705,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1703
1705
|
this.pendingTimers.clear();
|
|
1704
1706
|
}
|
|
1705
1707
|
startNavigationTracking() {
|
|
1706
|
-
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);
|
|
1707
1709
|
}
|
|
1708
1710
|
stopNavigationTracking() {
|
|
1709
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;
|
|
@@ -1721,7 +1723,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1721
1723
|
}
|
|
1722
1724
|
persistState() {
|
|
1723
1725
|
const t = rt();
|
|
1724
|
-
|
|
1726
|
+
pe({
|
|
1725
1727
|
...t,
|
|
1726
1728
|
navTimestamps: this.navTimestamps,
|
|
1727
1729
|
cooldownUntil: this.cooldownUntil,
|
|
@@ -1769,7 +1771,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1769
1771
|
const e = t.target;
|
|
1770
1772
|
e instanceof HTMLFormElement && (k(e) || (this.rememberSubmitAttempt(e), this.schedule(() => {
|
|
1771
1773
|
this.active && e.querySelector('[aria-invalid="true"], .is-invalid') && this.recordFormFailure(e);
|
|
1772
|
-
},
|
|
1774
|
+
}, pt)));
|
|
1773
1775
|
}
|
|
1774
1776
|
trackFormSubmitIntent(t) {
|
|
1775
1777
|
const e = t.closest("button, input");
|
|
@@ -1783,11 +1785,11 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1783
1785
|
rememberSubmitAttempt(t) {
|
|
1784
1786
|
this.recentSubmitForms.add(t), this.schedule(() => {
|
|
1785
1787
|
this.recentSubmitForms.delete(t);
|
|
1786
|
-
},
|
|
1788
|
+
}, pt);
|
|
1787
1789
|
}
|
|
1788
1790
|
recordFormFailure(t) {
|
|
1789
1791
|
if (this.recentFailedForms.has(t)) return;
|
|
1790
|
-
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t),
|
|
1792
|
+
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t), pt);
|
|
1791
1793
|
const e = Date.now(), r = e - lr, n = (this.formFailureTimestamps.get(t) ?? []).filter((s) => s > r);
|
|
1792
1794
|
n.push(e), this.formFailureTimestamps.set(t, n), !(n.length < ar) && (this.formFailureTimestamps.set(t, []), this.emitIfReady({
|
|
1793
1795
|
signal: "form_failure",
|
|
@@ -1805,7 +1807,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1805
1807
|
const t = location.href;
|
|
1806
1808
|
if (this.errorPageUrls.has(t)) return;
|
|
1807
1809
|
const e = document.title.toLowerCase();
|
|
1808
|
-
if (
|
|
1810
|
+
if (Bt.some((n) => n.test(e))) {
|
|
1809
1811
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1810
1812
|
signal: "error_page",
|
|
1811
1813
|
detail: document.title,
|
|
@@ -1818,7 +1820,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1818
1820
|
);
|
|
1819
1821
|
for (const n of r) {
|
|
1820
1822
|
const s = n.textContent ?? "";
|
|
1821
|
-
if (s.length < 200 &&
|
|
1823
|
+
if (s.length < 200 && Bt.some((o) => o.test(s.toLowerCase()))) {
|
|
1822
1824
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1823
1825
|
signal: "error_page",
|
|
1824
1826
|
detail: s.trim().slice(0, 60),
|
|
@@ -1891,7 +1893,7 @@ const rr = 4, nr = 1500, sr = 3, or = 5e3, bt = 500, ar = 2, lr = 3e4, cr = 2e3,
|
|
|
1891
1893
|
}
|
|
1892
1894
|
};
|
|
1893
1895
|
z.COOLDOWN_MS = 6e4;
|
|
1894
|
-
let
|
|
1896
|
+
let yt = z;
|
|
1895
1897
|
function q(i) {
|
|
1896
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) ?? "";
|
|
1897
1899
|
return `<${t}${e}${r}>${n ? ` "${n}"` : ""}`;
|
|
@@ -2047,16 +2049,16 @@ class yr {
|
|
|
2047
2049
|
n = await fetch(t, e);
|
|
2048
2050
|
} catch (s) {
|
|
2049
2051
|
if (r > 0 && !e.signal?.aborted)
|
|
2050
|
-
return await
|
|
2052
|
+
return await zt(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
2051
2053
|
throw s;
|
|
2052
2054
|
}
|
|
2053
2055
|
if (n.ok) return n;
|
|
2054
2056
|
if (n.status >= 500 && r > 0)
|
|
2055
|
-
return await
|
|
2057
|
+
return await zt(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
2056
2058
|
throw new fr(n.status);
|
|
2057
2059
|
}
|
|
2058
2060
|
}
|
|
2059
|
-
function
|
|
2061
|
+
function zt(i) {
|
|
2060
2062
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
2061
2063
|
}
|
|
2062
2064
|
async function xr(i, t) {
|
|
@@ -2108,47 +2110,47 @@ function Er() {
|
|
|
2108
2110
|
const i = crypto.getRandomValues(new Uint8Array(32));
|
|
2109
2111
|
return Array.from(i, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
2110
2112
|
}
|
|
2111
|
-
const
|
|
2112
|
-
let
|
|
2113
|
-
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() {
|
|
2114
2116
|
try {
|
|
2115
|
-
const i = window.localStorage.getItem(
|
|
2117
|
+
const i = window.localStorage.getItem(Ot);
|
|
2116
2118
|
if (i?.startsWith("anon_")) return i;
|
|
2117
|
-
const t =
|
|
2118
|
-
return window.localStorage.setItem(
|
|
2119
|
+
const t = $t();
|
|
2120
|
+
return window.localStorage.setItem(Ot, t), t;
|
|
2119
2121
|
} catch {
|
|
2120
|
-
return
|
|
2122
|
+
return Ut ?? (Ut = $t()), Ut;
|
|
2121
2123
|
}
|
|
2122
2124
|
}
|
|
2123
|
-
function
|
|
2125
|
+
function xe() {
|
|
2124
2126
|
try {
|
|
2125
|
-
return window.localStorage.getItem(
|
|
2127
|
+
return window.localStorage.getItem(fe) ?? void 0;
|
|
2126
2128
|
} catch {
|
|
2127
|
-
return
|
|
2129
|
+
return ve ?? void 0;
|
|
2128
2130
|
}
|
|
2129
2131
|
}
|
|
2130
2132
|
function Sr(i) {
|
|
2131
|
-
|
|
2133
|
+
ve = i;
|
|
2132
2134
|
try {
|
|
2133
|
-
window.localStorage.setItem(
|
|
2135
|
+
window.localStorage.setItem(fe, i);
|
|
2134
2136
|
} catch {
|
|
2135
2137
|
}
|
|
2136
2138
|
}
|
|
2137
2139
|
function _r() {
|
|
2138
2140
|
try {
|
|
2139
|
-
return window.localStorage.getItem(
|
|
2141
|
+
return window.localStorage.getItem(ge) ?? void 0;
|
|
2140
2142
|
} catch {
|
|
2141
|
-
return
|
|
2143
|
+
return we ?? void 0;
|
|
2142
2144
|
}
|
|
2143
2145
|
}
|
|
2144
2146
|
function L(i) {
|
|
2145
|
-
|
|
2147
|
+
we = i;
|
|
2146
2148
|
try {
|
|
2147
|
-
window.localStorage.setItem(
|
|
2149
|
+
window.localStorage.setItem(ge, i);
|
|
2148
2150
|
} catch {
|
|
2149
2151
|
}
|
|
2150
2152
|
}
|
|
2151
|
-
function
|
|
2153
|
+
function $t() {
|
|
2152
2154
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
2153
2155
|
}
|
|
2154
2156
|
const Cr = {
|
|
@@ -2776,12 +2778,12 @@ const Cr = {
|
|
|
2776
2778
|
fr: Dr,
|
|
2777
2779
|
de: Mr
|
|
2778
2780
|
};
|
|
2779
|
-
function
|
|
2781
|
+
function jt(i) {
|
|
2780
2782
|
if (P[i]) return P[i];
|
|
2781
2783
|
const t = i.split("-")[0];
|
|
2782
2784
|
return P[t] ? P[t] : P.en;
|
|
2783
2785
|
}
|
|
2784
|
-
const Rr = 60,
|
|
2786
|
+
const Rr = 60, qt = ["value", "content"], Ir = Object.fromEntries([
|
|
2785
2787
|
"button",
|
|
2786
2788
|
"checkbox",
|
|
2787
2789
|
"color",
|
|
@@ -2815,44 +2817,44 @@ function Fr() {
|
|
|
2815
2817
|
}
|
|
2816
2818
|
function Br(i, t) {
|
|
2817
2819
|
const e = Q(i);
|
|
2818
|
-
return
|
|
2820
|
+
return xt(e, t, ae()), e;
|
|
2819
2821
|
}
|
|
2820
|
-
function
|
|
2822
|
+
function xt(i, t, e) {
|
|
2821
2823
|
if (Array.isArray(i)) {
|
|
2822
|
-
i.forEach((a) =>
|
|
2824
|
+
i.forEach((a) => xt(a, t, e));
|
|
2823
2825
|
return;
|
|
2824
2826
|
}
|
|
2825
|
-
if (!
|
|
2826
|
-
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;
|
|
2827
2829
|
if (o instanceof Element) {
|
|
2828
2830
|
if (typeof i.text == "string" && (i.text = tt(i.text, o)), r)
|
|
2829
|
-
for (const a of
|
|
2831
|
+
for (const a of qt) {
|
|
2830
2832
|
const l = r[a];
|
|
2831
2833
|
typeof l == "string" && (r[a] = tt(l, o));
|
|
2832
2834
|
}
|
|
2833
|
-
} else o?.nodeType === Node.TEXT_NODE &&
|
|
2834
|
-
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));
|
|
2835
2837
|
}
|
|
2836
|
-
function
|
|
2838
|
+
function Wt(i) {
|
|
2837
2839
|
return !!i && typeof i == "object" && !Array.isArray(i);
|
|
2838
2840
|
}
|
|
2839
2841
|
async function zr() {
|
|
2840
2842
|
return (await import("@rrweb/record")).record;
|
|
2841
2843
|
}
|
|
2842
|
-
function
|
|
2844
|
+
function Yt() {
|
|
2843
2845
|
const i = globalThis;
|
|
2844
2846
|
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
2845
2847
|
}
|
|
2846
2848
|
function Or() {
|
|
2847
2849
|
return new Promise((i, t) => {
|
|
2848
|
-
const e =
|
|
2850
|
+
const e = Yt();
|
|
2849
2851
|
if (e) {
|
|
2850
2852
|
i(e);
|
|
2851
2853
|
return;
|
|
2852
2854
|
}
|
|
2853
2855
|
const r = document.createElement("script");
|
|
2854
2856
|
r.src = Hr, r.integrity = Nr, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2855
|
-
const n =
|
|
2857
|
+
const n = Yt();
|
|
2856
2858
|
n ? i(n) : t(new Error("rrweb record global not found after script load"));
|
|
2857
2859
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
2858
2860
|
});
|
|
@@ -3040,14 +3042,14 @@ class Gr {
|
|
|
3040
3042
|
// Load the screenshot dependency and font CSS ahead of submit. Bitmap capture
|
|
3041
3043
|
// starts alongside Session creation; only cross-origin fallback waits for it.
|
|
3042
3044
|
warmScreenshotDeps() {
|
|
3043
|
-
this.screenshotEnabled &&
|
|
3045
|
+
this.screenshotEnabled && _t();
|
|
3044
3046
|
}
|
|
3045
3047
|
start(t, e, r) {
|
|
3046
3048
|
const n = ++this.submissionAttempt, s = this.createSubmission(t, e, r, n);
|
|
3047
3049
|
return this.pendingSubmissionRequest = s, s;
|
|
3048
3050
|
}
|
|
3049
3051
|
async createSubmission(t, e, r, n) {
|
|
3050
|
-
if (await
|
|
3052
|
+
if (await Vt(), n !== this.submissionAttempt) return null;
|
|
3051
3053
|
const s = qr(), o = Vr({
|
|
3052
3054
|
description: t,
|
|
3053
3055
|
pageContext: s,
|
|
@@ -3055,8 +3057,8 @@ class Gr {
|
|
|
3055
3057
|
annotation: e,
|
|
3056
3058
|
user: this.deps.user(),
|
|
3057
3059
|
recording: r,
|
|
3058
|
-
anonId:
|
|
3059
|
-
anonEmail:
|
|
3060
|
+
anonId: ye(),
|
|
3061
|
+
anonEmail: xe(),
|
|
3060
3062
|
breadcrumbs: this.deps.breadcrumbCollector.getBreadcrumbs()
|
|
3061
3063
|
});
|
|
3062
3064
|
let a;
|
|
@@ -3070,26 +3072,27 @@ class Gr {
|
|
|
3070
3072
|
const h = new AbortController();
|
|
3071
3073
|
l = h, this.screenshotAbortController?.abort(), this.screenshotAbortController = h;
|
|
3072
3074
|
const b = (async () => {
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
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
|
+
}
|
|
3093
3096
|
})().finally(() => {
|
|
3094
3097
|
this.pendingScreenshotTask === b && (this.pendingScreenshotTask = null), this.screenshotAbortController === h && (this.screenshotAbortController = null);
|
|
3095
3098
|
});
|
|
@@ -3124,7 +3127,7 @@ class Gr {
|
|
|
3124
3127
|
if (e) return this.showFinalizeFailure({ canRetry: !0 });
|
|
3125
3128
|
throw o;
|
|
3126
3129
|
}
|
|
3127
|
-
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));
|
|
3128
3131
|
}
|
|
3129
3132
|
async waitForScreenshot() {
|
|
3130
3133
|
const t = this.pendingScreenshotTask;
|
|
@@ -3155,7 +3158,7 @@ class Gr {
|
|
|
3155
3158
|
});
|
|
3156
3159
|
}
|
|
3157
3160
|
}
|
|
3158
|
-
function
|
|
3161
|
+
function Vt() {
|
|
3159
3162
|
return new Promise((i) => requestAnimationFrame(() => setTimeout(i, 0)));
|
|
3160
3163
|
}
|
|
3161
3164
|
function ot(i) {
|
|
@@ -3216,13 +3219,13 @@ class x extends y {
|
|
|
3216
3219
|
ot(t), this.host.exitAll();
|
|
3217
3220
|
}
|
|
3218
3221
|
handleToolbarModeChange(t) {
|
|
3219
|
-
t === "record" ? this.host.transitionTo(new
|
|
3222
|
+
t === "record" ? this.host.transitionTo(new Tt(this.host)) : this.host.transitionTo(new x(this.host));
|
|
3220
3223
|
}
|
|
3221
3224
|
handleDrawStroke() {
|
|
3222
3225
|
this.host.transitionTo(new Zr(this.host, S() ? "sheet" : "bar"));
|
|
3223
3226
|
}
|
|
3224
3227
|
}
|
|
3225
|
-
class
|
|
3228
|
+
class Tt extends y {
|
|
3226
3229
|
constructor() {
|
|
3227
3230
|
super(...arguments), this.kind = "recording";
|
|
3228
3231
|
}
|
|
@@ -3249,13 +3252,13 @@ class Zr extends y {
|
|
|
3249
3252
|
ot(t), this.host.cancelDraw();
|
|
3250
3253
|
}
|
|
3251
3254
|
handleToolbarModeChange(t) {
|
|
3252
|
-
t === "record" ? this.host.transitionTo(new
|
|
3255
|
+
t === "record" ? this.host.transitionTo(new Tt(this.host)) : this.host.transitionTo(new x(this.host));
|
|
3253
3256
|
}
|
|
3254
3257
|
handleDrawStroke() {
|
|
3255
3258
|
this.surface === "bar" && this.host.refreshDrawBar();
|
|
3256
3259
|
}
|
|
3257
3260
|
}
|
|
3258
|
-
class
|
|
3261
|
+
class Xt extends y {
|
|
3259
3262
|
constructor(t, e) {
|
|
3260
3263
|
super(t), this.opts = e, this.kind = "popup";
|
|
3261
3264
|
}
|
|
@@ -3266,10 +3269,10 @@ class Vt extends y {
|
|
|
3266
3269
|
ot(t), this.host.exitAll();
|
|
3267
3270
|
}
|
|
3268
3271
|
handleToolbarModeChange(t) {
|
|
3269
|
-
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)));
|
|
3270
3273
|
}
|
|
3271
3274
|
}
|
|
3272
|
-
class
|
|
3275
|
+
class ft extends y {
|
|
3273
3276
|
constructor() {
|
|
3274
3277
|
super(...arguments), this.kind = "clarifying";
|
|
3275
3278
|
}
|
|
@@ -3294,33 +3297,33 @@ class Y extends y {
|
|
|
3294
3297
|
}
|
|
3295
3298
|
const Jr = /^#[0-9a-f]{6}$/i;
|
|
3296
3299
|
function Qr(i) {
|
|
3297
|
-
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() : {
|
|
3298
3301
|
primary: i.primary.toLowerCase(),
|
|
3299
3302
|
hover: i.hover.toLowerCase(),
|
|
3300
3303
|
active: i.active.toLowerCase(),
|
|
3301
3304
|
onPrimary: i.onPrimary.toLowerCase()
|
|
3302
3305
|
};
|
|
3303
3306
|
}
|
|
3304
|
-
function
|
|
3307
|
+
function Kt() {
|
|
3305
3308
|
console.warn(
|
|
3306
3309
|
"[MakeThisBetter] brandColors requires primary, hover, active, and onPrimary as six-digit hex colors."
|
|
3307
3310
|
);
|
|
3308
3311
|
}
|
|
3309
|
-
function
|
|
3312
|
+
function Gt() {
|
|
3310
3313
|
const { hostname: i } = window.location;
|
|
3311
3314
|
return i === "localhost" || i === "127.0.0.1" || i === "[::1]" || i.endsWith(".localhost") || i.endsWith(".local") || i.endsWith(".test");
|
|
3312
3315
|
}
|
|
3313
3316
|
class tn {
|
|
3314
3317
|
constructor(t) {
|
|
3315
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) => {
|
|
3316
|
-
e.key === "Escape" && (
|
|
3319
|
+
e.key === "Escape" && (kt(e) || this.state.handleEscape(e));
|
|
3317
3320
|
}, this.stopRecordingIntoNote = () => {
|
|
3318
|
-
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, {
|
|
3319
3322
|
x: window.innerWidth / 2,
|
|
3320
3323
|
y: window.innerHeight / 2,
|
|
3321
3324
|
targetName: this.messages.record.timer_label
|
|
3322
3325
|
})));
|
|
3323
|
-
}, 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({
|
|
3324
3327
|
projectKey: t.projectKey,
|
|
3325
3328
|
apiUrl: t.apiUrl,
|
|
3326
3329
|
userToken: t.userToken,
|
|
@@ -3348,7 +3351,7 @@ class tn {
|
|
|
3348
3351
|
this.consoleCollector.stop(), this.breadcrumbCollector.stop(), console.warn("[MakeThisBetter] Widget failed to start:", e);
|
|
3349
3352
|
return;
|
|
3350
3353
|
}
|
|
3351
|
-
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);
|
|
3352
3355
|
}
|
|
3353
3356
|
/**
|
|
3354
3357
|
* The single mutation point of the mode machine: the outgoing state exits,
|
|
@@ -3359,14 +3362,14 @@ class tn {
|
|
|
3359
3362
|
this.state = t, e.exit(), t.enter(), this.tab?.setActive(t.launcherLit);
|
|
3360
3363
|
}
|
|
3361
3364
|
buildUI() {
|
|
3362
|
-
if (this.shadow = new
|
|
3363
|
-
|
|
3365
|
+
if (this.shadow = new gt(this.config.theme ?? "auto", this.brandColors), this.config.entryMode === "api") {
|
|
3366
|
+
Gt() && console.warn(
|
|
3364
3367
|
'[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI.'
|
|
3365
3368
|
);
|
|
3366
3369
|
return;
|
|
3367
3370
|
}
|
|
3368
3371
|
if (S()) {
|
|
3369
|
-
|
|
3372
|
+
Gt() && console.warn(
|
|
3370
3373
|
"[MakeThisBetter] No launcher is rendered on touch devices. Call MakeThisBetter.open() from your own mobile UI."
|
|
3371
3374
|
);
|
|
3372
3375
|
return;
|
|
@@ -3399,7 +3402,7 @@ class tn {
|
|
|
3399
3402
|
// the language they were opened in rather than being re-rendered underneath a
|
|
3400
3403
|
// reporter who may be mid-sentence.
|
|
3401
3404
|
setLocale(t) {
|
|
3402
|
-
this.config.locale = t, this.messages =
|
|
3405
|
+
this.config.locale = t, this.messages = jt(t), this.tab?.setMessages(this.messages);
|
|
3403
3406
|
}
|
|
3404
3407
|
handleFrustration() {
|
|
3405
3408
|
!this.state.acceptsFrustrationPrompt || this.frustrationPrompt || er() || (this.frustrationPrompt = new Te(this.shadow, this.messages, {
|
|
@@ -3424,7 +3427,7 @@ class tn {
|
|
|
3424
3427
|
return this.toolbar !== null;
|
|
3425
3428
|
}
|
|
3426
3429
|
mountAnnotationChrome() {
|
|
3427
|
-
|
|
3430
|
+
_t();
|
|
3428
3431
|
const t = S();
|
|
3429
3432
|
this.toolbar = new He(
|
|
3430
3433
|
this.shadow,
|
|
@@ -3441,7 +3444,7 @@ class tn {
|
|
|
3441
3444
|
ensureSession() {
|
|
3442
3445
|
this.session || (this.session = new Ge(this.shadow, this.messages, {
|
|
3443
3446
|
onPin: (t, e) => {
|
|
3444
|
-
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new
|
|
3447
|
+
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new Xt(this, {
|
|
3445
3448
|
x: t.x,
|
|
3446
3449
|
y: t.y,
|
|
3447
3450
|
targetName: e,
|
|
@@ -3489,7 +3492,7 @@ class tn {
|
|
|
3489
3492
|
mountDrawSheet() {
|
|
3490
3493
|
this.engageScrollLock();
|
|
3491
3494
|
let t = !1;
|
|
3492
|
-
this.chatPopup = new
|
|
3495
|
+
this.chatPopup = new ht(this.shadow, {
|
|
3493
3496
|
targetName: this.messages.annotation.drawing,
|
|
3494
3497
|
x: window.innerWidth / 2,
|
|
3495
3498
|
y: window.innerHeight / 2,
|
|
@@ -3511,7 +3514,7 @@ class tn {
|
|
|
3511
3514
|
onAnswer: (e, r, n) => this.apiClient.answerClarification(e, r, n),
|
|
3512
3515
|
onFinalize: () => (this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3513
3516
|
onCancel: () => t ? this.exitAll() : this.cancelDraw(),
|
|
3514
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3517
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3515
3518
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3516
3519
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3517
3520
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
@@ -3540,7 +3543,7 @@ class tn {
|
|
|
3540
3543
|
this.teardownDrawBar(), this.releaseScrollLock(), this.dim?.destroy(), this.dim = null, this.mountChatAfterSubmit(r, e, n);
|
|
3541
3544
|
}
|
|
3542
3545
|
mountChatAfterSubmit(t, e, r) {
|
|
3543
|
-
this.dim = new
|
|
3546
|
+
this.dim = new Lt(this.shadow, () => this.exitAll()), this.engageScrollLock(), this.chatPopup = new ht(this.shadow, {
|
|
3544
3547
|
targetName: e?.targetName ?? this.messages.annotation.drawing,
|
|
3545
3548
|
x: this.lastPopupPos?.x ?? window.innerWidth / 2,
|
|
3546
3549
|
y: this.lastPopupPos?.y ?? window.innerHeight / 2,
|
|
@@ -3554,17 +3557,17 @@ class tn {
|
|
|
3554
3557
|
onAnswer: (n, s, o) => this.apiClient.answerClarification(n, s, o),
|
|
3555
3558
|
onFinalize: () => (this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3556
3559
|
onCancel: () => this.exitAll(),
|
|
3557
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3560
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3558
3561
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3559
3562
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
3560
3563
|
}), this.chatPopup.submit(t);
|
|
3561
3564
|
}
|
|
3562
3565
|
mountNotePopup({ x: t, y: e, targetName: r, targetRect: n }) {
|
|
3563
|
-
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());
|
|
3564
3567
|
const s = this.recordingManager?.getRecording();
|
|
3565
3568
|
s && this.lifecycle.setScreenshotEnabled(!0);
|
|
3566
3569
|
const o = this.currentAnnotation, a = this.recordingManager?.getRecording() ?? void 0;
|
|
3567
|
-
this.chatPopup = new
|
|
3570
|
+
this.chatPopup = new ht(this.shadow, {
|
|
3568
3571
|
targetName: r,
|
|
3569
3572
|
x: t,
|
|
3570
3573
|
y: e,
|
|
@@ -3583,7 +3586,7 @@ class tn {
|
|
|
3583
3586
|
// remains in this card as a retryable receipt state.
|
|
3584
3587
|
onFinalize: () => (this.teardownSubmittingUi(), this.transitionTo(new Y(this)), this.lifecycle.finalize()),
|
|
3585
3588
|
onCancel: () => this.exitAll(),
|
|
3586
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3589
|
+
onConversationOpen: () => this.transitionTo(new ft(this)),
|
|
3587
3590
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3588
3591
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3589
3592
|
resolveEmailCapture: () => this.buildEmailCapture(),
|
|
@@ -3611,7 +3614,7 @@ class tn {
|
|
|
3611
3614
|
buildMyFeedbackHandler() {
|
|
3612
3615
|
if (!this.config.user && _r())
|
|
3613
3616
|
return async () => {
|
|
3614
|
-
const t = await this.apiClient.createIdentityToken(
|
|
3617
|
+
const t = await this.apiClient.createIdentityToken(ye());
|
|
3615
3618
|
!t?.identity_token || !t.board_url || (L(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
|
|
3616
3619
|
};
|
|
3617
3620
|
}
|
|
@@ -3645,7 +3648,7 @@ class tn {
|
|
|
3645
3648
|
buildEmailCapture() {
|
|
3646
3649
|
if (this.config.user) return;
|
|
3647
3650
|
const { feedbackId: t, identityToken: e } = this.lastHandoff;
|
|
3648
|
-
if (!(!t || !e) && !
|
|
3651
|
+
if (!(!t || !e) && !xe())
|
|
3649
3652
|
return {
|
|
3650
3653
|
onSubmit: async (r) => {
|
|
3651
3654
|
const n = await this.apiClient.updateReporter(t, r, e);
|