@burdenoff/ui-engine 2026.1127.5 → 2026.1129.2

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 (59) hide show
  1. package/README.md +53 -4
  2. package/dist/analyze/messages.d.ts +7 -0
  3. package/dist/analyze/rules/heal-consequential.d.ts +2 -0
  4. package/dist/analyze/rules/popup-handler-loop.d.ts +2 -0
  5. package/dist/analyze/types.d.ts +24 -1
  6. package/dist/analyze.js +1 -1
  7. package/dist/dom-runtime.iife.js +1 -1
  8. package/dist/dom-runtime.js +2 -2
  9. package/dist/drivers.js +9 -7
  10. package/dist/heal/answer.d.ts +26 -0
  11. package/dist/heal/consequence.d.ts +74 -0
  12. package/dist/heal/index.d.ts +19 -0
  13. package/dist/heal/modes.d.ts +25 -0
  14. package/dist/heal/popup-limits.d.ts +11 -0
  15. package/dist/heal/popup.d.ts +48 -0
  16. package/dist/heal/question.d.ts +41 -0
  17. package/dist/heal/target-from-node.d.ts +9 -0
  18. package/dist/heal/types.d.ts +134 -0
  19. package/dist/heal/verify-rules.d.ts +19 -0
  20. package/dist/heal/verify.d.ts +52 -0
  21. package/dist/heal.d.ts +2 -0
  22. package/dist/heal.js +106 -0
  23. package/dist/index-20bbwwc9.js +37 -0
  24. package/dist/{index-xner4tgb.js → index-5cffktzd.js} +481 -3
  25. package/dist/index-6h7ah1dw.js +328 -0
  26. package/dist/{index-8w0f6rsz.js → index-6kva2gvd.js} +3 -3
  27. package/dist/{index-ct2xctrq.js → index-70vm0qz8.js} +2 -2
  28. package/dist/{index-21hvbvx1.js → index-8w31tpfq.js} +21 -8
  29. package/dist/{index-r2a9rftv.js → index-eff47v1g.js} +424 -17
  30. package/dist/{index-9s5nphx0.js → index-hw5npwsv.js} +1 -37
  31. package/dist/{index-ycs2bz1a.js → index-mhv6a02p.js} +11 -166
  32. package/dist/index-p5823rpv.js +0 -0
  33. package/dist/{index-5k26keah.js → index-qg9yfr7r.js} +16 -67
  34. package/dist/{index-c88tvyj1.js → index-qmv3ar39.js} +1 -1
  35. package/dist/index-t55wvhvh.js +229 -0
  36. package/dist/{index-77pcz6n3.js → index-vnv9tp11.js} +4 -2
  37. package/dist/index-w9jc25y9.js +306 -0
  38. package/dist/{index-s7qdecev.js → index-xdtanv9b.js} +358 -4
  39. package/dist/{index-vg8r40y7.js → index-yc0jgph6.js} +7 -0
  40. package/dist/index-zhbwhdya.js +407 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +142 -24
  43. package/dist/interpret/driver.d.ts +14 -0
  44. package/dist/interpret/errors.d.ts +11 -2
  45. package/dist/interpret/events.d.ts +4 -0
  46. package/dist/interpret/run.d.ts +33 -0
  47. package/dist/interpret.js +5 -4
  48. package/dist/script/adapters/from-computer-use.d.ts +124 -0
  49. package/dist/script/index.d.ts +1 -0
  50. package/dist/script.js +28 -9
  51. package/dist/target/index.d.ts +2 -0
  52. package/dist/target/roles.d.ts +11 -0
  53. package/dist/target/snapshot-mask.d.ts +49 -0
  54. package/dist/target/snapshot-tree.d.ts +65 -0
  55. package/dist/target/snapshot-url.d.ts +6 -0
  56. package/dist/target/snapshot.d.ts +1 -6
  57. package/dist/target.js +55 -13
  58. package/dist/testing.js +2 -2
  59. package/package.json +7 -3
package/README.md CHANGED
@@ -14,7 +14,7 @@ bun add @burdenoff/ui-engine zod
14
14
 
15
15
  ## Modules
16
16
 
17
- Each module is a subpath export. The root entry re-exports the data and planning modules (`recording` to `script`, `interpret` and `analyze`); the DOM modules (`target`, `dom-runtime`, `drivers`, `testing`) are subpath-only, so a consumer without DOM types, such as a service, never loads them through the root.
17
+ Each module is a subpath export. The root entry re-exports the data and planning modules (`recording` to `script`, `interpret`, `analyze` and `heal`); the DOM modules (`target`, `dom-runtime`, `drivers`, `testing`) are subpath-only, so a consumer without DOM types, such as a service, never loads them through the root.
18
18
 
19
19
  | Import | What it holds |
20
20
  |---|---|
@@ -28,7 +28,8 @@ Each module is a subpath export. The root entry re-exports the data and planning
28
28
  | `@burdenoff/ui-engine/dom-runtime` | The DOM runtime a desk injects into a page (`createDomRuntime`, `installDomRuntime`): resolve, act, highlight, snapshot |
29
29
  | `@burdenoff/ui-engine/dom-runtime.iife.js` | The same runtime as one self-contained script (at most 60 KB minified) that installs itself on `globalThis.__burdenoffUiRuntime` |
30
30
  | `@burdenoff/ui-engine/interpret` | The UI script interpreter (`runUiScript`), the compiler a worker runs before it parks a node (`compileUiScript`, `applyPins`, `inlineCalls`, `stripBreakpoints`), the expression evaluator, the desk driver interface and every run-time error code with its node error family (`UI_ERROR_CODES`) |
31
- | `@burdenoff/ui-engine/analyze` | The UI script analyzer: `analyzeUiScript`, the 11 rules of v1 (`UI_ANALYZER_RULES`), problem message keys under `fluidgrids.builder.uiScript.problem.*` with English templates (`UI_SCRIPT_PROBLEM_MESSAGES`), and `stepNumber` (see below) |
31
+ | `@burdenoff/ui-engine/analyze` | The UI script analyzer: `analyzeUiScript`, the 11 rules of v1 and the 2 healing rules (`UI_ANALYZER_RULES`), problem message keys under `fluidgrids.builder.uiScript.problem.*` with English templates (`UI_SCRIPT_PROBLEM_MESSAGES`), and `stepNumber` (see below) |
32
+ | `@burdenoff/ui-engine/heal` | UI step healing (plan P4-06a): the heal request and answer types, `buildHealQuestion`, `parseHealAnswer`, `verifyHealCandidate`, `classifyConsequence`, `targetFromSnapshotNode`, `maskSnapshot`, healing modes (`capHealMode`, `decideHeal`) and pop-up handlers (`parseUiPopupHandler`, `analyzeUiPopupHandler`, `matchesUrlPattern`). Needs no DOM (see below) |
32
33
  | `@burdenoff/ui-engine/drivers` | Desk drivers over a DOM: `createDomDriver` (the DOM runtime in the interpreter's own world) and `createSnapshotDriver` with `replayUiScriptOnSnapshot` (snapshot replay with no browser) |
33
34
  | `@burdenoff/ui-engine/testing` | Copies of the RPA playground fixture pages (`RPA_FIXTURES`), `mountFixture` for test DOMs, and `createFakeWebDriver`, a fake web desk over them |
34
35
 
@@ -62,6 +63,17 @@ A UI script is the portable form of a UI sequence that a desk runs: a paired bro
62
63
  | `fromBrowserActionSteps` | Run in Browser steps (`internal:browser-action`) | Keeps every field a 0.3.0 extension reads |
63
64
  | `toBrowserActionSteps` | Lowering to Run in Browser steps | Null unless the script fits the legacy contract: at most 100 steps and 256 KB, only the 14 legacy actions, one CSS selector per target (or one text for click and wait), step waits of at most 60 s (the legacy extension's cap), literal or supplied input values, no script wait or screenshot settings beyond the defaults, and no flow steps, verification, retries or breakpoints |
64
65
  | `fromRemoteBrowserSteps` | Remote Browser `runSteps` (`store/remotebrowser` 1.0.0) | Playwright `css=`, `text=`, `xpath=`, `id=` and `data-testid=` selectors; other engines are refused |
66
+ | `scriptFromComputerUseActions` | The actions an AI Step took (computer-use tool calls with the worker's `_uiTarget` fingerprints), for Save as steps | Returns `{ script, elements, skipped }` and saves nothing. See below |
67
+
68
+ **Save as steps.** `scriptFromComputerUseActions(actions, { name?, allowedHosts?, loginUrl?, loginSecretRefs?, inputDefaults? })` converts a recorded AI Step run (plan P4-06b, document 24 threats I3 and I7). Each record is the model's arguments (`action`, `url`, `x`, `y`, `text`, `key`, `deltaX`, `deltaY`, `milliseconds`, `ref`, directly or under `args`, as an object or JSON text; under `args` the worker fields are read only from the record) plus what the worker recorded (`ok`, `pageUrl`, `secretRef`, `screenshotFileId`, `_uiTarget` with `role`, `name`, `testId`, `cssPath`, `text`, `frameOrigin`, `frame`, `inFrame`, `editable`, `masked`, `inputType`). The rules:
69
+
70
+ - `navigate`, `click_ref`, `type_ref`, `key`, `scroll` and `wait` become steps; `click` and `double_click` become steps only with a recorded element. A target is built as test id, role and name, CSS path, then exact text (`targetFromUiFingerprint`).
71
+ - Secrets are typed by reference only: `type_login_username` and `type_login_password` become `typeSecret` with `login:username` and `login:password` (or `loginSecretRefs`), and typing recorded with a `secretRef` keeps that reference. `expectedOrigin` is the field's frame origin.
72
+ - Typed text becomes a declared input named after the field (`Invoice number` gives `invoiceNumber`), typed with `clear: false` as the tool does; with `inputDefaults` (default true) the typed value is the input's default. Text typed into a masked or password field, into a field nobody recorded, or that looks like a credential is skipped and never copied.
73
+ - Skipped, with a reason code and no values: `ACTION_FAILED`, `FIELD_UNKNOWN`, `FRAME_NOT_ADDRESSABLE` (another origin's frame with no recorded frame chain), `HOST_NOT_ALLOWED`, `INVALID_ACTION`, `INVALID_URL`, `LOGIN_PAGE_UNKNOWN`, `NO_EFFECT`, `NO_ELEMENT` (a click at a position with no element), `OBSERVATION_ONLY` (screenshots), `SECRET_TARGET_UNKNOWN`, `SECRET_VALUE`, `TOO_MANY_INPUTS`, `UNKNOWN_ACTION`, `URL_CARRIES_SECRET`.
74
+ - Untargeted typing goes into the field that last took the focus (a click on an element that takes text, a `type_ref` or a login action); a key press, a navigation, a click elsewhere or a skipped action forgets it. An element in a child frame needs its recorded `frame` chain. A scroll with no recorded element becomes a page scroll.
75
+ - `elements` lists each distinct target once, with a name, a key, the steps that use it and the first screenshot file, for the person to save to the element library. Steps keep inline targets.
76
+ - It throws `UiScriptError` only for an unusable call (not a list, more than 2,000 actions, more than 500 converted steps, invalid options) or a whole-script parse limit such as `SCRIPT_TOO_LARGE`. The schema and its hash do not change.
65
77
 
66
78
  **Descriptions.** `describeStep(step, elements)` returns `{ key, vars, fallback }`, with keys under `fluidgrids.uiScript.step.*` for `tr(key, vars)` and an English fallback; `UI_SCRIPT_STEP_MESSAGES` holds every English template.
67
79
 
@@ -114,7 +126,7 @@ The runtime must be injected into an isolated world (a content script, or a CDP
114
126
 
115
127
  | Family | Codes |
116
128
  |---|---|
117
- | DEPENDENCY | `ELEMENT_NOT_FOUND`, `ELEMENT_AMBIGUOUS`, `WINDOW_NOT_FOUND`, `UNEXPECTED_WINDOW`, `ACTION_FAILED` (the desk problem in `detail.problem`), `SECRET_UNAVAILABLE` |
129
+ | DEPENDENCY | `ELEMENT_NOT_FOUND`, `ELEMENT_AMBIGUOUS`, `WINDOW_NOT_FOUND`, `UNEXPECTED_WINDOW`, `ACTION_FAILED` (the desk problem in `detail.problem`), `SECRET_UNAVAILABLE`, `HEAL_APPROVAL_REQUIRED` (never retried; see Healing) |
118
130
  | TRANSIENT | `ELEMENT_NOT_INTERACTABLE`, `VERIFY_FAILED`, `NAVIGATION_TIMEOUT`, `NAVIGATION_FAILED`, `WAIT_TIMEOUT`, `APPLICATION_NOT_RESPONDING`, `ROBOT_LOST`, `INTERRUPTED`, `DRIVER_ERROR` |
119
131
  | VALIDATION | `UNSUPPORTED_ON_DESK`, `INVALID_SCRIPT`, `INVALID_INPUT` and `INVALID_STEP_RANGE` (all four before any step runs), `EXPRESSION_ERROR`, `SENSITIVE_ELEMENT`, `URL_NOT_ALLOWED` |
120
132
  | AUTHORIZATION | `LOGIN_FAILED` |
@@ -123,7 +135,7 @@ The runtime must be injected into an isolated world (a content script, or a CDP
123
135
 
124
136
  `ELEMENT_AMBIGUOUS` is DEPENDENCY, not VALIDATION: ambiguity is observed on the live page at run time, like `ELEMENT_NOT_FOUND`, and is never raised before a step runs (BOFF-17109).
125
137
 
126
- **Drivers.** A desk implements `UiDriver` (`driver.ts`): `resolve`, `act`, `read`, `readAll`, `listItems`, `pressKeys`, navigation, page text and HTML, `scrollPage`, and optionally `typeSecret`, `login` and `screenshot`, plus its `capabilities` and an optional `clock`. A driver makes one attempt per call; the interpreter owns waiting. A desk failure is a thrown `UiDriverError` with an engine code; anything else becomes `DRIVER_ERROR`. `createDomDriver` never reads a sensitive element, and its page text and HTML leave sensitive content, scripts, handlers and field values out. Its `readAll` and `listItems` return the resolution of the method that found the elements, so extract and extract-list steps report `resolvedBy`.
138
+ **Drivers.** A desk implements `UiDriver` (`driver.ts`): `resolve`, `act`, `read`, `readAll`, `listItems`, `pressKeys`, navigation, page text and HTML, `scrollPage`, and optionally `typeSecret`, `login` and `screenshot`, plus its `capabilities` and an optional `clock`. For healing it may add `treeSnapshot` (the page's value-free snapshot now) and `frameOrigin` (the origin a frame chain leads to); `createDomDriver` has both, and the snapshot driver returns its stored snapshot. A driver makes one attempt per call; the interpreter owns waiting. A desk failure is a thrown `UiDriverError` with an engine code; anything else becomes `DRIVER_ERROR`. `createDomDriver` never reads a sensitive element, and its page text and HTML leave sensitive content, scripts, handlers and field values out. Its `readAll` and `listItems` return the resolution of the method that found the elements, so extract and extract-list steps report `resolvedBy`.
127
139
 
128
140
  **Snapshot replay.** `replayUiScriptOnSnapshot(script, { document, snapshot, stepPath?, elementKeys? })` rebuilds a tree snapshot into an empty, inert document and replays a resolved script on it with a dry-run DOM driver, a virtual clock and one attempt per target. Verification, paging and waits that are not for a target to appear are skipped. A run snapshot taken at a step checks only that step; an element version's snapshot checks the steps that use the given element keys. It returns `{ passed, failedStepPath, errorCode, steps: [{ stepPath, verdict, resolvedBy }] }` with verdicts `passed`, `failed`, `skipped` and `unchecked` (contract `UiSnapshotReplay`).
129
141
 
@@ -147,12 +159,49 @@ A problem is `{ rule, group, severity, messageKey, vars, message, path?, stepId?
147
159
  | `secretOrigin` | security | warning | A Type secret step without `expectedOrigin` |
148
160
  | `sensitiveScreenshot` | security | warning | A step that signs in or types a secret and takes a screenshot every time, by its own policy (`sensitiveScreenshot`) or by the script's `everyStep` (`sensitiveScreenshotSettings`); a step that sets `never` or `onFailure` is not reported |
149
161
  | `inlineTarget` | maintainability | info | A step's first inline target, which could be an Element library element |
162
+ | `healConsequential` | security | info | Only with `healing` options: a step whose control looks like a payment, delete, send-outside or security control (`healConsequential`), or matches a workspace always-ask phrase (`healAlwaysAskKeyword`). Healing never changes such a step's target without a person's approval. Steps listed in `alwaysAskStepIds` are not reported |
163
+ | `popupHandlerLoop` | reliability | warning | Only with `popupHandler` (set by `analyzeUiPopupHandler`): a pop-up handler step that is a flow block (`popupHandlerFlow`), takes an action a handler may not take (`popupHandlerAction`), acts on a consequential control (`popupHandlerConsequential`), waits longer than 5,000 ms (`popupHandlerWait`), or a handler with no step that clicks, checks or presses a key (`popupHandlerNoAction`) |
150
164
  | `unusedValue` | maintainability | info | A declared variable nothing reads (`unusedVariable`), and a `set` or `saveAs` value no step, output or later node reads (`unusedValue`). A `set` or `saveAs` value is a key of the node's results, so it is reported only when `externalReads` is given, except a `__` name, which never reaches the results |
151
165
 
152
166
  Options:
153
167
 
154
168
  - `severity`: a workspace's setting per rule, `warning`, `info` or `off` (drops the rule's problems). Any other stored value is ignored and the rule keeps its default. `UI_ANALYZER_DEFAULT_SEVERITY` holds the defaults.
155
169
  - `externalReads`: the result names other nodes of the workflow read. A `set` or `saveAs` value is a key of the node's results, so without this list it is never reported as unused; the builder passes it, the service may leave it out.
170
+ - `healing`: `{ alwaysAskStepIds?, keywords? }`, the node's and workspace's healing settings, for `healConsequential`.
171
+ - `popupHandler`: `{ match }`, set when the script is a pop-up handler's steps, for `popupHandlerLoop`.
172
+
173
+ ## Healing
174
+
175
+ Healing repairs a step whose own target is no longer found (spec 10 section 3, plan P4-06a, BOFF-17301). The engine supplies the pieces; the workflow service (P4-13) makes the model call, and the remote-browser worker (P4-15) and the extension (P4-16) run the interpreter with the hook. The UI script schema does not change (`UI_SCRIPT_SCHEMA_HASH` keeps its P1-02 value, D-P4-9). Everything in `./heal` is pure and needs no DOM, except `verifyHealCandidate`, which asks the desk driver.
176
+
177
+ **Interpreter options** (all optional; without them, or with mode `off`, a run behaves exactly as before):
178
+
179
+ - `targetOverrides: { [stepId]: UiTarget }`: targets that replace steps' own targets, for the rerun after a person approves a heal (D-P4-11). Each must be a valid target of a step healing repairs, else the run fails `INVALID_SCRIPT` before any step runs. A passed step's event carries `detail.targetOverride: true`.
180
+ - `popupHandlers: UiPopupHandler[]`: `{ id, match: { urlPattern?, target }, steps }`. When a step's own target still fails with `ELEMENT_NOT_FOUND` or `ELEMENT_NOT_INTERACTABLE` after its retries, up to 2 handlers whose pattern matches the page address and whose `match.target` is visible run (every wait of a handler step is capped at 5 s, and the `popupHandlerLoop` rule refuses a handler step that asks for longer), each followed by one more attempt of the step. A handler that does not parse, has more than 10 steps, or trips the `popupHandlerLoop` rule is never used and is listed in a LOG event (`detail.popupHandlersRejected`); at most 50 are used. Handlers never run inside handlers, and no healing happens inside them. Patterns are `*` wildcards, compared without case against the address without query or fragment, never regular expressions. A pattern with `scheme://` is matched in parts: the scheme exactly, the host label by label (a leading `*.` stands for one or more labels; any other `*` stays inside one label, so `https://app.test*` never matches `https://app.test.evil.test`), and the path with `*` matching anything.
181
+ - `onTargetNotFound(request, { signal })`: asked once per step id per run, when the step's own target still fails with `ELEMENT_NOT_FOUND` or `ELEMENT_AMBIGUOUS` after its retries and pop-up handlers, for the actions `click`, `doubleClick`, `hover`, `type`, `clear`, `check`, `select`, `getText`, `getValue`, `getAttribute` and `waitFor` (never `typeSecret` or `login`). The request carries the step, the failed target, its description and the page address, and the page snapshot (`driver.treeSnapshot`) **masked by the engine** (`maskSnapshot`), with `maskedPaths` and `screenshotMask` (the rectangles a desk paints over its screenshot before upload). The hook returns `{ answer, mode, alwaysAsk?, consequence?, proposalId? }`.
182
+ - `healing: { alwaysAskStepIds?, keywords?, maskedPaths? }`: the node's always-ask steps, the workspace's always-ask phrases, and extra paths to mask.
183
+
184
+ **What happens to an answer.** The engine checks the host's answer again (the node path must be in the masked snapshot and the target valid), then runs `verifyHealCandidate` on the live page and `classifyConsequence` on the element. Then the mode decides (`decideHeal`):
185
+
186
+ | Mode | A verified candidate | Run result |
187
+ |---|---|---|
188
+ | `off` | not used | the step fails exactly as without healing |
189
+ | `suggest` | reported | the step fails with its own code; `error.heal.outcome` is `suggested`, with the candidate and `proposalId` |
190
+ | `heal_with_approval` | reported | the run stops with `HEAL_APPROVAL_REQUIRED` and `error.heal` (`approval_required`); the desk parks the run for a person |
191
+ | `heal_and_continue` | used | the step runs on the candidate; STEP_PASSED carries `detail.healed: { method: 'model', nodePath, proposalId }`, the step log `healed: true`, and the result `repairs.healed`. Later runs of that step id in the run use the healed target. A consequential candidate (payment, delete, send outside, security), a step whose own lost target or library element reads as consequential, an acting control with no readable words (an icon, or one inside a sensitive region), an always-ask step or phrase, or the service's `alwaysAsk` stops with `HEAL_APPROVAL_REQUIRED` instead |
192
+
193
+ `HEAL_APPROVAL_REQUIRED` ends the run even when the step has `onError: continue`, and is never retried by a step retry or a retry scope. A candidate that fails the check, an answer of `not_present` or `unavailable`, a hook that throws, or a desk without snapshots fail the step with its own code and `error.heal.outcome` set to `check_failed` (with the reason), `not_present` or `unavailable`. When a step run on a healed target fails there (its action may already have taken effect, for example before a `verify` failed), that failure's code is the step's, and the report carries `reason: STEP_FAILED`, `stepFailureCode` and `attempted: true`. The request's `url` is cleaned like a snapshot address (no query, fragment or reset token). `UiRunResult.repairs` (`{ healed, popupsHandled }`) is present only when a repair happened.
194
+
195
+ **The pieces** (threats R1, R2, R3, R7 and C4 of fluidgrids-specs document 24):
196
+
197
+ - `maskSnapshot(snapshot, { maskedPaths?, sensitive? })`: masked paths and, by default, every password, one-time-code, card or secret field, anything inside one and anything marked sensitive keep their tag, bounds and identifying attributes and lose their texts and descriptive attributes, descendants, shadow content and frames included; they gain `data-fg-sensitive`. Texts become empty strings, so node paths do not move, and the address is cleaned again. Returns `{ snapshot, maskedPaths, screenshotMask }` (rectangles in the top page's coordinates, frames included) and never changes its input.
198
+ - `buildHealQuestion(request)`: one narrow question: at most 400 visible elements (the ones most like the lost target, listed in page order), each with node path, role, name (at most 100 characters), a value placeholder and bounds; masked elements are listed with `masked: true` and no name. Page text goes in only as JSON values, under a system message that says it is data.
199
+ - `parseHealAnswer(text, snapshot, { listedPaths? })`: only `{"nodePath": "...", "confidence": 0..1}` or `{"notPresent": true}`, one JSON object (a single code fence is tolerated). The path must name a visible element (and one the question listed); any other text, key or path is `not_present`, so an answer can never carry an action, a value or an address.
200
+ - `verifyHealCandidate(driver, candidate, step, context)`: exactly one element, visible and enabled for a step that acts, a control type that fits the action (a click needs a button, link, checkbox, menu item, tab, option, radio, switch, combo box or grid cell; typing a text box, search box, combo box, number field or editable region), the same frame as the failed step (by origin when the desk reports one, else the same frame chain), never a password, secret or masked field for typing, and in the top document the snapshot node's position (within 24 px).
201
+ - `classifyConsequence(element, step, keywords?)`: English keyword phrases matched as whole words over the name, link address, hints and, for a submit button or a field that Enter or a key submits, its form's words; only for steps that can set something off (clicks, checks, choices, keys, and typing with Enter). Workspace phrases are case-folded keyword phrases, at most 50 of at most 100 characters (D-P4-12). Accepted residual risk: a control labelled in another language may not be classified.
202
+ - `targetFromSnapshotNode(path, snapshot)`: a multi-method target for a snapshot node (test id, `#id`, role and name, a control's `name`, exact text, fuzzy, then a structural CSS path), each method only when it names the element alone in its document, frame or shadow root, with the frame chain built the same way.
203
+
204
+ Node paths are `/` for the root, then `c<n>` (n-th child, texts counted), `s<n>` (n-th shadow child) and `f` (a frame's document element), for example `/c1/c0/s2/c0`.
156
205
 
157
206
  ## Compatibility with Stewards
158
207
 
@@ -30,6 +30,13 @@ export declare const UI_SCRIPT_PROBLEM_MESSAGES: {
30
30
  readonly inlineTarget: "Step {{step}} uses an inline target. Add it to the Element library so other workflows can reuse it.";
31
31
  readonly unusedValue: "Step {{step}} stores {{name}}, but no step, output or later node reads it.";
32
32
  readonly unusedVariable: "The variable {{name}} is declared, but no step reads it.";
33
+ readonly healConsequential: "Step {{step}} acts on {{target}}, which looks like a {{consequence}} control. If healing finds a new target for it, a person must approve the change before the step runs.";
34
+ readonly healAlwaysAskKeyword: "Step {{step}} acts on {{target}}, which matches the always-ask phrase {{keyword}}. If healing finds a new target for it, a person must approve the change before the step runs.";
35
+ readonly popupHandlerFlow: "Pop-up handler step {{step}} is a {{action}} block. A handler is a short, straight list of steps, so it can never loop.";
36
+ readonly popupHandlerAction: "Pop-up handler step {{step}} uses {{action}}. A handler may only click, check, press keys, hover, scroll or wait.";
37
+ readonly popupHandlerConsequential: "Pop-up handler step {{step}} acts on {{target}}, which looks like a {{consequence}} control. A handler never acts on such a control.";
38
+ readonly popupHandlerWait: "Pop-up handler step {{step}} waits {{milliseconds}} ms. A handler step waits at most 5,000 ms, so a pop-up never holds up a run.";
39
+ readonly popupHandlerNoAction: "The pop-up handler has no step that clicks, checks or presses a key, so it cannot clear the pop-up.";
33
40
  };
34
41
  export type UiScriptProblemMessageName = keyof typeof UI_SCRIPT_PROBLEM_MESSAGES;
35
42
  export type UiScriptProblemMessageKey = `fluidgrids.builder.uiScript.problem.${UiScriptProblemMessageName}`;
@@ -0,0 +1,2 @@
1
+ import type { UiAnalyzerRule } from './rule.js';
2
+ export declare const healConsequentialRule: UiAnalyzerRule;
@@ -0,0 +1,2 @@
1
+ import type { UiAnalyzerRule } from './rule.js';
2
+ export declare const popupHandlerLoopRule: UiAnalyzerRule;
@@ -6,6 +6,7 @@
6
6
  * shows it on save and never blocks a save (spec 19, M1), and the workflow
7
7
  * service reports it as a validation warning (plan P1-08).
8
8
  */
9
+ import type { UiTarget } from '../script/types.js';
9
10
  import type { UiScriptProblemMessageKey, UiScriptProblemMessageName } from './messages.js';
10
11
  /** How much a problem matters. Analyzer v1 never reports an error: a script that cannot run fails to parse instead. */
11
12
  export declare const UI_PROBLEM_SEVERITIES: readonly ["warning", "info"];
@@ -16,7 +17,7 @@ export type UiProblemSeveritySetting = UiProblemSeverity | 'off';
16
17
  export declare const UI_ANALYZER_RULE_GROUPS: readonly ["reliability", "security", "maintainability"];
17
18
  export type UiAnalyzerRuleGroup = (typeof UI_ANALYZER_RULE_GROUPS)[number];
18
19
  /** The rules of analyzer v1, in the order their problems are listed within one step. */
19
- export declare const UI_ANALYZER_RULE_IDS: readonly ["fixedWait", "singleMethodTarget", "hardwareInput", "unknownVariable", "maskedValue", "noCleanup", "plainTextSecret", "secretOrigin", "sensitiveScreenshot", "inlineTarget", "unusedValue"];
20
+ export declare const UI_ANALYZER_RULE_IDS: readonly ["fixedWait", "singleMethodTarget", "hardwareInput", "unknownVariable", "maskedValue", "noCleanup", "plainTextSecret", "secretOrigin", "sensitiveScreenshot", "inlineTarget", "unusedValue", "healConsequential", "popupHandlerLoop"];
20
21
  export type UiAnalyzerRuleId = (typeof UI_ANALYZER_RULE_IDS)[number];
21
22
  /** One problem the analyzer found. */
22
23
  export interface UiScriptProblem {
@@ -50,6 +51,28 @@ export interface UiAnalyzeOptions {
50
51
  * unused (unless its name starts with `__`), because a later node may read it.
51
52
  */
52
53
  externalReads?: readonly string[];
54
+ /**
55
+ * The node's healing settings (plan P4-06a). When given, the
56
+ * `healConsequential` rule tells the author which steps act on a control
57
+ * a heal never changes without a person's approval. Absent means the rule
58
+ * reports nothing.
59
+ */
60
+ healing?: {
61
+ alwaysAskStepIds?: readonly string[];
62
+ /** The workspace's always-ask keyword phrases. */
63
+ keywords?: readonly string[];
64
+ };
65
+ /**
66
+ * The script is a pop-up handler's steps (plan P4-06a, threat R7). When
67
+ * given, the `popupHandlerLoop` rule checks them; absent means the rule
68
+ * reports nothing. `analyzeUiPopupHandler` sets it.
69
+ */
70
+ popupHandler?: {
71
+ match: {
72
+ urlPattern?: string;
73
+ target: UiTarget;
74
+ };
75
+ };
53
76
  }
54
77
  /** A problem as a rule reports it, before the analyzer adds the severity and the message. */
55
78
  export interface UiRuleFinding {
package/dist/analyze.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  UI_ANALYZER_RULE_IDS2,
11
11
  UI_ANALYZER_DEFAULT_SEVERITY2,
12
12
  analyzeUiScript2
13
- } from "./index-s7qdecev.js";
13
+ } from "./index-xdtanv9b.js";
14
14
  export {
15
15
  UI_ANALYZER_DEFAULT_SEVERITY2 as UI_ANALYZER_DEFAULT_SEVERITY,
16
16
  UI_ANALYZER_RULES2 as UI_ANALYZER_RULES,
@@ -1 +1 @@
1
- (()=>{var U=["data-fg-sensitive","data-sensitive","data-private"];function Z(e){return U.some((t)=>e.hasAttribute(t))}function D(e){let t=e.assignedSlot;if(t!==void 0)return t;let n=e.parentElement?.shadowRoot;if(!n)return null;for(let o of Array.from(n.querySelectorAll("slot")))if((typeof o.assignedNodes==="function"?o.assignedNodes():[]).includes(e))return o;return null}function x(e){let t=D(e);if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();if(n&&"host"in n)return n.host;try{return e.ownerDocument.defaultView?.frameElement??null}catch{return null}}function y(e){for(let t=e;t;t=x(t))if(Z(t))return!0;return!1}var Y=256;function g(e){return(e??"").normalize("NFKC").replace(/\s+/g," ").trim().toLowerCase()}function P(e,t){return g(e)===g(t)}function fe(e,t){let n=g(t);return n.length>0&&g(e).includes(n)}function qe(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(o,r)=>r);for(let o=1;o<=e.length;o+=1){let r=[o];for(let i=1;i<=t.length;i+=1){let s=e[o-1]===t[i-1]?0:1;r[i]=Math.min((n[i]??0)+1,(r[i-1]??0)+1,(n[i-1]??0)+s)}n=r}return n[t.length]??0}function me(e,t){let n=g(e).slice(0,256),o=g(t).slice(0,256),r=Math.max(n.length,o.length);if(r===0)return 0;return 1-qe(n,o)/r}function _(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}var Q=512,Ze=65536,Ye={button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",number:"spinbutton",search:"searchbox",email:"textbox",tel:"textbox",text:"textbox",url:"textbox",password:"textbox",date:"textbox","datetime-local":"textbox",month:"textbox",time:"textbox",week:"textbox",color:"textbox",file:"button"},Je={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",hr:"separator",li:"listitem",main:"main",menu:"list",meter:"meter",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",p:"paragraph",progress:"progressbar",summary:"button",table:"table",tbody:"rowgroup",td:"cell",textarea:"textbox",tfoot:"rowgroup",thead:"rowgroup",tr:"row",ul:"list"},Qe=new Set(["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"]),et=new Set(["button","input","meter","output","progress","select","textarea"]),tt=new Set(["script","style","noscript","template","head","title","meta","link"]);function A(e){return e.localName.toLowerCase()}function be(e){return e.parentElement?.closest("article, aside, main, nav, section")!=null}function nt(e){let t=A(e);switch(t){case"a":case"area":return e.hasAttribute("href")?"link":"";case"input":{let n=(e.getAttribute("type")??"text").toLowerCase();if(n==="hidden")return"";if(e.hasAttribute("list")&&["text","search","email","tel","url"].includes(n))return"combobox";return Ye[n]??"textbox"}case"select":{let n=Number(e.getAttribute("size")??"0");return e.hasAttribute("multiple")||n>1?"listbox":"combobox"}case"img":return e.getAttribute("alt")===""?"presentation":"img";case"th":return e.getAttribute("scope")==="row"?"rowheader":"columnheader";case"header":return be(e)?"":"banner";case"footer":return be(e)?"":"contentinfo";case"section":case"form":return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?t==="form"?"form":"region":"";default:return Je[t]??""}}function R(e){let t=e.getAttribute("role")?.trim().split(/\s+/)[0];return t?t.toLowerCase():nt(e)}function ot(e,t){let n=e.getRootNode();return typeof n.getElementById==="function"?n.getElementById(t):null}function rt(e){return e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true"}function it(e){let t=e.ownerDocument.defaultView;if(!t)return"none";let n=t.getComputedStyle(e);if(n.display==="none")return"subtree";return n.visibility==="hidden"||n.visibility==="collapse"?"self":"none"}function I(e){let t=e.getAttribute("contenteditable");if(t===null)return!1;let n=t.trim().toLowerCase();return n===""||n==="true"||n==="plaintext-only"}function st(e){if(e.shadowRoot)return Array.from(e.shadowRoot.childNodes);if(A(e)==="slot"){let t=e,n=typeof t.assignedNodes==="function"?t.assignedNodes({flatten:!0}):[];if(n.length>0)return n}return Array.from(e.childNodes)}var at=/^(div|p|li|tr|td|th|br|h[1-6]|section|article|header|footer)$/;function O(e,t){if(e.remaining<=0||t.length===0)return;let n=t.slice(0,e.remaining);e.parts.push(n),e.remaining-=n.length}function pe(e,t,n,o,r,i=!1){if(t>32||n.remaining<=0)return;if(e.nodeType===3){if(!i)O(n,e.textContent??"");return}if(e.nodeType!==1)return;let s=e,a=A(s);if(tt.has(a)||Z(s))return;if(!r&&rt(s))return;let l=!1;if(t>0&&!r){let d=o?.isVisible?.(s);if(d===!1)l=!0;else if(d===void 0){let c=it(s);if(c==="subtree")return;l=c==="self"}}let u=s.getAttribute("aria-label")?.trim();if(u&&t>0&&!l){O(n,` ${u} `);return}if(a==="img"||a==="input"&&s.getAttribute("type")==="image"){if(!l)O(n,` ${s.getAttribute("alt")??""} `);return}if(a==="input"||a==="textarea"||a==="select")return;if(t>0&&I(s))return;let f=t>0&&at.test(a);if(f)O(n," ");for(let d of st(s))pe(d,t+1,n,o,r,l);if(f)O(n," ")}function he(e){if(A(e)==="textarea"||I(e))return!0;for(let n=x(e);n;n=x(n))if(A(n)==="textarea"||I(n))return!0;return!1}function Ee(e){for(let t=x(e);t;t=x(t)){let n=A(t);if(n==="textarea"||n==="select"||I(t))return!0}return!1}function H(e,t,n=!1){let o=A(e);if(o==="textarea"||o==="select"||I(e)||Ee(e)||y(e))return"";return E(e.getAttribute("aria-label")??"")||V(e,t,Q,n)}function V(e,t,n=Q,o=!1){if(e.nodeType===1&&y(e))return"";let r={parts:[],remaining:n*2+64};return pe(e,0,r,t,o),E(r.parts.join(""),n)}function E(e,t=Q){return e.replace(/\s+/g," ").trim().slice(0,t)}function lt(e,t){let n=[],o=e.getAttribute("id");if(o){let i=e.getRootNode();for(let s of Array.from(i.querySelectorAll("label")))if(s.getAttribute("for")===o)n.push(H(s,t,!0))}let r=e.closest("label");if(r&&!r.hasAttribute("for"))n.push(H(r,t,!0));return E(n.join(" "))}function J(e,t,n){let o=Array.from(e.children).find((r)=>A(r)===t);return o?H(o,n):""}function k(e,t){return Te(e,t,!0)}function ge(e,t){return Te(e,t,!1)}function ut(e,t){let n=Array.from(e.children).find((o)=>A(o)==="title");if(!n||y(n)||Ee(n))return"";return E(Array.from(n.childNodes).map((o)=>V(o,t)).join(" "))}function Te(e,t,n){let o=e.getAttribute("aria-labelledby");if(o){let l=o.split(/\s+/).filter(Boolean).map((u)=>ot(e,u)).filter((u)=>u!==null).map((u)=>H(u,t,!0)).join(" ");if(E(l))return E(l)}let r=e.getAttribute("aria-label");if(r&&E(r))return E(r);let i=A(e);if(et.has(i)){let l=lt(e,t);if(l)return l}if(i==="input"){let l=(e.getAttribute("type")??"text").toLowerCase();if(l==="button"||l==="submit"||l==="reset"){let u=e.getAttribute("value");if(u!==null)return E(u);return l==="submit"?"Submit":l==="reset"?"Reset":""}if(l==="image")return E(e.getAttribute("alt")??"")}if(i==="img"||i==="area"){let l=e.getAttribute("alt");if(l)return E(l)}if(i==="svg"){let l=ut(e,t);if(l)return l}if(i==="fieldset"){let l=J(e,"legend",t);if(l)return l}if(i==="table"){let l=J(e,"caption",t);if(l)return l}if(i==="option"){let l=E(e.getAttribute("label")??"");if(l)return l}if(i==="figure"){let l=J(e,"figcaption",t);if(l)return l}if(n&&Qe.has(R(e))){let l=V(e,t);if(l)return l}let s=e.getAttribute("title");if(s&&E(s))return E(s);let a=e.getAttribute("placeholder");if(a&&E(a))return E(a);return""}function F(e,t){if(A(e)==="input"){let o=(e.getAttribute("type")??"text").toLowerCase();return o==="button"||o==="submit"||o==="reset"?k(e,t):""}return V(e,t,Ze)}function ee(e,t,n,o){return R(e)===t.trim().toLowerCase()&&g(k(e,o))===g(n)}function ct(e){return e.ownerDocument.defaultView}function B(e){let t=D(e);if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return n&&"host"in n?n.host:null}function N(e,t){let n=t?.isVisible?.(e);if(n!==void 0)return n;if(!e.isConnected)return!1;let o=ct(e),r=e;while(r){if(r.hasAttribute("hidden"))return!1;if(r.localName==="input"&&r.getAttribute("type")?.toLowerCase()==="hidden")return!1;if(o&&o.getComputedStyle(r).display==="none")return!1;r=B(r)}if(o){let s=o.getComputedStyle(e);if(s.visibility==="hidden"||s.visibility==="collapse")return!1;if(s.display==="contents")return!0}let i=e.checkVisibility;return typeof i==="function"?i.call(e):!0}function w(e){for(let n=e;n;n=x(n))if(n.getAttribute("aria-disabled")==="true"||n.hasAttribute("inert"))return!1;if(!dt.has(e.localName)){let n=e.parentElement?.closest("button, select, option, optgroup, textarea");return n?w(n):!0}if(e.hasAttribute("disabled"))return!1;let t=e.parentElement?.closest("fieldset[disabled]");if(t){if(!Array.from(t.children).find((o)=>o.localName==="legend")?.contains(e))return!1}try{return!e.matches(":disabled")}catch{return!0}}var dt=new Set(["button","input","select","textarea","optgroup","option","fieldset"]);function C(e,t,n){let r=t?.rectOf?.(e)??e.getBoundingClientRect();return{x:Math.round(r.x+(n?.x??0)),y:Math.round(r.y+(n?.y??0)),width:Math.round(r.width),height:Math.round(r.height)}}function v(e){let t=Array.from(e.querySelectorAll("*"));return e.nodeType===1?[e,...t]:t}var ft=/password|passcode|passwd|\bpin\b|otp|one[\s-]?time|verification|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|secret|token|recovery/i,mt=/password|one-time-code|^cc-/i;function bt(e){return ft.test(e)}function S(e){if(y(e))return!0;if(xe(e))return!0;for(let t=x(e);t;t=x(t))if(xe(t))return!0;return!1}function xe(e){let t=e.localName,n=e.getAttribute("contenteditable"),o=n!==null&&n.trim().toLowerCase()!=="false";if(t!=="input"&&t!=="textarea"&&t!=="select"&&!o)return!1;if(e.getAttribute("type")?.toLowerCase()==="password")return!0;if((e.getAttribute("autocomplete")??"").trim().split(/\s+/).filter(Boolean).some((i)=>mt.test(i)))return!0;return pt(e).some((i)=>i.length>0&&bt(i.replace(/[-_]/g," ")))}function pt(e){let t=(a)=>(a??"").slice(0,512),n=[k(e),t(e.getAttribute("aria-label")),t(e.getAttribute("placeholder")),t(e.getAttribute("title")),t(e.getAttribute("name")),t(e.getAttribute("id"))],o=e.getRootNode(),r=(a)=>typeof o.getElementById==="function"?o.getElementById(a):null;for(let a of(e.getAttribute("aria-labelledby")??"").split(/\s+/).filter(Boolean)){let l=r(a);if(l)n.push(t(l.getAttribute("aria-label")),t(l.textContent))}let i=e.getAttribute("id"),s=Array.from(o.querySelectorAll("label")).filter((a)=>i!==null&&a.getAttribute("for")===i||!a.hasAttribute("for")&&a.contains(e));for(let a of s)n.push(t(a.getAttribute("aria-label")),t(a.textContent));return n}var ht=0.8,Et=0.05,gt=4,Ae=1000,z=2,Tt=new Set(["button","checkbox","combobox","link","listbox","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]),xt=/^[A-Za-z_][\w:.-]{0,127}$/;function At(e){return e.nodeType===9?e:e.ownerDocument}function yt(e,t){return{kind:"list",elements:v(t.root).filter((o)=>ee(o,e.role,e.name,t.probe)),...e.nth!==void 0?{nth:e.nth}:{}}}function St(e,t){try{return{kind:"list",elements:Array.from(t.root.querySelectorAll(e))}}catch{return{kind:"invalid"}}}function Mt(e,t){let n=e.attribute??"data-testid";if(!xt.test(n))return{kind:"invalid"};return{kind:"list",elements:v(t.root).filter((r)=>r.getAttribute(n)===e.value)}}function Rt(e,t){if(e.nodeType===9)return t.ownerDocument===e&&t.getRootNode()===e;return e===t||e.contains(t)}function kt(e,t){let n=At(t.root);if(typeof n.evaluate!=="function")return{kind:"unsupported"};let o;try{o=n.evaluate(e.xpath,t.root,null,7,null)}catch{return{kind:"invalid"}}let r=[],i=Math.min(o.snapshotLength,Ae);for(let s=0;s<i;s+=1){let a=o.snapshotItem(s);if(a&&a.nodeType===1&&Rt(t.root,a))r.push(a)}return{kind:"list",elements:r,...o.snapshotLength>Ae?{overflow:!0}:{}}}function Nt(e,t,n){let o=Math.min(g(e).length,Y),r=Math.max(o,t);return r>0&&Math.abs(o-t)<=(1-n)*r}function wt(e,t){let n=Math.min(1,Math.max(0.5,e.threshold??ht)),o=e.role?.trim().toLowerCase(),r=Math.min(g(e.name).length,Y),i=[];for(let s of v(t.root)){let a=R(s);if(o?a!==o:a==="")continue;let l=k(s,t.probe);if(!Nt(l,r,n))continue;let u=me(l,e.name);if(u>=n)i.push({element:s,score:u})}return{kind:"ranked",scored:i,margin:Et}}function Me(e,t){let n=v(e.root).filter((i)=>t(F(i,e.probe))),o=e.keep??(()=>!0),r=n.filter(o);return n.filter((i)=>!r.some((s)=>s!==i&&i.contains(s)))}function vt(e,t){let n=e.exact?(o)=>P(o,e.text):(o)=>fe(o,e.text);if(g(e.text).length===0)return{kind:"list",elements:[]};return{kind:"list",elements:Me(t,n),...e.nth!==void 0?{nth:e.nth}:{}}}function te(e){return g(e).replace(/[\s:*]+$/u,"")}function Ct(e,t){return(e.kind==="role"?v(t.root).filter((o)=>ee(o,e.role,e.name,t.probe)):Me(t,(o)=>te(o)===te(e.text)&&te(o)!=="")).filter((o)=>N(o,t.probe))}function Re(e,t,n){let o=e.role?.trim().toLowerCase();return v(t.root).filter((r)=>{let i=R(r);if(o?i!==o:!Tt.has(i))return!1;return!n.some((s)=>s===r||r.contains(s))})}var Dt=new Set(["h1","h2","h3","h4","h5","h6","legend","caption","figcaption","summary","dt"]);function _t(e){return Dt.has(e.localName)||R(e)==="heading"}function Ot(e){for(let t=e;t;t=t.parentElement)if(_t(t))return t;return null}function It(e,t,n){let o=Re(e,t,n),r=new Set;for(let i of n){let a=Ot(i)?.parentElement??i;for(let l of o)if(a.contains(l))r.add(l)}return{kind:"list",elements:o.filter((i)=>r.has(i))}}function ye(e,t,n,o){return e<o&&n<t}function Lt(e,t,n){let o=t.x+t.width,r=t.y+t.height,i=n.x+n.width,s=n.y+n.height,a=ye(t.y,r,n.y,s),l=ye(t.x,o,n.x,i);switch(e){case"rightOf":return a&&n.x>=o-z?Math.max(0,n.x-o):null;case"leftOf":return a&&i<=t.x+z?Math.max(0,t.x-i):null;case"below":return l&&n.y>=r-z?Math.max(0,n.y-r):null;case"above":return l&&s<=t.y+z?Math.max(0,t.y-s):null;case"sameRow":return a?Math.abs(n.x+n.width/2-(t.x+t.width/2)):null;default:return null}}function Se(e){return e.width>0&&e.height>0}function Wt(e,t){let n=Ct(e.anchor,t);if(n.length===0)return{kind:"list",elements:[]};if(e.relation==="inside")return It(e,t,n);let o=n.map((i)=>C(i,t.probe)).filter(Se);if(o.length===0)return{kind:"unsupported"};let r=[];for(let i of Re(e,t,n)){let s=C(i,t.probe);if(!Se(s))continue;let a=null;for(let l of o){let u=Lt(e.relation,l,s);if(u!==null&&(a===null||u<a))a=u}if(a!==null)r.push({element:i,score:-a})}return{kind:"ranked",scored:r,margin:gt}}function ke(e,t){switch(e.kind){case"role":return yt(e,t);case"css":return St(e.selector,t);case"testId":return Mt(e,t);case"xpath":return kt(e,t);case"fuzzy":return wt(e,t);case"anchor":return Wt(e,t);case"text":return vt(e,t);default:return{kind:"unsupported"}}}var Ne=5,we=200;var Ut={x:0,y:0,width:0,height:0};function Pt(e,t,n){let o={root:e,offset:Ut,hidden:!1,disabled:!1};for(let[r,i]of(t??[]).entries()){let s;try{s=Array.from(o.root.querySelectorAll(i))}catch{return{index:r,reason:"invalid"}}if(s.length===0)return{index:r,reason:"notFound"};if(s.length>1)return{index:r,reason:"ambiguous"};let a=s[0],l=a.localName;if(l==="iframe"||l==="frame"){let u=a,f=null;try{f=u.contentDocument}catch{f=null}if(!f)return{index:r,reason:"inaccessible"};let d=C(a,n,o.offset);o={root:f,offset:{x:d.x+u.clientLeft,y:d.y+u.clientTop,width:0,height:0},hidden:o.hidden||!N(a,n),disabled:o.disabled||!w(a)}}else if(a.shadowRoot)o={root:a.shadowRoot,offset:o.offset,hidden:o.hidden,disabled:o.disabled};else return{index:r,reason:"notAFrame"}}return o}function Ht(e,t,n,o){if(t==="attached")return!0;if(n.hidden||!N(e,o))return!1;return t==="visible"||!n.disabled&&w(e)}function ve(e,t,n,o,r){return{role:R(e),name:S(e)?"":_(he(e)?ge(e,r):k(e,r),we),bounds:C(e,r,o),method:t.kind,methodIndex:n}}function Vt(e,t,n,o=!1){if(t.length===0)return e.length>0?{outcome:"notInteractable",elements:e,matches:0}:{outcome:"none",elements:[],matches:0};if(o)return{outcome:"ambiguous",elements:t,matches:t.length};if(n!==void 0){let r=t[n];return r?{outcome:"found",element:r,matches:t.length}:{outcome:"none",elements:[],matches:t.length}}return t.length===1?{outcome:"found",element:t[0],matches:1}:{outcome:"ambiguous",elements:t,matches:t.length}}function Ft(e,t,n){if(t.length===0)return e.length>0?{outcome:"notInteractable",elements:e.map((a)=>a.element),matches:0}:{outcome:"none",elements:[],matches:0};let o=[...t].sort((a,l)=>l.score-a.score),r=o[0],i=o[1];if(!i||r.score-i.score>=n)return{outcome:"found",element:r.element,matches:t.length};let s=o.filter((a)=>r.score-a.score<n).map((a)=>a.element);return{outcome:"ambiguous",elements:s,matches:s.length}}function Bt(e,t){switch(e.kind){case"invalid":case"unsupported":return e.kind;case"list":return Vt(e.elements,e.elements.filter(t),e.nth,e.overflow);case"ranked":return Ft(e.scored,e.scored.filter((n)=>t(n.element)),e.margin)}}function X(e,t,n=[],o=0,r){return{status:"failed",code:e,candidates:n,candidateCount:o,attempts:t,...r?{frame:r}:{}}}function Ce(e,t,n={}){let o=n.state??"interactable",r=Pt(e,t.frame,n);if(!("root"in r)){let d=t.methods.map((c,b)=>({index:b,method:c.kind,outcome:"notTried",matches:0}));return X("ELEMENT_NOT_FOUND",d,[],0,r)}let i=[],s=t.methods.findIndex((d)=>d.enabled!==!1),a,l,u;for(let[d,c]of t.methods.entries()){if(u){i.push({index:d,method:c.kind,outcome:"notTried",matches:0});continue}if(c.enabled===!1){i.push({index:d,method:c.kind,outcome:"disabled",matches:0});continue}let b=(p)=>Ht(p,o,r,n),m=Bt(ke(c,{root:r.root,probe:n,keep:b}),b);if(m==="invalid"||m==="unsupported"){i.push({index:d,method:c.kind,outcome:m,matches:0});continue}if(i.push({index:d,method:c.kind,outcome:m.outcome,matches:m.matches}),m.outcome==="found")u={element:m.element,method:c,index:d};else if(m.outcome==="ambiguous"&&!a)a={elements:m.elements,method:c,index:d,count:m.matches};else if(m.outcome==="notInteractable"&&!l)l={elements:m.elements,method:c,index:d}}if(u)return{status:"found",element:u.element,method:u.method.kind,methodIndex:u.index,fallback:u.index!==s,candidate:ve(u.element,u.method,u.index,r.offset,n),attempts:i};let f=(d)=>d.elements.slice(0,Ne).map((c)=>ve(c,d.method,d.index,r.offset,n));if(a)return X("ELEMENT_AMBIGUOUS",i,f(a),a.count);if(l)return X("ELEMENT_NOT_INTERACTABLE",i,f(l),l.elements.length);return X("ELEMENT_NOT_FOUND",i)}var ne="[REDACTED]",zt=[/\b(?:Bearer|Basic)\s+[^\s"'`,;)\]}]+/gi,/\b(?:sk|pk|rk|xai)-[^\s"'`,;)\]}]+/gi,/\b(?:gsk|hf|ghp|gho|ghs|ghu|glpat)_[^\s"'`,;)\]}]+/gi,/\bAIza[\w-]{10,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{12,}/g],Xt=/([\s"'`,;:=()[\]{}]+)/,Kt=/^(?:api[_-]?key|access[_-]?key|secret|secret[_-]?key|client[_-]?secret|token|password)$/i;function jt(e){let t=e.indexOf("…");return e.includes("***")||t!==-1&&t<e.length-1}function $t(e){let t=e.split(Xt);for(let n=0;n<t.length;n+=2){let o=t[n]??"";if(o&&o!=="[REDACTED]"&&jt(o))t[n]="[REDACTED]";let r=t[n+1]??"";if(t[n+2]&&Kt.test(o)&&/[:=]/.test(r))t[n+2]="[REDACTED]"}return t.join("")}function oe(e){if(!e)return e;let t=e;for(let n of zt)t=t.replace(n,"[REDACTED]");return t=$t(t),t.replace(/(?:\[REDACTED\]){2,}/g,"[REDACTED]")}var De="";function K(e){if(!e)return!1;let t=e.replaceAll("[REDACTED]",De);return oe(t).replaceAll(De,"[REDACTED]")!==e}function re(e){try{return decodeURIComponent(e.replaceAll("+"," "))}catch{return e}}function _e(e){return K(re(e).replace(/[/?&#]/g," "))}var Gt=1,qt=5000,Zt=64,Ie=500,Yt=new Set(["script","style","noscript","template","link","meta","base","head","object","embed"]),Jt=new Set(["textarea"]),Qt=new Set(["id","class","role","name","type","for","title","alt","placeholder","label","autocomplete","tabindex","disabled","readonly","hidden","inert","contenteditable","list","multiple","size","scope","slot","part","lang","dir","data-testid","data-test","data-test-id","data-qa","data-cy","data-automation-id",...U]),en=new Set(["aria-valuenow","aria-valuetext","aria-checked","aria-selected","aria-pressed"]),tn=new Set(["button","submit","reset"]),Le=/reset|recover|verify|verification|magic|confirm|activate|invite|unsubscribe/i,nn=/^[a-z][a-z0-9-]{0,63}$/;var on=/^[a-z][a-z0-9_:.-]{0,127}$/;function We(e){let t=e.getAttribute("contenteditable");return t!==null&&t.trim().toLowerCase()!=="false"}function Ue(e){for(let t=x(e);t;t=x(t))if(t.localName==="textarea"||We(t))return!0;return!1}function rn(e){if(!e.parentElement?.shadowRoot)return!1;let t=D(e);return t!==null&&(S(t)||Ue(t))}function j(e){return _(oe(e),Ie)}function sn(e){let t=e;for(let n=0;n<3;n+=1){let o=re(t);if(o===t)break;t=o}return t}function an(e){let t=e.split(/[/?#;]/),n=t.findIndex((r)=>Le.test(r));return t.slice(0,n+1).map((r)=>K(r)?ne:r).join("/")}function Pe(e){let t=e.trim();if(t==="")return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith("//"),o="",r;if(n){let f;try{f=new URL(t.startsWith("//")?`https:${t}`:t)}catch{return null}if(f.protocol!=="http:"&&f.protocol!=="https:")return null;o=t.startsWith("//")?`//${f.host}`:f.origin,r=f.pathname}else r=t.split(/[?#]/)[0]??"";let i=r.split("/"),s=i.map(sn),a=s.findIndex((f)=>Le.test(f)),u=(a>=0?i.slice(0,a+1):i).map((f,d)=>{let c=s[d]??f;if(d===a)return an(c);return K(c)||_e(f)?ne:f}).join("/");return _(`${o}${u}`,Ie)}var ln=new Set(["alt","label","title","placeholder","value","aria-label","aria-description","aria-roledescription","aria-placeholder"]),un=new Set(["aria-hidden","aria-disabled","aria-expanded","aria-haspopup","aria-controls","aria-owns","aria-labelledby","aria-describedby","aria-level","aria-current","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-readonly","aria-required","aria-invalid","aria-busy","aria-live","aria-atomic","aria-posinset","aria-setsize","aria-colcount","aria-colindex","aria-colspan","aria-rowcount","aria-rowindex","aria-rowspan","aria-sort"]);function cn(e,t){let n={},o=e.localName;for(let r of Array.from(e.attributes)){let i=r.name.toLowerCase();if(i.startsWith("on")||!on.test(i))continue;if(t&&(ln.has(i)||i==="href"||i.startsWith("aria-")&&!un.has(i)))continue;if(Qt.has(i)||i.startsWith("aria-")&&!en.has(i))n[i]=j(r.value);else if(i==="href"&&(o==="a"||o==="area")){let s=Pe(r.value);if(s!==null)n[i]=s}else if(i==="value"&&o==="input"&&tn.has((e.getAttribute("type")??"").toLowerCase()))n[i]=j(r.value)}return Object.keys(n).length>0?n:void 0}function dn(e,t){let n=t?.rectOf?.(e)??e.getBoundingClientRect(),o=[Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height)];return o[2]>0||o[3]>0?o:void 0}function Oe(e,t,n,o,r){let i=[];for(let s of Array.from(e.childNodes)){if(t.count>=t.max){t.truncated=!0;break}if(s.nodeType===3){if(!o||rn(s))continue;let a=s.textContent??"";if(a.length===0)continue;let l=a.trim()===""?" ":j(a);t.count+=1,i.push(l)}else if(s.nodeType===1){let a=G(s,t,n+1,o,r);if(a)i.push(a)}}return i}function G(e,t,n,o,r){let i=e.localName.toLowerCase();if(Yt.has(i)||!nn.test(i))return null;if(n>Zt)return t.truncated=!0,null;t.count+=1;let s={t:i},a=Ue(e),l=r||a||y(e),u=cn(e,l);if(u)s.a=u;if(N(e,t.probe)){let p=dn(e,t.probe);if(p)s.r=p}else s.h=1;let f=S(e),d=o&&!a&&!f&&!Jt.has(i)&&!We(e),c=l||!d;if(i==="svg"){let p=Array.from(e.children).find((T)=>T.localName==="title"),h=p?G(p,t,n+1,d,c):null;if(h)s.c=[h];return s}if(i==="iframe"||i==="frame"){let p=null;try{p=e.contentDocument}catch{p=null}let h=p?.documentElement;if(h){let T=G(h,t,n+1,d,c);if(T)s.f=T}return s}let b=Oe(e,t,n,d,c);if(b.length>0)s.c=b;let m=e.shadowRoot;if(m){let p=Oe(m,t,n,d,c);if(p.length>0)s.s=p}return s}function fn(e){let t=e.querySelector("title");if(t&&y(t))return"";return j(e.title??"")}function He(e,t={}){let n={count:0,max:Math.max(1,t.maxNodes??qt),truncated:!1,probe:t},o=G(e.documentElement,n,0,!0,!1)??{t:"html"},r=e.defaultView;return{snapshotVersion:Gt,url:Pe(e.URL)??"",title:fn(e),viewport:{width:Math.round(r?.innerWidth??0),height:Math.round(r?.innerHeight??0)},root:o,nodeCount:n.count,truncated:n.truncated}}var ie=65536,mn=65536,Fe=new Set(["getText","getValue","getAttribute","exists"]),Be=new Set(["click","doubleClick","hover","check"]);function bn(e){return e.ownerDocument.defaultView}var pn={left:0,middle:1,right:2},hn={left:1,middle:4,right:2};function se(e,t,n){let o=e.getBoundingClientRect();return{bubbles:!0,cancelable:!0,composed:!0,view:t,button:pn[n],buttons:0,clientX:o.x+o.width/2,clientY:o.y+o.height/2,pointerId:1,pointerType:"mouse",isPrimary:!0}}function ze(e,t,n){let o=typeof t.PointerEvent==="function"?t.PointerEvent:t.MouseEvent,r=[];for(let s=e;s;s=B(s))r.unshift(s);let i={...n,bubbles:!1};e.dispatchEvent(new o("pointerover",n));for(let s of r)s.dispatchEvent(new o("pointerenter",i));e.dispatchEvent(new t.MouseEvent("mouseover",n));for(let s of r)s.dispatchEvent(new t.MouseEvent("mouseenter",i))}var En='a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]:not([contenteditable="false"])';function gn(e,t){for(let o=e;o;o=B(o))if(o.matches(En)&&w(o)&&o instanceof t.HTMLElement){o.focus();return}let n=e.ownerDocument.activeElement;if(n instanceof t.HTMLElement&&n!==e.ownerDocument.body)n.blur()}function Tn(e,t,n,o,r){let i=typeof t.PointerEvent==="function"?t.PointerEvent:t.MouseEvent,s={...n,buttons:hn[o],detail:r},a={...n,detail:r};ze(e,t,n);let l=e.dispatchEvent(new i("pointerdown",s));if(l&&e.dispatchEvent(new t.MouseEvent("mousedown",s)))gn(e,t);if(e.dispatchEvent(new i("pointerup",a)),l)e.dispatchEvent(new t.MouseEvent("mouseup",a))}function L(e,t,n,o=1){let r=se(e,t,n);Tn(e,t,r,n,o);let i=n==="left"?"click":n==="right"?"contextmenu":"auxclick";e.dispatchEvent(new t.MouseEvent(i,{...r,detail:o}))}function Xe(e,t){if(e instanceof t.HTMLTextAreaElement)return!0;if(!(e instanceof t.HTMLInputElement))return!1;return!["button","submit","reset","image","checkbox","radio","file","range","color","hidden"].includes(e.type)}function xn(e,t,n){let o=e instanceof t.HTMLTextAreaElement?t.HTMLTextAreaElement.prototype:t.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"value")?.set;if(r)r.call(e,n);else e.value=n;e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new t.Event("change",{bubbles:!0}))}function An(e,t){if(!(e instanceof t.HTMLElement))return!1;if(e.isContentEditable)return!0;let n=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return n===""||n==="true"||n==="plaintext-only"}function Ve(e,t,n,o){if(n.length>mn)return{ok:!1,problem:"INVALID_ACTION"};if(Xe(e,t)){if(e.readOnly)return{ok:!1,problem:"NOT_EDITABLE"};return e.focus(),xn(e,t,o?`${e.value}${n}`:n),{ok:!0}}if(An(e,t))return e.focus(),e.textContent=o?`${e.textContent??""}${n}`:n,e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),{ok:!0};return{ok:!1,problem:"NOT_EDITABLE"}}function yn(e){let t=e.getAttribute("label");return t!==null&&t.trim()!==""?t:e.textContent??""}function Sn(e,t,n){if(!(e instanceof t.HTMLSelectElement))return{ok:!1,problem:"NOT_SELECTABLE"};let o=Array.from(e.options),r=n.value!==void 0?o.find((i)=>i.value===n.value):n.label!==void 0?o.find((i)=>P(yn(i),n.label)):n.index!==void 0?o[n.index]:void 0;if(!r||r.disabled||r.closest("optgroup")?.hasAttribute("disabled"))return{ok:!1,problem:"OPTION_NOT_FOUND"};return e.focus(),r.selected=!0,e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new t.Event("change",{bubbles:!0})),{ok:!0}}function Mn(e,t,n){if(e instanceof t.HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")){if(e.checked!==n){if(e.type==="radio"&&!n)return{ok:!1,problem:"NOT_CHECKABLE"};L(e,t,"left")}return e.checked===n?{ok:!0}:{ok:!1,problem:"STATE_NOT_CHANGED"}}let o=e.getAttribute("role");if(o==="checkbox"||o==="switch"||o==="radio"||o==="menuitemcheckbox"){let r=()=>e.getAttribute("aria-checked")==="true";if(r()!==n)L(e,t,"left");return r()===n?{ok:!0}:{ok:!1,problem:"STATE_NOT_CHANGED"}}return{ok:!1,problem:"NOT_CHECKABLE"}}var Rn=/^(?:[\s\S]|[A-Z][A-Za-z0-9]{1,23})$/u;function kn(e,t){if(e instanceof t.HTMLButtonElement)return!0;if(e instanceof t.HTMLInputElement)return["submit","button","reset","image"].includes(e.type);let n=e.localName;return n==="a"&&e.hasAttribute("href")||n==="summary"}function Nn(e,t){if(e instanceof t.HTMLButtonElement)return!0;if(e instanceof t.HTMLInputElement)return["submit","button","reset","image","checkbox","radio"].includes(e.type);return e.localName==="summary"}function ae(e,t){e.dispatchEvent(new t.MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0,view:t,detail:0}))}function wn(e,t,n){if(!Rn.test(n))return{ok:!1,problem:"INVALID_ACTION"};let o=n==="Space"?" ":n;if(e instanceof t.HTMLElement)e.focus();let r={key:o,bubbles:!0,cancelable:!0,composed:!0},i=e.dispatchEvent(new t.KeyboardEvent("keydown",r));if(o==="Enter"&&i){if(kn(e,t))ae(e,t);else if(e instanceof t.HTMLInputElement&&Xe(e,t)&&e.form)Dn(e.form,t)}let s=e.dispatchEvent(new t.KeyboardEvent("keyup",r));if(o===" "&&i&&s&&Nn(e,t))ae(e,t);return{ok:!0}}var vn=new Set(["submit","image"]),Cn=new Set(["text","search","url","tel","email","password","date","month","week","time","datetime-local","number"]);function Dn(e,t){let n=Array.from(e.elements),o=e.getRootNode(),r=Array.from(o.querySelectorAll("button, input")).find((s)=>(s instanceof t.HTMLButtonElement&&s.type==="submit"||s instanceof t.HTMLInputElement&&vn.has(s.type))&&s.form===e);if(r){if(w(r))ae(r,t);return}if(n.filter((s)=>s instanceof t.HTMLInputElement&&Cn.has(s.type)).length===1)e.requestSubmit()}function _n(e,t){if(e instanceof t.HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"))return e.checked;if(e instanceof t.HTMLInputElement||e instanceof t.HTMLTextAreaElement||e instanceof t.HTMLSelectElement)return e.value.slice(0,ie);let n=e.getAttribute("aria-checked");if(n==="true"||n==="false")return n==="true";return e.getAttribute("aria-valuenow")??e.getAttribute("aria-valuetext")}var On=/^[A-Za-z_][\w:.-]{0,127}$/;function Ke(e,t){let n=bn(e);if(!n)return{ok:!1,problem:"INVALID_ACTION"};switch(t.kind){case"click":return L(e,n,t.button??"left"),{ok:!0};case"doubleClick":return L(e,n,"left",1),L(e,n,"left",2),e.dispatchEvent(new n.MouseEvent("dblclick",{...se(e,n,"left"),detail:2})),{ok:!0};case"hover":{let o=se(e,n,"left"),r=typeof n.PointerEvent==="function"?n.PointerEvent:n.MouseEvent;return ze(e,n,o),e.dispatchEvent(new r("pointermove",o)),e.dispatchEvent(new n.MouseEvent("mousemove",o)),{ok:!0}}case"focus":if(e instanceof n.HTMLElement)e.focus();return{ok:!0};case"type":return typeof t.text==="string"?Ve(e,n,t.text,t.append===!0):{ok:!1,problem:"INVALID_ACTION"};case"clear":return Ve(e,n,"",!1);case"select":return Sn(e,n,t);case"check":return Mn(e,n,t.checked===!0);case"pressKey":return typeof t.key==="string"?wn(e,n,t.key):{ok:!1,problem:"INVALID_ACTION"};case"scroll":return e.scrollBy?.({left:Number(t.dx??0)||0,top:Number(t.dy??0)||0}),{ok:!0};case"scrollIntoView":return e.scrollIntoView?.({block:"center",inline:"nearest"}),{ok:!0};case"getText":if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:F(e).slice(0,ie)};case"getValue":if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:_n(e,n)};case"getAttribute":{if(typeof t.name!=="string"||!On.test(t.name))return{ok:!1,problem:"INVALID_ACTION"};let o=t.name.toLowerCase();if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:e.getAttribute(o)?.slice(0,ie)??null}}case"exists":return{ok:!0,value:!0};default:return{ok:!1,problem:"INVALID_ACTION"}}}var $e=1,je="__burdenoffUiRuntime",In=60000,Ln="fg-ui-highlight",Wn=new Set(["role","css","testId","xpath","fuzzy","anchor","text"]);function le(e){if(!e||typeof e!=="object")return!1;let t=e;if(!Array.isArray(t.methods)||t.methods.length===0||t.methods.length>8)return!1;if(t.frame!==void 0&&!(Array.isArray(t.frame)&&t.frame.every((n)=>typeof n==="string")))return!1;return t.methods.every((n)=>!!n&&typeof n==="object"&&Wn.has(String(n.kind)))}function ue(){return{status:"failed",code:"ELEMENT_NOT_FOUND",candidates:[],candidateCount:0,attempts:[]}}function ce(e){return{status:e.status,method:e.method,methodIndex:e.methodIndex,fallback:e.fallback,candidate:e.candidate,attempts:e.attempts}}function Un(e){try{return e.defaultView?.frameElement??null}catch{return null}}function Pn(e,t,n,o){let r=e.getRootNode();if(typeof r.elementFromPoint!=="function")return null;let i=r.elementFromPoint(t,n);if(!i)return"offscreen";if(i===e||e.contains(i))return null;return o.some((s)=>s.contains(i))?null:"covered"}function Hn(e,t){let n=t.x+t.width/2,o=t.y+t.height/2,r=Array.from(e.labels??[]),i=e;for(let s=0;s<32;s+=1){let a=Pn(i,n,o,s===0?r:[]);if(a)return a;let l=i.getRootNode();if(l&&"host"in l){i=l.host;continue}let u=Un(i.ownerDocument);if(!u)return null;let f=u.getBoundingClientRect();n+=f.x+u.clientLeft,o+=f.y+u.clientTop,i=u}return null}function Vn(e,t){let n=e.ownerDocument.defaultView;if(!n)return!1;let o=t.x+t.width/2,r=t.y+t.height/2;return o<0||r<0||o>=n.innerWidth||r>=n.innerHeight}function Fn(e){let t=e.ownerDocument.defaultView;if(t&&t.getComputedStyle(e).pointerEvents==="none")return"noPointerEvents";let n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return null;if(Vn(e,n)&&typeof e.scrollIntoView==="function")e.scrollIntoView({block:"center",inline:"center"}),n=e.getBoundingClientRect();return Hn(e,n)}function Bn(e,t={}){let n=t.root??e,o={...t.rectOf?{rectOf:t.rectOf}:{},...t.isVisible?{isVisible:t.isVisible}:{}},r=null,i=null,s=()=>{if(i!==null)clearTimeout(i),i=null;r?.remove(),r=null},a=(c,b)=>(s(),Ce(n,c,{...o,...b?{state:b}:{}})),l=(c,b={})=>{if(!le(c))return ue();let m=a(c,b.state);return m.status==="found"?ce(m):m},u=(c,b,m={})=>{if(!b||typeof b!=="object"||typeof b.kind!=="string")return{ok:!1,code:"INVALID_ACTION"};if(!le(c))return{ok:!1,code:"ELEMENT_NOT_FOUND",resolution:ue()};let p=m.state??(Fe.has(b.kind)?"visible":"interactable"),h=a(c,p);if(h.status!=="found"){if(b.kind==="exists"&&h.code==="ELEMENT_NOT_FOUND")return{ok:!0,value:!1,resolution:h};return{ok:!1,code:h.code,resolution:h}}let T=ce(h),W=Be.has(b.kind)?Fn(h.element):null;if(W)return{ok:!1,code:"ELEMENT_NOT_INTERACTABLE",reason:W,resolution:{status:"failed",code:"ELEMENT_NOT_INTERACTABLE",candidates:[h.candidate],candidateCount:1,attempts:h.attempts}};let M=Ke(h.element,b);if(!M.ok)return{ok:!1,code:M.problem,resolution:T};return M.value===void 0?{ok:!0,resolution:T}:{ok:!0,resolution:T,value:M.value}},f=(c,b,m)=>{let p=e.createElement(Ln);p.setAttribute("aria-hidden","true"),p.setAttribute("style","all: initial; position: fixed; inset: 0; pointer-events: none; z-index: 2147483647;");let h=p.attachShadow({mode:"closed"});c.forEach((T,W)=>{let M=e.createElement("div");M.setAttribute("style",`position: fixed; left: ${T.bounds.x-3}px; top: ${T.bounds.y-3}px; width: ${T.bounds.width+6}px; height: ${T.bounds.height+6}px; outline: 3px solid Highlight; border-radius: 4px; box-sizing: border-box;`);let de=m?`${W+1}${b?` ${b}`:""}`:b;if(de){let q=e.createElement("span");q.textContent=de.slice(0,120),q.setAttribute("style","position: absolute; left: 0; top: 100%; margin-top: 4px; padding: 2px 6px; font: 600 11px system-ui, sans-serif; background: Highlight; color: HighlightText; border-radius: 3px; white-space: nowrap;"),M.appendChild(q)}h.appendChild(M)}),e.documentElement.appendChild(p),r=p};return{version:$e,resolve:l,act:u,highlight:(c,b={})=>{if(!le(c))return ue();let m=a(c,b.state??"visible");if(m.status==="found")f([m.candidate],b.label,!1);else if(m.candidates.length>0)f(m.candidates,b.label,!0);let p=Math.min(In,Math.max(0,Number(b.durationMs??0)||0));if(r&&p>0)i=setTimeout(s,p);return m.status==="found"?ce(m):m},clearHighlight:s,snapshot:(c={})=>(s(),He(e,{...o,...c.maxNodes?{maxNodes:c.maxNodes}:{}}))}}function Ge(e,t){let n=Reflect.get(e,je);if(n&&typeof n==="object"&&typeof n.version==="number"&&n.version>=$e)return n;let o=Object.freeze(Bn(t));return Object.defineProperty(e,je,{value:o,configurable:!0,enumerable:!1,writable:!1}),o}Ge(globalThis,globalThis.document);})();
1
+ (()=>{var U=["data-fg-sensitive","data-sensitive","data-private"];function Z(e){return U.some((t)=>e.hasAttribute(t))}function _(e){let t=e.assignedSlot;if(t!==void 0)return t;let n=e.parentElement?.shadowRoot;if(!n)return null;for(let o of Array.from(n.querySelectorAll("slot")))if((typeof o.assignedNodes==="function"?o.assignedNodes():[]).includes(e))return o;return null}function x(e){let t=_(e);if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();if(n&&"host"in n)return n.host;try{return e.ownerDocument.defaultView?.frameElement??null}catch{return null}}function y(e){for(let t=e;t;t=x(t))if(Z(t))return!0;return!1}var me={button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",number:"spinbutton",search:"searchbox",email:"textbox",tel:"textbox",text:"textbox",url:"textbox",password:"textbox",date:"textbox","datetime-local":"textbox",month:"textbox",time:"textbox",week:"textbox",color:"textbox",file:"button"},pe={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",hr:"separator",li:"listitem",main:"main",menu:"list",meter:"meter",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",p:"paragraph",progress:"progressbar",summary:"button",table:"table",tbody:"rowgroup",td:"cell",textarea:"textbox",tfoot:"rowgroup",thead:"rowgroup",tr:"row",ul:"list"},be=new Set(["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"]);var Y=256;function g(e){return(e??"").normalize("NFKC").replace(/\s+/g," ").trim().toLowerCase()}function P(e,t){return g(e)===g(t)}function he(e,t){let n=g(t);return n.length>0&&g(e).includes(n)}function Ye(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(o,r)=>r);for(let o=1;o<=e.length;o+=1){let r=[o];for(let i=1;i<=t.length;i+=1){let s=e[o-1]===t[i-1]?0:1;r[i]=Math.min((n[i]??0)+1,(r[i-1]??0)+1,(n[i-1]??0)+s)}n=r}return n[t.length]??0}function Ee(e,t){let n=g(e).slice(0,256),o=g(t).slice(0,256),r=Math.max(n.length,o.length);if(r===0)return 0;return 1-Ye(n,o)/r}function v(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}var Q=512,Je=65536,Qe=new Set(["button","input","meter","output","progress","select","textarea"]),et=new Set(["script","style","noscript","template","head","title","meta","link"]);function A(e){return e.localName.toLowerCase()}function ge(e){return e.parentElement?.closest("article, aside, main, nav, section")!=null}function tt(e){let t=A(e);switch(t){case"a":case"area":return e.hasAttribute("href")?"link":"";case"input":{let n=(e.getAttribute("type")??"text").toLowerCase();if(n==="hidden")return"";if(e.hasAttribute("list")&&["text","search","email","tel","url"].includes(n))return"combobox";return me[n]??"textbox"}case"select":{let n=Number(e.getAttribute("size")??"0");return e.hasAttribute("multiple")||n>1?"listbox":"combobox"}case"img":return e.getAttribute("alt")===""?"presentation":"img";case"th":return e.getAttribute("scope")==="row"?"rowheader":"columnheader";case"header":return ge(e)?"":"banner";case"footer":return ge(e)?"":"contentinfo";case"section":case"form":return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?t==="form"?"form":"region":"";default:return pe[t]??""}}function R(e){let t=e.getAttribute("role")?.trim().split(/\s+/)[0];return t?t.toLowerCase():tt(e)}function nt(e,t){let n=e.getRootNode();return typeof n.getElementById==="function"?n.getElementById(t):null}function ot(e){return e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true"}function rt(e){let t=e.ownerDocument.defaultView;if(!t)return"none";let n=t.getComputedStyle(e);if(n.display==="none")return"subtree";return n.visibility==="hidden"||n.visibility==="collapse"?"self":"none"}function I(e){let t=e.getAttribute("contenteditable");if(t===null)return!1;let n=t.trim().toLowerCase();return n===""||n==="true"||n==="plaintext-only"}function it(e){if(e.shadowRoot)return Array.from(e.shadowRoot.childNodes);if(A(e)==="slot"){let t=e,n=typeof t.assignedNodes==="function"?t.assignedNodes({flatten:!0}):[];if(n.length>0)return n}return Array.from(e.childNodes)}var st=/^(div|p|li|tr|td|th|br|h[1-6]|section|article|header|footer)$/;function O(e,t){if(e.remaining<=0||t.length===0)return;let n=t.slice(0,e.remaining);e.parts.push(n),e.remaining-=n.length}function Te(e,t,n,o,r,i=!1){if(t>32||n.remaining<=0)return;if(e.nodeType===3){if(!i)O(n,e.textContent??"");return}if(e.nodeType!==1)return;let s=e,a=A(s);if(et.has(a)||Z(s))return;if(!r&&ot(s))return;let l=!1;if(t>0&&!r){let d=o?.isVisible?.(s);if(d===!1)l=!0;else if(d===void 0){let c=rt(s);if(c==="subtree")return;l=c==="self"}}let u=s.getAttribute("aria-label")?.trim();if(u&&t>0&&!l){O(n,` ${u} `);return}if(a==="img"||a==="input"&&s.getAttribute("type")==="image"){if(!l)O(n,` ${s.getAttribute("alt")??""} `);return}if(a==="input"||a==="textarea"||a==="select")return;if(t>0&&I(s))return;let f=t>0&&st.test(a);if(f)O(n," ");for(let d of it(s))Te(d,t+1,n,o,r,l);if(f)O(n," ")}function xe(e){if(A(e)==="textarea"||I(e))return!0;for(let n=x(e);n;n=x(n))if(A(n)==="textarea"||I(n))return!0;return!1}function Ae(e){for(let t=x(e);t;t=x(t)){let n=A(t);if(n==="textarea"||n==="select"||I(t))return!0}return!1}function H(e,t,n=!1){let o=A(e);if(o==="textarea"||o==="select"||I(e)||Ae(e)||y(e))return"";return E(e.getAttribute("aria-label")??"")||V(e,t,Q,n)}function V(e,t,n=Q,o=!1){if(e.nodeType===1&&y(e))return"";let r={parts:[],remaining:n*2+64};return Te(e,0,r,t,o),E(r.parts.join(""),n)}function E(e,t=Q){return e.replace(/\s+/g," ").trim().slice(0,t)}function at(e,t){let n=[],o=e.getAttribute("id");if(o){let i=e.getRootNode();for(let s of Array.from(i.querySelectorAll("label")))if(s.getAttribute("for")===o)n.push(H(s,t,!0))}let r=e.closest("label");if(r&&!r.hasAttribute("for"))n.push(H(r,t,!0));return E(n.join(" "))}function J(e,t,n){let o=Array.from(e.children).find((r)=>A(r)===t);return o?H(o,n):""}function k(e,t){return Se(e,t,!0)}function ye(e,t){return Se(e,t,!1)}function lt(e,t){let n=Array.from(e.children).find((o)=>A(o)==="title");if(!n||y(n)||Ae(n))return"";return E(Array.from(n.childNodes).map((o)=>V(o,t)).join(" "))}function Se(e,t,n){let o=e.getAttribute("aria-labelledby");if(o){let l=o.split(/\s+/).filter(Boolean).map((u)=>nt(e,u)).filter((u)=>u!==null).map((u)=>H(u,t,!0)).join(" ");if(E(l))return E(l)}let r=e.getAttribute("aria-label");if(r&&E(r))return E(r);let i=A(e);if(Qe.has(i)){let l=at(e,t);if(l)return l}if(i==="input"){let l=(e.getAttribute("type")??"text").toLowerCase();if(l==="button"||l==="submit"||l==="reset"){let u=e.getAttribute("value");if(u!==null)return E(u);return l==="submit"?"Submit":l==="reset"?"Reset":""}if(l==="image")return E(e.getAttribute("alt")??"")}if(i==="img"||i==="area"){let l=e.getAttribute("alt");if(l)return E(l)}if(i==="svg"){let l=lt(e,t);if(l)return l}if(i==="fieldset"){let l=J(e,"legend",t);if(l)return l}if(i==="table"){let l=J(e,"caption",t);if(l)return l}if(i==="option"){let l=E(e.getAttribute("label")??"");if(l)return l}if(i==="figure"){let l=J(e,"figcaption",t);if(l)return l}if(n&&be.has(R(e))){let l=V(e,t);if(l)return l}let s=e.getAttribute("title");if(s&&E(s))return E(s);let a=e.getAttribute("placeholder");if(a&&E(a))return E(a);return""}function F(e,t){if(A(e)==="input"){let o=(e.getAttribute("type")??"text").toLowerCase();return o==="button"||o==="submit"||o==="reset"?k(e,t):""}return V(e,t,Je)}function ee(e,t,n,o){return R(e)===t.trim().toLowerCase()&&g(k(e,o))===g(n)}function ut(e){return e.ownerDocument.defaultView}function B(e){let t=_(e);if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return n&&"host"in n?n.host:null}function N(e,t){let n=t?.isVisible?.(e);if(n!==void 0)return n;if(!e.isConnected)return!1;let o=ut(e),r=e;while(r){if(r.hasAttribute("hidden"))return!1;if(r.localName==="input"&&r.getAttribute("type")?.toLowerCase()==="hidden")return!1;if(o&&o.getComputedStyle(r).display==="none")return!1;r=B(r)}if(o){let s=o.getComputedStyle(e);if(s.visibility==="hidden"||s.visibility==="collapse")return!1;if(s.display==="contents")return!0}let i=e.checkVisibility;return typeof i==="function"?i.call(e):!0}function w(e){for(let n=e;n;n=x(n))if(n.getAttribute("aria-disabled")==="true"||n.hasAttribute("inert"))return!1;if(!ct.has(e.localName)){let n=e.parentElement?.closest("button, select, option, optgroup, textarea");return n?w(n):!0}if(e.hasAttribute("disabled"))return!1;let t=e.parentElement?.closest("fieldset[disabled]");if(t){if(!Array.from(t.children).find((o)=>o.localName==="legend")?.contains(e))return!1}try{return!e.matches(":disabled")}catch{return!0}}var ct=new Set(["button","input","select","textarea","optgroup","option","fieldset"]);function D(e,t,n){let r=t?.rectOf?.(e)??e.getBoundingClientRect();return{x:Math.round(r.x+(n?.x??0)),y:Math.round(r.y+(n?.y??0)),width:Math.round(r.width),height:Math.round(r.height)}}function C(e){let t=Array.from(e.querySelectorAll("*"));return e.nodeType===1?[e,...t]:t}var dt=/password|passcode|passwd|\bpin\b|otp|one[\s-]?time|verification|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|secret|token|recovery/i,ft=/password|one-time-code|^cc-/i;function mt(e){return dt.test(e)}function S(e){if(y(e))return!0;if(Me(e))return!0;for(let t=x(e);t;t=x(t))if(Me(t))return!0;return!1}function Me(e){let t=e.localName,n=e.getAttribute("contenteditable"),o=n!==null&&n.trim().toLowerCase()!=="false";if(t!=="input"&&t!=="textarea"&&t!=="select"&&!o)return!1;if(e.getAttribute("type")?.toLowerCase()==="password")return!0;if((e.getAttribute("autocomplete")??"").trim().split(/\s+/).filter(Boolean).some((i)=>ft.test(i)))return!0;return pt(e).some((i)=>i.length>0&&mt(i.replace(/[-_]/g," ")))}function pt(e){let t=(a)=>(a??"").slice(0,512),n=[k(e),t(e.getAttribute("aria-label")),t(e.getAttribute("placeholder")),t(e.getAttribute("title")),t(e.getAttribute("name")),t(e.getAttribute("id"))],o=e.getRootNode(),r=(a)=>typeof o.getElementById==="function"?o.getElementById(a):null;for(let a of(e.getAttribute("aria-labelledby")??"").split(/\s+/).filter(Boolean)){let l=r(a);if(l)n.push(t(l.getAttribute("aria-label")),t(l.textContent))}let i=e.getAttribute("id"),s=Array.from(o.querySelectorAll("label")).filter((a)=>i!==null&&a.getAttribute("for")===i||!a.hasAttribute("for")&&a.contains(e));for(let a of s)n.push(t(a.getAttribute("aria-label")),t(a.textContent));return n}var bt=0.8,ht=0.05,Et=4,Re=1000,z=2,gt=new Set(["button","checkbox","combobox","link","listbox","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]),Tt=/^[A-Za-z_][\w:.-]{0,127}$/;function xt(e){return e.nodeType===9?e:e.ownerDocument}function At(e,t){return{kind:"list",elements:C(t.root).filter((o)=>ee(o,e.role,e.name,t.probe)),...e.nth!==void 0?{nth:e.nth}:{}}}function yt(e,t){try{return{kind:"list",elements:Array.from(t.root.querySelectorAll(e))}}catch{return{kind:"invalid"}}}function St(e,t){let n=e.attribute??"data-testid";if(!Tt.test(n))return{kind:"invalid"};return{kind:"list",elements:C(t.root).filter((r)=>r.getAttribute(n)===e.value)}}function Mt(e,t){if(e.nodeType===9)return t.ownerDocument===e&&t.getRootNode()===e;return e===t||e.contains(t)}function Rt(e,t){let n=xt(t.root);if(typeof n.evaluate!=="function")return{kind:"unsupported"};let o;try{o=n.evaluate(e.xpath,t.root,null,7,null)}catch{return{kind:"invalid"}}let r=[],i=Math.min(o.snapshotLength,Re);for(let s=0;s<i;s+=1){let a=o.snapshotItem(s);if(a&&a.nodeType===1&&Mt(t.root,a))r.push(a)}return{kind:"list",elements:r,...o.snapshotLength>Re?{overflow:!0}:{}}}function kt(e,t,n){let o=Math.min(g(e).length,Y),r=Math.max(o,t);return r>0&&Math.abs(o-t)<=(1-n)*r}function Nt(e,t){let n=Math.min(1,Math.max(0.5,e.threshold??bt)),o=e.role?.trim().toLowerCase(),r=Math.min(g(e.name).length,Y),i=[];for(let s of C(t.root)){let a=R(s);if(o?a!==o:a==="")continue;let l=k(s,t.probe);if(!kt(l,r,n))continue;let u=Ee(l,e.name);if(u>=n)i.push({element:s,score:u})}return{kind:"ranked",scored:i,margin:ht}}function we(e,t){let n=C(e.root).filter((i)=>t(F(i,e.probe))),o=e.keep??(()=>!0),r=n.filter(o);return n.filter((i)=>!r.some((s)=>s!==i&&i.contains(s)))}function wt(e,t){let n=e.exact?(o)=>P(o,e.text):(o)=>he(o,e.text);if(g(e.text).length===0)return{kind:"list",elements:[]};return{kind:"list",elements:we(t,n),...e.nth!==void 0?{nth:e.nth}:{}}}function te(e){return g(e).replace(/[\s:*]+$/u,"")}function Ct(e,t){return(e.kind==="role"?C(t.root).filter((o)=>ee(o,e.role,e.name,t.probe)):we(t,(o)=>te(o)===te(e.text)&&te(o)!=="")).filter((o)=>N(o,t.probe))}function Ce(e,t,n){let o=e.role?.trim().toLowerCase();return C(t.root).filter((r)=>{let i=R(r);if(o?i!==o:!gt.has(i))return!1;return!n.some((s)=>s===r||r.contains(s))})}var vt=new Set(["h1","h2","h3","h4","h5","h6","legend","caption","figcaption","summary","dt"]);function Dt(e){return vt.has(e.localName)||R(e)==="heading"}function _t(e){for(let t=e;t;t=t.parentElement)if(Dt(t))return t;return null}function Ot(e,t,n){let o=Ce(e,t,n),r=new Set;for(let i of n){let a=_t(i)?.parentElement??i;for(let l of o)if(a.contains(l))r.add(l)}return{kind:"list",elements:o.filter((i)=>r.has(i))}}function ke(e,t,n,o){return e<o&&n<t}function It(e,t,n){let o=t.x+t.width,r=t.y+t.height,i=n.x+n.width,s=n.y+n.height,a=ke(t.y,r,n.y,s),l=ke(t.x,o,n.x,i);switch(e){case"rightOf":return a&&n.x>=o-z?Math.max(0,n.x-o):null;case"leftOf":return a&&i<=t.x+z?Math.max(0,t.x-i):null;case"below":return l&&n.y>=r-z?Math.max(0,n.y-r):null;case"above":return l&&s<=t.y+z?Math.max(0,t.y-s):null;case"sameRow":return a?Math.abs(n.x+n.width/2-(t.x+t.width/2)):null;default:return null}}function Ne(e){return e.width>0&&e.height>0}function Lt(e,t){let n=Ct(e.anchor,t);if(n.length===0)return{kind:"list",elements:[]};if(e.relation==="inside")return Ot(e,t,n);let o=n.map((i)=>D(i,t.probe)).filter(Ne);if(o.length===0)return{kind:"unsupported"};let r=[];for(let i of Ce(e,t,n)){let s=D(i,t.probe);if(!Ne(s))continue;let a=null;for(let l of o){let u=It(e.relation,l,s);if(u!==null&&(a===null||u<a))a=u}if(a!==null)r.push({element:i,score:-a})}return{kind:"ranked",scored:r,margin:Et}}function ve(e,t){switch(e.kind){case"role":return At(e,t);case"css":return yt(e.selector,t);case"testId":return St(e,t);case"xpath":return Rt(e,t);case"fuzzy":return Nt(e,t);case"anchor":return Lt(e,t);case"text":return wt(e,t);default:return{kind:"unsupported"}}}var De=5,_e=200;var Wt={x:0,y:0,width:0,height:0};function Ut(e,t,n){let o={root:e,offset:Wt,hidden:!1,disabled:!1};for(let[r,i]of(t??[]).entries()){let s;try{s=Array.from(o.root.querySelectorAll(i))}catch{return{index:r,reason:"invalid"}}if(s.length===0)return{index:r,reason:"notFound"};if(s.length>1)return{index:r,reason:"ambiguous"};let a=s[0],l=a.localName;if(l==="iframe"||l==="frame"){let u=a,f=null;try{f=u.contentDocument}catch{f=null}if(!f)return{index:r,reason:"inaccessible"};let d=D(a,n,o.offset);o={root:f,offset:{x:d.x+u.clientLeft,y:d.y+u.clientTop,width:0,height:0},hidden:o.hidden||!N(a,n),disabled:o.disabled||!w(a)}}else if(a.shadowRoot)o={root:a.shadowRoot,offset:o.offset,hidden:o.hidden,disabled:o.disabled};else return{index:r,reason:"notAFrame"}}return o}function Pt(e,t,n,o){if(t==="attached")return!0;if(n.hidden||!N(e,o))return!1;return t==="visible"||!n.disabled&&w(e)}function Oe(e,t,n,o,r){return{role:R(e),name:S(e)?"":v(xe(e)?ye(e,r):k(e,r),_e),bounds:D(e,r,o),method:t.kind,methodIndex:n}}function Ht(e,t,n,o=!1){if(t.length===0)return e.length>0?{outcome:"notInteractable",elements:e,matches:0}:{outcome:"none",elements:[],matches:0};if(o)return{outcome:"ambiguous",elements:t,matches:t.length};if(n!==void 0){let r=t[n];return r?{outcome:"found",element:r,matches:t.length}:{outcome:"none",elements:[],matches:t.length}}return t.length===1?{outcome:"found",element:t[0],matches:1}:{outcome:"ambiguous",elements:t,matches:t.length}}function Vt(e,t,n){if(t.length===0)return e.length>0?{outcome:"notInteractable",elements:e.map((a)=>a.element),matches:0}:{outcome:"none",elements:[],matches:0};let o=[...t].sort((a,l)=>l.score-a.score),r=o[0],i=o[1];if(!i||r.score-i.score>=n)return{outcome:"found",element:r.element,matches:t.length};let s=o.filter((a)=>r.score-a.score<n).map((a)=>a.element);return{outcome:"ambiguous",elements:s,matches:s.length}}function Ft(e,t){switch(e.kind){case"invalid":case"unsupported":return e.kind;case"list":return Ht(e.elements,e.elements.filter(t),e.nth,e.overflow);case"ranked":return Vt(e.scored,e.scored.filter((n)=>t(n.element)),e.margin)}}function X(e,t,n=[],o=0,r){return{status:"failed",code:e,candidates:n,candidateCount:o,attempts:t,...r?{frame:r}:{}}}function Ie(e,t,n={}){let o=n.state??"interactable",r=Ut(e,t.frame,n);if(!("root"in r)){let d=t.methods.map((c,p)=>({index:p,method:c.kind,outcome:"notTried",matches:0}));return X("ELEMENT_NOT_FOUND",d,[],0,r)}let i=[],s=t.methods.findIndex((d)=>d.enabled!==!1),a,l,u;for(let[d,c]of t.methods.entries()){if(u){i.push({index:d,method:c.kind,outcome:"notTried",matches:0});continue}if(c.enabled===!1){i.push({index:d,method:c.kind,outcome:"disabled",matches:0});continue}let p=(b)=>Pt(b,o,r,n),m=Ft(ve(c,{root:r.root,probe:n,keep:p}),p);if(m==="invalid"||m==="unsupported"){i.push({index:d,method:c.kind,outcome:m,matches:0});continue}if(i.push({index:d,method:c.kind,outcome:m.outcome,matches:m.matches}),m.outcome==="found")u={element:m.element,method:c,index:d};else if(m.outcome==="ambiguous"&&!a)a={elements:m.elements,method:c,index:d,count:m.matches};else if(m.outcome==="notInteractable"&&!l)l={elements:m.elements,method:c,index:d}}if(u)return{status:"found",element:u.element,method:u.method.kind,methodIndex:u.index,fallback:u.index!==s,candidate:Oe(u.element,u.method,u.index,r.offset,n),attempts:i};let f=(d)=>d.elements.slice(0,De).map((c)=>Oe(c,d.method,d.index,r.offset,n));if(a)return X("ELEMENT_AMBIGUOUS",i,f(a),a.count);if(l)return X("ELEMENT_NOT_INTERACTABLE",i,f(l),l.elements.length);return X("ELEMENT_NOT_FOUND",i)}var ne="[REDACTED]",Bt=[/\b(?:Bearer|Basic)\s+[^\s"'`,;)\]}]+/gi,/\b(?:sk|pk|rk|xai)-[^\s"'`,;)\]}]+/gi,/\b(?:gsk|hf|ghp|gho|ghs|ghu|glpat)_[^\s"'`,;)\]}]+/gi,/\bAIza[\w-]{10,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{12,}/g],zt=/([\s"'`,;:=()[\]{}]+)/,Xt=/^(?:api[_-]?key|access[_-]?key|secret|secret[_-]?key|client[_-]?secret|token|password)$/i;function Kt(e){let t=e.indexOf("…");return e.includes("***")||t!==-1&&t<e.length-1}function jt(e){let t=e.split(zt);for(let n=0;n<t.length;n+=2){let o=t[n]??"";if(o&&o!=="[REDACTED]"&&Kt(o))t[n]="[REDACTED]";let r=t[n+1]??"";if(t[n+2]&&Xt.test(o)&&/[:=]/.test(r))t[n+2]="[REDACTED]"}return t.join("")}function oe(e){if(!e)return e;let t=e;for(let n of Bt)t=t.replace(n,"[REDACTED]");return t=jt(t),t.replace(/(?:\[REDACTED\]){2,}/g,"[REDACTED]")}var Le="";function K(e){if(!e)return!1;let t=e.replaceAll("[REDACTED]",Le);return oe(t).replaceAll(Le,"[REDACTED]")!==e}function re(e){try{return decodeURIComponent(e.replaceAll("+"," "))}catch{return e}}function We(e){return K(re(e).replace(/[/?&#]/g," "))}var $t=500,Ue=/reset|recover|verify|verification|magic|confirm|activate|invite|unsubscribe/i;function Gt(e){let t=e;for(let n=0;n<3;n+=1){let o=re(t);if(o===t)break;t=o}return t}function qt(e){let t=e.split(/[/?#;]/),n=t.findIndex((r)=>Ue.test(r));return t.slice(0,n+1).map((r)=>K(r)?ne:r).join("/")}function ie(e){let t=e.trim();if(t==="")return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith("//"),o="",r;if(n){let f;try{f=new URL(t.startsWith("//")?`https:${t}`:t)}catch{return null}if(f.protocol!=="http:"&&f.protocol!=="https:")return null;o=t.startsWith("//")?`//${f.host}`:f.origin,r=f.pathname}else r=t.split(/[?#]/)[0]??"";let i=r.split("/"),s=i.map(Gt),a=s.findIndex((f)=>Ue.test(f)),u=(a>=0?i.slice(0,a+1):i).map((f,d)=>{let c=s[d]??f;if(d===a)return qt(c);return K(c)||We(f)?ne:f}).join("/");return v(`${o}${u}`,$t)}var Zt=1,Yt=5000,Jt=64,Qt=500,en=new Set(["script","style","noscript","template","link","meta","base","head","object","embed"]),tn=new Set(["textarea"]),nn=new Set(["id","class","role","name","type","for","title","alt","placeholder","label","autocomplete","tabindex","disabled","readonly","hidden","inert","contenteditable","list","multiple","size","scope","slot","part","lang","dir","data-testid","data-test","data-test-id","data-qa","data-cy","data-automation-id",...U]),on=new Set(["aria-valuenow","aria-valuetext","aria-checked","aria-selected","aria-pressed"]),rn=new Set(["button","submit","reset"]),sn=/^[a-z][a-z0-9-]{0,63}$/;var an=/^[a-z][a-z0-9_:.-]{0,127}$/;function He(e){let t=e.getAttribute("contenteditable");return t!==null&&t.trim().toLowerCase()!=="false"}function Ve(e){for(let t=x(e);t;t=x(t))if(t.localName==="textarea"||He(t))return!0;return!1}function ln(e){if(!e.parentElement?.shadowRoot)return!1;let t=_(e);return t!==null&&(S(t)||Ve(t))}function j(e){return v(oe(e),Qt)}var un=new Set(["alt","label","title","placeholder","value","aria-label","aria-description","aria-roledescription","aria-placeholder"]),cn=new Set(["aria-hidden","aria-disabled","aria-expanded","aria-haspopup","aria-controls","aria-owns","aria-labelledby","aria-describedby","aria-level","aria-current","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-readonly","aria-required","aria-invalid","aria-busy","aria-live","aria-atomic","aria-posinset","aria-setsize","aria-colcount","aria-colindex","aria-colspan","aria-rowcount","aria-rowindex","aria-rowspan","aria-sort"]);function dn(e,t){let n={},o=e.localName;for(let r of Array.from(e.attributes)){let i=r.name.toLowerCase();if(i.startsWith("on")||!an.test(i))continue;if(t&&(un.has(i)||i==="href"||i.startsWith("aria-")&&!cn.has(i)))continue;if(nn.has(i)||i.startsWith("aria-")&&!on.has(i))n[i]=j(r.value);else if(i==="href"&&(o==="a"||o==="area")){let s=ie(r.value);if(s!==null)n[i]=s}else if(i==="value"&&o==="input"&&rn.has((e.getAttribute("type")??"").toLowerCase()))n[i]=j(r.value)}return Object.keys(n).length>0?n:void 0}function fn(e,t){let n=t?.rectOf?.(e)??e.getBoundingClientRect(),o=[Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height)];return o[2]>0||o[3]>0?o:void 0}function Pe(e,t,n,o,r){let i=[];for(let s of Array.from(e.childNodes)){if(t.count>=t.max){t.truncated=!0;break}if(s.nodeType===3){if(!o||ln(s))continue;let a=s.textContent??"";if(a.length===0)continue;let l=a.trim()===""?" ":j(a);t.count+=1,i.push(l)}else if(s.nodeType===1){let a=G(s,t,n+1,o,r);if(a)i.push(a)}}return i}function G(e,t,n,o,r){let i=e.localName.toLowerCase();if(en.has(i)||!sn.test(i))return null;if(n>Jt)return t.truncated=!0,null;t.count+=1;let s={t:i},a=Ve(e),l=r||a||y(e),u=dn(e,l);if(u)s.a=u;if(N(e,t.probe)){let b=fn(e,t.probe);if(b)s.r=b}else s.h=1;let f=S(e),d=o&&!a&&!f&&!tn.has(i)&&!He(e),c=l||!d;if(i==="svg"){let b=Array.from(e.children).find((T)=>T.localName==="title"),h=b?G(b,t,n+1,d,c):null;if(h)s.c=[h];return s}if(i==="iframe"||i==="frame"){let b=null;try{b=e.contentDocument}catch{b=null}let h=b?.documentElement;if(h){let T=G(h,t,n+1,d,c);if(T)s.f=T}return s}let p=Pe(e,t,n,d,c);if(p.length>0)s.c=p;let m=e.shadowRoot;if(m){let b=Pe(m,t,n,d,c);if(b.length>0)s.s=b}return s}function mn(e){let t=e.querySelector("title");if(t&&y(t))return"";return j(e.title??"")}function Fe(e,t={}){let n={count:0,max:Math.max(1,t.maxNodes??Yt),truncated:!1,probe:t},o=G(e.documentElement,n,0,!0,!1)??{t:"html"},r=e.defaultView;return{snapshotVersion:Zt,url:ie(e.URL)??"",title:mn(e),viewport:{width:Math.round(r?.innerWidth??0),height:Math.round(r?.innerHeight??0)},root:o,nodeCount:n.count,truncated:n.truncated}}var se=65536,pn=65536,ze=new Set(["getText","getValue","getAttribute","exists"]),Xe=new Set(["click","doubleClick","hover","check"]);function bn(e){return e.ownerDocument.defaultView}var hn={left:0,middle:1,right:2},En={left:1,middle:4,right:2};function ae(e,t,n){let o=e.getBoundingClientRect();return{bubbles:!0,cancelable:!0,composed:!0,view:t,button:hn[n],buttons:0,clientX:o.x+o.width/2,clientY:o.y+o.height/2,pointerId:1,pointerType:"mouse",isPrimary:!0}}function Ke(e,t,n){let o=typeof t.PointerEvent==="function"?t.PointerEvent:t.MouseEvent,r=[];for(let s=e;s;s=B(s))r.unshift(s);let i={...n,bubbles:!1};e.dispatchEvent(new o("pointerover",n));for(let s of r)s.dispatchEvent(new o("pointerenter",i));e.dispatchEvent(new t.MouseEvent("mouseover",n));for(let s of r)s.dispatchEvent(new t.MouseEvent("mouseenter",i))}var gn='a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]:not([contenteditable="false"])';function Tn(e,t){for(let o=e;o;o=B(o))if(o.matches(gn)&&w(o)&&o instanceof t.HTMLElement){o.focus();return}let n=e.ownerDocument.activeElement;if(n instanceof t.HTMLElement&&n!==e.ownerDocument.body)n.blur()}function xn(e,t,n,o,r){let i=typeof t.PointerEvent==="function"?t.PointerEvent:t.MouseEvent,s={...n,buttons:En[o],detail:r},a={...n,detail:r};Ke(e,t,n);let l=e.dispatchEvent(new i("pointerdown",s));if(l&&e.dispatchEvent(new t.MouseEvent("mousedown",s)))Tn(e,t);if(e.dispatchEvent(new i("pointerup",a)),l)e.dispatchEvent(new t.MouseEvent("mouseup",a))}function L(e,t,n,o=1){let r=ae(e,t,n);xn(e,t,r,n,o);let i=n==="left"?"click":n==="right"?"contextmenu":"auxclick";e.dispatchEvent(new t.MouseEvent(i,{...r,detail:o}))}function je(e,t){if(e instanceof t.HTMLTextAreaElement)return!0;if(!(e instanceof t.HTMLInputElement))return!1;return!["button","submit","reset","image","checkbox","radio","file","range","color","hidden"].includes(e.type)}function An(e,t,n){let o=e instanceof t.HTMLTextAreaElement?t.HTMLTextAreaElement.prototype:t.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"value")?.set;if(r)r.call(e,n);else e.value=n;e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new t.Event("change",{bubbles:!0}))}function yn(e,t){if(!(e instanceof t.HTMLElement))return!1;if(e.isContentEditable)return!0;let n=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return n===""||n==="true"||n==="plaintext-only"}function Be(e,t,n,o){if(n.length>pn)return{ok:!1,problem:"INVALID_ACTION"};if(je(e,t)){if(e.readOnly)return{ok:!1,problem:"NOT_EDITABLE"};return e.focus(),An(e,t,o?`${e.value}${n}`:n),{ok:!0}}if(yn(e,t))return e.focus(),e.textContent=o?`${e.textContent??""}${n}`:n,e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),{ok:!0};return{ok:!1,problem:"NOT_EDITABLE"}}function Sn(e){let t=e.getAttribute("label");return t!==null&&t.trim()!==""?t:e.textContent??""}function Mn(e,t,n){if(!(e instanceof t.HTMLSelectElement))return{ok:!1,problem:"NOT_SELECTABLE"};let o=Array.from(e.options),r=n.value!==void 0?o.find((i)=>i.value===n.value):n.label!==void 0?o.find((i)=>P(Sn(i),n.label)):n.index!==void 0?o[n.index]:void 0;if(!r||r.disabled||r.closest("optgroup")?.hasAttribute("disabled"))return{ok:!1,problem:"OPTION_NOT_FOUND"};return e.focus(),r.selected=!0,e.dispatchEvent(new t.Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new t.Event("change",{bubbles:!0})),{ok:!0}}function Rn(e,t,n){if(e instanceof t.HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")){if(e.checked!==n){if(e.type==="radio"&&!n)return{ok:!1,problem:"NOT_CHECKABLE"};L(e,t,"left")}return e.checked===n?{ok:!0}:{ok:!1,problem:"STATE_NOT_CHANGED"}}let o=e.getAttribute("role");if(o==="checkbox"||o==="switch"||o==="radio"||o==="menuitemcheckbox"){let r=()=>e.getAttribute("aria-checked")==="true";if(r()!==n)L(e,t,"left");return r()===n?{ok:!0}:{ok:!1,problem:"STATE_NOT_CHANGED"}}return{ok:!1,problem:"NOT_CHECKABLE"}}var kn=/^(?:[\s\S]|[A-Z][A-Za-z0-9]{1,23})$/u;function Nn(e,t){if(e instanceof t.HTMLButtonElement)return!0;if(e instanceof t.HTMLInputElement)return["submit","button","reset","image"].includes(e.type);let n=e.localName;return n==="a"&&e.hasAttribute("href")||n==="summary"}function wn(e,t){if(e instanceof t.HTMLButtonElement)return!0;if(e instanceof t.HTMLInputElement)return["submit","button","reset","image","checkbox","radio"].includes(e.type);return e.localName==="summary"}function le(e,t){e.dispatchEvent(new t.MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0,view:t,detail:0}))}function Cn(e,t,n){if(!kn.test(n))return{ok:!1,problem:"INVALID_ACTION"};let o=n==="Space"?" ":n;if(e instanceof t.HTMLElement)e.focus();let r={key:o,bubbles:!0,cancelable:!0,composed:!0},i=e.dispatchEvent(new t.KeyboardEvent("keydown",r));if(o==="Enter"&&i){if(Nn(e,t))le(e,t);else if(e instanceof t.HTMLInputElement&&je(e,t)&&e.form)_n(e.form,t)}let s=e.dispatchEvent(new t.KeyboardEvent("keyup",r));if(o===" "&&i&&s&&wn(e,t))le(e,t);return{ok:!0}}var vn=new Set(["submit","image"]),Dn=new Set(["text","search","url","tel","email","password","date","month","week","time","datetime-local","number"]);function _n(e,t){let n=Array.from(e.elements),o=e.getRootNode(),r=Array.from(o.querySelectorAll("button, input")).find((s)=>(s instanceof t.HTMLButtonElement&&s.type==="submit"||s instanceof t.HTMLInputElement&&vn.has(s.type))&&s.form===e);if(r){if(w(r))le(r,t);return}if(n.filter((s)=>s instanceof t.HTMLInputElement&&Dn.has(s.type)).length===1)e.requestSubmit()}function On(e,t){if(e instanceof t.HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"))return e.checked;if(e instanceof t.HTMLInputElement||e instanceof t.HTMLTextAreaElement||e instanceof t.HTMLSelectElement)return e.value.slice(0,se);let n=e.getAttribute("aria-checked");if(n==="true"||n==="false")return n==="true";return e.getAttribute("aria-valuenow")??e.getAttribute("aria-valuetext")}var In=/^[A-Za-z_][\w:.-]{0,127}$/;function $e(e,t){let n=bn(e);if(!n)return{ok:!1,problem:"INVALID_ACTION"};switch(t.kind){case"click":return L(e,n,t.button??"left"),{ok:!0};case"doubleClick":return L(e,n,"left",1),L(e,n,"left",2),e.dispatchEvent(new n.MouseEvent("dblclick",{...ae(e,n,"left"),detail:2})),{ok:!0};case"hover":{let o=ae(e,n,"left"),r=typeof n.PointerEvent==="function"?n.PointerEvent:n.MouseEvent;return Ke(e,n,o),e.dispatchEvent(new r("pointermove",o)),e.dispatchEvent(new n.MouseEvent("mousemove",o)),{ok:!0}}case"focus":if(e instanceof n.HTMLElement)e.focus();return{ok:!0};case"type":return typeof t.text==="string"?Be(e,n,t.text,t.append===!0):{ok:!1,problem:"INVALID_ACTION"};case"clear":return Be(e,n,"",!1);case"select":return Mn(e,n,t);case"check":return Rn(e,n,t.checked===!0);case"pressKey":return typeof t.key==="string"?Cn(e,n,t.key):{ok:!1,problem:"INVALID_ACTION"};case"scroll":return e.scrollBy?.({left:Number(t.dx??0)||0,top:Number(t.dy??0)||0}),{ok:!0};case"scrollIntoView":return e.scrollIntoView?.({block:"center",inline:"nearest"}),{ok:!0};case"getText":if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:F(e).slice(0,se)};case"getValue":if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:On(e,n)};case"getAttribute":{if(typeof t.name!=="string"||!In.test(t.name))return{ok:!1,problem:"INVALID_ACTION"};let o=t.name.toLowerCase();if(S(e))return{ok:!1,problem:"SENSITIVE_ELEMENT"};return{ok:!0,value:e.getAttribute(o)?.slice(0,se)??null}}case"exists":return{ok:!0,value:!0};default:return{ok:!1,problem:"INVALID_ACTION"}}}var qe=1,Ge="__burdenoffUiRuntime",Ln=60000,Wn="fg-ui-highlight",Un=new Set(["role","css","testId","xpath","fuzzy","anchor","text"]);function ue(e){if(!e||typeof e!=="object")return!1;let t=e;if(!Array.isArray(t.methods)||t.methods.length===0||t.methods.length>8)return!1;if(t.frame!==void 0&&!(Array.isArray(t.frame)&&t.frame.every((n)=>typeof n==="string")))return!1;return t.methods.every((n)=>!!n&&typeof n==="object"&&Un.has(String(n.kind)))}function ce(){return{status:"failed",code:"ELEMENT_NOT_FOUND",candidates:[],candidateCount:0,attempts:[]}}function de(e){return{status:e.status,method:e.method,methodIndex:e.methodIndex,fallback:e.fallback,candidate:e.candidate,attempts:e.attempts}}function Pn(e){try{return e.defaultView?.frameElement??null}catch{return null}}function Hn(e,t,n,o){let r=e.getRootNode();if(typeof r.elementFromPoint!=="function")return null;let i=r.elementFromPoint(t,n);if(!i)return"offscreen";if(i===e||e.contains(i))return null;return o.some((s)=>s.contains(i))?null:"covered"}function Vn(e,t){let n=t.x+t.width/2,o=t.y+t.height/2,r=Array.from(e.labels??[]),i=e;for(let s=0;s<32;s+=1){let a=Hn(i,n,o,s===0?r:[]);if(a)return a;let l=i.getRootNode();if(l&&"host"in l){i=l.host;continue}let u=Pn(i.ownerDocument);if(!u)return null;let f=u.getBoundingClientRect();n+=f.x+u.clientLeft,o+=f.y+u.clientTop,i=u}return null}function Fn(e,t){let n=e.ownerDocument.defaultView;if(!n)return!1;let o=t.x+t.width/2,r=t.y+t.height/2;return o<0||r<0||o>=n.innerWidth||r>=n.innerHeight}function Bn(e){let t=e.ownerDocument.defaultView;if(t&&t.getComputedStyle(e).pointerEvents==="none")return"noPointerEvents";let n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return null;if(Fn(e,n)&&typeof e.scrollIntoView==="function")e.scrollIntoView({block:"center",inline:"center"}),n=e.getBoundingClientRect();return Vn(e,n)}function zn(e,t={}){let n=t.root??e,o={...t.rectOf?{rectOf:t.rectOf}:{},...t.isVisible?{isVisible:t.isVisible}:{}},r=null,i=null,s=()=>{if(i!==null)clearTimeout(i),i=null;r?.remove(),r=null},a=(c,p)=>(s(),Ie(n,c,{...o,...p?{state:p}:{}})),l=(c,p={})=>{if(!ue(c))return ce();let m=a(c,p.state);return m.status==="found"?de(m):m},u=(c,p,m={})=>{if(!p||typeof p!=="object"||typeof p.kind!=="string")return{ok:!1,code:"INVALID_ACTION"};if(!ue(c))return{ok:!1,code:"ELEMENT_NOT_FOUND",resolution:ce()};let b=m.state??(ze.has(p.kind)?"visible":"interactable"),h=a(c,b);if(h.status!=="found"){if(p.kind==="exists"&&h.code==="ELEMENT_NOT_FOUND")return{ok:!0,value:!1,resolution:h};return{ok:!1,code:h.code,resolution:h}}let T=de(h),W=Xe.has(p.kind)?Bn(h.element):null;if(W)return{ok:!1,code:"ELEMENT_NOT_INTERACTABLE",reason:W,resolution:{status:"failed",code:"ELEMENT_NOT_INTERACTABLE",candidates:[h.candidate],candidateCount:1,attempts:h.attempts}};let M=$e(h.element,p);if(!M.ok)return{ok:!1,code:M.problem,resolution:T};return M.value===void 0?{ok:!0,resolution:T}:{ok:!0,resolution:T,value:M.value}},f=(c,p,m)=>{let b=e.createElement(Wn);b.setAttribute("aria-hidden","true"),b.setAttribute("style","all: initial; position: fixed; inset: 0; pointer-events: none; z-index: 2147483647;");let h=b.attachShadow({mode:"closed"});c.forEach((T,W)=>{let M=e.createElement("div");M.setAttribute("style",`position: fixed; left: ${T.bounds.x-3}px; top: ${T.bounds.y-3}px; width: ${T.bounds.width+6}px; height: ${T.bounds.height+6}px; outline: 3px solid Highlight; border-radius: 4px; box-sizing: border-box;`);let fe=m?`${W+1}${p?` ${p}`:""}`:p;if(fe){let q=e.createElement("span");q.textContent=fe.slice(0,120),q.setAttribute("style","position: absolute; left: 0; top: 100%; margin-top: 4px; padding: 2px 6px; font: 600 11px system-ui, sans-serif; background: Highlight; color: HighlightText; border-radius: 3px; white-space: nowrap;"),M.appendChild(q)}h.appendChild(M)}),e.documentElement.appendChild(b),r=b};return{version:qe,resolve:l,act:u,highlight:(c,p={})=>{if(!ue(c))return ce();let m=a(c,p.state??"visible");if(m.status==="found")f([m.candidate],p.label,!1);else if(m.candidates.length>0)f(m.candidates,p.label,!0);let b=Math.min(Ln,Math.max(0,Number(p.durationMs??0)||0));if(r&&b>0)i=setTimeout(s,b);return m.status==="found"?de(m):m},clearHighlight:s,snapshot:(c={})=>(s(),Fe(e,{...o,...c.maxNodes?{maxNodes:c.maxNodes}:{}}))}}function Ze(e,t){let n=Reflect.get(e,Ge);if(n&&typeof n==="object"&&typeof n.version==="number"&&n.version>=qe)return n;let o=Object.freeze(zn(t));return Object.defineProperty(e,Ge,{value:o,configurable:!0,enumerable:!1,writable:!1}),o}Ze(globalThis,globalThis.document);})();
@@ -6,14 +6,14 @@ import {
6
6
  isRuntimeTarget2,
7
7
  createDomRuntime2,
8
8
  installDomRuntime2
9
- } from "./index-ct2xctrq.js";
9
+ } from "./index-70vm0qz8.js";
10
10
  import {
11
11
  MAX_READ_TEXT2,
12
12
  MAX_TYPED_TEXT2,
13
13
  READ_ACTIONS2,
14
14
  POINTER_ACTIONS2,
15
15
  performDomAction2
16
- } from "./index-77pcz6n3.js";
16
+ } from "./index-vnv9tp11.js";
17
17
  export {
18
18
  DOM_RUNTIME_GLOBAL2 as DOM_RUNTIME_GLOBAL,
19
19
  DOM_RUNTIME_VERSION2 as DOM_RUNTIME_VERSION,
package/dist/drivers.js CHANGED
@@ -1,30 +1,31 @@
1
1
  import"./index-cs6acyjn.js";
2
2
  import {
3
3
  parseUiScript2
4
- } from "./index-c88tvyj1.js";
4
+ } from "./index-qmv3ar39.js";
5
+ import"./index-w9jc25y9.js";
5
6
  import {
6
7
  DOM_DRIVER_CAPABILITIES2,
7
8
  safePageText2,
8
9
  safePageHtml2,
9
10
  createDomDriver2
10
- } from "./index-21hvbvx1.js";
11
+ } from "./index-8w31tpfq.js";
11
12
  import {
12
13
  runUiScript2
13
- } from "./index-r2a9rftv.js";
14
+ } from "./index-eff47v1g.js";
14
15
  import {
15
16
  UiDriverError2,
16
17
  createVirtualClock2
17
- } from "./index-vg8r40y7.js";
18
+ } from "./index-yc0jgph6.js";
18
19
  import {
19
20
  CAPABILITY_IDS2
20
- } from "./index-9s5nphx0.js";
21
+ } from "./index-hw5npwsv.js";
21
22
  import {
22
23
  walkSteps2,
23
24
  stepTargets2
24
25
  } from "./index-g7724awk.js";
25
26
  import {
26
27
  hydrateTreeSnapshot2
27
- } from "./index-5k26keah.js";
28
+ } from "./index-qg9yfr7r.js";
28
29
  // src/drivers/snapshot-driver.ts
29
30
  var SNAPSHOT_DRIVER_CAPABILITIES = CAPABILITY_IDS2.filter((id) => id !== "action:focusWindow");
30
31
  var ignore = () => {
@@ -98,7 +99,8 @@ function createSnapshotDriver(options) {
98
99
  });
99
100
  }
100
101
  }
101
- }
102
+ },
103
+ treeSnapshot: async () => options.snapshot
102
104
  };
103
105
  }
104
106
  async function replayUiScriptOnSnapshot(script, options) {
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `parseHealAnswer` (plan P4-06a, threat R3 of document 24): reading a
3
+ * model's answer to a heal question strictly.
4
+ *
5
+ * The only answers are `{"nodePath": "<path>", "confidence": <0..1>}` and
6
+ * `{"notPresent": true}`, as one JSON object (a single surrounding code fence
7
+ * is tolerated, nothing else). The path must be a path of the snapshot that
8
+ * names a visible element, and, when the question's listed paths are given,
9
+ * one of them. Anything else (prose, unknown keys, an unknown or hidden path,
10
+ * a path that cannot become a target) is `not_present`: an answer can never
11
+ * carry an action, a value or an address, and R2's checks still run on a
12
+ * candidate it names.
13
+ */
14
+ import type { UiTreeSnapshot } from '../target/snapshot.js';
15
+ import { type SnapshotIndex } from '../target/snapshot-tree.js';
16
+ import type { UiHealAnswer } from './types.js';
17
+ /** Longest answer text read. */
18
+ export declare const MAX_HEAL_ANSWER_LENGTH = 4096;
19
+ export interface ParseHealAnswerOptions {
20
+ /** The paths the question listed (`buildHealQuestion(...).nodes`); an answer naming another path is refused. */
21
+ listedPaths?: readonly string[];
22
+ /** A prepared index of the snapshot. */
23
+ index?: SnapshotIndex;
24
+ }
25
+ /** Parse a model's answer to a heal question against the (masked) snapshot the question was built from. */
26
+ export declare function parseHealAnswer(text: unknown, snapshot: Pick<UiTreeSnapshot, 'root'>, options?: ParseHealAnswerOptions): UiHealAnswer;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The consequence classifier (plan P4-06a, threat R2 of document 24): what
3
+ * acting on a healed element could cause. A consequential candidate is never
4
+ * used without a person's approval, whatever the mode (`decideHeal`).
5
+ *
6
+ * The built-in lists are English keyword phrases, matched as whole words over
7
+ * the element's accessible name, its role, the words of its link and its form
8
+ * (name, id, label, action) and any hint words the caller adds. A submit
9
+ * button takes the class of its form, so "OK" in a payment form is a payment.
10
+ * The workspace adds its own phrases (`alwaysAskPatterns`, decision D-P4-12):
11
+ * case-folded keyword phrases, never regular expressions, at most 50 of at most
12
+ * 100 characters (threat C4); further or longer phrases are ignored.
13
+ *
14
+ * Accepted residual risk (document 24 section 8): a control labelled in
15
+ * another language may not be classified; Suggest stays the default mode and
16
+ * workspaces add their own phrases.
17
+ */
18
+ import type { UiStepAction, UiTarget } from '../script/types.js';
19
+ import type { UiConsequence } from './types.js';
20
+ /** Most workspace keyword phrases used. */
21
+ export declare const MAX_HEAL_KEYWORDS = 50;
22
+ /** Longest workspace keyword phrase used. */
23
+ export declare const MAX_HEAL_KEYWORD_LENGTH = 100;
24
+ /** The built-in keyword phrases, by consequence. Checked in this order. */
25
+ export declare const CONSEQUENCE_KEYWORDS: Readonly<Record<UiConsequence, readonly string[]>>;
26
+ /** What the classifier reads about an element. Every field is optional text; nothing is read from the page here. */
27
+ export interface UiHealElementInfo {
28
+ role?: string;
29
+ name?: string;
30
+ /** The element's tag (`button`, `input`), to tell submit buttons. */
31
+ tag?: string;
32
+ /** The `type` attribute (`submit`, `button`). */
33
+ type?: string;
34
+ /** The link's address (path only). */
35
+ href?: string;
36
+ /** Words of the element's form: its name, id, label and action. */
37
+ formWords?: string;
38
+ /** Other words the caller knows (selectors, test ids). */
39
+ hints?: readonly string[];
40
+ }
41
+ /** The classifier's answer. */
42
+ export interface UiConsequenceVerdict {
43
+ /** The built-in class, or null. */
44
+ consequence: UiConsequence | null;
45
+ /** The workspace phrase that matched, when one did: the step must always ask. */
46
+ keyword: string | null;
47
+ }
48
+ /** Text as a list of lower-case words: camel case, punctuation, `-` and `_` split words. */
49
+ export declare function keywordWords(text: string): string[];
50
+ /**
51
+ * The workspace phrases the classifier uses: trimmed, non-empty, at most
52
+ * `MAX_HEAL_KEYWORD_LENGTH` characters, the first `MAX_HEAL_KEYWORDS` of them.
53
+ */
54
+ export declare function usableKeywords(keywords: readonly unknown[] | undefined): string[];
55
+ /** True for a step that can set something off: a click, a check, a choice, a key, or typing that presses Enter. */
56
+ export declare function isActingStep(step: {
57
+ action: UiStepAction;
58
+ pressEnter?: boolean;
59
+ }): boolean;
60
+ /**
61
+ * Classify an element for a step. Only steps that can set something off are
62
+ * classified: clicks, checks, choices, keys, and a `type` step that presses
63
+ * Enter. Reads, waits, hovers and plain typing are never consequential.
64
+ */
65
+ export declare function classifyConsequence(element: UiHealElementInfo, step: {
66
+ action: UiStepAction;
67
+ pressEnter?: boolean;
68
+ }, extraKeywords?: readonly unknown[]): UiConsequenceVerdict;
69
+ /**
70
+ * What a stored target says about its element, for classifying a step before
71
+ * it runs (the analyzer): the role of its first role method, its names and
72
+ * texts, and its selectors and test ids as hints.
73
+ */
74
+ export declare function elementInfoFromTarget(target: UiTarget, elementName?: string): UiHealElementInfo;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@burdenoff/ui-engine/heal`: UI step healing (plan P4-06a, spec 10 section
3
+ * 3): the heal request and answer types, the question builder and the strict
4
+ * answer parser, the deterministic candidate check, the consequence
5
+ * classifier, targets from snapshot nodes, snapshot masking, and pop-up
6
+ * handlers. Everything here is pure except `verifyHealCandidate`, which asks
7
+ * the desk driver; none of it needs a DOM, so the workflow service uses it too.
8
+ */
9
+ export { UI_CONSEQUENCES, UI_HEAL_CHECK_REASONS, UI_HEAL_FAILURE_CODES, UI_HEAL_MODES, UI_HEAL_MODE_RANK, type UiConsequence, type UiHealAnswer, type UiHealCandidate, type UiHealCheckReason, type UiHealDecision, type UiHealElementRef, type UiHealFailureCode, type UiHealHook, type UiHealHookResult, type UiHealMode, type UiHealOutcome, type UiHealReport, type UiHealRequest, type UiHealSettings, } from './types.js';
10
+ export { capHealMode, decideHeal, parseHealMode } from './modes.js';
11
+ export { CONSEQUENCE_KEYWORDS, MAX_HEAL_KEYWORDS, MAX_HEAL_KEYWORD_LENGTH, type UiConsequenceVerdict, type UiHealElementInfo, classifyConsequence, elementInfoFromTarget, keywordWords, usableKeywords, } from './consequence.js';
12
+ export { HEALABLE_ACTIONS, VALUE_ACTIONS, compatibleRoles } from './verify-rules.js';
13
+ export { HEAL_SYSTEM_PROMPT, MAX_HEAL_NODE_NAME, MAX_HEAL_QUESTION_NODES, type UiHealQuestion, type UiHealQuestionInput, type UiHealQuestionNode, buildHealQuestion, } from './question.js';
14
+ export { MAX_HEAL_ANSWER_LENGTH, type ParseHealAnswerOptions, parseHealAnswer } from './answer.js';
15
+ export { HEAL_POSITION_TOLERANCE_PX, type UiHealCheck, type VerifyHealContext, verifyHealCandidate } from './verify.js';
16
+ export { targetFromSnapshotNode } from './target-from-node.js';
17
+ export { MAX_POPUP_HANDLERS_PER_APPLICATION, MAX_POPUP_HANDLERS_PER_STEP, MAX_POPUP_HANDLER_STEPS, MAX_POPUP_URL_PATTERN, POPUP_HANDLER_ACTIONS, POPUP_HANDLER_STEP_WAIT_MS, type UiPopupHandler, type UiPopupHandlerMatch, type UiPopupHandlerRejection, analyzeUiPopupHandler, matchesUrlPattern, parseUiPopupHandler, popupHandlerScript, usablePopupHandlers, } from './popup.js';
18
+ export { MASKED_MARKER, MAX_MASKED_PATHS, type MaskSnapshotOptions, type MaskedSnapshot, maskSnapshot, } from '../target/snapshot-mask.js';
19
+ export { MAX_SNAPSHOT_PATH_LENGTH, SNAPSHOT_ROOT_PATH, type SnapshotEdge, type SnapshotEntry, type SnapshotIndex, indexSnapshot, isSnapshotPath, snapshotNodeAt, walkSnapshot, } from '../target/snapshot-tree.js';