spana-test 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/agent/index.d.ts +2 -2
  2. package/dist/agent/index.js +5 -5
  3. package/dist/{app-CgbLADmF.d.ts → app-DSh1ejLh.d.ts} +97 -22
  4. package/dist/{chunk-NS2HLJO4.js → chunk-2KRVN4WN.js} +3 -3
  5. package/dist/{chunk-AJCSETN6.js → chunk-3UVSUVHW.js} +619 -174
  6. package/dist/chunk-3UVSUVHW.js.map +1 -0
  7. package/dist/{chunk-3FXDOTFI.js → chunk-ALPQES3J.js} +187 -36
  8. package/dist/chunk-ALPQES3J.js.map +1 -0
  9. package/dist/{chunk-PMXSU5MS.js → chunk-FP6PVHHR.js} +2 -2
  10. package/dist/{chunk-WKVU24B6.js → chunk-IGTK5MHB.js} +4 -4
  11. package/dist/{chunk-2T4K7BJ3.js → chunk-JZZ2W2XH.js} +3 -2
  12. package/dist/chunk-JZZ2W2XH.js.map +1 -0
  13. package/dist/{chunk-SNL4X67N.js → chunk-UEWZ2EXL.js} +352 -111
  14. package/dist/chunk-UEWZ2EXL.js.map +1 -0
  15. package/dist/{chunk-QP4MDUBY.js → chunk-VP6V4XEJ.js} +2 -2
  16. package/dist/{chunk-RKYKRGHB.js → chunk-Z6K4QQAR.js} +128 -6
  17. package/dist/chunk-Z6K4QQAR.js.map +1 -0
  18. package/dist/cli.js +9 -9
  19. package/dist/config-loader-F5YAY7RP.js +9 -0
  20. package/dist/{daemon-manager-DDYQITPD.js → daemon-manager-2EQDVUVM.js} +8 -2
  21. package/dist/{doctor-command-HEQQOYUR.js → doctor-command-YTCQ2SC7.js} +4 -4
  22. package/dist/{flow-Md5xLwbX.d.ts → flow-CSMwD9Fh.d.ts} +1 -1
  23. package/dist/gherkin/steps.d.ts +2 -2
  24. package/dist/index.d.ts +38 -8
  25. package/dist/index.js +25 -9
  26. package/dist/index.js.map +1 -1
  27. package/dist/{installer-IYGMG7LS.js → installer-5UHTYQTB.js} +3 -3
  28. package/dist/{server-JPNH33MX.js → server-4YLBAZEM.js} +6 -6
  29. package/dist/{server-4PEREPHY.js → server-IS4K5FCT.js} +2 -2
  30. package/dist/{session-D9e30RVS.d.ts → session-CgvT-Oso.d.ts} +3 -1
  31. package/dist/{session-V4PYJXNB.js → session-K7FCRKOC.js} +6 -6
  32. package/dist/{studio-command-JOIFCOHC.js → studio-command-RFPV2DS7.js} +2 -2
  33. package/dist/{test-command-JCO2HPYI.js → test-command-UEJG5AI6.js} +11 -9
  34. package/dist/test-command-UEJG5AI6.js.map +1 -0
  35. package/native/win32-x64/spana_native.dll +0 -0
  36. package/package.json +1 -1
  37. package/dist/chunk-2T4K7BJ3.js.map +0 -1
  38. package/dist/chunk-3FXDOTFI.js.map +0 -1
  39. package/dist/chunk-AJCSETN6.js.map +0 -1
  40. package/dist/chunk-RKYKRGHB.js.map +0 -1
  41. package/dist/chunk-SNL4X67N.js.map +0 -1
  42. package/dist/config-loader-5FU45FXK.js +0 -9
  43. package/dist/test-command-JCO2HPYI.js.map +0 -1
  44. /package/dist/{chunk-NS2HLJO4.js.map → chunk-2KRVN4WN.js.map} +0 -0
  45. /package/dist/{chunk-PMXSU5MS.js.map → chunk-FP6PVHHR.js.map} +0 -0
  46. /package/dist/{chunk-WKVU24B6.js.map → chunk-IGTK5MHB.js.map} +0 -0
  47. /package/dist/{chunk-QP4MDUBY.js.map → chunk-VP6V4XEJ.js.map} +0 -0
  48. /package/dist/{config-loader-5FU45FXK.js.map → config-loader-F5YAY7RP.js.map} +0 -0
  49. /package/dist/{daemon-manager-DDYQITPD.js.map → daemon-manager-2EQDVUVM.js.map} +0 -0
  50. /package/dist/{doctor-command-HEQQOYUR.js.map → doctor-command-YTCQ2SC7.js.map} +0 -0
  51. /package/dist/{installer-IYGMG7LS.js.map → installer-5UHTYQTB.js.map} +0 -0
  52. /package/dist/{server-JPNH33MX.js.map → server-4YLBAZEM.js.map} +0 -0
  53. /package/dist/{server-4PEREPHY.js.map → server-IS4K5FCT.js.map} +0 -0
  54. /package/dist/{session-V4PYJXNB.js.map → session-K7FCRKOC.js.map} +0 -0
  55. /package/dist/{studio-command-JOIFCOHC.js.map → studio-command-RFPV2DS7.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- export { C as ConnectOptions, D as Direction, S as Session, a as SuggestedSelector, c as connect } from '../session-D9e30RVS.js';
2
- import '../app-CgbLADmF.js';
1
+ export { C as ConnectOptions, D as Direction, S as Session, a as SuggestedSelector, c as connect } from '../session-CgvT-Oso.js';
2
+ import '../app-DSh1ejLh.js';
3
3
  import 'effect';
4
4
 
5
5
  interface ValidationError {
@@ -5,12 +5,12 @@ import "../chunk-PLE7RFQE.js";
5
5
  import {
6
6
  Session,
7
7
  connect
8
- } from "../chunk-WKVU24B6.js";
8
+ } from "../chunk-IGTK5MHB.js";
9
9
  import "../chunk-SF7UYW4I.js";
10
- import "../chunk-AJCSETN6.js";
11
- import "../chunk-SNL4X67N.js";
12
- import "../chunk-QP4MDUBY.js";
13
- import "../chunk-RKYKRGHB.js";
10
+ import "../chunk-3UVSUVHW.js";
11
+ import "../chunk-UEWZ2EXL.js";
12
+ import "../chunk-VP6V4XEJ.js";
13
+ import "../chunk-Z6K4QQAR.js";
14
14
  import "../chunk-WV3ALL3H.js";
15
15
  import "../chunk-JPZCZHL4.js";
16
16
  import "../chunk-2AFWVHQK.js";
@@ -16,6 +16,10 @@ interface SelectorModifiers<T extends string = string> {
16
16
  hasText?: string | RegExp;
17
17
  /** Exclude matches whose text contains this string or matches this RegExp (`.filter({ hasNotText })`). */
18
18
  hasNotText?: string | RegExp;
19
+ /** Keep only matches containing a descendant matching this selector (`.filter({ has })`). */
20
+ has?: Selector<T>;
21
+ /** Exclude matches containing a descendant matching this selector (`.filter({ hasNot })`). */
22
+ hasNot?: Selector<T>;
19
23
  /** Select the 0-based Nth match (negative values count from the end, e.g. `-1` for last). */
20
24
  nth?: number;
21
25
  /** Shorthand for `nth: 0` (`.first()`). */
@@ -36,8 +40,12 @@ type ObjectSelector<T extends string = string> = ({
36
40
  role: string;
37
41
  name?: string | RegExp;
38
42
  exact?: boolean;
43
+ level?: number;
44
+ includeHidden?: boolean;
39
45
  } & SelectorModifiers<T>) | ({
40
46
  css: string;
47
+ } & SelectorModifiers<T>) | ({
48
+ anyOf: Selector<T>[];
41
49
  } & SelectorModifiers<T>) | {
42
50
  point: {
43
51
  x: number;
@@ -73,16 +81,22 @@ interface RelativeSelector<T extends string = string> {
73
81
  }
74
82
  /** Extended selector that supports both simple and relative selectors. */
75
83
  type ExtendedSelector<T extends string = string> = Selector<T> | RelativeSelector<T>;
76
- /** Build an ARIA role selector (`getByRole(role, { name, exact })` or shorthand `byRole(role, name, opts)`). */
84
+ /** Build an ARIA role selector (`getByRole(role, { name, exact, level, includeHidden })` or shorthand `byRole(role, name, opts)`). */
77
85
  declare function byRole<T extends string = string>(role: string, opts?: {
78
86
  name?: string | RegExp;
79
87
  exact?: boolean;
88
+ level?: number;
89
+ includeHidden?: boolean;
80
90
  } & SelectorModifiers<T>): ObjectSelector<T>;
81
91
  declare function byRole<T extends string = string>(role: string, name: string | RegExp, opts?: {
82
92
  exact?: boolean;
93
+ level?: number;
94
+ includeHidden?: boolean;
83
95
  } & SelectorModifiers<T>): ObjectSelector<T>;
84
96
  /** Build a CSS selector (`locator(css)`), piercing Shadow DOM and same-origin iframes. */
85
97
  declare function byCss<T extends string = string>(css: string, opts?: SelectorModifiers<T>): ObjectSelector<T>;
98
+ /** Match elements satisfying ANY of the provided selectors (Playwright `locatorA.or(locatorB)`). */
99
+ declare function or<T extends string = string>(...selectors: Selector<T>[]): ObjectSelector<T>;
86
100
  /** Scope `child` inside elements matching `parent` (`locator(parent).locator(child)`). */
87
101
  declare function within<T extends string = string>(parent: Selector<T>, child: Selector<T>): ObjectSelector<T>;
88
102
  /** Scope `child` inside an `<iframe>` matching `frame` (`frameLocator(frame).locator(child)`). */
@@ -93,10 +107,12 @@ declare function nth<T extends string = string>(sel: Selector<T>, index: number)
93
107
  declare function first<T extends string = string>(sel: Selector<T>): ObjectSelector<T>;
94
108
  /** Narrow a selector to its last match (`.last()`). */
95
109
  declare function last<T extends string = string>(sel: Selector<T>): ObjectSelector<T>;
96
- /** Filter a selector's matches by text (`locator.filter({ hasText, hasNotText })`). */
110
+ /** Filter a selector's matches by text or descendant selector (`locator.filter({ hasText, hasNotText, has, hasNot })`). */
97
111
  declare function filterSelector<T extends string = string>(sel: Selector<T>, filter: {
98
112
  hasText?: string | RegExp;
99
113
  hasNotText?: string | RegExp;
114
+ has?: Selector<NoInfer<T>>;
115
+ hasNot?: Selector<NoInfer<T>>;
100
116
  }): ObjectSelector<T>;
101
117
  /**
102
118
  * Marks a label/text selector as targeting out-of-process system UI
@@ -118,7 +134,7 @@ declare function isSystemUISelector<T extends string = string>(sel: ExtendedSele
118
134
  declare function isTestIDSelector<T extends string = string>(sel: ExtendedSelector<T>): sel is {
119
135
  testID: T;
120
136
  };
121
- /** True when a selector uses web/DOM-specific composition (role, css, within, frame, nth, filter). */
137
+ /** True when a selector uses web/DOM-specific composition (role, css, anyOf, within, frame, nth, filter). */
122
138
  declare function isComposableDomSelector<T extends string = string>(sel: ExtendedSelector<T>): boolean;
123
139
 
124
140
  declare const DriverError_base: Schema.TaggedErrorClass<DriverError, "DriverError", {
@@ -156,9 +172,12 @@ interface DomElementMatch {
156
172
  tag?: string;
157
173
  role?: string;
158
174
  text?: string;
175
+ /** Whitespace-normalized `el.textContent` (immune to CSS `text-transform`, Playwright parity). */
176
+ textContent?: string;
159
177
  value?: string;
160
178
  accessibilityLabel?: string;
161
179
  accessibleName?: string;
180
+ accessibleDescription?: string;
162
181
  rect: DomRect;
163
182
  scrollX: number;
164
183
  scrollY: number;
@@ -205,17 +224,19 @@ interface DomWaitForMatchOptions {
205
224
  /** Max time to wait in ms. Default: 5000. */
206
225
  timeoutMs?: number;
207
226
  /** Assertion kind evaluated reactively inside the page via MutationObserver. */
208
- kind: "text" | "containsText" | "matchesText" | "value" | "attribute" | "accessibilityLabel" | "accessibleName" | "focused" | "count" | "url";
227
+ kind: "text" | "containsText" | "matchesText" | "value" | "attribute" | "accessibilityLabel" | "accessibleName" | "accessibleDescription" | "focused" | "count" | "url";
209
228
  /** Expected value/substring (optional when `kind === "attribute"` or `"accessibilityLabel"` checks presence). */
210
229
  expected?: string;
211
230
  /** Expected element count when `kind === "count"`. */
212
231
  expectedCount?: number;
213
232
  /** Attribute name when `kind === "attribute"`. */
214
233
  attributeName?: string;
215
- /** RegExp source when `kind === "matchesText" | "accessibleName" | "url"`. */
234
+ /** RegExp source when `kind === "matchesText" | "accessibleName" | "accessibleDescription" | "url"`. */
216
235
  patternSource?: string;
217
- /** RegExp flags when `kind === "matchesText" | "accessibleName" | "url"`. */
236
+ /** RegExp flags when `kind === "matchesText" | "accessibleName" | "accessibleDescription" | "url"`. */
218
237
  patternFlags?: string;
238
+ /** Invert the match condition (`expect(...).not.*`). */
239
+ negate?: boolean;
219
240
  }
220
241
  interface DomFillOptions {
221
242
  /** Max time to wait for an editable actionable target in ms. Default: 5000. */
@@ -289,17 +310,6 @@ interface DomChannel {
289
310
  listTargets?(): Promise<DomTargetInfo[]>;
290
311
  selectTarget?(targetId: string): Promise<void>;
291
312
  }
292
- /**
293
- * Self-contained MutationObserver-reactive DOM wait script with full single-round-trip
294
- * Playwright-grade actionability checks when `forAction: true`:
295
- * 1. App-ready signal (`window.__SPANA_APP_READY__`) when defined.
296
- * 2. Visible + enabled match (piercing open Shadow DOM & same-origin iframes).
297
- * 3. Auto-scroll offscreen targets into viewport (`scrollIntoView({ behavior: "instant" })`).
298
- * 4. Deep `elementFromPoint` hit-test verifying no overlay/backdrop/modal obscures the target.
299
- * 5. 2-rAF bounding-box stability check (≤ 1px movement; bypassed when `stableFrames === 0` or
300
- * `instantAnimations` style is active).
301
- * Retries seamlessly inside the page via `MutationObserver` + `rAF` in ONE single round trip!
302
- */
303
313
  declare function buildDomWaitForSelectorScript(selector: Selector, opts?: DomWaitForSelectorOptions): string;
304
314
  /**
305
315
  * Self-contained MutationObserver-reactive script that resolves `true` as soon as
@@ -325,8 +335,10 @@ declare function buildDomFillScript(selector: Selector, value: string, opts?: Do
325
335
  * Cuts per-action CDP `Runtime.evaluate` payload by ~100× (~8 KB → ~70 bytes)
326
336
  * and lets V8 TurboFan JIT-compile the selector & actionability helpers once.
327
337
  */
328
- declare const SPANA_INJECTED_RUNTIME_SCRIPT = "(function() {\n if (typeof window === \"undefined\" || window.__spanaRt) return true;\n \n function matchSpec(actual, spec, exact) {\n var str = String(actual || \"\");\n if (spec && typeof spec === \"object\" && typeof spec.__spanaRegex === \"string\") {\n try { return new RegExp(spec.__spanaRegex, spec.flags || \"\").test(str); } catch (e) { return false; }\n }\n var needle = String(spec == null ? \"\" : spec);\n if (exact) return str.trim() === needle.trim();\n return str.toLowerCase().indexOf(needle.toLowerCase()) !== -1;\n }\n function getImplicitRole(el) {\n if (!el || !el.getAttribute) return \"\";\n var explicit = (el.getAttribute(\"role\") || \"\").trim().toLowerCase();\n if (explicit) return explicit.split(/\\s+/)[0] || \"\";\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"BUTTON\") return \"button\";\n if (tag === \"A\") return el.hasAttribute(\"href\") ? \"link\" : \"\";\n if (tag === \"TEXTAREA\") return \"textbox\";\n if (tag === \"SELECT\") return (el.hasAttribute(\"multiple\") || Number(el.getAttribute(\"size\") || 0) > 1) ? \"listbox\" : \"combobox\";\n if (tag === \"OPTION\") return \"option\";\n if (tag === \"IMG\") return el.getAttribute(\"alt\") === \"\" ? \"presentation\" : \"img\";\n if (tag === \"DIALOG\") return \"dialog\";\n if (tag === \"NAV\") return \"navigation\";\n if (tag === \"MAIN\") return \"main\";\n if (tag === \"HEADER\") return \"banner\";\n if (tag === \"FOOTER\") return \"contentinfo\";\n if (tag === \"ASIDE\") return \"complementary\";\n if (tag === \"UL\" || tag === \"OL\") return \"list\";\n if (tag === \"LI\") return \"listitem\";\n if (tag === \"TABLE\") return \"table\";\n if (tag === \"TR\") return \"row\";\n if (tag === \"TD\") return \"cell\";\n if (tag === \"TH\") return \"columnheader\";\n if (tag === \"ARTICLE\") return \"article\";\n if (tag === \"FORM\") return \"form\";\n if (tag === \"PROGRESS\") return \"progressbar\";\n if (tag === \"HR\") return \"separator\";\n if (tag === \"SECTION\") return (el.hasAttribute(\"aria-label\") || el.hasAttribute(\"aria-labelledby\")) ? \"region\" : \"\";\n if (/^H[1-6]$/.test(tag)) return \"heading\";\n if (tag === \"INPUT\") {\n var t = (el.getAttribute(\"type\") || \"text\").toLowerCase();\n if (t === \"button\" || t === \"submit\" || t === \"reset\" || t === \"image\") return \"button\";\n if (t === \"checkbox\") return \"checkbox\";\n if (t === \"radio\") return \"radio\";\n if (t === \"search\") return \"searchbox\";\n if (t === \"number\") return \"spinbutton\";\n if (t === \"range\") return \"slider\";\n if (t === \"hidden\") return \"\";\n return \"textbox\";\n }\n return \"\";\n }\n function getAccessibleName(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var labelledBy = el.getAttribute && el.getAttribute(\"aria-labelledby\");\n if (labelledBy) {\n var parts = [];\n var ids = labelledBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = (ref.innerText || ref.textContent || \"\").trim();\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaLabel = el.getAttribute && el.getAttribute(\"aria-label\");\n if (ariaLabel && ariaLabel.trim()) return ariaLabel.trim();\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") {\n if (el.id && doc.querySelector) {\n try {\n var escId = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(el.id) : el.id;\n var forLbl = doc.querySelector('label[for=\"' + escId + '\"]');\n if (forLbl) {\n var ft = (forLbl.innerText || forLbl.textContent || \"\").trim();\n if (ft) return ft.replace(/\\s+/g, \" \");\n }\n } catch (e) {}\n }\n if (el.closest) {\n var wrapLbl = el.closest(\"label\");\n if (wrapLbl) {\n var wt = (wrapLbl.innerText || wrapLbl.textContent || \"\").trim();\n if (wt) return wt.replace(/\\s+/g, \" \");\n }\n }\n var itype = tag === \"INPUT\" ? (el.getAttribute(\"type\") || \"text\").toLowerCase() : \"\";\n if ((itype === \"button\" || itype === \"submit\" || itype === \"reset\") && el.value) {\n return String(el.value).trim();\n }\n var ph = el.getAttribute && el.getAttribute(\"placeholder\");\n if (ph && ph.trim()) return ph.trim();\n }\n if (tag === \"IMG\") {\n var alt = el.getAttribute && el.getAttribute(\"alt\");\n if (alt && alt.trim()) return alt.trim();\n }\n var title = el.getAttribute && el.getAttribute(\"title\");\n var txt = (el.innerText || el.textContent || \"\").replace(/\\s+/g, \" \").trim();\n if (txt) return txt;\n return title ? title.trim() : \"\";\n }\n function collectRoots(root, offsetX, offsetY, inShadow, inIframe, out) {\n if (!root) return;\n out.push({ root: root, offsetX: offsetX, offsetY: offsetY, inShadow: inShadow, inIframe: inIframe });\n if (root.shadowRoot) {\n collectRoots(root.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n var nodes = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var i = 0; i < nodes.length; i++) {\n var el = nodes[i];\n if (el.shadowRoot) {\n collectRoots(el.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var frameDoc = el.contentDocument;\n if (frameDoc) {\n var frameRect = el.getBoundingClientRect();\n collectRoots(frameDoc, offsetX + frameRect.left, offsetY + frameRect.top, inShadow, true, out);\n }\n } catch (e) {}\n }\n }\n }\n function findTextInRoot(root, needle, exact, ctx, pushHit) {\n var doc = root.ownerDocument || (root.nodeType === 9 ? root : document);\n if (doc && typeof doc.createTreeWalker === \"function\" && typeof NodeFilter !== \"undefined\") {\n var walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n var txtNode;\n while ((txtNode = walker.nextNode())) {\n var rawVal = (txtNode.nodeValue || \"\").trim();\n var val = rawVal.toLowerCase();\n var ok = exact ? rawVal === needle : (val && val.indexOf(needle.toLowerCase()) !== -1);\n if (ok && txtNode.parentElement) {\n pushHit(txtNode.parentElement, ctx);\n }\n }\n if (typeof root.querySelectorAll === \"function\") {\n var inputs = root.querySelectorAll(\"input, button\");\n for (var ii = 0; ii < inputs.length; ii++) {\n var inp = inputs[ii];\n var rawInp = String(inp.value || \"\").trim();\n var inpOk = exact ? rawInp === needle : (rawInp && rawInp.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (inpOk) {\n pushHit(inp, ctx);\n }\n }\n }\n return;\n }\n var all = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var k = 0; k < all.length; k++) {\n var node = all[k];\n var directText = \"\";\n for (var c = 0; c < node.childNodes.length; c++) {\n if (node.childNodes[c].nodeType === 3) directText += node.childNodes[c].textContent || \"\";\n }\n var trimmedDirect = directText.trim();\n var inpVal = (node.tagName === \"INPUT\" || node.tagName === \"BUTTON\") ? String(node.value || \"\").trim() : \"\";\n var directOk = exact ? trimmedDirect === needle : (trimmedDirect && trimmedDirect.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n var inputOk = exact ? inpVal === needle : (inpVal && inpVal.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (directOk || inputOk) {\n pushHit(node, ctx);\n }\n }\n }\n function findRoleInRoot(root, roleLower, nameSpec, exact, ctx, pushHit) {\n if (!root || !root.querySelectorAll) return;\n var candidates = root.querySelectorAll(\"*\");\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (getImplicitRole(el) !== roleLower) continue;\n if (nameSpec !== undefined && nameSpec !== null) {\n var accName = getAccessibleName(el);\n if (!matchSpec(accName, nameSpec, Boolean(exact))) continue;\n }\n pushHit(el, ctx);\n }\n }\n function applyModifiersAndSlice(hits, sel) {\n if (!sel || typeof sel !== \"object\" || \"point\" in sel) return hits;\n var filtered = hits;\n if (sel.hasText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return matchSpec(txt, sel.hasText, false);\n });\n }\n if (sel.hasNotText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return !matchSpec(txt, sel.hasNotText, false);\n });\n }\n if (sel.first) return filtered.length > 0 ? [filtered[0]] : [];\n if (sel.last) return filtered.length > 0 ? [filtered[filtered.length - 1]] : [];\n if (typeof sel.nth === \"number\") {\n var idx = sel.nth < 0 ? filtered.length + sel.nth : sel.nth;\n return idx >= 0 && idx < filtered.length ? [filtered[idx]] : [];\n }\n return filtered;\n }\n function findInScope(sel, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe) {\n var hits = [];\n var seen = typeof Set !== \"undefined\" ? new Set() : null;\n function pushHit(el, ctx) {\n if (seen) {\n if (seen.has(el)) return;\n seen.add(el);\n }\n hits.push({ el: el, offsetX: ctx.offsetX, offsetY: ctx.offsetY, inShadow: ctx.inShadow, inIframe: ctx.inIframe });\n }\n if (typeof sel === \"object\" && sel !== null && \"point\" in sel) {\n var atPt = document.elementFromPoint(sel.point.x, sel.point.y);\n if (atPt) pushHit(atPt, { offsetX: 0, offsetY: 0, inShadow: false, inIframe: false });\n return hits;\n }\n // Frame scoping: find matching <iframe> first, then search inside its contentDocument\n if (typeof sel === \"object\" && sel !== null && sel.frame) {\n var frameHits = findInScope(sel.frame, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var innerSel = Object.assign({}, sel);\n delete innerSel.frame;\n for (var fi = 0; fi < frameHits.length; fi++) {\n var fEl = frameHits[fi].el;\n if (fEl && fEl.tagName === \"IFRAME\") {\n try {\n var fDoc = fEl.contentDocument;\n if (fDoc) {\n var fRect = fEl.getBoundingClientRect();\n var sub = findInScope(innerSel, fDoc, frameHits[fi].offsetX + fRect.left, frameHits[fi].offsetY + fRect.top, frameHits[fi].inShadow, true);\n for (var si = 0; si < sub.length; si++) pushHit(sub[si].el, sub[si]);\n }\n } catch (e) {}\n }\n }\n return hits;\n }\n // Parent scoping: resolve 'within' first, then search inside each matched container\n if (typeof sel === \"object\" && sel !== null && sel.within) {\n var parentHits = findInScope(sel.within, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var childSel = Object.assign({}, sel);\n delete childSel.within;\n delete childSel.hasText;\n delete childSel.hasNotText;\n delete childSel.first;\n delete childSel.last;\n delete childSel.nth;\n var combined = [];\n var cSeen = typeof Set !== \"undefined\" ? new Set() : null;\n for (var pi = 0; pi < parentHits.length; pi++) {\n var ph = parentHits[pi];\n var subHits = findInScope(childSel, ph.el, ph.offsetX, ph.offsetY, ph.inShadow, ph.inIframe);\n for (var ci = 0; ci < subHits.length; ci++) {\n if (cSeen && cSeen.has(subHits[ci].el)) continue;\n if (cSeen) cSeen.add(subHits[ci].el);\n combined.push(subHits[ci]);\n }\n }\n return applyModifiersAndSlice(combined, sel);\n }\n\n var esc = function(v) {\n return typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(v) : String(v).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n };\n var mainCtx = { root: scopeRoot, offsetX: baseOffsetX, offsetY: baseOffsetY, inShadow: baseInShadow, inIframe: baseInIframe };\n var hasModifiers = typeof sel === \"object\" && sel !== null && (sel.hasText !== undefined || sel.hasNotText !== undefined || sel.first || sel.last || typeof sel.nth === \"number\");\n\n // O(1)-ish Light-DOM fast path: avoids scanning thousands of nodes with querySelectorAll(\"*\")\n // unless Shadow DOM / iframe piercing is needed or no Light-DOM match exists.\n if (scopeRoot && scopeRoot.querySelectorAll && !hasModifiers) {\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var fastTid = esc(sel.testID);\n var fastFound = scopeRoot.querySelectorAll('[data-testid=\"' + fastTid + '\"], [testID=\"' + fastTid + '\"]');\n if (fastFound.length > 0) {\n for (var fi2 = 0; fi2 < fastFound.length; fi2++) pushHit(fastFound[fi2], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var fastCss = scopeRoot.querySelectorAll(sel.css);\n if (fastCss.length > 0) {\n for (var fc = 0; fc < fastCss.length; fc++) pushHit(fastCss[fc], mainCtx);\n return hits;\n }\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var fastLbl = esc(sel.accessibilityLabel);\n var fastFoundLbl = scopeRoot.querySelectorAll('[aria-label=\"' + fastLbl + '\"]');\n if (fastFoundLbl.length > 0) {\n for (var fj = 0; fj < fastFoundLbl.length; fj++) pushHit(fastFoundLbl[fj], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(scopeRoot, String(sel.role).toLowerCase(), sel.name, sel.exact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var fastNeedle = typeof sel === \"string\" ? sel : sel.text;\n var fastExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(scopeRoot, fastNeedle, fastExact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n }\n }\n\n var roots = [];\n collectRoots(scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe, roots);\n for (var r = 0; r < roots.length; r++) {\n var ctx = roots[r];\n var root = ctx.root;\n if (!root || !root.querySelectorAll) continue;\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var tid = esc(sel.testID);\n var found = root.querySelectorAll('[data-testid=\"' + tid + '\"], [testID=\"' + tid + '\"]');\n for (var i = 0; i < found.length; i++) pushHit(found[i], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var foundCss = root.querySelectorAll(sel.css);\n for (var ci2 = 0; ci2 < foundCss.length; ci2++) pushHit(foundCss[ci2], ctx);\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var lbl = esc(sel.accessibilityLabel);\n var foundLbl = root.querySelectorAll('[aria-label=\"' + lbl + '\"]');\n for (var j = 0; j < foundLbl.length; j++) pushHit(foundLbl[j], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(root, String(sel.role).toLowerCase(), sel.name, sel.exact, ctx, pushHit);\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var needle = typeof sel === \"string\" ? sel : sel.text;\n var isExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(root, needle, isExact, ctx, pushHit);\n }\n }\n return applyModifiersAndSlice(hits, sel);\n }\n function findAcrossRoots(sel) {\n return findInScope(sel, document, 0, 0, false, false);\n }\n function isClickable(el) {\n var tag = el.tagName;\n if (tag === \"BUTTON\" || tag === \"A\" || tag === \"INPUT\" || tag === \"SELECT\" || tag === \"TEXTAREA\") return true;\n var role = el.getAttribute && el.getAttribute(\"role\");\n if (role === \"button\" || role === \"link\" || role === \"tab\" || role === \"checkbox\" || role === \"switch\") return true;\n if (typeof el.onclick === \"function\") return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cursor = win.getComputedStyle(el).cursor;\n return cursor === \"pointer\";\n }\n function isAppReady() {\n var sig = typeof window !== \"undefined\" ? window.__SPANA_APP_READY__ : undefined;\n if (typeof sig === \"function\") {\n try { return Boolean(sig()); } catch (e) { return false; }\n }\n if (typeof sig === \"boolean\") return sig;\n return true;\n }\n function deepElementFromPoint(rootDoc, x, y) {\n if (!rootDoc || typeof rootDoc.elementFromPoint !== \"function\") return null;\n var el = rootDoc.elementFromPoint(x, y);\n var guard = 0;\n while (el && guard++ < 16) {\n if (el.shadowRoot && typeof el.shadowRoot.elementFromPoint === \"function\") {\n var inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner && inner !== el) { el = inner; continue; }\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var fdoc = el.contentDocument;\n if (fdoc && typeof fdoc.elementFromPoint === \"function\") {\n var fr = el.getBoundingClientRect();\n var fx = x - fr.left;\n var fy = y - fr.top;\n var fEl = fdoc.elementFromPoint(fx, fy);\n if (fEl && fEl !== el) { el = fEl; x = fx; y = fy; continue; }\n }\n } catch (e) {}\n }\n break;\n }\n return el;\n }\n function isSameOrDescendant(target, candidate) {\n if (!target || !candidate) return false;\n if (target === candidate) return true;\n try {\n if (typeof target.contains === \"function\" && target.contains(candidate)) return true;\n if (typeof candidate.contains === \"function\" && candidate.contains(target)) return true;\n } catch (e) {}\n var cur = candidate;\n var guard = 0;\n while (cur && guard++ < 24) {\n if (cur === target) return true;\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n if (root && root.host) {\n cur = root.host;\n } else {\n cur = cur.parentElement;\n }\n }\n return false;\n }\n function isHitTestClear(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return false;\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return true;\n return isSameOrDescendant(el, topEl);\n }\n function ensureInViewport(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 1 || cy < 1 || cx > vw - 1 || cy > vh - 1)) {\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { el.scrollIntoView(true); } catch (e2) {} }\n }\n return true;\n }\n return false;\n }\n function hasActiveAnimation(el) {\n var cur = el;\n var depth = 0;\n while (cur && depth++ < 8) {\n if (typeof cur.getAnimations === \"function\") {\n try {\n var anims = cur.getAnimations();\n for (var i = 0; i < anims.length; i++) {\n if (anims[i] && anims[i].playState === \"running\") return true;\n }\n } catch (e) {}\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isVisible(el, rect) {\n if (rect.width <= 0 || rect.height <= 0) return false;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var style = win.getComputedStyle(el);\n if (style.display === \"none\" || style.visibility === \"hidden\" || parseFloat(style.opacity || \"1\") === 0) return false;\n return true;\n }\n function toMatch(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var attrs = {};\n if (el.attributes) {\n for (var i = 0; i < el.attributes.length; i++) {\n attrs[el.attributes[i].name] = el.attributes[i].value;\n }\n }\n var tag = el.tagName ? el.tagName.toLowerCase() : undefined;\n var val = (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.tagName === \"SELECT\")\n ? String(el.value ?? \"\")\n : undefined;\n var text = (el.innerText || el.textContent || \"\").trim() || undefined;\n var accName = getAccessibleName(el) || undefined;\n var role = getImplicitRole(el) || undefined;\n return {\n id: el.getAttribute(\"data-testid\") || el.getAttribute(\"testID\") || undefined,\n tag: tag,\n role: role,\n text: text,\n value: val,\n accessibilityLabel: el.getAttribute(\"aria-label\") || undefined,\n accessibleName: accName,\n rect: { x: rect.x + hit.offsetX, y: rect.y + hit.offsetY, width: rect.width, height: rect.height },\n scrollX: window.scrollX || window.pageXOffset || 0,\n scrollY: window.scrollY || window.pageYOffset || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0,\n viewportHeight: (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0,\n visible: isVisible(el, rect),\n enabled: !el.hasAttribute(\"disabled\") && el.getAttribute(\"aria-disabled\") !== \"true\",\n clickable: isClickable(el),\n focused: document.activeElement === el,\n attributes: attrs,\n inShadowDom: hit.inShadow || undefined,\n inIframe: hit.inIframe || undefined\n };\n }\n\n\n function query(sel) {\n return findAcrossRoots(sel).map(toMatch);\n }\n\n function scrollIntoView(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return null;\n var hit = hits[hits.length - 1];\n if (typeof hit.el.scrollIntoView === \"function\") {\n try { hit.el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { hit.el.scrollIntoView(true); } catch (e2) {} }\n }\n return toMatch(hit);\n }\n\n function tap(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return false;\n var hit = hits[hits.length - 1];\n var el = hit.el;\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); } catch (e) {}\n }\n var rect = el.getBoundingClientRect();\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var init = { bubbles: true, cancelable: true, composed: true, clientX: cx, clientY: cy };\n try { el.dispatchEvent(new PointerEvent(\"pointerdown\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mousedown\", init)); } catch (e) {}\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n try { el.dispatchEvent(new PointerEvent(\"pointerup\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mouseup\", init)); } catch (e) {}\n if (typeof el.click === \"function\") { el.click(); }\n else { el.dispatchEvent(new MouseEvent(\"click\", init)); }\n return true;\n }\n\n function waitForSelector(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var forAction = Boolean(opts.forAction);\n var failFastWhenIdle = Boolean(opts.failFastWhenIdle);\n var idleQuietMs = Math.max(50, Math.round(opts.idleQuietMs != null ? opts.idleQuietMs : 250));\n var reqStableFrames = opts.stableFrames !== undefined ? Math.max(0, Math.round(opts.stableFrames)) : (forAction ? -1 : 0);\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : forAction;\n var waitForAppReady = opts.waitForAppReady !== undefined ? Boolean(opts.waitForAppReady) : true;\n var instantAnim = Boolean(typeof document !== \"undefined\" && document.getElementById && document.getElementById(\"__spana_instant_anim\"));\n var explicitStableFrames = instantAnim ? 0 : reqStableFrames;\n\n function findCandidates() {\n if (waitForAppReady && !isAppReady()) return null;\n var rawHits = findAcrossRoots(sel);\n var ready = [];\n for (var i = 0; i < rawHits.length; i++) {\n var h = rawHits[i];\n var m = toMatch(h);\n if (!m.visible) continue;\n if (forAction && !m.enabled) continue;\n ready.push({ hit: h, match: m });\n }\n return ready.length > 0 ? ready : null;\n }\n\n function checkActionableNow() {\n var ready = findCandidates();\n if (!ready) return null;\n if (!forAction) return ready.map(function(r) { return r.match; });\n var target = ready[ready.length - 1];\n var didScroll = ensureInViewport(target.hit);\n if (checkHitTest && !isHitTestClear(target.hit)) return null;\n var updated = toMatch(target.hit);\n if (!updated.visible || !updated.enabled) return null;\n return { hits: ready, target: target, match: updated, didScroll: didScroll };\n }\n\n function neededStableFrames(candidate) {\n if (!forAction || typeof requestAnimationFrame !== \"function\") return 0;\n if (explicitStableFrames >= 0) return explicitStableFrames;\n if (hasActiveAnimation(candidate.target.hit.el)) return 2;\n if (candidate.didScroll) return 1;\n return 0;\n }\n\n var imm = checkActionableNow();\n if (imm) {\n if (!forAction) return imm;\n if (neededStableFrames(imm) <= 0) return [imm.match];\n }\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var idleTimer = null;\n var rafId = null;\n var checkingStability = false;\n\n function finish(result) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (idleTimer) clearTimeout(idleTimer);\n if (rafId !== null && typeof cancelAnimationFrame === \"function\") {\n try { cancelAnimationFrame(rafId); } catch (e) {}\n }\n resolve(result);\n }\n\n function armIdleTimer() {\n if (!failFastWhenIdle) return;\n if (idleTimer) clearTimeout(idleTimer);\n idleTimer = setTimeout(function() {\n if (document.readyState === \"complete\" && (!waitForAppReady || isAppReady())) {\n var hit = checkActionableNow();\n finish(hit ? (forAction ? [hit.match] : hit) : []);\n } else {\n armIdleTimer();\n }\n }, idleQuietMs);\n }\n\n function verifyStability(candidate) {\n if (done || checkingStability) return;\n var framesToWait = neededStableFrames(candidate);\n if (!forAction || framesToWait <= 0 || typeof requestAnimationFrame !== \"function\") {\n finish(forAction ? [candidate.match] : candidate);\n return;\n }\n checkingStability = true;\n var el = candidate.target.hit.el;\n var lastRect = candidate.match.rect;\n var remainingFrames = framesToWait;\n\n function step() {\n if (done) return;\n if (!el.isConnected) { checkingStability = false; return; }\n if (checkHitTest && !isHitTestClear(candidate.target.hit)) { checkingStability = false; return; }\n var cur = toMatch(candidate.target.hit);\n if (!cur.visible || !cur.enabled) { checkingStability = false; return; }\n var dx = Math.abs(cur.rect.x - lastRect.x);\n var dy = Math.abs(cur.rect.y - lastRect.y);\n var dw = Math.abs(cur.rect.width - lastRect.width);\n var dh = Math.abs(cur.rect.height - lastRect.height);\n if (dx <= 1 && dy <= 1 && dw <= 1 && dh <= 1) {\n remainingFrames -= 1;\n if (remainingFrames <= 0) { finish([cur]); return; }\n } else {\n remainingFrames = framesToWait;\n lastRect = cur.rect;\n }\n rafId = requestAnimationFrame(step);\n }\n rafId = requestAnimationFrame(step);\n }\n\n function attempt() {\n if (done || checkingStability) return;\n var hit = checkActionableNow();\n if (hit) {\n if (forAction) verifyStability(hit);\n else finish(hit);\n return;\n }\n armIdleTimer();\n }\n\n var scheduled = false;\n function scheduleAttempt() {\n if (done || scheduled || checkingStability) return;\n scheduled = true;\n Promise.resolve().then(function() { scheduled = false; attempt(); });\n }\n\n timeoutTimer = setTimeout(function() {\n var finalHit = checkActionableNow();\n finish(finalHit ? (forAction ? [finalHit.match] : finalHit) : []);\n }, timeoutMs);\n fallbackInterval = setInterval(attempt, forAction ? 40 : 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(scheduleAttempt);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n attempt();\n });\n }\n\n function waitForHidden(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n function isHiddenNow() {\n var hits = findAcrossRoots(sel);\n for (var i = 0; i < hits.length; i++) {\n if (toMatch(hits[i]).visible) return false;\n }\n return true;\n }\n if (isHiddenNow()) return true;\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n function finish(val) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(val);\n }\n function onChange() { if (isHiddenNow()) finish(true); }\n timeoutTimer = setTimeout(function() { finish(isHiddenNow()); }, timeoutMs);\n fallbackInterval = setInterval(onChange, 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function waitForMatch(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var kind = opts.kind;\n var expected = opts.expected !== undefined ? opts.expected : null;\n var expectedCount = opts.expectedCount !== undefined ? opts.expectedCount : null;\n var attributeName = opts.attributeName !== undefined ? opts.attributeName : null;\n var patternSource = opts.patternSource !== undefined ? opts.patternSource : null;\n var patternFlags = opts.patternFlags || \"\";\n var lastActual = undefined;\n var regex = patternSource !== null ? new RegExp(patternSource, patternFlags) : null;\n\n function evaluateMatch() {\n if (kind === \"url\") {\n var href = typeof window !== \"undefined\" && window.location ? String(window.location.href || \"\") : \"\";\n lastActual = href;\n if (regex) {\n if (regex.test(href)) return { matched: true, actual: href };\n } else if (expected !== null) {\n if (href === expected || href.indexOf(String(expected)) !== -1) {\n return { matched: true, actual: href };\n }\n }\n return null;\n }\n\n var hits = findAcrossRoots(sel);\n\n if (kind === \"count\") {\n var visibleCount = 0;\n for (var ci = 0; ci < hits.length; ci++) {\n if (toMatch(hits[ci]).visible) visibleCount++;\n }\n lastActual = String(visibleCount);\n if (expectedCount !== null && visibleCount === expectedCount) {\n return { matched: true, actual: String(visibleCount) };\n }\n return null;\n }\n\n for (var i = hits.length - 1; i >= 0; i--) {\n var m = toMatch(hits[i]);\n if (!m.visible) continue;\n if (kind === \"text\") {\n lastActual = m.text;\n if (m.text === expected) return { matched: true, actual: m.text };\n } else if (kind === \"containsText\") {\n var actual = m.text || \"\";\n lastActual = m.text;\n if (expected !== null && actual.toLowerCase().indexOf(String(expected).toLowerCase()) !== -1) {\n return { matched: true, actual: m.text };\n }\n } else if (kind === \"matchesText\") {\n var actualRe = m.text || \"\";\n lastActual = m.text;\n if (regex && regex.test(actualRe)) return { matched: true, actual: m.text };\n } else if (kind === \"value\") {\n var val = m.value !== undefined ? m.value : \"\";\n lastActual = val;\n if (val === expected) return { matched: true, actual: val };\n } else if (kind === \"attribute\" && attributeName !== null) {\n var attrVal = m.attributes ? m.attributes[attributeName] : undefined;\n lastActual = attrVal;\n if (expected === null ? attrVal !== undefined : attrVal === expected) {\n return { matched: true, actual: attrVal };\n }\n } else if (kind === \"accessibilityLabel\") {\n var lbl = m.accessibilityLabel;\n lastActual = lbl;\n if (expected === null ? (lbl !== undefined && lbl.length > 0) : lbl === expected) {\n return { matched: true, actual: lbl };\n }\n } else if (kind === \"accessibleName\") {\n var accName = m.accessibleName || m.accessibilityLabel || m.text || \"\";\n lastActual = accName;\n if (regex) {\n if (regex.test(accName)) return { matched: true, actual: accName };\n } else if (expected === null ? accName.length > 0 : accName.trim() === String(expected).trim()) {\n return { matched: true, actual: accName };\n }\n } else if (kind === \"focused\") {\n lastActual = m.focused ? \"focused\" : \"not focused\";\n if (m.focused) return { matched: true, actual: \"focused\" };\n }\n }\n return null;\n }\n\n var immediate = evaluateMatch();\n if (immediate) return immediate;\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n function finish(res) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"input\", onChange, true);\n document.removeEventListener(\"change\", onChange, true);\n document.removeEventListener(\"focusin\", onChange, true);\n document.removeEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n }\n resolve(res);\n }\n function onChange() {\n if (done || scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done) return;\n var res = evaluateMatch();\n if (res) finish(res);\n });\n }\n timeoutTimer = setTimeout(function() {\n var finalRes = evaluateMatch();\n finish(finalRes || { matched: false, actual: lastActual });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, kind === \"url\" ? 50 : 120);\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"input\", onChange, true);\n document.addEventListener(\"change\", onChange, true);\n document.addEventListener(\"focusin\", onChange, true);\n document.addEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n }\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function fill(sel, val, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : true;\n function writeValue(el) {\n if (el.isContentEditable) return false;\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\") {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var proto = tag === \"TEXTAREA\"\n ? (win.HTMLTextAreaElement && win.HTMLTextAreaElement.prototype)\n : (win.HTMLInputElement && win.HTMLInputElement.prototype);\n var desc = proto ? Object.getOwnPropertyDescriptor(proto, \"value\") : null;\n if (desc && typeof desc.set === \"function\") desc.set.call(el, val);\n else el.value = val;\n if (el._valueTracker && typeof el._valueTracker.setValue === \"function\") {\n try { el._valueTracker.setValue(val === \"\" ? \" \" : \"\"); } catch (e) {}\n }\n } else if (tag === \"SELECT\") {\n el.value = val;\n } else {\n el.value = val;\n }\n try { el.dispatchEvent(new InputEvent(\"input\", { bubbles: true, cancelable: true, data: val, inputType: \"insertText\" })); }\n catch (e) { el.dispatchEvent(new Event(\"input\", { bubbles: true, cancelable: true })); }\n el.dispatchEvent(new Event(\"change\", { bubbles: true, cancelable: true }));\n return true;\n }\n function findEditableNow() {\n if (!isAppReady()) return null;\n var hits = findAcrossRoots(sel);\n for (var i = hits.length - 1; i >= 0; i--) {\n var h = hits[i];\n var m = toMatch(h);\n if (!m.visible || !m.enabled) continue;\n ensureInViewport(h);\n if (checkHitTest && !isHitTestClear(h)) continue;\n return h.el;\n }\n return null;\n }\n function verifyAndRetryFill(attemptsLeft) {\n var el = findEditableNow();\n if (!el || el.isContentEditable) return Promise.resolve(false);\n if (!writeValue(el)) return Promise.resolve(false);\n return new Promise(function(resolve) {\n setTimeout(function() {\n var latest = findEditableNow() || el;\n if (latest && latest.isConnected && String(latest.value == null ? \"\" : latest.value) === val) {\n resolve(true);\n return;\n }\n if (attemptsLeft > 1) {\n verifyAndRetryFill(attemptsLeft - 1).then(resolve);\n } else {\n resolve(false);\n }\n }, 12);\n });\n }\n var immEl = findEditableNow();\n if (immEl) {\n if (immEl.isContentEditable) return false;\n return verifyAndRetryFill(3);\n }\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n var filling = false;\n function finish(ok) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(ok);\n }\n function onChange() {\n if (done || scheduled || filling) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done || filling) return;\n var target = findEditableNow();\n if (!target) return;\n if (target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(3).then(function(ok) { finish(ok); });\n });\n }\n timeoutTimer = setTimeout(function() {\n if (filling) return;\n var target = findEditableNow();\n if (!target || target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(2).then(function(ok) { finish(ok); });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, 40);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n window.__spanaRt = {\n query: query,\n scrollIntoView: scrollIntoView,\n tap: tap,\n waitForSelector: waitForSelector,\n waitForHidden: waitForHidden,\n waitForMatch: waitForMatch,\n fill: fill\n };\n return true;\n})();";
338
+ declare const SPANA_INJECTED_RUNTIME_SCRIPT = "(function() {\n if (typeof window === \"undefined\" || window.__spanaRt) return true;\n \n function matchSpec(actual, spec, exact) {\n var str = String(actual || \"\");\n if (spec && typeof spec === \"object\" && typeof spec.__spanaRegex === \"string\") {\n try { return new RegExp(spec.__spanaRegex, spec.flags || \"\").test(str); } catch (e) { return false; }\n }\n var needle = String(spec == null ? \"\" : spec);\n if (exact) return str.trim() === needle.trim();\n return str.toLowerCase().indexOf(needle.toLowerCase()) !== -1;\n }\n function getImplicitRole(el) {\n if (!el || !el.getAttribute) return \"\";\n var explicit = (el.getAttribute(\"role\") || \"\").trim().toLowerCase();\n if (explicit) return explicit.split(/\\s+/)[0] || \"\";\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"BUTTON\") return \"button\";\n if (tag === \"A\") return el.hasAttribute(\"href\") ? \"link\" : \"\";\n if (tag === \"TEXTAREA\") return \"textbox\";\n if (tag === \"SELECT\") return (el.hasAttribute(\"multiple\") || Number(el.getAttribute(\"size\") || 0) > 1) ? \"listbox\" : \"combobox\";\n if (tag === \"OPTION\") return \"option\";\n if (tag === \"IMG\") return el.getAttribute(\"alt\") === \"\" ? \"presentation\" : \"img\";\n if (tag === \"DIALOG\") return \"dialog\";\n if (tag === \"NAV\") return \"navigation\";\n if (tag === \"MAIN\") return \"main\";\n if (tag === \"HEADER\") return \"banner\";\n if (tag === \"FOOTER\") return \"contentinfo\";\n if (tag === \"ASIDE\") return \"complementary\";\n if (tag === \"UL\" || tag === \"OL\") return \"list\";\n if (tag === \"LI\") return \"listitem\";\n if (tag === \"TABLE\") return \"table\";\n if (tag === \"TR\") return \"row\";\n if (tag === \"TD\") return \"cell\";\n if (tag === \"TH\") return \"columnheader\";\n if (tag === \"ARTICLE\") return \"article\";\n if (tag === \"FORM\") return \"form\";\n if (tag === \"PROGRESS\") return \"progressbar\";\n if (tag === \"HR\") return \"separator\";\n if (tag === \"SECTION\") return (el.hasAttribute(\"aria-label\") || el.hasAttribute(\"aria-labelledby\")) ? \"region\" : \"\";\n if (/^H[1-6]$/.test(tag)) return \"heading\";\n if (tag === \"INPUT\") {\n var t = (el.getAttribute(\"type\") || \"text\").toLowerCase();\n if (t === \"button\" || t === \"submit\" || t === \"reset\" || t === \"image\") return \"button\";\n if (t === \"checkbox\") return \"checkbox\";\n if (t === \"radio\") return \"radio\";\n if (t === \"search\") return \"searchbox\";\n if (t === \"number\") return \"spinbutton\";\n if (t === \"range\") return \"slider\";\n if (t === \"hidden\") return \"\";\n return \"textbox\";\n }\n return \"\";\n }\n function visibleTextOf(node, allowHiddenRoot, skipControl) {\n if (!node) return \"\";\n if (node.nodeType === 3) return node.nodeValue || \"\";\n if (node.nodeType !== 1 && node.nodeType !== 11) return \"\";\n if (node.nodeType === 1) {\n if (skipControl && node === skipControl) return \"\";\n var t = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (t === \"SCRIPT\" || t === \"STYLE\" || t === \"NOSCRIPT\" || t === \"TEMPLATE\") return \"\";\n if (skipControl && (t === \"SELECT\" || t === \"TEXTAREA\" || t === \"INPUT\")) return \"\";\n if (!allowHiddenRoot) {\n if (node.getAttribute && node.getAttribute(\"aria-hidden\") === \"true\") return \"\";\n var win = (node.ownerDocument && node.ownerDocument.defaultView) || window;\n if (win && win.getComputedStyle) {\n var st = win.getComputedStyle(node);\n if (st && (st.display === \"none\" || st.visibility === \"hidden\" || st.visibility === \"collapse\")) {\n return \"\";\n }\n }\n }\n }\n var out = [];\n if (node.shadowRoot) {\n var stxt = visibleTextOf(node.shadowRoot, false, skipControl);\n if (stxt) out.push(stxt);\n }\n var kids = node.childNodes || [];\n for (var i = 0; i < kids.length; i++) {\n var k = visibleTextOf(kids[i], false, skipControl);\n if (k) out.push(k);\n }\n return out.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n function isAriaHidden(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 32) {\n if (cur.getAttribute) {\n if (cur.getAttribute(\"aria-hidden\") === \"true\") return true;\n if (cur.hasAttribute && cur.hasAttribute(\"inert\")) return true;\n }\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs && cs.display === \"none\") return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (typeof el.checkVisibility === \"function\") {\n try {\n if (!el.checkVisibility({ visibilityProperty: true })) return true;\n } catch (e) {}\n } else if (win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n function headingLevelOf(el) {\n if (!el) return null;\n var explicit = el.getAttribute && el.getAttribute(\"aria-level\");\n if (explicit) {\n var parsed = parseInt(explicit, 10);\n if (!isNaN(parsed)) return parsed;\n }\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n var m = /^H([1-6])$/.exec(tag);\n return m ? parseInt(m[1], 10) : null;\n }\n function getAccessibleName(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var labelledBy = el.getAttribute && el.getAttribute(\"aria-labelledby\");\n if (labelledBy) {\n var parts = [];\n var ids = labelledBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaLabel = el.getAttribute && el.getAttribute(\"aria-label\");\n if (ariaLabel && ariaLabel.trim()) return ariaLabel.trim();\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") {\n if (el.id && doc.querySelector) {\n try {\n var escId = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(el.id) : el.id;\n var forLbl = doc.querySelector('label[for=\"' + escId + '\"]');\n if (forLbl) {\n var ft = visibleTextOf(forLbl, false, el);\n if (ft) return ft;\n }\n } catch (e) {}\n }\n if (el.closest) {\n var wrapLbl = el.closest(\"label\");\n if (wrapLbl) {\n var wt = visibleTextOf(wrapLbl, false, el);\n if (wt) return wt;\n }\n }\n var itype = tag === \"INPUT\" ? (el.getAttribute(\"type\") || \"text\").toLowerCase() : \"\";\n if ((itype === \"button\" || itype === \"submit\" || itype === \"reset\") && el.value) {\n return String(el.value).trim();\n }\n var ph = el.getAttribute && el.getAttribute(\"placeholder\");\n if (ph && ph.trim()) return ph.trim();\n }\n if (tag === \"IMG\") {\n var alt = el.getAttribute && el.getAttribute(\"alt\");\n if (alt && alt.trim()) return alt.trim();\n }\n var txt = visibleTextOf(el, false, null);\n if (txt) return txt;\n var title = el.getAttribute && el.getAttribute(\"title\");\n return title ? title.trim() : \"\";\n }\n function getAccessibleDescription(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var describedBy = el.getAttribute && el.getAttribute(\"aria-describedby\");\n if (describedBy) {\n var parts = [];\n var ids = describedBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaDesc = el.getAttribute && el.getAttribute(\"aria-description\");\n if (ariaDesc && ariaDesc.trim()) return ariaDesc.trim();\n var title = el.getAttribute && el.getAttribute(\"title\");\n if (title && title.trim()) {\n var accName = getAccessibleName(el);\n if (accName && accName !== title.trim()) return title.trim();\n }\n return \"\";\n }\n function collectRoots(root, offsetX, offsetY, inShadow, inIframe, out) {\n if (!root) return;\n out.push({ root: root, offsetX: offsetX, offsetY: offsetY, inShadow: inShadow, inIframe: inIframe });\n if (root.shadowRoot) {\n collectRoots(root.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n var nodes = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var i = 0; i < nodes.length; i++) {\n var el = nodes[i];\n if (el.shadowRoot) {\n collectRoots(el.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var frameDoc = el.contentDocument;\n if (frameDoc) {\n var frameRect = el.getBoundingClientRect();\n collectRoots(frameDoc, offsetX + frameRect.left, offsetY + frameRect.top, inShadow, true, out);\n }\n } catch (e) {}\n }\n }\n }\n function findTextInRoot(root, needle, exact, ctx, pushHit) {\n var doc = root.ownerDocument || (root.nodeType === 9 ? root : document);\n if (doc && typeof doc.createTreeWalker === \"function\" && typeof NodeFilter !== \"undefined\") {\n var walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n var txtNode;\n while ((txtNode = walker.nextNode())) {\n var rawVal = (txtNode.nodeValue || \"\").trim();\n var val = rawVal.toLowerCase();\n var ok = exact ? rawVal === needle : (val && val.indexOf(needle.toLowerCase()) !== -1);\n if (ok && txtNode.parentElement) {\n pushHit(txtNode.parentElement, ctx);\n }\n }\n if (typeof root.querySelectorAll === \"function\") {\n var inputs = root.querySelectorAll(\"input, button\");\n for (var ii = 0; ii < inputs.length; ii++) {\n var inp = inputs[ii];\n var rawInp = String(inp.value || \"\").trim();\n var inpOk = exact ? rawInp === needle : (rawInp && rawInp.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (inpOk) {\n pushHit(inp, ctx);\n }\n }\n }\n return;\n }\n var all = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var k = 0; k < all.length; k++) {\n var node = all[k];\n var directText = \"\";\n for (var c = 0; c < node.childNodes.length; c++) {\n if (node.childNodes[c].nodeType === 3) directText += node.childNodes[c].textContent || \"\";\n }\n var trimmedDirect = directText.trim();\n var inpVal = (node.tagName === \"INPUT\" || node.tagName === \"BUTTON\") ? String(node.value || \"\").trim() : \"\";\n var directOk = exact ? trimmedDirect === needle : (trimmedDirect && trimmedDirect.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n var inputOk = exact ? inpVal === needle : (inpVal && inpVal.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (directOk || inputOk) {\n pushHit(node, ctx);\n }\n }\n }\n function findRoleInRoot(root, roleLower, nameSpec, exact, ctx, pushHit, includeHidden, level) {\n if (!root || !root.querySelectorAll) return;\n var candidates = root.querySelectorAll(\"*\");\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (getImplicitRole(el) !== roleLower) continue;\n if (!includeHidden && isAriaHidden(el)) continue;\n if (level !== undefined && level !== null && headingLevelOf(el) !== Number(level)) continue;\n if (nameSpec !== undefined && nameSpec !== null) {\n var accName = getAccessibleName(el);\n if (!matchSpec(accName, nameSpec, Boolean(exact))) continue;\n }\n pushHit(el, ctx);\n }\n }\n function applyModifiersAndSlice(hits, sel) {\n if (!sel || typeof sel !== \"object\" || \"point\" in sel) return hits;\n var filtered = hits;\n if (sel.hasText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return matchSpec(txt, sel.hasText, false);\n });\n }\n if (sel.hasNotText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return !matchSpec(txt, sel.hasNotText, false);\n });\n }\n if (sel.has !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.has, h.el, h.offsetX, h.offsetY, h.inShadow, h.inIframe).length > 0;\n });\n }\n if (sel.hasNot !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.hasNot, h.el, h.offsetX, h.offsetY, h.inShadow, h.inIframe).length === 0;\n });\n }\n if (sel.first) return filtered.length > 0 ? [filtered[0]] : [];\n if (sel.last) return filtered.length > 0 ? [filtered[filtered.length - 1]] : [];\n if (typeof sel.nth === \"number\") {\n var idx = sel.nth < 0 ? filtered.length + sel.nth : sel.nth;\n return idx >= 0 && idx < filtered.length ? [filtered[idx]] : [];\n }\n return filtered;\n }\n function findInScope(sel, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe) {\n var hits = [];\n var seen = typeof Set !== \"undefined\" ? new Set() : null;\n function pushHit(el, ctx) {\n if (seen) {\n if (seen.has(el)) return;\n seen.add(el);\n }\n hits.push({ el: el, offsetX: ctx.offsetX, offsetY: ctx.offsetY, inShadow: ctx.inShadow, inIframe: ctx.inIframe });\n }\n if (typeof sel === \"object\" && sel !== null && \"point\" in sel) {\n var atPt = document.elementFromPoint(sel.point.x, sel.point.y);\n if (atPt) pushHit(atPt, { offsetX: 0, offsetY: 0, inShadow: false, inIframe: false });\n return hits;\n }\n // Frame scoping: find matching <iframe> first, then search inside its contentDocument\n if (typeof sel === \"object\" && sel !== null && sel.frame) {\n var frameHits = findInScope(sel.frame, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var innerSel = Object.assign({}, sel);\n delete innerSel.frame;\n for (var fi = 0; fi < frameHits.length; fi++) {\n var fEl = frameHits[fi].el;\n if (fEl && fEl.tagName === \"IFRAME\") {\n try {\n var fDoc = fEl.contentDocument;\n if (fDoc) {\n var fRect = fEl.getBoundingClientRect();\n var sub = findInScope(innerSel, fDoc, frameHits[fi].offsetX + fRect.left, frameHits[fi].offsetY + fRect.top, frameHits[fi].inShadow, true);\n for (var si = 0; si < sub.length; si++) pushHit(sub[si].el, sub[si]);\n }\n } catch (e) {}\n }\n }\n return hits;\n }\n // Parent scoping: resolve 'within' first, then search inside each matched container\n if (typeof sel === \"object\" && sel !== null && sel.within) {\n var parentHits = findInScope(sel.within, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var childSel = Object.assign({}, sel);\n delete childSel.within;\n delete childSel.hasText;\n delete childSel.hasNotText;\n delete childSel.has;\n delete childSel.hasNot;\n delete childSel.first;\n delete childSel.last;\n delete childSel.nth;\n var combined = [];\n var cSeen = typeof Set !== \"undefined\" ? new Set() : null;\n for (var pi = 0; pi < parentHits.length; pi++) {\n var ph = parentHits[pi];\n var subHits = findInScope(childSel, ph.el, ph.offsetX, ph.offsetY, ph.inShadow, ph.inIframe);\n for (var ci = 0; ci < subHits.length; ci++) {\n if (cSeen && cSeen.has(subHits[ci].el)) continue;\n if (cSeen) cSeen.add(subHits[ci].el);\n combined.push(subHits[ci]);\n }\n }\n return applyModifiersAndSlice(combined, sel);\n }\n // Logical OR composition (anyOf): union deduplicated hits across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.anyOf)) {\n for (var bi = 0; bi < sel.anyOf.length; bi++) {\n var branchHits = findInScope(sel.anyOf[bi], scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n for (var bh = 0; bh < branchHits.length; bh++) {\n pushHit(branchHits[bh].el, branchHits[bh]);\n }\n }\n return applyModifiersAndSlice(hits, sel);\n }\n\n var esc = function(v) {\n return typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(v) : String(v).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n };\n var mainCtx = { root: scopeRoot, offsetX: baseOffsetX, offsetY: baseOffsetY, inShadow: baseInShadow, inIframe: baseInIframe };\n var hasModifiers = typeof sel === \"object\" && sel !== null && (sel.hasText !== undefined || sel.hasNotText !== undefined || sel.has !== undefined || sel.hasNot !== undefined || sel.first || sel.last || typeof sel.nth === \"number\");\n\n // O(1)-ish Light-DOM fast path: avoids scanning thousands of nodes with querySelectorAll(\"*\")\n // unless Shadow DOM / iframe piercing is needed or no Light-DOM match exists.\n if (scopeRoot && scopeRoot.querySelectorAll && !hasModifiers) {\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var fastTid = esc(sel.testID);\n var fastFound = scopeRoot.querySelectorAll('[data-testid=\"' + fastTid + '\"], [testID=\"' + fastTid + '\"]');\n if (fastFound.length > 0) {\n for (var fi2 = 0; fi2 < fastFound.length; fi2++) pushHit(fastFound[fi2], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var fastCss = scopeRoot.querySelectorAll(sel.css);\n if (fastCss.length > 0) {\n for (var fc = 0; fc < fastCss.length; fc++) pushHit(fastCss[fc], mainCtx);\n return hits;\n }\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var fastLbl = esc(sel.accessibilityLabel);\n var fastFoundLbl = scopeRoot.querySelectorAll('[aria-label=\"' + fastLbl + '\"]');\n if (fastFoundLbl.length > 0) {\n for (var fj = 0; fj < fastFoundLbl.length; fj++) pushHit(fastFoundLbl[fj], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(scopeRoot, String(sel.role).toLowerCase(), sel.name, sel.exact, mainCtx, pushHit, sel.includeHidden, sel.level);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var fastNeedle = typeof sel === \"string\" ? sel : sel.text;\n var fastExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(scopeRoot, fastNeedle, fastExact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n }\n }\n\n var roots = [];\n collectRoots(scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe, roots);\n for (var r = 0; r < roots.length; r++) {\n var ctx = roots[r];\n var root = ctx.root;\n if (!root || !root.querySelectorAll) continue;\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var tid = esc(sel.testID);\n var found = root.querySelectorAll('[data-testid=\"' + tid + '\"], [testID=\"' + tid + '\"]');\n for (var i = 0; i < found.length; i++) pushHit(found[i], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var foundCss = root.querySelectorAll(sel.css);\n for (var ci2 = 0; ci2 < foundCss.length; ci2++) pushHit(foundCss[ci2], ctx);\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var lbl = esc(sel.accessibilityLabel);\n var foundLbl = root.querySelectorAll('[aria-label=\"' + lbl + '\"]');\n for (var j = 0; j < foundLbl.length; j++) pushHit(foundLbl[j], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(root, String(sel.role).toLowerCase(), sel.name, sel.exact, ctx, pushHit, sel.includeHidden, sel.level);\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var needle = typeof sel === \"string\" ? sel : sel.text;\n var isExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(root, needle, isExact, ctx, pushHit);\n }\n }\n return applyModifiersAndSlice(hits, sel);\n }\n function findAcrossRoots(sel) {\n return findInScope(sel, document, 0, 0, false, false);\n }\n function isClickable(el) {\n var tag = el.tagName;\n if (tag === \"BUTTON\" || tag === \"A\" || tag === \"INPUT\" || tag === \"SELECT\" || tag === \"TEXTAREA\") return true;\n var role = el.getAttribute && el.getAttribute(\"role\");\n if (role === \"button\" || role === \"link\" || role === \"tab\" || role === \"checkbox\" || role === \"switch\") return true;\n if (typeof el.onclick === \"function\") return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cursor = win.getComputedStyle(el).cursor;\n return cursor === \"pointer\";\n }\n function isAppReady() {\n var sig = typeof window !== \"undefined\" ? window.__SPANA_APP_READY__ : undefined;\n if (typeof sig === \"function\") {\n try { return Boolean(sig()); } catch (e) { return false; }\n }\n if (typeof sig === \"boolean\") return sig;\n return true;\n }\n function deepElementFromPoint(rootDoc, x, y) {\n if (!rootDoc || typeof rootDoc.elementFromPoint !== \"function\") return null;\n var el = rootDoc.elementFromPoint(x, y);\n var guard = 0;\n while (el && guard++ < 16) {\n if (el.shadowRoot && typeof el.shadowRoot.elementFromPoint === \"function\") {\n var inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner && inner !== el) { el = inner; continue; }\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var fdoc = el.contentDocument;\n if (fdoc && typeof fdoc.elementFromPoint === \"function\") {\n var fr = el.getBoundingClientRect();\n var fx = x - fr.left;\n var fy = y - fr.top;\n var fEl = fdoc.elementFromPoint(fx, fy);\n if (fEl && fEl !== el) { el = fEl; x = fx; y = fy; continue; }\n }\n } catch (e) {}\n }\n break;\n }\n return el;\n }\n function labelControlOf(node) {\n var cur = node;\n var guard = 0;\n while (cur && guard++ < 8) {\n if (cur.tagName === \"LABEL\") return cur.control || null;\n cur = cur.parentElement;\n }\n return null;\n }\n function isSameOrDescendant(target, candidate) {\n if (!target || !candidate) return false;\n if (target === candidate) return true;\n try {\n if (typeof target.contains === \"function\" && target.contains(candidate)) return true;\n } catch (e) {}\n if (labelControlOf(candidate) === target) return true;\n var cur = candidate;\n var guard = 0;\n while (cur && guard++ < 24) {\n if (cur === target) return true;\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n if (root && root.host) {\n cur = root.host;\n } else {\n cur = cur.parentElement;\n }\n }\n return false;\n }\n function describeEl(el) {\n if (!el) return \"(unknown)\";\n var tag = el.tagName ? el.tagName.toLowerCase() : \"element\";\n var idPart = el.id ? \"#\" + el.id : \"\";\n var cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).filter(Boolean).slice(0, 3).join(\".\") : \"\";\n var clsPart = cls ? \".\" + cls : \"\";\n var txt = (el.innerText || el.textContent || \"\").replace(/\\s+/g, \" \").trim();\n if (txt.length > 40) txt = txt.slice(0, 37) + \"...\";\n return \"<\" + tag + idPart + clsPart + (txt ? \">\" + txt + \"</\" + tag + \">\" : \">\");\n }\n function getHitTestBlocker(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return \"outside viewport\";\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return null;\n if (isSameOrDescendant(el, topEl)) return null;\n return describeEl(topEl);\n }\n function isHitTestClear(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return false;\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return true;\n return isSameOrDescendant(el, topEl);\n }\n function ensureInViewport(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 1 || cy < 1 || cx > vw - 1 || cy > vh - 1)) {\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { el.scrollIntoView(true); } catch (e2) {} }\n }\n return true;\n }\n return false;\n }\n function scrollToUnobscure(hit) {\n var el = hit.el;\n if (typeof el.scrollIntoView !== \"function\") return false;\n var blocks = [\"center\", \"end\", \"start\", \"nearest\"];\n for (var i = 0; i < blocks.length; i++) {\n try {\n el.scrollIntoView({ block: blocks[i], inline: \"center\", behavior: \"instant\" });\n } catch (e) {\n try { el.scrollIntoView(true); } catch (e2) {}\n }\n if (isHitTestClear(hit)) return true;\n }\n return false;\n }\n function hasActiveAnimation(el) {\n var cur = el;\n var depth = 0;\n while (cur && depth++ < 8) {\n if (typeof cur.getAnimations === \"function\") {\n try {\n var anims = cur.getAnimations();\n for (var i = 0; i < anims.length; i++) {\n if (anims[i] && anims[i].playState === \"running\") return true;\n }\n } catch (e) {}\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isVisible(el, rect) {\n if (rect.width <= 0 || rect.height <= 0) return false;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var style = win.getComputedStyle(el);\n if (style.display === \"none\" || style.visibility === \"hidden\" || parseFloat(style.opacity || \"1\") === 0) return false;\n return true;\n }\n function toMatch(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var attrs = {};\n if (el.attributes) {\n for (var i = 0; i < el.attributes.length; i++) {\n attrs[el.attributes[i].name] = el.attributes[i].value;\n }\n }\n var tag = el.tagName ? el.tagName.toLowerCase() : undefined;\n var val = (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.tagName === \"SELECT\")\n ? String(el.value ?? \"\")\n : undefined;\n var text = (el.innerText || el.textContent || \"\").trim() || undefined;\n var normTextContent = (el.textContent || \"\").replace(/\\s+/g, \" \").trim() || undefined;\n var accName = getAccessibleName(el) || undefined;\n var accDesc = getAccessibleDescription(el) || undefined;\n var role = getImplicitRole(el) || undefined;\n return {\n id: el.getAttribute(\"data-testid\") || el.getAttribute(\"testID\") || undefined,\n tag: tag,\n role: role,\n text: text,\n textContent: normTextContent,\n value: val,\n accessibilityLabel: el.getAttribute(\"aria-label\") || undefined,\n accessibleName: accName,\n accessibleDescription: accDesc,\n rect: { x: rect.x + hit.offsetX, y: rect.y + hit.offsetY, width: rect.width, height: rect.height },\n scrollX: window.scrollX || window.pageXOffset || 0,\n scrollY: window.scrollY || window.pageYOffset || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0,\n viewportHeight: (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0,\n visible: isVisible(el, rect),\n enabled: !el.hasAttribute(\"disabled\") && el.getAttribute(\"aria-disabled\") !== \"true\",\n clickable: isClickable(el),\n focused: document.activeElement === el,\n attributes: attrs,\n inShadowDom: hit.inShadow || undefined,\n inIframe: hit.inIframe || undefined\n };\n }\n\n\n function query(sel) {\n return findAcrossRoots(sel).map(toMatch);\n }\n\n function scrollIntoView(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return null;\n var hit = hits[hits.length - 1];\n if (typeof hit.el.scrollIntoView === \"function\") {\n try { hit.el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { hit.el.scrollIntoView(true); } catch (e2) {} }\n }\n return toMatch(hit);\n }\n\n function tap(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return false;\n var hit = hits[hits.length - 1];\n var el = hit.el;\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); } catch (e) {}\n }\n var rect = el.getBoundingClientRect();\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var init = { bubbles: true, cancelable: true, composed: true, clientX: cx, clientY: cy };\n try { el.dispatchEvent(new PointerEvent(\"pointerdown\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mousedown\", init)); } catch (e) {}\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n try { el.dispatchEvent(new PointerEvent(\"pointerup\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mouseup\", init)); } catch (e) {}\n if (typeof el.click === \"function\") { el.click(); }\n else { el.dispatchEvent(new MouseEvent(\"click\", init)); }\n return true;\n }\n\n function waitForSelector(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var forAction = Boolean(opts.forAction);\n var failFastWhenIdle = Boolean(opts.failFastWhenIdle);\n var idleQuietMs = Math.max(50, Math.round(opts.idleQuietMs != null ? opts.idleQuietMs : 250));\n var reqStableFrames = opts.stableFrames !== undefined ? Math.max(0, Math.round(opts.stableFrames)) : (forAction ? 2 : 0);\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : forAction;\n var waitForAppReady = opts.waitForAppReady !== undefined ? Boolean(opts.waitForAppReady) : true;\n var instantAnim = Boolean(typeof document !== \"undefined\" && document.getElementById && document.getElementById(\"__spana_instant_anim\"));\n var explicitStableFrames = instantAnim ? 0 : reqStableFrames;\n\n function findCandidates() {\n if (waitForAppReady && !isAppReady()) return null;\n var rawHits = findAcrossRoots(sel);\n var ready = [];\n for (var i = 0; i < rawHits.length; i++) {\n var h = rawHits[i];\n var m = toMatch(h);\n if (!m.visible) continue;\n if (forAction && !m.enabled) continue;\n ready.push({ hit: h, match: m });\n }\n return ready.length > 0 ? ready : null;\n }\n\n function checkActionableNow() {\n var ready = findCandidates();\n if (!ready) return null;\n if (!forAction) return ready.map(function(r) { return r.match; });\n var target = ready[ready.length - 1];\n var didScroll = ensureInViewport(target.hit);\n if (checkHitTest && !isHitTestClear(target.hit)) {\n if (scrollToUnobscure(target.hit)) {\n didScroll = true;\n }\n if (!isHitTestClear(target.hit)) return null;\n }\n var updated = toMatch(target.hit);\n if (!updated.visible || !updated.enabled) return null;\n return { hits: ready, target: target, match: updated, didScroll: didScroll };\n }\n\n function neededStableFrames(candidate) {\n if (!forAction || typeof requestAnimationFrame !== \"function\") return 0;\n if (explicitStableFrames >= 0) return explicitStableFrames;\n if (hasActiveAnimation(candidate.target.hit.el)) return 2;\n if (candidate.didScroll) return 1;\n return 0;\n }\n\n var imm = checkActionableNow();\n if (imm) {\n if (!forAction) return imm;\n if (neededStableFrames(imm) <= 0) return [imm.match];\n }\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var idleTimer = null;\n var rafId = null;\n var checkingStability = false;\n\n function finish(result) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (idleTimer) clearTimeout(idleTimer);\n if (rafId !== null && typeof cancelAnimationFrame === \"function\") {\n try { cancelAnimationFrame(rafId); } catch (e) {}\n }\n resolve(result);\n }\n\n function armIdleTimer() {\n if (!failFastWhenIdle) return;\n if (idleTimer) clearTimeout(idleTimer);\n idleTimer = setTimeout(function() {\n if (document.readyState === \"complete\" && (!waitForAppReady || isAppReady())) {\n var hit = checkActionableNow();\n finish(hit ? (forAction ? [hit.match] : hit) : []);\n } else {\n armIdleTimer();\n }\n }, idleQuietMs);\n }\n\n function verifyStability(candidate) {\n if (done || checkingStability) return;\n var framesToWait = neededStableFrames(candidate);\n if (!forAction || framesToWait <= 0 || typeof requestAnimationFrame !== \"function\") {\n finish(forAction ? [candidate.match] : candidate);\n return;\n }\n checkingStability = true;\n var el = candidate.target.hit.el;\n var lastRect = candidate.match.rect;\n var remainingFrames = framesToWait;\n\n function step() {\n if (done) return;\n if (!el.isConnected) { checkingStability = false; return; }\n if (checkHitTest && !isHitTestClear(candidate.target.hit)) { checkingStability = false; return; }\n var cur = toMatch(candidate.target.hit);\n if (!cur.visible || !cur.enabled) { checkingStability = false; return; }\n var dx = Math.abs(cur.rect.x - lastRect.x);\n var dy = Math.abs(cur.rect.y - lastRect.y);\n var dw = Math.abs(cur.rect.width - lastRect.width);\n var dh = Math.abs(cur.rect.height - lastRect.height);\n if (dx <= 1 && dy <= 1 && dw <= 1 && dh <= 1) {\n remainingFrames -= 1;\n if (remainingFrames <= 0) { finish([cur]); return; }\n } else {\n remainingFrames = framesToWait;\n lastRect = cur.rect;\n }\n rafId = requestAnimationFrame(step);\n }\n rafId = requestAnimationFrame(step);\n }\n\n function attempt() {\n if (done || checkingStability) return;\n var hit = checkActionableNow();\n if (hit) {\n if (forAction) verifyStability(hit);\n else finish(hit);\n return;\n }\n armIdleTimer();\n }\n\n var scheduled = false;\n function scheduleAttempt() {\n if (done || scheduled || checkingStability) return;\n scheduled = true;\n Promise.resolve().then(function() { scheduled = false; attempt(); });\n }\n\n timeoutTimer = setTimeout(function() {\n var finalHit = checkActionableNow();\n finish(finalHit ? (forAction ? [finalHit.match] : finalHit) : []);\n }, timeoutMs);\n fallbackInterval = setInterval(attempt, forAction ? 40 : 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(scheduleAttempt);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n attempt();\n });\n }\n\n function waitForHidden(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n function isHiddenNow() {\n var hits = findAcrossRoots(sel);\n for (var i = 0; i < hits.length; i++) {\n if (toMatch(hits[i]).visible) return false;\n }\n return true;\n }\n if (isHiddenNow()) return true;\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n function finish(val) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(val);\n }\n function onChange() { if (isHiddenNow()) finish(true); }\n timeoutTimer = setTimeout(function() { finish(isHiddenNow()); }, timeoutMs);\n fallbackInterval = setInterval(onChange, 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function waitForMatch(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var kind = opts.kind;\n var expected = opts.expected !== undefined ? opts.expected : null;\n var expectedCount = opts.expectedCount !== undefined ? opts.expectedCount : null;\n var attributeName = opts.attributeName !== undefined ? opts.attributeName : null;\n var patternSource = opts.patternSource !== undefined ? opts.patternSource : null;\n var patternFlags = opts.patternFlags || \"\";\n var negate = Boolean(opts.negate);\n var lastActual = undefined;\n var regex = patternSource !== null ? new RegExp(patternSource, patternFlags) : null;\n\n function evaluateMatch() {\n if (kind === \"url\") {\n var href = typeof window !== \"undefined\" && window.location ? String(window.location.href || \"\") : \"\";\n lastActual = href;\n var urlOk = regex\n ? regex.test(href)\n : (expected !== null && (href === expected || href.indexOf(String(expected)) !== -1));\n if (negate ? !urlOk : urlOk) return { matched: true, actual: href };\n return null;\n }\n\n var hits = findAcrossRoots(sel);\n\n if (kind === \"count\") {\n var visibleCount = 0;\n for (var ci = 0; ci < hits.length; ci++) {\n if (toMatch(hits[ci]).visible) visibleCount++;\n }\n lastActual = String(visibleCount);\n var countOk = expectedCount !== null && visibleCount === expectedCount;\n if (negate ? !countOk : countOk) {\n return { matched: true, actual: String(visibleCount) };\n }\n return null;\n }\n\n for (var i = hits.length - 1; i >= 0; i--) {\n var m = toMatch(hits[i]);\n if (!m.visible) continue;\n var matched = false;\n var actualVal = undefined;\n if (kind === \"text\") {\n var normTxt = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = normTxt;\n matched = normTxt === (expected !== null ? String(expected).replace(/\\s+/g, \" \").trim() : expected);\n } else if (kind === \"containsText\") {\n var actual = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = actual;\n matched = expected !== null && actual.toLowerCase().indexOf(String(expected).replace(/\\s+/g, \" \").trim().toLowerCase()) !== -1;\n } else if (kind === \"matchesText\") {\n var actualRe = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = actualRe;\n matched = Boolean(regex && regex.test(actualRe));\n } else if (kind === \"value\") {\n var val = m.value !== undefined ? m.value : \"\";\n actualVal = val;\n matched = val === expected;\n } else if (kind === \"attribute\" && attributeName !== null) {\n var attrVal = m.attributes ? m.attributes[attributeName] : undefined;\n actualVal = attrVal;\n matched = expected === null ? attrVal !== undefined : attrVal === expected;\n } else if (kind === \"accessibilityLabel\") {\n var lbl = m.accessibilityLabel;\n actualVal = lbl;\n matched = expected === null ? (lbl !== undefined && lbl.length > 0) : lbl === expected;\n } else if (kind === \"accessibleName\") {\n var accName = m.accessibleName || m.accessibilityLabel || m.text || \"\";\n actualVal = accName;\n matched = regex ? regex.test(accName) : (expected === null ? accName.length > 0 : accName.trim() === String(expected).trim());\n } else if (kind === \"accessibleDescription\") {\n var accDesc = m.accessibleDescription || \"\";\n actualVal = accDesc;\n matched = regex ? regex.test(accDesc) : (expected === null ? accDesc.length > 0 : accDesc.trim() === String(expected).trim());\n } else if (kind === \"focused\") {\n actualVal = m.focused ? \"focused\" : \"not focused\";\n matched = Boolean(m.focused);\n }\n lastActual = actualVal;\n if (negate ? !matched : matched) return { matched: true, actual: actualVal };\n }\n return null;\n }\n\n var immediate = evaluateMatch();\n if (immediate) return immediate;\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n function finish(res) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"input\", onChange, true);\n document.removeEventListener(\"change\", onChange, true);\n document.removeEventListener(\"focusin\", onChange, true);\n document.removeEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n }\n resolve(res);\n }\n function onChange() {\n if (done || scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done) return;\n var res = evaluateMatch();\n if (res) finish(res);\n });\n }\n timeoutTimer = setTimeout(function() {\n var finalRes = evaluateMatch();\n finish(finalRes || { matched: false, actual: lastActual });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, kind === \"url\" ? 50 : 120);\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"input\", onChange, true);\n document.addEventListener(\"change\", onChange, true);\n document.addEventListener(\"focusin\", onChange, true);\n document.addEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n }\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function fill(sel, val, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : true;\n function writeValue(el) {\n if (el.isContentEditable) return false;\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\") {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var proto = tag === \"TEXTAREA\"\n ? (win.HTMLTextAreaElement && win.HTMLTextAreaElement.prototype)\n : (win.HTMLInputElement && win.HTMLInputElement.prototype);\n var desc = proto ? Object.getOwnPropertyDescriptor(proto, \"value\") : null;\n if (desc && typeof desc.set === \"function\") desc.set.call(el, val);\n else el.value = val;\n if (el._valueTracker && typeof el._valueTracker.setValue === \"function\") {\n try { el._valueTracker.setValue(val === \"\" ? \" \" : \"\"); } catch (e) {}\n }\n } else if (tag === \"SELECT\") {\n el.value = val;\n } else {\n el.value = val;\n }\n try { el.dispatchEvent(new InputEvent(\"input\", { bubbles: true, cancelable: true, data: val, inputType: \"insertText\" })); }\n catch (e) { el.dispatchEvent(new Event(\"input\", { bubbles: true, cancelable: true })); }\n el.dispatchEvent(new Event(\"change\", { bubbles: true, cancelable: true }));\n return true;\n }\n function findEditableNow() {\n if (!isAppReady()) return null;\n var hits = findAcrossRoots(sel);\n for (var i = hits.length - 1; i >= 0; i--) {\n var h = hits[i];\n var m = toMatch(h);\n if (!m.visible || !m.enabled) continue;\n ensureInViewport(h);\n if (checkHitTest && !isHitTestClear(h)) {\n scrollToUnobscure(h);\n if (!isHitTestClear(h)) continue;\n }\n return h.el;\n }\n return null;\n }\n function verifyAndRetryFill(attemptsLeft) {\n var el = findEditableNow();\n if (!el || el.isContentEditable) return Promise.resolve(false);\n if (!writeValue(el)) return Promise.resolve(false);\n return new Promise(function(resolve) {\n setTimeout(function() {\n var latest = findEditableNow() || el;\n if (latest && latest.isConnected && String(latest.value == null ? \"\" : latest.value) === val) {\n resolve(true);\n return;\n }\n if (attemptsLeft > 1) {\n verifyAndRetryFill(attemptsLeft - 1).then(resolve);\n } else {\n resolve(false);\n }\n }, 12);\n });\n }\n var immEl = findEditableNow();\n if (immEl) {\n if (immEl.isContentEditable) return false;\n return verifyAndRetryFill(3);\n }\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n var filling = false;\n function finish(ok) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(ok);\n }\n function onChange() {\n if (done || scheduled || filling) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done || filling) return;\n var target = findEditableNow();\n if (!target) return;\n if (target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(3).then(function(ok) { finish(ok); });\n });\n }\n timeoutTimer = setTimeout(function() {\n if (filling) return;\n var target = findEditableNow();\n if (!target || target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(2).then(function(ok) { finish(ok); });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, 40);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n window.__spanaRt = {\n query: query,\n scrollIntoView: scrollIntoView,\n tap: tap,\n waitForSelector: waitForSelector,\n waitForHidden: waitForHidden,\n waitForMatch: waitForMatch,\n fill: fill\n };\n return true;\n})();";
329
339
  type InjectedRuntimeMethod = "query" | "scrollIntoView" | "tap" | "waitForSelector" | "waitForHidden" | "waitForMatch" | "fill";
340
+ /** Build an in-page diagnostic script reporting why an existing element failed actionability (covered/disabled/hidden). */
341
+ declare function buildDomActionabilityDiagScript(selector: Selector): string;
330
342
  /** Build a ~70-byte call to the pre-injected `window.__spanaRt` runtime. */
331
343
  declare function buildInjectedCallScript(method: InjectedRuntimeMethod, ...args: unknown[]): string;
332
344
 
@@ -887,6 +899,8 @@ interface ProvConfig {
887
899
  locale?: string;
888
900
  /** Fail web element waits early when the page is idle & readyState === "complete" instead of waiting full waitTimeout. */
889
901
  failFastWhenIdle?: boolean;
902
+ /** Consecutive stable animation frames required before pointer actions on web. Default: 2. Set 0 to disable. */
903
+ actionStableFrames?: number;
890
904
  };
891
905
  platforms?: Platform[];
892
906
  /** Run platforms concurrently when they use independent resources. Default: false (serial). */
@@ -940,6 +954,8 @@ interface WaitOptions {
940
954
  failFastWhenIdle?: boolean;
941
955
  /** Quiet window in ms before failFastWhenIdle resolves empty. Default: 250. */
942
956
  idleQuietMs?: number;
957
+ /** Consecutive stable animation frames required before pointer actions on web. Default: 2. */
958
+ actionStableFrames?: number;
943
959
  }
944
960
 
945
961
  type Direction = "up" | "down" | "left" | "right";
@@ -970,6 +986,21 @@ interface StorybookOpenOptions {
970
986
  globals?: Record<string, StorybookValue>;
971
987
  }
972
988
 
989
+ interface NegatedPromiseExpectation {
990
+ toBeVisible(opts?: WaitOptions): Promise<void>;
991
+ toBeHidden(opts?: WaitOptions): Promise<void>;
992
+ toHaveText(expected: string, opts?: WaitOptions): Promise<void>;
993
+ toMatchText(pattern: RegExp, opts?: WaitOptions): Promise<void>;
994
+ toHaveValue(expected: string | number, opts?: WaitOptions): Promise<void>;
995
+ toHaveAttribute(name: string, value?: string, opts?: WaitOptions): Promise<void>;
996
+ toBeEnabled(opts?: WaitOptions): Promise<void>;
997
+ toBeDisabled(opts?: WaitOptions): Promise<void>;
998
+ toContainText(expected: string, opts?: WaitOptions): Promise<void>;
999
+ toHaveCount(expected: number, opts?: WaitOptions): Promise<void>;
1000
+ toBeFocused(opts?: WaitOptions): Promise<void>;
1001
+ toHaveAccessibleName(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1002
+ toHaveAccessibleDescription(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1003
+ }
973
1004
  interface PromiseExpectation<T extends string = string> {
974
1005
  toBeVisible(opts?: WaitOptions): Promise<void>;
975
1006
  toBeHidden(opts?: WaitOptions): Promise<void>;
@@ -986,6 +1017,10 @@ interface PromiseExpectation<T extends string = string> {
986
1017
  toBeFocused(opts?: WaitOptions): Promise<void>;
987
1018
  /** Assert that the matched element's computed accessible name matches string or RegExp. */
988
1019
  toHaveAccessibleName(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1020
+ /** Assert that the matched element's computed accessible description matches string or RegExp. */
1021
+ toHaveAccessibleDescription(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1022
+ /** Negated assertion chain (`expect(selector).not.*`). */
1023
+ readonly not: NegatedPromiseExpectation;
989
1024
  toMatchScreenshot(name: string, options?: {
990
1025
  threshold?: number;
991
1026
  maxDiffPixelRatio?: number;
@@ -1001,11 +1036,47 @@ interface PromiseExpectation<T extends string = string> {
1001
1036
  toHaveRole(expected: string): Promise<void>;
1002
1037
  toHaveMinTouchTarget(size?: number): Promise<void>;
1003
1038
  }
1004
- /** Callable `expect(selector)` helper with attached page-level matchers like `expect.toHaveURL(...)`. */
1005
- type PromiseExpectFn<T extends string = string> = ((selector: ExtendedSelector<T>) => PromiseExpectation<T>) & {
1039
+ interface RetryAssertionOptions {
1040
+ /** Total timeout in ms before failing. Default: 5000. */
1041
+ timeout?: number;
1042
+ /** Backoff intervals in ms between retries. Default: [50, 100, 250, 500]. */
1043
+ intervals?: number[];
1044
+ }
1045
+ interface ToPassExpectation {
1046
+ /** Retry the callback until it completes without throwing (Playwright `expect(fn).toPass()`). */
1047
+ toPass(opts?: RetryAssertionOptions): Promise<void>;
1048
+ }
1049
+ interface PollMatchers<V> {
1050
+ toBe(expected: V): Promise<void>;
1051
+ toEqual(expected: V): Promise<void>;
1052
+ toContain(expected: unknown): Promise<void>;
1053
+ toMatch(pattern: string | RegExp): Promise<void>;
1054
+ toBeGreaterThan(expected: number): Promise<void>;
1055
+ toBeLessThan(expected: number): Promise<void>;
1056
+ toBeGreaterThanOrEqual(expected: number): Promise<void>;
1057
+ toBeLessThanOrEqual(expected: number): Promise<void>;
1058
+ toBeTruthy(): Promise<void>;
1059
+ toBeFalsy(): Promise<void>;
1060
+ toBeDefined(): Promise<void>;
1061
+ toBeUndefined(): Promise<void>;
1062
+ toHaveLength(expected: number): Promise<void>;
1063
+ }
1064
+ interface PollExpectation<V> extends PollMatchers<V> {
1065
+ readonly not: PollMatchers<V>;
1066
+ }
1067
+ /** Callable `expect(selector)` / `expect(fn).toPass()` helper with `expect.poll(...)` and `expect.toHaveURL(...)`. */
1068
+ interface PromiseExpectFn<T extends string = string> {
1069
+ (selector: ExtendedSelector<T>): PromiseExpectation<T>;
1070
+ (fn: () => unknown | Promise<unknown>): ToPassExpectation;
1006
1071
  /** Assert that the current page URL matches a substring/exact string or RegExp. */
1007
1072
  toHaveURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1008
- };
1073
+ /** Negated page-level matchers (`expect.not.toHaveURL(...)`). */
1074
+ readonly not: {
1075
+ toHaveURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1076
+ };
1077
+ /** Poll an async/sync getter until the chained matcher passes (Playwright `expect.poll(fn)`). */
1078
+ poll<V>(fn: () => V | Promise<V>, opts?: RetryAssertionOptions): PollExpectation<V>;
1079
+ }
1009
1080
 
1010
1081
  interface BrowserRequestOptions {
1011
1082
  headers?: Record<string, string>;
@@ -1059,6 +1130,8 @@ interface FrameScope<T extends string = string> {
1059
1130
  timeout?: number;
1060
1131
  }): Promise<boolean>;
1061
1132
  isEnabled(selector: Selector<T>, opts?: WaitOptions): Promise<boolean>;
1133
+ /** Count visible elements matching `selector` inside this frame (returns `0` when none exist). */
1134
+ count(selector: Selector<T>, opts?: WaitOptions): Promise<number>;
1062
1135
  expect(selector: Selector<T>): PromiseExpectation<T>;
1063
1136
  }
1064
1137
  interface PromiseApp<T extends string = string, R extends string = string> {
@@ -1168,6 +1241,8 @@ interface PromiseApp<T extends string = string, R extends string = string> {
1168
1241
  timeout?: number;
1169
1242
  }): Promise<boolean>;
1170
1243
  isEnabled(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<boolean>;
1244
+ /** Return the number of currently visible elements matching `selector` (returns `0` without throwing when none exist). */
1245
+ count(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<number>;
1171
1246
  /** Wait for in-flight fetch/XHR, animations, and framework renders to settle via spana-bridge. */
1172
1247
  waitForIdle(opts?: DomIdleOptions): Promise<void>;
1173
1248
  /** Inject storage/auth state directly through the DOM bridge (avoids slow UI login flows). */
@@ -1188,4 +1263,4 @@ interface PromiseApp<T extends string = string, R extends string = string> {
1188
1263
  switchToNativeApp(): Promise<void>;
1189
1264
  }
1190
1265
 
1191
- export { type PromiseExpectFn as $, type AppiumExecutionConfig as A, type BrowserRouteMatcher as B, type BrowserHAR as C, DriverError as D, type ExtendedSelector as E, type BrowserNetworkConditions as F, type BrowserRequestClient as G, type BrowserRequestOptions as H, type BrowserRequestResponse as I, type BrowserResponseInfo as J, type CdpSessionHandle as K, DeviceInfo as L, type DeviceStateConfig as M, type DismissKeyboardOptions as N, type DomChannelKind as O, type Platform as P, type DomRect as Q, type RawDriverService as R, type Selector as S, type TapMode as T, type ElectronAppConfig as U, type VirtualAuthenticatorOptions as V, type FrameScope as W, type InjectedRuntimeMethod as X, type IsolatedBrowserContext as Y, type LaunchOptions as Z, type ObjectSelector as _, type DomElementMatch as a, type PromiseExpectation as a0, type RelativeSelector as a1, SPANA_INJECTED_RUNTIME_SCRIPT as a2, type ScrollUntilVisibleOptions as a3, type SelectorModifiers as a4, type StorybookConfig as a5, type StorybookOpenOptions as a6, type StorybookValue as a7, type TouchAction as a8, type TouchSequence as a9, type VideoRecordingMode as aa, type WarmDaemonConfig as ab, type WebBrowserEngine as ac, type WebContextIsolation as ad, type WebExecutionConfig as ae, type WebResourceBlockType as af, buildDomFillScript as ag, buildDomWaitForHiddenScript as ah, buildDomWaitForMatchScript as ai, buildDomWaitForSelectorScript as aj, buildInjectedCallScript as ak, byCss as al, byRole as am, defineConfig as an, filterSelector as ao, first as ap, inFrame as aq, isComposableDomSelector as ar, isSystemUISelector as as, isTestIDSelector as at, last as au, nth as av, systemUI as aw, within as ax, type ProvConfig as b, type DomChannel as c, type DomTargetInfo as d, type DomWaitForSelectorOptions as e, type DomWaitForHiddenOptions as f, type DomWaitForMatchOptions as g, type DomWaitForMatchResult as h, type DomFillOptions as i, type DomIdleOptions as j, type DomStorageEntries as k, type DomClearStorageOptions as l, type BrowserMockResponse as m, type BrowserConsoleLog as n, type BrowserJSError as o, type BrowserName as p, type ElectrobunAppConfig as q, type ElectrobunRenderer as r, type AppConfig as s, type VirtualCredential as t, type VirtualCredentialInput as u, type PromiseApp as v, type ArtifactConfig as w, type BackUntilVisibleOptions as x, type BridgeConfig as y, type BrowserCookie as z };
1266
+ export { type ObjectSelector as $, type AppiumExecutionConfig as A, type BrowserRouteMatcher as B, type BrowserHAR as C, DriverError as D, type ExtendedSelector as E, type BrowserNetworkConditions as F, type BrowserRequestClient as G, type BrowserRequestOptions as H, type BrowserRequestResponse as I, type BrowserResponseInfo as J, type CdpSessionHandle as K, DeviceInfo as L, type DeviceStateConfig as M, type DismissKeyboardOptions as N, type DomChannelKind as O, type Platform as P, type DomRect as Q, type RawDriverService as R, type Selector as S, type TapMode as T, type ElectronAppConfig as U, type VirtualAuthenticatorOptions as V, type FrameScope as W, type InjectedRuntimeMethod as X, type IsolatedBrowserContext as Y, type LaunchOptions as Z, type NegatedPromiseExpectation as _, type DomElementMatch as a, type PollExpectation as a0, type PollMatchers as a1, type PromiseExpectFn as a2, type PromiseExpectation as a3, type RelativeSelector as a4, type RetryAssertionOptions as a5, SPANA_INJECTED_RUNTIME_SCRIPT as a6, type ScrollUntilVisibleOptions as a7, type SelectorModifiers as a8, type StorybookConfig as a9, last as aA, nth as aB, or as aC, systemUI as aD, within as aE, type StorybookOpenOptions as aa, type StorybookValue as ab, type ToPassExpectation as ac, type TouchAction as ad, type TouchSequence as ae, type VideoRecordingMode as af, type WarmDaemonConfig as ag, type WebBrowserEngine as ah, type WebContextIsolation as ai, type WebExecutionConfig as aj, type WebResourceBlockType as ak, buildDomActionabilityDiagScript as al, buildDomFillScript as am, buildDomWaitForHiddenScript as an, buildDomWaitForMatchScript as ao, buildDomWaitForSelectorScript as ap, buildInjectedCallScript as aq, byCss as ar, byRole as as, defineConfig as at, filterSelector as au, first as av, inFrame as aw, isComposableDomSelector as ax, isSystemUISelector as ay, isTestIDSelector as az, type ProvConfig as b, type DomChannel as c, type DomTargetInfo as d, type DomWaitForSelectorOptions as e, type DomWaitForHiddenOptions as f, type DomWaitForMatchOptions as g, type DomWaitForMatchResult as h, type DomFillOptions as i, type DomIdleOptions as j, type DomStorageEntries as k, type DomClearStorageOptions as l, type BrowserMockResponse as m, type BrowserConsoleLog as n, type BrowserJSError as o, type BrowserName as p, type ElectrobunAppConfig as q, type ElectrobunRenderer as r, type AppConfig as s, type VirtualCredential as t, type VirtualCredentialInput as u, type PromiseApp as v, type ArtifactConfig as w, type BackUntilVisibleOptions as x, type BridgeConfig as y, type BrowserCookie as z };
@@ -199,11 +199,11 @@ var SpanaMcpServer = class {
199
199
  runFlowFn;
200
200
  constructor(options = {}) {
201
201
  this.connectFn = options.connectFn ?? (async (opts) => {
202
- const { connect } = await import("./session-V4PYJXNB.js");
202
+ const { connect } = await import("./session-K7FCRKOC.js");
203
203
  return connect(opts);
204
204
  });
205
205
  this.runFlowFn = options.runFlowFn ?? (async ({ flowPath, platform }) => {
206
- const { runTestCommand } = await import("./test-command-JCO2HPYI.js");
206
+ const { runTestCommand } = await import("./test-command-UEJG5AI6.js");
207
207
  return runTestCommand({
208
208
  flowPath,
209
209
  platforms: platform ? [platform] : [],
@@ -537,4 +537,4 @@ export {
537
537
  SPANA_MCP_TOOLS,
538
538
  SpanaMcpServer
539
539
  };
540
- //# sourceMappingURL=chunk-NS2HLJO4.js.map
540
+ //# sourceMappingURL=chunk-2KRVN4WN.js.map