@xpert-ai/chatkit-host-automation 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +632 -1
- package/dist/index.js +1205 -384
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const vt = [
|
|
2
2
|
"host_page_snapshot",
|
|
3
3
|
"host_page_click",
|
|
4
4
|
"host_page_fill",
|
|
@@ -10,10 +10,441 @@ const tt = [
|
|
|
10
10
|
"host_page_focus",
|
|
11
11
|
"host_page_pointer",
|
|
12
12
|
"host_page_screenshot",
|
|
13
|
+
"host_page_read",
|
|
13
14
|
"host_page_wait_for"
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
),
|
|
15
|
+
];
|
|
16
|
+
function dt(t) {
|
|
17
|
+
return (t ?? "").replace(/\s+/g, " ").trim();
|
|
18
|
+
}
|
|
19
|
+
function J(t, e = 600) {
|
|
20
|
+
return t.length > e ? `${t.slice(0, e)}... [truncated ${t.length - e} chars]` : t;
|
|
21
|
+
}
|
|
22
|
+
function xt(t, e = 600) {
|
|
23
|
+
return t ? J(t, e) : void 0;
|
|
24
|
+
}
|
|
25
|
+
function C(t) {
|
|
26
|
+
const e = dt(t.textContent);
|
|
27
|
+
return e ? J(e) : void 0;
|
|
28
|
+
}
|
|
29
|
+
function ft(t) {
|
|
30
|
+
const e = dt(
|
|
31
|
+
Array.from(t.childNodes).filter((n) => n.nodeType === Node.TEXT_NODE).map((n) => n.textContent ?? "").join(" ")
|
|
32
|
+
);
|
|
33
|
+
return e ? J(e) : void 0;
|
|
34
|
+
}
|
|
35
|
+
function D(t) {
|
|
36
|
+
var o;
|
|
37
|
+
if (!(t instanceof HTMLElement || t instanceof SVGElement) || t instanceof HTMLElement && t.hidden)
|
|
38
|
+
return !1;
|
|
39
|
+
const e = (o = t.ownerDocument.defaultView) == null ? void 0 : o.getComputedStyle(t);
|
|
40
|
+
if (e && (e.display === "none" || e.visibility === "hidden" || e.opacity === "0"))
|
|
41
|
+
return !1;
|
|
42
|
+
const n = t.getBoundingClientRect();
|
|
43
|
+
return n.width > 0 && n.height > 0;
|
|
44
|
+
}
|
|
45
|
+
function k(t) {
|
|
46
|
+
const e = t.getBoundingClientRect();
|
|
47
|
+
return {
|
|
48
|
+
x: e.left,
|
|
49
|
+
y: e.top,
|
|
50
|
+
width: e.width,
|
|
51
|
+
height: e.height
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function _t(t) {
|
|
55
|
+
return t instanceof Document ? t : t.ownerDocument;
|
|
56
|
+
}
|
|
57
|
+
function Q(t) {
|
|
58
|
+
let e = t;
|
|
59
|
+
for (; e; ) {
|
|
60
|
+
let n = e.previousElementSibling;
|
|
61
|
+
for (; n; ) {
|
|
62
|
+
if (n.matches('h1,h2,h3,h4,h5,h6,[role="heading"]'))
|
|
63
|
+
return C(n);
|
|
64
|
+
const o = n.querySelector(
|
|
65
|
+
'h1,h2,h3,h4,h5,h6,[role="heading"]'
|
|
66
|
+
);
|
|
67
|
+
if (o)
|
|
68
|
+
return C(o);
|
|
69
|
+
n = n.previousElementSibling;
|
|
70
|
+
}
|
|
71
|
+
e = e.parentElement;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function W(t) {
|
|
75
|
+
const e = Array.from(t.children).map((n) => ft(n) ?? C(n)).filter((n) => !!n);
|
|
76
|
+
return e.length > 1 ? e : t.children.length === 1 ? W(t.children[0]) : e;
|
|
77
|
+
}
|
|
78
|
+
function Tt(t) {
|
|
79
|
+
if (Array.from(t.children).some(
|
|
80
|
+
(i) => W(i).length === 2
|
|
81
|
+
))
|
|
82
|
+
return;
|
|
83
|
+
const e = W(t);
|
|
84
|
+
if (e.length !== 2)
|
|
85
|
+
return;
|
|
86
|
+
const [n, o] = e;
|
|
87
|
+
if (!(!n || !o || n === o || n.length > 120))
|
|
88
|
+
return { name: n, value: o };
|
|
89
|
+
}
|
|
90
|
+
function St(t) {
|
|
91
|
+
return t.fields ? t.fields.slice(0, 2).map((e) => `${e.name}: ${e.value}`) : t.items ? t.items.slice(0, 2) : t.rows ? t.rows.slice(0, 2).map((e) => e.join(" | ")) : t.text ? [t.text] : [];
|
|
92
|
+
}
|
|
93
|
+
function Ct(t) {
|
|
94
|
+
return t.fields ? t.fields.length : t.items ? t.items.length : t.rows ? t.rows.length : t.text ? 1 : 0;
|
|
95
|
+
}
|
|
96
|
+
function Mt(t) {
|
|
97
|
+
return [
|
|
98
|
+
t.heading,
|
|
99
|
+
t.text,
|
|
100
|
+
...t.items ?? [],
|
|
101
|
+
...(t.fields ?? []).flatMap((e) => [e.name, e.value]),
|
|
102
|
+
...t.headers ?? [],
|
|
103
|
+
...(t.rows ?? []).flat()
|
|
104
|
+
].reduce((e, n) => e + ((n == null ? void 0 : n.length) ?? 0), 0);
|
|
105
|
+
}
|
|
106
|
+
function At(t) {
|
|
107
|
+
return t.slice(0, 80).map((e, n) => {
|
|
108
|
+
const o = Mt(e), i = `b${n + 1}`;
|
|
109
|
+
return {
|
|
110
|
+
...e,
|
|
111
|
+
blockId: i,
|
|
112
|
+
preview: St(e),
|
|
113
|
+
itemCount: Ct(e),
|
|
114
|
+
chars: o,
|
|
115
|
+
truncated: o > 4e3,
|
|
116
|
+
readHint: {
|
|
117
|
+
tool: "host_page_read",
|
|
118
|
+
args: { blockId: i }
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function Lt(t) {
|
|
124
|
+
return t.map((e, n) => ({
|
|
125
|
+
index: n,
|
|
126
|
+
blockId: e.blockId,
|
|
127
|
+
type: e.type,
|
|
128
|
+
heading: e.heading,
|
|
129
|
+
level: e.level,
|
|
130
|
+
itemCount: e.itemCount,
|
|
131
|
+
chars: e.chars,
|
|
132
|
+
truncated: e.truncated
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
function Rt(t) {
|
|
136
|
+
return t.truncated ? "block_truncated" : t.type === "keyValueList" ? "structured_fields" : t.type === "table" ? "structured_table" : t.itemCount > 2 ? "preview_incomplete" : "long_readable_block";
|
|
137
|
+
}
|
|
138
|
+
function kt(t) {
|
|
139
|
+
return (t.type === "keyValueList" ? 100 : t.type === "table" ? 90 : t.type === "list" ? 80 : t.type === "paragraph" ? 50 : 10) + (t.truncated ? 40 : 0) + Math.min(t.itemCount, 20) + Math.min(Math.floor(t.chars / 400), 20);
|
|
140
|
+
}
|
|
141
|
+
function Pt(t) {
|
|
142
|
+
return t.filter(
|
|
143
|
+
(e) => e.type !== "heading" && (e.truncated || e.itemCount > 2 || e.chars > 600)
|
|
144
|
+
).map((e, n) => ({
|
|
145
|
+
block: e,
|
|
146
|
+
index: n,
|
|
147
|
+
score: kt(e)
|
|
148
|
+
})).sort((e, n) => n.score - e.score || e.index - n.index).slice(0, 12).sort((e, n) => e.index - n.index).map(({ block: e }) => ({
|
|
149
|
+
blockId: e.blockId,
|
|
150
|
+
type: e.type,
|
|
151
|
+
heading: e.heading,
|
|
152
|
+
reason: Rt(e),
|
|
153
|
+
args: {
|
|
154
|
+
blockId: e.blockId,
|
|
155
|
+
pageSize: e.fields || e.items || e.rows ? Math.min(20, Math.max(1, e.itemCount)) : void 0
|
|
156
|
+
}
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
function Nt(t) {
|
|
160
|
+
const e = Lt(t.blocks), n = Pt(t.blocks);
|
|
161
|
+
return {
|
|
162
|
+
...t,
|
|
163
|
+
outline: e,
|
|
164
|
+
suggestedReads: n,
|
|
165
|
+
blocks: t.blocks.map((o) => ({
|
|
166
|
+
blockId: o.blockId,
|
|
167
|
+
type: o.type,
|
|
168
|
+
heading: o.heading,
|
|
169
|
+
level: o.level,
|
|
170
|
+
preview: o.preview,
|
|
171
|
+
itemCount: o.itemCount,
|
|
172
|
+
chars: o.chars,
|
|
173
|
+
truncated: o.truncated,
|
|
174
|
+
rect: o.rect,
|
|
175
|
+
readHint: o.readHint
|
|
176
|
+
}))
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function It(t, e, n) {
|
|
180
|
+
const o = [], i = _t(t).createTreeWalker(
|
|
181
|
+
t,
|
|
182
|
+
NodeFilter.SHOW_ELEMENT
|
|
183
|
+
);
|
|
184
|
+
let r = i.nextNode();
|
|
185
|
+
for (; r; ) {
|
|
186
|
+
const s = r;
|
|
187
|
+
if (D(s)) {
|
|
188
|
+
const a = Tt(s);
|
|
189
|
+
a && o.push({ ...a, element: s });
|
|
190
|
+
}
|
|
191
|
+
r = i.nextNode();
|
|
192
|
+
}
|
|
193
|
+
if (o.length !== 0) {
|
|
194
|
+
e.push({
|
|
195
|
+
type: "keyValueList",
|
|
196
|
+
heading: Q(o[0].element),
|
|
197
|
+
fields: o.slice(0, 80).map(({ name: s, value: a }) => ({ name: s, value: a })),
|
|
198
|
+
rect: k(o[0].element)
|
|
199
|
+
});
|
|
200
|
+
for (const s of o)
|
|
201
|
+
n.add(s.element);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function Ht(t, e, n) {
|
|
205
|
+
for (const o of Array.from(t.querySelectorAll('ul,ol,[role="list"]'))) {
|
|
206
|
+
if (!D(o))
|
|
207
|
+
continue;
|
|
208
|
+
const i = Array.from(o.children).map((r) => C(r)).filter((r) => !!r).slice(0, 80);
|
|
209
|
+
if (i.length !== 0) {
|
|
210
|
+
e.push({
|
|
211
|
+
type: "list",
|
|
212
|
+
heading: Q(o),
|
|
213
|
+
items: i,
|
|
214
|
+
rect: k(o)
|
|
215
|
+
}), n.add(o);
|
|
216
|
+
for (const r of Array.from(o.children))
|
|
217
|
+
n.add(r);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function Ot(t, e, n) {
|
|
222
|
+
var o;
|
|
223
|
+
for (const i of Array.from(t.querySelectorAll('table,[role="table"],[role="grid"]'))) {
|
|
224
|
+
if (!D(i))
|
|
225
|
+
continue;
|
|
226
|
+
const r = Array.from(i.querySelectorAll('tr,[role="row"]')).map(
|
|
227
|
+
(a) => Array.from(a.querySelectorAll('th,td,[role="columnheader"],[role="cell"],[role="gridcell"]')).map((u) => C(u)).filter((u) => !!u).slice(0, 12)
|
|
228
|
+
).filter((a) => a.length > 0).slice(0, 80);
|
|
229
|
+
if (r.length === 0)
|
|
230
|
+
continue;
|
|
231
|
+
const s = (o = r[0]) != null && o.every((a) => a.length <= 120) ? r[0] : void 0;
|
|
232
|
+
e.push({
|
|
233
|
+
type: "table",
|
|
234
|
+
heading: Q(i),
|
|
235
|
+
headers: s,
|
|
236
|
+
rows: s ? r.slice(1) : r,
|
|
237
|
+
rect: k(i)
|
|
238
|
+
}), n.add(i);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function Bt(t, e, n) {
|
|
242
|
+
const o = 'h1,h2,h3,h4,h5,h6,[role="heading"],p,article,section';
|
|
243
|
+
for (const i of Array.from(t.querySelectorAll(o))) {
|
|
244
|
+
if (e.length >= 80)
|
|
245
|
+
break;
|
|
246
|
+
if (n.has(i) || !D(i))
|
|
247
|
+
continue;
|
|
248
|
+
const r = i.tagName.toLowerCase(), s = ft(i) ?? C(i);
|
|
249
|
+
if (s) {
|
|
250
|
+
if (r.match(/^h[1-6]$/) || i.getAttribute("role") === "heading") {
|
|
251
|
+
const a = r.match(/^h[1-6]$/) ? Number(r.slice(1)) : Number(i.getAttribute("aria-level") ?? 0) || 2;
|
|
252
|
+
e.push({
|
|
253
|
+
type: "heading",
|
|
254
|
+
level: a,
|
|
255
|
+
text: s,
|
|
256
|
+
rect: k(i)
|
|
257
|
+
});
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
s.length >= 24 && e.push({
|
|
261
|
+
type: "paragraph",
|
|
262
|
+
text: s,
|
|
263
|
+
rect: k(i)
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function Vt(t) {
|
|
269
|
+
return t.querySelectorAll(
|
|
270
|
+
'[aria-expanded="false"],[data-expanded="false"],details:not([open]),[hidden]'
|
|
271
|
+
).length;
|
|
272
|
+
}
|
|
273
|
+
function Dt(t) {
|
|
274
|
+
return Array.from(t.querySelectorAll("iframe")).filter((e) => {
|
|
275
|
+
try {
|
|
276
|
+
return !e.contentDocument;
|
|
277
|
+
} catch {
|
|
278
|
+
return !0;
|
|
279
|
+
}
|
|
280
|
+
}).length;
|
|
281
|
+
}
|
|
282
|
+
function ot(t) {
|
|
283
|
+
const e = t instanceof Document ? t.body ?? t.documentElement : t;
|
|
284
|
+
if (!e)
|
|
285
|
+
return {
|
|
286
|
+
blocks: [],
|
|
287
|
+
totalBlocks: 0,
|
|
288
|
+
truncated: !1,
|
|
289
|
+
coverage: {
|
|
290
|
+
status: "complete",
|
|
291
|
+
visibleTextCaptured: !1,
|
|
292
|
+
truncatedBlocks: 0,
|
|
293
|
+
collapsedSections: 0,
|
|
294
|
+
crossOriginFrames: 0,
|
|
295
|
+
virtualizedListsDetected: 0,
|
|
296
|
+
visualOnlyRegions: 0
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const n = [], o = /* @__PURE__ */ new Set();
|
|
300
|
+
It(e, n, o), Ht(e, n, o), Ot(e, n, o), Bt(e, n, o);
|
|
301
|
+
const i = At(n), r = i.filter((l) => l.truncated).length, s = Vt(e), a = Dt(e), u = n.length > i.length || r > 0 || s > 0 || a > 0, d = [];
|
|
302
|
+
return s > 0 && d.push("Some content is inside collapsed sections."), a > 0 && d.push("Some frame content could not be read from DOM."), {
|
|
303
|
+
blocks: i,
|
|
304
|
+
totalBlocks: n.length,
|
|
305
|
+
truncated: n.length > i.length || r > 0,
|
|
306
|
+
coverage: {
|
|
307
|
+
status: u ? "partial" : "complete",
|
|
308
|
+
visibleTextCaptured: i.length > 0,
|
|
309
|
+
truncatedBlocks: r,
|
|
310
|
+
collapsedSections: s,
|
|
311
|
+
crossOriginFrames: a,
|
|
312
|
+
virtualizedListsDetected: 0,
|
|
313
|
+
visualOnlyRegions: 0
|
|
314
|
+
},
|
|
315
|
+
...d.length > 0 ? { warnings: d } : {}
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function I(t, e, n) {
|
|
319
|
+
const o = Math.max(1, Math.min(100, Math.floor(n))), i = Math.max(1, Math.ceil(t / o)), r = Math.max(1, Math.min(i, Math.floor(e))), s = (r - 1) * o;
|
|
320
|
+
return {
|
|
321
|
+
page: r,
|
|
322
|
+
pageSize: o,
|
|
323
|
+
pageCount: i,
|
|
324
|
+
start: s,
|
|
325
|
+
end: Math.min(t, s + o)
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function U(t) {
|
|
329
|
+
return JSON.stringify(t).length;
|
|
330
|
+
}
|
|
331
|
+
function F(t, e) {
|
|
332
|
+
const n = t[e];
|
|
333
|
+
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
334
|
+
}
|
|
335
|
+
function H(t, e) {
|
|
336
|
+
const n = t[e];
|
|
337
|
+
return typeof n == "string" && n.trim() ? n : void 0;
|
|
338
|
+
}
|
|
339
|
+
function G(t, e, n = !1) {
|
|
340
|
+
const o = {
|
|
341
|
+
...t,
|
|
342
|
+
truncated: !!t.truncated || n
|
|
343
|
+
}, i = U(o), r = {
|
|
344
|
+
...o,
|
|
345
|
+
chars: i
|
|
346
|
+
};
|
|
347
|
+
return U(r) <= e ? r : {
|
|
348
|
+
blockId: H(t, "blockId"),
|
|
349
|
+
type: H(t, "type"),
|
|
350
|
+
heading: xt(H(t, "heading"), 120),
|
|
351
|
+
scope: H(t, "scope"),
|
|
352
|
+
page: F(t, "page"),
|
|
353
|
+
pageSize: 0,
|
|
354
|
+
pageCount: F(t, "pageCount"),
|
|
355
|
+
nextPage: F(t, "nextPage"),
|
|
356
|
+
chars: i,
|
|
357
|
+
truncated: !0,
|
|
358
|
+
budgetExceeded: !0,
|
|
359
|
+
warning: "Read result exceeded maxChars; retry with a smaller pageSize or a narrower blockId/query."
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function O(t, e, n) {
|
|
363
|
+
let o = e;
|
|
364
|
+
for (; o >= 1; ) {
|
|
365
|
+
const i = n(o), r = G(
|
|
366
|
+
i,
|
|
367
|
+
t,
|
|
368
|
+
o < e
|
|
369
|
+
);
|
|
370
|
+
if (U(r) <= t)
|
|
371
|
+
return r;
|
|
372
|
+
o = Math.floor(o / 2);
|
|
373
|
+
}
|
|
374
|
+
return G(n(1), t, !0);
|
|
375
|
+
}
|
|
376
|
+
function qt(t, e = {}) {
|
|
377
|
+
var u;
|
|
378
|
+
const n = typeof e.page == "number" ? e.page : 1, o = typeof e.pageSize == "number" ? e.pageSize : 20, i = typeof e.maxChars == "number" && Number.isFinite(e.maxChars) ? Math.max(500, Math.min(12e3, Math.floor(e.maxChars))) : 4e3, r = (u = e.query) == null ? void 0 : u.trim().toLowerCase(), s = r ? t.blocks.filter(
|
|
379
|
+
(d) => JSON.stringify(d).toLowerCase().includes(r)
|
|
380
|
+
) : t.blocks, a = e.blockId ? t.blocks.find((d) => d.blockId === e.blockId) : void 0;
|
|
381
|
+
if (a) {
|
|
382
|
+
if (a.fields && a.fields.length > 0) {
|
|
383
|
+
const d = a.fields;
|
|
384
|
+
return O(i, o, (l) => {
|
|
385
|
+
const c = I(d.length, n, l);
|
|
386
|
+
return {
|
|
387
|
+
...a,
|
|
388
|
+
fields: d.slice(c.start, c.end),
|
|
389
|
+
page: c.page,
|
|
390
|
+
pageSize: c.pageSize,
|
|
391
|
+
pageCount: c.pageCount,
|
|
392
|
+
nextPage: c.page < c.pageCount ? c.page + 1 : void 0
|
|
393
|
+
};
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
if (a.items && a.items.length > 0) {
|
|
397
|
+
const d = a.items;
|
|
398
|
+
return O(i, o, (l) => {
|
|
399
|
+
const c = I(d.length, n, l);
|
|
400
|
+
return {
|
|
401
|
+
...a,
|
|
402
|
+
items: d.slice(c.start, c.end),
|
|
403
|
+
page: c.page,
|
|
404
|
+
pageSize: c.pageSize,
|
|
405
|
+
pageCount: c.pageCount,
|
|
406
|
+
nextPage: c.page < c.pageCount ? c.page + 1 : void 0
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (a.rows && a.rows.length > 0) {
|
|
411
|
+
const d = a.rows;
|
|
412
|
+
return O(i, o, (l) => {
|
|
413
|
+
const c = I(d.length, n, l);
|
|
414
|
+
return {
|
|
415
|
+
...a,
|
|
416
|
+
rows: d.slice(c.start, c.end),
|
|
417
|
+
page: c.page,
|
|
418
|
+
pageSize: c.pageSize,
|
|
419
|
+
pageCount: c.pageCount,
|
|
420
|
+
nextPage: c.page < c.pageCount ? c.page + 1 : void 0
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return G(a, i);
|
|
425
|
+
}
|
|
426
|
+
return O(i, o, (d) => {
|
|
427
|
+
const l = I(s.length, n, d);
|
|
428
|
+
return {
|
|
429
|
+
scope: "visible",
|
|
430
|
+
blocks: s.slice(l.start, l.end),
|
|
431
|
+
page: l.page,
|
|
432
|
+
pageSize: l.pageSize,
|
|
433
|
+
pageCount: l.pageCount,
|
|
434
|
+
nextPage: l.page < l.pageCount ? l.page + 1 : void 0,
|
|
435
|
+
coverage: t.coverage,
|
|
436
|
+
warnings: t.warnings
|
|
437
|
+
};
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
class Xt extends Error {
|
|
441
|
+
constructor(e, n) {
|
|
442
|
+
super(e), this.details = n;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const Ft = new Set(
|
|
446
|
+
vt
|
|
447
|
+
), zt = [
|
|
17
448
|
"a[href]",
|
|
18
449
|
"button",
|
|
19
450
|
"input",
|
|
@@ -28,96 +459,110 @@ const tt = [
|
|
|
28
459
|
"[data-testid]",
|
|
29
460
|
"[data-test-id]",
|
|
30
461
|
"[data-qa]"
|
|
31
|
-
].join(","),
|
|
32
|
-
function
|
|
33
|
-
return
|
|
462
|
+
].join(","), it = 100, jt = 1e4, $t = 6e4;
|
|
463
|
+
function Wt(t) {
|
|
464
|
+
return Ft.has(t);
|
|
34
465
|
}
|
|
35
|
-
function
|
|
466
|
+
function T(t) {
|
|
36
467
|
return t instanceof Document ? t : t.ownerDocument;
|
|
37
468
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
469
|
+
function V(t) {
|
|
470
|
+
return T(t).defaultView ?? window;
|
|
40
471
|
}
|
|
41
|
-
function
|
|
472
|
+
function b(t) {
|
|
42
473
|
return typeof t == "object" && t !== null && !Array.isArray(t) ? t : {};
|
|
43
474
|
}
|
|
44
|
-
function
|
|
475
|
+
function z(t, e) {
|
|
45
476
|
if (typeof t != "string" || t.trim() === "")
|
|
46
477
|
throw new Error(`${e} must be a non-empty string.`);
|
|
47
478
|
return t;
|
|
48
479
|
}
|
|
49
|
-
function
|
|
480
|
+
function w(t) {
|
|
50
481
|
return typeof t == "string" && t.trim() ? t : void 0;
|
|
51
482
|
}
|
|
52
|
-
function
|
|
483
|
+
function Ut(t) {
|
|
484
|
+
return t === "viewport_normalized" ? "viewport_normalized" : "viewport-css-px";
|
|
485
|
+
}
|
|
486
|
+
function rt(t, e) {
|
|
487
|
+
const n = st(e.x, "x"), o = st(e.y, "y");
|
|
488
|
+
if (Ut(e.coordinateSpace) === "viewport_normalized") {
|
|
489
|
+
const i = V(t);
|
|
490
|
+
return {
|
|
491
|
+
x: Number((n * i.innerWidth).toFixed(3)),
|
|
492
|
+
y: Number((o * i.innerHeight).toFixed(3))
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
return { x: n, y: o };
|
|
496
|
+
}
|
|
497
|
+
function B(t) {
|
|
53
498
|
return typeof t == "number" && Number.isInteger(t) ? t : void 0;
|
|
54
499
|
}
|
|
55
|
-
function
|
|
500
|
+
function st(t, e) {
|
|
56
501
|
if (typeof t != "number" || !Number.isFinite(t))
|
|
57
502
|
throw new Error(`${e} must be a finite number.`);
|
|
58
503
|
return t;
|
|
59
504
|
}
|
|
60
|
-
function
|
|
505
|
+
function A(t) {
|
|
61
506
|
return typeof t == "number" && Number.isFinite(t) ? t : void 0;
|
|
62
507
|
}
|
|
63
|
-
function
|
|
508
|
+
function at(t, e) {
|
|
64
509
|
return typeof t == "string" && e.includes(t) ? t : void 0;
|
|
65
510
|
}
|
|
66
|
-
function
|
|
511
|
+
function Gt(t) {
|
|
67
512
|
if (typeof t == "string")
|
|
68
513
|
return [t];
|
|
69
514
|
if (Array.isArray(t) && t.every((e) => typeof e == "string"))
|
|
70
515
|
return t;
|
|
71
516
|
throw new Error("value or values must be a string or an array of strings.");
|
|
72
517
|
}
|
|
73
|
-
function
|
|
518
|
+
function m(t) {
|
|
74
519
|
const e = (t.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
75
520
|
return e ? e.slice(0, 160) : void 0;
|
|
76
521
|
}
|
|
77
|
-
function
|
|
522
|
+
function q(t) {
|
|
78
523
|
const e = Array.from(t.childNodes).filter((n) => n.nodeType === Node.TEXT_NODE).map((n) => n.textContent ?? "").join(" ").replace(/\s+/g, " ").trim();
|
|
79
524
|
return e ? e.slice(0, 160) : void 0;
|
|
80
525
|
}
|
|
81
|
-
function
|
|
526
|
+
function Z(t) {
|
|
82
527
|
if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement)
|
|
83
528
|
return t.value;
|
|
84
529
|
}
|
|
85
|
-
function
|
|
530
|
+
function ht(t) {
|
|
86
531
|
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio");
|
|
87
532
|
}
|
|
88
|
-
function
|
|
533
|
+
function Yt(t) {
|
|
89
534
|
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? Array.from(t.labels ?? []) : [];
|
|
90
535
|
}
|
|
91
|
-
function
|
|
536
|
+
function Kt(t, e) {
|
|
92
537
|
var o;
|
|
93
|
-
return (((o = t.getAttribute(e)) == null ? void 0 : o.trim().split(/\s+/)) ?? []).map((
|
|
538
|
+
return (((o = t.getAttribute(e)) == null ? void 0 : o.trim().split(/\s+/)) ?? []).map((i) => t.ownerDocument.getElementById(i)).filter((i) => !!i).map((i) => m(i)).filter((i) => !!i);
|
|
94
539
|
}
|
|
95
|
-
function
|
|
96
|
-
const e =
|
|
540
|
+
function Jt(t) {
|
|
541
|
+
const e = Kt(t, "aria-labelledby");
|
|
97
542
|
if (e.length > 0)
|
|
98
543
|
return e.join(" ").slice(0, 160);
|
|
99
|
-
const n =
|
|
544
|
+
const n = Yt(t).map((o) => m(o)).filter((o) => !!o);
|
|
100
545
|
if (n.length > 0)
|
|
101
546
|
return n.join(" ").slice(0, 160);
|
|
102
547
|
}
|
|
103
|
-
function
|
|
548
|
+
function Qt(t) {
|
|
104
549
|
const e = [];
|
|
105
550
|
let n = t.nextSibling;
|
|
106
551
|
for (; n; ) {
|
|
107
552
|
if (n.nodeType === Node.TEXT_NODE) {
|
|
108
|
-
const
|
|
109
|
-
|
|
553
|
+
const i = (n.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
554
|
+
i && e.push(i);
|
|
110
555
|
} else {
|
|
111
556
|
if (n.nodeType === Node.ELEMENT_NODE && n.tagName.toLowerCase() === "br")
|
|
112
557
|
break;
|
|
113
558
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
559
|
+
const i = n;
|
|
560
|
+
if (i.matches(
|
|
116
561
|
'input,textarea,select,button,a[href],[role="button"],[role="link"]'
|
|
117
562
|
))
|
|
118
563
|
break;
|
|
119
|
-
const
|
|
120
|
-
|
|
564
|
+
const r = m(i);
|
|
565
|
+
r && e.push(r);
|
|
121
566
|
break;
|
|
122
567
|
}
|
|
123
568
|
}
|
|
@@ -128,94 +573,94 @@ function dt(t) {
|
|
|
128
573
|
const o = e.join(" ").replace(/\s+/g, " ").trim();
|
|
129
574
|
return o ? o.slice(0, 160) : void 0;
|
|
130
575
|
}
|
|
131
|
-
function
|
|
576
|
+
function ct(t, e) {
|
|
132
577
|
var d;
|
|
133
578
|
const n = t.ownerDocument, o = n.body;
|
|
134
579
|
if (!o)
|
|
135
580
|
return;
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
581
|
+
const i = t.getBoundingClientRect();
|
|
582
|
+
if (i.width <= 0 || i.height <= 0)
|
|
138
583
|
return;
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const l =
|
|
143
|
-
if (l !== t && !l.contains(t) &&
|
|
144
|
-
const
|
|
584
|
+
const r = i.top + i.height / 2, s = [], a = n.createTreeWalker(o, NodeFilter.SHOW_ELEMENT);
|
|
585
|
+
let u = a.nextNode();
|
|
586
|
+
for (; u; ) {
|
|
587
|
+
const l = u;
|
|
588
|
+
if (l !== t && !l.contains(t) && tt(l)) {
|
|
589
|
+
const c = l.getBoundingClientRect(), f = q(l) ?? m(l);
|
|
145
590
|
if (f) {
|
|
146
|
-
const h =
|
|
147
|
-
|
|
591
|
+
const h = c.top + c.height / 2, y = Math.abs(h - r) <= Math.max(28, i.height * 1.25), p = e === "left" ? i.left - c.right : c.left - i.right;
|
|
592
|
+
y && p >= -8 && p <= 240 && s.push({
|
|
148
593
|
text: f,
|
|
149
|
-
score: Math.abs(
|
|
594
|
+
score: Math.abs(p) + Math.abs(h - r)
|
|
150
595
|
});
|
|
151
596
|
}
|
|
152
597
|
}
|
|
153
|
-
|
|
598
|
+
u = a.nextNode();
|
|
154
599
|
}
|
|
155
|
-
return (d =
|
|
600
|
+
return (d = s.sort((l, c) => l.score - c.score)[0]) == null ? void 0 : d.text;
|
|
156
601
|
}
|
|
157
|
-
function
|
|
602
|
+
function X(t) {
|
|
158
603
|
if (!(t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement))
|
|
159
604
|
return;
|
|
160
|
-
const e =
|
|
161
|
-
return e || (
|
|
605
|
+
const e = Jt(t);
|
|
606
|
+
return e || (ht(t) ? ct(t, "right") ?? Qt(t) ?? P(t)[0] : ct(t, "left") ?? P(t)[0]);
|
|
162
607
|
}
|
|
163
|
-
function
|
|
608
|
+
function lt(t, e) {
|
|
164
609
|
const n = e.trim().toLowerCase();
|
|
165
610
|
return t instanceof HTMLInputElement && t.type === "radio" ? n === "radio" || n === "radio button" : t instanceof HTMLInputElement && t.type === "checkbox" ? n === "checkbox" || n === "check box" : t instanceof HTMLSelectElement ? n === "select" || n === "select menu" || n === "combobox" || n === "combo box" : !1;
|
|
166
611
|
}
|
|
167
612
|
function x(t) {
|
|
168
|
-
const e =
|
|
169
|
-
if (n != null && n.trim() && !
|
|
613
|
+
const e = X(t), n = t.getAttribute("aria-label");
|
|
614
|
+
if (n != null && n.trim() && !lt(t, n))
|
|
170
615
|
return n.trim();
|
|
171
616
|
const o = t.getAttribute("title");
|
|
172
|
-
if (o != null && o.trim() && !
|
|
617
|
+
if (o != null && o.trim() && !lt(t, o))
|
|
173
618
|
return o.trim();
|
|
174
619
|
if (e)
|
|
175
620
|
return e;
|
|
176
|
-
const
|
|
177
|
-
return
|
|
621
|
+
const i = P(t)[0];
|
|
622
|
+
return i || m(t);
|
|
178
623
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!(t instanceof HTMLElement || t instanceof SVGElement) || !
|
|
624
|
+
function tt(t) {
|
|
625
|
+
if (!(t instanceof HTMLElement || t instanceof SVGElement) || !S(t) || t.matches(
|
|
181
626
|
'input,textarea,select,button,a[href],[role="button"],[role="link"]'
|
|
182
627
|
))
|
|
183
628
|
return !1;
|
|
184
|
-
const e =
|
|
629
|
+
const e = q(t) ?? m(t);
|
|
185
630
|
return !!(e && e.length <= 120);
|
|
186
631
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (!
|
|
632
|
+
function pt(t) {
|
|
633
|
+
var c;
|
|
634
|
+
if (!ht(t))
|
|
190
635
|
return;
|
|
191
|
-
const e = t.closest("fieldset"), n = e == null ? void 0 : e.querySelector("legend"), o = n ?
|
|
636
|
+
const e = t.closest("fieldset"), n = e == null ? void 0 : e.querySelector("legend"), o = n ? m(n) : void 0;
|
|
192
637
|
if (o)
|
|
193
638
|
return o;
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
639
|
+
const i = t.ownerDocument, r = i.body;
|
|
640
|
+
if (!r)
|
|
196
641
|
return;
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
642
|
+
const s = t.getBoundingClientRect();
|
|
643
|
+
if (s.width <= 0 || s.height <= 0)
|
|
199
644
|
return;
|
|
200
|
-
const
|
|
645
|
+
const a = s.left + s.width / 2, u = [], d = i.createTreeWalker(r, NodeFilter.SHOW_ELEMENT);
|
|
201
646
|
let l = d.nextNode();
|
|
202
647
|
for (; l; ) {
|
|
203
648
|
const f = l;
|
|
204
|
-
if (f !== t && !f.contains(t) && f.matches('legend,strong,b,[role="heading"],h1,h2,h3,h4,h5,h6') &&
|
|
205
|
-
const h = f.getBoundingClientRect(),
|
|
206
|
-
if (
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
text:
|
|
210
|
-
score:
|
|
649
|
+
if (f !== t && !f.contains(t) && f.matches('legend,strong,b,[role="heading"],h1,h2,h3,h4,h5,h6') && tt(f)) {
|
|
650
|
+
const h = f.getBoundingClientRect(), y = q(f) ?? m(f);
|
|
651
|
+
if (y && h.bottom <= s.top + 8) {
|
|
652
|
+
const p = s.top - h.bottom, E = h.left + h.width / 2;
|
|
653
|
+
p <= 160 && E >= s.left - 120 && E <= s.right + 320 && u.push({
|
|
654
|
+
text: y,
|
|
655
|
+
score: p + Math.abs(E - a) * 0.25
|
|
211
656
|
});
|
|
212
657
|
}
|
|
213
658
|
}
|
|
214
659
|
l = d.nextNode();
|
|
215
660
|
}
|
|
216
|
-
return (
|
|
661
|
+
return (c = u.sort((f, h) => f.score - h.score)[0]) == null ? void 0 : c.text;
|
|
217
662
|
}
|
|
218
|
-
function
|
|
663
|
+
function Zt(t) {
|
|
219
664
|
if (!(t instanceof HTMLSelectElement))
|
|
220
665
|
return;
|
|
221
666
|
const e = Array.from(t.options).map((n) => ({
|
|
@@ -226,42 +671,42 @@ function gt(t) {
|
|
|
226
671
|
}));
|
|
227
672
|
return e.length ? e : void 0;
|
|
228
673
|
}
|
|
229
|
-
function
|
|
674
|
+
function te(t) {
|
|
230
675
|
if (!(t instanceof HTMLSelectElement))
|
|
231
676
|
return;
|
|
232
677
|
const e = t.selectedOptions[0], n = e ? (e.label || e.textContent || e.value).replace(/\s+/g, " ").trim() : void 0;
|
|
233
678
|
return n ? n.slice(0, 160) : void 0;
|
|
234
679
|
}
|
|
235
|
-
function
|
|
680
|
+
function P(t) {
|
|
236
681
|
const e = t.ownerDocument, n = e.body;
|
|
237
682
|
if (!n)
|
|
238
683
|
return [];
|
|
239
684
|
const o = t.getBoundingClientRect();
|
|
240
685
|
if (o.width <= 0 || o.height <= 0)
|
|
241
686
|
return [];
|
|
242
|
-
const
|
|
243
|
-
let
|
|
244
|
-
for (;
|
|
245
|
-
const l =
|
|
246
|
-
if (l !== t && !l.contains(t) &&
|
|
247
|
-
const
|
|
687
|
+
const i = o.top + o.height / 2, r = o.left + o.width / 2, s = [], a = e.createTreeWalker(n, NodeFilter.SHOW_ELEMENT);
|
|
688
|
+
let u = a.nextNode();
|
|
689
|
+
for (; u; ) {
|
|
690
|
+
const l = u;
|
|
691
|
+
if (l !== t && !l.contains(t) && tt(l)) {
|
|
692
|
+
const c = l.getBoundingClientRect(), f = q(l) ?? m(l);
|
|
248
693
|
if (f) {
|
|
249
|
-
const h =
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
694
|
+
const h = c.top + c.height / 2, y = c.left + c.width / 2, p = c.right <= o.left + 12 && Math.abs(h - i) <= Math.max(28, o.height * 1.25), E = c.left >= o.right - 8 && c.left - o.right <= 240 && Math.abs(h - i) <= Math.max(28, o.height * 1.25), nt = c.bottom <= o.top + 8 && o.top - c.bottom <= 80 && y >= o.left - 80 && y <= o.right + 80;
|
|
695
|
+
if (p || E || nt) {
|
|
696
|
+
const wt = p ? o.left - c.right + Math.abs(h - i) : E ? c.left - o.right + Math.abs(h - i) : o.top - c.bottom + Math.abs(y - r);
|
|
697
|
+
s.push({
|
|
253
698
|
text: f,
|
|
254
|
-
score:
|
|
699
|
+
score: wt + (p ? 0 : E ? 5 : 100)
|
|
255
700
|
});
|
|
256
701
|
}
|
|
257
702
|
}
|
|
258
703
|
}
|
|
259
|
-
|
|
704
|
+
u = a.nextNode();
|
|
260
705
|
}
|
|
261
706
|
const d = /* @__PURE__ */ new Set();
|
|
262
|
-
return
|
|
707
|
+
return s.sort((l, c) => l.score - c.score).map((l) => l.text).filter((l) => d.has(l) ? !1 : (d.add(l), !0)).slice(0, 4);
|
|
263
708
|
}
|
|
264
|
-
function
|
|
709
|
+
function ee(t) {
|
|
265
710
|
return t.getAttribute("data-testid") ?? t.getAttribute("data-test-id") ?? t.getAttribute("data-qa") ?? void 0;
|
|
266
711
|
}
|
|
267
712
|
function M(t) {
|
|
@@ -288,65 +733,65 @@ function M(t) {
|
|
|
288
733
|
return "textbox";
|
|
289
734
|
}
|
|
290
735
|
}
|
|
291
|
-
function
|
|
736
|
+
function gt(t) {
|
|
292
737
|
return t instanceof HTMLButtonElement || t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.disabled || void 0 : t.getAttribute("aria-disabled") === "true" || void 0;
|
|
293
738
|
}
|
|
294
|
-
function
|
|
739
|
+
function ne(t) {
|
|
295
740
|
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked : void 0;
|
|
296
741
|
}
|
|
297
|
-
function
|
|
298
|
-
const e =
|
|
742
|
+
function oe(t) {
|
|
743
|
+
const e = N(t);
|
|
299
744
|
if (!(e.width <= 0 || e.height <= 0))
|
|
300
745
|
return {
|
|
301
746
|
x: e.x + e.width / 2,
|
|
302
747
|
y: e.y + e.height / 2
|
|
303
748
|
};
|
|
304
749
|
}
|
|
305
|
-
function
|
|
750
|
+
function _(t) {
|
|
306
751
|
return {
|
|
307
752
|
tag: t.tagName.toLowerCase(),
|
|
308
753
|
role: M(t),
|
|
309
754
|
name: x(t),
|
|
310
|
-
selector:
|
|
755
|
+
selector: Y(t)
|
|
311
756
|
};
|
|
312
757
|
}
|
|
313
|
-
function
|
|
758
|
+
function S(t) {
|
|
314
759
|
if (!(t instanceof HTMLElement || t instanceof SVGElement) || t instanceof HTMLElement && t.hidden)
|
|
315
760
|
return !1;
|
|
316
761
|
const e = t.ownerDocument.defaultView, n = e == null ? void 0 : e.getComputedStyle(t);
|
|
317
762
|
return !(n && (n.display === "none" || n.visibility === "hidden" || n.opacity === "0"));
|
|
318
763
|
}
|
|
319
|
-
function
|
|
320
|
-
return t.matches(
|
|
764
|
+
function mt(t) {
|
|
765
|
+
return t.matches(zt) && S(t);
|
|
321
766
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
767
|
+
function ie(t) {
|
|
768
|
+
return gt(t) !== !0;
|
|
324
769
|
}
|
|
325
|
-
function
|
|
770
|
+
function re(t) {
|
|
326
771
|
var n;
|
|
327
|
-
if (
|
|
772
|
+
if (mt(t))
|
|
328
773
|
return !0;
|
|
329
774
|
if (!(t instanceof HTMLElement))
|
|
330
775
|
return !1;
|
|
331
776
|
const e = (n = t.ownerDocument.defaultView) == null ? void 0 : n.getComputedStyle(t);
|
|
332
|
-
return ((e == null ? void 0 : e.cursor) === "pointer" || !!t.onclick) &&
|
|
777
|
+
return ((e == null ? void 0 : e.cursor) === "pointer" || !!t.onclick) && S(t);
|
|
333
778
|
}
|
|
334
|
-
function
|
|
335
|
-
var
|
|
779
|
+
function N(t) {
|
|
780
|
+
var r, s;
|
|
336
781
|
const e = t.getBoundingClientRect();
|
|
337
|
-
let n = e.left, o = e.top,
|
|
782
|
+
let n = e.left, o = e.top, i = null;
|
|
338
783
|
try {
|
|
339
|
-
|
|
784
|
+
i = ((r = t.ownerDocument.defaultView) == null ? void 0 : r.frameElement) ?? null;
|
|
340
785
|
} catch {
|
|
341
|
-
|
|
786
|
+
i = null;
|
|
342
787
|
}
|
|
343
|
-
for (;
|
|
344
|
-
const
|
|
345
|
-
n +=
|
|
788
|
+
for (; i; ) {
|
|
789
|
+
const a = i.getBoundingClientRect();
|
|
790
|
+
n += a.left, o += a.top;
|
|
346
791
|
try {
|
|
347
|
-
|
|
792
|
+
i = ((s = i.ownerDocument.defaultView) == null ? void 0 : s.frameElement) ?? null;
|
|
348
793
|
} catch {
|
|
349
|
-
|
|
794
|
+
i = null;
|
|
350
795
|
}
|
|
351
796
|
}
|
|
352
797
|
return {
|
|
@@ -356,21 +801,21 @@ function k(t) {
|
|
|
356
801
|
height: e.height
|
|
357
802
|
};
|
|
358
803
|
}
|
|
359
|
-
function
|
|
804
|
+
function Y(t) {
|
|
360
805
|
const e = (o) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(o) : o.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
361
806
|
if (t.id)
|
|
362
807
|
return `#${e(t.id)}`;
|
|
363
808
|
for (const o of ["data-testid", "data-test-id", "data-qa"]) {
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
return `[${o}="${e(
|
|
809
|
+
const i = t.getAttribute(o);
|
|
810
|
+
if (i)
|
|
811
|
+
return `[${o}="${e(i)}"]`;
|
|
367
812
|
}
|
|
368
813
|
const n = t.getAttribute("name");
|
|
369
814
|
return n ? `${t.tagName.toLowerCase()}[name="${e(
|
|
370
815
|
n
|
|
371
816
|
)}"]` : t.tagName.toLowerCase();
|
|
372
817
|
}
|
|
373
|
-
function
|
|
818
|
+
function se(t) {
|
|
374
819
|
const e = t.getBoundingClientRect();
|
|
375
820
|
if (!(e.width <= 0 || e.height <= 0))
|
|
376
821
|
return {
|
|
@@ -378,7 +823,7 @@ function vt(t) {
|
|
|
378
823
|
y: e.top + e.height / 2
|
|
379
824
|
};
|
|
380
825
|
}
|
|
381
|
-
function
|
|
826
|
+
function yt(t, e) {
|
|
382
827
|
if (typeof t.elementsFromPoint == "function")
|
|
383
828
|
return t.elementsFromPoint(e.x, e.y);
|
|
384
829
|
if (typeof t.elementFromPoint != "function")
|
|
@@ -386,28 +831,31 @@ function Q(t, e) {
|
|
|
386
831
|
const n = t.elementFromPoint(e.x, e.y);
|
|
387
832
|
return n ? [n] : [];
|
|
388
833
|
}
|
|
389
|
-
function
|
|
834
|
+
function ae(t) {
|
|
390
835
|
return typeof t.elementsFromPoint == "function" || typeof t.elementFromPoint == "function";
|
|
391
836
|
}
|
|
392
|
-
function
|
|
837
|
+
function ce(t, e) {
|
|
393
838
|
return t === e || t.contains(e);
|
|
394
839
|
}
|
|
395
|
-
function
|
|
840
|
+
function le(t) {
|
|
396
841
|
let e = t;
|
|
397
842
|
for (; e; ) {
|
|
398
|
-
if (
|
|
843
|
+
if (re(e))
|
|
399
844
|
return e;
|
|
400
845
|
e = e.parentElement;
|
|
401
846
|
}
|
|
402
847
|
return t;
|
|
403
848
|
}
|
|
404
|
-
function
|
|
849
|
+
function ut(t) {
|
|
405
850
|
return (t ?? "").replace(/\([^)]*\)/g, "").replace(/\s+/g, "").trim().toLowerCase();
|
|
406
851
|
}
|
|
407
|
-
function
|
|
852
|
+
function K(t) {
|
|
853
|
+
return bt(t)[0];
|
|
854
|
+
}
|
|
855
|
+
function bt(t) {
|
|
408
856
|
const e = t.getBoundingClientRect();
|
|
409
857
|
if (e.width <= 0 || e.height <= 0)
|
|
410
|
-
return;
|
|
858
|
+
return [];
|
|
411
859
|
const n = t.ownerDocument;
|
|
412
860
|
return [
|
|
413
861
|
{ x: e.left + e.width / 2, y: e.top + e.height / 2 },
|
|
@@ -415,101 +863,162 @@ function V(t) {
|
|
|
415
863
|
{ x: e.right - Math.min(8, e.width / 2), y: e.top + e.height / 2 },
|
|
416
864
|
{ x: e.left + e.width / 2, y: e.top + Math.min(8, e.height / 2) },
|
|
417
865
|
{ x: e.left + e.width / 2, y: e.bottom - Math.min(8, e.height / 2) }
|
|
418
|
-
].
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
);
|
|
866
|
+
].filter((i) => {
|
|
867
|
+
const r = yt(n, i)[0];
|
|
868
|
+
return r ? ce(t, r) : !1;
|
|
869
|
+
});
|
|
423
870
|
}
|
|
424
|
-
function
|
|
425
|
-
const n = t.getBoundingClientRect(), o =
|
|
871
|
+
function Et(t, e) {
|
|
872
|
+
const n = t.getBoundingClientRect(), o = N(t);
|
|
426
873
|
return {
|
|
427
874
|
x: e.x + o.x - n.left,
|
|
428
875
|
y: e.y + o.y - n.top
|
|
429
876
|
};
|
|
430
877
|
}
|
|
431
|
-
function
|
|
432
|
-
var
|
|
433
|
-
const n = M(e), o =
|
|
434
|
-
return o ? ((
|
|
435
|
-
const
|
|
436
|
-
return n &&
|
|
437
|
-
}).map((
|
|
438
|
-
candidate:
|
|
439
|
-
point:
|
|
440
|
-
rect:
|
|
878
|
+
function ue(t, e) {
|
|
879
|
+
var r;
|
|
880
|
+
const n = M(e), o = ut(x(e));
|
|
881
|
+
return o ? ((r = et(t).filter((s) => s !== e).filter((s) => {
|
|
882
|
+
const a = M(s), u = ut(x(s));
|
|
883
|
+
return n && a && n !== a ? !1 : u.includes(o) || o.includes(u);
|
|
884
|
+
}).map((s) => ({
|
|
885
|
+
candidate: s,
|
|
886
|
+
point: K(s),
|
|
887
|
+
rect: N(s)
|
|
441
888
|
})).filter(
|
|
442
|
-
(
|
|
443
|
-
).sort((
|
|
889
|
+
(s) => !!s.point
|
|
890
|
+
).sort((s, a) => a.rect.y - s.rect.y)[0]) == null ? void 0 : r.candidate) ?? null : null;
|
|
444
891
|
}
|
|
445
|
-
function
|
|
446
|
-
const e = t.ownerDocument, n =
|
|
892
|
+
function g(t) {
|
|
893
|
+
const e = t.ownerDocument, n = se(t), o = S(t) && !!n, i = ie(t), r = n ? yt(e, n) : [], s = r[0], a = bt(t).map(
|
|
894
|
+
(d) => Et(t, d)
|
|
895
|
+
), u = a.length > 0;
|
|
447
896
|
return {
|
|
448
897
|
visible: o,
|
|
449
|
-
enabled:
|
|
450
|
-
receivesEvents:
|
|
451
|
-
actionable: o &&
|
|
452
|
-
center:
|
|
453
|
-
hitTarget:
|
|
454
|
-
hitStack:
|
|
898
|
+
enabled: i,
|
|
899
|
+
receivesEvents: u,
|
|
900
|
+
actionable: o && i && u,
|
|
901
|
+
center: oe(t),
|
|
902
|
+
hitTarget: s,
|
|
903
|
+
hitStack: r,
|
|
904
|
+
safeClickPoints: a,
|
|
905
|
+
occludedBy: o && i && !u ? s : void 0
|
|
455
906
|
};
|
|
456
907
|
}
|
|
457
|
-
function
|
|
458
|
-
var
|
|
459
|
-
const n =
|
|
908
|
+
function de(t, e) {
|
|
909
|
+
var a, u, d;
|
|
910
|
+
const n = w(e.testId);
|
|
460
911
|
if (n) {
|
|
461
|
-
const l = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(n) : n.replaceAll("\\", "\\\\").replaceAll('"', '\\"'),
|
|
912
|
+
const l = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(n) : n.replaceAll("\\", "\\\\").replaceAll('"', '\\"'), c = t.querySelector(
|
|
462
913
|
`[data-testid="${l}"],[data-test-id="${l}"],[data-qa="${l}"]`
|
|
463
914
|
);
|
|
464
|
-
if (
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
const o = (
|
|
468
|
-
return !o && !
|
|
469
|
-
var
|
|
470
|
-
const
|
|
471
|
-
return !(o &&
|
|
915
|
+
if (c)
|
|
916
|
+
return c;
|
|
917
|
+
}
|
|
918
|
+
const o = (a = w(e.role)) == null ? void 0 : a.toLowerCase(), i = (u = w(e.name)) == null ? void 0 : u.toLowerCase(), r = (d = w(e.text)) == null ? void 0 : d.toLowerCase();
|
|
919
|
+
return !o && !i && !r ? null : et(t).find((l) => {
|
|
920
|
+
var y, p, E;
|
|
921
|
+
const c = (y = M(l)) == null ? void 0 : y.toLowerCase(), f = (p = x(l)) == null ? void 0 : p.toLowerCase(), h = (E = m(l)) == null ? void 0 : E.toLowerCase();
|
|
922
|
+
return !(o && c !== o || i && !(f != null && f.includes(i)) || r && !(h != null && h.includes(r)));
|
|
472
923
|
}) ?? null;
|
|
473
924
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
925
|
+
function fe(t) {
|
|
926
|
+
return [
|
|
927
|
+
x(t),
|
|
928
|
+
X(t),
|
|
929
|
+
pt(t),
|
|
930
|
+
m(t),
|
|
931
|
+
Z(t)
|
|
932
|
+
].filter((e) => !!e).join(" ").toLowerCase();
|
|
933
|
+
}
|
|
934
|
+
function he(t, e) {
|
|
935
|
+
const n = e.trim().toLowerCase();
|
|
936
|
+
let o = t, i = 0;
|
|
937
|
+
for (; o && i < 5; ) {
|
|
938
|
+
const r = o.tagName.toLowerCase();
|
|
939
|
+
if (r === "body" || r === "html")
|
|
940
|
+
return !1;
|
|
941
|
+
if (fe(o).includes(n))
|
|
942
|
+
return !0;
|
|
943
|
+
o = o.parentElement, i += 1;
|
|
944
|
+
}
|
|
945
|
+
return !1;
|
|
946
|
+
}
|
|
947
|
+
function pe(t) {
|
|
948
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
949
|
+
return;
|
|
950
|
+
const e = t;
|
|
951
|
+
if (e.type === "field_contains" && typeof e.field == "string" && e.field.trim() && typeof e.value == "string")
|
|
952
|
+
return {
|
|
953
|
+
type: "field_contains",
|
|
954
|
+
field: e.field,
|
|
955
|
+
value: e.value
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
function ge(t, e) {
|
|
959
|
+
const n = e.trim().toLowerCase();
|
|
960
|
+
return Array.from(t.querySelectorAll("input,textarea,select")).find(
|
|
961
|
+
(o) => [
|
|
962
|
+
X(o),
|
|
963
|
+
x(o),
|
|
964
|
+
o.getAttribute("name") ?? void 0,
|
|
965
|
+
o.getAttribute("placeholder") ?? void 0,
|
|
966
|
+
...P(o)
|
|
967
|
+
].some(
|
|
968
|
+
(r) => r == null ? void 0 : r.trim().toLowerCase().includes(n)
|
|
969
|
+
)
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
function me(t, e) {
|
|
973
|
+
if (!e)
|
|
974
|
+
return;
|
|
975
|
+
const n = ge(t, e.field), o = n ? Z(n) ?? "" : void 0;
|
|
976
|
+
return {
|
|
977
|
+
...e,
|
|
978
|
+
ok: typeof o == "string" && o.toLowerCase().includes(e.value.toLowerCase()),
|
|
979
|
+
actual: o,
|
|
980
|
+
matchedField: n ? _(n) : void 0
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
function et(t) {
|
|
984
|
+
const e = t instanceof Element ? t.ownerDocument : T(t), n = t instanceof Document ? t.body ?? t.documentElement : t;
|
|
476
985
|
if (!n)
|
|
477
986
|
return [];
|
|
478
|
-
const o = [],
|
|
479
|
-
const
|
|
480
|
-
let
|
|
481
|
-
for (;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
const d =
|
|
485
|
-
if (d &&
|
|
987
|
+
const o = [], i = (r) => {
|
|
988
|
+
const s = e.createTreeWalker(r, NodeFilter.SHOW_ELEMENT);
|
|
989
|
+
let a = s.nextNode();
|
|
990
|
+
for (; a; ) {
|
|
991
|
+
const u = a;
|
|
992
|
+
mt(u) && o.push(u);
|
|
993
|
+
const d = u.shadowRoot;
|
|
994
|
+
if (d && i(d), u instanceof HTMLIFrameElement)
|
|
486
995
|
try {
|
|
487
|
-
|
|
996
|
+
u.contentDocument && i(u.contentDocument);
|
|
488
997
|
} catch {
|
|
489
998
|
}
|
|
490
|
-
if (o.length >=
|
|
999
|
+
if (o.length >= it)
|
|
491
1000
|
return;
|
|
492
|
-
|
|
1001
|
+
a = s.nextNode();
|
|
493
1002
|
}
|
|
494
1003
|
};
|
|
495
|
-
return
|
|
1004
|
+
return i(n), o.slice(0, it);
|
|
496
1005
|
}
|
|
497
|
-
function
|
|
498
|
-
var
|
|
1006
|
+
function ye(t, e) {
|
|
1007
|
+
var i;
|
|
499
1008
|
const n = Object.getPrototypeOf(t), o = Object.getOwnPropertyDescriptor(n, "value");
|
|
500
|
-
(
|
|
1009
|
+
(i = o == null ? void 0 : o.set) == null || i.call(t, e);
|
|
501
1010
|
}
|
|
502
|
-
function
|
|
1011
|
+
function j(t) {
|
|
503
1012
|
t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
504
1013
|
}
|
|
505
|
-
function
|
|
1014
|
+
function L(t) {
|
|
506
1015
|
var e, n;
|
|
507
1016
|
(t instanceof HTMLElement || t instanceof SVGElement) && ((e = t.scrollIntoView) == null || e.call(t, { block: "center", inline: "center" })), t instanceof HTMLElement && ((n = t.focus) == null || n.call(t));
|
|
508
1017
|
}
|
|
509
|
-
function
|
|
1018
|
+
function R(t, e) {
|
|
510
1019
|
return typeof PointerEvent == "function" ? new PointerEvent(t, e) : new MouseEvent(t.replace("pointer", "mouse"), e);
|
|
511
1020
|
}
|
|
512
|
-
class
|
|
1021
|
+
class be {
|
|
513
1022
|
constructor(e = {}) {
|
|
514
1023
|
this.options = e, this.refs = /* @__PURE__ */ new Map(), this.nextRef = 1;
|
|
515
1024
|
}
|
|
@@ -539,17 +1048,19 @@ class kt {
|
|
|
539
1048
|
return this.pointer(n);
|
|
540
1049
|
case "host_page_screenshot":
|
|
541
1050
|
return this.screenshot();
|
|
1051
|
+
case "host_page_read":
|
|
1052
|
+
return this.read(n);
|
|
542
1053
|
case "host_page_wait_for":
|
|
543
1054
|
return this.waitFor(n);
|
|
544
1055
|
}
|
|
545
1056
|
}
|
|
546
1057
|
snapshot() {
|
|
547
|
-
var
|
|
1058
|
+
var r, s;
|
|
548
1059
|
this.refs.clear(), this.nextRef = 1;
|
|
549
|
-
const e = this.getRoot(), n =
|
|
550
|
-
(
|
|
1060
|
+
const e = this.getRoot(), n = T(e), o = V(e), i = et(e).map(
|
|
1061
|
+
(a) => this.snapshotElement(a)
|
|
551
1062
|
);
|
|
552
|
-
return {
|
|
1063
|
+
return this.readableContent = ot(e), {
|
|
553
1064
|
url: o.location.href,
|
|
554
1065
|
title: n.title,
|
|
555
1066
|
capabilities: {
|
|
@@ -572,28 +1083,34 @@ class kt {
|
|
|
572
1083
|
readyState: n.readyState,
|
|
573
1084
|
visibilityState: n.visibilityState,
|
|
574
1085
|
focusedElement: n.activeElement && n.activeElement !== n.body ? this.snapshotElementWithoutRef(n.activeElement) : void 0,
|
|
575
|
-
selection: ((
|
|
1086
|
+
selection: ((s = (r = n.getSelection) == null ? void 0 : r.call(n)) == null ? void 0 : s.toString()) || void 0
|
|
576
1087
|
},
|
|
577
1088
|
navigation: this.getNavigationState(o),
|
|
578
1089
|
frames: this.getFrameState(n),
|
|
579
|
-
accessibility:
|
|
580
|
-
ref:
|
|
581
|
-
role:
|
|
582
|
-
name:
|
|
583
|
-
value:
|
|
584
|
-
disabled:
|
|
585
|
-
checked:
|
|
586
|
-
focused: n.activeElement === this.refs.get(
|
|
1090
|
+
accessibility: i.map((a) => ({
|
|
1091
|
+
ref: a.ref,
|
|
1092
|
+
role: a.role,
|
|
1093
|
+
name: a.name,
|
|
1094
|
+
value: a.value,
|
|
1095
|
+
disabled: a.disabled,
|
|
1096
|
+
checked: a.checked,
|
|
1097
|
+
focused: n.activeElement === this.refs.get(a.ref)
|
|
587
1098
|
})),
|
|
588
|
-
|
|
1099
|
+
readableContent: Nt(
|
|
1100
|
+
this.readableContent
|
|
1101
|
+
),
|
|
1102
|
+
elements: i
|
|
589
1103
|
};
|
|
590
1104
|
}
|
|
591
1105
|
getRoot() {
|
|
592
1106
|
return this.options.root ?? document;
|
|
593
1107
|
}
|
|
1108
|
+
invalidateReadableContent() {
|
|
1109
|
+
this.readableContent = void 0;
|
|
1110
|
+
}
|
|
594
1111
|
getNavigationState(e) {
|
|
595
|
-
var o,
|
|
596
|
-
const n = (
|
|
1112
|
+
var o, i, r;
|
|
1113
|
+
const n = (r = (i = (o = e.performance) == null ? void 0 : o.getEntriesByType) == null ? void 0 : i.call(o, "navigation")) == null ? void 0 : r[0];
|
|
597
1114
|
if (!(typeof PerformanceNavigationTiming != "function" || !(n instanceof PerformanceNavigationTiming)))
|
|
598
1115
|
return {
|
|
599
1116
|
type: n.type,
|
|
@@ -604,12 +1121,12 @@ class kt {
|
|
|
604
1121
|
}
|
|
605
1122
|
getFrameState(e) {
|
|
606
1123
|
return Array.from(e.querySelectorAll("iframe")).map((n) => {
|
|
607
|
-
var
|
|
608
|
-
const o =
|
|
1124
|
+
var i, r;
|
|
1125
|
+
const o = N(n);
|
|
609
1126
|
try {
|
|
610
1127
|
return {
|
|
611
|
-
url: (
|
|
612
|
-
title: (
|
|
1128
|
+
url: (i = n.contentWindow) == null ? void 0 : i.location.href,
|
|
1129
|
+
title: (r = n.contentDocument) == null ? void 0 : r.title,
|
|
613
1130
|
sameOrigin: !0,
|
|
614
1131
|
rect: o
|
|
615
1132
|
};
|
|
@@ -630,159 +1147,193 @@ class kt {
|
|
|
630
1147
|
return this.createElementSnapshot(e, "");
|
|
631
1148
|
}
|
|
632
1149
|
createElementSnapshot(e, n) {
|
|
633
|
-
const o = (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && e.placeholder || void 0,
|
|
1150
|
+
const o = (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && e.placeholder || void 0, i = g(e);
|
|
634
1151
|
return {
|
|
635
1152
|
ref: n,
|
|
636
1153
|
tag: e.tagName.toLowerCase(),
|
|
637
1154
|
role: M(e),
|
|
638
1155
|
name: x(e),
|
|
639
|
-
label:
|
|
640
|
-
groupLabel:
|
|
641
|
-
text:
|
|
642
|
-
nearbyText:
|
|
643
|
-
testId:
|
|
644
|
-
value:
|
|
645
|
-
selectedLabel:
|
|
646
|
-
options:
|
|
1156
|
+
label: X(e),
|
|
1157
|
+
groupLabel: pt(e),
|
|
1158
|
+
text: m(e),
|
|
1159
|
+
nearbyText: P(e),
|
|
1160
|
+
testId: ee(e),
|
|
1161
|
+
value: Z(e),
|
|
1162
|
+
selectedLabel: te(e),
|
|
1163
|
+
options: Zt(e),
|
|
647
1164
|
placeholder: o,
|
|
648
|
-
selector:
|
|
649
|
-
disabled:
|
|
650
|
-
enabled:
|
|
651
|
-
checked:
|
|
652
|
-
visible:
|
|
653
|
-
actionable:
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
1165
|
+
selector: Y(e),
|
|
1166
|
+
disabled: gt(e),
|
|
1167
|
+
enabled: i.enabled,
|
|
1168
|
+
checked: ne(e),
|
|
1169
|
+
visible: i.visible,
|
|
1170
|
+
actionable: i.actionable,
|
|
1171
|
+
receivesEvents: i.receivesEvents,
|
|
1172
|
+
occludedBy: i.occludedBy ? _(i.occludedBy) : void 0,
|
|
1173
|
+
safeClickPoints: i.safeClickPoints,
|
|
1174
|
+
rect: N(e),
|
|
1175
|
+
center: i.center,
|
|
1176
|
+
hitTarget: i.hitTarget ? _(i.hitTarget) : void 0,
|
|
1177
|
+
hitStack: i.hitStack.slice(0, 5).map(_)
|
|
658
1178
|
};
|
|
659
1179
|
}
|
|
660
1180
|
resolveElement(e) {
|
|
661
|
-
const n =
|
|
1181
|
+
const n = w(e.ref) ?? w(e.axRef);
|
|
662
1182
|
if (n) {
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
1183
|
+
const r = this.refs.get(n);
|
|
1184
|
+
if (!r)
|
|
665
1185
|
throw new Error(`Unknown element ref: ${n}. Take a new snapshot.`);
|
|
666
|
-
return
|
|
1186
|
+
return r;
|
|
667
1187
|
}
|
|
668
|
-
const o =
|
|
1188
|
+
const o = w(e.selector);
|
|
669
1189
|
if (o) {
|
|
670
|
-
const
|
|
671
|
-
if (!
|
|
1190
|
+
const r = this.getRoot().querySelector(o);
|
|
1191
|
+
if (!r)
|
|
672
1192
|
throw new Error(`No element matches selector: ${o}.`);
|
|
673
|
-
return c;
|
|
674
|
-
}
|
|
675
|
-
const r = St(this.getRoot(), e);
|
|
676
|
-
if (r)
|
|
677
1193
|
return r;
|
|
1194
|
+
}
|
|
1195
|
+
const i = de(this.getRoot(), e);
|
|
1196
|
+
if (i)
|
|
1197
|
+
return i;
|
|
678
1198
|
if (typeof e.x < "u" || typeof e.y < "u") {
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}, i = m(this.getRoot()).elementFromPoint(
|
|
683
|
-
c.x,
|
|
684
|
-
c.y
|
|
1199
|
+
const r = rt(this.getRoot(), e), s = T(this.getRoot()).elementFromPoint(
|
|
1200
|
+
r.x,
|
|
1201
|
+
r.y
|
|
685
1202
|
);
|
|
686
|
-
if (!
|
|
687
|
-
throw new Error(`No element found at (${
|
|
688
|
-
return
|
|
1203
|
+
if (!s)
|
|
1204
|
+
throw new Error(`No element found at (${r.x}, ${r.y}).`);
|
|
1205
|
+
return s;
|
|
689
1206
|
}
|
|
690
1207
|
throw new Error(
|
|
691
1208
|
"Expected one of ref, selector, role/name/text/testId, or x/y."
|
|
692
1209
|
);
|
|
693
1210
|
}
|
|
694
1211
|
async click(e) {
|
|
695
|
-
const n =
|
|
696
|
-
if (!
|
|
697
|
-
throw new
|
|
698
|
-
`Target "${x(o) ?? o.tagName.toLowerCase()}" is not receiving pointer events
|
|
1212
|
+
const n = b(e), o = this.resolveElement(n), i = g(o), s = (i.actionable ? null : ue(this.getRoot(), o)) ?? le(o);
|
|
1213
|
+
if (!K(s) && !i.actionable && ae(o.ownerDocument))
|
|
1214
|
+
throw new Xt(
|
|
1215
|
+
`Target "${x(o) ?? o.tagName.toLowerCase()}" is not receiving pointer events.`,
|
|
1216
|
+
{
|
|
1217
|
+
reason: "target_occluded",
|
|
1218
|
+
target: this.describeElement(o),
|
|
1219
|
+
occluder: i.occludedBy ? _(i.occludedBy) : void 0,
|
|
1220
|
+
targetVisible: i.visible,
|
|
1221
|
+
targetEnabled: i.enabled,
|
|
1222
|
+
targetReceivesEvents: i.receivesEvents,
|
|
1223
|
+
recoverable: !0,
|
|
1224
|
+
hitStack: i.hitStack.slice(0, 5).map(_),
|
|
1225
|
+
nextActions: [
|
|
1226
|
+
{
|
|
1227
|
+
tool: "host_page_press",
|
|
1228
|
+
args: { key: "Escape" }
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
tool: "host_page_screenshot",
|
|
1232
|
+
args: {}
|
|
1233
|
+
}
|
|
1234
|
+
]
|
|
1235
|
+
}
|
|
699
1236
|
);
|
|
700
|
-
|
|
701
|
-
const
|
|
702
|
-
return
|
|
1237
|
+
L(s);
|
|
1238
|
+
const u = K(s), d = g(s), l = g(o), c = u ? Et(s, u) : d.center ?? i.center;
|
|
1239
|
+
return c && await this.showVisualEffect({
|
|
703
1240
|
type: "click",
|
|
704
|
-
point:
|
|
1241
|
+
point: c,
|
|
705
1242
|
anchor: "target",
|
|
706
|
-
target:
|
|
1243
|
+
target: s,
|
|
707
1244
|
requested: o
|
|
708
|
-
}),
|
|
709
|
-
clicked: this.describeElement(
|
|
1245
|
+
}), s instanceof HTMLElement ? s.click() : s.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), this.invalidateReadableContent(), {
|
|
1246
|
+
clicked: this.describeElement(s),
|
|
710
1247
|
requested: this.describeElement(o),
|
|
711
|
-
strategy:
|
|
712
|
-
point:
|
|
1248
|
+
strategy: s === o ? "dom" : "semantic_visible_fallback",
|
|
1249
|
+
point: c,
|
|
713
1250
|
actionability: {
|
|
714
1251
|
visible: l.visible,
|
|
715
1252
|
enabled: l.enabled,
|
|
716
|
-
receivesEvents: l.receivesEvents
|
|
1253
|
+
receivesEvents: l.receivesEvents,
|
|
1254
|
+
occludedBy: l.occludedBy ? _(l.occludedBy) : void 0,
|
|
1255
|
+
safeClickPoints: l.safeClickPoints
|
|
717
1256
|
}
|
|
718
1257
|
};
|
|
719
1258
|
}
|
|
1259
|
+
read(e) {
|
|
1260
|
+
const n = b(e), o = this.getRoot(), i = this.readableContent ?? ot(o);
|
|
1261
|
+
this.readableContent = i;
|
|
1262
|
+
const r = {
|
|
1263
|
+
blockId: w(n.blockId),
|
|
1264
|
+
query: w(n.query),
|
|
1265
|
+
page: B(n.page),
|
|
1266
|
+
pageSize: B(n.pageSize),
|
|
1267
|
+
maxChars: B(n.maxChars)
|
|
1268
|
+
};
|
|
1269
|
+
return qt(i, r);
|
|
1270
|
+
}
|
|
720
1271
|
async fill(e) {
|
|
721
|
-
const n =
|
|
722
|
-
if (
|
|
1272
|
+
const n = b(e), o = z(n.value, "value"), i = this.resolveElement(n);
|
|
1273
|
+
if (L(i), i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement)
|
|
723
1274
|
return await this.showVisualEffect({
|
|
724
1275
|
type: "fill",
|
|
725
|
-
target:
|
|
726
|
-
requested:
|
|
1276
|
+
target: i,
|
|
1277
|
+
requested: i,
|
|
727
1278
|
value: o,
|
|
728
1279
|
anchor: "target",
|
|
729
|
-
point:
|
|
730
|
-
}),
|
|
731
|
-
if (
|
|
1280
|
+
point: g(i).center
|
|
1281
|
+
}), ye(i, o), j(i), this.invalidateReadableContent(), { filled: this.describeElement(i), value: o };
|
|
1282
|
+
if (i instanceof HTMLElement && i.isContentEditable)
|
|
732
1283
|
return await this.showVisualEffect({
|
|
733
1284
|
type: "fill",
|
|
734
|
-
target:
|
|
735
|
-
requested:
|
|
1285
|
+
target: i,
|
|
1286
|
+
requested: i,
|
|
736
1287
|
value: o,
|
|
737
1288
|
anchor: "target",
|
|
738
|
-
point:
|
|
739
|
-
}),
|
|
1289
|
+
point: g(i).center
|
|
1290
|
+
}), i.textContent = o, j(i), this.invalidateReadableContent(), { filled: this.describeElement(i), value: o };
|
|
740
1291
|
throw new Error("Target element cannot be filled.");
|
|
741
1292
|
}
|
|
742
1293
|
async press(e) {
|
|
743
|
-
const n =
|
|
744
|
-
if (!
|
|
1294
|
+
const n = b(e), o = z(n.key, "key"), i = n.ref || n.selector || n.x !== void 0 && n.y !== void 0 ? this.resolveElement(n) : T(this.getRoot()).activeElement ?? T(this.getRoot()).body;
|
|
1295
|
+
if (!i)
|
|
745
1296
|
throw new Error("No target element is available for key press.");
|
|
746
|
-
|
|
1297
|
+
L(i), await this.showVisualEffect({
|
|
747
1298
|
type: "press",
|
|
748
|
-
target:
|
|
749
|
-
requested:
|
|
1299
|
+
target: i,
|
|
1300
|
+
requested: i,
|
|
750
1301
|
key: o,
|
|
751
1302
|
anchor: "target",
|
|
752
|
-
point:
|
|
1303
|
+
point: g(i).center
|
|
753
1304
|
});
|
|
754
|
-
const
|
|
755
|
-
return
|
|
1305
|
+
const r = { key: o, bubbles: !0, cancelable: !0 };
|
|
1306
|
+
return i.dispatchEvent(new KeyboardEvent("keydown", r)), o.length === 1 && i.dispatchEvent(new KeyboardEvent("keypress", r)), i.dispatchEvent(new KeyboardEvent("keyup", r)), this.invalidateReadableContent(), { pressed: o, target: this.describeElement(i) };
|
|
756
1307
|
}
|
|
757
1308
|
async select(e) {
|
|
758
|
-
const n =
|
|
759
|
-
if (!(
|
|
1309
|
+
const n = b(e), o = Gt(n.values ?? n.value), i = this.resolveElement(n);
|
|
1310
|
+
if (!(i instanceof HTMLSelectElement))
|
|
760
1311
|
throw new Error("Target element is not a select.");
|
|
761
|
-
|
|
762
|
-
const
|
|
1312
|
+
L(i);
|
|
1313
|
+
const r = new Set(o);
|
|
763
1314
|
await this.showVisualEffect({
|
|
764
1315
|
type: "select",
|
|
765
|
-
target:
|
|
766
|
-
requested:
|
|
1316
|
+
target: i,
|
|
1317
|
+
requested: i,
|
|
767
1318
|
values: o,
|
|
768
1319
|
anchor: "target",
|
|
769
|
-
point:
|
|
1320
|
+
point: g(i).center
|
|
770
1321
|
});
|
|
771
|
-
for (const
|
|
772
|
-
|
|
773
|
-
return
|
|
774
|
-
selected: Array.from(
|
|
775
|
-
(
|
|
1322
|
+
for (const s of Array.from(i.options))
|
|
1323
|
+
s.selected = r.has(s.value);
|
|
1324
|
+
return j(i), this.invalidateReadableContent(), {
|
|
1325
|
+
selected: Array.from(i.selectedOptions).map(
|
|
1326
|
+
(s) => s.value
|
|
776
1327
|
),
|
|
777
|
-
target: this.describeElement(
|
|
1328
|
+
target: this.describeElement(i)
|
|
778
1329
|
};
|
|
779
1330
|
}
|
|
780
1331
|
async scroll(e) {
|
|
781
|
-
var
|
|
782
|
-
const n =
|
|
783
|
-
x:
|
|
784
|
-
y:
|
|
785
|
-
} : null,
|
|
1332
|
+
var u, d, l, c;
|
|
1333
|
+
const n = b(e), o = n.x !== void 0 || n.y !== void 0 ? {
|
|
1334
|
+
x: A(n.x) ?? 0,
|
|
1335
|
+
y: A(n.y) ?? 0
|
|
1336
|
+
} : null, i = A(n.deltaX) ?? 0, r = A(n.deltaY) ?? 0, s = this.getRoot(), a = V(s);
|
|
786
1337
|
if (n.ref || n.selector || n.role || n.name || n.text || n.testId) {
|
|
787
1338
|
const f = this.resolveElement(n);
|
|
788
1339
|
if (!(f instanceof HTMLElement))
|
|
@@ -791,111 +1342,124 @@ class kt {
|
|
|
791
1342
|
type: "scroll",
|
|
792
1343
|
target: f,
|
|
793
1344
|
requested: f,
|
|
794
|
-
deltaX:
|
|
795
|
-
deltaY:
|
|
1345
|
+
deltaX: i,
|
|
1346
|
+
deltaY: r,
|
|
796
1347
|
anchor: "target",
|
|
797
|
-
point:
|
|
798
|
-
}), o ? (
|
|
1348
|
+
point: g(f).center
|
|
1349
|
+
}), o ? (u = f.scrollTo) == null || u.call(f, o.x, o.y) : (d = f.scrollBy) == null || d.call(f, i, r), this.invalidateReadableContent(), {
|
|
799
1350
|
scrolled: this.describeElement(f),
|
|
800
1351
|
scroll: { x: f.scrollLeft, y: f.scrollTop }
|
|
801
1352
|
};
|
|
802
1353
|
}
|
|
803
1354
|
return await this.showVisualEffect({
|
|
804
1355
|
type: "scroll",
|
|
805
|
-
deltaX:
|
|
806
|
-
deltaY:
|
|
1356
|
+
deltaX: i,
|
|
1357
|
+
deltaY: r,
|
|
807
1358
|
point: {
|
|
808
|
-
x:
|
|
809
|
-
y:
|
|
1359
|
+
x: a.innerWidth / 2,
|
|
1360
|
+
y: a.innerHeight / 2
|
|
810
1361
|
}
|
|
811
|
-
}), o ? (l =
|
|
1362
|
+
}), o ? (l = a.scrollTo) == null || l.call(a, o.x, o.y) : (c = a.scrollBy) == null || c.call(a, i, r), this.invalidateReadableContent(), { scroll: { x: a.scrollX, y: a.scrollY } };
|
|
812
1363
|
}
|
|
813
1364
|
navigate(e) {
|
|
814
1365
|
if (this.options.allowNavigation === !1)
|
|
815
1366
|
throw new Error("Navigation is disabled for host page automation.");
|
|
816
|
-
const n =
|
|
817
|
-
if (
|
|
1367
|
+
const n = b(e), o = this.getRoot(), i = V(o), r = z(n.url, "url"), s = new URL(r, i.location.href);
|
|
1368
|
+
if (s.protocol !== "http:" && s.protocol !== "https:")
|
|
818
1369
|
throw new Error("Navigation only supports HTTP(S) URLs.");
|
|
819
|
-
return this.refs.clear(),
|
|
1370
|
+
return this.refs.clear(), this.invalidateReadableContent(), i.location.assign(s.toString()), { navigated: s.toString() };
|
|
820
1371
|
}
|
|
821
1372
|
async hover(e) {
|
|
822
|
-
const n =
|
|
1373
|
+
const n = b(e), o = this.resolveElement(n), i = g(o).center;
|
|
823
1374
|
return await this.showVisualEffect({
|
|
824
1375
|
type: "hover",
|
|
825
1376
|
target: o,
|
|
826
1377
|
requested: o,
|
|
827
1378
|
anchor: "target",
|
|
828
|
-
point:
|
|
1379
|
+
point: i
|
|
829
1380
|
}), o.dispatchEvent(
|
|
830
1381
|
new MouseEvent("mouseover", {
|
|
831
1382
|
bubbles: !0,
|
|
832
1383
|
cancelable: !0,
|
|
833
|
-
clientX:
|
|
834
|
-
clientY:
|
|
1384
|
+
clientX: i == null ? void 0 : i.x,
|
|
1385
|
+
clientY: i == null ? void 0 : i.y
|
|
835
1386
|
})
|
|
836
1387
|
), o.dispatchEvent(
|
|
837
1388
|
new MouseEvent("mousemove", {
|
|
838
1389
|
bubbles: !0,
|
|
839
1390
|
cancelable: !0,
|
|
840
|
-
clientX:
|
|
841
|
-
clientY:
|
|
1391
|
+
clientX: i == null ? void 0 : i.x,
|
|
1392
|
+
clientY: i == null ? void 0 : i.y
|
|
842
1393
|
})
|
|
843
|
-
), { hovered: this.describeElement(o), point:
|
|
1394
|
+
), { hovered: this.describeElement(o), point: i };
|
|
844
1395
|
}
|
|
845
1396
|
async focus(e) {
|
|
846
|
-
const n =
|
|
847
|
-
return
|
|
1397
|
+
const n = b(e), o = this.resolveElement(n);
|
|
1398
|
+
return L(o), await this.showVisualEffect({
|
|
848
1399
|
type: "focus",
|
|
849
1400
|
target: o,
|
|
850
1401
|
requested: o,
|
|
851
1402
|
anchor: "target",
|
|
852
|
-
point:
|
|
1403
|
+
point: g(o).center
|
|
853
1404
|
}), { focused: this.describeElement(o) };
|
|
854
1405
|
}
|
|
855
1406
|
async pointer(e) {
|
|
856
|
-
const n =
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1407
|
+
const n = b(e), o = at(n.action, ["move", "down", "up", "click"]) ?? "click", i = B(n.button) ?? 0, r = typeof n.x < "u" || typeof n.y < "u", s = w(n.targetText);
|
|
1408
|
+
if (o === "click" && r && !s)
|
|
1409
|
+
throw new Error(
|
|
1410
|
+
"Pointer coordinate clicks require targetText to avoid unintended navigation."
|
|
1411
|
+
);
|
|
1412
|
+
const a = n.ref || n.selector || n.role || n.name || n.text || n.testId ? this.resolveElement(n) : null, u = a ? g(a).center : rt(this.getRoot(), n);
|
|
1413
|
+
if (!u)
|
|
861
1414
|
throw new Error("Target element has no clickable point.");
|
|
862
|
-
const
|
|
863
|
-
if (!
|
|
864
|
-
throw new Error(`No element found at (${
|
|
865
|
-
const
|
|
1415
|
+
const d = a ?? T(this.getRoot()).elementFromPoint(u.x, u.y);
|
|
1416
|
+
if (!d)
|
|
1417
|
+
throw new Error(`No element found at (${u.x}, ${u.y}).`);
|
|
1418
|
+
const l = s ? he(d, s) : void 0;
|
|
1419
|
+
if (s && !l)
|
|
1420
|
+
throw new Error(
|
|
1421
|
+
`Pointer target text mismatch: expected hit target to contain "${s}".`
|
|
1422
|
+
);
|
|
1423
|
+
const c = {
|
|
866
1424
|
bubbles: !0,
|
|
867
1425
|
cancelable: !0,
|
|
868
|
-
clientX:
|
|
869
|
-
clientY:
|
|
870
|
-
button:
|
|
1426
|
+
clientX: u.x,
|
|
1427
|
+
clientY: u.y,
|
|
1428
|
+
button: i
|
|
871
1429
|
};
|
|
872
1430
|
return o === "move" ? (await this.showVisualEffect({
|
|
873
1431
|
type: "pointer",
|
|
874
1432
|
action: o,
|
|
875
1433
|
anchor: "point",
|
|
876
|
-
point:
|
|
877
|
-
target:
|
|
878
|
-
}),
|
|
1434
|
+
point: u,
|
|
1435
|
+
target: d
|
|
1436
|
+
}), d.dispatchEvent(R("pointermove", c)), d.dispatchEvent(new MouseEvent("mousemove", c))) : o === "down" ? (await this.showVisualEffect({
|
|
879
1437
|
type: "pointer",
|
|
880
1438
|
action: o,
|
|
881
1439
|
anchor: "point",
|
|
882
|
-
point:
|
|
883
|
-
target:
|
|
884
|
-
}),
|
|
1440
|
+
point: u,
|
|
1441
|
+
target: d
|
|
1442
|
+
}), d.dispatchEvent(R("pointerdown", c)), d.dispatchEvent(new MouseEvent("mousedown", c))) : o === "up" ? (await this.showVisualEffect({
|
|
885
1443
|
type: "pointer",
|
|
886
1444
|
action: o,
|
|
887
1445
|
anchor: "point",
|
|
888
|
-
point:
|
|
889
|
-
target:
|
|
890
|
-
}),
|
|
1446
|
+
point: u,
|
|
1447
|
+
target: d
|
|
1448
|
+
}), d.dispatchEvent(R("pointerup", c)), d.dispatchEvent(new MouseEvent("mouseup", c))) : (await this.showVisualEffect({
|
|
891
1449
|
type: "click",
|
|
892
1450
|
anchor: "point",
|
|
893
|
-
point:
|
|
894
|
-
target:
|
|
895
|
-
}),
|
|
1451
|
+
point: u,
|
|
1452
|
+
target: d
|
|
1453
|
+
}), d.dispatchEvent(R("pointerdown", c)), d.dispatchEvent(new MouseEvent("mousedown", c)), d.dispatchEvent(R("pointerup", c)), d.dispatchEvent(new MouseEvent("mouseup", c)), d instanceof HTMLElement ? d.click() : d.dispatchEvent(new MouseEvent("click", c)), this.invalidateReadableContent()), {
|
|
896
1454
|
pointer: o,
|
|
897
|
-
point:
|
|
898
|
-
|
|
1455
|
+
point: u,
|
|
1456
|
+
coordinateSpace: "viewport-css-px",
|
|
1457
|
+
target: this.describeElement(d),
|
|
1458
|
+
targetTextMatched: l,
|
|
1459
|
+
expectedAfterClick: o === "click" ? me(
|
|
1460
|
+
this.getRoot(),
|
|
1461
|
+
pe(n.expectedAfterClick)
|
|
1462
|
+
) : void 0
|
|
899
1463
|
};
|
|
900
1464
|
}
|
|
901
1465
|
screenshot() {
|
|
@@ -904,14 +1468,14 @@ class kt {
|
|
|
904
1468
|
);
|
|
905
1469
|
}
|
|
906
1470
|
async showVisualEffect(e) {
|
|
907
|
-
var n, o,
|
|
1471
|
+
var n, o, i, r;
|
|
908
1472
|
try {
|
|
909
1473
|
await ((o = (n = this.options).showVisualEffect) == null ? void 0 : o.call(n, e));
|
|
910
1474
|
} catch {
|
|
911
1475
|
}
|
|
912
1476
|
if (!(e.type !== "click" || !e.point || !e.target || this.options.showVisualEffect))
|
|
913
1477
|
try {
|
|
914
|
-
await ((
|
|
1478
|
+
await ((r = (i = this.options).showClickEffect) == null ? void 0 : r.call(i, {
|
|
915
1479
|
point: e.point,
|
|
916
1480
|
target: e.target,
|
|
917
1481
|
requested: e.requested
|
|
@@ -920,29 +1484,29 @@ class kt {
|
|
|
920
1484
|
}
|
|
921
1485
|
}
|
|
922
1486
|
async waitFor(e) {
|
|
923
|
-
const n =
|
|
1487
|
+
const n = b(e), o = at(n.state, [
|
|
924
1488
|
"attached",
|
|
925
1489
|
"visible",
|
|
926
1490
|
"hidden",
|
|
927
1491
|
"detached"
|
|
928
|
-
]) ?? "visible",
|
|
929
|
-
|
|
930
|
-
Math.max(0, (
|
|
931
|
-
),
|
|
1492
|
+
]) ?? "visible", i = A(n.timeoutSeconds), r = Math.min(
|
|
1493
|
+
$t,
|
|
1494
|
+
Math.max(0, (i ?? jt / 1e3) * 1e3)
|
|
1495
|
+
), s = Date.now(), a = this.tryResolveElement(n);
|
|
932
1496
|
for (await this.showVisualEffect({
|
|
933
1497
|
type: "wait_for",
|
|
934
1498
|
state: o,
|
|
935
|
-
target:
|
|
936
|
-
requested:
|
|
937
|
-
...
|
|
938
|
-
point:
|
|
939
|
-
}); Date.now() -
|
|
940
|
-
const
|
|
941
|
-
if (o === "attached" ? !!
|
|
1499
|
+
target: a ?? void 0,
|
|
1500
|
+
requested: a ?? void 0,
|
|
1501
|
+
...a ? { anchor: "target" } : {},
|
|
1502
|
+
point: a ? g(a).center : void 0
|
|
1503
|
+
}); Date.now() - s <= r; ) {
|
|
1504
|
+
const u = this.tryResolveElement(n);
|
|
1505
|
+
if (o === "attached" ? !!u : o === "detached" ? !u : o === "hidden" ? !u || !S(u) : !!(u && S(u)))
|
|
942
1506
|
return {
|
|
943
1507
|
waitedFor: o,
|
|
944
|
-
elapsedMs: Date.now() -
|
|
945
|
-
target:
|
|
1508
|
+
elapsedMs: Date.now() - s,
|
|
1509
|
+
target: u ? this.describeElement(u) : void 0
|
|
946
1510
|
};
|
|
947
1511
|
await new Promise((l) => setTimeout(l, 100));
|
|
948
1512
|
}
|
|
@@ -960,52 +1524,309 @@ class kt {
|
|
|
960
1524
|
tag: e.tagName.toLowerCase(),
|
|
961
1525
|
role: M(e),
|
|
962
1526
|
name: x(e),
|
|
963
|
-
selector:
|
|
1527
|
+
selector: Y(e)
|
|
964
1528
|
};
|
|
965
1529
|
}
|
|
966
1530
|
}
|
|
967
|
-
function
|
|
1531
|
+
function Ee(t) {
|
|
968
1532
|
return typeof t == "object" && t !== null && !Array.isArray(t) ? t : {};
|
|
969
1533
|
}
|
|
970
|
-
function
|
|
1534
|
+
function we(t) {
|
|
971
1535
|
return JSON.stringify(t);
|
|
972
1536
|
}
|
|
973
|
-
function
|
|
1537
|
+
function $(t, e, n) {
|
|
974
1538
|
return {
|
|
975
1539
|
tool_call_id: t.tool_call_id ?? t.id,
|
|
976
1540
|
name: t.name,
|
|
977
1541
|
status: e,
|
|
978
|
-
content:
|
|
1542
|
+
content: we(n)
|
|
979
1543
|
};
|
|
980
1544
|
}
|
|
981
|
-
function
|
|
1545
|
+
function ve(t) {
|
|
982
1546
|
return t instanceof Error ? t.message : String(t);
|
|
983
1547
|
}
|
|
984
|
-
function
|
|
985
|
-
|
|
1548
|
+
function xe(t) {
|
|
1549
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
1550
|
+
return {};
|
|
1551
|
+
const e = Reflect.get(t, "details");
|
|
1552
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
1553
|
+
}
|
|
1554
|
+
function Se(t = {}) {
|
|
1555
|
+
const e = new be(t);
|
|
986
1556
|
return async (n) => {
|
|
987
|
-
if (!
|
|
988
|
-
return
|
|
1557
|
+
if (!Wt(n.name))
|
|
1558
|
+
return $(n, "error", {
|
|
989
1559
|
ok: !1,
|
|
990
1560
|
error: `Unknown host page automation tool: ${n.name}`
|
|
991
1561
|
});
|
|
992
1562
|
try {
|
|
993
1563
|
const o = await e.execute(
|
|
994
1564
|
n.name,
|
|
995
|
-
|
|
1565
|
+
Ee(n.params)
|
|
996
1566
|
);
|
|
997
|
-
return
|
|
1567
|
+
return $(n, "success", { ok: !0, result: o });
|
|
998
1568
|
} catch (o) {
|
|
999
|
-
return
|
|
1569
|
+
return $(n, "error", {
|
|
1000
1570
|
ok: !1,
|
|
1001
|
-
error:
|
|
1571
|
+
error: ve(o),
|
|
1572
|
+
...xe(o)
|
|
1002
1573
|
});
|
|
1003
1574
|
}
|
|
1004
1575
|
};
|
|
1005
1576
|
}
|
|
1577
|
+
const v = {
|
|
1578
|
+
ref: {
|
|
1579
|
+
type: ["string", "number"],
|
|
1580
|
+
description: "Element ref from host_page_snapshot."
|
|
1581
|
+
},
|
|
1582
|
+
axRef: {
|
|
1583
|
+
type: ["string", "number"],
|
|
1584
|
+
description: "Accessibility ref from host_page_snapshot."
|
|
1585
|
+
},
|
|
1586
|
+
selector: {
|
|
1587
|
+
type: "string",
|
|
1588
|
+
description: "CSS selector for the target element."
|
|
1589
|
+
},
|
|
1590
|
+
testId: {
|
|
1591
|
+
type: "string",
|
|
1592
|
+
description: "data-testid, data-test-id, or data-qa value."
|
|
1593
|
+
},
|
|
1594
|
+
role: {
|
|
1595
|
+
type: "string",
|
|
1596
|
+
description: "Accessible role to match."
|
|
1597
|
+
},
|
|
1598
|
+
name: {
|
|
1599
|
+
type: "string",
|
|
1600
|
+
description: "Accessible name to match."
|
|
1601
|
+
},
|
|
1602
|
+
text: {
|
|
1603
|
+
type: "string",
|
|
1604
|
+
description: "Visible text to match."
|
|
1605
|
+
},
|
|
1606
|
+
x: {
|
|
1607
|
+
type: "number",
|
|
1608
|
+
description: "Viewport x coordinate."
|
|
1609
|
+
},
|
|
1610
|
+
y: {
|
|
1611
|
+
type: "number",
|
|
1612
|
+
description: "Viewport y coordinate."
|
|
1613
|
+
}
|
|
1614
|
+
}, _e = {
|
|
1615
|
+
coordinateSpace: {
|
|
1616
|
+
type: "string",
|
|
1617
|
+
enum: ["viewport-css-px", "viewport_normalized"],
|
|
1618
|
+
description: "Coordinate space for x/y. Use viewport_normalized for screenshot-derived points."
|
|
1619
|
+
}
|
|
1620
|
+
}, Te = {
|
|
1621
|
+
type: "object",
|
|
1622
|
+
properties: {
|
|
1623
|
+
type: {
|
|
1624
|
+
const: "field_contains",
|
|
1625
|
+
description: "Currently supported post-click expectation type."
|
|
1626
|
+
},
|
|
1627
|
+
field: {
|
|
1628
|
+
type: "string",
|
|
1629
|
+
description: "Field label/name expected to change after clicking."
|
|
1630
|
+
},
|
|
1631
|
+
value: {
|
|
1632
|
+
type: "string",
|
|
1633
|
+
description: "Expected substring in the field value after clicking."
|
|
1634
|
+
}
|
|
1635
|
+
},
|
|
1636
|
+
required: ["type", "field", "value"],
|
|
1637
|
+
additionalProperties: !1
|
|
1638
|
+
}, Ce = {
|
|
1639
|
+
host_page_snapshot: {
|
|
1640
|
+
type: "object",
|
|
1641
|
+
properties: {},
|
|
1642
|
+
additionalProperties: !1
|
|
1643
|
+
},
|
|
1644
|
+
host_page_click: {
|
|
1645
|
+
type: "object",
|
|
1646
|
+
properties: {
|
|
1647
|
+
...v
|
|
1648
|
+
},
|
|
1649
|
+
additionalProperties: !1
|
|
1650
|
+
},
|
|
1651
|
+
host_page_fill: {
|
|
1652
|
+
type: "object",
|
|
1653
|
+
properties: {
|
|
1654
|
+
...v,
|
|
1655
|
+
value: {
|
|
1656
|
+
type: "string",
|
|
1657
|
+
description: "Text value to set on the target field."
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
required: ["value"],
|
|
1661
|
+
additionalProperties: !1
|
|
1662
|
+
},
|
|
1663
|
+
host_page_press: {
|
|
1664
|
+
type: "object",
|
|
1665
|
+
properties: {
|
|
1666
|
+
...v,
|
|
1667
|
+
key: {
|
|
1668
|
+
type: "string",
|
|
1669
|
+
description: "Keyboard key to press."
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
required: ["key"],
|
|
1673
|
+
additionalProperties: !1
|
|
1674
|
+
},
|
|
1675
|
+
host_page_select: {
|
|
1676
|
+
type: "object",
|
|
1677
|
+
properties: {
|
|
1678
|
+
...v,
|
|
1679
|
+
value: {
|
|
1680
|
+
type: ["string", "array"],
|
|
1681
|
+
description: "Select option value or values.",
|
|
1682
|
+
items: { type: "string" }
|
|
1683
|
+
},
|
|
1684
|
+
values: {
|
|
1685
|
+
type: ["string", "array"],
|
|
1686
|
+
description: "Select option values.",
|
|
1687
|
+
items: { type: "string" }
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
additionalProperties: !1
|
|
1691
|
+
},
|
|
1692
|
+
host_page_scroll: {
|
|
1693
|
+
type: "object",
|
|
1694
|
+
properties: {
|
|
1695
|
+
...v,
|
|
1696
|
+
deltaX: {
|
|
1697
|
+
type: "number",
|
|
1698
|
+
description: "Horizontal scroll delta."
|
|
1699
|
+
},
|
|
1700
|
+
deltaY: {
|
|
1701
|
+
type: "number",
|
|
1702
|
+
description: "Vertical scroll delta."
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
additionalProperties: !1
|
|
1706
|
+
},
|
|
1707
|
+
host_page_navigate: {
|
|
1708
|
+
type: "object",
|
|
1709
|
+
properties: {
|
|
1710
|
+
url: {
|
|
1711
|
+
type: "string",
|
|
1712
|
+
description: "HTTP(S) URL to navigate to."
|
|
1713
|
+
}
|
|
1714
|
+
},
|
|
1715
|
+
required: ["url"],
|
|
1716
|
+
additionalProperties: !1
|
|
1717
|
+
},
|
|
1718
|
+
host_page_hover: {
|
|
1719
|
+
type: "object",
|
|
1720
|
+
properties: {
|
|
1721
|
+
...v
|
|
1722
|
+
},
|
|
1723
|
+
additionalProperties: !1
|
|
1724
|
+
},
|
|
1725
|
+
host_page_focus: {
|
|
1726
|
+
type: "object",
|
|
1727
|
+
properties: {
|
|
1728
|
+
...v
|
|
1729
|
+
},
|
|
1730
|
+
additionalProperties: !1
|
|
1731
|
+
},
|
|
1732
|
+
host_page_pointer: {
|
|
1733
|
+
type: "object",
|
|
1734
|
+
properties: {
|
|
1735
|
+
...v,
|
|
1736
|
+
..._e,
|
|
1737
|
+
action: {
|
|
1738
|
+
type: "string",
|
|
1739
|
+
enum: ["move", "down", "up", "click"],
|
|
1740
|
+
description: "Pointer action. Defaults to click."
|
|
1741
|
+
},
|
|
1742
|
+
button: {
|
|
1743
|
+
type: ["string", "number"],
|
|
1744
|
+
description: "Mouse button."
|
|
1745
|
+
},
|
|
1746
|
+
clickCount: {
|
|
1747
|
+
type: "number",
|
|
1748
|
+
description: "Number of clicks for CDP mouse click."
|
|
1749
|
+
},
|
|
1750
|
+
targetText: {
|
|
1751
|
+
type: "string",
|
|
1752
|
+
description: "Required for explicit coordinate clicks. The actual hit target or near ancestor must contain this text."
|
|
1753
|
+
},
|
|
1754
|
+
expectedAfterClick: Te
|
|
1755
|
+
},
|
|
1756
|
+
additionalProperties: !1
|
|
1757
|
+
},
|
|
1758
|
+
host_page_screenshot: {
|
|
1759
|
+
type: "object",
|
|
1760
|
+
properties: {
|
|
1761
|
+
format: {
|
|
1762
|
+
type: "string",
|
|
1763
|
+
enum: ["jpeg", "png"],
|
|
1764
|
+
description: "Screenshot image format."
|
|
1765
|
+
},
|
|
1766
|
+
quality: {
|
|
1767
|
+
type: "number",
|
|
1768
|
+
description: "JPEG quality from 1 to 100."
|
|
1769
|
+
}
|
|
1770
|
+
},
|
|
1771
|
+
additionalProperties: !1
|
|
1772
|
+
},
|
|
1773
|
+
host_page_read: {
|
|
1774
|
+
type: "object",
|
|
1775
|
+
properties: {
|
|
1776
|
+
blockId: {
|
|
1777
|
+
type: "string",
|
|
1778
|
+
description: "Readable content block id from host_page_snapshot."
|
|
1779
|
+
},
|
|
1780
|
+
scope: {
|
|
1781
|
+
type: "string",
|
|
1782
|
+
enum: ["visible"],
|
|
1783
|
+
description: "Visible content scope. Use blockId when a specific readable block is known."
|
|
1784
|
+
},
|
|
1785
|
+
query: {
|
|
1786
|
+
type: "string",
|
|
1787
|
+
description: "Optional text query for selecting relevant readable blocks."
|
|
1788
|
+
},
|
|
1789
|
+
page: {
|
|
1790
|
+
type: "number",
|
|
1791
|
+
minimum: 1,
|
|
1792
|
+
description: "1-based page for long block content."
|
|
1793
|
+
},
|
|
1794
|
+
pageSize: {
|
|
1795
|
+
type: "number",
|
|
1796
|
+
minimum: 1,
|
|
1797
|
+
maximum: 100,
|
|
1798
|
+
description: "Items, fields, rows, or blocks to return per page."
|
|
1799
|
+
},
|
|
1800
|
+
maxChars: {
|
|
1801
|
+
type: "number",
|
|
1802
|
+
minimum: 500,
|
|
1803
|
+
maximum: 12e3,
|
|
1804
|
+
description: "Maximum characters to return."
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
additionalProperties: !1
|
|
1808
|
+
},
|
|
1809
|
+
host_page_wait_for: {
|
|
1810
|
+
type: "object",
|
|
1811
|
+
properties: {
|
|
1812
|
+
...v,
|
|
1813
|
+
state: {
|
|
1814
|
+
type: "string",
|
|
1815
|
+
enum: ["attached", "visible", "hidden", "detached"],
|
|
1816
|
+
description: "Target state to wait for. Defaults to visible."
|
|
1817
|
+
},
|
|
1818
|
+
timeoutSeconds: {
|
|
1819
|
+
type: "number",
|
|
1820
|
+
description: "Maximum wait time in seconds."
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
additionalProperties: !1
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1006
1826
|
export {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1827
|
+
vt as HOST_PAGE_AUTOMATION_TOOL_NAMES,
|
|
1828
|
+
Ce as HOST_PAGE_AUTOMATION_TOOL_SCHEMAS,
|
|
1829
|
+
be as HostPageAutomationExecutor,
|
|
1830
|
+
Se as createHostPageAutomationClientToolHandler,
|
|
1831
|
+
Wt as isHostPageAutomationToolName
|
|
1011
1832
|
};
|