@usecrow/client 0.1.26 → 0.1.28

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.
@@ -42,9 +42,9 @@ async function inputTextElement(e, n) {
42
42
  async function selectOptionElement(e, n) {
43
43
  if (!(e instanceof HTMLSelectElement))
44
44
  throw new Error("Element is not a select element");
45
- const i = Array.from(e.options).find((b) => {
45
+ const i = Array.from(e.options).find((w) => {
46
46
  var d;
47
- return ((d = b.textContent) == null ? void 0 : d.trim()) === n.trim();
47
+ return ((d = w.textContent) == null ? void 0 : d.trim()) === n.trim();
48
48
  });
49
49
  if (!i)
50
50
  throw new Error(`Option with text "${n}" not found in select element`);
@@ -61,37 +61,37 @@ async function scrollVertically(e, n, s) {
61
61
  "[SCROLL DEBUG] Starting direct container scroll for element:",
62
62
  l.tagName
63
63
  );
64
- let h = l, v = !1, w = null, u = 0, f = 0;
65
- const T = n;
64
+ let h = l, T = !1, b = null, u = 0, f = 0;
65
+ const N = n;
66
66
  for (; h && f < 10; ) {
67
- const F = window.getComputedStyle(h), P = /(auto|scroll|overlay)/.test(F.overflowY), O = h.scrollHeight > h.clientHeight;
67
+ const D = window.getComputedStyle(h), z = /(auto|scroll|overlay)/.test(D.overflowY), O = h.scrollHeight > h.clientHeight;
68
68
  if (console.log(
69
69
  "[SCROLL DEBUG] Checking element:",
70
70
  h.tagName,
71
71
  "hasScrollableY:",
72
- P,
72
+ z,
73
73
  "canScrollVertically:",
74
74
  O,
75
75
  "scrollHeight:",
76
76
  h.scrollHeight,
77
77
  "clientHeight:",
78
78
  h.clientHeight
79
- ), P && O) {
80
- const R = h.scrollTop, z = h.scrollHeight - h.clientHeight;
81
- let H = T / 3;
82
- H > 0 ? H = Math.min(H, z - R) : H = Math.max(H, -R), h.scrollTop = R + H;
83
- const D = h.scrollTop, _ = D - R;
79
+ ), z && O) {
80
+ const R = h.scrollTop, U = h.scrollHeight - h.clientHeight;
81
+ let H = N / 3;
82
+ H > 0 ? H = Math.min(H, U - R) : H = Math.max(H, -R), h.scrollTop = R + H;
83
+ const B = h.scrollTop, _ = B - R;
84
84
  if (console.log(
85
85
  "[SCROLL DEBUG] Scroll attempt:",
86
86
  h.tagName,
87
87
  "before:",
88
88
  R,
89
89
  "after:",
90
- D,
90
+ B,
91
91
  "delta:",
92
92
  _
93
93
  ), Math.abs(_) > 0.5) {
94
- v = !0, w = h, u = _, console.log(
94
+ T = !0, b = h, u = _, console.log(
95
95
  "[SCROLL DEBUG] Successfully scrolled container:",
96
96
  h.tagName,
97
97
  "delta:",
@@ -104,27 +104,27 @@ async function scrollVertically(e, n, s) {
104
104
  break;
105
105
  h = h.parentElement, f++;
106
106
  }
107
- return v ? `Scrolled container (${w == null ? void 0 : w.tagName}) by ${u}px` : `No scrollable container found for element (${l.tagName})`;
107
+ return T ? `Scrolled container (${b == null ? void 0 : b.tagName}) by ${u}px` : `No scrollable container found for element (${l.tagName})`;
108
108
  }
109
- const i = n, b = (l) => l.clientHeight >= window.innerHeight * 0.5, d = (l) => l && /(auto|scroll|overlay)/.test(getComputedStyle(l).overflowY) && l.scrollHeight > l.clientHeight && b(l);
109
+ const i = n, w = (l) => l.clientHeight >= window.innerHeight * 0.5, d = (l) => l && /(auto|scroll|overlay)/.test(getComputedStyle(l).overflowY) && l.scrollHeight > l.clientHeight && w(l);
110
110
  let r = document.activeElement;
111
111
  for (; r && !d(r) && r !== document.body; ) r = r.parentElement;
112
112
  if (r = d(r) ? r : Array.from(document.querySelectorAll("*")).find(d) || document.scrollingElement || document.documentElement, r === document.scrollingElement || r === document.documentElement || r === document.body) {
113
113
  const l = window.scrollY, h = document.documentElement.scrollHeight - window.innerHeight;
114
114
  window.scrollBy(0, i);
115
- const v = window.scrollY, w = v - l;
116
- if (Math.abs(w) < 1)
115
+ const T = window.scrollY, b = T - l;
116
+ if (Math.abs(b) < 1)
117
117
  return i > 0 ? "⚠️ Already at the bottom of the page, cannot scroll down further." : "⚠️ Already at the top of the page, cannot scroll up further.";
118
- const u = i > 0 && v >= h - 1, f = i < 0 && v <= 1;
119
- return u ? `✅ Scrolled page by ${w}px. Reached the bottom of the page.` : f ? `✅ Scrolled page by ${w}px. Reached the top of the page.` : `✅ Scrolled page by ${w}px.`;
118
+ const u = i > 0 && T >= h - 1, f = i < 0 && T <= 1;
119
+ return u ? `✅ Scrolled page by ${b}px. Reached the bottom of the page.` : f ? `✅ Scrolled page by ${b}px. Reached the top of the page.` : `✅ Scrolled page by ${b}px.`;
120
120
  } else {
121
121
  const l = r.scrollTop, h = r.scrollHeight - r.clientHeight;
122
122
  r.scrollBy({ top: i, behavior: "smooth" }), await waitFor(0.1);
123
- const v = r.scrollTop, w = v - l;
124
- if (Math.abs(w) < 1)
123
+ const T = r.scrollTop, b = T - l;
124
+ if (Math.abs(b) < 1)
125
125
  return i > 0 ? `⚠️ Already at the bottom of container (${r.tagName}), cannot scroll down further.` : `⚠️ Already at the top of container (${r.tagName}), cannot scroll up further.`;
126
- const u = i > 0 && v >= h - 1, f = i < 0 && v <= 1;
127
- return u ? `✅ Scrolled container (${r.tagName}) by ${w}px. Reached the bottom.` : f ? `✅ Scrolled container (${r.tagName}) by ${w}px. Reached the top.` : `✅ Scrolled container (${r.tagName}) by ${w}px.`;
126
+ const u = i > 0 && T >= h - 1, f = i < 0 && T <= 1;
127
+ return u ? `✅ Scrolled container (${r.tagName}) by ${b}px. Reached the bottom.` : f ? `✅ Scrolled container (${r.tagName}) by ${b}px. Reached the top.` : `✅ Scrolled container (${r.tagName}) by ${b}px.`;
128
128
  }
129
129
  }
130
130
  async function scrollHorizontally(e, n, s) {
@@ -134,37 +134,37 @@ async function scrollHorizontally(e, n, s) {
134
134
  "[SCROLL DEBUG] Starting direct container scroll for element:",
135
135
  l.tagName
136
136
  );
137
- let h = l, v = !1, w = null, u = 0, f = 0;
138
- const T = e ? n : -n;
137
+ let h = l, T = !1, b = null, u = 0, f = 0;
138
+ const N = e ? n : -n;
139
139
  for (; h && f < 10; ) {
140
- const F = window.getComputedStyle(h), P = /(auto|scroll|overlay)/.test(F.overflowX), O = h.scrollWidth > h.clientWidth;
140
+ const D = window.getComputedStyle(h), z = /(auto|scroll|overlay)/.test(D.overflowX), O = h.scrollWidth > h.clientWidth;
141
141
  if (console.log(
142
142
  "[SCROLL DEBUG] Checking element:",
143
143
  h.tagName,
144
144
  "hasScrollableX:",
145
- P,
145
+ z,
146
146
  "canScrollHorizontally:",
147
147
  O,
148
148
  "scrollWidth:",
149
149
  h.scrollWidth,
150
150
  "clientWidth:",
151
151
  h.clientWidth
152
- ), P && O) {
153
- const R = h.scrollLeft, z = h.scrollWidth - h.clientWidth;
154
- let H = T / 3;
155
- H > 0 ? H = Math.min(H, z - R) : H = Math.max(H, -R), h.scrollLeft = R + H;
156
- const D = h.scrollLeft, _ = D - R;
152
+ ), z && O) {
153
+ const R = h.scrollLeft, U = h.scrollWidth - h.clientWidth;
154
+ let H = N / 3;
155
+ H > 0 ? H = Math.min(H, U - R) : H = Math.max(H, -R), h.scrollLeft = R + H;
156
+ const B = h.scrollLeft, _ = B - R;
157
157
  if (console.log(
158
158
  "[SCROLL DEBUG] Scroll attempt:",
159
159
  h.tagName,
160
160
  "before:",
161
161
  R,
162
162
  "after:",
163
- D,
163
+ B,
164
164
  "delta:",
165
165
  _
166
166
  ), Math.abs(_) > 0.5) {
167
- v = !0, w = h, u = _, console.log(
167
+ T = !0, b = h, u = _, console.log(
168
168
  "[SCROLL DEBUG] Successfully scrolled container:",
169
169
  h.tagName,
170
170
  "delta:",
@@ -177,27 +177,27 @@ async function scrollHorizontally(e, n, s) {
177
177
  break;
178
178
  h = h.parentElement, f++;
179
179
  }
180
- return v ? `Scrolled container (${w == null ? void 0 : w.tagName}) horizontally by ${u}px` : `No horizontally scrollable container found for element (${l.tagName})`;
180
+ return T ? `Scrolled container (${b == null ? void 0 : b.tagName}) horizontally by ${u}px` : `No horizontally scrollable container found for element (${l.tagName})`;
181
181
  }
182
- const i = e ? n : -n, b = (l) => l.clientWidth >= window.innerWidth * 0.5, d = (l) => l && /(auto|scroll|overlay)/.test(getComputedStyle(l).overflowX) && l.scrollWidth > l.clientWidth && b(l);
182
+ const i = e ? n : -n, w = (l) => l.clientWidth >= window.innerWidth * 0.5, d = (l) => l && /(auto|scroll|overlay)/.test(getComputedStyle(l).overflowX) && l.scrollWidth > l.clientWidth && w(l);
183
183
  let r = document.activeElement;
184
184
  for (; r && !d(r) && r !== document.body; ) r = r.parentElement;
185
185
  if (r = d(r) ? r : Array.from(document.querySelectorAll("*")).find(d) || document.scrollingElement || document.documentElement, r === document.scrollingElement || r === document.documentElement || r === document.body) {
186
186
  const l = window.scrollX, h = document.documentElement.scrollWidth - window.innerWidth;
187
187
  window.scrollBy(i, 0);
188
- const v = window.scrollX, w = v - l;
189
- if (Math.abs(w) < 1)
188
+ const T = window.scrollX, b = T - l;
189
+ if (Math.abs(b) < 1)
190
190
  return i > 0 ? "⚠️ Already at the right edge of the page, cannot scroll right further." : "⚠️ Already at the left edge of the page, cannot scroll left further.";
191
- const u = i > 0 && v >= h - 1, f = i < 0 && v <= 1;
192
- return u ? `✅ Scrolled page by ${w}px. Reached the right edge of the page.` : f ? `✅ Scrolled page by ${w}px. Reached the left edge of the page.` : `✅ Scrolled page horizontally by ${w}px.`;
191
+ const u = i > 0 && T >= h - 1, f = i < 0 && T <= 1;
192
+ return u ? `✅ Scrolled page by ${b}px. Reached the right edge of the page.` : f ? `✅ Scrolled page by ${b}px. Reached the left edge of the page.` : `✅ Scrolled page horizontally by ${b}px.`;
193
193
  } else {
194
194
  const l = r.scrollLeft, h = r.scrollWidth - r.clientWidth;
195
195
  r.scrollBy({ left: i, behavior: "smooth" }), await waitFor(0.1);
196
- const v = r.scrollLeft, w = v - l;
197
- if (Math.abs(w) < 1)
196
+ const T = r.scrollLeft, b = T - l;
197
+ if (Math.abs(b) < 1)
198
198
  return i > 0 ? `⚠️ Already at the right edge of container (${r.tagName}), cannot scroll right further.` : `⚠️ Already at the left edge of container (${r.tagName}), cannot scroll left further.`;
199
- const u = i > 0 && v >= h - 1, f = i < 0 && v <= 1;
200
- return u ? `✅ Scrolled container (${r.tagName}) by ${w}px. Reached the right edge.` : f ? `✅ Scrolled container (${r.tagName}) by ${w}px. Reached the left edge.` : `✅ Scrolled container (${r.tagName}) horizontally by ${w}px.`;
199
+ const u = i > 0 && T >= h - 1, f = i < 0 && T <= 1;
200
+ return u ? `✅ Scrolled container (${r.tagName}) by ${b}px. Reached the right edge.` : f ? `✅ Scrolled container (${r.tagName}) by ${b}px. Reached the left edge.` : `✅ Scrolled container (${r.tagName}) horizontally by ${b}px.`;
201
201
  }
202
202
  }
203
203
  const VIEWPORT_EXPANSION = -1, domTree = (e = {
@@ -215,11 +215,11 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
215
215
  highlightOpacity: 0.1,
216
216
  highlightLabelOpacity: 0.5
217
217
  }) => {
218
- const { interactiveBlacklist: n, interactiveWhitelist: s, highlightOpacity: i, highlightLabelOpacity: b } = e, { doHighlightElements: d, focusHighlightIndex: r, viewportExpansion: l, debugMode: h } = e;
219
- let v = 0;
220
- const w = /* @__PURE__ */ new WeakMap();
218
+ const { interactiveBlacklist: n, interactiveWhitelist: s, highlightOpacity: i, highlightLabelOpacity: w } = e, { doHighlightElements: d, focusHighlightIndex: r, viewportExpansion: l, debugMode: h } = e;
219
+ let T = 0;
220
+ const b = /* @__PURE__ */ new WeakMap();
221
221
  function u(t, o) {
222
- !t || t.nodeType !== Node.ELEMENT_NODE || w.set(t, { ...w.get(t), ...o });
222
+ !t || t.nodeType !== Node.ELEMENT_NODE || b.set(t, { ...b.get(t), ...o });
223
223
  }
224
224
  const f = {
225
225
  boundingRects: /* @__PURE__ */ new WeakMap(),
@@ -229,37 +229,37 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
229
229
  f.boundingRects = /* @__PURE__ */ new WeakMap(), f.clientRects = /* @__PURE__ */ new WeakMap(), f.computedStyles = /* @__PURE__ */ new WeakMap();
230
230
  }
231
231
  };
232
- function T(t) {
232
+ function N(t) {
233
233
  if (!t) return null;
234
234
  if (f.boundingRects.has(t))
235
235
  return f.boundingRects.get(t);
236
236
  const o = t.getBoundingClientRect();
237
237
  return o && f.boundingRects.set(t, o), o;
238
238
  }
239
- function F(t) {
239
+ function D(t) {
240
240
  if (!t) return null;
241
241
  if (f.computedStyles.has(t))
242
242
  return f.computedStyles.get(t);
243
243
  const o = window.getComputedStyle(t);
244
244
  return o && f.computedStyles.set(t, o), o;
245
245
  }
246
- function P(t) {
246
+ function z(t) {
247
247
  if (!t) return null;
248
248
  if (f.clientRects.has(t))
249
249
  return f.clientRects.get(t);
250
250
  const o = t.getClientRects();
251
251
  return o && f.clientRects.set(t, o), o;
252
252
  }
253
- const O = {}, R = { current: 0 }, z = "playwright-highlight-container";
253
+ const O = {}, R = { current: 0 }, U = "playwright-highlight-container";
254
254
  function H(t, o, p = null) {
255
255
  if (!t) return o;
256
256
  const a = [];
257
- let c = null, x = 20, E = 16, M = null;
257
+ let c = null, x = 20, E = 16, I = null;
258
258
  try {
259
- let m = document.getElementById(z);
260
- m || (m = document.createElement("div"), m.id = z, m.style.position = "fixed", m.style.pointerEvents = "none", m.style.top = "0", m.style.left = "0", m.style.width = "100%", m.style.height = "100%", m.style.zIndex = "2147483640", m.style.backgroundColor = "transparent", document.body.appendChild(m));
261
- const L = t.getClientRects();
262
- if (!L || L.length === 0) return o;
259
+ let m = document.getElementById(U);
260
+ m || (m = document.createElement("div"), m.id = U, m.style.position = "fixed", m.style.pointerEvents = "none", m.style.top = "0", m.style.left = "0", m.style.width = "100%", m.style.height = "100%", m.style.zIndex = "2147483640", m.style.backgroundColor = "transparent", document.body.appendChild(m));
261
+ const $ = t.getClientRects();
262
+ if (!$ || $.length === 0) return o;
263
263
  const A = [
264
264
  "#FF0000",
265
265
  "#00FF00",
@@ -275,68 +275,70 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
275
275
  "#4682B4"
276
276
  ], g = o % A.length;
277
277
  let y = A[g];
278
- const k = y + Math.floor(i * 255).toString(16).padStart(2, "0");
279
- y = y + Math.floor(b * 255).toString(16).padStart(2, "0");
280
- let S = { x: 0, y: 0 };
278
+ const C = y + Math.floor(i * 255).toString(16).padStart(2, "0");
279
+ y = y + Math.floor(w * 255).toString(16).padStart(2, "0");
280
+ let M = { x: 0, y: 0 };
281
281
  if (p) {
282
- const I = p.getBoundingClientRect();
283
- S.x = I.left, S.y = I.top;
282
+ const k = p.getBoundingClientRect();
283
+ M.x = k.left, M.y = k.top;
284
+ }
285
+ const V = document.createDocumentFragment();
286
+ for (const k of $) {
287
+ if (k.width === 0 || k.height === 0) continue;
288
+ const S = document.createElement("div");
289
+ S.style.position = "fixed", S.style.border = `2px solid ${y}`, S.style.backgroundColor = C, S.style.pointerEvents = "none", S.style.boxSizing = "border-box";
290
+ const v = k.top + M.y, W = k.left + M.x;
291
+ S.style.top = `${v}px`, S.style.left = `${W}px`, S.style.width = `${k.width}px`, S.style.height = `${k.height}px`, V.appendChild(S), a.push({ element: S, initialRect: k });
284
292
  }
285
- const B = document.createDocumentFragment();
286
- for (const I of L) {
287
- if (I.width === 0 || I.height === 0) continue;
288
- const $ = document.createElement("div");
289
- $.style.position = "fixed", $.style.border = `2px solid ${y}`, $.style.backgroundColor = k, $.style.pointerEvents = "none", $.style.boxSizing = "border-box";
290
- const N = I.top + S.y, q = I.left + S.x;
291
- $.style.top = `${N}px`, $.style.left = `${q}px`, $.style.width = `${I.width}px`, $.style.height = `${I.height}px`, B.appendChild($), a.push({ element: $, initialRect: I });
293
+ const G = $[0];
294
+ if (w > 0) {
295
+ c = document.createElement("div"), c.className = "playwright-highlight-label", c.style.position = "fixed", c.style.background = y, c.style.color = "white", c.style.padding = "1px 4px", c.style.borderRadius = "4px", c.style.fontSize = `${Math.min(12, Math.max(8, G.height / 2))}px`, c.textContent = o.toString(), x = c.offsetWidth > 0 ? c.offsetWidth : x, E = c.offsetHeight > 0 ? c.offsetHeight : E;
296
+ const k = G.top + M.y, S = G.left + M.x;
297
+ let v = k + 2, W = S + G.width - x - 2;
298
+ (G.width < x + 4 || G.height < E + 4) && (v = k - E - 2, W = S + G.width - x, W < M.x && (W = S)), v = Math.max(0, Math.min(v, window.innerHeight - E)), W = Math.max(0, Math.min(W, window.innerWidth - x)), c.style.top = `${v}px`, c.style.left = `${W}px`, V.appendChild(c);
292
299
  }
293
- const G = L[0];
294
- c = document.createElement("div"), c.className = "playwright-highlight-label", c.style.position = "fixed", c.style.background = y, c.style.color = "white", c.style.padding = "1px 4px", c.style.borderRadius = "4px", c.style.fontSize = `${Math.min(12, Math.max(8, G.height / 2))}px`, c.textContent = o.toString(), x = c.offsetWidth > 0 ? c.offsetWidth : x, E = c.offsetHeight > 0 ? c.offsetHeight : E;
295
- const Y = G.top + S.y, Z = G.left + S.x;
296
- let j = Y + 2, J = Z + G.width - x - 2;
297
- (G.width < x + 4 || G.height < E + 4) && (j = Y - E - 2, J = Z + G.width - x, J < S.x && (J = Z)), j = Math.max(0, Math.min(j, window.innerHeight - E)), J = Math.max(0, Math.min(J, window.innerWidth - x)), c.style.top = `${j}px`, c.style.left = `${J}px`, B.appendChild(c);
298
- const it = ((I, $) => {
299
- let N = 0;
300
- return (...q) => {
301
- const V = performance.now();
302
- if (!(V - N < $))
303
- return N = V, I(...q);
300
+ const j = ((k, S) => {
301
+ let v = 0;
302
+ return (...W) => {
303
+ const P = performance.now();
304
+ if (!(P - v < S))
305
+ return v = P, k(...W);
304
306
  };
305
307
  })(() => {
306
- const I = t.getClientRects();
307
- let $ = { x: 0, y: 0 };
308
+ const k = t.getClientRects();
309
+ let S = { x: 0, y: 0 };
308
310
  if (p) {
309
- const N = p.getBoundingClientRect();
310
- $.x = N.left, $.y = N.top;
311
+ const v = p.getBoundingClientRect();
312
+ S.x = v.left, S.y = v.top;
311
313
  }
312
- if (a.forEach((N, q) => {
313
- if (q < I.length) {
314
- const V = I[q], et = V.top + $.y, K = V.left + $.x;
315
- N.element.style.top = `${et}px`, N.element.style.left = `${K}px`, N.element.style.width = `${V.width}px`, N.element.style.height = `${V.height}px`, N.element.style.display = V.width === 0 || V.height === 0 ? "none" : "block";
314
+ if (a.forEach((v, W) => {
315
+ if (W < k.length) {
316
+ const P = k[W], Z = P.top + S.y, J = P.left + S.x;
317
+ v.element.style.top = `${Z}px`, v.element.style.left = `${J}px`, v.element.style.width = `${P.width}px`, v.element.style.height = `${P.height}px`, v.element.style.display = P.width === 0 || P.height === 0 ? "none" : "block";
316
318
  } else
317
- N.element.style.display = "none";
318
- }), I.length < a.length)
319
- for (let N = I.length; N < a.length; N++)
320
- a[N].element.style.display = "none";
321
- if (c && I.length > 0) {
322
- const N = I[0], q = N.top + $.y, V = N.left + $.x;
323
- let et = q + 2, K = V + N.width - x - 2;
324
- (N.width < x + 4 || N.height < E + 4) && (et = q - E - 2, K = V + N.width - x, K < $.x && (K = V)), et = Math.max(0, Math.min(et, window.innerHeight - E)), K = Math.max(0, Math.min(K, window.innerWidth - x)), c.style.top = `${et}px`, c.style.left = `${K}px`, c.style.display = "block";
319
+ v.element.style.display = "none";
320
+ }), k.length < a.length)
321
+ for (let v = k.length; v < a.length; v++)
322
+ a[v].element.style.display = "none";
323
+ if (c && k.length > 0) {
324
+ const v = k[0], W = v.top + S.y, P = v.left + S.x;
325
+ let Z = W + 2, J = P + v.width - x - 2;
326
+ (v.width < x + 4 || v.height < E + 4) && (Z = W - E - 2, J = P + v.width - x, J < S.x && (J = P)), Z = Math.max(0, Math.min(Z, window.innerHeight - E)), J = Math.max(0, Math.min(J, window.innerWidth - x)), c.style.top = `${Z}px`, c.style.left = `${J}px`, c.style.display = "block";
325
327
  } else c && (c.style.display = "none");
326
328
  }, 16);
327
- return window.addEventListener("scroll", it, !0), window.addEventListener("resize", it), M = () => {
328
- window.removeEventListener("scroll", it, !0), window.removeEventListener("resize", it), a.forEach((I) => I.element.remove()), c && c.remove();
329
- }, m.appendChild(B), o + 1;
329
+ return window.addEventListener("scroll", j, !0), window.addEventListener("resize", j), I = () => {
330
+ window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j), a.forEach((k) => k.element.remove()), c && c.remove();
331
+ }, m.appendChild(V), o + 1;
330
332
  } finally {
331
- M && (window._highlightCleanupFunctions = window._highlightCleanupFunctions || []).push(
332
- M
333
+ I && (window._highlightCleanupFunctions = window._highlightCleanupFunctions || []).push(
334
+ I
333
335
  );
334
336
  }
335
337
  }
336
- function D(t) {
338
+ function B(t) {
337
339
  if (!t || t.nodeType !== Node.ELEMENT_NODE)
338
340
  return null;
339
- const o = F(t);
341
+ const o = D(t);
340
342
  if (!o) return null;
341
343
  const p = o.display;
342
344
  if (p === "inline" || p === "inline-block")
@@ -344,19 +346,19 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
344
346
  const a = o.overflowX, c = o.overflowY, x = a === "auto" || a === "scroll", E = c === "auto" || c === "scroll";
345
347
  if (!x && !E)
346
348
  return null;
347
- const M = t.scrollWidth - t.clientWidth, m = t.scrollHeight - t.clientHeight, L = 4;
348
- if (M < L && m < L || !E && M < L || !x && m < L)
349
+ const I = t.scrollWidth - t.clientWidth, m = t.scrollHeight - t.clientHeight, $ = 4;
350
+ if (I < $ && m < $ || !E && I < $ || !x && m < $)
349
351
  return null;
350
- const A = t.scrollTop, g = t.scrollLeft, y = t.scrollWidth - t.clientWidth - t.scrollLeft, k = t.scrollHeight - t.clientHeight - t.scrollTop, S = {
352
+ const A = t.scrollTop, g = t.scrollLeft, y = t.scrollWidth - t.clientWidth - t.scrollLeft, C = t.scrollHeight - t.clientHeight - t.scrollTop, M = {
351
353
  top: A,
352
354
  right: y,
353
- bottom: k,
355
+ bottom: C,
354
356
  left: g
355
357
  };
356
358
  return u(t, {
357
359
  scrollable: !0,
358
- scrollData: S
359
- }), S;
360
+ scrollData: M
361
+ }), M;
360
362
  }
361
363
  function _(t) {
362
364
  try {
@@ -394,14 +396,14 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
394
396
  checkVisibilityCSS: !0
395
397
  });
396
398
  } catch {
397
- const M = window.getComputedStyle(x);
398
- return M.display !== "none" && M.visibility !== "hidden" && M.opacity !== "0";
399
+ const I = window.getComputedStyle(x);
400
+ return I.display !== "none" && I.visibility !== "hidden" && I.opacity !== "0";
399
401
  }
400
402
  } catch (o) {
401
403
  return console.warn("Error checking text node visibility:", o), !1;
402
404
  }
403
405
  }
404
- function rt(t) {
406
+ function ot(t) {
405
407
  if (!t || !t.tagName) return !1;
406
408
  const o = /* @__PURE__ */ new Set([
407
409
  "body",
@@ -423,17 +425,17 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
423
425
  "template"
424
426
  ])).has(p);
425
427
  }
426
- function U(t) {
427
- const o = F(t);
428
+ function X(t) {
429
+ const o = D(t);
428
430
  return t.offsetWidth > 0 && t.offsetHeight > 0 && (o == null ? void 0 : o.visibility) !== "hidden" && (o == null ? void 0 : o.display) !== "none";
429
431
  }
430
- function C(t) {
431
- var k, S;
432
+ function L(t) {
433
+ var C, M;
432
434
  if (!t || t.nodeType !== Node.ELEMENT_NODE || n.includes(t))
433
435
  return !1;
434
436
  if (s.includes(t))
435
437
  return !0;
436
- const o = t.tagName.toLowerCase(), p = F(t), a = /* @__PURE__ */ new Set([
438
+ const o = t.tagName.toLowerCase(), p = D(t), a = /* @__PURE__ */ new Set([
437
439
  "pointer",
438
440
  // Link/clickable elements
439
441
  "move",
@@ -510,12 +512,12 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
510
512
  // 'default', // Default cursor
511
513
  // 'auto', // Browser default
512
514
  ]);
513
- function x(B) {
514
- return B.tagName.toLowerCase() === "html" ? !1 : !!(p != null && p.cursor && a.has(p.cursor));
515
+ function x(V) {
516
+ return V.tagName.toLowerCase() === "html" ? !1 : !!(p != null && p.cursor && a.has(p.cursor));
515
517
  }
516
518
  if (x(t))
517
519
  return !0;
518
- const M = /* @__PURE__ */ new Set([
520
+ const I = /* @__PURE__ */ new Set([
519
521
  "a",
520
522
  // Links
521
523
  "button",
@@ -554,15 +556,15 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
554
556
  // 'tabindex="-1"', // Removed from tab order
555
557
  // 'aria-hidden="true"' // Hidden from screen readers
556
558
  ]);
557
- if (M.has(o)) {
559
+ if (I.has(o)) {
558
560
  if (p != null && p.cursor && c.has(p.cursor))
559
561
  return !1;
560
- for (const B of m)
561
- if (t.hasAttribute(B) || t.getAttribute(B) === "true" || t.getAttribute(B) === "")
562
+ for (const V of m)
563
+ if (t.hasAttribute(V) || t.getAttribute(V) === "true" || t.getAttribute(V) === "")
562
564
  return !1;
563
565
  return !(t.disabled || t.readOnly || t.inert);
564
566
  }
565
- const L = t.getAttribute("role"), A = t.getAttribute("aria-role");
567
+ const $ = t.getAttribute("role"), A = t.getAttribute("aria-role");
566
568
  if (t.getAttribute("contenteditable") === "true" || t.isContentEditable || t.classList && (t.classList.contains("button") || t.classList.contains("dropdown-toggle") || t.getAttribute("data-index") || t.getAttribute("data-toggle") === "dropdown" || t.getAttribute("aria-haspopup") === "true"))
567
569
  return !0;
568
570
  const g = /* @__PURE__ */ new Set([
@@ -604,17 +606,17 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
604
606
  "scrollbar"
605
607
  // Scrollable control
606
608
  ]);
607
- if (M.has(o) || L && g.has(L) || A && g.has(A)) return !0;
609
+ if (I.has(o) || $ && g.has($) || A && g.has(A)) return !0;
608
610
  try {
609
611
  if (typeof getEventListeners == "function") {
610
- const Y = getEventListeners(t), Z = ["click", "mousedown", "mouseup", "dblclick"];
611
- for (const j of Z)
612
- if (Y[j] && Y[j].length > 0)
612
+ const q = getEventListeners(t), nt = ["click", "mousedown", "mouseup", "dblclick"];
613
+ for (const j of nt)
614
+ if (q[j] && q[j].length > 0)
613
615
  return !0;
614
616
  }
615
- const B = ((S = (k = t == null ? void 0 : t.ownerDocument) == null ? void 0 : k.defaultView) == null ? void 0 : S.getEventListenersForNode) || window.getEventListenersForNode;
616
- if (typeof B == "function") {
617
- const Y = B(t), Z = [
617
+ const V = ((M = (C = t == null ? void 0 : t.ownerDocument) == null ? void 0 : C.defaultView) == null ? void 0 : M.getEventListenersForNode) || window.getEventListenersForNode;
618
+ if (typeof V == "function") {
619
+ const q = V(t), nt = [
618
620
  "click",
619
621
  "mousedown",
620
622
  "mouseup",
@@ -626,23 +628,23 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
626
628
  "focus",
627
629
  "blur"
628
630
  ];
629
- for (const j of Z)
630
- for (const J of Y)
631
- if (J.type === j)
631
+ for (const j of nt)
632
+ for (const k of q)
633
+ if (k.type === j)
632
634
  return !0;
633
635
  }
634
636
  const G = ["onclick", "onmousedown", "onmouseup", "ondblclick"];
635
- for (const Y of G)
636
- if (t.hasAttribute(Y) || typeof t[Y] == "function")
637
+ for (const q of G)
638
+ if (t.hasAttribute(q) || typeof t[q] == "function")
637
639
  return !0;
638
640
  } catch {
639
641
  }
640
- return !!D(t);
642
+ return !!B(t);
641
643
  }
642
- function ot(t) {
644
+ function et(t) {
643
645
  if (l === -1)
644
646
  return !0;
645
- const o = P(t);
647
+ const o = z(t);
646
648
  if (!o || o.length === 0)
647
649
  return !1;
648
650
  let p = !1;
@@ -661,9 +663,9 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
661
663
  return !1;
662
664
  const x = t.getRootNode();
663
665
  if (x instanceof ShadowRoot) {
664
- const m = c.left + c.width / 2, L = c.top + c.height / 2;
666
+ const m = c.left + c.width / 2, $ = c.top + c.height / 2;
665
667
  try {
666
- const A = x.elementFromPoint(m, L);
668
+ const A = x.elementFromPoint(m, $);
667
669
  if (!A) return !1;
668
670
  let g = A;
669
671
  for (; g && g !== x; ) {
@@ -685,9 +687,9 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
685
687
  // { x: rect.left + margin, y: rect.bottom - margin }, // bottom left
686
688
  { x: c.right - E, y: c.bottom - E }
687
689
  // bottom right
688
- ].some(({ x: m, y: L }) => {
690
+ ].some(({ x: m, y: $ }) => {
689
691
  try {
690
- const A = document.elementFromPoint(m, L);
692
+ const A = document.elementFromPoint(m, $);
691
693
  if (!A) return !1;
692
694
  let g = A;
693
695
  for (; g && g !== document.documentElement; ) {
@@ -700,12 +702,12 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
700
702
  }
701
703
  });
702
704
  }
703
- function st(t, o) {
705
+ function it(t, o) {
704
706
  if (o === -1)
705
707
  return !0;
706
708
  const p = t.getClientRects();
707
709
  if (!p || p.length === 0) {
708
- const a = T(t);
710
+ const a = N(t);
709
711
  return !a || a.width === 0 || a.height === 0 ? !1 : !(a.bottom < -o || a.top > window.innerHeight + o || a.right < -o || a.left > window.innerWidth + o);
710
712
  }
711
713
  for (const a of p)
@@ -713,7 +715,7 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
713
715
  return !0;
714
716
  return !1;
715
717
  }
716
- function W(t) {
718
+ function F(t) {
717
719
  if (!t || t.nodeType !== Node.ELEMENT_NODE) return !1;
718
720
  const o = t.tagName.toLowerCase();
719
721
  return (/* @__PURE__ */ new Set([
@@ -727,7 +729,7 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
727
729
  "label"
728
730
  ])).has(o) ? !0 : t.hasAttribute("onclick") || t.hasAttribute("role") || t.hasAttribute("tabindex") || t.hasAttribute("aria-") || t.hasAttribute("data-action") || t.getAttribute("contenteditable") === "true";
729
731
  }
730
- const X = /* @__PURE__ */ new Set([
732
+ const Y = /* @__PURE__ */ new Set([
731
733
  "a",
732
734
  "button",
733
735
  "input",
@@ -737,7 +739,7 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
737
739
  "details",
738
740
  "label",
739
741
  "option"
740
- ]), Q = /* @__PURE__ */ new Set([
742
+ ]), K = /* @__PURE__ */ new Set([
741
743
  "button",
742
744
  "link",
743
745
  "menuitem",
@@ -756,24 +758,24 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
756
758
  "option",
757
759
  "scrollbar"
758
760
  ]);
759
- function nt(t) {
760
- if (!t || t.nodeType !== Node.ELEMENT_NODE || !U(t)) return !1;
761
+ function tt(t) {
762
+ if (!t || t.nodeType !== Node.ELEMENT_NODE || !X(t)) return !1;
761
763
  const o = t.hasAttribute("role") || t.hasAttribute("tabindex") || t.hasAttribute("onclick") || typeof t.onclick == "function", p = /\b(btn|clickable|menu|item|entry|link)\b/i.test(
762
764
  t.className || ""
763
- ), a = !!t.closest('button,a,[role="button"],.menu,.dropdown,.list,.toolbar'), c = [...t.children].some(U), x = t.parentElement && t.parentElement.isSameNode(document.body);
764
- return (C(t) || o || p) && c && a && !x;
765
+ ), a = !!t.closest('button,a,[role="button"],.menu,.dropdown,.list,.toolbar'), c = [...t.children].some(X), x = t.parentElement && t.parentElement.isSameNode(document.body);
766
+ return (L(t) || o || p) && c && a && !x;
765
767
  }
766
- function lt(t) {
768
+ function rt(t) {
767
769
  var a, c;
768
770
  if (!t || t.nodeType !== Node.ELEMENT_NODE)
769
771
  return !1;
770
772
  const o = t.tagName.toLowerCase(), p = t.getAttribute("role");
771
- if (o === "iframe" || X.has(o) || p && Q.has(p) || t.isContentEditable || t.getAttribute("contenteditable") === "true" || t.hasAttribute("data-testid") || t.hasAttribute("data-cy") || t.hasAttribute("data-test") || t.hasAttribute("onclick") || typeof t.onclick == "function")
773
+ if (o === "iframe" || Y.has(o) || p && K.has(p) || t.isContentEditable || t.getAttribute("contenteditable") === "true" || t.hasAttribute("data-testid") || t.hasAttribute("data-cy") || t.hasAttribute("data-test") || t.hasAttribute("onclick") || typeof t.onclick == "function")
772
774
  return !0;
773
775
  try {
774
776
  const x = ((c = (a = t == null ? void 0 : t.ownerDocument) == null ? void 0 : a.defaultView) == null ? void 0 : c.getEventListenersForNode) || window.getEventListenersForNode;
775
777
  if (typeof x == "function") {
776
- const M = x(t), m = [
778
+ const I = x(t), m = [
777
779
  "click",
778
780
  "mousedown",
779
781
  "mouseup",
@@ -785,9 +787,9 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
785
787
  "focus",
786
788
  "blur"
787
789
  ];
788
- for (const L of m)
789
- for (const A of M)
790
- if (A.type === L)
790
+ for (const $ of m)
791
+ for (const A of I)
792
+ if (A.type === $)
791
793
  return !0;
792
794
  }
793
795
  if ([
@@ -800,20 +802,20 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
800
802
  "oninput",
801
803
  "onfocus",
802
804
  "onblur"
803
- ].some((M) => t.hasAttribute(M)))
805
+ ].some((I) => t.hasAttribute(I)))
804
806
  return !0;
805
807
  } catch {
806
808
  }
807
- return !!nt(t);
809
+ return !!tt(t);
808
810
  }
809
- function ct(t, o, p, a) {
811
+ function st(t, o, p, a) {
810
812
  if (!t.isInteractive) return !1;
811
813
  let c = !1;
812
- return a ? lt(o) ? c = !0 : c = !1 : c = !0, c && (t.isInViewport = st(o, l), (t.isInViewport || l === -1) && (t.highlightIndex = v++, d)) ? (r >= 0 ? r === t.highlightIndex && H(o, t.highlightIndex, p) : H(o, t.highlightIndex, p), !0) : !1;
814
+ return a ? rt(o) ? c = !0 : c = !1 : c = !0, c && (t.isInViewport = it(o, l), (t.isInViewport || l === -1) && (t.highlightIndex = T++, d)) ? (r >= 0 ? r === t.highlightIndex && H(o, t.highlightIndex, p) : H(o, t.highlightIndex, p), !0) : !1;
813
815
  }
814
- function tt(t, o = null, p = !1) {
815
- var E, M, m, L, A;
816
- if (!t || t.id === z || t.nodeType !== Node.ELEMENT_NODE && t.nodeType !== Node.TEXT_NODE || !t || t.id === z || ((E = t.dataset) == null ? void 0 : E.browserUseIgnore) === "true" || t.getAttribute && t.getAttribute("aria-hidden") === "true")
816
+ function Q(t, o = null, p = !1) {
817
+ var E, I, m, $, A;
818
+ if (!t || t.id === U || t.nodeType !== Node.ELEMENT_NODE && t.nodeType !== Node.TEXT_NODE || !t || t.id === U || ((E = t.dataset) == null ? void 0 : E.browserUseIgnore) === "true" || t.getAttribute && t.getAttribute("aria-hidden") === "true")
817
819
  return null;
818
820
  if (t === document.body) {
819
821
  const g = {
@@ -822,9 +824,9 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
822
824
  xpath: "/body",
823
825
  children: []
824
826
  };
825
- for (const k of t.childNodes) {
826
- const S = tt(k, o, !1);
827
- S && g.children.push(S);
827
+ for (const C of t.childNodes) {
828
+ const M = Q(C, o, !1);
829
+ M && g.children.push(M);
828
830
  }
829
831
  const y = `${R.current++}`;
830
832
  return O[y] = g, y;
@@ -832,24 +834,24 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
832
834
  if (t.nodeType !== Node.ELEMENT_NODE && t.nodeType !== Node.TEXT_NODE)
833
835
  return null;
834
836
  if (t.nodeType === Node.TEXT_NODE) {
835
- const g = (M = t.textContent) == null ? void 0 : M.trim();
837
+ const g = (I = t.textContent) == null ? void 0 : I.trim();
836
838
  if (!g)
837
839
  return null;
838
840
  const y = t.parentElement;
839
841
  if (!y || y.tagName.toLowerCase() === "script")
840
842
  return null;
841
- const k = `${R.current++}`;
842
- return O[k] = {
843
+ const C = `${R.current++}`;
844
+ return O[C] = {
843
845
  type: "TEXT_NODE",
844
846
  text: g,
845
847
  isVisible: _(t)
846
- }, k;
848
+ }, C;
847
849
  }
848
- if (t.nodeType === Node.ELEMENT_NODE && !rt(t))
850
+ if (t.nodeType === Node.ELEMENT_NODE && !ot(t))
849
851
  return null;
850
852
  if (l !== -1 && !t.shadowRoot) {
851
- const g = T(t), y = F(t), k = y && (y.position === "fixed" || y.position === "sticky"), S = t.offsetWidth > 0 || t.offsetHeight > 0;
852
- if (!g || !k && !S && (g.bottom < -l || g.top > window.innerHeight + l || g.right < -l || g.left > window.innerWidth + l))
853
+ const g = N(t), y = D(t), C = y && (y.position === "fixed" || y.position === "sticky"), M = t.offsetWidth > 0 || t.offsetHeight > 0;
854
+ if (!g || !C && !M && (g.bottom < -l || g.top > window.innerHeight + l || g.right < -l || g.left > window.innerWidth + l))
853
855
  return null;
854
856
  }
855
857
  const a = {
@@ -861,63 +863,63 @@ const VIEWPORT_EXPANSION = -1, domTree = (e = {
861
863
  // xpath: getXPathTree(node, true),
862
864
  children: []
863
865
  };
864
- if (W(t) || t.tagName.toLowerCase() === "iframe" || t.tagName.toLowerCase() === "body") {
866
+ if (F(t) || t.tagName.toLowerCase() === "iframe" || t.tagName.toLowerCase() === "body") {
865
867
  const g = ((m = t.getAttributeNames) == null ? void 0 : m.call(t)) || [];
866
868
  for (const y of g) {
867
- const k = t.getAttribute(y);
868
- a.attributes[y] = k;
869
+ const C = t.getAttribute(y);
870
+ a.attributes[y] = C;
869
871
  }
870
872
  t.tagName.toLowerCase() === "input" && (t.type === "checkbox" || t.type === "radio") && (a.attributes.checked = t.checked ? "true" : "false");
871
873
  }
872
874
  let c = !1;
873
- if (t.nodeType === Node.ELEMENT_NODE && (a.isVisible = U(t), a.isVisible)) {
874
- a.isTopElement = ot(t);
875
+ if (t.nodeType === Node.ELEMENT_NODE && (a.isVisible = X(t), a.isVisible)) {
876
+ a.isTopElement = et(t);
875
877
  const g = t.getAttribute("role"), y = g === "menu" || g === "menubar" || g === "listbox";
876
- (a.isTopElement || y) && (a.isInteractive = C(t), c = ct(a, t, o, p), a.ref = t);
878
+ (a.isTopElement || y) && (a.isInteractive = L(t), c = st(a, t, o, p), a.ref = t);
877
879
  }
878
880
  if (t.tagName) {
879
881
  const g = t.tagName.toLowerCase();
880
882
  if (g === "iframe")
881
883
  try {
882
- const y = t.contentDocument || ((L = t.contentWindow) == null ? void 0 : L.document);
884
+ const y = t.contentDocument || (($ = t.contentWindow) == null ? void 0 : $.document);
883
885
  if (y)
884
- for (const k of y.childNodes) {
885
- const S = tt(k, t, !1);
886
- S && a.children.push(S);
886
+ for (const C of y.childNodes) {
887
+ const M = Q(C, t, !1);
888
+ M && a.children.push(M);
887
889
  }
888
890
  } catch (y) {
889
891
  console.warn("Unable to access iframe:", y);
890
892
  }
891
893
  else if (t.isContentEditable || t.getAttribute("contenteditable") === "true" || t.id === "tinymce" || t.classList.contains("mce-content-body") || g === "body" && ((A = t.getAttribute("data-id")) != null && A.startsWith("mce_")))
892
894
  for (const y of t.childNodes) {
893
- const k = tt(y, o, c);
894
- k && a.children.push(k);
895
+ const C = Q(y, o, c);
896
+ C && a.children.push(C);
895
897
  }
896
898
  else {
897
899
  if (t.shadowRoot) {
898
900
  a.shadowRoot = !0;
899
901
  for (const y of t.shadowRoot.childNodes) {
900
- const k = tt(y, o, c);
901
- k && a.children.push(k);
902
+ const C = Q(y, o, c);
903
+ C && a.children.push(C);
902
904
  }
903
905
  }
904
906
  for (const y of t.childNodes) {
905
- const S = tt(y, o, c || p);
906
- S && a.children.push(S);
907
+ const M = Q(y, o, c || p);
908
+ M && a.children.push(M);
907
909
  }
908
910
  }
909
911
  }
910
912
  if (a.tagName === "a" && a.children.length === 0 && !a.attributes.href) {
911
- const g = T(t);
913
+ const g = N(t);
912
914
  if (!(g && g.width > 0 && g.height > 0 || t.offsetWidth > 0 || t.offsetHeight > 0))
913
915
  return null;
914
916
  }
915
- a.extra = w.get(t) || null;
917
+ a.extra = b.get(t) || null;
916
918
  const x = `${R.current++}`;
917
919
  return O[x] = a, x;
918
920
  }
919
- const at = tt(document.body);
920
- return f.clearCache(), { rootId: at, map: O };
921
+ const lt = Q(document.body);
922
+ return f.clearCache(), { rootId: lt, map: O };
921
923
  }, newElementsCache = /* @__PURE__ */ new WeakMap();
922
924
  function getFlatTree(e) {
923
925
  const n = [];
@@ -935,12 +937,12 @@ function getFlatTree(e) {
935
937
  interactiveWhitelist: s,
936
938
  highlightOpacity: e.highlightOpacity ?? 0,
937
939
  highlightLabelOpacity: e.highlightLabelOpacity ?? 0.1
938
- }), b = window.location.href;
940
+ }), w = window.location.href;
939
941
  for (const d in i.map) {
940
942
  const r = i.map[d];
941
943
  if (r.isInteractive && r.ref) {
942
944
  const l = r.ref;
943
- newElementsCache.has(l) || (newElementsCache.set(l, b), r.isNew = !0);
945
+ newElementsCache.has(l) || (newElementsCache.set(l, w), r.isNew = !0);
944
946
  }
945
947
  }
946
948
  return i;
@@ -969,43 +971,43 @@ function flatTreeToString(e, n) {
969
971
  "aria-haspopup",
970
972
  "aria-controls",
971
973
  "aria-owns"
972
- ], i = [...n || [], ...s], b = (u, f) => u.length > f ? u.substring(0, f) + "..." : u, d = (u) => {
974
+ ], i = [...n || [], ...s], w = (u, f) => u.length > f ? u.substring(0, f) + "..." : u, d = (u) => {
973
975
  const f = e.map[u];
974
976
  if (!f) return null;
975
977
  if (f.type === "TEXT_NODE") {
976
- const T = f;
978
+ const N = f;
977
979
  return {
978
980
  type: "text",
979
- text: T.text,
980
- isVisible: T.isVisible,
981
+ text: N.text,
982
+ isVisible: N.isVisible,
981
983
  parent: null,
982
984
  children: []
983
985
  };
984
986
  } else {
985
- const T = f, F = [];
986
- if (T.children)
987
- for (const P of T.children) {
988
- const O = d(P);
989
- O && (O.parent = null, F.push(O));
987
+ const N = f, D = [];
988
+ if (N.children)
989
+ for (const z of N.children) {
990
+ const O = d(z);
991
+ O && (O.parent = null, D.push(O));
990
992
  }
991
993
  return {
992
994
  type: "element",
993
- tagName: T.tagName,
994
- attributes: T.attributes ?? {},
995
- isVisible: T.isVisible ?? !1,
996
- isInteractive: T.isInteractive ?? !1,
997
- isTopElement: T.isTopElement ?? !1,
998
- isNew: T.isNew ?? !1,
999
- highlightIndex: T.highlightIndex,
995
+ tagName: N.tagName,
996
+ attributes: N.attributes ?? {},
997
+ isVisible: N.isVisible ?? !1,
998
+ isInteractive: N.isInteractive ?? !1,
999
+ isTopElement: N.isTopElement ?? !1,
1000
+ isNew: N.isNew ?? !1,
1001
+ highlightIndex: N.highlightIndex,
1000
1002
  parent: null,
1001
- children: F,
1002
- extra: T.extra ?? {}
1003
+ children: D,
1004
+ extra: N.extra ?? {}
1003
1005
  };
1004
1006
  }
1005
1007
  }, r = (u, f = null) => {
1006
1008
  u.parent = f;
1007
- for (const T of u.children)
1008
- r(T, u);
1009
+ for (const N of u.children)
1010
+ r(N, u);
1009
1011
  }, l = d(e.rootId);
1010
1012
  if (!l) return "";
1011
1013
  r(l);
@@ -1017,67 +1019,67 @@ function flatTreeToString(e, n) {
1017
1019
  f = f.parent;
1018
1020
  }
1019
1021
  return !1;
1020
- }, v = (u, f, T) => {
1021
- var O, R, z, H;
1022
- let F = f;
1023
- const P = " ".repeat(f);
1022
+ }, T = (u, f, N) => {
1023
+ var O, R, U, H;
1024
+ let D = f;
1025
+ const z = " ".repeat(f);
1024
1026
  if (u.type === "element") {
1025
1027
  if (u.highlightIndex !== void 0) {
1026
- F += 1;
1027
- const D = getAllTextTillNextClickableElement(u);
1028
+ D += 1;
1029
+ const B = getAllTextTillNextClickableElement(u);
1028
1030
  let _ = "";
1029
1031
  if (i.length > 0 && u.attributes) {
1030
- const C = {};
1031
- for (const W of i) {
1032
- const X = u.attributes[W];
1033
- X && X.trim() !== "" && (C[W] = X.trim());
1032
+ const L = {};
1033
+ for (const F of i) {
1034
+ const Y = u.attributes[F];
1035
+ Y && Y.trim() !== "" && (L[F] = Y.trim());
1034
1036
  }
1035
- const ot = i.filter((W) => W in C);
1036
- if (ot.length > 1) {
1037
- const W = /* @__PURE__ */ new Set(), X = {};
1038
- for (const Q of ot) {
1039
- const nt = C[Q];
1040
- nt.length > 5 && (nt in X ? W.add(Q) : X[nt] = Q);
1037
+ const et = i.filter((F) => F in L);
1038
+ if (et.length > 1) {
1039
+ const F = /* @__PURE__ */ new Set(), Y = {};
1040
+ for (const K of et) {
1041
+ const tt = L[K];
1042
+ tt.length > 5 && (tt in Y ? F.add(K) : Y[tt] = K);
1041
1043
  }
1042
- for (const Q of W)
1043
- delete C[Q];
1044
+ for (const K of F)
1045
+ delete L[K];
1044
1046
  }
1045
- C.role === u.tagName && delete C.role;
1046
- const st = ["aria-label", "placeholder", "title"];
1047
- for (const W of st)
1048
- C[W] && C[W].toLowerCase().trim() === D.toLowerCase().trim() && delete C[W];
1049
- Object.keys(C).length > 0 && (_ = Object.entries(C).map(([W, X]) => `${W}=${b(X, 20)}`).join(" "));
1047
+ L.role === u.tagName && delete L.role;
1048
+ const it = ["aria-label", "placeholder", "title"];
1049
+ for (const F of it)
1050
+ L[F] && L[F].toLowerCase().trim() === B.toLowerCase().trim() && delete L[F];
1051
+ Object.keys(L).length > 0 && (_ = Object.entries(L).map(([F, Y]) => `${F}=${w(Y, 20)}`).join(" "));
1050
1052
  }
1051
- const rt = u.isNew ? `*[${u.highlightIndex}]` : `[${u.highlightIndex}]`;
1052
- let U = `${P}${rt}<${u.tagName ?? ""}`;
1053
- if (_ && (U += ` ${_}`), u.extra && u.extra.scrollable) {
1054
- let C = "";
1055
- (O = u.extra.scrollData) != null && O.left && (C += `left=${u.extra.scrollData.left}, `), (R = u.extra.scrollData) != null && R.top && (C += `top=${u.extra.scrollData.top}, `), (z = u.extra.scrollData) != null && z.right && (C += `right=${u.extra.scrollData.right}, `), (H = u.extra.scrollData) != null && H.bottom && (C += `bottom=${u.extra.scrollData.bottom}`), U += ` data-scrollable="${C}"`;
1053
+ const ot = u.isNew ? `*[${u.highlightIndex}]` : `[${u.highlightIndex}]`;
1054
+ let X = `${z}${ot}<${u.tagName ?? ""}`;
1055
+ if (_ && (X += ` ${_}`), u.extra && u.extra.scrollable) {
1056
+ let L = "";
1057
+ (O = u.extra.scrollData) != null && O.left && (L += `left=${u.extra.scrollData.left}, `), (R = u.extra.scrollData) != null && R.top && (L += `top=${u.extra.scrollData.top}, `), (U = u.extra.scrollData) != null && U.right && (L += `right=${u.extra.scrollData.right}, `), (H = u.extra.scrollData) != null && H.bottom && (L += `bottom=${u.extra.scrollData.bottom}`), X += ` data-scrollable="${L}"`;
1056
1058
  }
1057
- if (D) {
1058
- const C = D.trim();
1059
- _ || (U += " "), U += `>${C}`;
1060
- } else _ || (U += " ");
1061
- U += " />", T.push(U);
1059
+ if (B) {
1060
+ const L = B.trim();
1061
+ _ || (X += " "), X += `>${L}`;
1062
+ } else _ || (X += " ");
1063
+ X += " />", N.push(X);
1062
1064
  }
1063
- for (const D of u.children)
1064
- v(D, F, T);
1065
+ for (const B of u.children)
1066
+ T(B, D, N);
1065
1067
  } else if (u.type === "text") {
1066
1068
  if (h(u))
1067
1069
  return;
1068
- u.parent && u.parent.type === "element" && u.parent.isVisible && u.parent.isTopElement && T.push(`${P}${u.text ?? ""}`);
1070
+ u.parent && u.parent.type === "element" && u.parent.isVisible && u.parent.isTopElement && N.push(`${z}${u.text ?? ""}`);
1069
1071
  }
1070
- }, w = [];
1071
- return v(l, 0, w), w.join(`
1072
+ }, b = [];
1073
+ return T(l, 0, b), b.join(`
1072
1074
  `);
1073
1075
  }
1074
1076
  const getAllTextTillNextClickableElement = (e, n = -1) => {
1075
- const s = [], i = (b, d) => {
1076
- if (!(n !== -1 && d > n) && !(b.type === "element" && b !== e && b.highlightIndex !== void 0)) {
1077
- if (b.type === "text" && b.text)
1078
- s.push(b.text);
1079
- else if (b.type === "element")
1080
- for (const r of b.children)
1077
+ const s = [], i = (w, d) => {
1078
+ if (!(n !== -1 && d > n) && !(w.type === "element" && w !== e && w.highlightIndex !== void 0)) {
1079
+ if (w.type === "text" && w.text)
1080
+ s.push(w.text);
1081
+ else if (w.type === "element")
1082
+ for (const r of w.children)
1081
1083
  i(r, d + 1);
1082
1084
  }
1083
1085
  };
@@ -1087,8 +1089,8 @@ const getAllTextTillNextClickableElement = (e, n = -1) => {
1087
1089
  function getSelectorMap(e) {
1088
1090
  const n = /* @__PURE__ */ new Map(), s = Object.keys(e.map);
1089
1091
  for (const i of s) {
1090
- const b = e.map[i];
1091
- b.isInteractive && typeof b.highlightIndex == "number" && n.set(b.highlightIndex, b);
1092
+ const w = e.map[i];
1093
+ w.isInteractive && typeof w.highlightIndex == "number" && n.set(w.highlightIndex, w);
1092
1094
  }
1093
1095
  return n;
1094
1096
  }
@@ -1134,7 +1136,7 @@ function getPageInfo() {
1134
1136
  const e = window.innerWidth, n = window.innerHeight, s = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth || 0), i = Math.max(
1135
1137
  document.documentElement.scrollHeight,
1136
1138
  document.body.scrollHeight || 0
1137
- ), b = window.scrollX || window.pageXOffset || document.documentElement.scrollLeft || 0, d = window.scrollY || window.pageYOffset || document.documentElement.scrollTop || 0, r = Math.max(0, i - (window.innerHeight + d)), l = Math.max(0, s - (window.innerWidth + b));
1139
+ ), w = window.scrollX || window.pageXOffset || document.documentElement.scrollLeft || 0, d = window.scrollY || window.pageYOffset || document.documentElement.scrollTop || 0, r = Math.max(0, i - (window.innerHeight + d)), l = Math.max(0, s - (window.innerWidth + w));
1138
1140
  return {
1139
1141
  // Current viewport dimensions
1140
1142
  viewport_width: e,
@@ -1143,7 +1145,7 @@ function getPageInfo() {
1143
1145
  page_width: s,
1144
1146
  page_height: i,
1145
1147
  // Current scroll position
1146
- scroll_x: b,
1148
+ scroll_x: w,
1147
1149
  scroll_y: d,
1148
1150
  pixels_above: d,
1149
1151
  pixels_below: r,
@@ -1151,7 +1153,7 @@ function getPageInfo() {
1151
1153
  pages_below: n > 0 ? r / n : 0,
1152
1154
  total_pages: n > 0 ? i / n : 0,
1153
1155
  current_page_position: d / Math.max(1, i - n),
1154
- pixels_left: b,
1156
+ pixels_left: w,
1155
1157
  pixels_right: l
1156
1158
  };
1157
1159
  }
@@ -1171,7 +1173,7 @@ class PageController extends EventTarget {
1171
1173
  */
1172
1174
  initMask() {
1173
1175
  this.maskReady === null && (this.maskReady = (async () => {
1174
- const { SimulatorMask: e } = await import("./SimulatorMask-CgaoHOve.js");
1176
+ const { SimulatorMask: e } = await import("./SimulatorMask-74sRLkJv.js");
1175
1177
  this.mask = new e();
1176
1178
  })());
1177
1179
  }
@@ -1195,13 +1197,13 @@ class PageController extends EventTarget {
1195
1197
  async getBrowserState() {
1196
1198
  const e = window.location.href, n = document.title, s = getPageInfo(), i = this.config.viewportExpansion ?? VIEWPORT_EXPANSION;
1197
1199
  await this.updateTree();
1198
- const b = this.simplifiedHTML, d = `Current Page: [${n}](${e})`, r = `Page info: ${s.viewport_width}x${s.viewport_height}px viewport, ${s.page_width}x${s.page_height}px total page size, ${s.pages_above.toFixed(1)} pages above, ${s.pages_below.toFixed(1)} pages below, ${s.total_pages.toFixed(1)} total pages, at ${(s.current_page_position * 100).toFixed(0)}% of page`, l = i === -1 ? "Interactive elements from top layer of the current page (full page):" : "Interactive elements from top layer of the current page inside the viewport:", v = s.pixels_above > 4 && i !== -1 ? `... ${s.pixels_above} pixels above (${s.pages_above.toFixed(1)} pages) - scroll to see more ...` : "[Start of page]", w = `${d}
1200
+ const w = this.simplifiedHTML, d = `Current Page: [${n}](${e})`, r = `Page info: ${s.viewport_width}x${s.viewport_height}px viewport, ${s.page_width}x${s.page_height}px total page size, ${s.pages_above.toFixed(1)} pages above, ${s.pages_below.toFixed(1)} pages below, ${s.total_pages.toFixed(1)} total pages, at ${(s.current_page_position * 100).toFixed(0)}% of page`, l = i === -1 ? "Interactive elements from top layer of the current page (full page):" : "Interactive elements from top layer of the current page inside the viewport:", T = s.pixels_above > 4 && i !== -1 ? `... ${s.pixels_above} pixels above (${s.pages_above.toFixed(1)} pages) - scroll to see more ...` : "[Start of page]", b = `${d}
1199
1201
  ${r}
1200
1202
 
1201
1203
  ${l}
1202
1204
 
1203
- ${v}`, f = s.pixels_below > 4 && i !== -1 ? `... ${s.pixels_below} pixels below (${s.pages_below.toFixed(1)} pages) - scroll to see more ...` : "[End of page]";
1204
- return { url: e, title: n, header: w, content: b, footer: f };
1205
+ ${T}`, f = s.pixels_below > 4 && i !== -1 ? `... ${s.pixels_below} pixels below (${s.pages_below.toFixed(1)} pages) - scroll to see more ...` : "[End of page]";
1206
+ return { url: e, title: n, header: b, content: w, footer: f };
1205
1207
  }
1206
1208
  // ======= DOM Tree Operations =======
1207
1209
  /**
@@ -1297,9 +1299,9 @@ ${v}`, f = s.pixels_below > 4 && i !== -1 ? `... ${s.pixels_below} pixels below
1297
1299
  */
1298
1300
  async scroll(e) {
1299
1301
  try {
1300
- const { down: n, numPages: s, pixels: i, index: b } = e;
1302
+ const { down: n, numPages: s, pixels: i, index: w } = e;
1301
1303
  this.assertIndexed();
1302
- const d = i ?? s * (n ? 1 : -1) * window.innerHeight, r = b !== void 0 ? getElementByIndex(this.selectorMap, b) : null;
1304
+ const d = i ?? s * (n ? 1 : -1) * window.innerHeight, r = w !== void 0 ? getElementByIndex(this.selectorMap, w) : null;
1303
1305
  return {
1304
1306
  success: !0,
1305
1307
  message: await scrollVertically(n, d, r)
@@ -1318,10 +1320,10 @@ ${v}`, f = s.pixels_below > 4 && i !== -1 ? `... ${s.pixels_below} pixels below
1318
1320
  try {
1319
1321
  const { right: n, pixels: s, index: i } = e;
1320
1322
  this.assertIndexed();
1321
- const b = s * (n ? 1 : -1), d = i !== void 0 ? getElementByIndex(this.selectorMap, i) : null;
1323
+ const w = s * (n ? 1 : -1), d = i !== void 0 ? getElementByIndex(this.selectorMap, i) : null;
1322
1324
  return {
1323
1325
  success: !0,
1324
- message: await scrollHorizontally(n, b, d)
1326
+ message: await scrollHorizontally(n, w, d)
1325
1327
  };
1326
1328
  } catch (n) {
1327
1329
  return {