@qaiddev/thumbs-embed 1.11.0 → 1.12.1

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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -13
  3. package/dist/a11y-dialog.d.ts +77 -0
  4. package/dist/a11y.d.ts +6 -65
  5. package/dist/chunks/annotate-DGyRcgPt.js +2 -0
  6. package/dist/chunks/{annotate-5zJWs-aB.js.map → annotate-DGyRcgPt.js.map} +1 -1
  7. package/dist/chunks/core-BsR7oV99.js +26 -0
  8. package/dist/chunks/core-BsR7oV99.js.map +1 -0
  9. package/dist/chunks/dom-scpOS8nl.js +2 -0
  10. package/dist/chunks/{dom-DvdtcUS8.js.map → dom-scpOS8nl.js.map} +1 -1
  11. package/dist/chunks/modal-DYxcs1Gm.js +2 -0
  12. package/dist/chunks/modal-DYxcs1Gm.js.map +1 -0
  13. package/dist/chunks/recording-BUw5-5Rf.js +2 -0
  14. package/dist/chunks/{recording-CPzxRL7f.js.map → recording-BUw5-5Rf.js.map} +1 -1
  15. package/dist/chunks/screenshot-CNe1irEz.js +2 -0
  16. package/dist/chunks/{screenshot-DYOKg2bS.js.map → screenshot-CNe1irEz.js.map} +1 -1
  17. package/dist/chunks/screenshot-dom-ZYP2w2h0.js +2 -0
  18. package/dist/chunks/{screenshot-dom-CME7tYRE.js.map → screenshot-dom-ZYP2w2h0.js.map} +1 -1
  19. package/dist/chunks/send-C26DRoYc.js +2 -0
  20. package/dist/chunks/send-C26DRoYc.js.map +1 -0
  21. package/dist/chunks/targeting-CMUEe-7C.js +6 -0
  22. package/dist/chunks/{targeting-mahtuPpo.js.map → targeting-CMUEe-7C.js.map} +1 -1
  23. package/dist/chunks/video-BSP4s2te.js +2 -0
  24. package/dist/chunks/{video-Bd_29-rK.js.map → video-BSP4s2te.js.map} +1 -1
  25. package/dist/embed.d.ts +26 -31
  26. package/dist/index.js +1495 -1390
  27. package/dist/index.js.map +1 -1
  28. package/dist/loader.d.ts +6 -4
  29. package/dist/loader.js +1 -6
  30. package/dist/loader.js.map +1 -1
  31. package/dist/modal-positioning.d.ts +0 -27
  32. package/dist/qaid.umd.cjs +14 -14
  33. package/dist/qaid.umd.cjs.map +1 -1
  34. package/dist/quest-config.d.ts +2 -0
  35. package/dist/quest-launcher.d.ts +1 -3
  36. package/dist/send.d.ts +60 -0
  37. package/dist/tooltip-positioning.d.ts +31 -0
  38. package/package.json +2 -2
  39. package/dist/chunks/annotate-5zJWs-aB.js +0 -357
  40. package/dist/chunks/core-CL1dwdaN.js +0 -1342
  41. package/dist/chunks/core-CL1dwdaN.js.map +0 -1
  42. package/dist/chunks/dom-DvdtcUS8.js +0 -17
  43. package/dist/chunks/modal-DccueVYZ.js +0 -222
  44. package/dist/chunks/modal-DccueVYZ.js.map +0 -1
  45. package/dist/chunks/recording-CPzxRL7f.js +0 -323
  46. package/dist/chunks/screenshot-DYOKg2bS.js +0 -33
  47. package/dist/chunks/screenshot-dom-CME7tYRE.js +0 -63
  48. package/dist/chunks/targeting-mahtuPpo.js +0 -298
  49. package/dist/chunks/video-Bd_29-rK.js +0 -214
@@ -1,63 +0,0 @@
1
- const w = "https://qaid.dev/lib/html2canvas.min.js";
2
- let a = null;
3
- function g() {
4
- if (typeof document > "u" || typeof window > "u")
5
- return !1;
6
- const n = document.createElement("canvas");
7
- return typeof n.getContext == "function" && !!n.getContext("2d");
8
- }
9
- function f() {
10
- return window.html2canvas ? Promise.resolve(!0) : a || (a = new Promise((n) => {
11
- if (!document.querySelector(
12
- `script[src="${w}"]`
13
- )) {
14
- const e = document.createElement("script");
15
- e.src = w, e.async = !0, document.head.appendChild(e);
16
- }
17
- const r = Date.now(), i = () => {
18
- if (window.html2canvas) {
19
- n(!0);
20
- return;
21
- }
22
- if (Date.now() - r > 1e4) {
23
- a = null, n(!1);
24
- return;
25
- }
26
- setTimeout(i, 50);
27
- };
28
- i();
29
- }), a);
30
- }
31
- async function L(n = {}) {
32
- const { quality: c = 0.8, maxWidth: r = 1280, maxHeight: i = 800 } = n;
33
- try {
34
- if (!await f() || !window.html2canvas)
35
- return console.warn("html2canvas failed to load"), null;
36
- const s = await window.html2canvas(document.body, {
37
- useCORS: !0,
38
- allowTaint: !1,
39
- logging: !1,
40
- windowWidth: document.documentElement.clientWidth,
41
- windowHeight: document.documentElement.clientHeight,
42
- width: document.documentElement.clientWidth,
43
- height: document.documentElement.clientHeight,
44
- x: window.scrollX,
45
- y: window.scrollY,
46
- ignoreElements: (t) => t instanceof HTMLElement ? t.classList.contains("qaid-buttons") || t.classList.contains("qaid-targeting-overlay") || t.classList.contains("qaid-modal-container") || t.classList.contains("qaid-bottom-sheet") || t.classList.contains("qaid-backdrop") || t.classList.contains("qaid-selected-marker") || t.classList.contains("qaid-tooltip-text") || t.classList.contains("qaid-recording-indicator") || t.classList.contains("qaid-video-preview") || t.className?.toString().startsWith?.("qaid-") : !1
47
- }), l = s.width, u = s.height, d = Math.min(r / l, i / u, 1);
48
- if (d < 1) {
49
- const t = Math.round(l * d), m = Math.round(u * d), o = document.createElement("canvas");
50
- o.width = t, o.height = m;
51
- const h = o.getContext("2d");
52
- return h ? (h.drawImage(s, 0, 0, t, m), o.toDataURL("image/webp", c)) : null;
53
- }
54
- return s.toDataURL("image/webp", c);
55
- } catch (e) {
56
- return console.warn("DOM screenshot capture failed:", e), null;
57
- }
58
- }
59
- export {
60
- L as captureDomScreenshot,
61
- g as isDomScreenshotSupported
62
- };
63
- //# sourceMappingURL=screenshot-dom-CME7tYRE.js.map
@@ -1,298 +0,0 @@
1
- import { g as k, e as q, i as m } from "./core-CL1dwdaN.js";
2
- const T = ["data-comp", "data-qa", "data-testid", "data-id"];
3
- function E(i, t = document.body) {
4
- let e = i;
5
- for (; e && e !== t; ) {
6
- for (const r of T) {
7
- const o = e.getAttribute(r);
8
- if (o)
9
- return `${r}="${o}"`;
10
- }
11
- e = e.parentElement;
12
- }
13
- return null;
14
- }
15
- function S(i, t = 100) {
16
- const e = i.textContent?.trim().slice(0, t) || "";
17
- return e.length === t ? e + "..." : e;
18
- }
19
- function w(i) {
20
- let t = 1, e = i.previousElementSibling;
21
- for (; e; )
22
- t++, e = e.previousElementSibling;
23
- return t;
24
- }
25
- function L(i) {
26
- const t = [];
27
- let e = i;
28
- for (; e && e !== document.body && e !== document.documentElement; ) {
29
- const r = e.tagName.toLowerCase(), o = w(e);
30
- t.unshift(`${r}:nth-child(${o})`), e = e.parentElement;
31
- }
32
- return t.length > 0 ? `body > ${t.join(" > ")}` : "body";
33
- }
34
- function A(i) {
35
- return i.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
36
- }
37
- function P(i) {
38
- const t = E(i);
39
- return t ? `[${t}]` : i.id ? `#${A(i.id)}` : L(i);
40
- }
41
- function y(i) {
42
- const t = S(i), e = E(i);
43
- return { selector: P(i), text: t, dataAttr: e };
44
- }
45
- const $ = [
46
- "a[href]",
47
- "button",
48
- "input:not([type=hidden])",
49
- "select",
50
- "textarea",
51
- "summary",
52
- "[tabindex]",
53
- "[role]",
54
- "img",
55
- "h1",
56
- "h2",
57
- "h3",
58
- "h4",
59
- "h5",
60
- "h6",
61
- "p",
62
- "li",
63
- "label",
64
- ...T.map((i) => `[${i}]`)
65
- ].join(","), D = /^(?:A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/;
66
- function B(i) {
67
- if (i.hasAttribute("hidden") || i.getAttribute("aria-hidden") === "true") return !1;
68
- const t = i.ownerDocument?.defaultView;
69
- if (t && typeof t.getComputedStyle == "function") {
70
- const e = t.getComputedStyle(i);
71
- if (e.display === "none" || e.visibility === "hidden") return !1;
72
- }
73
- return !0;
74
- }
75
- function H(i = {}) {
76
- const t = i.root ?? document.body, e = i.selector ?? $, r = i.isExcluded ?? (() => !1), o = i.isVisible ?? B;
77
- return Array.from(t.querySelectorAll(e)).filter(
78
- (a) => !r(a) && o(a)
79
- );
80
- }
81
- function V(i) {
82
- const t = i.candidates ?? H({
83
- root: i.root,
84
- selector: i.selector,
85
- isExcluded: i.isExcluded,
86
- isVisible: i.isVisible
87
- }), e = i.moveFocus ?? !0, r = i.eventTarget ?? document, o = /* @__PURE__ */ new Set();
88
- let a = -1, n = !1;
89
- const h = i.initial !== void 0 ? i.initial : typeof document < "u" ? document.activeElement : null;
90
- if (h) {
91
- const s = t.indexOf(h);
92
- s >= 0 && (a = s);
93
- }
94
- a < 0 && t.length > 0 && (a = 0);
95
- function C(s) {
96
- if (!e) return;
97
- const d = s;
98
- if (typeof d.focus == "function") {
99
- s.getAttribute("tabindex") === null && !D.test(s.tagName) && (s.setAttribute("tabindex", "-1"), o.add(s));
100
- try {
101
- d.focus();
102
- } catch {
103
- }
104
- }
105
- }
106
- function v() {
107
- const s = t[a];
108
- s && (C(s), i.onHighlight?.(s, a));
109
- }
110
- function l(s) {
111
- if (n || t.length === 0) return;
112
- const d = t.length;
113
- a = (s % d + d) % d, v();
114
- }
115
- function c() {
116
- l(a + 1);
117
- }
118
- function u() {
119
- l(a - 1);
120
- }
121
- function b() {
122
- return t[a] ?? null;
123
- }
124
- function p() {
125
- n || (n = !0, r.removeEventListener("keydown", g, !0), o.forEach((s) => s.removeAttribute("tabindex")), o.clear());
126
- }
127
- function f() {
128
- if (n) return;
129
- const s = b();
130
- p(), s && i.onSelect(s);
131
- }
132
- function x() {
133
- n || (p(), i.onCancel?.());
134
- }
135
- function g(s) {
136
- if (!n)
137
- switch (s.key) {
138
- case "Tab":
139
- s.preventDefault(), s.stopPropagation(), s.shiftKey ? u() : c();
140
- break;
141
- case "ArrowDown":
142
- case "ArrowRight":
143
- s.preventDefault(), s.stopPropagation(), c();
144
- break;
145
- case "ArrowUp":
146
- case "ArrowLeft":
147
- s.preventDefault(), s.stopPropagation(), u();
148
- break;
149
- case "Enter":
150
- case " ":
151
- case "Spacebar":
152
- s.preventDefault(), s.stopPropagation(), f();
153
- break;
154
- case "Escape":
155
- case "Esc":
156
- s.preventDefault(), s.stopPropagation(), x();
157
- break;
158
- }
159
- }
160
- return r.addEventListener("keydown", g, !0), a >= 0 && v(), {
161
- candidates: t,
162
- getIndex: () => a,
163
- getCurrent: b,
164
- next: c,
165
- prev: u,
166
- moveTo: l,
167
- select: f,
168
- cancel: x,
169
- handleKey: g,
170
- stop: p
171
- };
172
- }
173
- const M = ".qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6365f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}@media(forced-colors:active){.qaid-selected-marker,.qaid-highlight-box{border-color:Highlight}}", N = 12;
174
- class R {
175
- constructor(t) {
176
- this.host = t;
177
- }
178
- host;
179
- mousePos = { x: 0, y: 0 };
180
- touchStartPos = null;
181
- overlayContainer = null;
182
- captureLayer = null;
183
- crosshairH = null;
184
- crosshairV = null;
185
- scope = null;
186
- highlightBox = null;
187
- marker = null;
188
- keyboardController = null;
189
- boundMouseMove = (t) => this.handleMouseMove(t);
190
- boundClick = (t) => this.handleClick(t);
191
- boundTouchStart = (t) => this.handleTouchStart(t);
192
- boundTouchEnd = (t) => this.handleTouchEnd(t);
193
- startPointer(t, e) {
194
- this.host.setState("TARGETING"), this.host.feedbackData.feedbackType = t, this.host.feedbackData.elementSelector = null, this.host.feedbackData.elementText = null, this.host.selectedBounds.visible = !1, this.mousePos.x = e.clientX, this.mousePos.y = e.clientY, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), document.body.style.setProperty("--qaid-positive", this.host.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.host.cssVars["--qaid-negative"]), this.createTargetingOverlay(), document.addEventListener("keydown", this.host.boundKeyDown), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("click", this.boundClick, !0), document.addEventListener("touchstart", this.boundTouchStart, { passive: !0 }), document.addEventListener("touchend", this.boundTouchEnd, { passive: !1 });
195
- }
196
- /**
197
- * Keyboard-driven targeting. Mirrors startPointer minus the mouse plumbing:
198
- * no `qaid-targeting` body class (keeps the cursor visible for keyboard
199
- * users), no mouse reticle, and no document mouse/click listeners. The
200
- * KeyboardTargetingController owns Tab/Arrow/Enter/Space/Escape.
201
- */
202
- startKeyboard(t) {
203
- this.host.setState("TARGETING"), this.host.feedbackData.feedbackType = t, this.host.feedbackData.elementSelector = null, this.host.feedbackData.elementText = null, this.host.selectedBounds.visible = !1, document.body.style.setProperty("--qaid-positive", this.host.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.host.cssVars["--qaid-negative"]), this.createTargetingOverlay(), this.crosshairH && (this.crosshairH.style.display = "none"), this.crosshairV && (this.crosshairV.style.display = "none"), this.scope && (this.scope.style.display = "none"), this.keyboardController = V({
204
- isExcluded: (e) => m(e),
205
- onHighlight: (e) => {
206
- const r = e.getBoundingClientRect(), o = this.highlightBox;
207
- o && (o.style.transform = `translate(${r.left}px, ${r.top}px)`, o.style.width = `${r.width}px`, o.style.height = `${r.height}px`, o.style.display = "block");
208
- const { text: a } = y(e);
209
- this.host.announceMsg(`Targeting ${a || e.tagName.toLowerCase()}`);
210
- },
211
- onSelect: (e) => this.selectKeyboardTarget(e),
212
- onCancel: () => this.cancel()
213
- });
214
- }
215
- selectKeyboardTarget(t) {
216
- const e = k(t, 8);
217
- Object.assign(this.host.selectedBounds, e, {
218
- clickX: e.x + e.width / 2,
219
- clickY: e.y + e.height / 2,
220
- visible: !0
221
- });
222
- const { selector: r, text: o } = y(t);
223
- this.host.feedbackData.elementSelector = r, this.host.feedbackData.elementText = o, this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.keyboardController = null, this.host.clearActiveThumb(), this.host.setState("SELECTED"), this.showSelectedMarker(), this.host.submitFeedback();
224
- }
225
- createTargetingOverlay() {
226
- const t = this.host.ensureOverlayHost();
227
- this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.host.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer";
228
- const e = document.createElement("div");
229
- e.className = "qaid-vignette", this.crosshairH = document.createElement("div"), this.crosshairH.className = "qaid-crosshair-h", this.crosshairV = document.createElement("div"), this.crosshairV.className = "qaid-crosshair-v", this.scope = document.createElement("div"), this.scope.className = "qaid-scope", this.scope.innerHTML = `
230
- <div class="qaid-scope-ring"></div>
231
- <div class="qaid-scope-ring-inner"></div>
232
- <div class="qaid-scope-dot"></div>
233
- `, this.highlightBox = document.createElement("div"), this.highlightBox.className = "qaid-highlight-box", this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(e), this.overlayContainer.appendChild(this.highlightBox), this.overlayContainer.appendChild(this.crosshairH), this.overlayContainer.appendChild(this.crosshairV), this.overlayContainer.appendChild(this.scope), this.crosshairH.style.top = `${this.mousePos.y}px`, this.crosshairV.style.left = `${this.mousePos.x}px`, this.scope.style.left = `${this.mousePos.x}px`, this.scope.style.top = `${this.mousePos.y}px`, this.host.applyVars(this.overlayContainer), t.appendChild(this.overlayContainer);
234
- }
235
- handleMouseMove(t) {
236
- this.updateReticleAt(t.clientX, t.clientY);
237
- }
238
- /** Move the crosshair/scope reticle and highlight the element under (x, y). */
239
- updateReticleAt(t, e) {
240
- if (this.mousePos.x = t, this.mousePos.y = e, this.crosshairH && (this.crosshairH.style.top = `${e}px`), this.crosshairV && (this.crosshairV.style.left = `${t}px`), this.scope && (this.scope.style.left = `${t}px`, this.scope.style.top = `${e}px`), this.captureLayer && this.host.shadowHost) {
241
- const r = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean), o = q(t, e, r);
242
- if (o && !m(o)) {
243
- if (this.highlightBox) {
244
- const a = o.getBoundingClientRect();
245
- this.highlightBox.style.transform = `translate(${a.left}px, ${a.top}px)`, this.highlightBox.style.width = `${a.width}px`, this.highlightBox.style.height = `${a.height}px`, this.highlightBox.style.display = "block";
246
- }
247
- } else this.highlightBox && (this.highlightBox.style.display = "none");
248
- }
249
- }
250
- handleClick(t) {
251
- t.preventDefault(), t.stopPropagation(), this.selectAt(t.clientX, t.clientY);
252
- }
253
- // ---- Touch targeting (iOS/iPadOS) ----
254
- handleTouchStart(t) {
255
- const e = t.touches[0];
256
- e && (this.touchStartPos = { x: e.clientX, y: e.clientY }, this.updateReticleAt(e.clientX, e.clientY));
257
- }
258
- handleTouchEnd(t) {
259
- const e = t.changedTouches[0], r = this.touchStartPos;
260
- this.touchStartPos = null, !(!e || !r || Math.hypot(e.clientX - r.x, e.clientY - r.y) > N) && (t.preventDefault(), this.selectAt(e.clientX, e.clientY));
261
- }
262
- /** Select the element under (x, y) and tear down targeting. */
263
- selectAt(t, e) {
264
- const r = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean), o = q(t, e, r);
265
- if (!o || m(o))
266
- return;
267
- const a = k(o, 8);
268
- Object.assign(this.host.selectedBounds, a, { clickX: t, clickY: e, visible: !0 });
269
- const { selector: n, text: h } = y(o);
270
- this.host.feedbackData.elementSelector = n, this.host.feedbackData.elementText = h, this.stopTargetingListeners(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.host.setState("SELECTED"), this.host.clearActiveThumb(), this.showSelectedMarker(), this.host.submitFeedback();
271
- }
272
- stopTargetingListeners() {
273
- this.removeTargetingOverlay(), this.touchStartPos = null, document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), document.removeEventListener("touchstart", this.boundTouchStart), document.removeEventListener("touchend", this.boundTouchEnd), document.removeEventListener("keydown", this.host.boundKeyDown);
274
- }
275
- cancel() {
276
- this.keyboardController?.stop(), this.keyboardController = null, this.stopTargetingListeners(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.host.clearActiveThumb(), this.host.setState("IDLE"), this.host.feedbackData.feedbackType = null, this.host.feedbackData.elementSelector = null, this.host.feedbackData.elementText = null, this.host.selectedBounds.visible = !1;
277
- }
278
- removeTargetingOverlay() {
279
- this.overlayContainer && (this.overlayContainer.remove(), this.overlayContainer = null), this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null;
280
- }
281
- showSelectedMarker() {
282
- const t = this.host.ensureOverlayHost();
283
- this.marker = document.createElement("div"), this.marker.className = "qaid-selected-marker", this.marker.style.left = `${this.host.selectedBounds.x}px`, this.marker.style.top = `${this.host.selectedBounds.y}px`, this.marker.style.width = `${this.host.selectedBounds.width}px`, this.marker.style.height = `${this.host.selectedBounds.height}px`, this.marker.style.zIndex = String(this.host.config.zIndex + 1), this.host.applyVars(this.marker), t.appendChild(this.marker);
284
- }
285
- hideMarker() {
286
- this.marker && (this.marker.remove(), this.marker = null);
287
- }
288
- /** Full teardown for embed.destroy(). */
289
- destroy() {
290
- this.keyboardController?.stop(), this.keyboardController = null, this.stopTargetingListeners(), this.hideMarker();
291
- }
292
- }
293
- const I = M;
294
- export {
295
- R as TargetingController,
296
- I as styles
297
- };
298
- //# sourceMappingURL=targeting-mahtuPpo.js.map
@@ -1,214 +0,0 @@
1
- function D() {
2
- const e = navigator.userAgent || "";
3
- return /iP(hone|ad|od)/.test(e) || // iPadOS 13+ masquerades as "MacIntel" but is a multi-touch device.
4
- navigator.platform === "MacIntel" && (navigator.maxTouchPoints || 0) > 1;
5
- }
6
- function A(e, a, r, d, s) {
7
- const t = e >= a, o = r >= d;
8
- return t === o ? { width: e, height: a, rotate: 0 } : { width: a, height: e, rotate: s === 270 ? -90 : 90 };
9
- }
10
- function x(e, a, r) {
11
- if (r.rotate === 0) {
12
- e.drawImage(a, 0, 0, r.width, r.height);
13
- return;
14
- }
15
- e.save(), r.rotate === 90 ? (e.translate(r.width, 0), e.rotate(Math.PI / 2)) : (e.translate(0, r.height), e.rotate(-Math.PI / 2)), e.drawImage(a, 0, 0, r.height, r.width), e.restore();
16
- }
17
- function C() {
18
- const e = typeof screen < "u" ? screen.orientation : void 0;
19
- return e && typeof e.angle == "number" ? e.angle : 0;
20
- }
21
- function E(e) {
22
- return new Promise((a) => {
23
- if (e.videoWidth > 0) {
24
- a();
25
- return;
26
- }
27
- e.addEventListener("loadedmetadata", () => a(), { once: !0 });
28
- });
29
- }
30
- async function I(e) {
31
- try {
32
- await e.play();
33
- } catch {
34
- }
35
- }
36
- async function F(e, a = 15) {
37
- const r = document.createElement("canvas");
38
- if (typeof r.captureStream != "function") return null;
39
- const d = r.getContext("2d");
40
- if (!d) return null;
41
- const s = document.createElement("video");
42
- s.muted = !0, s.playsInline = !0, s.srcObject = e, await E(s);
43
- const t = A(
44
- s.videoWidth,
45
- s.videoHeight,
46
- window.innerWidth,
47
- window.innerHeight,
48
- C()
49
- );
50
- r.width = t.width, r.height = t.height, await I(s);
51
- let o = 0;
52
- const c = () => {
53
- x(d, s, t), o = requestAnimationFrame(c);
54
- };
55
- c();
56
- const n = r.captureStream(a);
57
- return {
58
- stream: n,
59
- stop: () => {
60
- o && cancelAnimationFrame(o), o = 0, n.getTracks().forEach((u) => u.stop()), s.pause(), s.srcObject = null;
61
- }
62
- };
63
- }
64
- function B(e, a, r, d, s) {
65
- const t = Math.max(0, Math.min(d, e.left * a)), o = Math.max(0, Math.min(s, e.top * r)), c = Math.max(0, Math.min(d, (e.left + e.width) * a)), n = Math.max(0, Math.min(s, (e.top + e.height) * r)), u = c - t, i = n - o;
66
- return u <= 0 || i <= 0 ? null : { x: t, y: o, w: u, h: i };
67
- }
68
- function O(e, a, r, d, s, t, o) {
69
- e.drawImage(a, 0, 0, d, s);
70
- const c = d / Math.max(1, window.innerWidth), n = s / Math.max(1, window.innerHeight);
71
- for (const u of r) {
72
- const i = B(
73
- u.getBoundingClientRect(),
74
- c,
75
- n,
76
- d,
77
- s
78
- );
79
- i && (e.save(), o ? (e.filter = `blur(${t}px)`, e.drawImage(a, i.x, i.y, i.w, i.h, i.x, i.y, i.w, i.h)) : (e.fillStyle = "#0b0b0b", e.fillRect(i.x, i.y, i.w, i.h)), e.restore());
80
- }
81
- }
82
- async function P(e, a, r = {}) {
83
- const d = r.frameRate ?? 15, s = r.blurRadius ?? 12, t = document.createElement("canvas");
84
- if (typeof t.captureStream != "function") return null;
85
- const o = t.getContext("2d");
86
- if (!o) return null;
87
- const c = "filter" in o, n = document.createElement("video");
88
- n.muted = !0, n.playsInline = !0, n.srcObject = e, await E(n), t.width = n.videoWidth, t.height = n.videoHeight, await I(n);
89
- let u = 0;
90
- const i = () => {
91
- O(
92
- o,
93
- n,
94
- a,
95
- t.width,
96
- t.height,
97
- s,
98
- c
99
- ), u = requestAnimationFrame(i);
100
- };
101
- i();
102
- const h = t.captureStream(d);
103
- return {
104
- stream: h,
105
- stop: () => {
106
- u && cancelAnimationFrame(u), u = 0, h.getTracks().forEach((p) => p.stop()), n.pause(), n.srcObject = null;
107
- }
108
- };
109
- }
110
- const L = "This browser cannot blur the areas you picked, so the recording was not started.";
111
- function V() {
112
- return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function" && typeof MediaRecorder < "u";
113
- }
114
- function j() {
115
- if (typeof MediaRecorder > "u") return "";
116
- const e = [
117
- "video/webm;codecs=vp9",
118
- "video/webm;codecs=vp8",
119
- "video/webm",
120
- "video/mp4"
121
- ];
122
- for (const a of e)
123
- if (MediaRecorder.isTypeSupported(a))
124
- return a;
125
- return "";
126
- }
127
- function q(e = {}) {
128
- const a = e.maxDuration ?? 15, r = e.videoBitsPerSecond ?? 8e5, d = e.redactionElements ?? [], s = e.redactionBlurRadius;
129
- let t = null, o = null, c = null, n = null, u = [], i = null, h = null, p = null, R = 0, w = null, g = null, S = !1, v = null;
130
- function k() {
131
- p !== null && (clearInterval(p), p = null), v !== null && (clearTimeout(v), v = null), o && (o.stop(), o = null), c && (c.stop(), c = null), t && (t.getTracks().forEach((f) => f.stop()), t = null), n = null, u = [], i = null, h = null, w = null, g = null;
132
- }
133
- function y() {
134
- S || (S = !0, n && n.state !== "inactive" && n.stop());
135
- }
136
- return {
137
- async start() {
138
- S = !1, u = [];
139
- const f = j();
140
- if (!f)
141
- throw new Error("No supported video MIME type found");
142
- t = await navigator.mediaDevices.getDisplayMedia({
143
- video: {
144
- frameRate: 15,
145
- displaySurface: "browser"
146
- },
147
- audio: !1,
148
- // @ts-expect-error preferCurrentTab is not in the TS types yet
149
- preferCurrentTab: !0,
150
- selfBrowserSurface: "include",
151
- monitorTypeSurfaces: "exclude",
152
- surfaceSwitching: "exclude"
153
- });
154
- const m = t.getVideoTracks()[0], T = m?.getSettings?.()?.displaySurface;
155
- if (T === "monitor" || T === "window")
156
- throw t.getTracks().forEach((l) => l.stop()), t = null, new Error(
157
- "qaid records only the current tab — please share this tab, not a window or your whole screen."
158
- );
159
- m && m.addEventListener("ended", () => {
160
- y();
161
- });
162
- let b = t;
163
- if (D()) {
164
- const l = await F(t);
165
- l && (o = l, b = l.stream);
166
- }
167
- if (d.length > 0) {
168
- const l = await P(b, d, {
169
- blurRadius: s
170
- });
171
- if (!l)
172
- throw o && (o.stop(), o = null), t.getTracks().forEach((M) => M.stop()), t = null, new Error(L);
173
- c = l, b = l.stream;
174
- }
175
- n = new MediaRecorder(b, {
176
- mimeType: f,
177
- videoBitsPerSecond: r
178
- }), n.ondataavailable = (l) => {
179
- l.data.size > 0 && u.push(l.data);
180
- }, n.onstop = () => {
181
- const l = new Blob(u, { type: f });
182
- w && w(l), h && h(l), o && (o.stop(), o = null), c && (c.stop(), c = null), t && t.getTracks().forEach((M) => M.stop());
183
- }, n.onerror = () => {
184
- g && g(new Error("MediaRecorder error"));
185
- }, n.start(1e3), R = Date.now(), p = setInterval(() => {
186
- const l = Math.floor((Date.now() - R) / 1e3);
187
- i && i(l);
188
- }, 1e3), v = setTimeout(() => {
189
- y();
190
- }, a * 1e3);
191
- },
192
- stop() {
193
- return new Promise((f, m) => {
194
- w = f, g = m, y();
195
- });
196
- },
197
- onTick(f) {
198
- i = f;
199
- },
200
- onStop(f) {
201
- h = f;
202
- },
203
- destroy() {
204
- y(), k();
205
- }
206
- };
207
- }
208
- export {
209
- L as REDACTION_UNAVAILABLE,
210
- q as createVideoRecorder,
211
- j as getSupportedMimeType,
212
- V as isVideoRecordingSupported
213
- };
214
- //# sourceMappingURL=video-Bd_29-rK.js.map