makethisbetter 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -62
- package/README.md +4 -4
- package/dist/context/frustration.d.ts +1 -1
- package/dist/context/frustration.d.ts.map +1 -1
- package/dist/makethisbetter.cjs.js +13 -27
- package/dist/makethisbetter.cjs.js.map +1 -1
- package/dist/makethisbetter.esm.js +218 -248
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +16 -30
- package/dist/makethisbetter.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/widget/controller.d.ts +0 -1
- package/dist/widget/controller.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/context/frustration.test.ts +2 -3
- package/src/context/frustration.ts +0 -1
- package/src/types.ts +1 -1
- package/src/widget/controller.ts +7 -18
- package/src/widget/pet.test.ts +34 -32
|
@@ -33,45 +33,8 @@ class nt {
|
|
|
33
33
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
width: "3.5",
|
|
39
|
-
linecap: "round",
|
|
40
|
-
linejoin: "round",
|
|
41
|
-
filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
|
|
42
|
-
};
|
|
43
|
-
class ot {
|
|
44
|
-
constructor(t, e, s) {
|
|
45
|
-
this.onClick = s, this.el = t.el("div", "mtb-pet"), this.el.innerHTML = this.buildSVG(), this.el.setAttribute("role", "button"), this.el.setAttribute("aria-label", e.tab), this.el.tabIndex = 0, this.bubble = t.el("div", "mtb-pet-bubble"), this.bubble.textContent = e.pet.bubble, this.el.appendChild(this.bubble), this.el.addEventListener("click", this.onClick), this.el.addEventListener("keydown", (r) => {
|
|
46
|
-
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), this.onClick());
|
|
47
|
-
}), t.append(this.el);
|
|
48
|
-
}
|
|
49
|
-
buildSVG() {
|
|
50
|
-
return `<svg class="mtb-pet-svg" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
51
|
-
<circle cx="24" cy="28" r="16" fill="${x}"/>
|
|
52
|
-
<circle cx="24" cy="28" r="14" fill="#10b981"/>
|
|
53
|
-
<circle cx="19" cy="25" r="3" fill="#fff"/>
|
|
54
|
-
<circle cx="29" cy="25" r="3" fill="#fff"/>
|
|
55
|
-
<circle cx="20" cy="24.5" r="1.5" fill="#064e3b"/>
|
|
56
|
-
<circle cx="30" cy="24.5" r="1.5" fill="#064e3b"/>
|
|
57
|
-
<ellipse cx="19.5" cy="23.5" rx="0.8" ry="0.6" fill="#fff" opacity="0.7"/>
|
|
58
|
-
<ellipse cx="29.5" cy="23.5" rx="0.8" ry="0.6" fill="#fff" opacity="0.7"/>
|
|
59
|
-
<path d="M20 31 Q24 34 28 31" stroke="#064e3b" stroke-width="1.5" stroke-linecap="round" fill="none"/>
|
|
60
|
-
<circle cx="15" cy="30" r="2.5" fill="${x}" opacity="0.4"/>
|
|
61
|
-
<circle cx="33" cy="30" r="2.5" fill="${x}" opacity="0.4"/>
|
|
62
|
-
<path d="M14 17 Q16 12 20 15" stroke="#10b981" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
63
|
-
<path d="M34 17 Q32 12 28 15" stroke="#10b981" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
64
|
-
</svg>`;
|
|
65
|
-
}
|
|
66
|
-
setActive(t) {
|
|
67
|
-
this.el.classList.toggle("active", t), t && this.bubble.classList.add("hidden");
|
|
68
|
-
}
|
|
69
|
-
destroy() {
|
|
70
|
-
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const at = 8e3;
|
|
74
|
-
class lt {
|
|
36
|
+
const ot = 8e3;
|
|
37
|
+
class at {
|
|
75
38
|
constructor(t, e, s) {
|
|
76
39
|
this.el = t.el("div", "mtb-frustration-prompt"), this.el.innerHTML = `
|
|
77
40
|
<div class="mtb-frustration-icon">⚠️</div>
|
|
@@ -80,13 +43,13 @@ class lt {
|
|
|
80
43
|
<button class="mtb-frustration-tell">${e.frustration.action}</button>
|
|
81
44
|
<button class="mtb-frustration-dismiss">${e.frustration.dismiss}</button>
|
|
82
45
|
</div>
|
|
83
|
-
`, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", s.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", s.onDismiss), t.append(this.el), setTimeout(s.onDismiss,
|
|
46
|
+
`, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", s.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", s.onDismiss), t.append(this.el), setTimeout(s.onDismiss, ot);
|
|
84
47
|
}
|
|
85
48
|
destroy() {
|
|
86
49
|
this.el.remove();
|
|
87
50
|
}
|
|
88
51
|
}
|
|
89
|
-
class
|
|
52
|
+
class lt {
|
|
90
53
|
constructor(t, e, s, r) {
|
|
91
54
|
this.currentMode = "markup", this.messages = e, this.el = t.el("div", "mtb-toolbar"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.hintEl = this.el.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", () => {
|
|
92
55
|
this.setMode("markup"), r?.("markup");
|
|
@@ -123,7 +86,7 @@ class ct {
|
|
|
123
86
|
this.el.remove();
|
|
124
87
|
}
|
|
125
88
|
}
|
|
126
|
-
class
|
|
89
|
+
class ct {
|
|
127
90
|
constructor(t, e) {
|
|
128
91
|
this.onMouseDown = e.onMouseDown, this.onMouseMove = e.onMouseMove, this.onMouseUp = e.onMouseUp, this.onMouseLeave = e.onMouseLeave, this.overlayEl = t.el("div", "mtb-overlay"), this.overlayEl.addEventListener("mousedown", this.onMouseDown), this.overlayEl.addEventListener("mousemove", this.onMouseMove), this.overlayEl.addEventListener("mouseup", this.onMouseUp), this.overlayEl.addEventListener("mouseleave", this.onMouseLeave), t.append(this.overlayEl), this.dimEl = t.el("div", "mtb-dim"), t.append(this.dimEl);
|
|
129
92
|
}
|
|
@@ -131,7 +94,7 @@ class ht {
|
|
|
131
94
|
this.overlayEl.removeEventListener("mousedown", this.onMouseDown), this.overlayEl.removeEventListener("mousemove", this.onMouseMove), this.overlayEl.removeEventListener("mouseup", this.onMouseUp), this.overlayEl.removeEventListener("mouseleave", this.onMouseLeave), this.overlayEl.remove(), this.dimEl.remove();
|
|
132
95
|
}
|
|
133
96
|
}
|
|
134
|
-
class
|
|
97
|
+
class ht {
|
|
135
98
|
constructor(t) {
|
|
136
99
|
this.highlightEl = t.el("div", "mtb-highlight"), this.hide(), t.append(this.highlightEl);
|
|
137
100
|
}
|
|
@@ -146,7 +109,7 @@ class dt {
|
|
|
146
109
|
this.highlightEl.remove();
|
|
147
110
|
}
|
|
148
111
|
}
|
|
149
|
-
function
|
|
112
|
+
function dt(i) {
|
|
150
113
|
if (i instanceof HTMLElement) {
|
|
151
114
|
const t = i.getAttribute("aria-label");
|
|
152
115
|
if (t) return t;
|
|
@@ -163,7 +126,7 @@ function ut(i) {
|
|
|
163
126
|
}
|
|
164
127
|
return i.tagName.toLowerCase();
|
|
165
128
|
}
|
|
166
|
-
function
|
|
129
|
+
function ut(i) {
|
|
167
130
|
const t = [];
|
|
168
131
|
let e = i;
|
|
169
132
|
for (; e && e !== document.body && t.length < 5; ) {
|
|
@@ -188,7 +151,7 @@ function pt(i) {
|
|
|
188
151
|
}
|
|
189
152
|
return t.join(" > ");
|
|
190
153
|
}
|
|
191
|
-
class
|
|
154
|
+
class pt {
|
|
192
155
|
constructor(t) {
|
|
193
156
|
this.pins = [], this.shadow = t;
|
|
194
157
|
}
|
|
@@ -204,12 +167,19 @@ class ft {
|
|
|
204
167
|
this.clearAll();
|
|
205
168
|
}
|
|
206
169
|
}
|
|
207
|
-
|
|
170
|
+
const D = "#059669", x = {
|
|
171
|
+
color: D,
|
|
172
|
+
width: "3.5",
|
|
173
|
+
linecap: "round",
|
|
174
|
+
linejoin: "round",
|
|
175
|
+
filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
|
|
176
|
+
};
|
|
177
|
+
class ft {
|
|
208
178
|
constructor(t, e) {
|
|
209
179
|
this.path = null, this.points = [], this.isDrawing = !1, this.onDrawComplete = e, this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.svg.setAttribute("class", "mtb-draw-svg"), t.append(this.svg);
|
|
210
180
|
}
|
|
211
181
|
startDraw(t, e) {
|
|
212
|
-
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke",
|
|
182
|
+
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke", x.color), this.path.setAttribute("stroke-width", x.width), this.path.setAttribute("stroke-linecap", x.linecap), this.path.setAttribute("stroke-linejoin", x.linejoin), this.path.setAttribute("style", `filter:${x.filter}`), this.svg.appendChild(this.path);
|
|
213
183
|
}
|
|
214
184
|
continueDraw(t, e) {
|
|
215
185
|
!this.isDrawing || !this.path || (this.points.push([t, e]), this.path.setAttribute("d", this.buildPathD()));
|
|
@@ -259,12 +229,12 @@ class mt {
|
|
|
259
229
|
this.svg.remove();
|
|
260
230
|
}
|
|
261
231
|
}
|
|
262
|
-
const
|
|
232
|
+
const mt = 5;
|
|
263
233
|
class H {
|
|
264
234
|
constructor(t, e, s) {
|
|
265
|
-
this.messages = e, this.onReady = s, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new
|
|
235
|
+
this.messages = e, this.onReady = s, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new ht(t), this.pinMarker = new pt(t), this.drawLayer = new ft(t, (r) => {
|
|
266
236
|
this.onReady(r, this.messages.annotation.drawing);
|
|
267
|
-
}), this.overlay = new
|
|
237
|
+
}), this.overlay = new ct(t, {
|
|
268
238
|
onMouseDown: (r) => this.handleMouseDown(r),
|
|
269
239
|
onMouseMove: (r) => this.handleMouseMove(r),
|
|
270
240
|
onMouseUp: (r) => this.handleMouseUp(r),
|
|
@@ -295,16 +265,16 @@ class H {
|
|
|
295
265
|
}
|
|
296
266
|
handleMouseUp(t) {
|
|
297
267
|
if (!this.drawLayer.isCurrentlyDrawing()) return;
|
|
298
|
-
if (this.drawLayer.getPointCount() >=
|
|
268
|
+
if (this.drawLayer.getPointCount() >= mt) {
|
|
299
269
|
this.drawLayer.endDraw();
|
|
300
270
|
return;
|
|
301
271
|
}
|
|
302
272
|
this.drawLayer.cancelCurrentDraw();
|
|
303
|
-
const e = $(t.clientX, t.clientY), s = e ?
|
|
273
|
+
const e = $(t.clientX, t.clientY), s = e ? dt(e) : this.messages.annotation.element, r = {
|
|
304
274
|
type: "pin",
|
|
305
275
|
x: t.clientX,
|
|
306
276
|
y: t.clientY,
|
|
307
|
-
targetSelector: e ?
|
|
277
|
+
targetSelector: e ? ut(e) : void 0,
|
|
308
278
|
targetText: e?.textContent?.trim().slice(0, 200) ?? "",
|
|
309
279
|
targetName: s
|
|
310
280
|
};
|
|
@@ -320,7 +290,7 @@ class H {
|
|
|
320
290
|
function $(i, t) {
|
|
321
291
|
return document.elementsFromPoint(i, t).find((e) => e.id !== "mtb-widget-host") ?? null;
|
|
322
292
|
}
|
|
323
|
-
class
|
|
293
|
+
class bt {
|
|
324
294
|
constructor(t, e) {
|
|
325
295
|
this.loading = !1, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.el = t.el("div", "mtb-popup"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.textarea = this.el.querySelector(".mtb-textarea"), this.submitBtn = this.el.querySelector(".mtb-submit-btn"), this.positionPopup(e.x, e.y), this.bindEvents(e.messages), this.textarea.focus();
|
|
326
296
|
}
|
|
@@ -397,8 +367,8 @@ class gt {
|
|
|
397
367
|
function m(i) {
|
|
398
368
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
399
369
|
}
|
|
400
|
-
const
|
|
401
|
-
class
|
|
370
|
+
const gt = 2e3, yt = 2e3;
|
|
371
|
+
class xt {
|
|
402
372
|
constructor(t, e) {
|
|
403
373
|
this.pollTimer = null, this.doneTimer = null, this.sending = !1, this.destroyed = !1, this.feedbackId = e.feedbackId, this.apiClient = e.apiClient, this.onDone = e.onDone, this.el = t.el("div", "mtb-clarify"), this.el.style.right = "20px", this.el.style.bottom = "20px", this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.messagesEl = this.el.querySelector(".mtb-clarify-messages"), this.inputEl = this.el.querySelector(".mtb-clarify-input"), this.sendBtn = this.el.querySelector(".mtb-clarify-send"), this.bindEvents(e.messages), this.startConversation();
|
|
404
374
|
}
|
|
@@ -406,16 +376,16 @@ class wt {
|
|
|
406
376
|
return `
|
|
407
377
|
<div class="mtb-clarify-header">
|
|
408
378
|
<div class="mtb-clarify-icon">
|
|
409
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${
|
|
379
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${D}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
410
380
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
411
381
|
</svg>
|
|
412
382
|
</div>
|
|
413
|
-
<button class="mtb-clarify-skip">${
|
|
383
|
+
<button class="mtb-clarify-skip">${T(t.clarify.skip)}</button>
|
|
414
384
|
</div>
|
|
415
385
|
<div class="mtb-clarify-messages"></div>
|
|
416
386
|
<div class="mtb-clarify-footer">
|
|
417
|
-
<input class="mtb-clarify-input" type="text" placeholder="${
|
|
418
|
-
<button class="mtb-clarify-send" disabled>${
|
|
387
|
+
<input class="mtb-clarify-input" type="text" placeholder="${T(t.clarify.placeholder)}" />
|
|
388
|
+
<button class="mtb-clarify-send" disabled>${T(t.clarify.send)}</button>
|
|
419
389
|
</div>
|
|
420
390
|
`;
|
|
421
391
|
}
|
|
@@ -457,7 +427,7 @@ class wt {
|
|
|
457
427
|
}
|
|
458
428
|
}
|
|
459
429
|
startPolling() {
|
|
460
|
-
this.stopPolling(), this.pollTimer = setInterval(() => this.poll(),
|
|
430
|
+
this.stopPolling(), this.pollTimer = setInterval(() => this.poll(), gt);
|
|
461
431
|
}
|
|
462
432
|
stopPolling() {
|
|
463
433
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
@@ -475,7 +445,7 @@ class wt {
|
|
|
475
445
|
handleDone() {
|
|
476
446
|
this.inputEl.disabled = !0, this.sendBtn.disabled = !0, this.doneTimer = setTimeout(() => {
|
|
477
447
|
this.destroyed || this.onDone();
|
|
478
|
-
},
|
|
448
|
+
}, yt);
|
|
479
449
|
}
|
|
480
450
|
renderConversation(t, e) {
|
|
481
451
|
this.renderMessages(t);
|
|
@@ -500,17 +470,17 @@ class wt {
|
|
|
500
470
|
this.destroyed = !0, this.stopPolling(), this.doneTimer !== null && (clearTimeout(this.doneTimer), this.doneTimer = null), this.el.remove();
|
|
501
471
|
}
|
|
502
472
|
}
|
|
503
|
-
function
|
|
473
|
+
function T(i) {
|
|
504
474
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
505
475
|
}
|
|
506
|
-
const
|
|
507
|
-
class
|
|
476
|
+
const wt = 5e3;
|
|
477
|
+
class kt {
|
|
508
478
|
constructor(t, e, s, r) {
|
|
509
479
|
this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
|
|
510
480
|
const n = r ? `<button class="mtb-view-feedback-link">${e.success.view_feedback}</button>` : "";
|
|
511
481
|
this.el.innerHTML = `
|
|
512
482
|
<div class="mtb-success-icon">
|
|
513
|
-
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${
|
|
483
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${D}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
514
484
|
<polyline points="20 6 9 17 4 12"/>
|
|
515
485
|
</svg>
|
|
516
486
|
</div>
|
|
@@ -518,13 +488,13 @@ class vt {
|
|
|
518
488
|
<div class="mtb-success-msg">${e.success.message}</div>
|
|
519
489
|
${n}
|
|
520
490
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
521
|
-
`, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", s), r && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", r), setTimeout(() => s(),
|
|
491
|
+
`, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", s), r && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", r), setTimeout(() => s(), wt);
|
|
522
492
|
}
|
|
523
493
|
destroy() {
|
|
524
494
|
this.el.remove();
|
|
525
495
|
}
|
|
526
496
|
}
|
|
527
|
-
function
|
|
497
|
+
function vt(i, t) {
|
|
528
498
|
if (i.match(/^[a-z]+:\/\//i))
|
|
529
499
|
return i;
|
|
530
500
|
if (i.match(/^\/\//))
|
|
@@ -556,19 +526,19 @@ function S(i, t) {
|
|
|
556
526
|
const s = (i.ownerDocument.defaultView || window).getComputedStyle(i).getPropertyValue(t);
|
|
557
527
|
return s ? parseFloat(s.replace("px", "")) : 0;
|
|
558
528
|
}
|
|
559
|
-
function
|
|
529
|
+
function Et(i) {
|
|
560
530
|
const t = S(i, "border-left-width"), e = S(i, "border-right-width");
|
|
561
531
|
return i.clientWidth + t + e;
|
|
562
532
|
}
|
|
563
|
-
function
|
|
533
|
+
function Ct(i) {
|
|
564
534
|
const t = S(i, "border-top-width"), e = S(i, "border-bottom-width");
|
|
565
535
|
return i.clientHeight + t + e;
|
|
566
536
|
}
|
|
567
537
|
function Y(i, t = {}) {
|
|
568
|
-
const e = t.width ||
|
|
538
|
+
const e = t.width || Et(i), s = t.height || Ct(i);
|
|
569
539
|
return { width: e, height: s };
|
|
570
540
|
}
|
|
571
|
-
function
|
|
541
|
+
function Mt() {
|
|
572
542
|
let i, t;
|
|
573
543
|
try {
|
|
574
544
|
t = process;
|
|
@@ -578,10 +548,10 @@ function Tt() {
|
|
|
578
548
|
return e && (i = parseInt(e, 10), Number.isNaN(i) && (i = 1)), i || window.devicePixelRatio || 1;
|
|
579
549
|
}
|
|
580
550
|
const d = 16384;
|
|
581
|
-
function
|
|
551
|
+
function Tt(i) {
|
|
582
552
|
(i.width > d || i.height > d) && (i.width > d && i.height > d ? i.width > i.height ? (i.height *= d / i.width, i.width = d) : (i.width *= d / i.height, i.height = d) : i.width > d ? (i.height *= d / i.width, i.width = d) : (i.width *= d / i.height, i.height = d));
|
|
583
553
|
}
|
|
584
|
-
function
|
|
554
|
+
function E(i) {
|
|
585
555
|
return new Promise((t, e) => {
|
|
586
556
|
const s = new Image();
|
|
587
557
|
s.onload = () => {
|
|
@@ -591,12 +561,12 @@ function C(i) {
|
|
|
591
561
|
}, s.onerror = e, s.crossOrigin = "anonymous", s.decoding = "async", s.src = i;
|
|
592
562
|
});
|
|
593
563
|
}
|
|
594
|
-
async function
|
|
564
|
+
async function Lt(i) {
|
|
595
565
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
596
566
|
}
|
|
597
|
-
async function
|
|
567
|
+
async function At(i, t, e) {
|
|
598
568
|
const s = "http://www.w3.org/2000/svg", r = document.createElementNS(s, "svg"), n = document.createElementNS(s, "foreignObject");
|
|
599
|
-
return r.setAttribute("width", `${t}`), r.setAttribute("height", `${e}`), r.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), r.appendChild(n), n.appendChild(i),
|
|
569
|
+
return r.setAttribute("width", `${t}`), r.setAttribute("height", `${e}`), r.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), r.appendChild(n), n.appendChild(i), Lt(r);
|
|
600
570
|
}
|
|
601
571
|
const h = (i, t) => {
|
|
602
572
|
if (i instanceof t)
|
|
@@ -604,18 +574,18 @@ const h = (i, t) => {
|
|
|
604
574
|
const e = Object.getPrototypeOf(i);
|
|
605
575
|
return e === null ? !1 : e.constructor.name === t.name || h(e, t);
|
|
606
576
|
};
|
|
607
|
-
function
|
|
577
|
+
function Rt(i) {
|
|
608
578
|
const t = i.getPropertyValue("content");
|
|
609
579
|
return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
610
580
|
}
|
|
611
|
-
function
|
|
581
|
+
function Dt(i, t) {
|
|
612
582
|
return V(t).map((e) => {
|
|
613
583
|
const s = i.getPropertyValue(e), r = i.getPropertyPriority(e);
|
|
614
584
|
return `${e}: ${s}${r ? " !important" : ""};`;
|
|
615
585
|
}).join(" ");
|
|
616
586
|
}
|
|
617
|
-
function
|
|
618
|
-
const r = `.${i}:${t}`, n = e.cssText ?
|
|
587
|
+
function Pt(i, t, e, s) {
|
|
588
|
+
const r = `.${i}:${t}`, n = e.cssText ? Rt(e) : Dt(e, s);
|
|
619
589
|
return document.createTextNode(`${r}{${n}}`);
|
|
620
590
|
}
|
|
621
591
|
function I(i, t, e, s) {
|
|
@@ -629,12 +599,12 @@ function I(i, t, e, s) {
|
|
|
629
599
|
return;
|
|
630
600
|
}
|
|
631
601
|
const a = document.createElement("style");
|
|
632
|
-
a.appendChild(
|
|
602
|
+
a.appendChild(Pt(o, e, r, s)), t.appendChild(a);
|
|
633
603
|
}
|
|
634
|
-
function
|
|
604
|
+
function _t(i, t, e) {
|
|
635
605
|
I(i, t, ":before", e), I(i, t, ":after", e);
|
|
636
606
|
}
|
|
637
|
-
const O = "application/font-woff", F = "image/jpeg",
|
|
607
|
+
const O = "application/font-woff", F = "image/jpeg", Ht = {
|
|
638
608
|
woff: O,
|
|
639
609
|
woff2: O,
|
|
640
610
|
ttf: "application/font-truetype",
|
|
@@ -647,21 +617,21 @@ const O = "application/font-woff", F = "image/jpeg", $t = {
|
|
|
647
617
|
svg: "image/svg+xml",
|
|
648
618
|
webp: "image/webp"
|
|
649
619
|
};
|
|
650
|
-
function
|
|
620
|
+
function $t(i) {
|
|
651
621
|
const t = /\.([^./]*?)$/g.exec(i);
|
|
652
622
|
return t ? t[1] : "";
|
|
653
623
|
}
|
|
654
|
-
function
|
|
655
|
-
const t =
|
|
656
|
-
return
|
|
624
|
+
function P(i) {
|
|
625
|
+
const t = $t(i).toLowerCase();
|
|
626
|
+
return Ht[t] || "";
|
|
657
627
|
}
|
|
658
|
-
function
|
|
628
|
+
function It(i) {
|
|
659
629
|
return i.split(/,/)[1];
|
|
660
630
|
}
|
|
661
|
-
function
|
|
631
|
+
function A(i) {
|
|
662
632
|
return i.search(/^(data:)/) !== -1;
|
|
663
633
|
}
|
|
664
|
-
function
|
|
634
|
+
function Ot(i, t) {
|
|
665
635
|
return `data:${t};base64,${i}`;
|
|
666
636
|
}
|
|
667
637
|
async function X(i, t, e) {
|
|
@@ -680,64 +650,64 @@ async function X(i, t, e) {
|
|
|
680
650
|
}, a.readAsDataURL(r);
|
|
681
651
|
});
|
|
682
652
|
}
|
|
683
|
-
const
|
|
684
|
-
function
|
|
653
|
+
const L = {};
|
|
654
|
+
function Ft(i, t, e) {
|
|
685
655
|
let s = i.replace(/\?.*/, "");
|
|
686
656
|
return e && (s = i), /ttf|otf|eot|woff2?/i.test(s) && (s = s.replace(/.*\//, "")), t ? `[${t}]${s}` : s;
|
|
687
657
|
}
|
|
688
658
|
async function _(i, t, e) {
|
|
689
|
-
const s =
|
|
690
|
-
if (
|
|
691
|
-
return
|
|
659
|
+
const s = Ft(i, t, e.includeQueryParams);
|
|
660
|
+
if (L[s] != null)
|
|
661
|
+
return L[s];
|
|
692
662
|
e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
693
663
|
let r;
|
|
694
664
|
try {
|
|
695
|
-
const n = await X(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""),
|
|
696
|
-
r =
|
|
665
|
+
const n = await X(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), It(a)));
|
|
666
|
+
r = Ot(n, t);
|
|
697
667
|
} catch (n) {
|
|
698
668
|
r = e.imagePlaceholder || "";
|
|
699
669
|
let o = `Failed to fetch resource: ${i}`;
|
|
700
670
|
n && (o = typeof n == "string" ? n : n.message), o && console.warn(o);
|
|
701
671
|
}
|
|
702
|
-
return
|
|
672
|
+
return L[s] = r, r;
|
|
703
673
|
}
|
|
704
|
-
async function
|
|
674
|
+
async function jt(i) {
|
|
705
675
|
const t = i.toDataURL();
|
|
706
|
-
return t === "data:," ? i.cloneNode(!1) :
|
|
676
|
+
return t === "data:," ? i.cloneNode(!1) : E(t);
|
|
707
677
|
}
|
|
708
|
-
async function
|
|
678
|
+
async function Ut(i, t) {
|
|
709
679
|
if (i.currentSrc) {
|
|
710
680
|
const n = document.createElement("canvas"), o = n.getContext("2d");
|
|
711
681
|
n.width = i.clientWidth, n.height = i.clientHeight, o?.drawImage(i, 0, 0, n.width, n.height);
|
|
712
682
|
const a = n.toDataURL();
|
|
713
|
-
return
|
|
683
|
+
return E(a);
|
|
714
684
|
}
|
|
715
|
-
const e = i.poster, s =
|
|
716
|
-
return
|
|
685
|
+
const e = i.poster, s = P(e), r = await _(e, s, t);
|
|
686
|
+
return E(r);
|
|
717
687
|
}
|
|
718
|
-
async function
|
|
688
|
+
async function zt(i, t) {
|
|
719
689
|
var e;
|
|
720
690
|
try {
|
|
721
691
|
if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
|
|
722
|
-
return await
|
|
692
|
+
return await C(i.contentDocument.body, t, !0);
|
|
723
693
|
} catch {
|
|
724
694
|
}
|
|
725
695
|
return i.cloneNode(!1);
|
|
726
696
|
}
|
|
727
|
-
async function
|
|
728
|
-
return h(i, HTMLCanvasElement) ?
|
|
697
|
+
async function Bt(i, t) {
|
|
698
|
+
return h(i, HTMLCanvasElement) ? jt(i) : h(i, HTMLVideoElement) ? Ut(i, t) : h(i, HTMLIFrameElement) ? zt(i, t) : i.cloneNode(G(i));
|
|
729
699
|
}
|
|
730
|
-
const
|
|
731
|
-
async function
|
|
700
|
+
const qt = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", G = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
|
|
701
|
+
async function Wt(i, t, e) {
|
|
732
702
|
var s, r;
|
|
733
703
|
if (G(t))
|
|
734
704
|
return t;
|
|
735
705
|
let n = [];
|
|
736
|
-
return
|
|
706
|
+
return qt(i) && i.assignedNodes ? n = p(i.assignedNodes()) : h(i, HTMLIFrameElement) && (!((s = i.contentDocument) === null || s === void 0) && s.body) ? n = p(i.contentDocument.body.childNodes) : n = p(((r = i.shadowRoot) !== null && r !== void 0 ? r : i).childNodes), n.length === 0 || h(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() => C(a, e)).then((l) => {
|
|
737
707
|
l && t.appendChild(l);
|
|
738
708
|
}), Promise.resolve()), t;
|
|
739
709
|
}
|
|
740
|
-
function
|
|
710
|
+
function Nt(i, t, e) {
|
|
741
711
|
const s = t.style;
|
|
742
712
|
if (!s)
|
|
743
713
|
return;
|
|
@@ -747,19 +717,19 @@ function Vt(i, t, e) {
|
|
|
747
717
|
n === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), h(i, HTMLIFrameElement) && n === "display" && o === "inline" && (o = "block"), n === "d" && t.getAttribute("d") && (o = `path(${t.getAttribute("d")})`), s.setProperty(n, o, r.getPropertyPriority(n));
|
|
748
718
|
});
|
|
749
719
|
}
|
|
750
|
-
function
|
|
720
|
+
function Vt(i, t) {
|
|
751
721
|
h(i, HTMLTextAreaElement) && (t.innerHTML = i.value), h(i, HTMLInputElement) && t.setAttribute("value", i.value);
|
|
752
722
|
}
|
|
753
|
-
function
|
|
723
|
+
function Yt(i, t) {
|
|
754
724
|
if (h(i, HTMLSelectElement)) {
|
|
755
725
|
const e = t, s = Array.from(e.children).find((r) => i.value === r.getAttribute("value"));
|
|
756
726
|
s && s.setAttribute("selected", "");
|
|
757
727
|
}
|
|
758
728
|
}
|
|
759
|
-
function
|
|
760
|
-
return h(t, Element) && (
|
|
729
|
+
function Xt(i, t, e) {
|
|
730
|
+
return h(t, Element) && (Nt(i, t, e), _t(i, t, e), Vt(i, t), Yt(i, t)), t;
|
|
761
731
|
}
|
|
762
|
-
async function
|
|
732
|
+
async function Gt(i, t) {
|
|
763
733
|
const e = i.querySelectorAll ? i.querySelectorAll("use") : [];
|
|
764
734
|
if (e.length === 0)
|
|
765
735
|
return i;
|
|
@@ -768,7 +738,7 @@ async function Kt(i, t) {
|
|
|
768
738
|
const a = e[n].getAttribute("xlink:href");
|
|
769
739
|
if (a) {
|
|
770
740
|
const l = i.querySelector(a), c = document.querySelector(a);
|
|
771
|
-
!l && c && !s[a] && (s[a] = await
|
|
741
|
+
!l && c && !s[a] && (s[a] = await C(c, t, !0));
|
|
772
742
|
}
|
|
773
743
|
}
|
|
774
744
|
const r = Object.values(s);
|
|
@@ -783,31 +753,31 @@ async function Kt(i, t) {
|
|
|
783
753
|
}
|
|
784
754
|
return i;
|
|
785
755
|
}
|
|
786
|
-
async function
|
|
787
|
-
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((s) =>
|
|
756
|
+
async function C(i, t, e) {
|
|
757
|
+
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((s) => Bt(s, t)).then((s) => Wt(i, s, t)).then((s) => Xt(i, s, t)).then((s) => Gt(s, t));
|
|
788
758
|
}
|
|
789
|
-
const K = /url\((['"]?)([^'"]+?)\1\)/g,
|
|
790
|
-
function
|
|
759
|
+
const K = /url\((['"]?)([^'"]+?)\1\)/g, Kt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Jt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
760
|
+
function Qt(i) {
|
|
791
761
|
const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
792
762
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
793
763
|
}
|
|
794
|
-
function
|
|
764
|
+
function Zt(i) {
|
|
795
765
|
const t = [];
|
|
796
|
-
return i.replace(K, (e, s, r) => (t.push(r), e)), t.filter((e) => !
|
|
766
|
+
return i.replace(K, (e, s, r) => (t.push(r), e)), t.filter((e) => !A(e));
|
|
797
767
|
}
|
|
798
|
-
async function
|
|
768
|
+
async function te(i, t, e, s, r) {
|
|
799
769
|
try {
|
|
800
|
-
const n = e ?
|
|
770
|
+
const n = e ? vt(t, e) : t, o = P(t);
|
|
801
771
|
let a;
|
|
802
|
-
return r || (a = await _(n, o, s)), i.replace(
|
|
772
|
+
return r || (a = await _(n, o, s)), i.replace(Qt(t), `$1${a}$3`);
|
|
803
773
|
} catch {
|
|
804
774
|
}
|
|
805
775
|
return i;
|
|
806
776
|
}
|
|
807
|
-
function
|
|
808
|
-
return t ? i.replace(
|
|
777
|
+
function ee(i, { preferredFontFormat: t }) {
|
|
778
|
+
return t ? i.replace(Jt, (e) => {
|
|
809
779
|
for (; ; ) {
|
|
810
|
-
const [s, , r] =
|
|
780
|
+
const [s, , r] = Kt.exec(e) || [];
|
|
811
781
|
if (!r)
|
|
812
782
|
return "";
|
|
813
783
|
if (r === t)
|
|
@@ -821,8 +791,8 @@ function J(i) {
|
|
|
821
791
|
async function Q(i, t, e) {
|
|
822
792
|
if (!J(i))
|
|
823
793
|
return i;
|
|
824
|
-
const s =
|
|
825
|
-
return
|
|
794
|
+
const s = ee(i, e);
|
|
795
|
+
return Zt(s).reduce((n, o) => n.then((a) => te(a, o, t, e)), Promise.resolve(s));
|
|
826
796
|
}
|
|
827
797
|
async function g(i, t, e) {
|
|
828
798
|
var s;
|
|
@@ -833,14 +803,14 @@ async function g(i, t, e) {
|
|
|
833
803
|
}
|
|
834
804
|
return !1;
|
|
835
805
|
}
|
|
836
|
-
async function
|
|
806
|
+
async function ie(i, t) {
|
|
837
807
|
await g("background", i, t) || await g("background-image", i, t), await g("mask", i, t) || await g("-webkit-mask", i, t) || await g("mask-image", i, t) || await g("-webkit-mask-image", i, t);
|
|
838
808
|
}
|
|
839
|
-
async function
|
|
809
|
+
async function se(i, t) {
|
|
840
810
|
const e = h(i, HTMLImageElement);
|
|
841
|
-
if (!(e && !
|
|
811
|
+
if (!(e && !A(i.src)) && !(h(i, SVGImageElement) && !A(i.href.baseVal)))
|
|
842
812
|
return;
|
|
843
|
-
const s = e ? i.src : i.href.baseVal, r = await _(s,
|
|
813
|
+
const s = e ? i.src : i.href.baseVal, r = await _(s, P(s), t);
|
|
844
814
|
await new Promise((n, o) => {
|
|
845
815
|
i.onload = n, i.onerror = t.onImageErrorHandler ? (...l) => {
|
|
846
816
|
try {
|
|
@@ -853,14 +823,14 @@ async function re(i, t) {
|
|
|
853
823
|
a.decode && (a.decode = n), a.loading === "lazy" && (a.loading = "eager"), e ? (i.srcset = "", i.src = r) : i.href.baseVal = r;
|
|
854
824
|
});
|
|
855
825
|
}
|
|
856
|
-
async function
|
|
826
|
+
async function re(i, t) {
|
|
857
827
|
const s = p(i.childNodes).map((r) => Z(r, t));
|
|
858
828
|
await Promise.all(s).then(() => i);
|
|
859
829
|
}
|
|
860
830
|
async function Z(i, t) {
|
|
861
|
-
h(i, Element) && (await
|
|
831
|
+
h(i, Element) && (await ie(i, t), await se(i, t), await re(i, t));
|
|
862
832
|
}
|
|
863
|
-
function
|
|
833
|
+
function ne(i, t) {
|
|
864
834
|
const { style: e } = i;
|
|
865
835
|
t.backgroundColor && (e.backgroundColor = t.backgroundColor), t.width && (e.width = `${t.width}px`), t.height && (e.height = `${t.height}px`);
|
|
866
836
|
const s = t.style;
|
|
@@ -910,7 +880,7 @@ function B(i) {
|
|
|
910
880
|
}
|
|
911
881
|
return t;
|
|
912
882
|
}
|
|
913
|
-
async function
|
|
883
|
+
async function oe(i, t) {
|
|
914
884
|
const e = [], s = [];
|
|
915
885
|
return i.forEach((r) => {
|
|
916
886
|
if ("cssRules" in r)
|
|
@@ -918,12 +888,12 @@ async function ae(i, t) {
|
|
|
918
888
|
p(r.cssRules || []).forEach((n, o) => {
|
|
919
889
|
if (n.type === CSSRule.IMPORT_RULE) {
|
|
920
890
|
let a = o + 1;
|
|
921
|
-
const l = n.href, c = U(l).then((u) => z(u, t)).then((u) => B(u).forEach((
|
|
891
|
+
const l = n.href, c = U(l).then((u) => z(u, t)).then((u) => B(u).forEach((M) => {
|
|
922
892
|
try {
|
|
923
|
-
r.insertRule(
|
|
893
|
+
r.insertRule(M, M.startsWith("@import") ? a += 1 : r.cssRules.length);
|
|
924
894
|
} catch (it) {
|
|
925
895
|
console.error("Error inserting rule from remote css", {
|
|
926
|
-
rule:
|
|
896
|
+
rule: M,
|
|
927
897
|
error: it
|
|
928
898
|
});
|
|
929
899
|
}
|
|
@@ -952,19 +922,19 @@ async function ae(i, t) {
|
|
|
952
922
|
}
|
|
953
923
|
}), e));
|
|
954
924
|
}
|
|
955
|
-
function
|
|
925
|
+
function ae(i) {
|
|
956
926
|
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => J(t.style.getPropertyValue("src")));
|
|
957
927
|
}
|
|
958
|
-
async function
|
|
928
|
+
async function le(i, t) {
|
|
959
929
|
if (i.ownerDocument == null)
|
|
960
930
|
throw new Error("Provided element is not within a Document");
|
|
961
|
-
const e = p(i.ownerDocument.styleSheets), s = await
|
|
962
|
-
return
|
|
931
|
+
const e = p(i.ownerDocument.styleSheets), s = await oe(e, t);
|
|
932
|
+
return ae(s);
|
|
963
933
|
}
|
|
964
934
|
function tt(i) {
|
|
965
935
|
return i.trim().replace(/["']/g, "");
|
|
966
936
|
}
|
|
967
|
-
function
|
|
937
|
+
function ce(i) {
|
|
968
938
|
const t = /* @__PURE__ */ new Set();
|
|
969
939
|
function e(s) {
|
|
970
940
|
(s.style.fontFamily || getComputedStyle(s).fontFamily).split(",").forEach((n) => {
|
|
@@ -975,56 +945,56 @@ function he(i) {
|
|
|
975
945
|
}
|
|
976
946
|
return e(i), t;
|
|
977
947
|
}
|
|
978
|
-
async function
|
|
979
|
-
const e = await
|
|
948
|
+
async function he(i, t) {
|
|
949
|
+
const e = await le(i, t), s = ce(i);
|
|
980
950
|
return (await Promise.all(e.filter((n) => s.has(tt(n.style.fontFamily))).map((n) => {
|
|
981
951
|
const o = n.parentStyleSheet ? n.parentStyleSheet.href : null;
|
|
982
952
|
return Q(n.cssText, o, t);
|
|
983
953
|
}))).join(`
|
|
984
954
|
`);
|
|
985
955
|
}
|
|
986
|
-
async function
|
|
987
|
-
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await
|
|
956
|
+
async function de(i, t) {
|
|
957
|
+
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await he(i, t);
|
|
988
958
|
if (e) {
|
|
989
959
|
const s = document.createElement("style"), r = document.createTextNode(e);
|
|
990
960
|
s.appendChild(r), i.firstChild ? i.insertBefore(s, i.firstChild) : i.appendChild(s);
|
|
991
961
|
}
|
|
992
962
|
}
|
|
963
|
+
async function ue(i, t = {}) {
|
|
964
|
+
const { width: e, height: s } = Y(i, t), r = await C(i, t, !0);
|
|
965
|
+
return await de(r, t), await Z(r, t), ne(r, t), await At(r, e, s);
|
|
966
|
+
}
|
|
993
967
|
async function pe(i, t = {}) {
|
|
994
|
-
const { width: e, height: s } = Y(i, t), r = await
|
|
995
|
-
return
|
|
968
|
+
const { width: e, height: s } = Y(i, t), r = await ue(i, t), n = await E(r), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || Mt(), c = t.canvasWidth || e, u = t.canvasHeight || s;
|
|
969
|
+
return o.width = c * l, o.height = u * l, t.skipAutoScale || Tt(o), o.style.width = `${c}`, o.style.height = `${u}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(n, 0, 0, o.width, o.height), o;
|
|
996
970
|
}
|
|
997
971
|
async function fe(i, t = {}) {
|
|
998
|
-
|
|
999
|
-
return o.width = c * l, o.height = u * l, t.skipAutoScale || Lt(o), o.style.width = `${c}`, o.style.height = `${u}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(n, 0, 0, o.width, o.height), o;
|
|
972
|
+
return (await pe(i, t)).toDataURL();
|
|
1000
973
|
}
|
|
1001
|
-
async function me(i
|
|
1002
|
-
|
|
1003
|
-
}
|
|
1004
|
-
async function be(i = []) {
|
|
1005
|
-
const t = ge(i);
|
|
974
|
+
async function me(i = []) {
|
|
975
|
+
const t = be(i);
|
|
1006
976
|
try {
|
|
1007
|
-
const e = await
|
|
977
|
+
const e = await fe(document.body, {
|
|
1008
978
|
cacheBust: !0,
|
|
1009
979
|
skipAutoScale: !1,
|
|
1010
980
|
filter: (s) => !(s instanceof HTMLElement && s.id === "mtb-widget-host")
|
|
1011
981
|
});
|
|
1012
|
-
return
|
|
982
|
+
return xe(e);
|
|
1013
983
|
} catch {
|
|
1014
984
|
return null;
|
|
1015
985
|
} finally {
|
|
1016
986
|
t?.remove();
|
|
1017
987
|
}
|
|
1018
988
|
}
|
|
1019
|
-
function
|
|
989
|
+
function be(i) {
|
|
1020
990
|
if (i.length === 0) return null;
|
|
1021
991
|
const t = document.createElement("div");
|
|
1022
992
|
t.setAttribute("data-mtb-capture-annotations", "true"), t.setAttribute("aria-hidden", "true"), t.style.cssText = "position:fixed;inset:0;pointer-events:none;z-index:2147483645;";
|
|
1023
993
|
for (const [e, s] of i.entries())
|
|
1024
|
-
s.type === "pin" ? t.appendChild(
|
|
994
|
+
s.type === "pin" ? t.appendChild(ge(s, e + 1)) : s.type === "draw" && s.drawPath && t.appendChild(ye(s.drawPath));
|
|
1025
995
|
return document.body.appendChild(t), t;
|
|
1026
996
|
}
|
|
1027
|
-
function
|
|
997
|
+
function ge(i, t) {
|
|
1028
998
|
const e = document.createElement("div");
|
|
1029
999
|
return e.textContent = String(t), e.style.cssText = [
|
|
1030
1000
|
"position:fixed",
|
|
@@ -1044,19 +1014,19 @@ function ye(i, t) {
|
|
|
1044
1014
|
"transform:translate(-50%,-50%)"
|
|
1045
1015
|
].join(";"), e;
|
|
1046
1016
|
}
|
|
1047
|
-
function
|
|
1017
|
+
function ye(i) {
|
|
1048
1018
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1049
1019
|
t.setAttribute("width", "100%"), t.setAttribute("height", "100%"), t.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`), t.style.cssText = "position:fixed;inset:0;width:100%;height:100%;overflow:visible;";
|
|
1050
1020
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1051
1021
|
return e.setAttribute("d", i), e.setAttribute("fill", "none"), e.setAttribute("stroke", "#059669"), e.setAttribute("stroke-width", "3.5"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round"), e.setAttribute("filter", "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"), t.appendChild(e), t;
|
|
1052
1022
|
}
|
|
1053
|
-
function
|
|
1023
|
+
function xe(i) {
|
|
1054
1024
|
const [t, e] = i.split(","), s = t.match(/:(.*?);/)?.[1] ?? "image/png", r = atob(e), n = new Uint8Array(r.length);
|
|
1055
1025
|
for (let o = 0; o < r.length; o++)
|
|
1056
1026
|
n[o] = r.charCodeAt(o);
|
|
1057
1027
|
return new Blob([n], { type: s });
|
|
1058
1028
|
}
|
|
1059
|
-
class
|
|
1029
|
+
class we {
|
|
1060
1030
|
constructor() {
|
|
1061
1031
|
this.listeners = /* @__PURE__ */ new Set(), this.originalOnError = null, this.installedOnError = null, this.rejectionHandler = null, this.hooked = !1;
|
|
1062
1032
|
}
|
|
@@ -1078,8 +1048,8 @@ class ke {
|
|
|
1078
1048
|
for (const e of this.listeners) e(t);
|
|
1079
1049
|
}
|
|
1080
1050
|
}
|
|
1081
|
-
const et = new
|
|
1082
|
-
class
|
|
1051
|
+
const et = new we(), ke = 20;
|
|
1052
|
+
class ve {
|
|
1083
1053
|
constructor() {
|
|
1084
1054
|
this.errors = [], this.unsubscribe = null;
|
|
1085
1055
|
}
|
|
@@ -1091,7 +1061,7 @@ class Ee {
|
|
|
1091
1061
|
this.addError(`${t.message}${e}`);
|
|
1092
1062
|
}
|
|
1093
1063
|
addError(t) {
|
|
1094
|
-
this.errors.length >=
|
|
1064
|
+
this.errors.length >= ke || this.errors.includes(t) || this.errors.push(t);
|
|
1095
1065
|
}
|
|
1096
1066
|
getErrors() {
|
|
1097
1067
|
return [...this.errors];
|
|
@@ -1100,7 +1070,7 @@ class Ee {
|
|
|
1100
1070
|
this.unsubscribe?.(), this.unsubscribe = null;
|
|
1101
1071
|
}
|
|
1102
1072
|
}
|
|
1103
|
-
const Se = 3,
|
|
1073
|
+
const Se = 3, Ee = 1e3, Ce = 3, Me = 5e3, Te = 500, Le = 500, Ae = 300, Re = /* @__PURE__ */ new Set([
|
|
1104
1074
|
"A",
|
|
1105
1075
|
"BUTTON",
|
|
1106
1076
|
"INPUT",
|
|
@@ -1109,7 +1079,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1109
1079
|
"LABEL",
|
|
1110
1080
|
"SUMMARY",
|
|
1111
1081
|
"DETAILS"
|
|
1112
|
-
]),
|
|
1082
|
+
]), De = /* @__PURE__ */ new Set([
|
|
1113
1083
|
"button",
|
|
1114
1084
|
"link",
|
|
1115
1085
|
"checkbox",
|
|
@@ -1130,7 +1100,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1130
1100
|
"page not found",
|
|
1131
1101
|
"server error",
|
|
1132
1102
|
"internal server error"
|
|
1133
|
-
],
|
|
1103
|
+
], k = class k {
|
|
1134
1104
|
constructor(t) {
|
|
1135
1105
|
this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.errorCount = 0, this.deadClickCount = 0, this.cooldownUntil = 0, this.navTimestamps = [], this.boundPopstateHandler = null, this.originalPushState = null, this.originalReplaceState = null, this.installedPushState = null, this.installedReplaceState = null, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
|
|
1136
1106
|
}
|
|
@@ -1165,7 +1135,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1165
1135
|
if (!e || this.isWidgetElement(e)) return;
|
|
1166
1136
|
const s = Date.now();
|
|
1167
1137
|
this.clickHistory.push({ target: e, time: s });
|
|
1168
|
-
const r = s -
|
|
1138
|
+
const r = s - Ee;
|
|
1169
1139
|
if (this.clickHistory = this.clickHistory.filter((o) => o.time > r), this.clickHistory.filter((o) => o.target === e).length >= Se) {
|
|
1170
1140
|
this.clickHistory = [], this.emitHighPriority({
|
|
1171
1141
|
signal: "rage_click",
|
|
@@ -1183,13 +1153,13 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1183
1153
|
handleNavigation() {
|
|
1184
1154
|
const t = Date.now();
|
|
1185
1155
|
this.navTimestamps.push(t);
|
|
1186
|
-
const e = t -
|
|
1187
|
-
this.navTimestamps = this.navTimestamps.filter((s) => s > e), this.navTimestamps.length >=
|
|
1156
|
+
const e = t - Me;
|
|
1157
|
+
this.navTimestamps = this.navTimestamps.filter((s) => s > e), this.navTimestamps.length >= Ce && (this.navTimestamps = [], this.emitIfReady({
|
|
1188
1158
|
signal: "rapid_navigation",
|
|
1189
1159
|
timestamp: t
|
|
1190
1160
|
})), setTimeout(() => {
|
|
1191
1161
|
this.active && this.checkErrorPage();
|
|
1192
|
-
},
|
|
1162
|
+
}, Ae);
|
|
1193
1163
|
}
|
|
1194
1164
|
handleFormSubmit(t) {
|
|
1195
1165
|
const e = t.target;
|
|
@@ -1199,7 +1169,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1199
1169
|
target: y(e),
|
|
1200
1170
|
timestamp: Date.now()
|
|
1201
1171
|
});
|
|
1202
|
-
},
|
|
1172
|
+
}, Te));
|
|
1203
1173
|
}
|
|
1204
1174
|
handleFormInvalid(t) {
|
|
1205
1175
|
const e = t.target;
|
|
@@ -1250,7 +1220,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1250
1220
|
target: y(t),
|
|
1251
1221
|
timestamp: e
|
|
1252
1222
|
});
|
|
1253
|
-
},
|
|
1223
|
+
}, Le));
|
|
1254
1224
|
}
|
|
1255
1225
|
ensureDomObserver() {
|
|
1256
1226
|
this.domObserver || (this.domObserver = new MutationObserver(() => {
|
|
@@ -1275,9 +1245,9 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1275
1245
|
return !1;
|
|
1276
1246
|
}
|
|
1277
1247
|
isInteractive(t) {
|
|
1278
|
-
if (
|
|
1248
|
+
if (Re.has(t.tagName)) return !0;
|
|
1279
1249
|
const e = t.getAttribute("role");
|
|
1280
|
-
return !!(e &&
|
|
1250
|
+
return !!(e && De.has(e) || t.hasAttribute("onclick") || t.hasAttribute("tabindex") || t.contentEditable === "true" || window.getComputedStyle(t).cursor === "pointer" || t.closest('a, button, [role="button"], [role="link"], label'));
|
|
1281
1251
|
}
|
|
1282
1252
|
isWidgetElement(t) {
|
|
1283
1253
|
const e = document.getElementById("mtb-widget-host");
|
|
@@ -1285,40 +1255,40 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1285
1255
|
}
|
|
1286
1256
|
emitIfReady(t) {
|
|
1287
1257
|
const e = Date.now();
|
|
1288
|
-
e < this.cooldownUntil || (this.cooldownUntil = e +
|
|
1258
|
+
e < this.cooldownUntil || (this.cooldownUntil = e + k.COOLDOWN_MS, this.onFrustration(t));
|
|
1289
1259
|
}
|
|
1290
1260
|
emitHighPriority(t) {
|
|
1291
|
-
this.cooldownUntil = Date.now() +
|
|
1261
|
+
this.cooldownUntil = Date.now() + k.COOLDOWN_MS, this.onFrustration(t);
|
|
1292
1262
|
}
|
|
1293
1263
|
};
|
|
1294
|
-
|
|
1295
|
-
let
|
|
1264
|
+
k.COOLDOWN_MS = 6e4;
|
|
1265
|
+
let R = k;
|
|
1296
1266
|
function y(i) {
|
|
1297
1267
|
const t = i.tagName.toLowerCase(), e = i.id ? `#${i.id}` : "", s = i.className && typeof i.className == "string" ? "." + i.className.trim().split(/\s+/).slice(0, 2).join(".") : "", r = i.textContent?.trim().slice(0, 30) ?? "";
|
|
1298
1268
|
return `<${t}${e}${s}>${r ? ` "${r}"` : ""}`;
|
|
1299
1269
|
}
|
|
1300
|
-
function
|
|
1270
|
+
function Pe() {
|
|
1301
1271
|
return {
|
|
1302
1272
|
page_url: window.location.href,
|
|
1303
1273
|
user_agent: navigator.userAgent,
|
|
1304
|
-
browser:
|
|
1305
|
-
os:
|
|
1274
|
+
browser: _e(),
|
|
1275
|
+
os: He(),
|
|
1306
1276
|
screen_width: window.screen.width,
|
|
1307
1277
|
screen_height: window.screen.height
|
|
1308
1278
|
};
|
|
1309
1279
|
}
|
|
1310
|
-
function
|
|
1280
|
+
function _e() {
|
|
1311
1281
|
const i = navigator.userAgent;
|
|
1312
1282
|
return /Edg\//.test(i) ? `Edge ${i.match(/Edg\/(\S+)/)?.[1] ?? ""}` : /OPR\//.test(i) ? `Opera ${i.match(/OPR\/(\S+)/)?.[1] ?? ""}` : /Chrome\//.test(i) ? `Chrome ${i.match(/Chrome\/(\S+)/)?.[1] ?? ""}` : /Safari\//.test(i) && /Version\//.test(i) ? `Safari ${i.match(/Version\/(\S+)/)?.[1] ?? ""}` : /Firefox\//.test(i) ? `Firefox ${i.match(/Firefox\/(\S+)/)?.[1] ?? ""}` : "Unknown";
|
|
1313
1283
|
}
|
|
1314
|
-
function
|
|
1284
|
+
function He() {
|
|
1315
1285
|
const i = navigator.userAgent;
|
|
1316
1286
|
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";
|
|
1317
1287
|
}
|
|
1318
|
-
const
|
|
1319
|
-
class
|
|
1288
|
+
const $e = "https://makethisbetter.dev/api/v1";
|
|
1289
|
+
class Ie {
|
|
1320
1290
|
constructor(t, e, s = 1e3, r, n) {
|
|
1321
|
-
this.projectKey = t, this.apiUrl = (e ??
|
|
1291
|
+
this.projectKey = t, this.apiUrl = (e ?? $e).replace(/\/$/, ""), this.retryDelayMs = s, this.userToken = r, this.userTokenFn = n;
|
|
1322
1292
|
}
|
|
1323
1293
|
async resolveUserToken() {
|
|
1324
1294
|
return this.userTokenFn ? this.userTokenFn() : this.userToken;
|
|
@@ -1335,7 +1305,7 @@ class Oe {
|
|
|
1335
1305
|
}
|
|
1336
1306
|
e && s.append("feedback[screenshot]", e, "screenshot.png");
|
|
1337
1307
|
const r = await this.authHeaders();
|
|
1338
|
-
return r["X-Idempotency-Key"] =
|
|
1308
|
+
return r["X-Idempotency-Key"] = Oe(), (await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks`, {
|
|
1339
1309
|
method: "POST",
|
|
1340
1310
|
headers: r,
|
|
1341
1311
|
body: s
|
|
@@ -1376,10 +1346,10 @@ class Oe {
|
|
|
1376
1346
|
function W(i) {
|
|
1377
1347
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
1378
1348
|
}
|
|
1379
|
-
function
|
|
1349
|
+
function Oe() {
|
|
1380
1350
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
1381
1351
|
}
|
|
1382
|
-
function
|
|
1352
|
+
function Fe(i, t, e, s, r, n) {
|
|
1383
1353
|
return {
|
|
1384
1354
|
description: i,
|
|
1385
1355
|
...t,
|
|
@@ -1397,7 +1367,7 @@ function je(i, t, e, s, r, n) {
|
|
|
1397
1367
|
recording_duration: n?.duration
|
|
1398
1368
|
};
|
|
1399
1369
|
}
|
|
1400
|
-
const
|
|
1370
|
+
const je = {
|
|
1401
1371
|
tab: "Feedback",
|
|
1402
1372
|
toolbar: {
|
|
1403
1373
|
markup: "Mark up",
|
|
@@ -1450,7 +1420,7 @@ const Ue = {
|
|
|
1450
1420
|
send: "Send",
|
|
1451
1421
|
skip: "Skip"
|
|
1452
1422
|
}
|
|
1453
|
-
},
|
|
1423
|
+
}, Ue = {
|
|
1454
1424
|
tab: "反馈",
|
|
1455
1425
|
toolbar: {
|
|
1456
1426
|
markup: "标注",
|
|
@@ -1503,7 +1473,7 @@ const Ue = {
|
|
|
1503
1473
|
send: "发送",
|
|
1504
1474
|
skip: "跳过"
|
|
1505
1475
|
}
|
|
1506
|
-
},
|
|
1476
|
+
}, ze = {
|
|
1507
1477
|
tab: "フィードバック",
|
|
1508
1478
|
toolbar: {
|
|
1509
1479
|
markup: "マークアップ",
|
|
@@ -1556,7 +1526,7 @@ const Ue = {
|
|
|
1556
1526
|
send: "送信",
|
|
1557
1527
|
skip: "スキップ"
|
|
1558
1528
|
}
|
|
1559
|
-
},
|
|
1529
|
+
}, Be = {
|
|
1560
1530
|
tab: "피드백",
|
|
1561
1531
|
toolbar: {
|
|
1562
1532
|
markup: "마크업",
|
|
@@ -1609,7 +1579,7 @@ const Ue = {
|
|
|
1609
1579
|
send: "보내기",
|
|
1610
1580
|
skip: "건너뛰기"
|
|
1611
1581
|
}
|
|
1612
|
-
},
|
|
1582
|
+
}, qe = {
|
|
1613
1583
|
tab: "Comentarios",
|
|
1614
1584
|
toolbar: {
|
|
1615
1585
|
markup: "Anotar",
|
|
@@ -1662,7 +1632,7 @@ const Ue = {
|
|
|
1662
1632
|
send: "Enviar",
|
|
1663
1633
|
skip: "Omitir"
|
|
1664
1634
|
}
|
|
1665
|
-
},
|
|
1635
|
+
}, We = {
|
|
1666
1636
|
tab: "Avis",
|
|
1667
1637
|
toolbar: {
|
|
1668
1638
|
markup: "Annoter",
|
|
@@ -1715,7 +1685,7 @@ const Ue = {
|
|
|
1715
1685
|
send: "Envoyer",
|
|
1716
1686
|
skip: "Passer"
|
|
1717
1687
|
}
|
|
1718
|
-
},
|
|
1688
|
+
}, Ne = {
|
|
1719
1689
|
tab: "Feedback",
|
|
1720
1690
|
toolbar: {
|
|
1721
1691
|
markup: "Markieren",
|
|
@@ -1768,29 +1738,29 @@ const Ue = {
|
|
|
1768
1738
|
send: "Senden",
|
|
1769
1739
|
skip: "Überspringen"
|
|
1770
1740
|
}
|
|
1771
|
-
},
|
|
1772
|
-
en:
|
|
1773
|
-
"zh-CN":
|
|
1774
|
-
ja:
|
|
1775
|
-
ko:
|
|
1776
|
-
es:
|
|
1777
|
-
fr:
|
|
1778
|
-
de:
|
|
1741
|
+
}, w = {
|
|
1742
|
+
en: je,
|
|
1743
|
+
"zh-CN": Ue,
|
|
1744
|
+
ja: ze,
|
|
1745
|
+
ko: Be,
|
|
1746
|
+
es: qe,
|
|
1747
|
+
fr: We,
|
|
1748
|
+
de: Ne
|
|
1779
1749
|
};
|
|
1780
|
-
function
|
|
1781
|
-
if (
|
|
1750
|
+
function Ve(i) {
|
|
1751
|
+
if (w[i]) return w[i];
|
|
1782
1752
|
const t = i.split("-")[0];
|
|
1783
|
-
return
|
|
1753
|
+
return w[t] ? w[t] : w.en;
|
|
1784
1754
|
}
|
|
1785
|
-
const
|
|
1786
|
-
let
|
|
1787
|
-
function
|
|
1788
|
-
return
|
|
1755
|
+
const Ye = 60, Xe = "https://cdn.jsdelivr.net/npm/rrweb@2.1.0/dist/rrweb.min.js", Ge = "sha384-6qZKf9GE/E2uhA8IdLwXsQiLN/jVx8mhA0i04rQ1aHLrs2URo3ivHlSbaccG59zt";
|
|
1756
|
+
let v = null;
|
|
1757
|
+
function Ke() {
|
|
1758
|
+
return v || (v = Je().catch(() => Qe()), v);
|
|
1789
1759
|
}
|
|
1790
|
-
async function
|
|
1760
|
+
async function Je() {
|
|
1791
1761
|
return (await import("rrweb")).record;
|
|
1792
1762
|
}
|
|
1793
|
-
function
|
|
1763
|
+
function Qe() {
|
|
1794
1764
|
return new Promise((i, t) => {
|
|
1795
1765
|
const e = globalThis;
|
|
1796
1766
|
if (e.rrweb?.record) {
|
|
@@ -1798,18 +1768,18 @@ function Ze() {
|
|
|
1798
1768
|
return;
|
|
1799
1769
|
}
|
|
1800
1770
|
const s = document.createElement("script");
|
|
1801
|
-
s.src =
|
|
1771
|
+
s.src = Xe, s.integrity = Ge, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1802
1772
|
const r = globalThis;
|
|
1803
1773
|
r.rrweb?.record ? i(r.rrweb.record) : t(new Error("rrweb global not found after script load"));
|
|
1804
1774
|
}, s.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(s);
|
|
1805
1775
|
});
|
|
1806
1776
|
}
|
|
1807
|
-
class
|
|
1777
|
+
class Ze {
|
|
1808
1778
|
constructor(t, e) {
|
|
1809
1779
|
this.events = [], this.stopFn = null, this.startedAt = 0, this.timer = null, this.clickHandler = null, this.stopped = !1, this.shadow = t, this.onMaxReached = e;
|
|
1810
1780
|
}
|
|
1811
1781
|
async start() {
|
|
1812
|
-
const t = await
|
|
1782
|
+
const t = await Ke();
|
|
1813
1783
|
this.startedAt = Date.now(), this.stopped = !1, this.stopFn = t({
|
|
1814
1784
|
emit: (e) => {
|
|
1815
1785
|
this.stopped || this.events.push(e);
|
|
@@ -1822,7 +1792,7 @@ class ti {
|
|
|
1822
1792
|
});
|
|
1823
1793
|
}, document.addEventListener("click", this.clickHandler, !0), this.timer = setTimeout(() => {
|
|
1824
1794
|
this.onMaxReached?.();
|
|
1825
|
-
},
|
|
1795
|
+
}, Ye * 1e3);
|
|
1826
1796
|
}
|
|
1827
1797
|
stop() {
|
|
1828
1798
|
return this.stopped = !0, this.stopFn?.(), this.stopFn = null, this.cleanupTimer(), this.cleanupClickHandler(), {
|
|
@@ -1847,7 +1817,7 @@ class ti {
|
|
|
1847
1817
|
s.style.left = `${t}px`, s.style.top = `${e}px`, this.shadow.append(s), s.addEventListener("animationend", () => s.remove());
|
|
1848
1818
|
}
|
|
1849
1819
|
}
|
|
1850
|
-
class
|
|
1820
|
+
class ti {
|
|
1851
1821
|
constructor(t, e, s, r) {
|
|
1852
1822
|
this.intervalId = null, this.getDuration = s, this.el = t.el("div", "mtb-record-bar"), this.el.innerHTML = `
|
|
1853
1823
|
<span class="mtb-record-dot"></span>
|
|
@@ -1863,12 +1833,12 @@ class ei {
|
|
|
1863
1833
|
this.intervalId && (clearInterval(this.intervalId), this.intervalId = null), this.el.remove();
|
|
1864
1834
|
}
|
|
1865
1835
|
}
|
|
1866
|
-
class
|
|
1836
|
+
class ei {
|
|
1867
1837
|
constructor() {
|
|
1868
1838
|
this.session = null, this.bar = null, this.result = null;
|
|
1869
1839
|
}
|
|
1870
1840
|
async start(t, e, s) {
|
|
1871
|
-
this.session = new
|
|
1841
|
+
this.session = new Ze(t, s), this.bar = new ti(
|
|
1872
1842
|
t,
|
|
1873
1843
|
e,
|
|
1874
1844
|
() => this.session?.getDuration() ?? 0,
|
|
@@ -1890,10 +1860,10 @@ class ii {
|
|
|
1890
1860
|
}
|
|
1891
1861
|
class N {
|
|
1892
1862
|
constructor(t) {
|
|
1893
|
-
this.tab = null, this.
|
|
1863
|
+
this.tab = null, this.toolbar = null, this.session = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.currentAnnotation = null, this.recordingManager = null, this.config = t, this.messages = Ve(t.locale ?? "en"), this.apiClient = new Ie(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new ve(), this.consoleCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new R(() => this.handleFrustration()), this.frustrationDetector.start());
|
|
1894
1864
|
}
|
|
1895
1865
|
buildUI() {
|
|
1896
|
-
this.shadow = new rt(this.config.theme ?? "auto"),
|
|
1866
|
+
this.shadow = new rt(this.config.theme ?? "auto"), this.tab = new nt(
|
|
1897
1867
|
this.shadow,
|
|
1898
1868
|
this.messages,
|
|
1899
1869
|
this.config.position ?? "right",
|
|
@@ -1905,7 +1875,7 @@ class N {
|
|
|
1905
1875
|
this.mode === "idle" ? (this.dismissFrustrationPrompt(), this.enterAnnotationMode()) : this.exitAll();
|
|
1906
1876
|
}
|
|
1907
1877
|
handleFrustration() {
|
|
1908
|
-
this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new
|
|
1878
|
+
this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new at(this.shadow, this.messages, {
|
|
1909
1879
|
onTell: () => {
|
|
1910
1880
|
this.dismissFrustrationPrompt(), this.enterAnnotationMode();
|
|
1911
1881
|
},
|
|
@@ -1916,7 +1886,7 @@ class N {
|
|
|
1916
1886
|
this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
|
|
1917
1887
|
}
|
|
1918
1888
|
enterAnnotationMode() {
|
|
1919
|
-
this.mode = "annotating", this.tab?.setActive(!0), this.
|
|
1889
|
+
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new lt(
|
|
1920
1890
|
this.shadow,
|
|
1921
1891
|
this.messages,
|
|
1922
1892
|
() => this.exitAll(),
|
|
@@ -1926,7 +1896,7 @@ class N {
|
|
|
1926
1896
|
});
|
|
1927
1897
|
}
|
|
1928
1898
|
handleToolbarModeChange(t) {
|
|
1929
|
-
t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new
|
|
1899
|
+
t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new ei(), this.recordingManager.start(this.shadow, this.messages, () => {
|
|
1930
1900
|
this.recordingManager && (this.recordingManager.stop(), this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
|
|
1931
1901
|
}).catch(() => {
|
|
1932
1902
|
this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
|
|
@@ -1935,7 +1905,7 @@ class N {
|
|
|
1935
1905
|
})), this.mode = "annotating");
|
|
1936
1906
|
}
|
|
1937
1907
|
showPopup(t, e, s) {
|
|
1938
|
-
this.mode = "popup", this.session?.dismissInteraction(), this.popup = new
|
|
1908
|
+
this.mode = "popup", this.session?.dismissInteraction(), this.popup = new bt(this.shadow, {
|
|
1939
1909
|
targetName: s,
|
|
1940
1910
|
x: t,
|
|
1941
1911
|
y: e,
|
|
@@ -1948,9 +1918,9 @@ class N {
|
|
|
1948
1918
|
if (!this.popup) return;
|
|
1949
1919
|
this.popup.setLoading(!0);
|
|
1950
1920
|
const e = this.currentAnnotation, s = this.recordingManager?.getRecording() ?? void 0, [r, n] = await Promise.all([
|
|
1951
|
-
|
|
1952
|
-
Promise.resolve(
|
|
1953
|
-
]), o =
|
|
1921
|
+
me(e ? [e] : []),
|
|
1922
|
+
Promise.resolve(Pe())
|
|
1923
|
+
]), o = Fe(
|
|
1954
1924
|
t,
|
|
1955
1925
|
n,
|
|
1956
1926
|
this.consoleCollector.getErrors(),
|
|
@@ -1966,7 +1936,7 @@ class N {
|
|
|
1966
1936
|
}
|
|
1967
1937
|
}
|
|
1968
1938
|
showClarify(t, e) {
|
|
1969
|
-
this.mode = "idle", this.tab?.setActive(!1), this.
|
|
1939
|
+
this.mode = "idle", this.tab?.setActive(!1), this.clarify = new xt(this.shadow, {
|
|
1970
1940
|
feedbackId: t,
|
|
1971
1941
|
apiClient: this.apiClient,
|
|
1972
1942
|
messages: this.messages,
|
|
@@ -1976,9 +1946,9 @@ class N {
|
|
|
1976
1946
|
});
|
|
1977
1947
|
}
|
|
1978
1948
|
showSuccess(t) {
|
|
1979
|
-
this.mode = "idle", this.tab?.setActive(!1)
|
|
1949
|
+
this.mode = "idle", this.tab?.setActive(!1);
|
|
1980
1950
|
const s = `${this.config.apiUrl ? this.config.apiUrl.replace(/\/api\/v1\/?$/, "") : "https://makethisbetter.dev"}/board/projects/${t}/feedbacks`, r = !!(this.config.userToken || this.config.userTokenFn);
|
|
1981
|
-
this.success = new
|
|
1951
|
+
this.success = new kt(this.shadow, this.messages, () => {
|
|
1982
1952
|
this.success?.destroy(), this.success = null;
|
|
1983
1953
|
}, r ? async () => {
|
|
1984
1954
|
const n = await this.apiClient.resolveUserToken();
|
|
@@ -1986,14 +1956,14 @@ class N {
|
|
|
1986
1956
|
} : void 0);
|
|
1987
1957
|
}
|
|
1988
1958
|
exitAll() {
|
|
1989
|
-
this.mode = "idle", this.tab?.setActive(!1), this.
|
|
1959
|
+
this.mode = "idle", this.tab?.setActive(!1), this.toolbar?.destroy(), this.toolbar = null, this.session?.destroy(), this.session = null, this.popup?.destroy(), this.popup = null, this.clarify?.destroy(), this.clarify = null, this.currentAnnotation = null, this.recordingManager?.destroy(), this.recordingManager = null;
|
|
1990
1960
|
}
|
|
1991
1961
|
destroy() {
|
|
1992
|
-
this.exitAll(), this.consoleCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.
|
|
1962
|
+
this.exitAll(), this.consoleCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.recordingManager?.destroy(), this.shadow.destroy();
|
|
1993
1963
|
}
|
|
1994
1964
|
}
|
|
1995
1965
|
let f = null;
|
|
1996
|
-
const
|
|
1966
|
+
const ii = {
|
|
1997
1967
|
init(i) {
|
|
1998
1968
|
f && (f.destroy(), f = null), document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
|
|
1999
1969
|
f = new N(i);
|
|
@@ -2003,8 +1973,8 @@ const si = {
|
|
|
2003
1973
|
f?.destroy(), f = null;
|
|
2004
1974
|
}
|
|
2005
1975
|
};
|
|
2006
|
-
typeof window < "u" && (window.MakeThisBetter =
|
|
1976
|
+
typeof window < "u" && (window.MakeThisBetter = ii);
|
|
2007
1977
|
export {
|
|
2008
|
-
|
|
1978
|
+
ii as MakeThisBetter
|
|
2009
1979
|
};
|
|
2010
1980
|
//# sourceMappingURL=makethisbetter.esm.js.map
|