ariawalk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/ariawalk.js +70 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,20 @@ npx ariawalk run <testId> --base-url http://localhost:3000
|
|
|
10
10
|
|
|
11
11
|
`ariawalk login` shows a code and opens ariawalk.com/device, where you confirm it while signed in. That works over SSH too: open the link on any device. The CLI then gets an API key named "CLI · <your machine>" for the organization you pick (`--org` when you're in several), which you can revoke under **API and MCP** or with `ariawalk logout`. `ariawalk whoami` shows who you're logged in as. In CI, set `ARIAWALK_API_KEY` instead.
|
|
12
12
|
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx ariawalk tests # your tests with their ids (--json for scripts and agents)
|
|
17
|
+
npx ariawalk run # pick tests from a checklist, then run them one after another
|
|
18
|
+
npx ariawalk run <testId>… --base-url http://localhost:3000
|
|
19
|
+
npx ariawalk report <runId|url> # a run's full report as Markdown
|
|
20
|
+
npx ariawalk skills install # teach coding agents (Claude Code…) to use the CLI
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The checklist is line-based (type `2 4-6` to toggle, `a` for all, Enter to run), so it works with screen readers and over SSH.
|
|
24
|
+
|
|
25
|
+
`ariawalk skills install` writes `.claude/skills/ariawalk/SKILL.md` in the current project (`--global` for every project): how to find tests, run them against the dev server, read the report and fix what it finds. Use it instead of the MCP server if your agent can run shell commands.
|
|
26
|
+
|
|
13
27
|
- `--base-url` moves the test's start URL to another origin. Localhost and private hosts need no domain verification; public hosts must be verified in Ariawalk.
|
|
14
28
|
- Secret test data values are never sent to the CLI. Pass them with `--data password=…` or `ARIAWALK_DATA_PASSWORD`.
|
|
15
29
|
- Runs from your machine land in your own "local" environment, and runs in CI (GitHub Actions, GitLab, Buildkite) land in `ci:<branch>`. They never become the baseline for production runs.
|
package/dist/ariawalk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as e}from"node:module";import{spawn as t}from"node:child_process";import n from"node:path";import{parseArgs as r}from"node:util";import{chmod as i,mkdir as a,readFile as o,writeFile as s}from"node:fs/promises";import{homedir as c,hostname as l}from"node:os";import{createInterface as u}from"node:readline/promises";import{existsSync as d,readFileSync as f}from"node:fs";import{chromium as p}from"playwright";var m=class extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t}},h=4,g=3e5,_=e=>new Promise(t=>setTimeout(t,e)),v=class e{baseUrl;token;constructor(e,t){this.baseUrl=e,this.token=t}as(t){return new e(this.baseUrl,t)}get(e){return this.request(`GET`,e)}post(e,t,n){return this.request(`POST`,e,t,n)}put(e,t,n,r){return this.request(`PUT`,e,{bytes:t,contentType:n},r)}async request(e,t,n,r){let i=e===`PUT`?n:void 0,a;for(let o=0;o<=h;o++){o&&await _(Math.min(1e3*2**(o-1),15e3));let s;try{s=await fetch(`${this.baseUrl}/api/v1${t}`,{method:e,signal:r?AbortSignal.any([r,AbortSignal.timeout(g)]):AbortSignal.timeout(g),headers:{authorization:`Bearer ${this.token}`,...n===void 0?{}:{"content-type":i?.contentType??`application/json`},"user-agent":`ariawalk-cli`},body:i?new Blob([i.bytes]):n===void 0?void 0:JSON.stringify(n)})}catch(n){if(r?.aborted)throw n;if(n instanceof Error&&n.name===`TimeoutError`)throw Error(`${e} ${t} got no answer in ${g/6e4} minutes.`);a=n;continue}if(s.ok)return await s.json();let c=await s.json().catch(()=>null),l=new m(s.status,c?.error?.code??`http_error`,c?.error?.message??`${e} ${t} failed with HTTP ${s.status}`);if(s.status!==429&&s.status<500)throw l;a=l}throw a instanceof Error?a:Error(String(a))}};function y(){let e=process.env.XDG_CONFIG_HOME||n.join(c(),`.config`);return n.join(e,`ariawalk`,`config.json`)}async function b(){try{return JSON.parse(await o(y(),`utf8`))}catch{return{}}}async function ee(e={}){let t=await b();return{apiKey:process.env.ARIAWALK_API_KEY||t.apiKey,apiUrl:(e.apiUrl||process.env.ARIAWALK_API_URL||t.apiUrl||`https://ariawalk.com`).replace(/\/+$/,``)}}async function x(e){let t=y();return await a(n.dirname(t),{recursive:!0}),await s(t,`${JSON.stringify({...await b(),...e},null,2)}\n`,{mode:384}),await i(t,384),t}async function te(){let{apiKey:e,...t}=await b(),r=y();await a(n.dirname(r),{recursive:!0}),await s(r,`${JSON.stringify(t,null,2)}\n`,{mode:384})}var ne=process.stdout.isTTY&&!process.env.NO_COLOR,S=e=>t=>ne?`\x1b[${e}m${t}\x1b[0m`:t,C=S(2),w=S(1),re=S(31),ie=S(32),ae=S(33),T=(e=``)=>process.stdout.write(`${e}\n`),oe=e=>process.stderr.write(`${re(`error`)} ${e}\n`),se={blocker:re,serious:re,moderate:ae,minor:C};function ce(e){let t=``,n=()=>{ne&&t&&process.stdout.write(`\r\x1B[2K`),t=``},r=e=>{n(),T(e)};return{activity(e){ne&&e&&(n(),t=e,process.stdout.write(C(e)))},async stepStarted(t){(t.n===1||e.verbose)&&r(C(`Step ${t.n} · ${t.pageTitle||t.pageUrl}`))},async stepUpdated(t,n){if(n.heard?.length){let i=n.action?w(n.action.replaceAll(`_`,` `)):`listened`;r(`${C(String(t).padStart(3))} ${i}${n.targetName?` on ${n.targetName}`:``}`);for(let t of n.heard.slice(0,e.verbose?100:3))r(` ${C(`${t.keys} →`)} ${t.speech||C(`(nothing said)`)}`);!e.verbose&&n.heard.length>3&&r(C(` … ${n.heard.length-3} more key presses`))}n.decision?.reason&&e.verbose&&r(C(` ${n.decision.reason}`)),n.decision?.goalReached&&n.narration&&r(ie(` ${n.narration}`))},async findings(t){for(let n of t)(n.severity===`blocker`||n.severity===`serious`||e.verbose)&&r(` ${se[n.severity](n.severity)} ${n.title}${n.wcag?C(` (WCAG ${n.wcag})`):``}`)}}}function le(e){return e===`localhost`||e===`127.0.0.1`||e.endsWith(`.localhost`)}function ue(e,t){let n;try{n=new URL(e)}catch{return!1}if(n.protocol!==`https:`&&n.protocol!==`http:`)return!1;let r=n.hostname.toLowerCase();return t.some(e=>r===e||r.endsWith(`.${e}`))}function de(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``).replace(/\.$/,``);if(le(t)||t===`::1`)return!0;let n=/^(\d{1,3})\.(\d{1,3})\.\d{1,3}\.\d{1,3}$/.exec(t);if(n){let[e,t]=[Number(n[1]),Number(n[2])];return e===127||e===10||e===192&&t===168||e===172&&t>=16&&t<=31}return t.includes(`.`)?/\.(local|internal|lan|home\.arpa)$/.test(t):/^[a-z0-9-]+$/.test(t)}function E(e,t){let n;try{n=new URL(e)}catch{return!1}return n.protocol!==`https:`&&n.protocol!==`http:`?!1:de(n.hostname)||ue(e,t)}function D(e){try{let t=new URL(e);return`${t.host}${t.pathname}`}catch{return e}}function O(...e){return e.map(e=>e??``).join(`|`)}function fe(e,t,n,r){let i=D(r),a=[];t&&a.push({fingerprint:O(`focus`,`trap`,i),severity:`blocker`,source:`focus`,title:`Keyboard focus is trapped`,detail:`Pressing Tab stopped moving focus, so keyboard users cannot leave this element.`,wcag:`2.1.2`,stepN:n,pageUrl:r});for(let t of e){let e=`${t.role} <${t.tag}> (tab stop ${t.index+1})`;t.name||a.push({fingerprint:O(`focus`,`unnamed`,i,t.role,t.tag,String(t.index)),severity:`serious`,source:`focus`,title:`Focusable element has no accessible name`,detail:`Screen readers announce ${e} without a name, so users can't tell what it does.`,wcag:`4.1.2`,stepN:n,pageUrl:r}),t.noVisibleFocus?a.push({fingerprint:O(`focus`,`invisible`,i,t.role,t.name),severity:`serious`,source:`focus`,title:`No visible focus indicator`,detail:`${e} looks the same focused and unfocused, so sighted keyboard users lose their place.`,wcag:`2.4.7`,stepN:n,pageUrl:r}):t.focusContrast!==void 0&&t.focusContrast<3&&a.push({fingerprint:O(`focus`,`faint-focus`,i,t.role,t.name),severity:`moderate`,source:`focus`,title:`Focus indicator is hard to see`,detail:`${e} shows focus, but the change reaches only ${t.focusContrast}:1 against its surroundings; at least 3:1 is needed for people with low vision to see where they are. Use a darker or thicker outline.`,wcag:`1.4.11`,stepN:n,pageUrl:r}),t.fieldContrast!==void 0&&t.fieldContrast<3&&a.push({fingerprint:O(`focus`,`faint-field`,i,t.role,t.name),severity:`moderate`,source:`focus`,title:`Field's edge is hard to see`,detail:`${e}: its border and background reach only ${t.fieldContrast}:1 against the page, so people with low vision may not find where to type. Give it a border of at least 3:1.`,wcag:`1.4.11`,stepN:n,pageUrl:r})}return a}function pe(e,t,n){return e.map(e=>({fingerprint:O(`focus`,`mouse-only`,D(n),e.selector,e.text),severity:`serious`,source:`focus`,title:`Clickable element can't be reached with the keyboard`,detail:`"${e.text||`(no text)`}" <${e.tag}> responds to the mouse but isn't focusable, so keyboard and screen reader users can't use it. Use a <button> or <a href>.`,wcag:`2.1.1`,stepN:t,pageUrl:n,selector:e.selector}))}function me(e,t,n,r,i){let a=r.map(e=>`"${e.text||e.selector}" <${e.tag}>`).join(`, `);return{fingerprint:O(`task`,`blocked`,D(n)),severity:`blocker`,source:`task`,title:`Task cannot be completed with a screen reader`,detail:`${e}${a?` Mouse-only controls on this page: ${a}.`:i?` Keyboard focus is trapped on this page.`:``}`,wcag:a||i?`2.1.1`:`4.1.2`,stepN:t,pageUrl:n}}function he(e,t,n,r,i){let a=n?` on “${n}”`:``,o=D(i);switch(e){case`silent-change`:return{fingerprint:O(`screen-reader`,`silent`,o,n),severity:`serious`,source:`screen-reader`,title:`A change was not announced`,detail:`After ${t}${a} the page changed, but NVDA said nothing and focus stayed where it was, so screen reader users don't know anything happened. Announce the result with a live region (e.g. role="status") or move focus to it.`,wcag:`4.1.3`,stepN:r,pageUrl:i};case`focus-lost`:return{fingerprint:O(`screen-reader`,`focus-lost`,o,n),severity:`serious`,source:`screen-reader`,title:`Focus was lost after an action`,detail:`After ${t}${a} keyboard focus went back to the start of the page, so screen reader users lose their place and have to find their way back. Keep focus on the control, or move it to the new content.`,wcag:`2.4.3`,stepN:r,pageUrl:i};case`cursor-reset`:return{fingerprint:O(`screen-reader`,`cursor-reset`,o,n),severity:`moderate`,source:`screen-reader`,title:`Content was replaced under the reading position`,detail:`After ${t}${a} the content NVDA was reading was replaced, so its reading position jumped. Update content in place, or move focus to what replaced it.`,stepN:r,pageUrl:i}}}var ge=new Set([`click here`,`here`,`click`,`more`,`read more`,`learn more`,`more info`,`details`,`link`,`button`,`image`,`img`,`icon`,`go`,`submit`,`this`,`continue reading`]);function _e(e){let t=e.trim().toLowerCase();return ge.has(t)||/\.(png|jpe?g|gif|svg|webp|avif)$/.test(t)||/^[\W\d_]{1,2}$/u.test(t)||/^[a-z]+[-_]?\d{2,}$/.test(t)}function ve(e){return/^(edit|delete|remove|change|update|view|open|select|choose|add|buy|download|share|rename|duplicate|archive|copy|move|manage|configure|more options|options|actions)( (it|this|item|now|details|to (cart|basket|bag)))?$/i.test(e.trim())}var k=e=>`“${e}”`;function ye(e){return e===`generic`?`element`:e}function be(e,t,n){let r=e.name.trim(),i=e.naming,a=[],o=ye(e.role),s=e.context?` (in ${k(e.context)})`:``;if(!r&&i?.scrollable)a.push({kind:`unnamed`,severity:`serious`,message:`A scrolling area${s} that the browser makes focusable so keyboard users can scroll it. It has no name, so a screen reader announces just “${o}”.`,fix:`Give it role="region" and a name, e.g. aria-label="…" or aria-labelledby pointing at its heading${e.context?` (${k(e.context)})`:``}.`,wcag:`4.1.2`});else if(!r&&i?.plainText)a.push({kind:`unnamed`,severity:`serious`,message:`Shows ${k(i.plainText)} on screen, but it's a plain <${e.tag}>, whose text is never used as a name, so a screen reader announces just “${o}”.`,fix:`Use a real <button> (or <a href> if it goes somewhere), or add the right role, e.g. role="button", so its text becomes its name.`,wcag:`4.1.2`});else if(!r){let t=[`textbox`,`combobox`,`searchbox`,`spinbutton`,`checkbox`,`radio`,`slider`].includes(e.role);a.push({kind:`unnamed`,severity:`serious`,message:`A screen reader announces just ${k(o)}${s}, with no name, so users can't tell what it does.`,fix:t?`Give it a visible <label for="…">, or aria-labelledby pointing at the text that labels it.`:e.tag===`a`?`Give the link text that says where it goes; for an icon link, add aria-label="…".`:`Give it text, or for an icon-only control add aria-label="…" that says what it does.`,wcag:`4.1.2`})}else if(ve(r)){let t=n>1?` ${n} controls on this page are announced the same way.`:``;a.push({kind:`no-target`,severity:`moderate`,message:`Says ${k(r)} but not what it acts on. Heard on its own, users can't tell which item it's for.${t}`,fix:e.context?`Name the item: aria-label="${r} ${e.context}", or keep the visible ${k(r)} and add aria-describedby pointing at the heading ${k(e.context)}.`:`Say what it acts on, e.g. aria-label="${r} <item name>", or add aria-describedby pointing at the item's name.`,wcag:`2.4.6`})}else _e(r)?a.push({kind:`vague`,severity:`moderate`,message:`${k(r)} doesn't say what this ${o} does or where it goes, especially when heard in a list of links or buttons.`,fix:`Use a name that makes sense on its own, e.g. "Read more about <topic>"; visually hidden text works too.`,wcag:`2.4.4`}):n>1&&a.push({kind:`ambiguous`,severity:`moderate`,message:`${n} controls on this page are all announced as ${k(r)}, so tabbing through them, users hear the same thing ${n} times.`,fix:e.context?`Make each name unique, e.g. aria-label="${r}, ${e.context}", or aria-labelledby combining its own label with the heading ${k(e.context)}.`:`Make each name unique by adding what it belongs to, via aria-label or aria-labelledby.`,wcag:`2.4.6`});return i?.brokenRefs?.length&&a.push({kind:`broken-reference`,severity:`serious`,message:`${i.brokenRefs.join(`, `)} points at an element that doesn't exist, so that text is never announced.`,fix:`Fix the id, or remove the attribute if the text is gone.`,wcag:`1.3.1`}),r&&i?.source===`placeholder`&&a.push({kind:`placeholder-only`,severity:`moderate`,message:`Its only label is the placeholder ${k(r)}, which disappears as soon as you type and isn't announced reliably.`,fix:`Add a visible <label for="…">; keep the placeholder only for an example value.`,wcag:`3.3.2`}),r&&i?.source===`title`&&a.push({kind:`title-only`,severity:`minor`,message:`Named only by its title attribute (a tooltip). Some screen readers skip it, and touch and keyboard users never see it.`,fix:`Use visible text or aria-label instead of title.`,wcag:`4.1.2`}),i?.visibleText&&a.push({kind:`label-mismatch`,severity:`moderate`,message:`Shows ${k(i.visibleText)} on screen but is announced as ${k(r)}. Voice-control users who say what they see can't activate it.`,fix:`Start the aria-label with the visible text, e.g. aria-label="${i.visibleText} …", or drop aria-label.`,wcag:`2.5.3`}),{page:t,role:e.role,name:r,context:e.context,source:i?.source,description:i?.description,issues:a}}function xe(e){let t=new Map;for(let n of e){let e=new Map;for(let t of n.stops)t.name.trim()&&e.set(`${t.role}|${t.name}`,(e.get(`${t.role}|${t.name}`)??0)+1);for(let r of n.stops){let i=`${n.page}|${r.role}|${r.name}|${r.tag}|${r.context??``}`,a=e.get(`${r.role}|${r.name}`)??0;t.set(i,{stop:r,page:n.page,sameName:Math.max(a,t.get(i)?.sameName??0)})}}return[...t.values()].map(({stop:e,page:t,sameName:n})=>be(e,t,n))}var Se={critical:3,serious:2,moderate:1,minor:.5},Ce=new Set([`color-contrast`,`link-in-text-block`,`target-size`,`meta-viewport`,`meta-viewport-large`,`avoid-inline-spacing`,`css-orientation-lock`,`blink`,`marquee`,`meta-refresh`,`no-autoplay-audio`,`color-contrast-dark`,`reflow`,`text-spacing`,`hover-contrast`]),we=new Set([`scrollable-region-focusable`,`nested-interactive`,`tabindex`,`frame-focusable-content`,`accesskeys`,`focus-order-semantics`,`bypass`]);function Te(e){return Ce.has(e)?`design`:we.has(e)?`keyboard`:`context`}function A(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function j(e,t){let n=e+t;return n===0?100:Math.round(100*e/n)}function Ee(e){let t=new Map;for(let n of e){let e=new Map;for(let t of n.stops)t.name.trim()&&e.set(`${t.role}|${t.name}`,(e.get(`${t.role}|${t.name}`)??0)+1);for(let r of n.stops){let i=`${n.page}|${r.role}|${r.name}|${r.tag}|${r.context??``}`,a=(e.get(`${r.role}|${r.name}`)??0)>1;t.set(i,{stop:r,ambiguous:a||(t.get(i)?.ambiguous??!1)})}}return[...t.values()]}function De(e,t){let n=0,r=0,i=0;for(let a of e)Te(a.id)===t&&(n+=a.passed,i+=a.failed,r+=a.failed*Se[a.impact??`moderate`]);return{passed:n,failed:i,failWeight:r}}var Oe=[[`unnamed`,e=>`${e} unnamed`],[`broken-reference`,e=>`${e} point${e===1?`s`:``} at a missing label or description`],[`no-target`,e=>`${e} ${e===1?`doesn't`:`don't`} say what ${e===1?`it acts`:`they act`} on`],[`ambiguous`,e=>`${e} share${e===1?`s`:``} a name with other controls`],[`vague`,e=>`${e} vaguely named`],[`label-mismatch`,e=>`${e} announced differently from what ${e===1?`it shows`:`they show`}`],[`placeholder-only`,e=>`${e} labelled only by a placeholder`],[`title-only`,e=>`${e} named only by a tooltip`]],ke={serious:Se.serious,moderate:Se.moderate,minor:Se.minor};function Ae(e,t){let n=xe(e),r=n.filter(e=>e.issues.length),i=n.length-r.length,a=De(t,`context`),o=r.reduce((e,t)=>e+Math.max(...t.issues.map(e=>ke[e.severity])),0),s=j(i+a.passed,o+a.failWeight),c=[`${i} of ${A(n.length,`keyboard control`)} clearly named`];for(let[e,t]of Oe){let r=n.filter(t=>t.issues.some(t=>t.kind===e)).length;r&&c.push(t(r))}return a.failed&&c.push(A(a.failed,`label, alt text or ARIA issue`)),{score:s,checked:n.length+a.passed+a.failed,failed:r.length+a.failed,summary:`${c.join(`, `)}.`,controls:n}}function je(e,t){let n=Ee(e),r=n.filter(({stop:e})=>e.noVisibleFocus).length,i=n.filter(({stop:e})=>!e.noVisibleFocus&&e.focusContrast!==void 0),a=i.filter(({stop:e})=>e.focusContrast<3).length,o=n.filter(({stop:e})=>e.fieldContrast!==void 0),s=o.filter(({stop:e})=>e.fieldContrast<3).length,c=De(t,`design`),l=j(n.length-r+(i.length-a)+(o.length-s)+c.passed,r*Se.serious+(a+s)*Se.moderate+c.failWeight),u=t.filter(e=>e.id===`color-contrast`).reduce((e,t)=>e+t.failed,0),d=[`${n.length-r} of ${A(n.length,`control`)} show focus`];a&&d.push(`${a} of them faintly`),u&&d.push(`${A(u,`text element`)} fail${u===1?`s`:``} contrast`),s&&d.push(`${A(s,`field`)} hard to see`);let f=c.failed-u;return f&&d.push(`${A(f,`other visual issue`)} (size, zoom, motion)`),{score:l,checked:n.length+i.length+o.length+c.passed+c.failed,failed:r+a+s+c.failed,summary:`${d.join(`, `)}.`}}var Me=8;function Ne(e){let t=e.journey,n=t.actions.map(e=>e.cheapest).filter(e=>!!e),r=e=>n.length?n.reduce((t,n)=>t+e(n),0)/n.length:0,i=r(e=>e.seconds),a=Math.max(0,...e.pages.map(e=>e.mouseOnlyControls),0),o=e.pages.some(e=>e.trapped),s=De(e.axe,`keyboard`),c=100-Math.min(40,Math.max(0,i-Me)*2);c-=Math.min(30,t.silentChanges*10),c-=Math.min(30,t.focusLost*10),c-=Math.min(15,t.cursorResets*5),c-=Math.min(20,a*5),c-=Math.min(20,s.failWeight*2),o&&(c=Math.min(c,20)),e.outcome===`blocked`&&(c=Math.min(c,30)),c=Math.round(Math.max(0,Math.min(100,c)));let l=Math.round(t.wordsHeard/300*10)/10,u=t.actions.length?[`${A(t.actions.length,`action`)}; a skilled NVDA user needs ${i.toFixed(1)} s to reach each control`]:[`No actions taken`];return t.silentChanges&&u.push(`${A(t.silentChanges,`change`)} not announced`),t.focusLost&&u.push(`focus lost ${A(t.focusLost,`time`)}`),t.cursorResets&&u.push(`reading position reset ${A(t.cursorResets,`time`)}`),a&&u.push(A(a,`mouse-only control`)),o&&u.push(`focus gets trapped`),e.outcome===`blocked`&&u.push(`the task is blocked for screen reader users`),u.push(`the agent pressed ${A(t.keystrokes,`key`)} and listened for ${l} min`),{score:c,checked:t.actions.length,failed:t.silentChanges+t.focusLost+t.cursorResets+a+ +!!o+s.failed,summary:`${u.join(`, `)}.`,actions:t.actions.length,secondsPerAction:Math.round(i*10)/10,keystrokesPerAction:Math.round(r(e=>e.keystrokes)*10)/10,wordsPerAction:Math.round(r(e=>e.words)),agentKeystrokes:t.keystrokes,agentListeningMinutes:l,silentChanges:t.silentChanges,focusLost:t.focusLost,cursorResets:t.cursorResets}}function Pe(e){let t=Ae(e.pages,e.axe),n=je(e.pages,e.axe),r=Ne(e),i=Math.round((t.score+r.score+n.score)/3);return e.outcome===`blocked`&&(i=Math.min(i,40)),{version:3,overall:i,partial:e.outcome!==`completed`&&e.outcome!==`blocked`,context:t,journey:r,design:n}}var Fe=new Set([`button`,`link`,`textbox`,`searchbox`,`combobox`,`spinbutton`,`radio`,`checkbox`,`switch`,`option`,`menuitem`,`tab`,`slider`,`listbox`,`radiogroup`]);function Ie(e,t,n){let r=e=>e.toLowerCase().replace(/["'\\]/g,``).replace(/\s+/g,` `).trim(),i=r(e??``).replace(/^[a-z]+: /,``);if(i.length<4)return!1;let a=new Set(n.split(`
|
|
2
|
+
import{createRequire as e}from"node:module";import{spawn as t}from"node:child_process";import n from"node:path";import{parseArgs as r}from"node:util";import{chmod as i,mkdir as a,readFile as o,writeFile as s}from"node:fs/promises";import{homedir as c,hostname as l}from"node:os";import{createInterface as u}from"node:readline/promises";import{existsSync as d,readFileSync as f}from"node:fs";import{chromium as p}from"playwright";var m=class extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t}},h=4,g=3e5,_=e=>new Promise(t=>setTimeout(t,e)),v=class e{baseUrl;token;constructor(e,t){this.baseUrl=e,this.token=t}as(t){return new e(this.baseUrl,t)}get(e){return this.request(`GET`,e)}getText(e){return this.request(`GET`,e)}post(e,t,n){return this.request(`POST`,e,t,n)}put(e,t,n,r){return this.request(`PUT`,e,{bytes:t,contentType:n},r)}async request(e,t,n,r){let i=e===`PUT`?n:void 0,a;for(let o=0;o<=h;o++){o&&await _(Math.min(1e3*2**(o-1),15e3));let s;try{s=await fetch(`${this.baseUrl}/api/v1${t}`,{method:e,signal:r?AbortSignal.any([r,AbortSignal.timeout(g)]):AbortSignal.timeout(g),headers:{authorization:`Bearer ${this.token}`,...n===void 0?{}:{"content-type":i?.contentType??`application/json`},"user-agent":`ariawalk-cli`},body:i?new Blob([i.bytes]):n===void 0?void 0:JSON.stringify(n)})}catch(n){if(r?.aborted)throw n;if(n instanceof Error&&n.name===`TimeoutError`)throw Error(`${e} ${t} got no answer in ${g/6e4} minutes.`);a=n;continue}if(s.ok)return/^text\//.test(s.headers.get(`content-type`)??``)?await s.text():await s.json();let c=await s.json().catch(()=>null),l=new m(s.status,c?.error?.code??`http_error`,c?.error?.message??`${e} ${t} failed with HTTP ${s.status}`);if(s.status!==429&&s.status<500)throw l;a=l}throw a instanceof Error?a:Error(String(a))}};function y(){let e=process.env.XDG_CONFIG_HOME||n.join(c(),`.config`);return n.join(e,`ariawalk`,`config.json`)}async function ee(){try{return JSON.parse(await o(y(),`utf8`))}catch{return{}}}async function te(e={}){let t=await ee();return{apiKey:process.env.ARIAWALK_API_KEY||t.apiKey,apiUrl:(e.apiUrl||process.env.ARIAWALK_API_URL||t.apiUrl||`https://ariawalk.com`).replace(/\/+$/,``)}}async function b(e){let t=y();return await a(n.dirname(t),{recursive:!0}),await s(t,`${JSON.stringify({...await ee(),...e},null,2)}\n`,{mode:384}),await i(t,384),t}async function ne(){let{apiKey:e,...t}=await ee(),r=y();await a(n.dirname(r),{recursive:!0}),await s(r,`${JSON.stringify(t,null,2)}\n`,{mode:384})}var re=process.stdout.isTTY&&!process.env.NO_COLOR,x=e=>t=>re?`\x1b[${e}m${t}\x1b[0m`:t,S=x(2),C=x(1),ie=x(31),ae=x(32),w=x(33),T=(e=``)=>process.stdout.write(`${e}\n`),oe=e=>process.stderr.write(`${ie(`error`)} ${e}\n`),se={blocker:ie,serious:ie,moderate:w,minor:S};function ce(e){let t=``,n=()=>{re&&t&&process.stdout.write(`\r\x1B[2K`),t=``},r=e=>{n(),T(e)};return{activity(e){re&&e&&(n(),t=e,process.stdout.write(S(e)))},async stepStarted(t){(t.n===1||e.verbose)&&r(S(`Step ${t.n} · ${t.pageTitle||t.pageUrl}`))},async stepUpdated(t,n){if(n.heard?.length){let i=n.action?C(n.action.replaceAll(`_`,` `)):`listened`;r(`${S(String(t).padStart(3))} ${i}${n.targetName?` on ${n.targetName}`:``}`);for(let t of n.heard.slice(0,e.verbose?100:3))r(` ${S(`${t.keys} →`)} ${t.speech||S(`(nothing said)`)}`);!e.verbose&&n.heard.length>3&&r(S(` … ${n.heard.length-3} more key presses`))}n.decision?.reason&&e.verbose&&r(S(` ${n.decision.reason}`)),n.decision?.goalReached&&n.narration&&r(ae(` ${n.narration}`))},async findings(t){for(let n of t)(n.severity===`blocker`||n.severity===`serious`||e.verbose)&&r(` ${se[n.severity](n.severity)} ${n.title}${n.wcag?S(` (WCAG ${n.wcag})`):``}`)}}}function le(e){return e===`localhost`||e===`127.0.0.1`||e.endsWith(`.localhost`)}function ue(e,t){let n;try{n=new URL(e)}catch{return!1}if(n.protocol!==`https:`&&n.protocol!==`http:`)return!1;let r=n.hostname.toLowerCase();return t.some(e=>r===e||r.endsWith(`.${e}`))}function de(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``).replace(/\.$/,``);if(le(t)||t===`::1`)return!0;let n=/^(\d{1,3})\.(\d{1,3})\.\d{1,3}\.\d{1,3}$/.exec(t);if(n){let[e,t]=[Number(n[1]),Number(n[2])];return e===127||e===10||e===192&&t===168||e===172&&t>=16&&t<=31}return t.includes(`.`)?/\.(local|internal|lan|home\.arpa)$/.test(t):/^[a-z0-9-]+$/.test(t)}function E(e,t){let n;try{n=new URL(e)}catch{return!1}return n.protocol!==`https:`&&n.protocol!==`http:`?!1:de(n.hostname)||ue(e,t)}function D(e){try{let t=new URL(e);return`${t.host}${t.pathname}`}catch{return e}}function O(...e){return e.map(e=>e??``).join(`|`)}function fe(e,t,n,r){let i=D(r),a=[];t&&a.push({fingerprint:O(`focus`,`trap`,i),severity:`blocker`,source:`focus`,title:`Keyboard focus is trapped`,detail:`Pressing Tab stopped moving focus, so keyboard users cannot leave this element.`,wcag:`2.1.2`,stepN:n,pageUrl:r});for(let t of e){let e=`${t.role} <${t.tag}> (tab stop ${t.index+1})`;t.name||a.push({fingerprint:O(`focus`,`unnamed`,i,t.role,t.tag,String(t.index)),severity:`serious`,source:`focus`,title:`Focusable element has no accessible name`,detail:`Screen readers announce ${e} without a name, so users can't tell what it does.`,wcag:`4.1.2`,stepN:n,pageUrl:r}),t.noVisibleFocus?a.push({fingerprint:O(`focus`,`invisible`,i,t.role,t.name),severity:`serious`,source:`focus`,title:`No visible focus indicator`,detail:`${e} looks the same focused and unfocused, so sighted keyboard users lose their place.`,wcag:`2.4.7`,stepN:n,pageUrl:r}):t.focusContrast!==void 0&&t.focusContrast<3&&a.push({fingerprint:O(`focus`,`faint-focus`,i,t.role,t.name),severity:`moderate`,source:`focus`,title:`Focus indicator is hard to see`,detail:`${e} shows focus, but the change reaches only ${t.focusContrast}:1 against its surroundings; at least 3:1 is needed for people with low vision to see where they are. Use a darker or thicker outline.`,wcag:`1.4.11`,stepN:n,pageUrl:r}),t.fieldContrast!==void 0&&t.fieldContrast<3&&a.push({fingerprint:O(`focus`,`faint-field`,i,t.role,t.name),severity:`moderate`,source:`focus`,title:`Field's edge is hard to see`,detail:`${e}: its border and background reach only ${t.fieldContrast}:1 against the page, so people with low vision may not find where to type. Give it a border of at least 3:1.`,wcag:`1.4.11`,stepN:n,pageUrl:r})}return a}function pe(e,t,n){return e.map(e=>({fingerprint:O(`focus`,`mouse-only`,D(n),e.selector,e.text),severity:`serious`,source:`focus`,title:`Clickable element can't be reached with the keyboard`,detail:`"${e.text||`(no text)`}" <${e.tag}> responds to the mouse but isn't focusable, so keyboard and screen reader users can't use it. Use a <button> or <a href>.`,wcag:`2.1.1`,stepN:t,pageUrl:n,selector:e.selector}))}function me(e,t,n,r,i){let a=r.map(e=>`"${e.text||e.selector}" <${e.tag}>`).join(`, `);return{fingerprint:O(`task`,`blocked`,D(n)),severity:`blocker`,source:`task`,title:`Task cannot be completed with a screen reader`,detail:`${e}${a?` Mouse-only controls on this page: ${a}.`:i?` Keyboard focus is trapped on this page.`:``}`,wcag:a||i?`2.1.1`:`4.1.2`,stepN:t,pageUrl:n}}function he(e,t,n,r,i){let a=n?` on “${n}”`:``,o=D(i);switch(e){case`silent-change`:return{fingerprint:O(`screen-reader`,`silent`,o,n),severity:`serious`,source:`screen-reader`,title:`A change was not announced`,detail:`After ${t}${a} the page changed, but NVDA said nothing and focus stayed where it was, so screen reader users don't know anything happened. Announce the result with a live region (e.g. role="status") or move focus to it.`,wcag:`4.1.3`,stepN:r,pageUrl:i};case`focus-lost`:return{fingerprint:O(`screen-reader`,`focus-lost`,o,n),severity:`serious`,source:`screen-reader`,title:`Focus was lost after an action`,detail:`After ${t}${a} keyboard focus went back to the start of the page, so screen reader users lose their place and have to find their way back. Keep focus on the control, or move it to the new content.`,wcag:`2.4.3`,stepN:r,pageUrl:i};case`cursor-reset`:return{fingerprint:O(`screen-reader`,`cursor-reset`,o,n),severity:`moderate`,source:`screen-reader`,title:`Content was replaced under the reading position`,detail:`After ${t}${a} the content NVDA was reading was replaced, so its reading position jumped. Update content in place, or move focus to what replaced it.`,stepN:r,pageUrl:i}}}var ge=new Set([`click here`,`here`,`click`,`more`,`read more`,`learn more`,`more info`,`details`,`link`,`button`,`image`,`img`,`icon`,`go`,`submit`,`this`,`continue reading`]);function _e(e){let t=e.trim().toLowerCase();return ge.has(t)||/\.(png|jpe?g|gif|svg|webp|avif)$/.test(t)||/^[\W\d_]{1,2}$/u.test(t)||/^[a-z]+[-_]?\d{2,}$/.test(t)}function ve(e){return/^(edit|delete|remove|change|update|view|open|select|choose|add|buy|download|share|rename|duplicate|archive|copy|move|manage|configure|more options|options|actions)( (it|this|item|now|details|to (cart|basket|bag)))?$/i.test(e.trim())}var k=e=>`“${e}”`;function ye(e){return e===`generic`?`element`:e}function be(e,t,n){let r=e.name.trim(),i=e.naming,a=[],o=ye(e.role),s=e.context?` (in ${k(e.context)})`:``;if(!r&&i?.scrollable)a.push({kind:`unnamed`,severity:`serious`,message:`A scrolling area${s} that the browser makes focusable so keyboard users can scroll it. It has no name, so a screen reader announces just “${o}”.`,fix:`Give it role="region" and a name, e.g. aria-label="…" or aria-labelledby pointing at its heading${e.context?` (${k(e.context)})`:``}.`,wcag:`4.1.2`});else if(!r&&i?.plainText)a.push({kind:`unnamed`,severity:`serious`,message:`Shows ${k(i.plainText)} on screen, but it's a plain <${e.tag}>, whose text is never used as a name, so a screen reader announces just “${o}”.`,fix:`Use a real <button> (or <a href> if it goes somewhere), or add the right role, e.g. role="button", so its text becomes its name.`,wcag:`4.1.2`});else if(!r){let t=[`textbox`,`combobox`,`searchbox`,`spinbutton`,`checkbox`,`radio`,`slider`].includes(e.role);a.push({kind:`unnamed`,severity:`serious`,message:`A screen reader announces just ${k(o)}${s}, with no name, so users can't tell what it does.`,fix:t?`Give it a visible <label for="…">, or aria-labelledby pointing at the text that labels it.`:e.tag===`a`?`Give the link text that says where it goes; for an icon link, add aria-label="…".`:`Give it text, or for an icon-only control add aria-label="…" that says what it does.`,wcag:`4.1.2`})}else if(ve(r)){let t=n>1?` ${n} controls on this page are announced the same way.`:``;a.push({kind:`no-target`,severity:`moderate`,message:`Says ${k(r)} but not what it acts on. Heard on its own, users can't tell which item it's for.${t}`,fix:e.context?`Name the item: aria-label="${r} ${e.context}", or keep the visible ${k(r)} and add aria-describedby pointing at the heading ${k(e.context)}.`:`Say what it acts on, e.g. aria-label="${r} <item name>", or add aria-describedby pointing at the item's name.`,wcag:`2.4.6`})}else _e(r)?a.push({kind:`vague`,severity:`moderate`,message:`${k(r)} doesn't say what this ${o} does or where it goes, especially when heard in a list of links or buttons.`,fix:`Use a name that makes sense on its own, e.g. "Read more about <topic>"; visually hidden text works too.`,wcag:`2.4.4`}):n>1&&a.push({kind:`ambiguous`,severity:`moderate`,message:`${n} controls on this page are all announced as ${k(r)}, so tabbing through them, users hear the same thing ${n} times.`,fix:e.context?`Make each name unique, e.g. aria-label="${r}, ${e.context}", or aria-labelledby combining its own label with the heading ${k(e.context)}.`:`Make each name unique by adding what it belongs to, via aria-label or aria-labelledby.`,wcag:`2.4.6`});return i?.brokenRefs?.length&&a.push({kind:`broken-reference`,severity:`serious`,message:`${i.brokenRefs.join(`, `)} points at an element that doesn't exist, so that text is never announced.`,fix:`Fix the id, or remove the attribute if the text is gone.`,wcag:`1.3.1`}),r&&i?.source===`placeholder`&&a.push({kind:`placeholder-only`,severity:`moderate`,message:`Its only label is the placeholder ${k(r)}, which disappears as soon as you type and isn't announced reliably.`,fix:`Add a visible <label for="…">; keep the placeholder only for an example value.`,wcag:`3.3.2`}),r&&i?.source===`title`&&a.push({kind:`title-only`,severity:`minor`,message:`Named only by its title attribute (a tooltip). Some screen readers skip it, and touch and keyboard users never see it.`,fix:`Use visible text or aria-label instead of title.`,wcag:`4.1.2`}),i?.visibleText&&a.push({kind:`label-mismatch`,severity:`moderate`,message:`Shows ${k(i.visibleText)} on screen but is announced as ${k(r)}. Voice-control users who say what they see can't activate it.`,fix:`Start the aria-label with the visible text, e.g. aria-label="${i.visibleText} …", or drop aria-label.`,wcag:`2.5.3`}),{page:t,role:e.role,name:r,context:e.context,source:i?.source,description:i?.description,issues:a}}function xe(e){let t=new Map;for(let n of e){let e=new Map;for(let t of n.stops)t.name.trim()&&e.set(`${t.role}|${t.name}`,(e.get(`${t.role}|${t.name}`)??0)+1);for(let r of n.stops){let i=`${n.page}|${r.role}|${r.name}|${r.tag}|${r.context??``}`,a=e.get(`${r.role}|${r.name}`)??0;t.set(i,{stop:r,page:n.page,sameName:Math.max(a,t.get(i)?.sameName??0)})}}return[...t.values()].map(({stop:e,page:t,sameName:n})=>be(e,t,n))}var Se={critical:3,serious:2,moderate:1,minor:.5},Ce=new Set([`color-contrast`,`link-in-text-block`,`target-size`,`meta-viewport`,`meta-viewport-large`,`avoid-inline-spacing`,`css-orientation-lock`,`blink`,`marquee`,`meta-refresh`,`no-autoplay-audio`,`color-contrast-dark`,`reflow`,`text-spacing`,`hover-contrast`]),we=new Set([`scrollable-region-focusable`,`nested-interactive`,`tabindex`,`frame-focusable-content`,`accesskeys`,`focus-order-semantics`,`bypass`]);function Te(e){return Ce.has(e)?`design`:we.has(e)?`keyboard`:`context`}function A(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function j(e,t){let n=e+t;return n===0?100:Math.round(100*e/n)}function Ee(e){let t=new Map;for(let n of e){let e=new Map;for(let t of n.stops)t.name.trim()&&e.set(`${t.role}|${t.name}`,(e.get(`${t.role}|${t.name}`)??0)+1);for(let r of n.stops){let i=`${n.page}|${r.role}|${r.name}|${r.tag}|${r.context??``}`,a=(e.get(`${r.role}|${r.name}`)??0)>1;t.set(i,{stop:r,ambiguous:a||(t.get(i)?.ambiguous??!1)})}}return[...t.values()]}function De(e,t){let n=0,r=0,i=0;for(let a of e)Te(a.id)===t&&(n+=a.passed,i+=a.failed,r+=a.failed*Se[a.impact??`moderate`]);return{passed:n,failed:i,failWeight:r}}var Oe=[[`unnamed`,e=>`${e} unnamed`],[`broken-reference`,e=>`${e} point${e===1?`s`:``} at a missing label or description`],[`no-target`,e=>`${e} ${e===1?`doesn't`:`don't`} say what ${e===1?`it acts`:`they act`} on`],[`ambiguous`,e=>`${e} share${e===1?`s`:``} a name with other controls`],[`vague`,e=>`${e} vaguely named`],[`label-mismatch`,e=>`${e} announced differently from what ${e===1?`it shows`:`they show`}`],[`placeholder-only`,e=>`${e} labelled only by a placeholder`],[`title-only`,e=>`${e} named only by a tooltip`]],ke={serious:Se.serious,moderate:Se.moderate,minor:Se.minor};function Ae(e,t){let n=xe(e),r=n.filter(e=>e.issues.length),i=n.length-r.length,a=De(t,`context`),o=r.reduce((e,t)=>e+Math.max(...t.issues.map(e=>ke[e.severity])),0),s=j(i+a.passed,o+a.failWeight),c=[`${i} of ${A(n.length,`keyboard control`)} clearly named`];for(let[e,t]of Oe){let r=n.filter(t=>t.issues.some(t=>t.kind===e)).length;r&&c.push(t(r))}return a.failed&&c.push(A(a.failed,`label, alt text or ARIA issue`)),{score:s,checked:n.length+a.passed+a.failed,failed:r.length+a.failed,summary:`${c.join(`, `)}.`,controls:n}}function je(e,t){let n=Ee(e),r=n.filter(({stop:e})=>e.noVisibleFocus).length,i=n.filter(({stop:e})=>!e.noVisibleFocus&&e.focusContrast!==void 0),a=i.filter(({stop:e})=>e.focusContrast<3).length,o=n.filter(({stop:e})=>e.fieldContrast!==void 0),s=o.filter(({stop:e})=>e.fieldContrast<3).length,c=De(t,`design`),l=j(n.length-r+(i.length-a)+(o.length-s)+c.passed,r*Se.serious+(a+s)*Se.moderate+c.failWeight),u=t.filter(e=>e.id===`color-contrast`).reduce((e,t)=>e+t.failed,0),d=[`${n.length-r} of ${A(n.length,`control`)} show focus`];a&&d.push(`${a} of them faintly`),u&&d.push(`${A(u,`text element`)} fail${u===1?`s`:``} contrast`),s&&d.push(`${A(s,`field`)} hard to see`);let f=c.failed-u;return f&&d.push(`${A(f,`other visual issue`)} (size, zoom, motion)`),{score:l,checked:n.length+i.length+o.length+c.passed+c.failed,failed:r+a+s+c.failed,summary:`${d.join(`, `)}.`}}var Me=8;function Ne(e){let t=e.journey,n=t.actions.map(e=>e.cheapest).filter(e=>!!e),r=e=>n.length?n.reduce((t,n)=>t+e(n),0)/n.length:0,i=r(e=>e.seconds),a=Math.max(0,...e.pages.map(e=>e.mouseOnlyControls),0),o=e.pages.some(e=>e.trapped),s=De(e.axe,`keyboard`),c=100-Math.min(40,Math.max(0,i-Me)*2);c-=Math.min(30,t.silentChanges*10),c-=Math.min(30,t.focusLost*10),c-=Math.min(15,t.cursorResets*5),c-=Math.min(20,a*5),c-=Math.min(20,s.failWeight*2),o&&(c=Math.min(c,20)),e.outcome===`blocked`&&(c=Math.min(c,30)),c=Math.round(Math.max(0,Math.min(100,c)));let l=Math.round(t.wordsHeard/300*10)/10,u=t.actions.length?[`${A(t.actions.length,`action`)}; a skilled NVDA user needs ${i.toFixed(1)} s to reach each control`]:[`No actions taken`];return t.silentChanges&&u.push(`${A(t.silentChanges,`change`)} not announced`),t.focusLost&&u.push(`focus lost ${A(t.focusLost,`time`)}`),t.cursorResets&&u.push(`reading position reset ${A(t.cursorResets,`time`)}`),a&&u.push(A(a,`mouse-only control`)),o&&u.push(`focus gets trapped`),e.outcome===`blocked`&&u.push(`the task is blocked for screen reader users`),u.push(`the agent pressed ${A(t.keystrokes,`key`)} and listened for ${l} min`),{score:c,checked:t.actions.length,failed:t.silentChanges+t.focusLost+t.cursorResets+a+ +!!o+s.failed,summary:`${u.join(`, `)}.`,actions:t.actions.length,secondsPerAction:Math.round(i*10)/10,keystrokesPerAction:Math.round(r(e=>e.keystrokes)*10)/10,wordsPerAction:Math.round(r(e=>e.words)),agentKeystrokes:t.keystrokes,agentListeningMinutes:l,silentChanges:t.silentChanges,focusLost:t.focusLost,cursorResets:t.cursorResets}}function Pe(e){let t=Ae(e.pages,e.axe),n=je(e.pages,e.axe),r=Ne(e),i=Math.round((t.score+r.score+n.score)/3);return e.outcome===`blocked`&&(i=Math.min(i,40)),{version:3,overall:i,partial:e.outcome!==`completed`&&e.outcome!==`blocked`,context:t,journey:r,design:n}}var Fe=new Set([`button`,`link`,`textbox`,`searchbox`,`combobox`,`spinbutton`,`radio`,`checkbox`,`switch`,`option`,`menuitem`,`tab`,`slider`,`listbox`,`radiogroup`]);function Ie(e,t,n){let r=e=>e.toLowerCase().replace(/["'\\]/g,``).replace(/\s+/g,` `).trim(),i=r(e??``).replace(/^[a-z]+: /,``);if(i.length<4)return!1;let a=new Set(n.split(`
|
|
3
3
|
`).map(r));return t.split(`
|
|
4
4
|
`).some(e=>{let t=r(e);if(a.has(t))return!1;let n=t.match(/^- ([a-z]+)/)?.[1];return n&&Fe.has(n)?!1:t.replace(/^- [a-z]+:? ?/,``).includes(i)})}function Le(e,t){let n=e=>e.toLowerCase().replace(/["'\\“”‘’]/g,``).replace(/\s+/g,` `).trim(),r=n(e??``);return r.length>=4&&t.some(e=>n(e).includes(r))}function Re(e,t,n,r){if(!r?.editable)return{rejected:`focus is not on an edit field${r?.spoken?` (it's on "${r.spoken}")`:``}, so there is nothing to type into.`};let i=e=>t.find(t=>t.key===e),a=e.text?.trim().match(/^\{\{\s*([^}]+?)\s*\}\}$/)?.[1],o=i(a??e.dataKey??``);if(o)return{value:o.value,display:o.isSecret?`{{${o.key}}}`:o.value};let s=e.text?.trim();return s&&(t.find(e=>!e.isSecret&&e.value===s)||n.includes(s))?{value:s,display:s}:{rejected:`${s?`"${s}" is`:`you gave`} no valid text to type. Copy a test data value or text written in the task exactly, or use {{key}} for a secret.`}}function ze(e,t,n,r){if(r!==void 0)return`Typed "${r}"${n?`; heard “${n}”`:``}.`;let i=t>1?`${e} ×${t}`:e;return n?`Pressed ${i}; heard “${n}”.`:`Pressed ${i}; nothing was announced.`}var Be=`/*! axe v4.14.0
|
|
5
5
|
* Copyright (c) 2015 - 2026 Deque Systems, Inc.
|
|
@@ -59,7 +59,7 @@ import{createRequire as e}from"node:module";import{spawn as t}from"node:child_pr
|
|
|
59
59
|
return parts.join(' > ');
|
|
60
60
|
};
|
|
61
61
|
window.__ariawalkColor = { parse, over, luminance, contrast, backdrop, selectorOf };
|
|
62
|
-
})()`,Je=200,Ye=12e3;async function Xe(e){await e.evaluate(qe),await e.evaluate(({attr:e})=>{document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e)),document.activeElement?.blur();let t=e=>{let t=getComputedStyle(e);return[t.outlineStyle,t.outlineWidth,t.outlineColor,t.boxShadow,t.backgroundColor,t.borderColor,t.color,t.textDecorationLine].join(`|`)},{parse:n,over:r,contrast:i,backdrop:a}=window.__ariawalkColor,o=e=>{let t=getComputedStyle(e);return{outlineStyle:t.outlineStyle,outlineWidth:parseFloat(t.outlineWidth)||0,outlineColor:t.outlineColor,outlineOffset:parseFloat(t.outlineOffset)||0,boxShadow:t.boxShadow,backgroundColor:t.backgroundColor,color:t.color,textDecorationLine:t.textDecorationLine,borders:[`Top`,`Right`,`Bottom`,`Left`].map(e=>({width:parseFloat(t.getPropertyValue(`border-${e.toLowerCase()}-width`))||0,style:t.getPropertyValue(`border-${e.toLowerCase()}-style`),color:t.getPropertyValue(`border-${e.toLowerCase()}-color`)}))}},s=e=>{if(!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement&&/^(text|email|tel|url|search|password|number|date|datetime-local|month|week|time)$/.test(e.type)))return;let t=a(e.parentElement);if(!t)return;let s=o(e),c=n(s.backgroundColor),l=c?r(c,t):t,u=i(l,t);for(let e of s.borders){let a=n(e.color);e.width>=1&&!/none|hidden/.test(e.style)&&a&&(u=Math.max(u,i(r(a,t),t)))}return Math.round(u*10)/10},c=(e,t)=>{let s=o(e),c=a(e.parentElement),l=n(t.backgroundColor),u=c&&l?r(l,c):c,d=[];if(s.outlineStyle===`auto`)return 21;let f=n(s.outlineColor);if(!/none|hidden/.test(s.outlineStyle)&&s.outlineWidth>=1&&f&&(t.outlineStyle!==s.outlineStyle||t.outlineWidth!==s.outlineWidth||t.outlineColor!==s.outlineColor)){let e=s.outlineOffset<0?u:c;e&&d.push(i(r(f,e),e))}if(s.boxShadow!==t.boxShadow&&s.boxShadow!==`none`&&c)for(let e of s.boxShadow.match(/rgba?\([^)]+\)/g)??[]){let t=n(e);t&&d.push(i(r(t,c),c))}if(s.backgroundColor!==t.backgroundColor&&c){let e=n(s.backgroundColor),a=n(t.backgroundColor);e&&a&&d.push(i(r(e,c),r(a,c)))}if(s.borders.forEach((e,a)=>{let o=t.borders[a],s=n(e.color),l=n(o.color);e.width>=1&&!/none|hidden/.test(e.style)&&s&&(e.color!==o.color||e.width!==o.width)&&c&&d.push(Math.max(i(r(s,c),c),l&&o.width>=1?i(r(s,c),r(l,c)):0))}),s.textDecorationLine!==t.textDecorationLine&&/underline/.test(s.textDecorationLine)&&u){let e=n(s.color);e&&d.push(i(r(e,u),u))}if(s.color!==t.color){let e=n(s.color),a=n(t.color);e&&a&&u&&d.push(i(r(e,u),r(a,u)))}return d.length?Math.round(Math.max(...d)*10)/10:void 0},l=new Map,u=new Map,d=new Map;document.querySelectorAll(`a[href],button,input,select,textarea,summary,[tabindex],[contenteditable]`).forEach(e=>{l.set(e,t(e)),u.set(e,o(e)),d.set(e,s(e))}),window.__ariawalk={baseline:l,sig:t,looks:u,fields:d,focusContrast:c};let f=document.body;f.setAttribute(`tabindex`,`-1`),f.focus(),f.removeAttribute(`tabindex`),window.scrollTo(0,0)},{attr:Ke});let t=[],n=!1,r=null;for(let i=0;i<Je;i++){await e.keyboard.press(`Tab`);let i=await e.evaluate(({attr:e,next:t})=>{let n=document.activeElement;for(;n?.shadowRoot?.activeElement;)n=n.shadowRoot.activeElement;if(!n||n===document.body||n===document.documentElement)return{kind:`end`};let r=n.getAttribute(e);if(r!==null)return{kind:`seen`,index:Number(r)};n.setAttribute(e,String(t));let i=window.__ariawalk,a=i.baseline.get(n),o=e=>(e.textContent??``).replace(/\s+/g,` `).trim(),s;if(n instanceof HTMLInputElement&&n.type===`radio`&&n.name){let e=n.form??document;s=Array.from(e.querySelectorAll(`input[type=radio][name="${CSS.escape(n.name)}"]`)).map(e=>(e.labels?.[0]?o(e.labels[0]):e.getAttribute(`aria-label`)??e.value)+(e.checked?` (selected)`:``))}else if(n instanceof HTMLSelectElement)s=Array.from(n.options).map(e=>o(e)+(e.selected?` (selected)`:``));else if(n.getAttribute(`role`)===`radio`||n.getAttribute(`role`)===`option`){let e=n.closest(`[role=radiogroup],[role=listbox]`);e&&(s=Array.from(e.querySelectorAll(`[role=radio],[role=option]`)).map(e=>o(e)+(e.getAttribute(`aria-checked`)===`true`||e.getAttribute(`aria-selected`)===`true`?` (selected)`:``)))}let c=`li, article, section, fieldset, tr, [role=group], [role=region], dialog, form`,l;for(let e=n.closest(c),t=0;e&&t<4&&!l;e=e.parentElement?.closest(c)??null,t++){let t=e.querySelector(`h1, h2, h3, h4, h5, h6, legend, caption, [role=heading]`);t&&!t.contains(n)&&(l=o(t).slice(0,80))}let u;n instanceof HTMLInputElement&&(n.type===`checkbox`||n.type===`radio`)?u=n.checked?`checked`:`not checked`:n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?u=n.value?n instanceof HTMLInputElement&&n.type===`password`?`filled`:`contains "${n.value.slice(0,60)}"`:`empty`:n.getAttribute(`aria-checked`)&&(u=n.getAttribute(`aria-checked`)===`true`?`checked`:`not checked`);let d=e=>(n.getAttribute(e)??``).split(/\s+/).filter(Boolean),f=e=>d(e).map(e=>document.getElementById(e)).filter(e=>!!e).map(e=>o(e)).join(` `).trim(),p=[`aria-labelledby`,`aria-describedby`].flatMap(e=>d(e).filter(e=>!document.getElementById(e)).map(t=>`${e}: #${t}`)),m=Array.from(n.labels??[]),h=(n instanceof HTMLElement?n.innerText:n.textContent??``).replace(/\s+/g,` `).trim(),g=n.querySelector(`img[alt]`)?.getAttribute(`alt`)?.trim()||(n instanceof HTMLInputElement&&n.type===`image`?n.alt:``),_=n.getAttribute(`title`)?.trim()??``,v=n.getAttribute(`placeholder`)?.trim()??``,y=f(`aria-labelledby`)?`aria-labelledby`:n.getAttribute(`aria-label`)?.trim()?`aria-label`:m.some(e=>o(e))?`label`:g?`alt`:h&&!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?`content`:_?`title`:v?`placeholder`:`none`,b=(f(`aria-describedby`)||(y===`title`?``:_)).slice(0,160)||void 0,ee=n.getAttribute(`aria-label`)?.trim()??``,x=y===`aria-label`&&h&&!ee.toLowerCase().includes(h.toLowerCase())?h.slice(0,80):void 0,te=!n.getAttribute(`role`)&&!/^(a|button|input|select|textarea|summary|iframe|area|img)$/i.test(n.tagName),ne=getComputedStyle(n),S=te&&(/(auto|scroll)/.test(ne.overflowY)&&n.scrollHeight>n.clientHeight||/(auto|scroll)/.test(ne.overflowX)&&n.scrollWidth>n.clientWidth);return{kind:`new`,naming:{source:te&&y===`content`?`none`:y,description:b,visibleText:x,brokenRefs:p.length?p:void 0,scrollable:S||void 0,plainText:te&&!S&&h?h.slice(0,80):void 0},options:s,state:u,context:l,tag:n.tagName.toLowerCase(),noVisibleFocus:a!==void 0&&a===i.sig(n),focusContrast:a!==void 0&&a!==i.sig(n)&&i.looks.get(n)?i.focusContrast(n,i.looks.get(n)):void 0,fieldContrast:i.fields.get(n)}},{attr:Ke,next:t.length});if(i.kind===`end`)break;if(i.kind===`seen`){if(i.index===r&&(n=!0),i.index===0||n)break;r=i.index;continue}let a=t.length;t.push({index:a,role:`generic`,name:``,tag:i.tag,noVisibleFocus:i.noVisibleFocus,focusContrast:i.focusContrast,fieldContrast:i.fieldContrast,options:i.options,context:i.context,state:i.state,naming:i.naming}),r=a}return(await Promise.all(t.map(t=>Qe(e,t.index)))).forEach(({role:e,name:n},r)=>Object.assign(t[r],{role:e,name:n})),{stops:t,trapped:n}}async function Ze(e){return e.evaluate(()=>{let e=`a[href],button,input,select,textarea,summary,[tabindex],[contenteditable],label,iframe`,t=[];for(let n of Array.from(document.body.querySelectorAll(`*`))){if(!(n.hasAttribute(`onclick`)||getComputedStyle(n).cursor===`pointer`)||n.tabIndex>=0||n.closest(e)||n.querySelector(e))continue;let r=n.parentElement;if(r&&r!==document.body&&getComputedStyle(r).cursor===`pointer`&&!n.hasAttribute(`onclick`))continue;let i=n.getBoundingClientRect();if(i.width===0||i.height===0||getComputedStyle(n).visibility===`hidden`)continue;let a=(n.innerText||n.getAttribute(`aria-label`)||``).replace(/\s+/g,` `).trim().slice(0,80),o=Array.from(n.classList).slice(0,2).map(e=>`.${CSS.escape(e)}`).join(``);t.push({tag:n.tagName.toLowerCase(),text:a,selector:`${n.tagName.toLowerCase()}${n.id?`#${CSS.escape(n.id)}`:o}`})}return t.slice(0,20)})}async function Qe(e,t){try{let n=Ge(await e.locator(`[${Ke}="${t}"]`).ariaSnapshot({timeout:2e3}));if(n)return n}catch{}return{role:`generic`,name:``}}async function $e(e){let t=We(await e.locator(`body`).ariaSnapshot({timeout:1e4}));return t.length>Ye?`${t.slice(0,Ye)}\n# …truncated`:t}async function et(e,t=150,n=2e3){await e.evaluate(({quietMs:e,maxMs:t})=>new Promise(n=>{let r=setTimeout(o,e),i=setTimeout(o,t),a=new MutationObserver(()=>{clearTimeout(r),r=setTimeout(o,e)});a.observe(document,{subtree:!0,childList:!0,attributes:!0,characterData:!0});function o(){a.disconnect(),clearTimeout(r),clearTimeout(i),n()}}),{quietMs:t,maxMs:n}).catch(()=>e.waitForLoadState(`domcontentloaded`,{timeout:1e4}).catch(()=>{}))}var tt=25;async function nt(e,t,n=new Set){await e.addScriptTag({content:Be});let{violations:r,passes:i,incomplete:a}=await e.evaluate(async()=>{let e=await window.axe.run(document,{runOnly:{type:`tag`,values:[`wcag2a`,`wcag2aa`,`wcag21a`,`wcag21aa`,`wcag22aa`]},resultTypes:[`violations`,`passes`,`incomplete`]}),t=e=>({id:e.id,impact:e.impact,nodes:e.nodes.map(e=>e.target.join(` `))});return{violations:e.violations,passes:e.passes.map(t),incomplete:e.incomplete.filter(e=>e.id===`color-contrast`).map(t)}}),o=e.url(),s=D(o),c=(e,t)=>{let r=`${s}|${e}|${t}`;return!n.has(r)&&(n.add(r),!0)},l=new Map,u=(e,t,n)=>{let r=l.get(e)??{id:e,impact:t,passed:0,failed:0};r[n]++,n===`failed`&&(r.impact=t),l.set(e,r)},d=(e,n,r,i,a,c)=>({fingerprint:O(`axe`,e,s,c),severity:n,source:`axe`,title:r,detail:i,wcag:a,stepN:t,pageUrl:o,selector:c}),f=[];for(let e of r){let t=e.nodes.filter(t=>c(e.id,t.target.join(` `)));t.forEach(()=>u(e.id,e.impact,`failed`));for(let n of t.slice(0,5))f.push(d(e.id,e.impact===`critical`?`serious`:e.impact??`moderate`,e.help,n.failureSummary??e.description,ot(e.tags),n.target.join(` `)))}for(let e of i)for(let t of e.nodes)c(e.id,t)&&u(e.id,e.impact,`passed`);let p=a.flatMap(e=>e.nodes).filter(e=>!n.has(`${s}|color-contrast|${e}`));for(let t of p.slice(0,tt)){let n=await rt(e,t).catch(()=>null);if(c(`color-contrast`,t),!n){f.push(d(`color-contrast-review`,`minor`,`Text contrast needs a manual check`,`The text sits on something that couldn't be measured (e.g. a video or an element that moves). Check that it reaches 4.5:1, or 3:1 for large text.`,`1.4.3`,t));continue}let r=n.large?3:4.5;n.ratio>=r?u(`color-contrast`,`serious`,`passed`):(u(`color-contrast`,`serious`,`failed`),f.push(d(`color-contrast`,`serious`,`Text over an image or gradient has too little contrast`,`Measured on screen: the text reaches ${n.ratio.toFixed(1)}:1 against the background behind it (the weakest tenth of it); ${r}:1 is needed${n.large?` for large text`:``}. Add a solid or darker backdrop behind the text, or change its color.`,`1.4.3`,t)))}return{findings:f,stats:[...l.values()]}}async function rt(e,t){let n=e.locator(t).first(),r=await n.evaluate(e=>{let t=e.getBoundingClientRect(),n=document.createRange();n.selectNodeContents(e);let r=n.getBoundingClientRect(),i=getComputedStyle(e),a=i.color,o=parseFloat(i.fontSize)>=24||parseFloat(i.fontSize)>=18.66&&Number(i.fontWeight)>=700;if(!document.getElementById(`ariawalk-hide-text`)){let e=document.createElement(`style`);e.id=`ariawalk-hide-text`,e.textContent=`[data-ariawalk-hide-text],[data-ariawalk-hide-text] *{color:transparent!important;-webkit-text-fill-color:transparent!important;text-shadow:none!important;caret-color:transparent!important}`,document.head.appendChild(e)}return e.setAttribute(`data-ariawalk-hide-text`,``),{color:a,large:o,rect:{x:r.left-t.left,y:r.top-t.top,w:r.width,h:r.height}}}),i;try{i=await n.screenshot({scale:`css`,animations:`disabled`,timeout:5e3})}finally{await n.evaluate(e=>e.removeAttribute(`data-ariawalk-hide-text`)).catch(()=>{})}if(r.rect.w<1||r.rect.h<1)return null;let a=await e.evaluate(async({b64:e,rect:t,color:n})=>{let r=Uint8Array.from(atob(e),e=>e.charCodeAt(0)),i=await createImageBitmap(new Blob([r],{type:`image/png`})),a=new OffscreenCanvas(i.width,i.height).getContext(`2d`);a.drawImage(i,0,0);let o=Math.max(0,Math.floor(t.x)),s=Math.max(0,Math.floor(t.y)),c=Math.min(i.width-o,Math.ceil(t.w)),l=Math.min(i.height-s,Math.ceil(t.h));if(c<1||l<1)return null;let u=a.getImageData(o,s,c,l).data,d=n.match(/rgba?\(([^)]+)\)/);if(!d)return null;let[f,p,m,h=1]=d[1].split(/[\s,/]+/).filter(Boolean).map(Number),g=(e,t,n)=>{let r=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*r(e)+.7152*r(t)+.0722*r(n)},_=[],v=Math.max(1,Math.floor(Math.sqrt(c*l/2e4)));for(let e=0;e<l;e+=v)for(let t=0;t<c;t+=v){let n=(e*c+t)*4,[r,i,a]=[u[n],u[n+1],u[n+2]],o=g(f*h+r*(1-h),p*h+i*(1-h),m*h+a*(1-h)),s=g(r,i,a);_.push((Math.max(o,s)+.05)/(Math.min(o,s)+.05))}return _.sort((e,t)=>e-t),_[Math.floor(_.length*.1)]??null},{b64:i.toString(`base64`),rect:r.rect,color:r.color});return a===null?null:{ratio:Math.round(a*10)/10,large:r.large}}var it={width:1280,height:900};async function at(e,t){let n=e.url(),r=D(n),i=[],a=[],o=(e,i,a,o,s,c)=>({fingerprint:O(`visual`,e,r,c),severity:i,source:`axe`,title:a,detail:o,wcag:s,stepN:t,pageUrl:n,selector:c});await e.evaluate(qe);let s=()=>e.evaluate(()=>[document.body,...document.querySelectorAll(`main, header, p, a, button`)].slice(0,30).map(e=>{let t=getComputedStyle(e);return t.color+t.backgroundColor}).join()),c=await s();await e.emulateMedia({colorScheme:`dark`});try{if(await s()!==c){await e.addScriptTag({content:Be});let t=await e.evaluate(async()=>{let e=await window.axe.run(document,{runOnly:{type:`rule`,values:[`color-contrast`]},resultTypes:[`violations`,`passes`]}),t=e.violations[0];return{passed:e.passes[0]?.nodes.length??0,failed:(t?.nodes??[]).map(e=>({selector:e.target.join(` `),summary:e.failureSummary}))}});a.push({id:`color-contrast-dark`,impact:`serious`,passed:t.passed,failed:t.failed.length});for(let e of t.failed.slice(0,5))i.push(o(`dark-contrast`,`serious`,`Text has too little contrast in dark mode`,`With the system set to dark mode: ${e.summary}`,`1.4.3`,e.selector))}}finally{await e.emulateMedia({colorScheme:`light`})}await e.setViewportSize({width:320,height:it.height});try{await e.waitForTimeout(150);let t=await e.evaluate(()=>{let{selectorOf:e}=window.__ariawalkColor,t=document.documentElement.clientWidth;if(document.documentElement.scrollWidth<=t+2)return{fits:!0,wide:[]};let n=e=>!!e.closest(`table, pre, code, svg, canvas, video, iframe, [role=grid]`)||(()=>{for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowX;if(e===`auto`||e===`scroll`)return!0}return!1})(),r=[];for(let e of document.body.querySelectorAll(`*`)){let i=e.getBoundingClientRect();i.width&&i.right>t+2&&!n(e)&&getComputedStyle(e).visibility!==`hidden`&&r.push({el:e,right:i.right})}let i=r.filter(({el:e})=>!r.some(t=>t.el!==e&&t.el.contains(e)));return{fits:i.length===0,wide:i.slice(0,5).map(({el:t,right:n})=>({selector:e(t),width:Math.round(n)}))}});a.push({id:`reflow`,impact:`serious`,passed:+!!t.fits,failed:+!t.fits});for(let e of t.wide)i.push(o(`reflow`,`serious`,`Content doesn't fit a phone-width screen`,`At 320 px wide (a phone, or 400% zoom) this element is ${e.width} px wide, so people have to scroll sideways to read each line. Let it wrap or shrink.`,`1.4.10`,e.selector))}finally{await e.setViewportSize(it)}let l=await e.evaluate(()=>{let{selectorOf:e}=window.__ariawalkColor,t=[...document.body.querySelectorAll(`*`)].filter(e=>{let t=getComputedStyle(e);return/hidden|clip/.test(t.overflowX+t.overflowY)&&(e.textContent??``).trim()&&e.offsetParent!==null}),n=e=>e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1,r=new Set(t.filter(n)),i=document.createElement(`style`);i.textContent=`*{line-height:1.5!important;letter-spacing:.12em!important;word-spacing:.16em!important}p{margin-bottom:2em!important}`,document.head.appendChild(i);let a=t.filter(e=>!r.has(e)&&n(e));return i.remove(),{checked:t.length,cut:a.slice(0,5).map(e),total:a.length}});l.checked&&a.push({id:`text-spacing`,impact:`serious`,passed:l.checked-l.total,failed:l.total});for(let e of l.cut)i.push(o(`text-spacing`,`serious`,`Text is cut off with increased text spacing`,`People who widen line, letter or word spacing to read (WCAG's text spacing settings) lose part of this text: its box hides what no longer fits. Let it grow instead of a fixed height or width.`,`1.4.12`,e));let u=await e.evaluate(e=>[...document.querySelectorAll(`[${e}]`)].filter(e=>(e.textContent??``).trim()).slice(0,30).map(t=>t.getAttribute(e)),Ke),d=0,f=[];for(let t of u){let n=e.locator(`[${Ke}="${t}"]`).first();if(!await n.hover({timeout:2e3,trial:!1}).then(()=>!0,()=>!1))continue;let r=await n.evaluate(e=>{let t=window.__ariawalkColor,n=getComputedStyle(e),r=t.backdrop(e.parentElement),i=t.parse(n.backgroundColor),a=t.parse(n.color);if(!r||!a||getComputedStyle(e).backgroundImage!==`none`)return null;let o=i?t.over(i,r):r,s=parseFloat(n.fontSize)>=24||parseFloat(n.fontSize)>=18.66&&Number(n.fontWeight)>=700;return{ratio:Math.round(t.contrast(t.over(a,o),o)*10)/10,needed:s?3:4.5,selector:t.selectorOf(e)}}).catch(()=>null);r&&(r.ratio>=r.needed?d++:f.push(r))}await e.mouse.move(0,0),d+f.length&&a.push({id:`hover-contrast`,impact:`moderate`,passed:d,failed:f.length});for(let e of f.slice(0,5))i.push(o(`hover-contrast`,`moderate`,`Text contrast drops on hover`,`When the pointer is over it, the text reaches only ${e.ratio}:1 against its background; ${e.needed}:1 is needed. Keep hover colors as readable as the resting ones.`,`1.4.3`,e.selector));return{findings:i,stats:a}}function ot(e){let t=e.find(e=>/^wcag\d{3,4}$/.test(e));if(!t)return;let n=t.slice(4);return`${n[0]}.${n[1]}.${n.slice(2)}`}var st=new Set([`InlineTextBox`]);function ct(e){let t=new Map,n=e.documents[0];if(!n)return t;let r=t=>t===void 0||t<0?``:e.strings[t]??``,{nodes:i,layout:a,textBoxes:o}=n,s=i.backendNodeId??[],c=new Set(i.isClickable?.index??[]);s.forEach((e,n)=>{let a=i.attributes?.[n]??[],o=e=>{for(let t=0;t<a.length;t+=2)if(r(a[t])===e)return r(a[t+1])},s=r(i.nodeName?.[n]).toLowerCase();t.set(e,{tag:s,display:``,inputType:s===`input`?(o(`type`)??`text`).toLowerCase():void 0,current:o(`aria-current`),valueText:o(`aria-valuetext`),clickable:c.has(n)||void 0})});let l=new Map;a.nodeIndex.forEach((e,n)=>{l.set(e,n);let i=t.get(s[e]);if(!i)return;i.display=r(a.styles[n]?.[0]);let[,o=0,,c=0]=a.bounds[n]??[];i.top=o,i.bottom=o+c});let u=new Map;o.layoutIndex.forEach((e,t)=>{let[,n=0,,i=0]=o.bounds[t]??[],s=r(a.text[e]).slice(o.start[t],o.start[t]+o.length[t]),c=u.get(e)??[],l=c[c.length-1];l&&Math.abs(l.top-n)<1?l.text+=s:c.push({text:s,top:n,bottom:n+i}),u.set(e,c)});for(let[e,n]of l){let r=u.get(n),i=t.get(s[e]);i&&r?.length&&(i.lines=r)}return t}function lt(e){let t={};for(let{name:n,value:r}of e.properties??[]){let e=r.value;switch(n){case`checked`:case`pressed`:t[n]=String(e);break;case`expanded`:case`selected`:case`required`:case`disabled`:case`readonly`:case`focusable`:case`focused`:case`multiline`:case`modal`:t[n]=e===!0||e===`true`;break;case`level`:t.level=Number(e);break;case`invalid`:case`hasPopup`:case`editable`:case`live`:case`valuetext`:e!==void 0&&e!==``&&e!==`false`&&(t[n]=String(e));break;case`activedescendant`:t.activeDescendant=r.relatedNodes?.[0]?.backendDOMNodeId}}return t}function ut(e){return e==null?``:String(typeof e==`number`?Number.parseFloat(e.toPrecision(7)):e)}function dt(e){return e.name?.sources?.find(e=>e.value!==void 0&&!e.superseded)?.type??``}function ft(e,t,n){let r=new Map(e.map(e=>[e.nodeId,e])),i=new Map,a=null,o=e=>{let n={key:e.backendDOMNodeId===void 0?`a${e.nodeId}`:`b${e.backendDOMNodeId}`,backendId:e.backendDOMNodeId,role:e.role?.value??`generic`,name:String(e.name?.value??``).replace(/\s+/g,` `).trim(),nameFrom:dt(e),description:String(e.description?.value??``).replace(/\s+/g,` `).trim(),value:ut(e.value?.value),props:lt(e),children:[],dom:e.backendDOMNodeId===void 0?void 0:t.get(e.backendDOMNodeId)};return i.set(n.key,n),n.props.focused&&n.role!==`RootWebArea`&&(a=n),n},s=(e,t=[])=>{for(let n of t){let t=r.get(n);if(!t||st.has(t.role?.value??``))continue;if(t.ignored){s(e,t.childIds);continue}let i=o(t);i.parent=e,e.children.push(i),s(i,t.childIds)}},c=e[0];if(!c)throw Error(`Empty accessibility tree`);let l=o(c);s(l,c.childIds);let u=a;return u?.props.activeDescendant!==void 0&&(a=i.get(`b${u.props.activeDescendant}`)??u),{root:l,byKey:i,focused:a,...n}}var pt=e=>{let t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t};function mt(e){return e.role===`StaticText`?e.name:e.children.map(mt).join(``).replace(/\s+/g,` `).trim()}var ht=`(() => {
|
|
62
|
+
})()`,Je=200,Ye=12e3;async function Xe(e){await e.evaluate(qe),await e.evaluate(({attr:e})=>{document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e)),document.activeElement?.blur();let t=e=>{let t=getComputedStyle(e);return[t.outlineStyle,t.outlineWidth,t.outlineColor,t.boxShadow,t.backgroundColor,t.borderColor,t.color,t.textDecorationLine].join(`|`)},{parse:n,over:r,contrast:i,backdrop:a}=window.__ariawalkColor,o=e=>{let t=getComputedStyle(e);return{outlineStyle:t.outlineStyle,outlineWidth:parseFloat(t.outlineWidth)||0,outlineColor:t.outlineColor,outlineOffset:parseFloat(t.outlineOffset)||0,boxShadow:t.boxShadow,backgroundColor:t.backgroundColor,color:t.color,textDecorationLine:t.textDecorationLine,borders:[`Top`,`Right`,`Bottom`,`Left`].map(e=>({width:parseFloat(t.getPropertyValue(`border-${e.toLowerCase()}-width`))||0,style:t.getPropertyValue(`border-${e.toLowerCase()}-style`),color:t.getPropertyValue(`border-${e.toLowerCase()}-color`)}))}},s=e=>{if(!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement&&/^(text|email|tel|url|search|password|number|date|datetime-local|month|week|time)$/.test(e.type)))return;let t=a(e.parentElement);if(!t)return;let s=o(e),c=n(s.backgroundColor),l=c?r(c,t):t,u=i(l,t);for(let e of s.borders){let a=n(e.color);e.width>=1&&!/none|hidden/.test(e.style)&&a&&(u=Math.max(u,i(r(a,t),t)))}return Math.round(u*10)/10},c=(e,t)=>{let s=o(e),c=a(e.parentElement),l=n(t.backgroundColor),u=c&&l?r(l,c):c,d=[];if(s.outlineStyle===`auto`)return 21;let f=n(s.outlineColor);if(!/none|hidden/.test(s.outlineStyle)&&s.outlineWidth>=1&&f&&(t.outlineStyle!==s.outlineStyle||t.outlineWidth!==s.outlineWidth||t.outlineColor!==s.outlineColor)){let e=s.outlineOffset<0?u:c;e&&d.push(i(r(f,e),e))}if(s.boxShadow!==t.boxShadow&&s.boxShadow!==`none`&&c)for(let e of s.boxShadow.match(/rgba?\([^)]+\)/g)??[]){let t=n(e);t&&d.push(i(r(t,c),c))}if(s.backgroundColor!==t.backgroundColor&&c){let e=n(s.backgroundColor),a=n(t.backgroundColor);e&&a&&d.push(i(r(e,c),r(a,c)))}if(s.borders.forEach((e,a)=>{let o=t.borders[a],s=n(e.color),l=n(o.color);e.width>=1&&!/none|hidden/.test(e.style)&&s&&(e.color!==o.color||e.width!==o.width)&&c&&d.push(Math.max(i(r(s,c),c),l&&o.width>=1?i(r(s,c),r(l,c)):0))}),s.textDecorationLine!==t.textDecorationLine&&/underline/.test(s.textDecorationLine)&&u){let e=n(s.color);e&&d.push(i(r(e,u),u))}if(s.color!==t.color){let e=n(s.color),a=n(t.color);e&&a&&u&&d.push(i(r(e,u),r(a,u)))}return d.length?Math.round(Math.max(...d)*10)/10:void 0},l=new Map,u=new Map,d=new Map;document.querySelectorAll(`a[href],button,input,select,textarea,summary,[tabindex],[contenteditable]`).forEach(e=>{l.set(e,t(e)),u.set(e,o(e)),d.set(e,s(e))}),window.__ariawalk={baseline:l,sig:t,looks:u,fields:d,focusContrast:c};let f=document.body;f.setAttribute(`tabindex`,`-1`),f.focus(),f.removeAttribute(`tabindex`),window.scrollTo(0,0)},{attr:Ke});let t=[],n=!1,r=null;for(let i=0;i<Je;i++){await e.keyboard.press(`Tab`);let i=await e.evaluate(({attr:e,next:t})=>{let n=document.activeElement;for(;n?.shadowRoot?.activeElement;)n=n.shadowRoot.activeElement;if(!n||n===document.body||n===document.documentElement)return{kind:`end`};let r=n.getAttribute(e);if(r!==null)return{kind:`seen`,index:Number(r)};n.setAttribute(e,String(t));let i=window.__ariawalk,a=i.baseline.get(n),o=e=>(e.textContent??``).replace(/\s+/g,` `).trim(),s;if(n instanceof HTMLInputElement&&n.type===`radio`&&n.name){let e=n.form??document;s=Array.from(e.querySelectorAll(`input[type=radio][name="${CSS.escape(n.name)}"]`)).map(e=>(e.labels?.[0]?o(e.labels[0]):e.getAttribute(`aria-label`)??e.value)+(e.checked?` (selected)`:``))}else if(n instanceof HTMLSelectElement)s=Array.from(n.options).map(e=>o(e)+(e.selected?` (selected)`:``));else if(n.getAttribute(`role`)===`radio`||n.getAttribute(`role`)===`option`){let e=n.closest(`[role=radiogroup],[role=listbox]`);e&&(s=Array.from(e.querySelectorAll(`[role=radio],[role=option]`)).map(e=>o(e)+(e.getAttribute(`aria-checked`)===`true`||e.getAttribute(`aria-selected`)===`true`?` (selected)`:``)))}let c=`li, article, section, fieldset, tr, [role=group], [role=region], dialog, form`,l;for(let e=n.closest(c),t=0;e&&t<4&&!l;e=e.parentElement?.closest(c)??null,t++){let t=e.querySelector(`h1, h2, h3, h4, h5, h6, legend, caption, [role=heading]`);t&&!t.contains(n)&&(l=o(t).slice(0,80))}let u;n instanceof HTMLInputElement&&(n.type===`checkbox`||n.type===`radio`)?u=n.checked?`checked`:`not checked`:n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?u=n.value?n instanceof HTMLInputElement&&n.type===`password`?`filled`:`contains "${n.value.slice(0,60)}"`:`empty`:n.getAttribute(`aria-checked`)&&(u=n.getAttribute(`aria-checked`)===`true`?`checked`:`not checked`);let d=e=>(n.getAttribute(e)??``).split(/\s+/).filter(Boolean),f=e=>d(e).map(e=>document.getElementById(e)).filter(e=>!!e).map(e=>o(e)).join(` `).trim(),p=[`aria-labelledby`,`aria-describedby`].flatMap(e=>d(e).filter(e=>!document.getElementById(e)).map(t=>`${e}: #${t}`)),m=Array.from(n.labels??[]),h=(n instanceof HTMLElement?n.innerText:n.textContent??``).replace(/\s+/g,` `).trim(),g=n.querySelector(`img[alt]`)?.getAttribute(`alt`)?.trim()||(n instanceof HTMLInputElement&&n.type===`image`?n.alt:``),_=n.getAttribute(`title`)?.trim()??``,v=n.getAttribute(`placeholder`)?.trim()??``,y=f(`aria-labelledby`)?`aria-labelledby`:n.getAttribute(`aria-label`)?.trim()?`aria-label`:m.some(e=>o(e))?`label`:g?`alt`:h&&!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?`content`:_?`title`:v?`placeholder`:`none`,ee=(f(`aria-describedby`)||(y===`title`?``:_)).slice(0,160)||void 0,te=n.getAttribute(`aria-label`)?.trim()??``,b=y===`aria-label`&&h&&!te.toLowerCase().includes(h.toLowerCase())?h.slice(0,80):void 0,ne=!n.getAttribute(`role`)&&!/^(a|button|input|select|textarea|summary|iframe|area|img)$/i.test(n.tagName),re=getComputedStyle(n),x=ne&&(/(auto|scroll)/.test(re.overflowY)&&n.scrollHeight>n.clientHeight||/(auto|scroll)/.test(re.overflowX)&&n.scrollWidth>n.clientWidth);return{kind:`new`,naming:{source:ne&&y===`content`?`none`:y,description:ee,visibleText:b,brokenRefs:p.length?p:void 0,scrollable:x||void 0,plainText:ne&&!x&&h?h.slice(0,80):void 0},options:s,state:u,context:l,tag:n.tagName.toLowerCase(),noVisibleFocus:a!==void 0&&a===i.sig(n),focusContrast:a!==void 0&&a!==i.sig(n)&&i.looks.get(n)?i.focusContrast(n,i.looks.get(n)):void 0,fieldContrast:i.fields.get(n)}},{attr:Ke,next:t.length});if(i.kind===`end`)break;if(i.kind===`seen`){if(i.index===r&&(n=!0),i.index===0||n)break;r=i.index;continue}let a=t.length;t.push({index:a,role:`generic`,name:``,tag:i.tag,noVisibleFocus:i.noVisibleFocus,focusContrast:i.focusContrast,fieldContrast:i.fieldContrast,options:i.options,context:i.context,state:i.state,naming:i.naming}),r=a}return(await Promise.all(t.map(t=>Qe(e,t.index)))).forEach(({role:e,name:n},r)=>Object.assign(t[r],{role:e,name:n})),{stops:t,trapped:n}}async function Ze(e){return e.evaluate(()=>{let e=`a[href],button,input,select,textarea,summary,[tabindex],[contenteditable],label,iframe`,t=[];for(let n of Array.from(document.body.querySelectorAll(`*`))){if(!(n.hasAttribute(`onclick`)||getComputedStyle(n).cursor===`pointer`)||n.tabIndex>=0||n.closest(e)||n.querySelector(e))continue;let r=n.parentElement;if(r&&r!==document.body&&getComputedStyle(r).cursor===`pointer`&&!n.hasAttribute(`onclick`))continue;let i=n.getBoundingClientRect();if(i.width===0||i.height===0||getComputedStyle(n).visibility===`hidden`)continue;let a=(n.innerText||n.getAttribute(`aria-label`)||``).replace(/\s+/g,` `).trim().slice(0,80),o=Array.from(n.classList).slice(0,2).map(e=>`.${CSS.escape(e)}`).join(``);t.push({tag:n.tagName.toLowerCase(),text:a,selector:`${n.tagName.toLowerCase()}${n.id?`#${CSS.escape(n.id)}`:o}`})}return t.slice(0,20)})}async function Qe(e,t){try{let n=Ge(await e.locator(`[${Ke}="${t}"]`).ariaSnapshot({timeout:2e3}));if(n)return n}catch{}return{role:`generic`,name:``}}async function $e(e){let t=We(await e.locator(`body`).ariaSnapshot({timeout:1e4}));return t.length>Ye?`${t.slice(0,Ye)}\n# …truncated`:t}async function et(e,t=150,n=2e3){await e.evaluate(({quietMs:e,maxMs:t})=>new Promise(n=>{let r=setTimeout(o,e),i=setTimeout(o,t),a=new MutationObserver(()=>{clearTimeout(r),r=setTimeout(o,e)});a.observe(document,{subtree:!0,childList:!0,attributes:!0,characterData:!0});function o(){a.disconnect(),clearTimeout(r),clearTimeout(i),n()}}),{quietMs:t,maxMs:n}).catch(()=>e.waitForLoadState(`domcontentloaded`,{timeout:1e4}).catch(()=>{}))}var tt=25;async function nt(e,t,n=new Set){await e.addScriptTag({content:Be});let{violations:r,passes:i,incomplete:a}=await e.evaluate(async()=>{let e=await window.axe.run(document,{runOnly:{type:`tag`,values:[`wcag2a`,`wcag2aa`,`wcag21a`,`wcag21aa`,`wcag22aa`]},resultTypes:[`violations`,`passes`,`incomplete`]}),t=e=>({id:e.id,impact:e.impact,nodes:e.nodes.map(e=>e.target.join(` `))});return{violations:e.violations,passes:e.passes.map(t),incomplete:e.incomplete.filter(e=>e.id===`color-contrast`).map(t)}}),o=e.url(),s=D(o),c=(e,t)=>{let r=`${s}|${e}|${t}`;return!n.has(r)&&(n.add(r),!0)},l=new Map,u=(e,t,n)=>{let r=l.get(e)??{id:e,impact:t,passed:0,failed:0};r[n]++,n===`failed`&&(r.impact=t),l.set(e,r)},d=(e,n,r,i,a,c)=>({fingerprint:O(`axe`,e,s,c),severity:n,source:`axe`,title:r,detail:i,wcag:a,stepN:t,pageUrl:o,selector:c}),f=[];for(let e of r){let t=e.nodes.filter(t=>c(e.id,t.target.join(` `)));t.forEach(()=>u(e.id,e.impact,`failed`));for(let n of t.slice(0,5))f.push(d(e.id,e.impact===`critical`?`serious`:e.impact??`moderate`,e.help,n.failureSummary??e.description,ot(e.tags),n.target.join(` `)))}for(let e of i)for(let t of e.nodes)c(e.id,t)&&u(e.id,e.impact,`passed`);let p=a.flatMap(e=>e.nodes).filter(e=>!n.has(`${s}|color-contrast|${e}`));for(let t of p.slice(0,tt)){let n=await rt(e,t).catch(()=>null);if(c(`color-contrast`,t),!n){f.push(d(`color-contrast-review`,`minor`,`Text contrast needs a manual check`,`The text sits on something that couldn't be measured (e.g. a video or an element that moves). Check that it reaches 4.5:1, or 3:1 for large text.`,`1.4.3`,t));continue}let r=n.large?3:4.5;n.ratio>=r?u(`color-contrast`,`serious`,`passed`):(u(`color-contrast`,`serious`,`failed`),f.push(d(`color-contrast`,`serious`,`Text over an image or gradient has too little contrast`,`Measured on screen: the text reaches ${n.ratio.toFixed(1)}:1 against the background behind it (the weakest tenth of it); ${r}:1 is needed${n.large?` for large text`:``}. Add a solid or darker backdrop behind the text, or change its color.`,`1.4.3`,t)))}return{findings:f,stats:[...l.values()]}}async function rt(e,t){let n=e.locator(t).first(),r=await n.evaluate(e=>{let t=e.getBoundingClientRect(),n=document.createRange();n.selectNodeContents(e);let r=n.getBoundingClientRect(),i=getComputedStyle(e),a=i.color,o=parseFloat(i.fontSize)>=24||parseFloat(i.fontSize)>=18.66&&Number(i.fontWeight)>=700;if(!document.getElementById(`ariawalk-hide-text`)){let e=document.createElement(`style`);e.id=`ariawalk-hide-text`,e.textContent=`[data-ariawalk-hide-text],[data-ariawalk-hide-text] *{color:transparent!important;-webkit-text-fill-color:transparent!important;text-shadow:none!important;caret-color:transparent!important}`,document.head.appendChild(e)}return e.setAttribute(`data-ariawalk-hide-text`,``),{color:a,large:o,rect:{x:r.left-t.left,y:r.top-t.top,w:r.width,h:r.height}}}),i;try{i=await n.screenshot({scale:`css`,animations:`disabled`,timeout:5e3})}finally{await n.evaluate(e=>e.removeAttribute(`data-ariawalk-hide-text`)).catch(()=>{})}if(r.rect.w<1||r.rect.h<1)return null;let a=await e.evaluate(async({b64:e,rect:t,color:n})=>{let r=Uint8Array.from(atob(e),e=>e.charCodeAt(0)),i=await createImageBitmap(new Blob([r],{type:`image/png`})),a=new OffscreenCanvas(i.width,i.height).getContext(`2d`);a.drawImage(i,0,0);let o=Math.max(0,Math.floor(t.x)),s=Math.max(0,Math.floor(t.y)),c=Math.min(i.width-o,Math.ceil(t.w)),l=Math.min(i.height-s,Math.ceil(t.h));if(c<1||l<1)return null;let u=a.getImageData(o,s,c,l).data,d=n.match(/rgba?\(([^)]+)\)/);if(!d)return null;let[f,p,m,h=1]=d[1].split(/[\s,/]+/).filter(Boolean).map(Number),g=(e,t,n)=>{let r=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*r(e)+.7152*r(t)+.0722*r(n)},_=[],v=Math.max(1,Math.floor(Math.sqrt(c*l/2e4)));for(let e=0;e<l;e+=v)for(let t=0;t<c;t+=v){let n=(e*c+t)*4,[r,i,a]=[u[n],u[n+1],u[n+2]],o=g(f*h+r*(1-h),p*h+i*(1-h),m*h+a*(1-h)),s=g(r,i,a);_.push((Math.max(o,s)+.05)/(Math.min(o,s)+.05))}return _.sort((e,t)=>e-t),_[Math.floor(_.length*.1)]??null},{b64:i.toString(`base64`),rect:r.rect,color:r.color});return a===null?null:{ratio:Math.round(a*10)/10,large:r.large}}var it={width:1280,height:900};async function at(e,t){let n=e.url(),r=D(n),i=[],a=[],o=(e,i,a,o,s,c)=>({fingerprint:O(`visual`,e,r,c),severity:i,source:`axe`,title:a,detail:o,wcag:s,stepN:t,pageUrl:n,selector:c});await e.evaluate(qe);let s=()=>e.evaluate(()=>[document.body,...document.querySelectorAll(`main, header, p, a, button`)].slice(0,30).map(e=>{let t=getComputedStyle(e);return t.color+t.backgroundColor}).join()),c=await s();await e.emulateMedia({colorScheme:`dark`});try{if(await s()!==c){await e.addScriptTag({content:Be});let t=await e.evaluate(async()=>{let e=await window.axe.run(document,{runOnly:{type:`rule`,values:[`color-contrast`]},resultTypes:[`violations`,`passes`]}),t=e.violations[0];return{passed:e.passes[0]?.nodes.length??0,failed:(t?.nodes??[]).map(e=>({selector:e.target.join(` `),summary:e.failureSummary}))}});a.push({id:`color-contrast-dark`,impact:`serious`,passed:t.passed,failed:t.failed.length});for(let e of t.failed.slice(0,5))i.push(o(`dark-contrast`,`serious`,`Text has too little contrast in dark mode`,`With the system set to dark mode: ${e.summary}`,`1.4.3`,e.selector))}}finally{await e.emulateMedia({colorScheme:`light`})}await e.setViewportSize({width:320,height:it.height});try{await e.waitForTimeout(150);let t=await e.evaluate(()=>{let{selectorOf:e}=window.__ariawalkColor,t=document.documentElement.clientWidth;if(document.documentElement.scrollWidth<=t+2)return{fits:!0,wide:[]};let n=e=>!!e.closest(`table, pre, code, svg, canvas, video, iframe, [role=grid]`)||(()=>{for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowX;if(e===`auto`||e===`scroll`)return!0}return!1})(),r=[];for(let e of document.body.querySelectorAll(`*`)){let i=e.getBoundingClientRect();i.width&&i.right>t+2&&!n(e)&&getComputedStyle(e).visibility!==`hidden`&&r.push({el:e,right:i.right})}let i=r.filter(({el:e})=>!r.some(t=>t.el!==e&&t.el.contains(e)));return{fits:i.length===0,wide:i.slice(0,5).map(({el:t,right:n})=>({selector:e(t),width:Math.round(n)}))}});a.push({id:`reflow`,impact:`serious`,passed:+!!t.fits,failed:+!t.fits});for(let e of t.wide)i.push(o(`reflow`,`serious`,`Content doesn't fit a phone-width screen`,`At 320 px wide (a phone, or 400% zoom) this element is ${e.width} px wide, so people have to scroll sideways to read each line. Let it wrap or shrink.`,`1.4.10`,e.selector))}finally{await e.setViewportSize(it)}let l=await e.evaluate(()=>{let{selectorOf:e}=window.__ariawalkColor,t=[...document.body.querySelectorAll(`*`)].filter(e=>{let t=getComputedStyle(e);return/hidden|clip/.test(t.overflowX+t.overflowY)&&(e.textContent??``).trim()&&e.offsetParent!==null}),n=e=>e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1,r=new Set(t.filter(n)),i=document.createElement(`style`);i.textContent=`*{line-height:1.5!important;letter-spacing:.12em!important;word-spacing:.16em!important}p{margin-bottom:2em!important}`,document.head.appendChild(i);let a=t.filter(e=>!r.has(e)&&n(e));return i.remove(),{checked:t.length,cut:a.slice(0,5).map(e),total:a.length}});l.checked&&a.push({id:`text-spacing`,impact:`serious`,passed:l.checked-l.total,failed:l.total});for(let e of l.cut)i.push(o(`text-spacing`,`serious`,`Text is cut off with increased text spacing`,`People who widen line, letter or word spacing to read (WCAG's text spacing settings) lose part of this text: its box hides what no longer fits. Let it grow instead of a fixed height or width.`,`1.4.12`,e));let u=await e.evaluate(e=>[...document.querySelectorAll(`[${e}]`)].filter(e=>(e.textContent??``).trim()).slice(0,30).map(t=>t.getAttribute(e)),Ke),d=0,f=[];for(let t of u){let n=e.locator(`[${Ke}="${t}"]`).first();if(!await n.hover({timeout:2e3,trial:!1}).then(()=>!0,()=>!1))continue;let r=await n.evaluate(e=>{let t=window.__ariawalkColor,n=getComputedStyle(e),r=t.backdrop(e.parentElement),i=t.parse(n.backgroundColor),a=t.parse(n.color);if(!r||!a||getComputedStyle(e).backgroundImage!==`none`)return null;let o=i?t.over(i,r):r,s=parseFloat(n.fontSize)>=24||parseFloat(n.fontSize)>=18.66&&Number(n.fontWeight)>=700;return{ratio:Math.round(t.contrast(t.over(a,o),o)*10)/10,needed:s?3:4.5,selector:t.selectorOf(e)}}).catch(()=>null);r&&(r.ratio>=r.needed?d++:f.push(r))}await e.mouse.move(0,0),d+f.length&&a.push({id:`hover-contrast`,impact:`moderate`,passed:d,failed:f.length});for(let e of f.slice(0,5))i.push(o(`hover-contrast`,`moderate`,`Text contrast drops on hover`,`When the pointer is over it, the text reaches only ${e.ratio}:1 against its background; ${e.needed}:1 is needed. Keep hover colors as readable as the resting ones.`,`1.4.3`,e.selector));return{findings:i,stats:a}}function ot(e){let t=e.find(e=>/^wcag\d{3,4}$/.test(e));if(!t)return;let n=t.slice(4);return`${n[0]}.${n[1]}.${n.slice(2)}`}var st=new Set([`InlineTextBox`]);function ct(e){let t=new Map,n=e.documents[0];if(!n)return t;let r=t=>t===void 0||t<0?``:e.strings[t]??``,{nodes:i,layout:a,textBoxes:o}=n,s=i.backendNodeId??[],c=new Set(i.isClickable?.index??[]);s.forEach((e,n)=>{let a=i.attributes?.[n]??[],o=e=>{for(let t=0;t<a.length;t+=2)if(r(a[t])===e)return r(a[t+1])},s=r(i.nodeName?.[n]).toLowerCase();t.set(e,{tag:s,display:``,inputType:s===`input`?(o(`type`)??`text`).toLowerCase():void 0,current:o(`aria-current`),valueText:o(`aria-valuetext`),clickable:c.has(n)||void 0})});let l=new Map;a.nodeIndex.forEach((e,n)=>{l.set(e,n);let i=t.get(s[e]);if(!i)return;i.display=r(a.styles[n]?.[0]);let[,o=0,,c=0]=a.bounds[n]??[];i.top=o,i.bottom=o+c});let u=new Map;o.layoutIndex.forEach((e,t)=>{let[,n=0,,i=0]=o.bounds[t]??[],s=r(a.text[e]).slice(o.start[t],o.start[t]+o.length[t]),c=u.get(e)??[],l=c[c.length-1];l&&Math.abs(l.top-n)<1?l.text+=s:c.push({text:s,top:n,bottom:n+i}),u.set(e,c)});for(let[e,n]of l){let r=u.get(n),i=t.get(s[e]);i&&r?.length&&(i.lines=r)}return t}function lt(e){let t={};for(let{name:n,value:r}of e.properties??[]){let e=r.value;switch(n){case`checked`:case`pressed`:t[n]=String(e);break;case`expanded`:case`selected`:case`required`:case`disabled`:case`readonly`:case`focusable`:case`focused`:case`multiline`:case`modal`:t[n]=e===!0||e===`true`;break;case`level`:t.level=Number(e);break;case`invalid`:case`hasPopup`:case`editable`:case`live`:case`valuetext`:e!==void 0&&e!==``&&e!==`false`&&(t[n]=String(e));break;case`activedescendant`:t.activeDescendant=r.relatedNodes?.[0]?.backendDOMNodeId}}return t}function ut(e){return e==null?``:String(typeof e==`number`?Number.parseFloat(e.toPrecision(7)):e)}function dt(e){return e.name?.sources?.find(e=>e.value!==void 0&&!e.superseded)?.type??``}function ft(e,t,n){let r=new Map(e.map(e=>[e.nodeId,e])),i=new Map,a=null,o=e=>{let n={key:e.backendDOMNodeId===void 0?`a${e.nodeId}`:`b${e.backendDOMNodeId}`,backendId:e.backendDOMNodeId,role:e.role?.value??`generic`,name:String(e.name?.value??``).replace(/\s+/g,` `).trim(),nameFrom:dt(e),description:String(e.description?.value??``).replace(/\s+/g,` `).trim(),value:ut(e.value?.value),props:lt(e),children:[],dom:e.backendDOMNodeId===void 0?void 0:t.get(e.backendDOMNodeId)};return i.set(n.key,n),n.props.focused&&n.role!==`RootWebArea`&&(a=n),n},s=(e,t=[])=>{for(let n of t){let t=r.get(n);if(!t||st.has(t.role?.value??``))continue;if(t.ignored){s(e,t.childIds);continue}let i=o(t);i.parent=e,e.children.push(i),s(i,t.childIds)}},c=e[0];if(!c)throw Error(`Empty accessibility tree`);let l=o(c);s(l,c.childIds);let u=a;return u?.props.activeDescendant!==void 0&&(a=i.get(`b${u.props.activeDescendant}`)??u),{root:l,byKey:i,focused:a,...n}}var pt=e=>{let t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t};function mt(e){return e.role===`StaticText`?e.name:e.children.map(mt).join(``).replace(/\s+/g,` `).trim()}var ht=`(() => {
|
|
63
63
|
if (window.__ariawalkSR) return;
|
|
64
64
|
const sr = (window.__ariawalkSR = { mutations: 0, live: [], doc: Math.random().toString(36).slice(2) });
|
|
65
65
|
const LIVE = '[aria-live]:not([aria-live="off"]), [role=alert], [role=status], [role=log], output';
|
|
@@ -110,7 +110,7 @@ import{createRequire as e}from"node:module";import{spawn as t}from"node:child_pr
|
|
|
110
110
|
if (!el) return;
|
|
111
111
|
if (typeof el.click === 'function') el.click();
|
|
112
112
|
else el.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
|
|
113
|
-
}`)}async live(){return this.page.evaluate(()=>{let e=window.__ariawalkSR;if(!e)return[];let t=e.live;return e.live=[],t}).catch(()=>[])}async settle(){await this.page.waitForLoadState(`domcontentloaded`,{timeout:1e4}).catch(()=>{}),await et(this.page)}async call(e,t){let{object:n}=await this.cdp.send(`DOM.resolveNode`,{backendNodeId:e});n.objectId&&await this.cdp.send(`Runtime.callFunctionOn`,{objectId:n.objectId,functionDeclaration:t,awaitPromise:!1})}},_t=new Set(`banner.navigation.main.contentinfo.complementary.search.form.region.list.listitem.table.grid.treegrid.row.cell.gridcell.columnheader.rowheader.group.radiogroup.heading.link.button.checkbox.radio.switch.tab.tablist.tabpanel.menu.menubar.menuitem.menuitemcheckbox.menuitemradio.option.listbox.tree.treeitem.dialog.alertdialog.alert.article.blockquote.figure.toolbar.application.document.note.status.log.math.term.definition.emphasis.strong.mark.deletion.insertion`.split(`.`)),vt=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`slider`,`progressbar`,`meter`,`image`,`img`,`separator`,`scrollbar`,`Canvas`,`Video`,`Audio`,`Iframe`,`IframePresentational`,`PluginObject`,`Embed`]),yt=e=>{if(e.role===`StaticText`||e.role===`ListMarker`)return!1;let t=e.dom?.display;return!!t&&t!==`contents`&&t!==`none`&&!t.startsWith(`inline`)};function bt(e){return vt.has(e.role)?!0:e.children.length===0&&_t.has(e.role)?[`checkbox`,`radio`,`switch`,`button`,`link`,`menuitem`,`tab`,`option`,`treeitem`].includes(e.role):!1}var xt=e=>!!e.dom?.clickable&&[`generic`,`paragraph`,`Section`,`none`].includes(e.role)&&!!e.dom.tag&&![`html`,`body`].includes(e.dom.tag),St=e=>e.some(e=>e.kind===`text`||e.kind===`object`);function Ct(e){let t,n=e=>{(e.role===`dialog`||e.role===`alertdialog`)&&e.props.modal&&(t=e),e.children.forEach(n)};return n(e),t}function wt(e){let t=Ct(e),n=[],r=new Set,i=()=>r.add(n.length),a=e=>{let t=yt(e);if(t&&i(),e.role===`StaticText`){let t=e.name;if(t.trim()){let r=e.dom?.lines?.filter(e=>e.text.trim());r?.length?r.forEach((t,r)=>n.push({kind:`text`,node:e,text:t.text.replace(/\s+/g,` `).trim(),top:t.top,bottom:t.bottom,segment:r})):n.push({kind:`text`,node:e,text:t.trim(),segment:0})}}else if(e.role===`LineBreak`)i();else if(e.role===`ListMarker`)e.name.trim()&&n.push({kind:`text`,node:e,text:e.name.trim(),top:e.dom?.top,bottom:e.dom?.bottom,segment:0});else if(bt(e))n.push({kind:`object`,node:e,top:e.dom?.top,bottom:e.dom?.bottom});else if((_t.has(e.role)||xt(e))&&e.role!==`RootWebArea`){let t=n.length;n.push({kind:`start`,node:e}),e.children.forEach(a),!n.slice(t+1).some(e=>e.kind===`text`||e.kind===`object`&&(e.node.name||![`image`,`img`].includes(e.node.role)))&&e.name&&St(n.slice(t))&&(n.length=t+1,n.push({kind:`text`,node:e,text:e.name,top:e.dom?.top,bottom:e.dom?.bottom,segment:0})),St(n.slice(t))?n.push({kind:`end`,node:e}):e.name&&[`button`,`link`,`heading`,`tab`,`menuitem`,`option`,`checkbox`,`radio`,`switch`].includes(e.role)?(n.length=t,n.push({kind:`object`,node:e,top:e.dom?.top,bottom:e.dom?.bottom})):n.length=t}else e.children.forEach(a);t&&i()};return t?t.children.forEach(a):a(e),Tt(n,r)}function Tt(e,t){let n=[],r=[],i=null,a=-1,o,s,c=[],l=t=>{i.atoms.push(e[t]),r[t]=n.length-1};e.forEach((e,r)=>{if(e.kind===`start`||e.kind===`end`&&!i){c.push(r);return}if(e.kind===`end`){c.length?c.push(r):l(r);return}let{top:u,bottom:d}=e,f=u!==void 0&&d!==void 0&&d>u,p=!i;for(let e=a+1;!p&&e<=r;e++)p=t.has(e);!p&&f&&o!==void 0&&s!==void 0&&(p=u>=s-1||d<=o+1),p&&(i={atoms:[],first:c[0]??r,before:[],after:[]},n.push(i),o=s=void 0),c.forEach(l),c=[],l(r),a=r,f&&(o=o===void 0?u:Math.min(o,u),s=s===void 0?d:Math.max(s,d))}),i&&c.forEach(l);let u=[],d=[];e.forEach((e,t)=>{e.kind===`start`&&d.push(e.node),u[t]=[...d],e.kind===`end`&&d.splice(d.lastIndexOf(e.node),1)});for(let t of n){let n=u[t.first]??[];t.before=t.atoms[0]?.kind===`start`?n.slice(0,-1):n.slice();let r=t.first+t.atoms.length-1,i=e[r];t.after=i?.kind===`end`?(u[r]??[]).filter(e=>e!==i.node):(u[r]??[]).slice()}return{atoms:e,lines:n,lineOf:r,stackAt:u}}function Et(e,t){return e.atoms.findIndex(e=>e.node.key===t)}function Dt(e,t){for(let n=t;n;n=n.parent){let t=Et(e,n.key);if(t>=0)return t}return 0}var Ot={heading:`heading`,heading1:`heading at level 1`,heading2:`heading at level 2`,heading3:`heading at level 3`,heading4:`heading at level 4`,heading5:`heading at level 5`,heading6:`heading at level 6`,link:`link`,formField:`form field`,button:`button`,edit:`edit field`,checkbox:`check box`,combobox:`combo box`,radio:`radio button`,landmark:`landmark`,list:`list`,listItem:`list item`,table:`table`,graphic:`graphic`,separator:`separator`,blockquote:`block quote`,frame:`embedded object`},kt={roles:{link:`link`,button:`button`,toggleButton:`toggle button`,menuButton:`menu button`,textbox:`edit`,spinbutton:`spin button`,checkbox:`check box`,radio:`radio button`,switch:`switch`,combobox:`combo box`,listbox:`list`,heading:`heading`,image:`graphic`,list:`list`,table:`table`,treegrid:`tree view`,tablist:`tab control`,tab:`tab`,tabpanel:`property page`,dialog:`dialog`,alert:`alert`,group:`grouping`,region:`region`,menu:`menu`,menubar:`menu bar`,menuitem:`menu item`,menuitemcheckbox:`check menu item`,menuitemradio:`radio menu item`,slider:`slider`,progressbar:`progress bar`,separator:`separator`,article:`article`,figure:`figure`,blockquote:`block quote`,tree:`tree view`,treeitem:`tree view item`,toolbar:`tool bar`,math:`math`,application:`application`,tooltip:`tool tip`,meter:`meter`,note:`note`,cell:`cell`},landmarks:{banner:`banner`,navigation:`navigation`,main:`main`,contentinfo:`content info`,complementary:`complementary`,search:`search`,form:`form`},landmark:`landmark`,states:{focused:`focused`,linked:`linked`,unavailable:`unavailable`,invalid:`invalid entry`,required:`required`,editable:`editable`,readOnly:`read only`,protected:`protected`,on:`on`,off:`off`,checked:`checked`,notChecked:`not checked`,halfChecked:`half checked`,pressed:`pressed`,notPressed:`not pressed`,halfPressed:`half pressed`,selected:`selected`,expanded:`expanded`,collapsed:`collapsed`,subMenu:`sub Menu`,multiLine:`multi line`,clickable:`clickable`,current:{page:`current page`,step:`current step`,location:`current location`,date:`current date`,time:`current time`,true:`current`}},blank:`blank`,selected:e=>`selected ${e}`,level:e=>`level ${e}`,withItems:e=>`with ${e} ${e===1?`item`:`items`}`,withRowsAndColumns:(e,t)=>`with ${e} ${e===1?`row`:`rows`} and ${t} ${t===1?`column`:`columns`}`,row:e=>`row ${e}`,column:e=>`column ${e}`,position:(e,t)=>`${e} of ${t}`,outOf:e=>`out of ${e}`,noNext:Object.fromEntries(Object.entries(Ot).map(([e,t])=>[e,`no next ${t}`])),noPrevious:Object.fromEntries(Object.entries(Ot).map(([e,t])=>[e,`no previous ${t}`])),top:`top`,bottom:`bottom`,document:`document`,elementsList:`Elements List`,dialog:`dialog`,listKinds:{link:`links`,heading:`headings`,formField:`form fields`,button:`buttons`,landmark:`landmarks`},items:e=>`${e} ${e===1?`item`:`items`}`,textNotFound:e=>`text "${e}" not found`,notInTableCell:`not in a table cell`,edgeOfTable:`edge of table`,addressBar:`Address and search bar`,space:`space`,symbols:{"•":`bullet`,"◦":`white bullet`,"▪":`black square`},numberSign:`number`},At=e=>`Ingen nästa rubrik på nivå ${e}`,jt=e=>`Ingen föregående rubrik på nivå ${e}`,Mt={en:kt,sv:{roles:{link:`länk`,button:`knapp`,toggleButton:`växlingsknapp`,menuButton:`menyknapp`,textbox:`redigera`,spinbutton:`öka-minska knapp`,checkbox:`kryssruta`,radio:`radioknapp`,switch:`växlingsknapp`,combobox:`kombinationsruta`,listbox:`lista`,heading:`rubrik`,image:`grafik`,list:`lista`,table:`tabell`,treegrid:`trädvy`,tablist:`flikar`,tab:`flik`,tabpanel:`egenskapssida`,dialog:`dialog`,alert:`varning`,group:`gruppering`,region:`region`,menu:`meny`,menubar:`menyrad`,menuitem:`menyobjekt`,menuitemcheckbox:`menyval med bockmarkering`,menuitemradio:`menyval med radioknapp`,slider:`skjutreglage`,progressbar:`förloppsindikator`,separator:`separator`,article:`avsnitt`,figure:`figur`,blockquote:`blockcitat`,tree:`trädvy`,treeitem:`trädvy-element`,toolbar:`verktygsfält`,math:`matematik`,application:`applikation`,tooltip:`verktygstips`,meter:`meter`,note:`anteckning`,cell:`cell`},landmarks:{banner:`baner`,navigation:`navigering`,main:`huvudinnehåll`,contentinfo:`innehållsinfo`,complementary:`komplementär`,search:`sök`,form:`formulär`},landmark:`landmärke`,states:{focused:`fokuserad`,linked:`länkad`,unavailable:`otillgänglig`,invalid:`ogiltig inmatning`,required:`krävs`,editable:`redigerbar`,readOnly:`skrivskyddat`,protected:`skyddat`,on:`på`,off:`av`,checked:`kryssad`,notChecked:`inte kryssat`,halfChecked:`delvis kryssad`,pressed:`tryckt`,notPressed:`inte tryckt`,halfPressed:`delvis tryckt`,selected:`markerad`,expanded:`expanderat`,collapsed:`stängd`,subMenu:`undermeny`,multiLine:`flerrad`,clickable:`klickbar`,current:{page:`aktuell sida`,step:`aktuellt steg`,location:`aktuell position`,date:`aktuellt datum`,time:`aktuell tid`,true:`aktuell`}},blank:`tom`,selected:e=>`markerade ${e}`,level:e=>`nivå ${e}`,withItems:e=>`med ${e} objekt`,withRowsAndColumns:(e,t)=>`med ${e} ${e===1?`rad`:`rader`} och ${t} ${t===1?`kolumn`:`kolumner`}`,row:e=>`rad ${e}`,column:e=>`kolumn ${e}`,position:(e,t)=>`${e} av ${t}`,outOf:e=>`lämnar ${e}`,noNext:{heading:`ingen nästa rubrik`,heading1:At(1),heading2:At(2),heading3:At(3),heading4:At(4),heading5:At(5),heading6:At(6),link:`ingen nästa länk`,formField:`inget nästa formulärfält`,button:`ingen nästa knapp`,edit:`inget nästa textfält`,checkbox:`ingen nästa kryssruta`,combobox:`ingen nästa kombinationsruta`,radio:`ingen nästa radioknapp`,landmark:`inget nästa landmärke`,list:`ingen nästa lista`,listItem:`inget nästa listobjekt`,table:`ingen nästa tabell`,graphic:`ingen nästa grafik`,separator:`ingen nästa separator`,blockquote:`inget nästa blockcitat`,frame:`inget nästa inbäddat objekt`},noPrevious:{heading:`ingen föregående rubrik`,heading1:jt(1),heading2:jt(2),heading3:jt(3),heading4:jt(4),heading5:jt(5),heading6:jt(6),link:`ingen föregående länk`,formField:`inget föregående formulärfält`,button:`ingen föregående knapp`,edit:`inget föregående textfält`,checkbox:`ingen föregående kryssruta`,combobox:`ingen föregående kombinationsruta`,radio:`ingen föregående radioknapp`,landmark:`ingen föregående landmärke`,list:`ingen föregående lista`,listItem:`inget föregående listobjekt`,table:`ingen föregående tabell`,graphic:`ingen föregående grafik`,separator:`ingen föregående separator`,blockquote:`inget föregående blockcitat`,frame:`inget föregående inbäddat objekt`},top:`Överst`,bottom:`Nederst`,document:`dokument`,elementsList:`Elementlista`,dialog:`dialog`,listKinds:{link:`länkar`,heading:`rubriker`,formField:`formulärfält`,button:`knappar`,landmark:`landmärken`},items:e=>`${e} objekt`,textNotFound:e=>`texten "${e}" hittas inte`,notInTableCell:`Inte i en tabellcell`,edgeOfTable:`Tabellkant`,addressBar:`Adress- och sökfält`,space:`mellanslag`,symbols:{"•":`listpunkt`,"◦":`vit listpunkt`,"▪":`svart fyrkant`},numberSign:`nummer`}},Nt=new Set([`banner`,`navigation`,`main`,`contentinfo`,`complementary`,`search`,`form`]),Pt={searchbox:`textbox`,img:`image`,grid:`table`,alertdialog:`alert`,radiogroup:`group`},Ft=new Set([...Nt,`region`,`list`,`table`,`grid`,`treegrid`,`group`,`radiogroup`,`dialog`,`alertdialog`,`tablist`,`tabpanel`,`menu`,`menubar`,`listbox`,`tree`,`toolbar`,`article`,`blockquote`,`figure`,`application`,`document`,`row`,`listitem`,`note`,`status`,`log`,`alert`]),It=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`listbox`,`option`,`tree`,`treeitem`,`slider`,`menu`,`menubar`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`gridcell`,`application`,`grid`,`treegrid`]),M=e=>[`textbox`,`searchbox`,`spinbutton`].includes(e.role)||e.role===`combobox`&&!!e.props.editable,Lt=e=>Nt.has(e.role)&&(e.role!==`form`||!!e.name),Rt=e=>e.props.valuetext??e.dom?.valueText??e.value;function zt(e){let t={radio:[`radiogroup`,`group`],tab:[`tablist`],menuitem:[`menu`,`menubar`],menuitemcheckbox:[`menu`,`menubar`],menuitemradio:[`menu`,`menubar`],option:[`listbox`],treeitem:[`tree`,`group`]}[e.role];if(!t)return;let n=e.parent;for(;n&&!t.includes(n.role);)n=n.parent;if(n??=e.parent,!n)return;let r=[],i=e.role.startsWith(`menuitem`),a=n=>{for(let o of n.children)o.role===e.role||i&&o.role.startsWith(`menuitem`)?r.push(o):t.includes(o.role)||a(o)};a(n);let o=r.indexOf(e);return o>=0&&r.length>1?{n:o+1,total:r.length}:void 0}function Bt(e){for(let t=e;t;t=t.parent)if([`table`,`grid`,`treegrid`].includes(t.role))return t}function Vt(e){let t=[],n=e=>e.children.forEach(e=>e.role===`row`?t.push(e):[`table`,`grid`,`treegrid`].includes(e.role)?null:n(e));return n(e),t}var Ht=new Set([`cell`,`gridcell`,`columnheader`,`rowheader`]);function Ut(e){let t=e.parent,n=Bt(e);if(!t||t.role!==`row`||!n)return;let r=Vt(n),i=t.children.filter(e=>Ht.has(e.role)).indexOf(e)+1,a=r[0]?.children.filter(e=>Ht.has(e.role))[i-1],o=a&&a!==e&&a.role===`columnheader`?mt(a):void 0;return{row:r.indexOf(t)+1,column:i,header:o}}function Wt(e,t){for(let n=e.parent;n;n=n.parent)if(n.role===t)return n}var Gt=new Set([`slider`,`progressbar`,`meter`,`scrollbar`]),Kt=new Set([`tabpanel`,`region`,`article`,`document`,`main`,`section`]),qt=e=>new Set(e.map(e=>e.key));function Jt(e){let t=e.states,n=t=>e.roles[Pt[t]??t]??``,r=t=>`${e.landmarks[t.role]} ${e.landmark}`,i=t=>[n(`heading`),e.level(t??2)],a=new Set([t.checked,t.notChecked,t.halfChecked,t.on,t.off,t.pressed,t.notPressed,t.halfPressed,t.expanded,t.collapsed,t.selected,t.unavailable]);function o(t){if(t.role===`button`){if(t.props.pressed!==void 0)return e.roles.toggleButton;if(t.props.hasPopup===`menu`||t.props.hasPopup===`true`)return e.roles.menuButton}return t.role===`region`&&!t.name?``:Lt(t)?r(t):n(t.role)}function s(e,n){let r=e.props,i=[];return n===`sayFocus`&&r.focused&&i.push(t.focused),n===`sayFocus`&&e.role===`link`&&i.push(t.linked),r.disabled&&i.push(t.unavailable),r.invalid&&r.invalid!==`false`&&i.push(t.invalid),r.required&&i.push(t.required),(e.role===`spinbutton`||e.role===`combobox`&&r.editable)&&i.push(t.editable),r.readonly&&M(e)&&i.push(t.readOnly),e.dom?.inputType===`password`&&i.push(t.protected),e.role===`switch`?i.push(r.checked===`true`?t.on:t.off):r.checked!==void 0&&i.push(r.checked===`true`?t.checked:r.checked===`mixed`?t.halfChecked:t.notChecked),r.pressed!==void 0&&i.push(r.pressed===`true`?t.pressed:r.pressed===`mixed`?t.halfPressed:t.notPressed),r.selected&&[`tab`,`option`,`treeitem`,`row`,`gridcell`].includes(e.role)&&i.push(t.selected),r.expanded!==void 0&&i.push(r.expanded?t.expanded:t.collapsed),e.role===`button`&&(r.hasPopup===`menu`||r.hasPopup===`true`)&&i.push(t.subMenu),e.dom?.current&&e.dom.current!==`false`&&i.push(t.current[e.dom.current]??t.current.true),r.multiline&&M(e)&&i.push(t.multiLine),n!==`focusMode`&&e.dom?.clickable&&!_t.has(e.role)&&!It.has(e.role)&&i.push(t.clickable),i}function c(t){let n=zt(t);return n&&e.position(n.n,n.total)}function l(t){let n=Vt(t),r=Math.max(0,...n.map(e=>e.children.filter(e=>Ht.has(e.role)).length));return e.withRowsAndColumns(n.length,r)}function u(i,a){let o=a===`focusMode`||a===`sayFocus`;if(Lt(i))return[i.name,r(i)].filter(Boolean);switch(i.role){case`region`:return i.name?[i.name,n(`region`)]:[];case`list`:return o?[n(`list`)]:[n(`list`),e.withItems(i.children.filter(e=>e.role===`listitem`).length)];case`listbox`:return o?[]:[i.name,n(`listbox`),e.withItems(i.children.filter(e=>e.role===`option`).length)].filter(Boolean);case`group`:case`radiogroup`:return a===`line`||!i.name?a===`line`?[n(`group`)]:[]:[i.name,n(`group`)];case`table`:case`grid`:case`treegrid`:{let e=i.dom?.clickable?[t.clickable]:[];return o?[i.name,n(`table`)].filter(Boolean):[...a===`line`?[]:[i.name].filter(Boolean),n(`table`),...e,l(i)]}case`dialog`:case`alertdialog`:return[i.name,n(i.role),i.description].filter(Boolean);case`tablist`:return a===`line`||a===`quicknav`?[]:[i.name,n(`tablist`)].filter(Boolean);case`heading`:return a===`focusMode`?[i.name,n(`heading`)].filter(Boolean):[];case`blockquote`:case`article`:case`figure`:case`toolbar`:case`tree`:return[i.name,n(i.role)].filter(Boolean);default:return[]}}function d(t){if(Lt(t))return[e.outOf(r(t))];switch(t.role){case`region`:return t.name?[e.outOf(n(`region`))]:[];case`list`:case`group`:case`radiogroup`:case`table`:case`grid`:case`treegrid`:case`dialog`:case`alertdialog`:case`blockquote`:case`article`:case`figure`:case`toolbar`:case`tree`:return[e.outOf(n(t.role))];default:return[]}}function f(t){if(Ht.has(t.role)){let n=Ut(t);return n?[e.row(n.row),n.header??``,e.column(n.column)]:[]}return t.role===`heading`?i(t.props.level):[o(t),...s(t,`line`)].filter(Boolean)}function p(t){return e.symbols[t.trim()]??t.replace(/#(?=\w)/g,`${e.numberSign} `)}function m(t,n){let r=p(Rt(t));return M(t)?t.dom?.inputType===`password`&&r?[`•`.repeat(Math.min(r.length,8))]:n===`focusBrowse`||n===`focusMode`||n===`sayFocus`?r?[e.selected(r)]:[e.blank]:r?[r]:[]:[`combobox`,`slider`,`progressbar`,`meter`,`scrollbar`].includes(t.role)&&r?[r]:[]}function h(r,a){if(Ht.has(r.role)){if(a===`sayFocus`)return[mt(r),e.roles.cell??`cell`,t.focused];let n=Ut(r);return[mt(r),...n?[e.row(n.row),n.header,e.column(n.column)]:[]].filter(e=>!!e)}if(r.role===`heading`){let e=r.children.length===1?r.children[0]:void 0;return e&&[`button`,`link`].includes(e.role)&&a===`quicknav`?h(e,a):[r.name,...i(r.props.level)]}if(r.role===`image`||r.role===`img`)return[r.name,n(`image`)].filter(Boolean);if(Kt.has(r.role)&&a!==`sayFocus`&&a!==`quicknav`)return[r.name,o(r),mt(r)].filter(Boolean);let l=(a===`focusMode`||a===`focusBrowse`)&&[`menuitem`,`option`].includes(r.role)?``:o(r),u=a===`focusBrowse`||a===`focusMode`||a===`sayFocus`,d=Gt.has(r.role)?m(r,a):[],f=[r.name,l,...d,...s(r,a),...u||a===`quicknav`?[r.description]:[],...d.length?[]:m(r,a)];if(u&&f.push(c(r)??``),a===`quicknav`||a===`focusBrowse`){let e=Wt(r,`heading`);e&&f.push(...i(e.props.level))}return f.filter(Boolean)}function g(e){if(e.role===`image`||e.role===`img`){if(!e.name)return[];let t=e.parent;return t&&[`link`,`button`].includes(t.role)&&mt(t)===``?[e.name]:[n(`image`),e.name].filter(Boolean)}return M(e)||[`slider`,`combobox`,`progressbar`,`meter`].includes(e.role)?[o(e),...s(e,`line`),...m(e,`line`)].filter(Boolean):e.role===`separator`?[n(`separator`)]:e.nameFrom===`relatedElement`?[e.name,o(e),...s(e,`line`)].filter(Boolean):[o(e),...s(e,`line`),e.name].filter(Boolean)}function _(e,t,n){let r=e.lines[t];if(!r)return[];let i=[],a=qt(n),o=r.atoms.filter(e=>e.kind===`start`).map(e=>e.node),s=qt([...r.before,...o]);for(let e of[...n].reverse())s.has(e.key)||i.push(...d(e));for(let e of r.before)a.has(e.key)||i.push(...Ft.has(e.role)?u(e,`line`):f(e));return r.atoms.forEach((e,t)=>{switch(e.kind){case`start`:Ft.has(e.node.role)?a.has(e.node.key)||i.push(...u(e.node,`line`)):Ht.has(e.node.role)&&a.has(e.node.key)||i.push(...f(e.node));break;case`end`:Ft.has(e.node.role)&&r.atoms.slice(t+1).some(e=>e.kind===`text`||e.kind===`object`)&&i.push(...d(e.node));break;case`text`:i.push(p(e.text));break;case`object`:i.push(...g(e.node))}}),i.filter(e=>e.trim())}function v(e,t,n,r=!1){let i=qt(t),a=[];for(let t=r?e:e.parent;t;t=t.parent)a.unshift(t);return a.filter(e=>!i.has(e.key)&&(Ft.has(e.role)||n===`focusMode`&&e.role===`heading`)).flatMap(e=>u(e,n))}function y(e,t,n){return[...v(e,t,n),...h(e,n)]}function b(e,t,n,r=!1){let i=new Set(s(e,n)),o=s(t,n).filter(e=>!i.has(e)&&a.has(e));return Rt(e)!==Rt(t)&&(r||!M(t))&&o.push(p(Rt(t))),o.filter(Boolean)}return{strings:e,roleText:o,states:s,position:c,containerSpeech:u,exitSpeech:d,speakText:p,objectSpeech:h,lineSpeech:_,enteredSpeech:v,arrivalSpeech:y,stateChangeSpeech:b}}var Yt=new Map;function Xt(e=`en`){let t=Yt.get(e);return t||Yt.set(e,t=Jt(Mt[e])),t}var{roleText:Zt,states:Qt,position:$t,containerSpeech:en,exitSpeech:tn,speakText:nn,objectSpeech:rn,lineSpeech:an,enteredSpeech:on,arrivalSpeech:sn,stateChangeSpeech:cn}=Jt(kt),ln=e=>Ft.has(e.role),un={heading:`H`,heading1:`1`,heading2:`2`,heading3:`3`,heading4:`4`,heading5:`5`,heading6:`6`,link:`K`,formField:`F`,button:`B`,edit:`E`,checkbox:`X`,combobox:`C`,radio:`R`,landmark:`D`,list:`L`,listItem:`I`,table:`T`,graphic:`G`,separator:`S`,blockquote:`Q`,frame:`M`},dn=new Set([`banner`,`navigation`,`main`,`contentinfo`,`complementary`,`search`]),fn=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`button`,`tab`,`treeitem`]);function pn(e,t){switch(e){case`heading`:return t.role===`heading`;case`heading1`:case`heading2`:case`heading3`:case`heading4`:case`heading5`:case`heading6`:return t.role===`heading`&&t.props.level===Number(e.slice(-1));case`link`:return t.role===`link`;case`formField`:return fn.has(t.role);case`button`:return t.role===`button`;case`edit`:return M(t);case`checkbox`:return t.role===`checkbox`;case`combobox`:return t.role===`combobox`;case`radio`:return t.role===`radio`;case`landmark`:return dn.has(t.role)||(t.role===`region`||t.role===`form`)&&!!t.name;case`list`:return t.role===`list`;case`listItem`:return t.role===`listitem`;case`table`:return[`table`,`grid`,`treegrid`].includes(t.role);case`graphic`:return t.role===`image`||t.role===`img`;case`separator`:return t.role===`separator`;case`blockquote`:return t.role===`blockquote`;case`frame`:return t.role===`Iframe`}}var mn={link:`link`,heading:`heading`,formField:`formField`,button:`button`,landmark:`landmark`},hn=(e,t)=>pn(mn[e],t);function gn(e){switch(e.type){case`nextLine`:return`Down Arrow`;case`prevLine`:return`Up Arrow`;case`readLine`:return`NVDA+Up Arrow`;case`sayAll`:return`NVDA+Down Arrow`;case`top`:return`Control+Home`;case`bottom`:return`Control+End`;case`next`:return un[e.kind];case`prev`:return`Shift+${un[e.kind]}`;case`tab`:return`Tab`;case`shiftTab`:return`Shift+Tab`;case`enter`:return`Enter`;case`space`:return`Space`;case`escape`:return`Escape`;case`toggleMode`:return`NVDA+Space`;case`sayFocus`:return`NVDA+Tab`;case`key`:return e.key.replace(/^Arrow(\w+)/,`$1 Arrow`);case`type`:return`typed "${e.text}"`;case`elementsList`:return`NVDA+F7 (${e.kind}s${e.filter?`, filter "${e.filter}"`:``})`;case`elementsListChoose`:return`Elements list: item ${e.index}, Enter`;case`find`:return`NVDA+Control+F "${e.text}", Enter`;case`tableMove`:return{nextRow:`Control+Alt+Down Arrow`,prevRow:`Control+Alt+Up Arrow`,nextColumn:`Control+Alt+Right Arrow`,prevColumn:`Control+Alt+Left Arrow`}[e.direction]}}var _n=.4,vn=e=>e.join(` `).split(/\s+/).filter(Boolean).length;function yn(e,t,n){return{keystrokes:e,words:t,seconds:Math.round((e*_n+t/5)*10)/10,via:n}}function bn(e,t){let n=new Set,r=[];return e.atoms.forEach((e,i)=>{(e.kind===`start`||e.kind===`object`)&&t(e.node)&&!n.has(e.node.key)&&(n.add(e.node.key),r.push(i))}),r}function xn(e,t,n,r,i){let a=r>n,o=t.filter(e=>a?e>n&&e<=r:e<n&&e>=r);return o.includes(r)?{presses:o.length,words:o.reduce((t,n)=>t+vn(i(e.atoms[n].node)),0)}:null}var Sn=[[`heading`,`H`],[`link`,`K`],[`button`,`B`],[`formField`,`F`],[`edit`,`E`],[`checkbox`,`X`],[`combobox`,`C`],[`radio`,`R`],[`landmark`,`D`],[`list`,`L`],[`table`,`T`],[`graphic`,`G`]],Cn=[{kind:`link`,key:``,label:e=>e.name},{kind:`heading`,key:`Alt+H`,label:e=>e.name},{kind:`formField`,key:`Alt+F`,label:e=>[e.name,Zt(e)].filter(Boolean).join(` `)},{kind:`button`,key:`Alt+B`,label:e=>e.name}];function wn(e,t,n){let r=e.lineOf[t]??0,i=e.lineOf[n]??0,a=i>=r?1:-1,o=0;for(let t=r+a;a>0?t<=i:t>=i;t+=a)o+=vn(an(e,t,[]));return{presses:Math.abs(i-r),words:o}}function Tn(e,t,n,r){let i=Dt(e,n);if(e.atoms[i]?.node.key!==n.key&&!e.atoms.some(e=>e.node.key===n.key))return null;if(i===t)return yn(0,0,`already there`);let a=[];for(let[r,o]of Sn){if(!pn(r,n))continue;let s=xn(e,bn(e,e=>pn(r,e)),t,i,e=>rn(e,`quicknav`));s&&a.push(yn(s.presses,s.words,`${i>t?``:`Shift+`}${o} ×${s.presses}`))}if(n.props.focusable){let n=bn(e,e=>!!e.props.focusable&&e.role!==`RootWebArea`),o=r?Dt(e,r):t,s=xn(e,n,o,i,e=>rn(e,`focusBrowse`));s&&a.push(yn(s.presses,s.words,`${i>o?`Tab`:`Shift+Tab`} ×${s.presses}`))}let o=t=>{let n=e.lines[e.lineOf[t]];return!!n&&n.atoms.slice(0,t-n.first).every(e=>e.kind===`start`)},s=wn(e,t,i);s.presses>0&&o(i)&&a.push(yn(s.presses,s.words,`${i>t?`Down`:`Up`} Arrow ×${s.presses}`));let c=bn(e,e=>e.role===`heading`),l=[...c].reverse().find(e=>e<=i);if(l!==void 0&&l!==i){let n=xn(e,c,t,l,e=>rn(e,`quicknav`));if(n){let r=wn(e,l,i);r.presses>0&&o(i)&&a.push(yn(n.presses+r.presses,n.words+r.words,`${l>t?``:`Shift+`}H ×${n.presses}, Down Arrow ×${r.presses}`))}}for(let t of Cn){if(!pn(t.kind,n)||!n.name)continue;let r=bn(e,e=>pn(t.kind,e)).map(t=>e.atoms[t].node),i=t.label(n).toLowerCase(),o=i;for(let e=2;e<=i.length;e++){let n=i.slice(0,e);if(r.filter(e=>t.label(e).toLowerCase().includes(n)).length===1){o=n;break}}let s=r.filter(e=>t.label(e).toLowerCase().includes(o)),c=Math.max(1,s.indexOf(n)+1),l=1+ +!!t.key+1+o.length+1+c+1,u=4+s.slice(0,c).reduce((e,n)=>e+t.label(n).split(/\s+/).length+3,0);a.push(yn(l,u,`elements list "${o}"`))}let u=mt(n).toLowerCase();if(u){let n=e.atoms.filter((e,n)=>n>t&&e.kind===`text`).map(e=>e.kind===`text`?e.text.toLowerCase():``),r=u;for(let e=3;e<=u.length;e++){let t=u.slice(0,e);if(n.findIndex(e=>e.includes(t))===n.findIndex(e=>e.includes(u))){r=t;break}}i>t&&a.push(yn(2+r.length+1,vn(an(e,e.lineOf[i],[])),`find "${r}"`))}return a.length?a.reduce((e,t)=>t.seconds<e.seconds?t:e):null}var En=new Set([`cell`,`gridcell`,`columnheader`,`rowheader`]),Dn=new Set([`link`,`button`,`checkbox`,`radio`,`switch`,`tab`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`treeitem`,`DisclosureTriangle`]),On={browse:`focusBrowse`,focus:`focusMode`},kn=class{port;options;mode=`browse`;manualMode=!1;page;buffer;cursor=0;context=[];mark=0;list=null;sp;t;constructor(e,t={}){this.port=e,this.options=t,this.sp=Xt(t.language),this.t=this.sp.strings}async attach(){await this.load(await this.port.snapshot()),this.mark=await this.port.mutations(),await this.port.live();let e=this.page.focused;e&&this.moveTo(Dt(this.buffer,e))}async announcePage(){return await this.load(await this.port.snapshot()),this.mark=await this.port.mutations(),await this.port.live(),{keys:`(page loaded)`,mode:this.mode,keystrokes:0,speech:this.pageSpeech(),events:[`page-load`]}}async execute(e){let t={keys:gn(e),mode:this.mode,speech:[],keystrokes:1};this.list&&e.type!==`elementsListChoose`&&(this.list=null,t.keystrokes++);let n=await this.port.live();switch(await this.refresh(t),t.speech.push(...An(n)),n.length&&Mn(t,`live`),e.type){case`nextLine`:case`prevLine`:this.mode===`focus`?await this.pageKey(t,e.type===`nextLine`?`ArrowDown`:`ArrowUp`):this.lineMove(t,e.type===`nextLine`?1:-1);break;case`readLine`:if(this.mode===`focus`&&this.page.focused){let e=this.page.focused;t.speech.push(M(e)?Rt(e)||`blank`:e.role===`slider`?`blank`:mt(e)||`blank`)}else t.speech.push(...this.sp.lineSpeech(this.buffer,this.lineIndex(),this.lineContext(this.lineIndex())));break;case`sayAll`:t.speech.push(...this.sayAll(this.lineIndex()));break;case`top`:case`bottom`:this.mode===`focus`?await this.pageKey(t,e.type===`top`?`Control+Home`:`Control+End`):this.jumpToLine(t,e.type===`top`?0:this.buffer.lines.length-1);break;case`next`:case`prev`:this.mode===`focus`?await this.typeKey(t,un[e.kind].toLowerCase()):this.quickNav(t,e.kind,e.type===`next`?1:-1);break;case`tab`:case`shiftTab`:await this.pageAction(t,()=>this.port.press(e.type===`tab`?`Tab`:`Shift+Tab`),{tabbing:!0});break;case`enter`:case`space`:this.mode===`browse`?await this.activate(t):(e.type===`space`&&this.page.focused&&M(this.page.focused)&&t.speech.push(this.t.space),await this.pageAction(t,()=>this.port.press(e.type===`enter`?`Enter`:`Space`)));break;case`escape`:{let e=t.speech.length;await this.pageAction(t,()=>this.port.press(`Escape`)),this.mode===`focus`&&t.speech.length===e&&!t.events?.length&&this.setMode(t,`browse`);break}case`toggleMode`:this.setMode(t,this.mode===`browse`?`focus`:`browse`),this.manualMode=!0;break;case`sayFocus`:t.speech.push(...this.page.focused?this.sp.objectSpeech(this.page.focused,`sayFocus`):[this.page.title,this.t.document]);break;case`key`:this.mode===`focus`?await this.pageAction(t,()=>this.port.press(e.key),{valueKeys:!0}):e.key===`ArrowDown`||e.key===`ArrowUp`?this.lineMove(t,e.key===`ArrowDown`?1:-1):jn(t,`${t.keys} in browse mode only moves within the line; nothing reached the page`);break;case`type`:t.keystrokes=Math.max(1,e.text.length),this.mode===`focus`?(t.speech.push(e.text),await this.pageAction(t,()=>this.port.type(e.text))):jn(t,`In browse mode letters are navigation keys, so nothing was typed. Press Enter on the field first.`);break;case`elementsList`:this.openList(t,e.kind,e.filter);break;case`elementsListChoose`:await this.chooseFromList(t,e.index);break;case`find`:t.keystrokes=3+e.text.length,this.find(t,e.text);break;case`tableMove`:this.tableMove(t,e.direction)}return t.speech=t.speech.filter(e=>e.trim()),t}currentLine(){return this.sp.lineSpeech(this.buffer,this.lineIndex(),this.lineContext(this.lineIndex()))}position(){return this.mode===`focus`&&this.page.focused?this.sp.objectSpeech(this.page.focused,`focusMode`):this.currentLine()}currentTarget(){return this.mode===`focus`?this.page.focused:this.targetAtCursor()??null}openListItems(){return this.list?.items??null}async aside(e){let t=this.page.focused?.backendId;try{return await e()}finally{t===void 0?await this.port.blur().catch(()=>{}):await this.port.focus(t).catch(()=>{});let e=await this.port.snapshot();this.mark=await this.port.mutations(),await this.port.live(),e.documentId===this.page.documentId?this.rebuild(e,{keys:``,mode:this.mode,speech:[],keystrokes:0}):await this.load(e)}}targetAtCursor(){for(let e=this.buffer.atoms[this.cursor]?.node;e&&e.role!==`RootWebArea`;e=e.parent)if(It.has(e.role)||Dn.has(e.role)||e.role===`LabelText`||e.dom?.clickable||e.props.focusable&&e.role!==`StaticText`)return e}cursorIndex(){return this.cursor}lineIndex(){return this.buffer.lineOf[this.cursor]??0}lineContext(e){let t=this.buffer.lines[e];return t?[...t.before,...t.atoms.filter(e=>e.kind===`start`).map(e=>e.node)]:[]}moveTo(e){this.cursor=Math.max(0,Math.min(e,this.buffer.atoms.length-1)),this.context=this.buffer.stackAt[this.cursor]??[]}lineMove(e,t){let n=this.lineIndex(),r=n+t;this.buffer.lines[r]?(e.speech.push(...this.sp.lineSpeech(this.buffer,r,this.lineContext(n))),this.cursor=this.buffer.lines[r].first,this.context=this.lineContext(r)):(e.speech.push(t>0?this.t.bottom:this.t.top),e.boundary=!0)}jumpToLine(e,t){this.buffer.lines[t]&&(e.speech.push(...this.sp.lineSpeech(this.buffer,t,[])),this.cursor=this.buffer.lines[t].first,this.context=this.lineContext(t))}sayAll(e){let t=this.options.sayAllLines??12,n=[],r=e>0?this.lineContext(e-1):[],i=e;for(let a=e;a<Math.min(this.buffer.lines.length,e+t);a++)n.push(...this.sp.lineSpeech(this.buffer,a,r)),r=this.lineContext(a),i=a;return this.buffer.lines[i]&&(this.cursor=this.buffer.lines[i].first,this.context=this.lineContext(i)),n}targets(e){let t=new Set,n=[];return this.buffer.atoms.forEach((r,i)=>{(r.kind===`start`||r.kind===`object`)&&e(r.node)&&!t.has(r.node.key)&&(t.add(r.node.key),n.push(i))}),n}quickNav(e,t,n){let r=this.targets(e=>pn(t,e)),i=new Set((this.buffer.stackAt[this.cursor]??[]).map(e=>e.key)),a=n>0?r.find(e=>e>this.cursor):[...r].reverse().find(e=>e<this.cursor&&!i.has(this.buffer.atoms[e].node.key));a===void 0?(e.speech.push(n>0?this.t.noNext[t]:this.t.noPrevious[t]),e.boundary=!0):e.speech.push(...this.arrive(a,`quicknav`))}arrive(e,t){let n=this.buffer.atoms[e],r=n.node,i;if(n.kind===`start`&&ln(r)&&![`listitem`,`row`].includes(r.role)){let n=this.buffer.stackAt[e]??[];i=[...this.sp.enteredSpeech(r,this.context,t,!0),...this.sp.lineSpeech(this.buffer,this.buffer.lineOf[e],n)]}else i=n.kind===`text`?this.sp.lineSpeech(this.buffer,this.buffer.lineOf[e],this.context):this.sp.arrivalSpeech(r,this.context,t);return this.moveTo(e),i}openList(e,t,n){let r=this.targets(e=>hn(t,e)).map(e=>this.buffer.atoms[e].node),i=e=>t===`formField`?[e.name,this.sp.roleText(e),...this.sp.states(e,`quicknav`)].filter(Boolean).join(` `):t===`landmark`?[this.sp.roleText(e).replace(` ${this.t.landmark}`,``),e.name].filter(Boolean).join(` `):e.name||`(unlabeled)`,a=n?.trim().toLowerCase(),o=a?r.filter(e=>i(e).toLowerCase().includes(a)):r,s=Math.min(o.length,10);e.keystrokes=1+(t===`link`?0:1)+(a?2+a.length:0)+s;let c=this.t.listKinds;e.speech.push(this.t.elementsList,this.t.dialog,c[t],this.t.items(o.length)),o.slice(0,s).forEach((t,n)=>e.speech.push(`${i(t)} ${this.t.position(n+1,o.length)}`)),o.length||jn(e,a?`No ${c[t]} contain "${n}".`:`This page has no ${c[t]}.`),this.list={items:o,read:s,kind:t}}async chooseFromList(e,t){let n=this.list;this.list=null;let r=n?.items[t-1];if(!n||!r){jn(e,n?`The elements list has no item ${t}.`:`The elements list is not open.`);return}e.keystrokes=Math.abs(t-n.read)+1;let i=Dt(this.buffer,r);n.kind===`link`||n.kind===`button`?(this.moveTo(i),await this.activate(e)):n.kind===`formField`&&r.backendId!==void 0&&r.props.focusable?await this.pageAction(e,()=>this.port.focus(r.backendId)):e.speech.push(...this.arrive(i,`quicknav`))}find(e,t){let n=t.trim().toLowerCase(),r=this.buffer.atoms.findIndex((e,t)=>t>this.cursor&&e.kind===`text`&&e.text.toLowerCase().includes(n));r<0||!n?(e.speech.push(this.t.textNotFound(t)),e.boundary=!0):e.speech.push(...this.arrive(r,`line`))}tableMove(e,t){let n=[...this.buffer.stackAt[this.cursor]??[]].reverse().find(e=>En.has(e.role)),r=n?.parent,i=r?.parent&&pt(r).find(e=>[`table`,`grid`,`treegrid`].includes(e.role));if(!n||!r||!i){e.speech.push(this.t.notInTableCell);return}let a=[],o=e=>e.children.forEach(e=>e.role===`row`?a.push(e):o(e));o(i);let s=e=>e.children.filter(e=>En.has(e.role)),c=a.indexOf(r),l=s(r).indexOf(n);t===`nextRow`&&c++,t===`prevRow`&&c--,t===`nextColumn`&&l++,t===`prevColumn`&&l--;let u=a[c]&&s(a[c])[l];if(!u){e.speech.push(this.t.edgeOfTable),e.boundary=!0;return}let d=Dt(this.buffer,u),f=Ut(u),p=this.buffer.stackAt[d]??[];e.speech.push(...f?[this.t.row(f.row),f.header??``,this.t.column(f.column)]:[]),e.speech.push(...this.sp.lineSpeech(this.buffer,this.buffer.lineOf[d],p)),this.moveTo(d)}async activate(e){let t=this.targetAtCursor();if(!t||t.backendId===void 0){jn(e,`Nothing here to activate.`);return}let n=t.backendId;if(It.has(t.role)&&(M(t)||t.role===`combobox`||t.role===`listbox`||t.role===`slider`)){let r=this.page.focused?.key===t.key;this.setMode(e,`focus`),r||await this.pageAction(e,()=>this.port.focus(n))}else await this.pageAction(e,async()=>{t.props.focusable&&await this.port.focus(n),await this.port.click(n)},{target:t})}async pageKey(e,t){await this.pageAction(e,()=>this.port.press(t))}async typeKey(e,t){e.speech.push(t),await this.pageAction(e,()=>this.port.type(t))}setMode(e,t){this.mode!==t&&(this.mode=t,jn(e,`${t} mode`))}async pageAction(e,t,{target:n,valueKeys:r=!1,tabbing:i=!1}={}){let a=this.page;await t(),await this.port.settle();let o=await this.port.live(),s=await this.port.snapshot(),c=await this.port.mutations(),l=c!==this.mark;if(this.mark=c,s.documentId!==a.documentId){await this.load(s),Mn(e,`page-load`),e.speech.push(...this.pageSpeech(),...An(o));return}let u=e.speech.length,d=a.focused;l?this.rebuild(s,e):this.page=s;let f=s.focused,p=n?s.byKey.get(n.key):void 0,m=f?.key===d?.key||f?.key===n?.key,h=n&&p&&m?this.sp.stateChangeSpeech(n,p,On[this.mode]):[];e.speech.push(...h);let g=!!n&&f?.key===n.key&&!h.length;if(f?.key!==d?.key&&!g){if(!f)i?(e.speech.push(this.t.addressBar,this.t.roles.textbox),jn(e,`Focus left the page for the browser toolbar; Tab again to come back to the page.`)):d&&Mn(e,`focus-lost`);else{this.manualMode||this.setMode(e,It.has(f.role)?`focus`:`browse`);let t=On[this.mode],n=this.mode===`focus`&&d?pt(d).reverse():this.context;e.speech.push(...this.sp.enteredSpeech(f,n,t),...this.sp.objectSpeech(f,t)),this.moveTo(Dt(this.buffer,f))}}else f&&d&&f.key!==n?.key&&e.speech.push(...this.sp.stateChangeSpeech(d,f,On[this.mode],r));e.speech.push(...An(o)),o.length&&Mn(e,`live`),l&&e.speech.length===u&&Mn(e,`silent-change`)}async refresh(e){let t=await this.port.mutations();if(t===this.mark)return;this.mark=t;let n=await this.port.snapshot();n.documentId===this.page.documentId?this.rebuild(n,e):(await this.load(n),Mn(e,`page-load`),e.speech.push(...this.pageSpeech()))}async load(e){this.page=e,this.buffer=wt(e.root),this.mode=`browse`,this.manualMode=!1,this.list=null,this.moveTo(0)}pageSpeech(){let e=[this.page.title],t=this.page.focused;if(t){this.mode=It.has(t.role)?`focus`:`browse`;let n=On[this.mode];e.push(...this.sp.enteredSpeech(t,[],n),...this.sp.objectSpeech(t,n)),this.moveTo(Dt(this.buffer,t))}else e.push(...this.sayAll(0));return e.filter(Boolean)}rebuild(e,t){let n=this.buffer,r=n.atoms[this.cursor];if(this.page=e,this.buffer=wt(e.root),!r)return this.moveTo(0);let i=this.buffer.atoms.findIndex(e=>e.node.key===r.node.key&&e.kind===r.kind&&(e.kind!==`text`||r.kind!==`text`||e.segment===r.segment));if(i>=0)return this.moveTo(i);for(let e=this.cursor-1;e>=0;e--){let r=this.buffer.atoms.findIndex(t=>t.node.key===n.atoms[e].node.key);if(r>=0){this.moveTo(r),Mn(t,`cursor-reset`);return}}this.moveTo(0),Mn(t,`cursor-reset`)}};function An(e){return e.flatMap(e=>e.role===`alert`?[`alert`,e.text]:[e.text])}function jn(e,t){(e.notes??=[]).push(t)}function Mn(e,t){let n=e.events??=[];n.includes(t)||n.push(t)}var N=(e,t,n)=>({describe:`${n===`next`?``:`Shift+`}${Nn[e]}: ${n} ${t}`,mode:`browse`}),Nn={heading:`H`,link:`K`,formField:`F`,button:`B`,edit:`E`,checkbox:`X`,combobox:`C`,radio:`R`,landmark:`D`,list:`L`,listItem:`I`,table:`T`,graphic:`G`},Pn={next_line:{describe:`Down Arrow: read the next line`,mode:`browse`},previous_line:{describe:`Up Arrow: read the previous line`,mode:`browse`},read_current_line:{describe:`NVDA+Up Arrow: repeat the current line`,mode:`browse`},say_all:{describe:`NVDA+Down Arrow: read on from here (about a dozen lines)`,mode:`browse`},top_of_page:{describe:`Control+Home: go to the top of the page`,mode:`browse`},next_heading:N(`heading`,`heading`,`next`),previous_heading:N(`heading`,`heading`,`previous`),next_link:N(`link`,`link`,`next`),previous_link:N(`link`,`link`,`previous`),next_form_field:N(`formField`,`form field (edit, button, check box, combo box…)`,`next`),previous_form_field:N(`formField`,`form field`,`previous`),next_button:N(`button`,`button`,`next`),previous_button:N(`button`,`button`,`previous`),next_edit_field:N(`edit`,`edit field`,`next`),previous_edit_field:N(`edit`,`edit field`,`previous`),next_checkbox:N(`checkbox`,`check box`,`next`),next_combo_box:N(`combobox`,`combo box`,`next`),next_radio_button:N(`radio`,`radio button`,`next`),next_landmark:N(`landmark`,`landmark (banner, navigation, main…)`,`next`),previous_landmark:N(`landmark`,`landmark`,`previous`),next_list:N(`list`,`list`,`next`),next_list_item:N(`listItem`,`list item`,`next`),next_table:N(`table`,`table`,`next`),next_graphic:N(`graphic`,`graphic`,`next`),tab:{describe:`Tab: move focus to the next focusable control`},shift_tab:{describe:`Shift+Tab: move focus to the previous focusable control`},enter:{describe:`Enter: activate the link or button you are on; on an edit field or combo box, start typing (focus mode)`},space:{describe:`Space: activate or toggle (check boxes, radio buttons, buttons)`},escape:{describe:`Escape: close a menu or dialog; in focus mode, go back to browse mode`},toggle_mode:{describe:`NVDA+Space: switch between browse mode and focus mode`},report_focus:{describe:`NVDA+Tab: say what has keyboard focus`},arrow_down:{describe:`Down Arrow in focus mode: next option in a list, combo box, menu or radio group`,mode:`focus`},arrow_up:{describe:`Up Arrow in focus mode: previous option`,mode:`focus`},arrow_right:{describe:`Right Arrow in focus mode: next tab, radio button or menu`,mode:`focus`},arrow_left:{describe:`Left Arrow in focus mode: previous tab, radio button or menu`,mode:`focus`},home:{describe:`Home in focus mode: first option`,mode:`focus`},end:{describe:`End in focus mode: last option`,mode:`focus`},type:{describe:`Type text into the focused edit field (focus mode). Set text.`,mode:`focus`},elements_list:{describe:`NVDA+F7: list the links, headings, form fields, buttons or landmarks, optionally filtered. Set list, and text to filter.`,mode:`browse`},elements_list_choose:{describe:`In the open elements list, go to item number index (links and buttons are activated).`,mode:`browse`},find:{describe:`NVDA+Control+F: find text on the page, searching forward from where you are (text above you is not found). Set text.`,mode:`browse`},table_next_row:{describe:`Control+Alt+Down Arrow: same column, next row`,mode:`browse`},table_previous_row:{describe:`Control+Alt+Up Arrow: same column, previous row`,mode:`browse`},table_next_column:{describe:`Control+Alt+Right Arrow: next cell in the row`,mode:`browse`},table_previous_column:{describe:`Control+Alt+Left Arrow: previous cell in the row`,mode:`browse`}};Object.keys(Pn);var Fn=new Set([`enter`,`space`,`type`,`arrow_down`,`arrow_up`,`arrow_left`,`arrow_right`,`home`,`end`,`escape`]);function In(e){let t=(e,t)=>e===`next`?{type:`next`,kind:t}:{type:`prev`,kind:t},n=e=>({type:`key`,key:e});switch(e.command){case`next_line`:return{type:`nextLine`};case`previous_line`:return{type:`prevLine`};case`read_current_line`:return{type:`readLine`};case`say_all`:return{type:`sayAll`};case`top_of_page`:return{type:`top`};case`next_heading`:return t(`next`,`heading`);case`previous_heading`:return t(`prev`,`heading`);case`next_link`:return t(`next`,`link`);case`previous_link`:return t(`prev`,`link`);case`next_form_field`:return t(`next`,`formField`);case`previous_form_field`:return t(`prev`,`formField`);case`next_button`:return t(`next`,`button`);case`previous_button`:return t(`prev`,`button`);case`next_edit_field`:return t(`next`,`edit`);case`previous_edit_field`:return t(`prev`,`edit`);case`next_checkbox`:return t(`next`,`checkbox`);case`next_combo_box`:return t(`next`,`combobox`);case`next_radio_button`:return t(`next`,`radio`);case`next_landmark`:return t(`next`,`landmark`);case`previous_landmark`:return t(`prev`,`landmark`);case`next_list`:return t(`next`,`list`);case`next_list_item`:return t(`next`,`listItem`);case`next_table`:return t(`next`,`table`);case`next_graphic`:return t(`next`,`graphic`);case`tab`:return{type:`tab`};case`shift_tab`:return{type:`shiftTab`};case`enter`:return{type:`enter`};case`space`:return{type:`space`};case`escape`:return{type:`escape`};case`toggle_mode`:return{type:`toggleMode`};case`report_focus`:return{type:`sayFocus`};case`arrow_down`:return n(`ArrowDown`);case`arrow_up`:return n(`ArrowUp`);case`arrow_right`:return n(`ArrowRight`);case`arrow_left`:return n(`ArrowLeft`);case`home`:return n(`Home`);case`end`:return n(`End`);case`type`:return e.text?{type:`type`,text:e.text}:{rejected:`type needs the text to type.`};case`elements_list`:return e.list?{type:`elementsList`,kind:e.list,filter:e.text||void 0}:{rejected:`elements_list needs list (link, heading, formField, button or landmark).`};case`elements_list_choose`:return e.index?{type:`elementsListChoose`,index:e.index}:{rejected:`elements_list_choose needs the item number in index.`};case`find`:return e.text?{type:`find`,text:e.text}:{rejected:`find needs the text to look for.`};case`table_next_row`:return{type:`tableMove`,direction:`nextRow`};case`table_previous_row`:return{type:`tableMove`,direction:`prevRow`};case`table_next_column`:return{type:`tableMove`,direction:`nextColumn`};case`table_previous_column`:return{type:`tableMove`,direction:`prevColumn`}}}var Ln=25,Rn=new Set([`enter`,`space`,`type`,`escape`,`toggle_mode`,`report_focus`,`say_all`,`top_of_page`,`elements_list`,`elements_list_choose`,`find`,`read_current_line`]);function zn(e){let t=e.position().join(`, `),n=e.mode===`browse`?e.buffer.atoms[e.cursorIndex()]?.node:void 0;if(!n)return t;let r=e.sp.objectSpeech(n,`quicknav`).join(`, `);return r&&r!==t?`${r} (on the line “${t}”)`:t}var Bn=e=>e.toLowerCase().replace(/[\u2010-\u2015\u2212]/g,`-`).replace(/\s+/g,` `).trim(),Vn=/has been closed|Target closed|disconnected|Browser closed/i;function Hn(){return{pages:[],axe:[],journey:{actions:[],keystrokes:0,wordsHeard:0,silentChanges:0,focusLost:0,cursorResets:0},snapshots:new Map,transcript:[]}}async function Un(e,t){let n=Hn(),r=!1,i={...t.sink,stepStarted:e=>(r=!0,t.sink.stepStarted(e))},a=await qn(e,{...t,sink:i},n);a.outcome===`error`&&!r&&!e.signal?.aborted&&Vn.test(a.error??``)&&(Object.assign(n,Hn()),a=await qn(e,{...t,sink:i},n));let o=Pe({outcome:a.outcome,pages:n.pages,axe:n.axe,journey:n.journey});return{...a,scores:o,pageSnapshots:[...n.snapshots.values()],transcript:n.transcript}}function Wn(e,t){let n=e;for(let e of t)e.isSecret&&e.value.length>=3&&(n=n.split(e.value).join(`••••`));return n}function Gn(e){let t=[];for(let n of e.byKey.values())n.props.focusable&&n.role!==`RootWebArea`&&t.push(`${n.role}|${n.name}`);return`${e.documentId}#${t.sort().join(`;`)}`}var Kn=e=>e.split(/\s+/).filter(Boolean).length;async function qn(e,t,n){let{engine:r,sink:i,signal:a}={...t,signal:e.signal},o,s=0,c=(e,t,n)=>Qn(e,t,n,a),l=()=>({outcome:`cancelled`,summary:$n(a),steps:s}),u=t=>Wn(t,e.testData),d=[],f=[],p=[],m=(e,t)=>{let r=u(t.speech.join(`, `)),i={keys:u(t.keys),mode:t.mode,speech:r,notes:t.notes,events:t.events,boundary:t.boundary},a=t.events?.includes(`page-load`)&&t.mode===`browse`&&r?[...t.notes??[],`reading stopped at the last thing said: everything before it is above you (Shift+ keys go back)`]:t.notes;return f.push({step:e,keys:i.keys,mode:t.mode,speech:r,notes:a}),n.transcript.push(i),n.journey.keystrokes+=t.keystrokes,n.journey.wordsHeard+=Kn(r),i};try{if(!e.isUrlAllowed(e.startUrl))return{outcome:`error`,error:`${e.startUrl} is not on a verified domain`,steps:0};o=await c(t.launchBrowser(),6e4,`Browser launch`);let h=await o.newPage({viewport:it}),g=[];await Yn(h,e.isUrlAllowed,e=>g.push(e));let _=await gt.attach(h),v=new kn(_,{language:e.speechLanguage});i.activity(`Opening ${e.startUrl}`),await h.goto(e.startUrl,{waitUntil:`domcontentloaded`,timeout:3e4}),await _.settle(),m(0,await c(v.announcePage(),6e4,`Screen reader`));let y=await c($e(h),3e4,`Accessibility snapshot`),b=y,ee=``,x={stops:[],mouseOnly:[],trapped:!1},te=new Set,ne=new Set,S=0,C=!1,w=null,re=new Set,ie=null,ae=!1,T=0;for(s=1;s<=e.maxSteps;s++){if(a?.aborted)return l();let o=new Zn(s),_=h.url(),oe=v.page.title;g.length&&=(d.push(`The page tried to leave the site under test (${g.join(`, `)}); that navigation was blocked.`),0);let se=Gn(v.page),ce=[],le=Promise.resolve();if(se!==ee){ee=se,i.activity(`Checking the page: tab order, focus and structure…`);let r=await o.time(`audit`,c(v.aside(async()=>{let t=await Xe(h),n=await Ze(h).catch(()=>[]),r=D(_),i=e.extendedVisualChecks&&!ne.has(r)?(ne.add(r),await at(h,s).catch(()=>null)):null;return{stops:t.stops,trapped:t.trapped,mouseOnly:n,extended:i}}),12e4,`Page audit`));x=r,r.extended&&(n.axe.push(...r.extended.stats),await i.findings(r.extended.findings)),ce=r.stops,await i.findings([...fe(r.stops,r.trapped,s,_),...pe(r.mouseOnly,s,_)]),n.pages.push({page:D(_),stops:r.stops,mouseOnlyControls:r.mouseOnly.length,trapped:r.trapped}),b=await c($e(h),3e4,`Accessibility snapshot`),n.snapshots.set(D(_),{page:D(_),url:_,title:oe,snapshot:u(b)}),le=o.time(`sideWork`,(async()=>{let e=await Xn(h,s,t);e&&await i.stepUpdated(s,{screenshotKey:e});let r=await c(nt(h,s,te),9e4,`axe-core`).catch(()=>null);r&&(n.axe.push(...r.stats),await i.findings(r.findings))})())}await i.stepStarted({n:s,pageUrl:_,pageTitle:oe,tabStops:ce,narration:`Listening and deciding…`}),i.activity(`Deciding the next key press…`);let ue=v.page.focused,de={task:e.task,testData:e.testData,pageTitle:oe,mode:v.mode,heard:f,position:u(zn(v)),focus:ue?u(v.sp.objectSpeech(ue,`sayFocus`).join(`, `)):``,focusIsEditable:!!ue&&M(ue),openList:v.openListItems()?.map(e=>u([e.name,v.sp.objectSpeech(e,`quicknav`)[1]].filter(Boolean).join(` `))),language:e.speechLanguage??`en`,history:d,pageText:b},E=await o.time(`decide`,c(r.decide(de),18e4,`Decision`));await le;let O=`you have not heard any confirmation since you started acting on the page`;if(E.goalReached&&C&&Le(E.evidence,p)){let e=await c($e(h),3e4,`Accessibility snapshot`);if(O=`that text was already on the page before you acted, or is a control label`,Ie(E.evidence,e,y)){i.activity(`Verifying the task was completed…`);let t=await o.time(`verify`,c(r.verifyCompletion({...de,pageText:e},E.evidence),18e4,`Completion check`));if(o.log(),t.confirmed)return await i.stepUpdated(s,{decision:E,narration:`Task completed with a screen reader: heard “${E.evidence}”.`}),{outcome:`completed`,summary:`Completed with NVDA in ${s-1} steps. ${t.reason}`,steps:s};O=`a check of the page disagreed: ${t.reason}`}}if(E.goalReached&&(d.push(`${s}. You said the task was done${E.evidence?`, quoting "${E.evidence}"`:``}, but ${O}. Keep working on the task; if the site did something other than the task asked, choose wrong_result.`),!E.command)){await i.stepUpdated(s,{decision:E,narration:`Thought the task was done, but ${O}.`}),S++;continue}if(E.wrongResult){if(C&&Le(E.evidence,p))return await i.stepUpdated(s,{decision:E,narration:`The site did something other than the task: heard “${E.evidence}”.`}),{outcome:`inconclusive`,summary:`The site didn't do what the task asked: heard “${E.evidence}”. ${E.reason??``}`.trim(),steps:s};S++,d.push(`${s}. You said the result was wrong, but the words you quoted weren't heard after you acted. Quote them exactly from <heard>, or keep working on the task.`),await i.stepUpdated(s,{decision:E,narration:`Thought the result was wrong, without proof; continuing.`});continue}if(!E.command){if(!(x.mouseOnly.length||x.trapped)&&S<4){S++,d.push(`${s}. You said you were stuck. Explore further before giving up: jump through headings, landmarks, form fields and buttons, read line by line, or open the elements list.`),await i.stepUpdated(s,{decision:E,narration:`Thought it was stuck; exploring further.`});continue}return await i.stepUpdated(s,{decision:E,narration:`No way forward with the screen reader.`}),await i.findings([me(E.reason??`Nothing a screen reader user can reach moves the task forward.`,s,_,x.mouseOnly,x.trapped)]),{outcome:`blocked`,summary:`Blocked at step ${s} on ${_}.`,steps:s}}let ge;if(E.command===`type`){let t=Re(E,e.testData,e.task,{editable:!!ue&&(M(ue)||ue.role===`combobox`)&&v.mode===`focus`,spoken:de.focus});if(`rejected`in t){S++,d.push(`${s}. Rejected your choice: ${t.rejected}`),await i.stepUpdated(s,{decision:E,narration:`Skipped: ${t.rejected}`});continue}ge={text:t.value,display:t.display}}let _e=In({command:E.command,text:ge?.text??E.text,index:E.index,list:E.list});if(`rejected`in _e){S++,d.push(`${s}. Rejected your choice: ${_e.rejected}`),await i.stepUpdated(s,{decision:E,narration:`Skipped: ${_e.rejected}`});continue}let ve=[`enter`,`space`,`type`,`elements_list_choose`].includes(E.command),k=ve?E.command===`elements_list_choose`?v.openListItems()?.[(E.index??1)-1]:v.currentTarget():null;k??=null;let ye=k&&`${v.page.documentId}#${k.key}`;if(k&&ye&&!re.has(ye)){re.add(ye);let e=w?.documentId===v.page.documentId?v.buffer.atoms.findIndex(e=>e.node.key===w.key):0,t=Tn(v.buffer,Math.max(0,e),k,w?v.page.focused:null);n.journey.actions.push({cheapest:t&&{keystrokes:t.keystrokes,words:t.words,seconds:t.seconds}})}i.activity(E.reason??`Pressing keys…`);let be=!Rn.has(E.command),xe=be&&E.until?.trim()?Bn(E.until):void 0,Se=be?Math.max(1,Math.min(Ln,E.repeat??(xe?Ln:1))):1,Ce=v.buffer.atoms[v.cursorIndex()]?.node,we=_e.type===`next`||_e.type===`prev`?_e.kind:null,Te=Ce&&we&&pn(we,Ce)?Bn(u(v.sp.objectSpeech(Ce,`quicknav`).join(` `))):``,A=!!xe&&!!Te&&Te.includes(xe)&&!ae;if(ae=A,A){d.push(`${s}. You are already on "${E.until}" (${de.position}): act on it now. To reach a different one, set until to words only that one has.`),await i.stepUpdated(s,{decision:E,narration:`Already on “${u(E.until)}”; didn't move.`});continue}let j=[],Ee=0,De=new Set(f.slice(-10).map(e=>e.speech));await o.time(`act`,c((async()=>{for(let e=0;e<Se&&!a?.aborted;e++){let e=await v.execute(_e);if(Ee++,j.push(m(s,e)),xe&&Bn(e.speech.join(` `)).includes(xe)||e.boundary)break}})(),12e4,`Screen reader`)),Fn.has(E.command)&&(C=!0),C&&p.push(...j.map(e=>e.speech));let Oe=k?u(k.name||k.role):void 0;for(let e of j)for(let t of e.events??[])t===`silent-change`&&(E.command===`enter`||E.command===`space`)?(n.journey.silentChanges++,await i.findings([he(`silent-change`,e.keys,Oe,s,_)])):t===`focus-lost`&&ve?(n.journey.focusLost++,await i.findings([he(`focus-lost`,e.keys,Oe,s,_)])):t===`cursor-reset`&&Fn.has(E.command)&&!(ve&&e.events?.includes(`focus-lost`))&&(n.journey.cursorResets++,await i.findings([he(`cursor-reset`,e.keys,Oe,s,_)]));k&&(w={documentId:v.page.documentId,key:k.key});let ke=[...j].reverse().find(e=>e.speech)?.speech??``,Ae=ze(j[0]?.keys??E.command,Ee,ke,ge?.display),je=j.flatMap(e=>e.notes??[]);if(j.at(-1)?.boundary&&je.push(`you are past the last one in that direction: go back the other way instead of pressing it again`),xe&&!Bn(j.at(-1)?.speech??``).includes(xe)&&je.push(`did not hear "${E.until}" on the way`),T=be&&Ee===1&&!xe&&E.command===ie?T+1:0,ie=E.command,T>=1&&je.push(`you pressed ${E.command} one item at a time ${T+1} times: set until to what you are listening for and it keeps pressing for you`),ve&&!ke&&j.some(e=>e.events?.includes(`silent-change`))&&je.push(`nothing was announced, but the page changed: find out what changed (read on, jump to the next heading or form field)`),d.push(`${s}. ${Ae}${je.length?` (${[...new Set(je)].join(`; `)})`:``}`),await i.stepUpdated(s,{decision:E,narration:Ae,action:E.command,targetRole:k?.role,targetName:k?u(k.name):void 0,typedValue:ge?.display,heard:j,keystrokes:j.reduce((e,t)=>e+Jn(t,_e.type===`type`?ge?.text:void 0),0)}),i.activity(Ae),S=j.some(e=>e.speech&&!De.has(e.speech)||e.events?.length)?0:S+1,S>=4&&(x.mouseOnly.length||x.trapped))return await i.findings([me(`No progress in ${S} steps: nothing a screen reader user can reach moves the task forward.`,s,_,x.mouseOnly,x.trapped)]),{outcome:`blocked`,summary:`Blocked at step ${s} on ${_}.`,steps:s};if(S>=4)return{outcome:`inconclusive`,summary:`Stopped after ${S} steps in a row made no progress. This may be a screen reader problem or the agent misreading the page: review the steps.`,steps:s};o.log()}return{outcome:`inconclusive`,summary:`Used all ${e.maxSteps} steps without confirming the task was done. Review the steps to see where it went wrong.`,steps:e.maxSteps}}catch(e){return a?.aborted?l():{outcome:`error`,error:e instanceof Error?e.message:String(e),steps:s}}finally{await o?.close().catch(()=>{})}}function Jn(e,t){return t!==void 0&&e.keys.startsWith(`typed`)?Math.max(1,t.length):/^NVDA\+F7/.test(e.keys)||/^Elements list/.test(e.keys)||/^NVDA\+Control\+F/.test(e.keys)?3:1}async function Yn(e,t,n){await e.route(`**/*`,async r=>{let i=r.request();return i.isNavigationRequest()&&i.frame()===e.mainFrame()&&!t(i.url())?(n(i.url()),r.abort(`blockedbyclient`)):r.continue()})}async function Xn(e,t,n){try{return await n.saveScreenshot(t,await e.screenshot({type:`jpeg`,quality:60,timeout:15e3}))}catch{return}}var Zn=class{n;#e={};#t=Date.now();constructor(e){this.n=e}async time(e,t){let n=Date.now();try{return await t}finally{this.#e[e]=Date.now()-n}}log(){let e=Object.entries(this.#e).map(([e,t])=>`${e}=${t}`);console.log(`[run-timing] step=${this.n} total=${Date.now()-this.#t} ${e.join(` `)}`)}};function Qn(e,t,n,r){let i,a,o=new Promise((e,o)=>{i=setTimeout(()=>o(Error(`${n} timed out after ${t/1e3}s`)),t),r&&(a=()=>o(Error(`Run stopped`)),r.aborted?a():r.addEventListener(`abort`,a,{once:!0}))});return Promise.race([e,o]).finally(()=>{clearTimeout(i),a&&r?.removeEventListener(`abort`,a)})}function $n(e){return typeof e?.reason==`string`?e.reason:`Stopped before finishing.`}function er(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function tr(e,t=`|`){return e.map(e=>Tr(e)).join(t)}function nr(e,t){return typeof t==`bigint`?t.toString():t}var rr=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ir(e){return new rr(e)}function ar(e){return e==null}function or(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sr(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function cr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lr(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ur(e){return lr(e._zod.def)??e._zod.def.shape}function dr(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return cr(this,t,e),e},enumerable:!0,configurable:!0})}function fr(e,t,n){t in e?cr(e,t,n):e[t]=n}function pr(e,t,n,r){let i=ur(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?dr(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):fr(e,a,r?r(n.value,a):n.value))}}function mr(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?dr(e,n,()=>t[n]):fr(e,n,r.value))}}function P(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function hr(e){return JSON.stringify(e)}function gr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var _r=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function vr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yr=ir(()=>{if(R.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function br(e){if(vr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return vr(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function xr(e){return br(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Sr=new Set([`string`,`number`,`symbol`]);function Cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wr(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Tr(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Er(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Dr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Or={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function kr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return pr(i,e,Ar(e,t)),wr(e,P(n,{shape:i,checks:[]}))}function Ar(e,t){let n=ur(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function jr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ar(e,t)),a={};return pr(a,e,Reflect.ownKeys(ur(e)).filter(e=>!i.has(e))),wr(e,P(n,{shape:a,checks:[]}))}function Mr(e,t){if(!br(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ur(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return wr(e,P(e._zod.def,{shape:Nr(e,t)}))}function Nr(e,t){let n={};return pr(n,e,Reflect.ownKeys(ur(e))),mr(n,t),n}function Pr(e,t){if(!br(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return wr(e,P(e._zod.def,{shape:Nr(e,t)}))}function Fr(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return pr(n,e,Reflect.ownKeys(ur(e))),pr(n,t,Reflect.ownKeys(ur(t))),wr(e,P(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ir(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ar(t,n)):void 0,o={};return pr(o,t,Reflect.ownKeys(ur(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),wr(t,P(t._zod.def,{shape:o,checks:[]}))}function Lr(e,t,n){let r=n?new Set(Ar(t,n)):void 0,i={};return pr(i,t,Reflect.ownKeys(ur(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),wr(t,P(t._zod.def,{shape:i}))}function Rr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function zr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Br(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Vr(e){return typeof e==`string`?e:e?.message}function Hr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ur(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Vr(e.inst?._zod.def?.error?.(e))??Vr(a?.(e))??Vr(t?.error?.(e))??Vr(n.customError?.(e))??Vr(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Wr=/[\uD800-\uDBFF]/;function Gr(e){let t=e.length;if(!Wr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Kr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function qr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Jr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Yr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$r(e,n,r.value)}}function Xr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Zr(e,t,n){return Xr(e,t,n,!1)}function Qr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Xr(this,n,r(this))},set(e){Xr(this,n,e)}})}return t}function $r(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Xr(this,t,n.bind(this))},set(e){Xr(this,t,e)}})}function ei(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var ti,ni=!1,ri={configurable:!0,get(){ni=!0}};function I(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&ti!==e._zod?ti=void 0:(ti=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ri);let e=ni;ni=!1;try{let r=n(this);return ni?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ni||=e,r}catch(n){throw delete this[t],ni||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function ii(e,t,n,r){let i=ei(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ai=`~constantCatch`;function oi(e){let t=()=>e;return t[ai]=!0,t}var si,ci={value:void 0,enumerable:!1},li=`captureStackTrace`in Error?Error:null;function ui(e){let t=li;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return li=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function L(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ci.value=new a(r);try{Object.defineProperty(n,"_zod",ci)}finally{ci.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Yr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ui(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var di=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},fi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(si=globalThis).__zod_globalConfig??(si.__zod_globalConfig={});var R=globalThis.__zod_globalConfig;function pi(e){return e&&Object.assign(R,e),R}function mi(){let e=this._zod;return e.message??=JSON.stringify(e.def,nr,2),e.message}function hi(e){this._zod.message=e}var gi={get:mi,set:hi,enumerable:!0,configurable:!0},_i={value:void 0,enumerable:!1},vi=new WeakSet([Object.prototype,Error.prototype]),yi=(e,t)=>{e.name=`$ZodError`,_i.value=t,Object.defineProperty(e,"issues",_i),_i.value=void 0,Object.defineProperty(e,"message",gi);let n=Object.getPrototypeOf(e);vi.has(n)||(vi.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},bi=L(`$ZodError`,yi);L(`$ZodError`,yi,void 0,{Parent:Error});function xi(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Si(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?xi(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ci(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function wi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ti=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new di;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ur(e,o,pi())));throw _r(n,a?.callee??t),n}return s.value};return t},Ei=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ur(e,o,pi())));throw _r(n,a?.callee??t),n}return s.value};return t},Di=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new di;return a.issues.length?Oi(e,a.issues,i):{success:!0,data:a.value}};function Oi(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ur(e,n,pi()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ki=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Oi(e,a.issues,i):{success:!0,data:a.value}},Ai=Symbol.for(`zod.compile.invalid`),ji=Symbol.for(`zod.compile.fallback`),Mi=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ai)return!0;if(r.definite===!0&&n===void 0)return!1}return Ni(e,t,n)});function Ni(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ji]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new di;return a.issues.length===0}var Pi=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Fi=e=>{let t=Ti(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,wi(n,a))};return n},Ii=e=>{let t=Ti(e),n=(e,r,i,a)=>t(e,r,i,wi(n,a));return n},Li=e=>{let t=Ei(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,wi(n,a))};return n},Ri=e=>{let t=Ei(e),n=async(e,r,i,a)=>await t(e,r,i,wi(n,a));return n},zi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Di(e)(t,n,i)},Bi=e=>(t,n,r)=>Di(e)(t,n,r),Vi=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ki(e)(t,n,i)},Hi=e=>async(t,n,r)=>ki(e)(t,n,r),Ui=/^[cC][0-9a-z]{6,}$/,Wi=/^[0-9a-z]+$/,Gi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ki=/^[0-9a-vA-V]{20}$/,qi=/^[A-Za-z0-9]{27}$/,Ji=/^[a-zA-Z0-9_-]{21}$/;function Yi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Xi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$i=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ea=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function ta(){return new RegExp(ea,`u`)}var na=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ra=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ia=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,aa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sa=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ca=/^https?$/,la=/^\+[1-9]\d{6,14}$/,ua=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function da(e){return RegExp(`^${e}$`)}var fa=da(ua);function pa(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ma(e){return RegExp(`^${pa(e)}$`)}function ha(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${pa({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${pa({precision:e.precision})}`:n;return RegExp(`^${ua}T(?:${r})$`)}var ga=/^[\s\S]{0,}$/,_a=/^-?\d+(?:\.\d+)?$/,va=/^(?:true|false)$/i,ya=/^[^A-Z]*$/,ba=/^[^a-z]*$/,z=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xa=e=>{let t=e.value;return!ar(t)&&t.length!==void 0},Sa={number:`number`,bigint:`bigint`,object:`date`},Ca=L(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=Sa[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Sa[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wa=L(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=Sa[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Sa[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ta=L(`$ZodCheckMultipleOf`,(e,t)=>{z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):sr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ea=L(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Dr[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Da=L(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Gr(r):i)<=t.maximum)return;let a=Kr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oa=L(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Gr(r):i)>=t.minimum)return;let a=Kr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ka=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Gr(r):i;if(a===t.length)return;let o=Kr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Aa=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ja=L(`$ZodCheckRegex`,(e,t)=>{Aa.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ma=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ya,Aa.init(e,t)}),Na=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ba,Aa.init(e,t)}),Pa=L(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=Cr(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Fa=L(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${Cr(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ia=L(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${Cr(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),La=L(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ra=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
113
|
+
}`)}async live(){return this.page.evaluate(()=>{let e=window.__ariawalkSR;if(!e)return[];let t=e.live;return e.live=[],t}).catch(()=>[])}async settle(){await this.page.waitForLoadState(`domcontentloaded`,{timeout:1e4}).catch(()=>{}),await et(this.page)}async call(e,t){let{object:n}=await this.cdp.send(`DOM.resolveNode`,{backendNodeId:e});n.objectId&&await this.cdp.send(`Runtime.callFunctionOn`,{objectId:n.objectId,functionDeclaration:t,awaitPromise:!1})}},_t=new Set(`banner.navigation.main.contentinfo.complementary.search.form.region.list.listitem.table.grid.treegrid.row.cell.gridcell.columnheader.rowheader.group.radiogroup.heading.link.button.checkbox.radio.switch.tab.tablist.tabpanel.menu.menubar.menuitem.menuitemcheckbox.menuitemradio.option.listbox.tree.treeitem.dialog.alertdialog.alert.article.blockquote.figure.toolbar.application.document.note.status.log.math.term.definition.emphasis.strong.mark.deletion.insertion`.split(`.`)),vt=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`slider`,`progressbar`,`meter`,`image`,`img`,`separator`,`scrollbar`,`Canvas`,`Video`,`Audio`,`Iframe`,`IframePresentational`,`PluginObject`,`Embed`]),yt=e=>{if(e.role===`StaticText`||e.role===`ListMarker`)return!1;let t=e.dom?.display;return!!t&&t!==`contents`&&t!==`none`&&!t.startsWith(`inline`)};function bt(e){return vt.has(e.role)?!0:e.children.length===0&&_t.has(e.role)?[`checkbox`,`radio`,`switch`,`button`,`link`,`menuitem`,`tab`,`option`,`treeitem`].includes(e.role):!1}var xt=e=>!!e.dom?.clickable&&[`generic`,`paragraph`,`Section`,`none`].includes(e.role)&&!!e.dom.tag&&![`html`,`body`].includes(e.dom.tag),St=e=>e.some(e=>e.kind===`text`||e.kind===`object`);function Ct(e){let t,n=e=>{(e.role===`dialog`||e.role===`alertdialog`)&&e.props.modal&&(t=e),e.children.forEach(n)};return n(e),t}function wt(e){let t=Ct(e),n=[],r=new Set,i=()=>r.add(n.length),a=e=>{let t=yt(e);if(t&&i(),e.role===`StaticText`){let t=e.name;if(t.trim()){let r=e.dom?.lines?.filter(e=>e.text.trim());r?.length?r.forEach((t,r)=>n.push({kind:`text`,node:e,text:t.text.replace(/\s+/g,` `).trim(),top:t.top,bottom:t.bottom,segment:r})):n.push({kind:`text`,node:e,text:t.trim(),segment:0})}}else if(e.role===`LineBreak`)i();else if(e.role===`ListMarker`)e.name.trim()&&n.push({kind:`text`,node:e,text:e.name.trim(),top:e.dom?.top,bottom:e.dom?.bottom,segment:0});else if(bt(e))n.push({kind:`object`,node:e,top:e.dom?.top,bottom:e.dom?.bottom});else if((_t.has(e.role)||xt(e))&&e.role!==`RootWebArea`){let t=n.length;n.push({kind:`start`,node:e}),e.children.forEach(a),!n.slice(t+1).some(e=>e.kind===`text`||e.kind===`object`&&(e.node.name||![`image`,`img`].includes(e.node.role)))&&e.name&&St(n.slice(t))&&(n.length=t+1,n.push({kind:`text`,node:e,text:e.name,top:e.dom?.top,bottom:e.dom?.bottom,segment:0})),St(n.slice(t))?n.push({kind:`end`,node:e}):e.name&&[`button`,`link`,`heading`,`tab`,`menuitem`,`option`,`checkbox`,`radio`,`switch`].includes(e.role)?(n.length=t,n.push({kind:`object`,node:e,top:e.dom?.top,bottom:e.dom?.bottom})):n.length=t}else e.children.forEach(a);t&&i()};return t?t.children.forEach(a):a(e),Tt(n,r)}function Tt(e,t){let n=[],r=[],i=null,a=-1,o,s,c=[],l=t=>{i.atoms.push(e[t]),r[t]=n.length-1};e.forEach((e,r)=>{if(e.kind===`start`||e.kind===`end`&&!i){c.push(r);return}if(e.kind===`end`){c.length?c.push(r):l(r);return}let{top:u,bottom:d}=e,f=u!==void 0&&d!==void 0&&d>u,p=!i;for(let e=a+1;!p&&e<=r;e++)p=t.has(e);!p&&f&&o!==void 0&&s!==void 0&&(p=u>=s-1||d<=o+1),p&&(i={atoms:[],first:c[0]??r,before:[],after:[]},n.push(i),o=s=void 0),c.forEach(l),c=[],l(r),a=r,f&&(o=o===void 0?u:Math.min(o,u),s=s===void 0?d:Math.max(s,d))}),i&&c.forEach(l);let u=[],d=[];e.forEach((e,t)=>{e.kind===`start`&&d.push(e.node),u[t]=[...d],e.kind===`end`&&d.splice(d.lastIndexOf(e.node),1)});for(let t of n){let n=u[t.first]??[];t.before=t.atoms[0]?.kind===`start`?n.slice(0,-1):n.slice();let r=t.first+t.atoms.length-1,i=e[r];t.after=i?.kind===`end`?(u[r]??[]).filter(e=>e!==i.node):(u[r]??[]).slice()}return{atoms:e,lines:n,lineOf:r,stackAt:u}}function Et(e,t){return e.atoms.findIndex(e=>e.node.key===t)}function Dt(e,t){for(let n=t;n;n=n.parent){let t=Et(e,n.key);if(t>=0)return t}return 0}var Ot={heading:`heading`,heading1:`heading at level 1`,heading2:`heading at level 2`,heading3:`heading at level 3`,heading4:`heading at level 4`,heading5:`heading at level 5`,heading6:`heading at level 6`,link:`link`,formField:`form field`,button:`button`,edit:`edit field`,checkbox:`check box`,combobox:`combo box`,radio:`radio button`,landmark:`landmark`,list:`list`,listItem:`list item`,table:`table`,graphic:`graphic`,separator:`separator`,blockquote:`block quote`,frame:`embedded object`},kt={roles:{link:`link`,button:`button`,toggleButton:`toggle button`,menuButton:`menu button`,textbox:`edit`,spinbutton:`spin button`,checkbox:`check box`,radio:`radio button`,switch:`switch`,combobox:`combo box`,listbox:`list`,heading:`heading`,image:`graphic`,list:`list`,table:`table`,treegrid:`tree view`,tablist:`tab control`,tab:`tab`,tabpanel:`property page`,dialog:`dialog`,alert:`alert`,group:`grouping`,region:`region`,menu:`menu`,menubar:`menu bar`,menuitem:`menu item`,menuitemcheckbox:`check menu item`,menuitemradio:`radio menu item`,slider:`slider`,progressbar:`progress bar`,separator:`separator`,article:`article`,figure:`figure`,blockquote:`block quote`,tree:`tree view`,treeitem:`tree view item`,toolbar:`tool bar`,math:`math`,application:`application`,tooltip:`tool tip`,meter:`meter`,note:`note`,cell:`cell`},landmarks:{banner:`banner`,navigation:`navigation`,main:`main`,contentinfo:`content info`,complementary:`complementary`,search:`search`,form:`form`},landmark:`landmark`,states:{focused:`focused`,linked:`linked`,unavailable:`unavailable`,invalid:`invalid entry`,required:`required`,editable:`editable`,readOnly:`read only`,protected:`protected`,on:`on`,off:`off`,checked:`checked`,notChecked:`not checked`,halfChecked:`half checked`,pressed:`pressed`,notPressed:`not pressed`,halfPressed:`half pressed`,selected:`selected`,expanded:`expanded`,collapsed:`collapsed`,subMenu:`sub Menu`,multiLine:`multi line`,clickable:`clickable`,current:{page:`current page`,step:`current step`,location:`current location`,date:`current date`,time:`current time`,true:`current`}},blank:`blank`,selected:e=>`selected ${e}`,level:e=>`level ${e}`,withItems:e=>`with ${e} ${e===1?`item`:`items`}`,withRowsAndColumns:(e,t)=>`with ${e} ${e===1?`row`:`rows`} and ${t} ${t===1?`column`:`columns`}`,row:e=>`row ${e}`,column:e=>`column ${e}`,position:(e,t)=>`${e} of ${t}`,outOf:e=>`out of ${e}`,noNext:Object.fromEntries(Object.entries(Ot).map(([e,t])=>[e,`no next ${t}`])),noPrevious:Object.fromEntries(Object.entries(Ot).map(([e,t])=>[e,`no previous ${t}`])),top:`top`,bottom:`bottom`,document:`document`,elementsList:`Elements List`,dialog:`dialog`,listKinds:{link:`links`,heading:`headings`,formField:`form fields`,button:`buttons`,landmark:`landmarks`},items:e=>`${e} ${e===1?`item`:`items`}`,textNotFound:e=>`text "${e}" not found`,notInTableCell:`not in a table cell`,edgeOfTable:`edge of table`,addressBar:`Address and search bar`,space:`space`,symbols:{"•":`bullet`,"◦":`white bullet`,"▪":`black square`},numberSign:`number`},At=e=>`Ingen nästa rubrik på nivå ${e}`,jt=e=>`Ingen föregående rubrik på nivå ${e}`,Mt={en:kt,sv:{roles:{link:`länk`,button:`knapp`,toggleButton:`växlingsknapp`,menuButton:`menyknapp`,textbox:`redigera`,spinbutton:`öka-minska knapp`,checkbox:`kryssruta`,radio:`radioknapp`,switch:`växlingsknapp`,combobox:`kombinationsruta`,listbox:`lista`,heading:`rubrik`,image:`grafik`,list:`lista`,table:`tabell`,treegrid:`trädvy`,tablist:`flikar`,tab:`flik`,tabpanel:`egenskapssida`,dialog:`dialog`,alert:`varning`,group:`gruppering`,region:`region`,menu:`meny`,menubar:`menyrad`,menuitem:`menyobjekt`,menuitemcheckbox:`menyval med bockmarkering`,menuitemradio:`menyval med radioknapp`,slider:`skjutreglage`,progressbar:`förloppsindikator`,separator:`separator`,article:`avsnitt`,figure:`figur`,blockquote:`blockcitat`,tree:`trädvy`,treeitem:`trädvy-element`,toolbar:`verktygsfält`,math:`matematik`,application:`applikation`,tooltip:`verktygstips`,meter:`meter`,note:`anteckning`,cell:`cell`},landmarks:{banner:`baner`,navigation:`navigering`,main:`huvudinnehåll`,contentinfo:`innehållsinfo`,complementary:`komplementär`,search:`sök`,form:`formulär`},landmark:`landmärke`,states:{focused:`fokuserad`,linked:`länkad`,unavailable:`otillgänglig`,invalid:`ogiltig inmatning`,required:`krävs`,editable:`redigerbar`,readOnly:`skrivskyddat`,protected:`skyddat`,on:`på`,off:`av`,checked:`kryssad`,notChecked:`inte kryssat`,halfChecked:`delvis kryssad`,pressed:`tryckt`,notPressed:`inte tryckt`,halfPressed:`delvis tryckt`,selected:`markerad`,expanded:`expanderat`,collapsed:`stängd`,subMenu:`undermeny`,multiLine:`flerrad`,clickable:`klickbar`,current:{page:`aktuell sida`,step:`aktuellt steg`,location:`aktuell position`,date:`aktuellt datum`,time:`aktuell tid`,true:`aktuell`}},blank:`tom`,selected:e=>`markerade ${e}`,level:e=>`nivå ${e}`,withItems:e=>`med ${e} objekt`,withRowsAndColumns:(e,t)=>`med ${e} ${e===1?`rad`:`rader`} och ${t} ${t===1?`kolumn`:`kolumner`}`,row:e=>`rad ${e}`,column:e=>`kolumn ${e}`,position:(e,t)=>`${e} av ${t}`,outOf:e=>`lämnar ${e}`,noNext:{heading:`ingen nästa rubrik`,heading1:At(1),heading2:At(2),heading3:At(3),heading4:At(4),heading5:At(5),heading6:At(6),link:`ingen nästa länk`,formField:`inget nästa formulärfält`,button:`ingen nästa knapp`,edit:`inget nästa textfält`,checkbox:`ingen nästa kryssruta`,combobox:`ingen nästa kombinationsruta`,radio:`ingen nästa radioknapp`,landmark:`inget nästa landmärke`,list:`ingen nästa lista`,listItem:`inget nästa listobjekt`,table:`ingen nästa tabell`,graphic:`ingen nästa grafik`,separator:`ingen nästa separator`,blockquote:`inget nästa blockcitat`,frame:`inget nästa inbäddat objekt`},noPrevious:{heading:`ingen föregående rubrik`,heading1:jt(1),heading2:jt(2),heading3:jt(3),heading4:jt(4),heading5:jt(5),heading6:jt(6),link:`ingen föregående länk`,formField:`inget föregående formulärfält`,button:`ingen föregående knapp`,edit:`inget föregående textfält`,checkbox:`ingen föregående kryssruta`,combobox:`ingen föregående kombinationsruta`,radio:`ingen föregående radioknapp`,landmark:`ingen föregående landmärke`,list:`ingen föregående lista`,listItem:`inget föregående listobjekt`,table:`ingen föregående tabell`,graphic:`ingen föregående grafik`,separator:`ingen föregående separator`,blockquote:`inget föregående blockcitat`,frame:`inget föregående inbäddat objekt`},top:`Överst`,bottom:`Nederst`,document:`dokument`,elementsList:`Elementlista`,dialog:`dialog`,listKinds:{link:`länkar`,heading:`rubriker`,formField:`formulärfält`,button:`knappar`,landmark:`landmärken`},items:e=>`${e} objekt`,textNotFound:e=>`texten "${e}" hittas inte`,notInTableCell:`Inte i en tabellcell`,edgeOfTable:`Tabellkant`,addressBar:`Adress- och sökfält`,space:`mellanslag`,symbols:{"•":`listpunkt`,"◦":`vit listpunkt`,"▪":`svart fyrkant`},numberSign:`nummer`}},Nt=new Set([`banner`,`navigation`,`main`,`contentinfo`,`complementary`,`search`,`form`]),Pt={searchbox:`textbox`,img:`image`,grid:`table`,alertdialog:`alert`,radiogroup:`group`},Ft=new Set([...Nt,`region`,`list`,`table`,`grid`,`treegrid`,`group`,`radiogroup`,`dialog`,`alertdialog`,`tablist`,`tabpanel`,`menu`,`menubar`,`listbox`,`tree`,`toolbar`,`article`,`blockquote`,`figure`,`application`,`document`,`row`,`listitem`,`note`,`status`,`log`,`alert`]),It=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`listbox`,`option`,`tree`,`treeitem`,`slider`,`menu`,`menubar`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`gridcell`,`application`,`grid`,`treegrid`]),M=e=>[`textbox`,`searchbox`,`spinbutton`].includes(e.role)||e.role===`combobox`&&!!e.props.editable,Lt=e=>Nt.has(e.role)&&(e.role!==`form`||!!e.name),Rt=e=>e.props.valuetext??e.dom?.valueText??e.value;function zt(e){let t={radio:[`radiogroup`,`group`],tab:[`tablist`],menuitem:[`menu`,`menubar`],menuitemcheckbox:[`menu`,`menubar`],menuitemradio:[`menu`,`menubar`],option:[`listbox`],treeitem:[`tree`,`group`]}[e.role];if(!t)return;let n=e.parent;for(;n&&!t.includes(n.role);)n=n.parent;if(n??=e.parent,!n)return;let r=[],i=e.role.startsWith(`menuitem`),a=n=>{for(let o of n.children)o.role===e.role||i&&o.role.startsWith(`menuitem`)?r.push(o):t.includes(o.role)||a(o)};a(n);let o=r.indexOf(e);return o>=0&&r.length>1?{n:o+1,total:r.length}:void 0}function Bt(e){for(let t=e;t;t=t.parent)if([`table`,`grid`,`treegrid`].includes(t.role))return t}function Vt(e){let t=[],n=e=>e.children.forEach(e=>e.role===`row`?t.push(e):[`table`,`grid`,`treegrid`].includes(e.role)?null:n(e));return n(e),t}var Ht=new Set([`cell`,`gridcell`,`columnheader`,`rowheader`]);function Ut(e){let t=e.parent,n=Bt(e);if(!t||t.role!==`row`||!n)return;let r=Vt(n),i=t.children.filter(e=>Ht.has(e.role)).indexOf(e)+1,a=r[0]?.children.filter(e=>Ht.has(e.role))[i-1],o=a&&a!==e&&a.role===`columnheader`?mt(a):void 0;return{row:r.indexOf(t)+1,column:i,header:o}}function Wt(e,t){for(let n=e.parent;n;n=n.parent)if(n.role===t)return n}var Gt=new Set([`slider`,`progressbar`,`meter`,`scrollbar`]),Kt=new Set([`tabpanel`,`region`,`article`,`document`,`main`,`section`]),qt=e=>new Set(e.map(e=>e.key));function Jt(e){let t=e.states,n=t=>e.roles[Pt[t]??t]??``,r=t=>`${e.landmarks[t.role]} ${e.landmark}`,i=t=>[n(`heading`),e.level(t??2)],a=new Set([t.checked,t.notChecked,t.halfChecked,t.on,t.off,t.pressed,t.notPressed,t.halfPressed,t.expanded,t.collapsed,t.selected,t.unavailable]);function o(t){if(t.role===`button`){if(t.props.pressed!==void 0)return e.roles.toggleButton;if(t.props.hasPopup===`menu`||t.props.hasPopup===`true`)return e.roles.menuButton}return t.role===`region`&&!t.name?``:Lt(t)?r(t):n(t.role)}function s(e,n){let r=e.props,i=[];return n===`sayFocus`&&r.focused&&i.push(t.focused),n===`sayFocus`&&e.role===`link`&&i.push(t.linked),r.disabled&&i.push(t.unavailable),r.invalid&&r.invalid!==`false`&&i.push(t.invalid),r.required&&i.push(t.required),(e.role===`spinbutton`||e.role===`combobox`&&r.editable)&&i.push(t.editable),r.readonly&&M(e)&&i.push(t.readOnly),e.dom?.inputType===`password`&&i.push(t.protected),e.role===`switch`?i.push(r.checked===`true`?t.on:t.off):r.checked!==void 0&&i.push(r.checked===`true`?t.checked:r.checked===`mixed`?t.halfChecked:t.notChecked),r.pressed!==void 0&&i.push(r.pressed===`true`?t.pressed:r.pressed===`mixed`?t.halfPressed:t.notPressed),r.selected&&[`tab`,`option`,`treeitem`,`row`,`gridcell`].includes(e.role)&&i.push(t.selected),r.expanded!==void 0&&i.push(r.expanded?t.expanded:t.collapsed),e.role===`button`&&(r.hasPopup===`menu`||r.hasPopup===`true`)&&i.push(t.subMenu),e.dom?.current&&e.dom.current!==`false`&&i.push(t.current[e.dom.current]??t.current.true),r.multiline&&M(e)&&i.push(t.multiLine),n!==`focusMode`&&e.dom?.clickable&&!_t.has(e.role)&&!It.has(e.role)&&i.push(t.clickable),i}function c(t){let n=zt(t);return n&&e.position(n.n,n.total)}function l(t){let n=Vt(t),r=Math.max(0,...n.map(e=>e.children.filter(e=>Ht.has(e.role)).length));return e.withRowsAndColumns(n.length,r)}function u(i,a){let o=a===`focusMode`||a===`sayFocus`;if(Lt(i))return[i.name,r(i)].filter(Boolean);switch(i.role){case`region`:return i.name?[i.name,n(`region`)]:[];case`list`:return o?[n(`list`)]:[n(`list`),e.withItems(i.children.filter(e=>e.role===`listitem`).length)];case`listbox`:return o?[]:[i.name,n(`listbox`),e.withItems(i.children.filter(e=>e.role===`option`).length)].filter(Boolean);case`group`:case`radiogroup`:return a===`line`||!i.name?a===`line`?[n(`group`)]:[]:[i.name,n(`group`)];case`table`:case`grid`:case`treegrid`:{let e=i.dom?.clickable?[t.clickable]:[];return o?[i.name,n(`table`)].filter(Boolean):[...a===`line`?[]:[i.name].filter(Boolean),n(`table`),...e,l(i)]}case`dialog`:case`alertdialog`:return[i.name,n(i.role),i.description].filter(Boolean);case`tablist`:return a===`line`||a===`quicknav`?[]:[i.name,n(`tablist`)].filter(Boolean);case`heading`:return a===`focusMode`?[i.name,n(`heading`)].filter(Boolean):[];case`blockquote`:case`article`:case`figure`:case`toolbar`:case`tree`:return[i.name,n(i.role)].filter(Boolean);default:return[]}}function d(t){if(Lt(t))return[e.outOf(r(t))];switch(t.role){case`region`:return t.name?[e.outOf(n(`region`))]:[];case`list`:case`group`:case`radiogroup`:case`table`:case`grid`:case`treegrid`:case`dialog`:case`alertdialog`:case`blockquote`:case`article`:case`figure`:case`toolbar`:case`tree`:return[e.outOf(n(t.role))];default:return[]}}function f(t){if(Ht.has(t.role)){let n=Ut(t);return n?[e.row(n.row),n.header??``,e.column(n.column)]:[]}return t.role===`heading`?i(t.props.level):[o(t),...s(t,`line`)].filter(Boolean)}function p(t){return e.symbols[t.trim()]??t.replace(/#(?=\w)/g,`${e.numberSign} `)}function m(t,n){let r=p(Rt(t));return M(t)?t.dom?.inputType===`password`&&r?[`•`.repeat(Math.min(r.length,8))]:n===`focusBrowse`||n===`focusMode`||n===`sayFocus`?r?[e.selected(r)]:[e.blank]:r?[r]:[]:[`combobox`,`slider`,`progressbar`,`meter`,`scrollbar`].includes(t.role)&&r?[r]:[]}function h(r,a){if(Ht.has(r.role)){if(a===`sayFocus`)return[mt(r),e.roles.cell??`cell`,t.focused];let n=Ut(r);return[mt(r),...n?[e.row(n.row),n.header,e.column(n.column)]:[]].filter(e=>!!e)}if(r.role===`heading`){let e=r.children.length===1?r.children[0]:void 0;return e&&[`button`,`link`].includes(e.role)&&a===`quicknav`?h(e,a):[r.name,...i(r.props.level)]}if(r.role===`image`||r.role===`img`)return[r.name,n(`image`)].filter(Boolean);if(Kt.has(r.role)&&a!==`sayFocus`&&a!==`quicknav`)return[r.name,o(r),mt(r)].filter(Boolean);let l=(a===`focusMode`||a===`focusBrowse`)&&[`menuitem`,`option`].includes(r.role)?``:o(r),u=a===`focusBrowse`||a===`focusMode`||a===`sayFocus`,d=Gt.has(r.role)?m(r,a):[],f=[r.name,l,...d,...s(r,a),...u||a===`quicknav`?[r.description]:[],...d.length?[]:m(r,a)];if(u&&f.push(c(r)??``),a===`quicknav`||a===`focusBrowse`){let e=Wt(r,`heading`);e&&f.push(...i(e.props.level))}return f.filter(Boolean)}function g(e){if(e.role===`image`||e.role===`img`){if(!e.name)return[];let t=e.parent;return t&&[`link`,`button`].includes(t.role)&&mt(t)===``?[e.name]:[n(`image`),e.name].filter(Boolean)}return M(e)||[`slider`,`combobox`,`progressbar`,`meter`].includes(e.role)?[o(e),...s(e,`line`),...m(e,`line`)].filter(Boolean):e.role===`separator`?[n(`separator`)]:e.nameFrom===`relatedElement`?[e.name,o(e),...s(e,`line`)].filter(Boolean):[o(e),...s(e,`line`),e.name].filter(Boolean)}function _(e,t,n){let r=e.lines[t];if(!r)return[];let i=[],a=qt(n),o=r.atoms.filter(e=>e.kind===`start`).map(e=>e.node),s=qt([...r.before,...o]);for(let e of[...n].reverse())s.has(e.key)||i.push(...d(e));for(let e of r.before)a.has(e.key)||i.push(...Ft.has(e.role)?u(e,`line`):f(e));return r.atoms.forEach((e,t)=>{switch(e.kind){case`start`:Ft.has(e.node.role)?a.has(e.node.key)||i.push(...u(e.node,`line`)):Ht.has(e.node.role)&&a.has(e.node.key)||i.push(...f(e.node));break;case`end`:Ft.has(e.node.role)&&r.atoms.slice(t+1).some(e=>e.kind===`text`||e.kind===`object`)&&i.push(...d(e.node));break;case`text`:i.push(p(e.text));break;case`object`:i.push(...g(e.node))}}),i.filter(e=>e.trim())}function v(e,t,n,r=!1){let i=qt(t),a=[];for(let t=r?e:e.parent;t;t=t.parent)a.unshift(t);return a.filter(e=>!i.has(e.key)&&(Ft.has(e.role)||n===`focusMode`&&e.role===`heading`)).flatMap(e=>u(e,n))}function y(e,t,n){return[...v(e,t,n),...h(e,n)]}function ee(e,t,n,r=!1){let i=new Set(s(e,n)),o=s(t,n).filter(e=>!i.has(e)&&a.has(e));return Rt(e)!==Rt(t)&&(r||!M(t))&&o.push(p(Rt(t))),o.filter(Boolean)}return{strings:e,roleText:o,states:s,position:c,containerSpeech:u,exitSpeech:d,speakText:p,objectSpeech:h,lineSpeech:_,enteredSpeech:v,arrivalSpeech:y,stateChangeSpeech:ee}}var Yt=new Map;function Xt(e=`en`){let t=Yt.get(e);return t||Yt.set(e,t=Jt(Mt[e])),t}var{roleText:Zt,states:Qt,position:$t,containerSpeech:en,exitSpeech:tn,speakText:nn,objectSpeech:rn,lineSpeech:an,enteredSpeech:on,arrivalSpeech:sn,stateChangeSpeech:cn}=Jt(kt),ln=e=>Ft.has(e.role),un={heading:`H`,heading1:`1`,heading2:`2`,heading3:`3`,heading4:`4`,heading5:`5`,heading6:`6`,link:`K`,formField:`F`,button:`B`,edit:`E`,checkbox:`X`,combobox:`C`,radio:`R`,landmark:`D`,list:`L`,listItem:`I`,table:`T`,graphic:`G`,separator:`S`,blockquote:`Q`,frame:`M`},dn=new Set([`banner`,`navigation`,`main`,`contentinfo`,`complementary`,`search`]),fn=new Set([`textbox`,`searchbox`,`spinbutton`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`button`,`tab`,`treeitem`]);function pn(e,t){switch(e){case`heading`:return t.role===`heading`;case`heading1`:case`heading2`:case`heading3`:case`heading4`:case`heading5`:case`heading6`:return t.role===`heading`&&t.props.level===Number(e.slice(-1));case`link`:return t.role===`link`;case`formField`:return fn.has(t.role);case`button`:return t.role===`button`;case`edit`:return M(t);case`checkbox`:return t.role===`checkbox`;case`combobox`:return t.role===`combobox`;case`radio`:return t.role===`radio`;case`landmark`:return dn.has(t.role)||(t.role===`region`||t.role===`form`)&&!!t.name;case`list`:return t.role===`list`;case`listItem`:return t.role===`listitem`;case`table`:return[`table`,`grid`,`treegrid`].includes(t.role);case`graphic`:return t.role===`image`||t.role===`img`;case`separator`:return t.role===`separator`;case`blockquote`:return t.role===`blockquote`;case`frame`:return t.role===`Iframe`}}var mn={link:`link`,heading:`heading`,formField:`formField`,button:`button`,landmark:`landmark`},hn=(e,t)=>pn(mn[e],t);function gn(e){switch(e.type){case`nextLine`:return`Down Arrow`;case`prevLine`:return`Up Arrow`;case`readLine`:return`NVDA+Up Arrow`;case`sayAll`:return`NVDA+Down Arrow`;case`top`:return`Control+Home`;case`bottom`:return`Control+End`;case`next`:return un[e.kind];case`prev`:return`Shift+${un[e.kind]}`;case`tab`:return`Tab`;case`shiftTab`:return`Shift+Tab`;case`enter`:return`Enter`;case`space`:return`Space`;case`escape`:return`Escape`;case`toggleMode`:return`NVDA+Space`;case`sayFocus`:return`NVDA+Tab`;case`key`:return e.key.replace(/^Arrow(\w+)/,`$1 Arrow`);case`type`:return`typed "${e.text}"`;case`elementsList`:return`NVDA+F7 (${e.kind}s${e.filter?`, filter "${e.filter}"`:``})`;case`elementsListChoose`:return`Elements list: item ${e.index}, Enter`;case`find`:return`NVDA+Control+F "${e.text}", Enter`;case`tableMove`:return{nextRow:`Control+Alt+Down Arrow`,prevRow:`Control+Alt+Up Arrow`,nextColumn:`Control+Alt+Right Arrow`,prevColumn:`Control+Alt+Left Arrow`}[e.direction]}}var _n=.4,vn=e=>e.join(` `).split(/\s+/).filter(Boolean).length;function yn(e,t,n){return{keystrokes:e,words:t,seconds:Math.round((e*_n+t/5)*10)/10,via:n}}function bn(e,t){let n=new Set,r=[];return e.atoms.forEach((e,i)=>{(e.kind===`start`||e.kind===`object`)&&t(e.node)&&!n.has(e.node.key)&&(n.add(e.node.key),r.push(i))}),r}function xn(e,t,n,r,i){let a=r>n,o=t.filter(e=>a?e>n&&e<=r:e<n&&e>=r);return o.includes(r)?{presses:o.length,words:o.reduce((t,n)=>t+vn(i(e.atoms[n].node)),0)}:null}var Sn=[[`heading`,`H`],[`link`,`K`],[`button`,`B`],[`formField`,`F`],[`edit`,`E`],[`checkbox`,`X`],[`combobox`,`C`],[`radio`,`R`],[`landmark`,`D`],[`list`,`L`],[`table`,`T`],[`graphic`,`G`]],Cn=[{kind:`link`,key:``,label:e=>e.name},{kind:`heading`,key:`Alt+H`,label:e=>e.name},{kind:`formField`,key:`Alt+F`,label:e=>[e.name,Zt(e)].filter(Boolean).join(` `)},{kind:`button`,key:`Alt+B`,label:e=>e.name}];function wn(e,t,n){let r=e.lineOf[t]??0,i=e.lineOf[n]??0,a=i>=r?1:-1,o=0;for(let t=r+a;a>0?t<=i:t>=i;t+=a)o+=vn(an(e,t,[]));return{presses:Math.abs(i-r),words:o}}function Tn(e,t,n,r){let i=Dt(e,n);if(e.atoms[i]?.node.key!==n.key&&!e.atoms.some(e=>e.node.key===n.key))return null;if(i===t)return yn(0,0,`already there`);let a=[];for(let[r,o]of Sn){if(!pn(r,n))continue;let s=xn(e,bn(e,e=>pn(r,e)),t,i,e=>rn(e,`quicknav`));s&&a.push(yn(s.presses,s.words,`${i>t?``:`Shift+`}${o} ×${s.presses}`))}if(n.props.focusable){let n=bn(e,e=>!!e.props.focusable&&e.role!==`RootWebArea`),o=r?Dt(e,r):t,s=xn(e,n,o,i,e=>rn(e,`focusBrowse`));s&&a.push(yn(s.presses,s.words,`${i>o?`Tab`:`Shift+Tab`} ×${s.presses}`))}let o=t=>{let n=e.lines[e.lineOf[t]];return!!n&&n.atoms.slice(0,t-n.first).every(e=>e.kind===`start`)},s=wn(e,t,i);s.presses>0&&o(i)&&a.push(yn(s.presses,s.words,`${i>t?`Down`:`Up`} Arrow ×${s.presses}`));let c=bn(e,e=>e.role===`heading`),l=[...c].reverse().find(e=>e<=i);if(l!==void 0&&l!==i){let n=xn(e,c,t,l,e=>rn(e,`quicknav`));if(n){let r=wn(e,l,i);r.presses>0&&o(i)&&a.push(yn(n.presses+r.presses,n.words+r.words,`${l>t?``:`Shift+`}H ×${n.presses}, Down Arrow ×${r.presses}`))}}for(let t of Cn){if(!pn(t.kind,n)||!n.name)continue;let r=bn(e,e=>pn(t.kind,e)).map(t=>e.atoms[t].node),i=t.label(n).toLowerCase(),o=i;for(let e=2;e<=i.length;e++){let n=i.slice(0,e);if(r.filter(e=>t.label(e).toLowerCase().includes(n)).length===1){o=n;break}}let s=r.filter(e=>t.label(e).toLowerCase().includes(o)),c=Math.max(1,s.indexOf(n)+1),l=1+ +!!t.key+1+o.length+1+c+1,u=4+s.slice(0,c).reduce((e,n)=>e+t.label(n).split(/\s+/).length+3,0);a.push(yn(l,u,`elements list "${o}"`))}let u=mt(n).toLowerCase();if(u){let n=e.atoms.filter((e,n)=>n>t&&e.kind===`text`).map(e=>e.kind===`text`?e.text.toLowerCase():``),r=u;for(let e=3;e<=u.length;e++){let t=u.slice(0,e);if(n.findIndex(e=>e.includes(t))===n.findIndex(e=>e.includes(u))){r=t;break}}i>t&&a.push(yn(2+r.length+1,vn(an(e,e.lineOf[i],[])),`find "${r}"`))}return a.length?a.reduce((e,t)=>t.seconds<e.seconds?t:e):null}var En=new Set([`cell`,`gridcell`,`columnheader`,`rowheader`]),Dn=new Set([`link`,`button`,`checkbox`,`radio`,`switch`,`tab`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`treeitem`,`DisclosureTriangle`]),On={browse:`focusBrowse`,focus:`focusMode`},kn=class{port;options;mode=`browse`;manualMode=!1;page;buffer;cursor=0;context=[];mark=0;list=null;sp;t;constructor(e,t={}){this.port=e,this.options=t,this.sp=Xt(t.language),this.t=this.sp.strings}async attach(){await this.load(await this.port.snapshot()),this.mark=await this.port.mutations(),await this.port.live();let e=this.page.focused;e&&this.moveTo(Dt(this.buffer,e))}async announcePage(){return await this.load(await this.port.snapshot()),this.mark=await this.port.mutations(),await this.port.live(),{keys:`(page loaded)`,mode:this.mode,keystrokes:0,speech:this.pageSpeech(),events:[`page-load`]}}async execute(e){let t={keys:gn(e),mode:this.mode,speech:[],keystrokes:1};this.list&&e.type!==`elementsListChoose`&&(this.list=null,t.keystrokes++);let n=await this.port.live();switch(await this.refresh(t),t.speech.push(...An(n)),n.length&&Mn(t,`live`),e.type){case`nextLine`:case`prevLine`:this.mode===`focus`?await this.pageKey(t,e.type===`nextLine`?`ArrowDown`:`ArrowUp`):this.lineMove(t,e.type===`nextLine`?1:-1);break;case`readLine`:if(this.mode===`focus`&&this.page.focused){let e=this.page.focused;t.speech.push(M(e)?Rt(e)||`blank`:e.role===`slider`?`blank`:mt(e)||`blank`)}else t.speech.push(...this.sp.lineSpeech(this.buffer,this.lineIndex(),this.lineContext(this.lineIndex())));break;case`sayAll`:t.speech.push(...this.sayAll(this.lineIndex()));break;case`top`:case`bottom`:this.mode===`focus`?await this.pageKey(t,e.type===`top`?`Control+Home`:`Control+End`):this.jumpToLine(t,e.type===`top`?0:this.buffer.lines.length-1);break;case`next`:case`prev`:this.mode===`focus`?await this.typeKey(t,un[e.kind].toLowerCase()):this.quickNav(t,e.kind,e.type===`next`?1:-1);break;case`tab`:case`shiftTab`:await this.pageAction(t,()=>this.port.press(e.type===`tab`?`Tab`:`Shift+Tab`),{tabbing:!0});break;case`enter`:case`space`:this.mode===`browse`?await this.activate(t):(e.type===`space`&&this.page.focused&&M(this.page.focused)&&t.speech.push(this.t.space),await this.pageAction(t,()=>this.port.press(e.type===`enter`?`Enter`:`Space`)));break;case`escape`:{let e=t.speech.length;await this.pageAction(t,()=>this.port.press(`Escape`)),this.mode===`focus`&&t.speech.length===e&&!t.events?.length&&this.setMode(t,`browse`);break}case`toggleMode`:this.setMode(t,this.mode===`browse`?`focus`:`browse`),this.manualMode=!0;break;case`sayFocus`:t.speech.push(...this.page.focused?this.sp.objectSpeech(this.page.focused,`sayFocus`):[this.page.title,this.t.document]);break;case`key`:this.mode===`focus`?await this.pageAction(t,()=>this.port.press(e.key),{valueKeys:!0}):e.key===`ArrowDown`||e.key===`ArrowUp`?this.lineMove(t,e.key===`ArrowDown`?1:-1):jn(t,`${t.keys} in browse mode only moves within the line; nothing reached the page`);break;case`type`:t.keystrokes=Math.max(1,e.text.length),this.mode===`focus`?(t.speech.push(e.text),await this.pageAction(t,()=>this.port.type(e.text))):jn(t,`In browse mode letters are navigation keys, so nothing was typed. Press Enter on the field first.`);break;case`elementsList`:this.openList(t,e.kind,e.filter);break;case`elementsListChoose`:await this.chooseFromList(t,e.index);break;case`find`:t.keystrokes=3+e.text.length,this.find(t,e.text);break;case`tableMove`:this.tableMove(t,e.direction)}return t.speech=t.speech.filter(e=>e.trim()),t}currentLine(){return this.sp.lineSpeech(this.buffer,this.lineIndex(),this.lineContext(this.lineIndex()))}position(){return this.mode===`focus`&&this.page.focused?this.sp.objectSpeech(this.page.focused,`focusMode`):this.currentLine()}currentTarget(){return this.mode===`focus`?this.page.focused:this.targetAtCursor()??null}openListItems(){return this.list?.items??null}async aside(e){let t=this.page.focused?.backendId;try{return await e()}finally{t===void 0?await this.port.blur().catch(()=>{}):await this.port.focus(t).catch(()=>{});let e=await this.port.snapshot();this.mark=await this.port.mutations(),await this.port.live(),e.documentId===this.page.documentId?this.rebuild(e,{keys:``,mode:this.mode,speech:[],keystrokes:0}):await this.load(e)}}targetAtCursor(){for(let e=this.buffer.atoms[this.cursor]?.node;e&&e.role!==`RootWebArea`;e=e.parent)if(It.has(e.role)||Dn.has(e.role)||e.role===`LabelText`||e.dom?.clickable||e.props.focusable&&e.role!==`StaticText`)return e}cursorIndex(){return this.cursor}lineIndex(){return this.buffer.lineOf[this.cursor]??0}lineContext(e){let t=this.buffer.lines[e];return t?[...t.before,...t.atoms.filter(e=>e.kind===`start`).map(e=>e.node)]:[]}moveTo(e){this.cursor=Math.max(0,Math.min(e,this.buffer.atoms.length-1)),this.context=this.buffer.stackAt[this.cursor]??[]}lineMove(e,t){let n=this.lineIndex(),r=n+t;this.buffer.lines[r]?(e.speech.push(...this.sp.lineSpeech(this.buffer,r,this.lineContext(n))),this.cursor=this.buffer.lines[r].first,this.context=this.lineContext(r)):(e.speech.push(t>0?this.t.bottom:this.t.top),e.boundary=!0)}jumpToLine(e,t){this.buffer.lines[t]&&(e.speech.push(...this.sp.lineSpeech(this.buffer,t,[])),this.cursor=this.buffer.lines[t].first,this.context=this.lineContext(t))}sayAll(e){let t=this.options.sayAllLines??12,n=[],r=e>0?this.lineContext(e-1):[],i=e;for(let a=e;a<Math.min(this.buffer.lines.length,e+t);a++)n.push(...this.sp.lineSpeech(this.buffer,a,r)),r=this.lineContext(a),i=a;return this.buffer.lines[i]&&(this.cursor=this.buffer.lines[i].first,this.context=this.lineContext(i)),n}targets(e){let t=new Set,n=[];return this.buffer.atoms.forEach((r,i)=>{(r.kind===`start`||r.kind===`object`)&&e(r.node)&&!t.has(r.node.key)&&(t.add(r.node.key),n.push(i))}),n}quickNav(e,t,n){let r=this.targets(e=>pn(t,e)),i=new Set((this.buffer.stackAt[this.cursor]??[]).map(e=>e.key)),a=n>0?r.find(e=>e>this.cursor):[...r].reverse().find(e=>e<this.cursor&&!i.has(this.buffer.atoms[e].node.key));a===void 0?(e.speech.push(n>0?this.t.noNext[t]:this.t.noPrevious[t]),e.boundary=!0):e.speech.push(...this.arrive(a,`quicknav`))}arrive(e,t){let n=this.buffer.atoms[e],r=n.node,i;if(n.kind===`start`&&ln(r)&&![`listitem`,`row`].includes(r.role)){let n=this.buffer.stackAt[e]??[];i=[...this.sp.enteredSpeech(r,this.context,t,!0),...this.sp.lineSpeech(this.buffer,this.buffer.lineOf[e],n)]}else i=n.kind===`text`?this.sp.lineSpeech(this.buffer,this.buffer.lineOf[e],this.context):this.sp.arrivalSpeech(r,this.context,t);return this.moveTo(e),i}openList(e,t,n){let r=this.targets(e=>hn(t,e)).map(e=>this.buffer.atoms[e].node),i=e=>t===`formField`?[e.name,this.sp.roleText(e),...this.sp.states(e,`quicknav`)].filter(Boolean).join(` `):t===`landmark`?[this.sp.roleText(e).replace(` ${this.t.landmark}`,``),e.name].filter(Boolean).join(` `):e.name||`(unlabeled)`,a=n?.trim().toLowerCase(),o=a?r.filter(e=>i(e).toLowerCase().includes(a)):r,s=Math.min(o.length,10);e.keystrokes=1+(t===`link`?0:1)+(a?2+a.length:0)+s;let c=this.t.listKinds;e.speech.push(this.t.elementsList,this.t.dialog,c[t],this.t.items(o.length)),o.slice(0,s).forEach((t,n)=>e.speech.push(`${i(t)} ${this.t.position(n+1,o.length)}`)),o.length||jn(e,a?`No ${c[t]} contain "${n}".`:`This page has no ${c[t]}.`),this.list={items:o,read:s,kind:t}}async chooseFromList(e,t){let n=this.list;this.list=null;let r=n?.items[t-1];if(!n||!r){jn(e,n?`The elements list has no item ${t}.`:`The elements list is not open.`);return}e.keystrokes=Math.abs(t-n.read)+1;let i=Dt(this.buffer,r);n.kind===`link`||n.kind===`button`?(this.moveTo(i),await this.activate(e)):n.kind===`formField`&&r.backendId!==void 0&&r.props.focusable?await this.pageAction(e,()=>this.port.focus(r.backendId)):e.speech.push(...this.arrive(i,`quicknav`))}find(e,t){let n=t.trim().toLowerCase(),r=this.buffer.atoms.findIndex((e,t)=>t>this.cursor&&e.kind===`text`&&e.text.toLowerCase().includes(n));r<0||!n?(e.speech.push(this.t.textNotFound(t)),e.boundary=!0):e.speech.push(...this.arrive(r,`line`))}tableMove(e,t){let n=[...this.buffer.stackAt[this.cursor]??[]].reverse().find(e=>En.has(e.role)),r=n?.parent,i=r?.parent&&pt(r).find(e=>[`table`,`grid`,`treegrid`].includes(e.role));if(!n||!r||!i){e.speech.push(this.t.notInTableCell);return}let a=[],o=e=>e.children.forEach(e=>e.role===`row`?a.push(e):o(e));o(i);let s=e=>e.children.filter(e=>En.has(e.role)),c=a.indexOf(r),l=s(r).indexOf(n);t===`nextRow`&&c++,t===`prevRow`&&c--,t===`nextColumn`&&l++,t===`prevColumn`&&l--;let u=a[c]&&s(a[c])[l];if(!u){e.speech.push(this.t.edgeOfTable),e.boundary=!0;return}let d=Dt(this.buffer,u),f=Ut(u),p=this.buffer.stackAt[d]??[];e.speech.push(...f?[this.t.row(f.row),f.header??``,this.t.column(f.column)]:[]),e.speech.push(...this.sp.lineSpeech(this.buffer,this.buffer.lineOf[d],p)),this.moveTo(d)}async activate(e){let t=this.targetAtCursor();if(!t||t.backendId===void 0){jn(e,`Nothing here to activate.`);return}let n=t.backendId;if(It.has(t.role)&&(M(t)||t.role===`combobox`||t.role===`listbox`||t.role===`slider`)){let r=this.page.focused?.key===t.key;this.setMode(e,`focus`),r||await this.pageAction(e,()=>this.port.focus(n))}else await this.pageAction(e,async()=>{t.props.focusable&&await this.port.focus(n),await this.port.click(n)},{target:t})}async pageKey(e,t){await this.pageAction(e,()=>this.port.press(t))}async typeKey(e,t){e.speech.push(t),await this.pageAction(e,()=>this.port.type(t))}setMode(e,t){this.mode!==t&&(this.mode=t,jn(e,`${t} mode`))}async pageAction(e,t,{target:n,valueKeys:r=!1,tabbing:i=!1}={}){let a=this.page;await t(),await this.port.settle();let o=await this.port.live(),s=await this.port.snapshot(),c=await this.port.mutations(),l=c!==this.mark;if(this.mark=c,s.documentId!==a.documentId){await this.load(s),Mn(e,`page-load`),e.speech.push(...this.pageSpeech(),...An(o));return}let u=e.speech.length,d=a.focused;l?this.rebuild(s,e):this.page=s;let f=s.focused,p=n?s.byKey.get(n.key):void 0,m=f?.key===d?.key||f?.key===n?.key,h=n&&p&&m?this.sp.stateChangeSpeech(n,p,On[this.mode]):[];e.speech.push(...h);let g=!!n&&f?.key===n.key&&!h.length;if(f?.key!==d?.key&&!g){if(!f)i?(e.speech.push(this.t.addressBar,this.t.roles.textbox),jn(e,`Focus left the page for the browser toolbar; Tab again to come back to the page.`)):d&&Mn(e,`focus-lost`);else{this.manualMode||this.setMode(e,It.has(f.role)?`focus`:`browse`);let t=On[this.mode],n=this.mode===`focus`&&d?pt(d).reverse():this.context;e.speech.push(...this.sp.enteredSpeech(f,n,t),...this.sp.objectSpeech(f,t)),this.moveTo(Dt(this.buffer,f))}}else f&&d&&f.key!==n?.key&&e.speech.push(...this.sp.stateChangeSpeech(d,f,On[this.mode],r));e.speech.push(...An(o)),o.length&&Mn(e,`live`),l&&e.speech.length===u&&Mn(e,`silent-change`)}async refresh(e){let t=await this.port.mutations();if(t===this.mark)return;this.mark=t;let n=await this.port.snapshot();n.documentId===this.page.documentId?this.rebuild(n,e):(await this.load(n),Mn(e,`page-load`),e.speech.push(...this.pageSpeech()))}async load(e){this.page=e,this.buffer=wt(e.root),this.mode=`browse`,this.manualMode=!1,this.list=null,this.moveTo(0)}pageSpeech(){let e=[this.page.title],t=this.page.focused;if(t){this.mode=It.has(t.role)?`focus`:`browse`;let n=On[this.mode];e.push(...this.sp.enteredSpeech(t,[],n),...this.sp.objectSpeech(t,n)),this.moveTo(Dt(this.buffer,t))}else e.push(...this.sayAll(0));return e.filter(Boolean)}rebuild(e,t){let n=this.buffer,r=n.atoms[this.cursor];if(this.page=e,this.buffer=wt(e.root),!r)return this.moveTo(0);let i=this.buffer.atoms.findIndex(e=>e.node.key===r.node.key&&e.kind===r.kind&&(e.kind!==`text`||r.kind!==`text`||e.segment===r.segment));if(i>=0)return this.moveTo(i);for(let e=this.cursor-1;e>=0;e--){let r=this.buffer.atoms.findIndex(t=>t.node.key===n.atoms[e].node.key);if(r>=0){this.moveTo(r),Mn(t,`cursor-reset`);return}}this.moveTo(0),Mn(t,`cursor-reset`)}};function An(e){return e.flatMap(e=>e.role===`alert`?[`alert`,e.text]:[e.text])}function jn(e,t){(e.notes??=[]).push(t)}function Mn(e,t){let n=e.events??=[];n.includes(t)||n.push(t)}var N=(e,t,n)=>({describe:`${n===`next`?``:`Shift+`}${Nn[e]}: ${n} ${t}`,mode:`browse`}),Nn={heading:`H`,link:`K`,formField:`F`,button:`B`,edit:`E`,checkbox:`X`,combobox:`C`,radio:`R`,landmark:`D`,list:`L`,listItem:`I`,table:`T`,graphic:`G`},Pn={next_line:{describe:`Down Arrow: read the next line`,mode:`browse`},previous_line:{describe:`Up Arrow: read the previous line`,mode:`browse`},read_current_line:{describe:`NVDA+Up Arrow: repeat the current line`,mode:`browse`},say_all:{describe:`NVDA+Down Arrow: read on from here (about a dozen lines)`,mode:`browse`},top_of_page:{describe:`Control+Home: go to the top of the page`,mode:`browse`},next_heading:N(`heading`,`heading`,`next`),previous_heading:N(`heading`,`heading`,`previous`),next_link:N(`link`,`link`,`next`),previous_link:N(`link`,`link`,`previous`),next_form_field:N(`formField`,`form field (edit, button, check box, combo box…)`,`next`),previous_form_field:N(`formField`,`form field`,`previous`),next_button:N(`button`,`button`,`next`),previous_button:N(`button`,`button`,`previous`),next_edit_field:N(`edit`,`edit field`,`next`),previous_edit_field:N(`edit`,`edit field`,`previous`),next_checkbox:N(`checkbox`,`check box`,`next`),next_combo_box:N(`combobox`,`combo box`,`next`),next_radio_button:N(`radio`,`radio button`,`next`),next_landmark:N(`landmark`,`landmark (banner, navigation, main…)`,`next`),previous_landmark:N(`landmark`,`landmark`,`previous`),next_list:N(`list`,`list`,`next`),next_list_item:N(`listItem`,`list item`,`next`),next_table:N(`table`,`table`,`next`),next_graphic:N(`graphic`,`graphic`,`next`),tab:{describe:`Tab: move focus to the next focusable control`},shift_tab:{describe:`Shift+Tab: move focus to the previous focusable control`},enter:{describe:`Enter: activate the link or button you are on; on an edit field or combo box, start typing (focus mode)`},space:{describe:`Space: activate or toggle (check boxes, radio buttons, buttons)`},escape:{describe:`Escape: close a menu or dialog; in focus mode, go back to browse mode`},toggle_mode:{describe:`NVDA+Space: switch between browse mode and focus mode`},report_focus:{describe:`NVDA+Tab: say what has keyboard focus`},arrow_down:{describe:`Down Arrow in focus mode: next option in a list, combo box, menu or radio group`,mode:`focus`},arrow_up:{describe:`Up Arrow in focus mode: previous option`,mode:`focus`},arrow_right:{describe:`Right Arrow in focus mode: next tab, radio button or menu`,mode:`focus`},arrow_left:{describe:`Left Arrow in focus mode: previous tab, radio button or menu`,mode:`focus`},home:{describe:`Home in focus mode: first option`,mode:`focus`},end:{describe:`End in focus mode: last option`,mode:`focus`},type:{describe:`Type text into the focused edit field (focus mode). Set text.`,mode:`focus`},elements_list:{describe:`NVDA+F7: list the links, headings, form fields, buttons or landmarks, optionally filtered. Set list, and text to filter.`,mode:`browse`},elements_list_choose:{describe:`In the open elements list, go to item number index (links and buttons are activated).`,mode:`browse`},find:{describe:`NVDA+Control+F: find text on the page, searching forward from where you are (text above you is not found). Set text.`,mode:`browse`},table_next_row:{describe:`Control+Alt+Down Arrow: same column, next row`,mode:`browse`},table_previous_row:{describe:`Control+Alt+Up Arrow: same column, previous row`,mode:`browse`},table_next_column:{describe:`Control+Alt+Right Arrow: next cell in the row`,mode:`browse`},table_previous_column:{describe:`Control+Alt+Left Arrow: previous cell in the row`,mode:`browse`}};Object.keys(Pn);var Fn=new Set([`enter`,`space`,`type`,`arrow_down`,`arrow_up`,`arrow_left`,`arrow_right`,`home`,`end`,`escape`]);function In(e){let t=(e,t)=>e===`next`?{type:`next`,kind:t}:{type:`prev`,kind:t},n=e=>({type:`key`,key:e});switch(e.command){case`next_line`:return{type:`nextLine`};case`previous_line`:return{type:`prevLine`};case`read_current_line`:return{type:`readLine`};case`say_all`:return{type:`sayAll`};case`top_of_page`:return{type:`top`};case`next_heading`:return t(`next`,`heading`);case`previous_heading`:return t(`prev`,`heading`);case`next_link`:return t(`next`,`link`);case`previous_link`:return t(`prev`,`link`);case`next_form_field`:return t(`next`,`formField`);case`previous_form_field`:return t(`prev`,`formField`);case`next_button`:return t(`next`,`button`);case`previous_button`:return t(`prev`,`button`);case`next_edit_field`:return t(`next`,`edit`);case`previous_edit_field`:return t(`prev`,`edit`);case`next_checkbox`:return t(`next`,`checkbox`);case`next_combo_box`:return t(`next`,`combobox`);case`next_radio_button`:return t(`next`,`radio`);case`next_landmark`:return t(`next`,`landmark`);case`previous_landmark`:return t(`prev`,`landmark`);case`next_list`:return t(`next`,`list`);case`next_list_item`:return t(`next`,`listItem`);case`next_table`:return t(`next`,`table`);case`next_graphic`:return t(`next`,`graphic`);case`tab`:return{type:`tab`};case`shift_tab`:return{type:`shiftTab`};case`enter`:return{type:`enter`};case`space`:return{type:`space`};case`escape`:return{type:`escape`};case`toggle_mode`:return{type:`toggleMode`};case`report_focus`:return{type:`sayFocus`};case`arrow_down`:return n(`ArrowDown`);case`arrow_up`:return n(`ArrowUp`);case`arrow_right`:return n(`ArrowRight`);case`arrow_left`:return n(`ArrowLeft`);case`home`:return n(`Home`);case`end`:return n(`End`);case`type`:return e.text?{type:`type`,text:e.text}:{rejected:`type needs the text to type.`};case`elements_list`:return e.list?{type:`elementsList`,kind:e.list,filter:e.text||void 0}:{rejected:`elements_list needs list (link, heading, formField, button or landmark).`};case`elements_list_choose`:return e.index?{type:`elementsListChoose`,index:e.index}:{rejected:`elements_list_choose needs the item number in index.`};case`find`:return e.text?{type:`find`,text:e.text}:{rejected:`find needs the text to look for.`};case`table_next_row`:return{type:`tableMove`,direction:`nextRow`};case`table_previous_row`:return{type:`tableMove`,direction:`prevRow`};case`table_next_column`:return{type:`tableMove`,direction:`nextColumn`};case`table_previous_column`:return{type:`tableMove`,direction:`prevColumn`}}}var Ln=25,Rn=new Set([`enter`,`space`,`type`,`escape`,`toggle_mode`,`report_focus`,`say_all`,`top_of_page`,`elements_list`,`elements_list_choose`,`find`,`read_current_line`]);function zn(e){let t=e.position().join(`, `),n=e.mode===`browse`?e.buffer.atoms[e.cursorIndex()]?.node:void 0;if(!n)return t;let r=e.sp.objectSpeech(n,`quicknav`).join(`, `);return r&&r!==t?`${r} (on the line “${t}”)`:t}var Bn=e=>e.toLowerCase().replace(/[\u2010-\u2015\u2212]/g,`-`).replace(/\s+/g,` `).trim(),Vn=/has been closed|Target closed|disconnected|Browser closed/i;function Hn(){return{pages:[],axe:[],journey:{actions:[],keystrokes:0,wordsHeard:0,silentChanges:0,focusLost:0,cursorResets:0},snapshots:new Map,transcript:[]}}async function Un(e,t){let n=Hn(),r=!1,i={...t.sink,stepStarted:e=>(r=!0,t.sink.stepStarted(e))},a=await qn(e,{...t,sink:i},n);a.outcome===`error`&&!r&&!e.signal?.aborted&&Vn.test(a.error??``)&&(Object.assign(n,Hn()),a=await qn(e,{...t,sink:i},n));let o=Pe({outcome:a.outcome,pages:n.pages,axe:n.axe,journey:n.journey});return{...a,scores:o,pageSnapshots:[...n.snapshots.values()],transcript:n.transcript}}function Wn(e,t){let n=e;for(let e of t)e.isSecret&&e.value.length>=3&&(n=n.split(e.value).join(`••••`));return n}function Gn(e){let t=[];for(let n of e.byKey.values())n.props.focusable&&n.role!==`RootWebArea`&&t.push(`${n.role}|${n.name}`);return`${e.documentId}#${t.sort().join(`;`)}`}var Kn=e=>e.split(/\s+/).filter(Boolean).length;async function qn(e,t,n){let{engine:r,sink:i,signal:a}={...t,signal:e.signal},o,s=0,c=(e,t,n)=>Qn(e,t,n,a),l=()=>({outcome:`cancelled`,summary:$n(a),steps:s}),u=t=>Wn(t,e.testData),d=[],f=[],p=[],m=(e,t)=>{let r=u(t.speech.join(`, `)),i={keys:u(t.keys),mode:t.mode,speech:r,notes:t.notes,events:t.events,boundary:t.boundary},a=t.events?.includes(`page-load`)&&t.mode===`browse`&&r?[...t.notes??[],`reading stopped at the last thing said: everything before it is above you (Shift+ keys go back)`]:t.notes;return f.push({step:e,keys:i.keys,mode:t.mode,speech:r,notes:a}),n.transcript.push(i),n.journey.keystrokes+=t.keystrokes,n.journey.wordsHeard+=Kn(r),i};try{if(!e.isUrlAllowed(e.startUrl))return{outcome:`error`,error:`${e.startUrl} is not on a verified domain`,steps:0};o=await c(t.launchBrowser(),6e4,`Browser launch`);let h=await o.newPage({viewport:it}),g=[];await Yn(h,e.isUrlAllowed,e=>g.push(e));let _=await gt.attach(h),v=new kn(_,{language:e.speechLanguage});i.activity(`Opening ${e.startUrl}`),await h.goto(e.startUrl,{waitUntil:`domcontentloaded`,timeout:3e4}),await _.settle(),m(0,await c(v.announcePage(),6e4,`Screen reader`));let y=await c($e(h),3e4,`Accessibility snapshot`),ee=y,te=``,b={stops:[],mouseOnly:[],trapped:!1},ne=new Set,re=new Set,x=0,S=!1,C=null,ie=new Set,ae=null,w=!1,T=0;for(s=1;s<=e.maxSteps;s++){if(a?.aborted)return l();let o=new Zn(s),_=h.url(),oe=v.page.title;g.length&&=(d.push(`The page tried to leave the site under test (${g.join(`, `)}); that navigation was blocked.`),0);let se=Gn(v.page),ce=[],le=Promise.resolve();if(se!==te){te=se,i.activity(`Checking the page: tab order, focus and structure…`);let r=await o.time(`audit`,c(v.aside(async()=>{let t=await Xe(h),n=await Ze(h).catch(()=>[]),r=D(_),i=e.extendedVisualChecks&&!re.has(r)?(re.add(r),await at(h,s).catch(()=>null)):null;return{stops:t.stops,trapped:t.trapped,mouseOnly:n,extended:i}}),12e4,`Page audit`));b=r,r.extended&&(n.axe.push(...r.extended.stats),await i.findings(r.extended.findings)),ce=r.stops,await i.findings([...fe(r.stops,r.trapped,s,_),...pe(r.mouseOnly,s,_)]),n.pages.push({page:D(_),stops:r.stops,mouseOnlyControls:r.mouseOnly.length,trapped:r.trapped}),ee=await c($e(h),3e4,`Accessibility snapshot`),n.snapshots.set(D(_),{page:D(_),url:_,title:oe,snapshot:u(ee)}),le=o.time(`sideWork`,(async()=>{let e=await Xn(h,s,t);e&&await i.stepUpdated(s,{screenshotKey:e});let r=await c(nt(h,s,ne),9e4,`axe-core`).catch(()=>null);r&&(n.axe.push(...r.stats),await i.findings(r.findings))})())}await i.stepStarted({n:s,pageUrl:_,pageTitle:oe,tabStops:ce,narration:`Listening and deciding…`}),i.activity(`Deciding the next key press…`);let ue=v.page.focused,de={task:e.task,testData:e.testData,pageTitle:oe,mode:v.mode,heard:f,position:u(zn(v)),focus:ue?u(v.sp.objectSpeech(ue,`sayFocus`).join(`, `)):``,focusIsEditable:!!ue&&M(ue),openList:v.openListItems()?.map(e=>u([e.name,v.sp.objectSpeech(e,`quicknav`)[1]].filter(Boolean).join(` `))),language:e.speechLanguage??`en`,history:d,pageText:ee},E=await o.time(`decide`,c(r.decide(de),18e4,`Decision`));await le;let O=`you have not heard any confirmation since you started acting on the page`;if(E.goalReached&&S&&Le(E.evidence,p)){let e=await c($e(h),3e4,`Accessibility snapshot`);if(O=`that text was already on the page before you acted, or is a control label`,Ie(E.evidence,e,y)){i.activity(`Verifying the task was completed…`);let t=await o.time(`verify`,c(r.verifyCompletion({...de,pageText:e},E.evidence),18e4,`Completion check`));if(o.log(),t.confirmed)return await i.stepUpdated(s,{decision:E,narration:`Task completed with a screen reader: heard “${E.evidence}”.`}),{outcome:`completed`,summary:`Completed with NVDA in ${s-1} steps. ${t.reason}`,steps:s};O=`a check of the page disagreed: ${t.reason}`}}if(E.goalReached&&(d.push(`${s}. You said the task was done${E.evidence?`, quoting "${E.evidence}"`:``}, but ${O}. Keep working on the task; if the site did something other than the task asked, choose wrong_result.`),!E.command)){await i.stepUpdated(s,{decision:E,narration:`Thought the task was done, but ${O}.`}),x++;continue}if(E.wrongResult){if(S&&Le(E.evidence,p))return await i.stepUpdated(s,{decision:E,narration:`The site did something other than the task: heard “${E.evidence}”.`}),{outcome:`inconclusive`,summary:`The site didn't do what the task asked: heard “${E.evidence}”. ${E.reason??``}`.trim(),steps:s};x++,d.push(`${s}. You said the result was wrong, but the words you quoted weren't heard after you acted. Quote them exactly from <heard>, or keep working on the task.`),await i.stepUpdated(s,{decision:E,narration:`Thought the result was wrong, without proof; continuing.`});continue}if(!E.command){if(!(b.mouseOnly.length||b.trapped)&&x<4){x++,d.push(`${s}. You said you were stuck. Explore further before giving up: jump through headings, landmarks, form fields and buttons, read line by line, or open the elements list.`),await i.stepUpdated(s,{decision:E,narration:`Thought it was stuck; exploring further.`});continue}return await i.stepUpdated(s,{decision:E,narration:`No way forward with the screen reader.`}),await i.findings([me(E.reason??`Nothing a screen reader user can reach moves the task forward.`,s,_,b.mouseOnly,b.trapped)]),{outcome:`blocked`,summary:`Blocked at step ${s} on ${_}.`,steps:s}}let ge;if(E.command===`type`){let t=Re(E,e.testData,e.task,{editable:!!ue&&(M(ue)||ue.role===`combobox`)&&v.mode===`focus`,spoken:de.focus});if(`rejected`in t){x++,d.push(`${s}. Rejected your choice: ${t.rejected}`),await i.stepUpdated(s,{decision:E,narration:`Skipped: ${t.rejected}`});continue}ge={text:t.value,display:t.display}}let _e=In({command:E.command,text:ge?.text??E.text,index:E.index,list:E.list});if(`rejected`in _e){x++,d.push(`${s}. Rejected your choice: ${_e.rejected}`),await i.stepUpdated(s,{decision:E,narration:`Skipped: ${_e.rejected}`});continue}let ve=[`enter`,`space`,`type`,`elements_list_choose`].includes(E.command),k=ve?E.command===`elements_list_choose`?v.openListItems()?.[(E.index??1)-1]:v.currentTarget():null;k??=null;let ye=k&&`${v.page.documentId}#${k.key}`;if(k&&ye&&!ie.has(ye)){ie.add(ye);let e=C?.documentId===v.page.documentId?v.buffer.atoms.findIndex(e=>e.node.key===C.key):0,t=Tn(v.buffer,Math.max(0,e),k,C?v.page.focused:null);n.journey.actions.push({cheapest:t&&{keystrokes:t.keystrokes,words:t.words,seconds:t.seconds}})}i.activity(E.reason??`Pressing keys…`);let be=!Rn.has(E.command),xe=be&&E.until?.trim()?Bn(E.until):void 0,Se=be?Math.max(1,Math.min(Ln,E.repeat??(xe?Ln:1))):1,Ce=v.buffer.atoms[v.cursorIndex()]?.node,we=_e.type===`next`||_e.type===`prev`?_e.kind:null,Te=Ce&&we&&pn(we,Ce)?Bn(u(v.sp.objectSpeech(Ce,`quicknav`).join(` `))):``,A=!!xe&&!!Te&&Te.includes(xe)&&!w;if(w=A,A){d.push(`${s}. You are already on "${E.until}" (${de.position}): act on it now. To reach a different one, set until to words only that one has.`),await i.stepUpdated(s,{decision:E,narration:`Already on “${u(E.until)}”; didn't move.`});continue}let j=[],Ee=0,De=new Set(f.slice(-10).map(e=>e.speech));await o.time(`act`,c((async()=>{for(let e=0;e<Se&&!a?.aborted;e++){let e=await v.execute(_e);if(Ee++,j.push(m(s,e)),xe&&Bn(e.speech.join(` `)).includes(xe)||e.boundary)break}})(),12e4,`Screen reader`)),Fn.has(E.command)&&(S=!0),S&&p.push(...j.map(e=>e.speech));let Oe=k?u(k.name||k.role):void 0;for(let e of j)for(let t of e.events??[])t===`silent-change`&&(E.command===`enter`||E.command===`space`)?(n.journey.silentChanges++,await i.findings([he(`silent-change`,e.keys,Oe,s,_)])):t===`focus-lost`&&ve?(n.journey.focusLost++,await i.findings([he(`focus-lost`,e.keys,Oe,s,_)])):t===`cursor-reset`&&Fn.has(E.command)&&!(ve&&e.events?.includes(`focus-lost`))&&(n.journey.cursorResets++,await i.findings([he(`cursor-reset`,e.keys,Oe,s,_)]));k&&(C={documentId:v.page.documentId,key:k.key});let ke=[...j].reverse().find(e=>e.speech)?.speech??``,Ae=ze(j[0]?.keys??E.command,Ee,ke,ge?.display),je=j.flatMap(e=>e.notes??[]);if(j.at(-1)?.boundary&&je.push(`you are past the last one in that direction: go back the other way instead of pressing it again`),xe&&!Bn(j.at(-1)?.speech??``).includes(xe)&&je.push(`did not hear "${E.until}" on the way`),T=be&&Ee===1&&!xe&&E.command===ae?T+1:0,ae=E.command,T>=1&&je.push(`you pressed ${E.command} one item at a time ${T+1} times: set until to what you are listening for and it keeps pressing for you`),ve&&!ke&&j.some(e=>e.events?.includes(`silent-change`))&&je.push(`nothing was announced, but the page changed: find out what changed (read on, jump to the next heading or form field)`),d.push(`${s}. ${Ae}${je.length?` (${[...new Set(je)].join(`; `)})`:``}`),await i.stepUpdated(s,{decision:E,narration:Ae,action:E.command,targetRole:k?.role,targetName:k?u(k.name):void 0,typedValue:ge?.display,heard:j,keystrokes:j.reduce((e,t)=>e+Jn(t,_e.type===`type`?ge?.text:void 0),0)}),i.activity(Ae),x=j.some(e=>e.speech&&!De.has(e.speech)||e.events?.length)?0:x+1,x>=4&&(b.mouseOnly.length||b.trapped))return await i.findings([me(`No progress in ${x} steps: nothing a screen reader user can reach moves the task forward.`,s,_,b.mouseOnly,b.trapped)]),{outcome:`blocked`,summary:`Blocked at step ${s} on ${_}.`,steps:s};if(x>=4)return{outcome:`inconclusive`,summary:`Stopped after ${x} steps in a row made no progress. This may be a screen reader problem or the agent misreading the page: review the steps.`,steps:s};o.log()}return{outcome:`inconclusive`,summary:`Used all ${e.maxSteps} steps without confirming the task was done. Review the steps to see where it went wrong.`,steps:e.maxSteps}}catch(e){return a?.aborted?l():{outcome:`error`,error:e instanceof Error?e.message:String(e),steps:s}}finally{await o?.close().catch(()=>{})}}function Jn(e,t){return t!==void 0&&e.keys.startsWith(`typed`)?Math.max(1,t.length):/^NVDA\+F7/.test(e.keys)||/^Elements list/.test(e.keys)||/^NVDA\+Control\+F/.test(e.keys)?3:1}async function Yn(e,t,n){await e.route(`**/*`,async r=>{let i=r.request();return i.isNavigationRequest()&&i.frame()===e.mainFrame()&&!t(i.url())?(n(i.url()),r.abort(`blockedbyclient`)):r.continue()})}async function Xn(e,t,n){try{return await n.saveScreenshot(t,await e.screenshot({type:`jpeg`,quality:60,timeout:15e3}))}catch{return}}var Zn=class{n;#e={};#t=Date.now();constructor(e){this.n=e}async time(e,t){let n=Date.now();try{return await t}finally{this.#e[e]=Date.now()-n}}log(){let e=Object.entries(this.#e).map(([e,t])=>`${e}=${t}`);console.log(`[run-timing] step=${this.n} total=${Date.now()-this.#t} ${e.join(` `)}`)}};function Qn(e,t,n,r){let i,a,o=new Promise((e,o)=>{i=setTimeout(()=>o(Error(`${n} timed out after ${t/1e3}s`)),t),r&&(a=()=>o(Error(`Run stopped`)),r.aborted?a():r.addEventListener(`abort`,a,{once:!0}))});return Promise.race([e,o]).finally(()=>{clearTimeout(i),a&&r?.removeEventListener(`abort`,a)})}function $n(e){return typeof e?.reason==`string`?e.reason:`Stopped before finishing.`}function er(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function tr(e,t=`|`){return e.map(e=>Tr(e)).join(t)}function nr(e,t){return typeof t==`bigint`?t.toString():t}var rr=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ir(e){return new rr(e)}function ar(e){return e==null}function or(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sr(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function cr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lr(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ur(e){return lr(e._zod.def)??e._zod.def.shape}function dr(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return cr(this,t,e),e},enumerable:!0,configurable:!0})}function fr(e,t,n){t in e?cr(e,t,n):e[t]=n}function pr(e,t,n,r){let i=ur(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?dr(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):fr(e,a,r?r(n.value,a):n.value))}}function mr(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?dr(e,n,()=>t[n]):fr(e,n,r.value))}}function P(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function hr(e){return JSON.stringify(e)}function gr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var _r=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function vr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yr=ir(()=>{if(R.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function br(e){if(vr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return vr(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function xr(e){return br(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Sr=new Set([`string`,`number`,`symbol`]);function Cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wr(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Tr(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Er(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Dr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Or={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function kr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return pr(i,e,Ar(e,t)),wr(e,P(n,{shape:i,checks:[]}))}function Ar(e,t){let n=ur(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function jr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ar(e,t)),a={};return pr(a,e,Reflect.ownKeys(ur(e)).filter(e=>!i.has(e))),wr(e,P(n,{shape:a,checks:[]}))}function Mr(e,t){if(!br(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ur(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return wr(e,P(e._zod.def,{shape:Nr(e,t)}))}function Nr(e,t){let n={};return pr(n,e,Reflect.ownKeys(ur(e))),mr(n,t),n}function Pr(e,t){if(!br(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return wr(e,P(e._zod.def,{shape:Nr(e,t)}))}function Fr(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return pr(n,e,Reflect.ownKeys(ur(e))),pr(n,t,Reflect.ownKeys(ur(t))),wr(e,P(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ir(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ar(t,n)):void 0,o={};return pr(o,t,Reflect.ownKeys(ur(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),wr(t,P(t._zod.def,{shape:o,checks:[]}))}function Lr(e,t,n){let r=n?new Set(Ar(t,n)):void 0,i={};return pr(i,t,Reflect.ownKeys(ur(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),wr(t,P(t._zod.def,{shape:i}))}function Rr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function zr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Br(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Vr(e){return typeof e==`string`?e:e?.message}function Hr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ur(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Vr(e.inst?._zod.def?.error?.(e))??Vr(a?.(e))??Vr(t?.error?.(e))??Vr(n.customError?.(e))??Vr(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Wr=/[\uD800-\uDBFF]/;function Gr(e){let t=e.length;if(!Wr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Kr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function qr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Jr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Yr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$r(e,n,r.value)}}function Xr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Zr(e,t,n){return Xr(e,t,n,!1)}function Qr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Xr(this,n,r(this))},set(e){Xr(this,n,e)}})}return t}function $r(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Xr(this,t,n.bind(this))},set(e){Xr(this,t,e)}})}function ei(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var ti,ni=!1,ri={configurable:!0,get(){ni=!0}};function I(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&ti!==e._zod?ti=void 0:(ti=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ri);let e=ni;ni=!1;try{let r=n(this);return ni?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ni||=e,r}catch(n){throw delete this[t],ni||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function ii(e,t,n,r){let i=ei(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ai=`~constantCatch`;function oi(e){let t=()=>e;return t[ai]=!0,t}var si,ci={value:void 0,enumerable:!1},li=`captureStackTrace`in Error?Error:null;function ui(e){let t=li;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return li=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function L(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ci.value=new a(r);try{Object.defineProperty(n,"_zod",ci)}finally{ci.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Yr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ui(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var di=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},fi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(si=globalThis).__zod_globalConfig??(si.__zod_globalConfig={});var R=globalThis.__zod_globalConfig;function pi(e){return e&&Object.assign(R,e),R}function mi(){let e=this._zod;return e.message??=JSON.stringify(e.def,nr,2),e.message}function hi(e){this._zod.message=e}var gi={get:mi,set:hi,enumerable:!0,configurable:!0},_i={value:void 0,enumerable:!1},vi=new WeakSet([Object.prototype,Error.prototype]),yi=(e,t)=>{e.name=`$ZodError`,_i.value=t,Object.defineProperty(e,"issues",_i),_i.value=void 0,Object.defineProperty(e,"message",gi);let n=Object.getPrototypeOf(e);vi.has(n)||(vi.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},bi=L(`$ZodError`,yi);L(`$ZodError`,yi,void 0,{Parent:Error});function xi(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Si(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?xi(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ci(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function wi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ti=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new di;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ur(e,o,pi())));throw _r(n,a?.callee??t),n}return s.value};return t},Ei=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ur(e,o,pi())));throw _r(n,a?.callee??t),n}return s.value};return t},Di=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new di;return a.issues.length?Oi(e,a.issues,i):{success:!0,data:a.value}};function Oi(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ur(e,n,pi()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ki=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Oi(e,a.issues,i):{success:!0,data:a.value}},Ai=Symbol.for(`zod.compile.invalid`),ji=Symbol.for(`zod.compile.fallback`),Mi=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ai)return!0;if(r.definite===!0&&n===void 0)return!1}return Ni(e,t,n)});function Ni(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ji]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new di;return a.issues.length===0}var Pi=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Fi=e=>{let t=Ti(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,wi(n,a))};return n},Ii=e=>{let t=Ti(e),n=(e,r,i,a)=>t(e,r,i,wi(n,a));return n},Li=e=>{let t=Ei(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,wi(n,a))};return n},Ri=e=>{let t=Ei(e),n=async(e,r,i,a)=>await t(e,r,i,wi(n,a));return n},zi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Di(e)(t,n,i)},Bi=e=>(t,n,r)=>Di(e)(t,n,r),Vi=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ki(e)(t,n,i)},Hi=e=>async(t,n,r)=>ki(e)(t,n,r),Ui=/^[cC][0-9a-z]{6,}$/,Wi=/^[0-9a-z]+$/,Gi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ki=/^[0-9a-vA-V]{20}$/,qi=/^[A-Za-z0-9]{27}$/,Ji=/^[a-zA-Z0-9_-]{21}$/;function Yi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Xi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$i=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ea=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function ta(){return new RegExp(ea,`u`)}var na=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ra=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ia=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,aa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sa=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ca=/^https?$/,la=/^\+[1-9]\d{6,14}$/,ua=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function da(e){return RegExp(`^${e}$`)}var fa=da(ua);function pa(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ma(e){return RegExp(`^${pa(e)}$`)}function ha(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${pa({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${pa({precision:e.precision})}`:n;return RegExp(`^${ua}T(?:${r})$`)}var ga=/^[\s\S]{0,}$/,_a=/^-?\d+(?:\.\d+)?$/,va=/^(?:true|false)$/i,ya=/^[^A-Z]*$/,ba=/^[^a-z]*$/,z=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xa=e=>{let t=e.value;return!ar(t)&&t.length!==void 0},Sa={number:`number`,bigint:`bigint`,object:`date`},Ca=L(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=Sa[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Sa[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wa=L(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=Sa[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Sa[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ta=L(`$ZodCheckMultipleOf`,(e,t)=>{z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):sr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ea=L(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Dr[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Da=L(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Gr(r):i)<=t.maximum)return;let a=Kr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oa=L(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Gr(r):i)>=t.minimum)return;let a=Kr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ka=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=xa),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Gr(r):i;if(a===t.length)return;let o=Kr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Aa=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ja=L(`$ZodCheckRegex`,(e,t)=>{Aa.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ma=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ya,Aa.init(e,t)}),Na=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ba,Aa.init(e,t)}),Pa=L(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=Cr(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Fa=L(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${Cr(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ia=L(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${Cr(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),La=L(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ra=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
114
114
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
115
115
|
`)}\n};`)(...Object.values(this.closed))}},za={major:4,minor:6,patch:5},B=L(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=za;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Rr(t),a;for(let o of n){if(o._zod.def.when){if(zr(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new di;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Hr(t.issues,n,e),i||=Rr(t,n))});else{if(t.issues.length===n)continue;Hr(t.issues,n,e),i||=Rr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Rr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new di;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new di;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Zr(this,`~standard`,Ha(this))},set"~standard"(e){Xr(this,`~standard`,e)}}),Ba=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ur(e,t,pi()))}:{value:e.value};async function Va(e,t){let n={async:!0};return Ba(await e._zod.run({value:t,issues:[]},n),n)}function Ha(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ba(r,n)}catch{}return Va(e,t)},vendor:`zod`,version:1}}var Ua=L(`$ZodString`,(e,t)=>{B.init(e,t),e._zod.pattern=t.pattern??ga,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),V=L(`$ZodStringFormat`,(e,t)=>{Aa.init(e,t),Ua.init(e,t)}),Wa=L(`$ZodGUID`,(e,t)=>{t.pattern??=Zi,V.init(e,t)}),Ga=L(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Qi(e)}else t.pattern??=Qi();V.init(e,t)}),Ka=L(`$ZodEmail`,(e,t)=>{t.pattern??=$i,V.init(e,t)});function qa(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ja(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?qa(e)||2:Ya(e,t)}function Ya(e,t){if(!t.normalize&&t.protocol?.source===ca.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Xa=/[\t\n\r]/g;function Za(e){return e.replace(Xa,``)}function Qa(e,t){return t.lastIndex=0,t.test(e.hostname)}function $a(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var eo=L(`$ZodURL`,(e,t)=>{V.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ja(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Za(r);return}t.hostname&&!Qa(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!$a(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Za(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),to=L(`$ZodEmoji`,(e,t)=>{t.pattern??=ta(),V.init(e,t)}),no=L(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ji:Yi(t.length),V.init(e,t)}),ro=L(`$ZodCUID`,(e,t)=>{t.pattern??=Ui,V.init(e,t)}),io=L(`$ZodCUID2`,(e,t)=>{t.pattern??=Wi,V.init(e,t)}),ao=L(`$ZodULID`,(e,t)=>{t.pattern??=Gi,V.init(e,t)}),oo=L(`$ZodXID`,(e,t)=>{t.pattern??=Ki,V.init(e,t)}),so=L(`$ZodKSUID`,(e,t)=>{t.pattern??=qi,V.init(e,t)}),co=L(`$ZodISODateTime`,(e,t)=>{t.pattern??=ha(t),V.init(e,t)}),lo=L(`$ZodISODate`,(e,t)=>{t.pattern??=fa,V.init(e,t)}),uo=L(`$ZodISOTime`,(e,t)=>{t.pattern??=ma(t),V.init(e,t)}),fo=L(`$ZodISODuration`,(e,t)=>{t.pattern??=Xi,V.init(e,t)}),po=L(`$ZodIPv4`,(e,t)=>{t.pattern??=na,V.init(e,t)}),mo=/^[0-9a-fA-F:.]+$/;function ho(e){return mo.test(e)?qa(`http://[${e}]`):!1}var go=L(`$ZodIPv6`,(e,t)=>{t.pattern??=ra,V.init(e,t),e._zod.check=n=>{ho(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),_o=L(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ia,V.init(e,t)});function vo(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ho(n)}var yo=L(`$ZodCIDRv6`,(e,t)=>{t.pattern??=aa,V.init(e,t),e._zod.check=n=>{vo(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function bo(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var xo=/^[0-9a-zA-Z+/]*={0,2}$/,So=L(`$ZodBase64`,(e,t)=>{t.pattern??=xo,V.init(e,t),e._zod.check=n=>{bo(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Co=/^[A-Za-z0-9_-]*$/;function wo(e){if(!Co.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return bo(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var To=L(`$ZodBase64URL`,(e,t)=>{t.pattern??=Co,V.init(e,t),e._zod.check=n=>{wo(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Eo=L(`$ZodE164`,(e,t)=>{t.pattern??=la,V.init(e,t)});function Do(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Oo=L(`$ZodJWT`,(e,t)=>{V.init(e,t),e._zod.check=n=>{Do(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ko=L(`$ZodNumber`,(e,t)=>{B.init(e,t),e._zod.pattern=_a,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ao=L(`$ZodNumberFormat`,(e,t)=>{Ea.init(e,t),ko.init(e,t)}),jo=L(`$ZodBoolean`,(e,t)=>{B.init(e,t),e._zod.pattern=va,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Mo=L(`$ZodUnknown`,(e,t)=>{B.init(e,t),e._zod.parse=e=>e}),No=L(`$ZodNever`,(e,t)=>{B.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Po(e,t,n){e.issues.length&&t.issues.push(...Br(n,e.issues)),t.value[n]=e.value}var Fo=L(`$ZodArray`,(e,t)=>{B.init(e,t);let n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Po(t,r,e)));else if(Po(c,r,e),s&&c.issues.length!==0&&Rr(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Io(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Br(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Lo=[];function Ro(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Lo,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Er(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function zo(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Rr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Io(e,n,i,t,d,f))):Io(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Bo=L(`$ZodObject`,(e,t)=>{B.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ir(()=>Ro(t));I(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||cr(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=vr,o=t.catchall,s,c=R.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Rr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Io(n,t,e,r,a,o))):Io(s,t,e,r,a,o)}return o?zo(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Vo=L(`$ZodObjectJIT`,(e,t)=>{Bo.init(e,t);let n=e._zod.parse,r=ir(()=>Ro(t)),i=R.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Ra([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
116
116
|
let ${e}_ab = false;
|
|
@@ -164,10 +164,63 @@ import{createRequire as e}from"node:module";import{spawn as t}from"node:child_pr
|
|
|
164
164
|
|
|
165
165
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=vr,c=!R.jitless,l=c&&yr.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?zo([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Ho(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Rr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ur(e,r,pi())))}),t)}var Uo=L(`$ZodUnion`,(e,t)=>{B.init(e,t),I(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),I(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),I(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),I(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>or(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ho(t,r,e,i)):Ho(o,r,e,i)}});function Wo(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Go=L(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Uo.init(e,t);let n=e._zod.parse;I(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||cr(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=lr(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ir(()=>Wo(t));e._zod.parse=(i,a)=>{let o=i.value;if(!vr(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Ko=L(`$ZodIntersection`,(e,t)=>{B.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Jo(e,t,n)):Jo(e,i,a)}});function qo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(br(e)&&br(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=qo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=qo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Jo(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=qo(t.value,n.value);if(!c.valid){if(Rr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yo=L(`$ZodEnum`,(e,t)=>{B.init(e,t);let n=er(t.entries),r=new Set(n);e._zod.values=r,I(e,`pattern`,e=>{let t=er(e.def.entries).filter(e=>Sr.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Cr(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Xo=L(`$ZodLiteral`,(e,t)=>{B.init(e,t);let n=new Set(t.values);e._zod.values=n,I(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Cr(e):e?Cr(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Zo=L(`$ZodTransform`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,R.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new fi(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new di;return n.value=i,n}});function Qo(e,t){return e.value=t.issues.length?void 0:t.value,e}var $o=L(`$ZodOptional`,(e,t)=>{B.init(e,t),I(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,I(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),I(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${or(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Qo(e,t)):Qo(e,r)}return t.innerType._zod.run(e,n)}}),es=L(`$ZodExactOptional`,(e,t)=>{$o.init(e,t),I(e,`values`,e=>e.def.innerType._zod.values),I(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ts=L(`$ZodNullable`,(e,t)=>{B.init(e,t),I(e,`optin`,e=>e.def.innerType._zod.optin),I(e,`optout`,e=>e.def.innerType._zod.optout),I(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${or(t.source)}|null)$`):void 0}),I(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ns=L(`$ZodDefault`,(e,t)=>{B.init(e,t),e._zod.optin=`defaulted`,I(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>rs(e,t)):rs(r,t)}});function rs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var is=L(`$ZodPrefault`,(e,t)=>{B.init(e,t),e._zod.optin=`defaulted`,I(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),as=L(`$ZodNonOptional`,(e,t)=>{B.init(e,t),I(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>os(t,e)):os(i,e)}});function os(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ss(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ur(e,r,pi()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var cs=L(`$ZodCatch`,(e,t)=>{B.init(e,t),I(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),I(e,`optout`,e=>e.def.innerType._zod.optout),I(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ss(e,r,t,n)):ss(e,r,t,n)}}),ls=L(`$ZodPipe`,(e,t)=>{B.init(e,t),I(e,`values`,e=>e.def.in._zod.values),I(e,`optin`,e=>e.def.in._zod.optin),I(e,`optout`,e=>e.def.out._zod.optout),I(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>us(e,t.in,n)):us(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>us(e,t.out,n)):us(r,t.out,n)}});function us(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ds=L(`$ZodReadonly`,(e,t)=>{B.init(e,t),I(e,`propValues`,e=>e.def.innerType._zod.propValues),I(e,`values`,e=>e.def.innerType._zod.values),I(e,`optin`,e=>e.def.innerType?._zod?.optin),I(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(fs):fs(r)}});function fs(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ps=L(`$ZodCustom`,(e,t)=>{z.init(e,t),B.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ms(t,n,r,e));ms(i,n,r,e)}});function ms(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Jr(e))}}var hs=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},gs=`~memo`,_s=[];function vs(e){return typeof e==`object`&&!!e}function ys(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var bs=new WeakMap,xs=0,Ss=1,Cs=2;function ws(e,t,n){let r=bs.get(e);if(r!==void 0)return r?Cs:xs;if(t.has(e))return Cs;t.add(e);let i=xs,a=e=>{if(i!==Cs&&e?._zod){let r=ws(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=xs;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ss:o.value?._zod?ws(o.value,t,n):xs;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=lr(c);s(e?o(e,!0):Ss),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ws(r,t,!1):Ss);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ts(e,i)}function Ts(e,t){return t!==Ss&&bs.set(e,t===Cs),t}function Es(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ds,Os=[],ks={alloc(e,t,n){let r=Ds;if(!r)return n;Ds=void 0;let i={value:n,issues:null};return r.set(t.value,i),Os.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&js(n,e.value))throw new hs;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ws(e,new Set,!1);if(i===xs)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Cs||r?n=!0:r=!0}let l=s.value;if(!vs(l))return t(s,c);let u=c[gs];u||(u={buckets:new WeakMap,backEdges:void 0},c[gs]=u);let d;i===c?d=a:(d=Es(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ys(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ds=d;let p=Os.length,m=t(s,c);Ds=void 0;let h=Os.length>p?Os.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ys(e.issues):_s),e)):(h&&(h.issues=m.issues.length?ys(m.issues):_s),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function As(){return ks}function js(e,t){let n=e[gs]?.backEdges;return n!==void 0&&vs(t)&&n.has(t)}var Ms=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(qr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Tr(e.values[0])}`:`Invalid option: expected one of ${tr(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${tr(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ns(){return{localeError:Ms()}}var Ps,Fs=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Is(){return new Fs}(Ps=globalThis).__zod_globalRegistry??(Ps.__zod_globalRegistry=Is());var Ls=globalThis.__zod_globalRegistry;function Rs(e){return e.checks&&=[...e.checks],e}function zs(e,t){return new e(Rs({type:`string`,...F(t)}))}function Bs(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...F(t)})}function Vs(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...F(t)})}function Hs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...F(t)})}function Us(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...F(t)})}function Ws(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...F(t)})}function Gs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...F(t)})}function Ks(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...F(t)})}function qs(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...F(t)})}function Js(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...F(t)})}function Ys(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...F(t)})}function Xs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...F(t)})}function Zs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...F(t)})}function Qs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...F(t)})}function $s(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...F(t)})}function ec(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...F(t)})}function tc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...F(t)})}function nc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...F(t)})}function rc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...F(t)})}function ic(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...F(t)})}function ac(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...F(t)})}function oc(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...F(t)})}function sc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...F(t)})}function cc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...F(t)})}function lc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...F(t)})}function uc(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...F(t)})}function dc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...F(t)})}function fc(e,t){return new e(Rs({type:`number`,checks:[],...F(t)}))}function pc(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...F(t)})}function mc(e,t){return new e({type:`boolean`,...F(t)})}function hc(e){return new e({type:`unknown`})}function gc(e,t){return new e({type:`never`,...F(t)})}function _c(e,t){return new Ca({check:`less_than`,...F(t),value:e,inclusive:!1})}function vc(e,t){return new Ca({check:`less_than`,...F(t),value:e,inclusive:!0})}function yc(e,t){return new wa({check:`greater_than`,...F(t),value:e,inclusive:!1})}function bc(e,t){return new wa({check:`greater_than`,...F(t),value:e,inclusive:!0})}function xc(e,t){return new Ta({check:`multiple_of`,...F(t),value:e})}function Sc(e,t){return new Da({check:`max_length`,...F(t),maximum:e})}function Cc(e,t){return new Oa({check:`min_length`,...F(t),minimum:e})}function wc(e,t){return new ka({check:`length_equals`,...F(t),length:e})}function Tc(e,t){return new ja({check:`string_format`,format:`regex`,...F(t),pattern:e})}function Ec(e){return new Ma({check:`string_format`,format:`lowercase`,...F(e)})}function Dc(e){return new Na({check:`string_format`,format:`uppercase`,...F(e)})}function Oc(e,t){return new Pa({check:`string_format`,format:`includes`,...F(t),includes:e})}function kc(e,t){return new Fa({check:`string_format`,format:`starts_with`,...F(t),prefix:e})}function Ac(e,t){return new Ia({check:`string_format`,format:`ends_with`,...F(t),suffix:e})}function jc(e){return new La({check:`overwrite`,tx:e})}function Mc(e){return jc(t=>t.normalize(e))}function Nc(){return jc(e=>e.trim())}function Pc(){return jc(e=>e.toLowerCase())}function Fc(){return jc(e=>e.toUpperCase())}function Ic(){return jc(e=>gr(e))}function Lc(e,t,n){return new e({type:`array`,element:t,...F(n)})}function Rc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...F(n)})}function zc(e,t){let n=Bc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Jr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Jr(r))}},e(t.value,t)),t);return n}function Bc(e,t){let n=new z({check:`custom`,...F(t)});return n._zod.check=e,n}function Vc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&cr(e,t,n[t]);return e}function Hc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ls,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Uc(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function H(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,H(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Vc(o.schema,c),t.io===`input`&&U(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Wc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Gc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Wc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Wc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
166
166
|
|
|
167
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Kc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Kc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var qc=new Set([`type`,`properties`,`required`,`additionalProperties`]),Jc=[`oneOf`,`anyOf`];function Yc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Xc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!qc.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Yc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}cr(n,r,e.length===1?e[0]:Xc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Yc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Zc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of qc)if(t in e)return;let n=t.filter(e=>Jc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Xc(t);else{let e=n[0],i=Jc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Xc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Vc(e,r))}function Qc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Vc(i,s),Vc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Kc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Zc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Vc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,cr(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:el(t,`input`,e.processors),output:el(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function U(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return U(r.element,n);if(r.type===`set`)return U(r.valueType,n);if(r.type===`lazy`)return U(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return U(r.innerType,n);if(r.type===`intersection`)return U(r.left,n)||U(r.right,n);if(r.type===`record`||r.type===`map`)return U(r.keyType,n)||U(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:U(r.in,n)||U(r.out,n);if(r.type===`object`){for(let e in r.shape)if(U(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(U(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(U(e,n))return!0;return!!(r.rest&&U(r.rest,n))}return!1}var $c=(e,t={})=>n=>{let r=Hc({...n,processors:t});return H(e,r),Gc(r,e),Qc(r,e)},el=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Hc({...i??{},target:a,io:t,processors:n});return H(e,o),Gc(o,e),Qc(o,e)},tl=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},nl=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},rl=(e,t)=>{tl(e,`minimum`,t),nl(e,`maximum`,t)},il=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},al=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},ol=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},sl=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},cl=(e,t)=>tl(e,`minimum`,t.minimum),ll=(e,t)=>nl(e,`maximum`,t.maximum),ul=e=>(t,n)=>{sl(t,n.format);let[r,i]=e[n.format];tl(t,`minimum`,r),nl(t,`maximum`,i)},dl={greater_than:(e,t)=>tl(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>nl(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>il(e,t.value),number_format:ul(Dr),bigint_format:ul(Or),min_length:cl,max_length:ll,length_equals:(e,t)=>rl(e,t.length),min_size:cl,max_size:ll,size_equals:(e,t)=>rl(e,t.size),string_format:(e,t)=>{sl(e,t.format),t.pattern&&al(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ol(e,t.mime)};function fl(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)dl[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&tl(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&tl(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&nl(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&nl(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&il(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ol(t,i.mime);for(let e of i.patterns??[])al(t,e);return t}var pl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ml=new Map([[xo,oa],[Co,sa]]),hl=e=>ml.get(e)??e,gl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=fl(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=pl[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(hl);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},_l=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=fl(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Uc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},vl=(e,t,n,r)=>{n.type=`boolean`},yl=(e,t,n,r)=>{n.not={}},bl=(e,t,n,r)=>{let i=e._zod.def,a=er(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},xl=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Uc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Uc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Sl=(e,t,n,r)=>{Uc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Cl=(e,t,n,r)=>{Uc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},wl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=fl(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=H(a.element,t,{...r,path:[...r.path,`items`]})};function Tl(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Tl(t.out):t.type===`catch`?Tl(t.innerType):e._zod.optin}var El=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Uc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)cr(i.properties,e,H(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Tl(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=H(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Dl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>H(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ol=(e,t,n,r)=>{let i=e._zod.def,a=H(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=H(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},kl=(e,t,n,r)=>{let i=e._zod.def,a=H(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Al=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jl=Symbol();function Ml(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Uc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),jl):JSON.parse(o)}var Nl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ml(i.defaultValue,e,t,n,r);o!==jl&&(n.default=o)},Pl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ml(i.defaultValue,e,t,n,r);o!==jl&&(n._prefault=o)},Fl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Uc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Il=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;H(o,t,r);let s=t.seen.get(e);s.ref=o},Ll=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Rl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zl=new WeakSet([Object.prototype,Error.prototype]);function Bl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var W=L(`ZodError`,(e,t)=>{bi.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);zl.has(n)||(zl.add(n),Bl(n,`format`,e=>t=>Ci(e,t)),Bl(n,`flatten`,e=>t=>Si(e,t)),Bl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,nr,2)}),Bl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,nr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Vl=Ti(W),Hl=Ei(W),Ul=Di(W),Wl=ki(W),Gl=Fi(W),Kl=Ii(W),ql=Li(W),Jl=Ri(W),Yl=zi(W),Xl=Bi(W),Zl=Vi(W),Ql=Hi(W);function $l(){R.localeError||pi(Ns())}function eu(){R.memoizer||pi({memoizer:As()})}var G=L(`ZodType`,(e,t)=>($l(),B.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(P(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return wr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_d(e,t))},superRefine(e,t){return this.check(vd(e,t))},overwrite(e){return this.check(jc(e))},optional(){return $u(this)},exactOptional(){return td(this)},nullable(){return rd(this)},nullish(){return $u(rd(this))},nonoptional(e){return ld(this,e)},array(){return J(this)},or(e){return Vu([this,e])},and(e){return Gu(this,e)},transform(e){return pd(this,Zu(e))},default(e){return ad(this,e)},prefault(e){return sd(this,e)},catch(e){return dd(this,e)},pipe(e){return pd(this,e)},readonly(){return hd(this)},describe(e){let t=this.clone();return Ls.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ls.get(this);let t=this.clone();return Ls.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Zr(this,`~standard`,{...Ha(this),jsonSchema:{input:el(this,`input`),output:el(this,`output`)}})},set"~standard"(e){Xr(this,`~standard`,e)},parse:function e(t,n){return Vl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Hl(this,t,n,{callee:e})},safeParse(e,t){return Ul(this,e,t)},async safeParseAsync(e,t){return Wl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Xr(this,`spa`,e)},validate(e,t){return Mi(this,e,t)},validateAsync(e,t){return Pi(this,e,t)},encode:function e(t,n){return Gl(this,t,n,{callee:e})},decode:function e(t,n){return Kl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ql(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Jl(this,t,n,{callee:e})},safeEncode(e,t){return Yl(this,e,t)},safeDecode(e,t){return Xl(this,e,t)},async safeEncodeAsync(e,t){return Zl(this,e,t)},async safeDecodeAsync(e,t){return Ql(this,e,t)},toJSONSchema(e){return $c(this,{})(e)},get description(){return Ls.get(this)?.description},get _def(){return this._zod.def}}),tu=L(`_ZodString`,(e,t)=>{Ua.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)},Qr({format:e=>fl(e).format??null,minLength:e=>fl(e).minimum??null,maxLength:e=>fl(e).maximum??null},{regex(...e){return this.check(Tc(...e))},includes(...e){return this.check(Oc(...e))},startsWith(...e){return this.check(kc(...e))},endsWith(...e){return this.check(Ac(...e))},min(...e){return this.check(Cc(...e))},max(...e){return this.check(Sc(...e))},length(...e){return this.check(wc(...e))},nonempty(...e){return this.check(Cc(1,...e))},lowercase(e){return this.check(Ec(e))},uppercase(e){return this.check(Dc(e))},trim(){return this.check(Nc())},normalize(...e){return this.check(Mc(...e))},toLowerCase(){return this.check(Pc())},toUpperCase(){return this.check(Fc())},slugify(){return this.check(Ic())}})),nu=L(`ZodString`,(e,t)=>{Ua.init(e,t),tu.init(e,t)},{email(e){return this.check(Bs(cu,e))},url(e){return this.check(Ks(du,e))},jwt(e){return this.check(sc(Du,e))},emoji(e){return this.check(qs(pu,e))},guid(e){return this.check(Vs(lu,e))},uuid(e){return this.check(Hs(uu,e))},uuidv4(e){return this.check(Us(uu,e))},uuidv6(e){return this.check(Ws(uu,e))},uuidv7(e){return this.check(Gs(uu,e))},nanoid(e){return this.check(Js(mu,e))},cuid(e){return this.check(Ys(hu,e))},cuid2(e){return this.check(Xs(gu,e))},ulid(e){return this.check(Zs(_u,e))},base64(e){return this.check(ic(wu,e))},base64url(e){return this.check(ac(Tu,e))},xid(e){return this.check(Qs(vu,e))},ksuid(e){return this.check($s(yu,e))},ipv4(e){return this.check(ec(bu,e))},ipv6(e){return this.check(tc(xu,e))},cidrv4(e){return this.check(nc(Su,e))},cidrv6(e){return this.check(rc(Cu,e))},e164(e){return this.check(oc(Eu,e))},datetime(e){return this.check(cc(iu,e))},date(e){return this.check(lc(au,e))},time(e){return this.check(uc(ou,e))},duration(e){return this.check(dc(su,e))}});function ru(e){return zs(nu,e)}var K=L(`ZodStringFormat`,(e,t)=>{V.init(e,t),tu.init(e,t)}),iu=L(`ZodISODateTime`,(e,t)=>{co.init(e,t),K.init(e,t)}),au=L(`ZodISODate`,(e,t)=>{lo.init(e,t),K.init(e,t)}),ou=L(`ZodISOTime`,(e,t)=>{uo.init(e,t),K.init(e,t)}),su=L(`ZodISODuration`,(e,t)=>{fo.init(e,t),K.init(e,t)}),cu=L(`ZodEmail`,(e,t)=>{Ka.init(e,t),K.init(e,t)}),lu=L(`ZodGUID`,(e,t)=>{Wa.init(e,t),K.init(e,t)}),uu=L(`ZodUUID`,(e,t)=>{Ga.init(e,t),K.init(e,t)}),du=L(`ZodURL`,(e,t)=>{eo.init(e,t),K.init(e,t)});function fu(e){return Ks(du,e)}var pu=L(`ZodEmoji`,(e,t)=>{to.init(e,t),K.init(e,t)}),mu=L(`ZodNanoID`,(e,t)=>{no.init(e,t),K.init(e,t)}),hu=L(`ZodCUID`,(e,t)=>{ro.init(e,t),K.init(e,t)}),gu=L(`ZodCUID2`,(e,t)=>{io.init(e,t),K.init(e,t)}),_u=L(`ZodULID`,(e,t)=>{ao.init(e,t),K.init(e,t)}),vu=L(`ZodXID`,(e,t)=>{oo.init(e,t),K.init(e,t)}),yu=L(`ZodKSUID`,(e,t)=>{so.init(e,t),K.init(e,t)}),bu=L(`ZodIPv4`,(e,t)=>{po.init(e,t),K.init(e,t)}),xu=L(`ZodIPv6`,(e,t)=>{go.init(e,t),K.init(e,t)}),Su=L(`ZodCIDRv4`,(e,t)=>{_o.init(e,t),K.init(e,t)}),Cu=L(`ZodCIDRv6`,(e,t)=>{yo.init(e,t),K.init(e,t)}),wu=L(`ZodBase64`,(e,t)=>{So.init(e,t),K.init(e,t)}),Tu=L(`ZodBase64URL`,(e,t)=>{To.init(e,t),K.init(e,t)}),Eu=L(`ZodE164`,(e,t)=>{Eo.init(e,t),K.init(e,t)}),Du=L(`ZodJWT`,(e,t)=>{Oo.init(e,t),K.init(e,t)}),Ou=L(`ZodNumber`,(e,t)=>{ko.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r),e.isFinite=!0},Qr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=fl(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=fl(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=fl(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>fl(e).format??null},{gt(e,t){return this.check(yc(e,t))},gte(e,t){return this.check(bc(e,t))},min(e,t){return this.check(bc(e,t))},lt(e,t){return this.check(_c(e,t))},lte(e,t){return this.check(vc(e,t))},max(e,t){return this.check(vc(e,t))},int(e){return this.check(Au(e))},safe(e){return this.check(Au(e))},positive(e){return this.check(yc(0,e))},nonnegative(e){return this.check(bc(0,e))},negative(e){return this.check(_c(0,e))},nonpositive(e){return this.check(vc(0,e))},multipleOf(e,t){return this.check(xc(e,t))},step(e,t){return this.check(xc(e,t))},finite(){return this}}));function q(e){return fc(Ou,e)}var ku=L(`ZodNumberFormat`,(e,t)=>{Ao.init(e,t),Ou.init(e,t)});function Au(e){return pc(ku,e)}var ju=L(`ZodBoolean`,(e,t)=>{jo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r)});function Mu(e){return mc(ju,e)}var Nu=L(`ZodUnknown`,(e,t)=>{Mo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pu(){return hc(Nu)}var Fu=L(`ZodNever`,(e,t)=>{No.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r)});function Iu(e){return gc(Fu,e)}var Lu=L(`ZodArray`,(e,t)=>{eu(),Fo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Cc(e,t))},nonempty(e){return this.check(Cc(1,e))},max(e,t){return this.check(Sc(e,t))},length(e,t){return this.check(wc(e,t))},unwrap(){return this.element}});function J(e,t){return Lc(Lu,e,t)}var Ru=L(`ZodObject`,(e,t)=>{eu(),Vo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),ii(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return qu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(P(this._zod.def,{catchall:e}))},passthrough(){return this.clone(P(this._zod.def,{catchall:Pu()}))},loose(){return this.clone(P(this._zod.def,{catchall:Pu()}))},strict(){return this.clone(P(this._zod.def,{catchall:Iu()}))},strip(){return this.clone(P(this._zod.def,{catchall:void 0}))},extend(e){return Mr(this,e)},safeExtend(e){return Pr(this,e)},merge(e){return Fr(this,e)},pick(e){return kr(this,e)},omit(e){return jr(this,e)},partial(...e){return Ir(Qu,this,e[0])},exactPartial(...e){return Ir(ed,this,e[0],`exactPartial`)},required(...e){return Lr(cd,this,e[0])}});function Y(e,t){return new Ru({type:`object`,shape:e??{},...F(t)})}function zu(e,t){return new Ru({type:`object`,shape:e,catchall:Pu(),...F(t)})}var Bu=L(`ZodUnion`,(e,t)=>{Uo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.options=t.options});function Vu(e,t){return new Bu({type:`union`,options:e,...F(t)})}var Hu=L(`ZodDiscriminatedUnion`,(e,t)=>{Bu.init(e,t),Go.init(e,t)});function Uu(e,t,n){return new Hu({type:`union`,options:t,discriminator:e,...F(n)})}var Wu=L(`ZodIntersection`,(e,t)=>{Ko.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r)});function Gu(e,t){return new Wu({type:`intersection`,left:e,right:t})}var Ku=L(`ZodEnum`,(e,t)=>{Yo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ku({...t,checks:[],...F(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ku({...t,checks:[],...F(r),entries:i})}});function qu(e,t){return new Ku({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...F(t)})}var Ju=L(`ZodLiteral`,(e,t)=>{Xo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Yu(e,t){return new Ju({type:`literal`,values:Array.isArray(e)?e:[e],...F(t)})}var Xu=L(`ZodTransform`,(e,t)=>{eu(),Zo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new fi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Jr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Jr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Zu(e){return new Xu({type:`transform`,transform:e})}var Qu=L(`ZodOptional`,(e,t)=>{$o.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new Qu({type:`optional`,innerType:e})}var ed=L(`ZodExactOptional`,(e,t)=>{es.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function td(e){return new ed({type:`optional`,innerType:e})}var nd=L(`ZodNullable`,(e,t)=>{ts.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rd(e){return new nd({type:`nullable`,innerType:e})}var id=L(`ZodDefault`,(e,t)=>{ns.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ad(e,t){return new id({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xr(t)}})}var od=L(`ZodPrefault`,(e,t)=>{is.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e,t){return new od({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xr(t)}})}var cd=L(`ZodNonOptional`,(e,t)=>{as.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ld(e,t){return new cd({type:`nonoptional`,innerType:e,...F(t)})}var ud=L(`ZodCatch`,(e,t)=>{cs.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dd(e,t){return new ud({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:oi(t)})}var fd=L(`ZodPipe`,(e,t)=>{ls.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),e.in=t.in,e.out=t.out});function pd(e,t){return new fd({type:`pipe`,in:e,out:t})}var md=L(`ZodReadonly`,(e,t)=>{ds.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hd(e){return new md({type:`readonly`,innerType:e})}var gd=L(`ZodCustom`,(e,t)=>{ps.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r)});function _d(e,t={}){return Rc(gd,e,t)}function vd(e,t){return zc(e,t)}var X={speech:4e3,line:2e3,history:1e3,listItem:500,pageText:3e5,snapshot:2e5,narration:4e3,transcriptSpeech:1e4},Z=e=>ru().max(e),yd=[`blocker`,`serious`,`moderate`,`minor`],bd=[`task`,`axe`,`focus`,`screen-reader`],xd=qu([`browse`,`focus`]),Sd=Y({provider:Z(40).optional(),repo:Z(200).optional(),branch:Z(200).min(1),defaultBranch:Z(200).optional(),sha:Z(64).optional(),pr:q().int().positive().optional(),jobUrl:fu().max(500).optional()});Y({testId:ru().min(1).max(64),baseUrl:fu().max(500).optional(),ci:Sd.optional()});var Cd=Y({step:q().int().min(0).max(1e3),keys:Z(200),mode:xd,speech:Z(X.speech),notes:J(Z(500)).max(10).optional()});Y({context:Y({pageTitle:Z(500),mode:xd,heard:J(Cd).max(120),position:Z(X.line),focus:Z(X.line),focusIsEditable:Mu(),openList:J(Z(X.listItem)).max(500).optional(),history:J(Z(X.history)).max(300),pageText:Z(X.pageText)}),evidence:Z(2e3).min(1)});var wd=zu({keys:Z(200),mode:xd,speech:Z(X.transcriptSpeech)}),Td=zu({index:q(),role:Z(200),name:Z(2e3),tag:Z(50)}),Ed=Y({narration:Z(X.narration).optional(),screenshotKey:Z(300).optional(),action:Z(100).optional(),targetRole:Z(200).optional(),targetName:Z(2e3).optional(),typedValue:Z(2e3).optional(),heard:J(wd).max(100).optional(),keystrokes:q().int().min(0).optional(),decision:zu({engine:Z(200),confidence:q(),reason:Z(4e3).optional(),evidence:Z(2e3).optional()}).optional()}),Dd=Y({fingerprint:Z(200),severity:qu(yd),source:qu(bd),title:Z(500),detail:Z(1e4),wcag:Z(100).optional(),stepN:q().int().min(0).max(1e3),pageUrl:Z(2e3),selector:Z(2e3).optional()});Y({events:J(Uu(`type`,[Y({type:Yu(`stepStarted`),step:Y({n:q().int().min(1).max(1e3),pageUrl:Z(2e3),pageTitle:Z(500),narration:Z(X.narration),tabStops:J(Td).max(1e3),screenshotKey:Z(300).optional()})}),Y({type:Yu(`stepUpdated`),n:q().int().min(1).max(1e3),patch:Ed}),Y({type:Yu(`findings`),findings:J(Dd).max(500)}),Y({type:Yu(`activity`),text:Z(200)})])).max(200)});var Od=zu({score:q()});Y({outcome:qu([`completed`,`blocked`,`inconclusive`,`error`,`cancelled`]),summary:Z(4e3).optional(),error:Z(4e3).optional(),steps:q().int().min(0).max(1e3),scores:zu({overall:q(),context:Od,design:Od}),pageSnapshots:J(Y({page:Z(2e3),url:Z(2e3),title:Z(500),snapshot:Z(X.snapshot)})).max(50),transcript:J(wd).max(5e3)});function kd(){try{return JSON.parse(f(process.env.GITHUB_EVENT_PATH??``,`utf8`)).repository?.default_branch}catch{return}}function Ad(e=process.env){if(e.GITHUB_ACTIONS===`true`){let t=/^refs\/pull\/(\d+)\//.exec(e.GITHUB_REF??``)?.[1],n=e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME;return n?{provider:`github`,repo:e.GITHUB_REPOSITORY,branch:n,defaultBranch:kd(),sha:e.GITHUB_SHA,pr:t?Number(t):void 0,jobUrl:e.GITHUB_RUN_ID?`${e.GITHUB_SERVER_URL??`https://github.com`}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:void 0}:void 0}if(e.GITLAB_CI===`true`){let t=e.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME||e.CI_COMMIT_REF_NAME;return t?{provider:`gitlab`,repo:e.CI_PROJECT_PATH,branch:t,defaultBranch:e.CI_DEFAULT_BRANCH,sha:e.CI_COMMIT_SHA,pr:e.CI_MERGE_REQUEST_IID?Number(e.CI_MERGE_REQUEST_IID):void 0,jobUrl:e.CI_JOB_URL}:void 0}if(e.BUILDKITE===`true`&&e.BUILDKITE_BRANCH)return{provider:`buildkite`,repo:e.BUILDKITE_REPO,branch:e.BUILDKITE_BRANCH,defaultBranch:e.BUILDKITE_PIPELINE_DEFAULT_BRANCH,sha:e.BUILDKITE_COMMIT,pr:e.BUILDKITE_PULL_REQUEST&&e.BUILDKITE_PULL_REQUEST!==`false`?Number(e.BUILDKITE_PULL_REQUEST):void 0,jobUrl:e.BUILDKITE_BUILD_URL}}var Q=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,jd=class{api;runId;model;signal;onRejected;constructor(e,t,n,r,i=()=>{}){this.api=e,this.runId=t,this.model=n,this.signal=r,this.onRejected=i}async call(e,t){try{return await this.api.post(`/local-runs/${this.runId}/${e}`,t,this.signal)}catch(e){throw e instanceof m&&(e.status===403||e.status===409)&&this.onRejected(e.message),e}}body(e,t){return{pageTitle:Q(e.pageTitle,500),mode:e.mode,heard:e.heard.slice(-80).map(e=>({...e,keys:Q(e.keys,200),speech:Q(e.speech,X.speech),notes:e.notes?.slice(0,10).map(e=>Q(e,X.listItem))})),position:Q(e.position,X.line),focus:Q(e.focus,X.line),focusIsEditable:e.focusIsEditable,openList:e.openList?.slice(0,500).map(e=>Q(e,X.listItem)),history:e.history.slice(-300).map(e=>Q(e,X.history)),pageText:Q(t,X.pageText)}}decide(e){return this.call(`decide`,this.body(e,``))}verifyCompletion(e,t){return this.call(`verify`,{context:this.body(e,e.pageText),evidence:Q(t,2e3)})}},Md=25,Nd=1e3,Pd=e=>({...e,keys:Q(e.keys,200),speech:Q(e.speech,X.transcriptSpeech)});function Fd(e){let{decision:t}=e;return{narration:e.narration&&Q(e.narration,X.narration),screenshotKey:e.screenshotKey,action:e.action,targetRole:e.targetRole&&Q(e.targetRole,200),targetName:e.targetName&&Q(e.targetName,X.line),typedValue:e.typedValue&&Q(e.typedValue,X.line),heard:e.heard?.slice(0,100).map(Pd),keystrokes:e.keystrokes,decision:t&&{...t,engine:Q(t.engine,200),reason:t.reason&&Q(t.reason,4e3),evidence:t.evidence&&Q(t.evidence,2e3)}}}var Id=e=>({...e,title:Q(e.title,500),detail:Q(e.detail,1e4),pageUrl:Q(e.pageUrl,X.line),selector:e.selector&&Q(e.selector,X.line)}),Ld=class{api;runId;onRejected;#e=[];#t;#n=Promise.resolve();error;constructor(e,t,n){this.api=e,this.runId=t,this.onRejected=n}sink(e){let t=``;return{activity:n=>{n&&n!==t&&this.push({type:`activity`,text:Q(n,200)}),t=n,e.activity(n)},stepStarted:async t=>{this.push({type:`stepStarted`,step:{n:t.n,pageUrl:Q(t.pageUrl,X.line),pageTitle:Q(t.pageTitle,500),narration:Q(t.narration,X.narration),tabStops:t.tabStops.slice(0,1e3).map(e=>({...e,name:Q(e.name,X.line)})),screenshotKey:t.screenshotKey}}),await e.stepStarted(t)},stepUpdated:async(t,n)=>{this.push({type:`stepUpdated`,n:t,patch:Fd(n)}),await e.stepUpdated(t,n)},findings:async t=>{t.length&&this.push({type:`findings`,findings:t.slice(0,500).map(Id)}),await e.findings(t)}}}push(e){this.#e.push(e),this.#e.length>=Md?this.flush():this.#t??=setTimeout(()=>this.flush(),Nd)}flush(){return clearTimeout(this.#t),this.#t=void 0,this.#n=this.#n.then(async()=>{for(;this.#e.length&&!this.error;){let e=this.#e.splice(0,Md);try{await this.api.post(`/local-runs/${this.runId}/events`,{events:e})}catch(e){this.error=e instanceof Error?e:Error(String(e)),e instanceof m&&(e.status===403||e.status===409)&&this.onRejected(e.message)}}}),this.#n}},$=class extends Error{},Rd=3e4,zd=e=>`ARIAWALK_DATA_${e.toUpperCase().replace(/[^A-Z0-9]/g,`_`)}`;function Bd(e,t,n=process.env){let r=[],i=e.map(e=>{let i=t[e.key]??n[zd(e.key)]??e.value;return i??r.push(e.key),{key:e.key,value:i??``,isSecret:e.secret}});if(r.length)throw new $(`This test needs secret values Ariawalk never sends: ${r.join(`, `)}. Pass ${r.map(e=>`--data ${e}=…`).join(` `)} or set ${r.map(zd).join(`, `)}.`);return i}var Vd={completed:ie(`Completed`),blocked:re(`Blocked`),inconclusive:ae(`Inconclusive`),error:re(`Error`),cancelled:ae(`Stopped`)};async function Hd(e,t){if(!d(p.executablePath()))throw new $(`Chromium is not installed yet. Run: npx ariawalk install`);let n=await e.get(`/tests/${t.testId}`);Bd(n.data,t.data);let r=t.ci?Ad():void 0,i=await e.post(`/local-runs`,{testId:t.testId,baseUrl:t.baseUrl,ci:r}),a=Bd(i.data,t.data),o=e.as(i.token);T(`${w(n.name)} ${C(`· ${i.environment}`)}`),T(C(`${i.startUrl}`)),T(C(`Report: ${i.url}`)),T();let s=new AbortController,c=0,l=()=>{++c>1&&process.exit(130),T(ae(`
|
|
168
|
-
Stopping after the current step… (Ctrl+C again to quit now)`)),s.abort(`Stopped from the terminal.`)};process.on(`SIGINT`,l);let u,
|
|
167
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Kc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Kc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var qc=new Set([`type`,`properties`,`required`,`additionalProperties`]),Jc=[`oneOf`,`anyOf`];function Yc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Xc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!qc.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Yc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}cr(n,r,e.length===1?e[0]:Xc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Yc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Zc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of qc)if(t in e)return;let n=t.filter(e=>Jc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Xc(t);else{let e=n[0],i=Jc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Xc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Vc(e,r))}function Qc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Vc(i,s),Vc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Kc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Zc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Vc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,cr(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:el(t,`input`,e.processors),output:el(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function U(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return U(r.element,n);if(r.type===`set`)return U(r.valueType,n);if(r.type===`lazy`)return U(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return U(r.innerType,n);if(r.type===`intersection`)return U(r.left,n)||U(r.right,n);if(r.type===`record`||r.type===`map`)return U(r.keyType,n)||U(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:U(r.in,n)||U(r.out,n);if(r.type===`object`){for(let e in r.shape)if(U(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(U(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(U(e,n))return!0;return!!(r.rest&&U(r.rest,n))}return!1}var $c=(e,t={})=>n=>{let r=Hc({...n,processors:t});return H(e,r),Gc(r,e),Qc(r,e)},el=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Hc({...i??{},target:a,io:t,processors:n});return H(e,o),Gc(o,e),Qc(o,e)},tl=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},nl=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},rl=(e,t)=>{tl(e,`minimum`,t),nl(e,`maximum`,t)},il=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},al=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},ol=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},sl=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},cl=(e,t)=>tl(e,`minimum`,t.minimum),ll=(e,t)=>nl(e,`maximum`,t.maximum),ul=e=>(t,n)=>{sl(t,n.format);let[r,i]=e[n.format];tl(t,`minimum`,r),nl(t,`maximum`,i)},dl={greater_than:(e,t)=>tl(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>nl(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>il(e,t.value),number_format:ul(Dr),bigint_format:ul(Or),min_length:cl,max_length:ll,length_equals:(e,t)=>rl(e,t.length),min_size:cl,max_size:ll,size_equals:(e,t)=>rl(e,t.size),string_format:(e,t)=>{sl(e,t.format),t.pattern&&al(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ol(e,t.mime)};function fl(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)dl[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&tl(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&tl(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&nl(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&nl(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&il(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ol(t,i.mime);for(let e of i.patterns??[])al(t,e);return t}var pl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ml=new Map([[xo,oa],[Co,sa]]),hl=e=>ml.get(e)??e,gl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=fl(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=pl[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(hl);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},_l=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=fl(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Uc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},vl=(e,t,n,r)=>{n.type=`boolean`},yl=(e,t,n,r)=>{n.not={}},bl=(e,t,n,r)=>{let i=e._zod.def,a=er(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},xl=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Uc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Uc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Sl=(e,t,n,r)=>{Uc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Cl=(e,t,n,r)=>{Uc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},wl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=fl(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=H(a.element,t,{...r,path:[...r.path,`items`]})};function Tl(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Tl(t.out):t.type===`catch`?Tl(t.innerType):e._zod.optin}var El=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Uc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)cr(i.properties,e,H(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Tl(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=H(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Dl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>H(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ol=(e,t,n,r)=>{let i=e._zod.def,a=H(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=H(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},kl=(e,t,n,r)=>{let i=e._zod.def,a=H(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Al=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jl=Symbol();function Ml(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Uc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),jl):JSON.parse(o)}var Nl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ml(i.defaultValue,e,t,n,r);o!==jl&&(n.default=o)},Pl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ml(i.defaultValue,e,t,n,r);o!==jl&&(n._prefault=o)},Fl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Uc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Il=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;H(o,t,r);let s=t.seen.get(e);s.ref=o},Ll=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Rl=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zl=new WeakSet([Object.prototype,Error.prototype]);function Bl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var W=L(`ZodError`,(e,t)=>{bi.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);zl.has(n)||(zl.add(n),Bl(n,`format`,e=>t=>Ci(e,t)),Bl(n,`flatten`,e=>t=>Si(e,t)),Bl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,nr,2)}),Bl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,nr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Vl=Ti(W),Hl=Ei(W),Ul=Di(W),Wl=ki(W),Gl=Fi(W),Kl=Ii(W),ql=Li(W),Jl=Ri(W),Yl=zi(W),Xl=Bi(W),Zl=Vi(W),Ql=Hi(W);function $l(){R.localeError||pi(Ns())}function eu(){R.memoizer||pi({memoizer:As()})}var G=L(`ZodType`,(e,t)=>($l(),B.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(P(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return wr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_d(e,t))},superRefine(e,t){return this.check(vd(e,t))},overwrite(e){return this.check(jc(e))},optional(){return $u(this)},exactOptional(){return td(this)},nullable(){return rd(this)},nullish(){return $u(rd(this))},nonoptional(e){return ld(this,e)},array(){return J(this)},or(e){return Vu([this,e])},and(e){return Gu(this,e)},transform(e){return pd(this,Zu(e))},default(e){return ad(this,e)},prefault(e){return sd(this,e)},catch(e){return dd(this,e)},pipe(e){return pd(this,e)},readonly(){return hd(this)},describe(e){let t=this.clone();return Ls.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ls.get(this);let t=this.clone();return Ls.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Zr(this,`~standard`,{...Ha(this),jsonSchema:{input:el(this,`input`),output:el(this,`output`)}})},set"~standard"(e){Xr(this,`~standard`,e)},parse:function e(t,n){return Vl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Hl(this,t,n,{callee:e})},safeParse(e,t){return Ul(this,e,t)},async safeParseAsync(e,t){return Wl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Xr(this,`spa`,e)},validate(e,t){return Mi(this,e,t)},validateAsync(e,t){return Pi(this,e,t)},encode:function e(t,n){return Gl(this,t,n,{callee:e})},decode:function e(t,n){return Kl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ql(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Jl(this,t,n,{callee:e})},safeEncode(e,t){return Yl(this,e,t)},safeDecode(e,t){return Xl(this,e,t)},async safeEncodeAsync(e,t){return Zl(this,e,t)},async safeDecodeAsync(e,t){return Ql(this,e,t)},toJSONSchema(e){return $c(this,{})(e)},get description(){return Ls.get(this)?.description},get _def(){return this._zod.def}}),tu=L(`_ZodString`,(e,t)=>{Ua.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)},Qr({format:e=>fl(e).format??null,minLength:e=>fl(e).minimum??null,maxLength:e=>fl(e).maximum??null},{regex(...e){return this.check(Tc(...e))},includes(...e){return this.check(Oc(...e))},startsWith(...e){return this.check(kc(...e))},endsWith(...e){return this.check(Ac(...e))},min(...e){return this.check(Cc(...e))},max(...e){return this.check(Sc(...e))},length(...e){return this.check(wc(...e))},nonempty(...e){return this.check(Cc(1,...e))},lowercase(e){return this.check(Ec(e))},uppercase(e){return this.check(Dc(e))},trim(){return this.check(Nc())},normalize(...e){return this.check(Mc(...e))},toLowerCase(){return this.check(Pc())},toUpperCase(){return this.check(Fc())},slugify(){return this.check(Ic())}})),nu=L(`ZodString`,(e,t)=>{Ua.init(e,t),tu.init(e,t)},{email(e){return this.check(Bs(cu,e))},url(e){return this.check(Ks(du,e))},jwt(e){return this.check(sc(Du,e))},emoji(e){return this.check(qs(pu,e))},guid(e){return this.check(Vs(lu,e))},uuid(e){return this.check(Hs(uu,e))},uuidv4(e){return this.check(Us(uu,e))},uuidv6(e){return this.check(Ws(uu,e))},uuidv7(e){return this.check(Gs(uu,e))},nanoid(e){return this.check(Js(mu,e))},cuid(e){return this.check(Ys(hu,e))},cuid2(e){return this.check(Xs(gu,e))},ulid(e){return this.check(Zs(_u,e))},base64(e){return this.check(ic(wu,e))},base64url(e){return this.check(ac(Tu,e))},xid(e){return this.check(Qs(vu,e))},ksuid(e){return this.check($s(yu,e))},ipv4(e){return this.check(ec(bu,e))},ipv6(e){return this.check(tc(xu,e))},cidrv4(e){return this.check(nc(Su,e))},cidrv6(e){return this.check(rc(Cu,e))},e164(e){return this.check(oc(Eu,e))},datetime(e){return this.check(cc(iu,e))},date(e){return this.check(lc(au,e))},time(e){return this.check(uc(ou,e))},duration(e){return this.check(dc(su,e))}});function ru(e){return zs(nu,e)}var K=L(`ZodStringFormat`,(e,t)=>{V.init(e,t),tu.init(e,t)}),iu=L(`ZodISODateTime`,(e,t)=>{co.init(e,t),K.init(e,t)}),au=L(`ZodISODate`,(e,t)=>{lo.init(e,t),K.init(e,t)}),ou=L(`ZodISOTime`,(e,t)=>{uo.init(e,t),K.init(e,t)}),su=L(`ZodISODuration`,(e,t)=>{fo.init(e,t),K.init(e,t)}),cu=L(`ZodEmail`,(e,t)=>{Ka.init(e,t),K.init(e,t)}),lu=L(`ZodGUID`,(e,t)=>{Wa.init(e,t),K.init(e,t)}),uu=L(`ZodUUID`,(e,t)=>{Ga.init(e,t),K.init(e,t)}),du=L(`ZodURL`,(e,t)=>{eo.init(e,t),K.init(e,t)});function fu(e){return Ks(du,e)}var pu=L(`ZodEmoji`,(e,t)=>{to.init(e,t),K.init(e,t)}),mu=L(`ZodNanoID`,(e,t)=>{no.init(e,t),K.init(e,t)}),hu=L(`ZodCUID`,(e,t)=>{ro.init(e,t),K.init(e,t)}),gu=L(`ZodCUID2`,(e,t)=>{io.init(e,t),K.init(e,t)}),_u=L(`ZodULID`,(e,t)=>{ao.init(e,t),K.init(e,t)}),vu=L(`ZodXID`,(e,t)=>{oo.init(e,t),K.init(e,t)}),yu=L(`ZodKSUID`,(e,t)=>{so.init(e,t),K.init(e,t)}),bu=L(`ZodIPv4`,(e,t)=>{po.init(e,t),K.init(e,t)}),xu=L(`ZodIPv6`,(e,t)=>{go.init(e,t),K.init(e,t)}),Su=L(`ZodCIDRv4`,(e,t)=>{_o.init(e,t),K.init(e,t)}),Cu=L(`ZodCIDRv6`,(e,t)=>{yo.init(e,t),K.init(e,t)}),wu=L(`ZodBase64`,(e,t)=>{So.init(e,t),K.init(e,t)}),Tu=L(`ZodBase64URL`,(e,t)=>{To.init(e,t),K.init(e,t)}),Eu=L(`ZodE164`,(e,t)=>{Eo.init(e,t),K.init(e,t)}),Du=L(`ZodJWT`,(e,t)=>{Oo.init(e,t),K.init(e,t)}),Ou=L(`ZodNumber`,(e,t)=>{ko.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r),e.isFinite=!0},Qr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=fl(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=fl(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=fl(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>fl(e).format??null},{gt(e,t){return this.check(yc(e,t))},gte(e,t){return this.check(bc(e,t))},min(e,t){return this.check(bc(e,t))},lt(e,t){return this.check(_c(e,t))},lte(e,t){return this.check(vc(e,t))},max(e,t){return this.check(vc(e,t))},int(e){return this.check(Au(e))},safe(e){return this.check(Au(e))},positive(e){return this.check(yc(0,e))},nonnegative(e){return this.check(bc(0,e))},negative(e){return this.check(_c(0,e))},nonpositive(e){return this.check(vc(0,e))},multipleOf(e,t){return this.check(xc(e,t))},step(e,t){return this.check(xc(e,t))},finite(){return this}}));function q(e){return fc(Ou,e)}var ku=L(`ZodNumberFormat`,(e,t)=>{Ao.init(e,t),Ou.init(e,t)});function Au(e){return pc(ku,e)}var ju=L(`ZodBoolean`,(e,t)=>{jo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r)});function Mu(e){return mc(ju,e)}var Nu=L(`ZodUnknown`,(e,t)=>{Mo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pu(){return hc(Nu)}var Fu=L(`ZodNever`,(e,t)=>{No.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r)});function Iu(e){return gc(Fu,e)}var Lu=L(`ZodArray`,(e,t)=>{eu(),Fo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Cc(e,t))},nonempty(e){return this.check(Cc(1,e))},max(e,t){return this.check(Sc(e,t))},length(e,t){return this.check(wc(e,t))},unwrap(){return this.element}});function J(e,t){return Lc(Lu,e,t)}var Ru=L(`ZodObject`,(e,t)=>{eu(),Vo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),ii(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return qu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(P(this._zod.def,{catchall:e}))},passthrough(){return this.clone(P(this._zod.def,{catchall:Pu()}))},loose(){return this.clone(P(this._zod.def,{catchall:Pu()}))},strict(){return this.clone(P(this._zod.def,{catchall:Iu()}))},strip(){return this.clone(P(this._zod.def,{catchall:void 0}))},extend(e){return Mr(this,e)},safeExtend(e){return Pr(this,e)},merge(e){return Fr(this,e)},pick(e){return kr(this,e)},omit(e){return jr(this,e)},partial(...e){return Ir(Qu,this,e[0])},exactPartial(...e){return Ir(ed,this,e[0],`exactPartial`)},required(...e){return Lr(cd,this,e[0])}});function Y(e,t){return new Ru({type:`object`,shape:e??{},...F(t)})}function zu(e,t){return new Ru({type:`object`,shape:e,catchall:Pu(),...F(t)})}var Bu=L(`ZodUnion`,(e,t)=>{Uo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.options=t.options});function Vu(e,t){return new Bu({type:`union`,options:e,...F(t)})}var Hu=L(`ZodDiscriminatedUnion`,(e,t)=>{Bu.init(e,t),Go.init(e,t)});function Uu(e,t,n){return new Hu({type:`union`,options:t,discriminator:e,...F(n)})}var Wu=L(`ZodIntersection`,(e,t)=>{Ko.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r)});function Gu(e,t){return new Wu({type:`intersection`,left:e,right:t})}var Ku=L(`ZodEnum`,(e,t)=>{Yo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ku({...t,checks:[],...F(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ku({...t,checks:[],...F(r),entries:i})}});function qu(e,t){return new Ku({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...F(t)})}var Ju=L(`ZodLiteral`,(e,t)=>{Xo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Yu(e,t){return new Ju({type:`literal`,values:Array.isArray(e)?e:[e],...F(t)})}var Xu=L(`ZodTransform`,(e,t)=>{eu(),Zo.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new fi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Jr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Jr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Zu(e){return new Xu({type:`transform`,transform:e})}var Qu=L(`ZodOptional`,(e,t)=>{$o.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new Qu({type:`optional`,innerType:e})}var ed=L(`ZodExactOptional`,(e,t)=>{es.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function td(e){return new ed({type:`optional`,innerType:e})}var nd=L(`ZodNullable`,(e,t)=>{ts.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rd(e){return new nd({type:`nullable`,innerType:e})}var id=L(`ZodDefault`,(e,t)=>{ns.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ad(e,t){return new id({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xr(t)}})}var od=L(`ZodPrefault`,(e,t)=>{is.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e,t){return new od({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xr(t)}})}var cd=L(`ZodNonOptional`,(e,t)=>{as.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ld(e,t){return new cd({type:`nonoptional`,innerType:e,...F(t)})}var ud=L(`ZodCatch`,(e,t)=>{cs.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dd(e,t){return new ud({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:oi(t)})}var fd=L(`ZodPipe`,(e,t)=>{ls.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),e.in=t.in,e.out=t.out});function pd(e,t){return new fd({type:`pipe`,in:e,out:t})}var md=L(`ZodReadonly`,(e,t)=>{ds.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hd(e){return new md({type:`readonly`,innerType:e})}var gd=L(`ZodCustom`,(e,t)=>{ps.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r)});function _d(e,t={}){return Rc(gd,e,t)}function vd(e,t){return zc(e,t)}var X={speech:4e3,line:2e3,history:1e3,listItem:500,pageText:3e5,snapshot:2e5,narration:4e3,transcriptSpeech:1e4},Z=e=>ru().max(e),yd=[`blocker`,`serious`,`moderate`,`minor`],bd=[`task`,`axe`,`focus`,`screen-reader`],xd=qu([`browse`,`focus`]),Sd=Y({provider:Z(40).optional(),repo:Z(200).optional(),branch:Z(200).min(1),defaultBranch:Z(200).optional(),sha:Z(64).optional(),pr:q().int().positive().optional(),jobUrl:fu().max(500).optional()});Y({testId:ru().min(1).max(64),baseUrl:fu().max(500).optional(),ci:Sd.optional()});var Cd=Y({step:q().int().min(0).max(1e3),keys:Z(200),mode:xd,speech:Z(X.speech),notes:J(Z(500)).max(10).optional()});Y({context:Y({pageTitle:Z(500),mode:xd,heard:J(Cd).max(120),position:Z(X.line),focus:Z(X.line),focusIsEditable:Mu(),openList:J(Z(X.listItem)).max(500).optional(),history:J(Z(X.history)).max(300),pageText:Z(X.pageText)}),evidence:Z(2e3).min(1)});var wd=zu({keys:Z(200),mode:xd,speech:Z(X.transcriptSpeech)}),Td=zu({index:q(),role:Z(200),name:Z(2e3),tag:Z(50)}),Ed=Y({narration:Z(X.narration).optional(),screenshotKey:Z(300).optional(),action:Z(100).optional(),targetRole:Z(200).optional(),targetName:Z(2e3).optional(),typedValue:Z(2e3).optional(),heard:J(wd).max(100).optional(),keystrokes:q().int().min(0).optional(),decision:zu({engine:Z(200),confidence:q(),reason:Z(4e3).optional(),evidence:Z(2e3).optional()}).optional()}),Dd=Y({fingerprint:Z(200),severity:qu(yd),source:qu(bd),title:Z(500),detail:Z(1e4),wcag:Z(100).optional(),stepN:q().int().min(0).max(1e3),pageUrl:Z(2e3),selector:Z(2e3).optional()});Y({events:J(Uu(`type`,[Y({type:Yu(`stepStarted`),step:Y({n:q().int().min(1).max(1e3),pageUrl:Z(2e3),pageTitle:Z(500),narration:Z(X.narration),tabStops:J(Td).max(1e3),screenshotKey:Z(300).optional()})}),Y({type:Yu(`stepUpdated`),n:q().int().min(1).max(1e3),patch:Ed}),Y({type:Yu(`findings`),findings:J(Dd).max(500)}),Y({type:Yu(`activity`),text:Z(200)})])).max(200)});var Od=zu({score:q()});Y({outcome:qu([`completed`,`blocked`,`inconclusive`,`error`,`cancelled`]),summary:Z(4e3).optional(),error:Z(4e3).optional(),steps:q().int().min(0).max(1e3),scores:zu({overall:q(),context:Od,design:Od}),pageSnapshots:J(Y({page:Z(2e3),url:Z(2e3),title:Z(500),snapshot:Z(X.snapshot)})).max(50),transcript:J(wd).max(5e3)});function kd(){try{return JSON.parse(f(process.env.GITHUB_EVENT_PATH??``,`utf8`)).repository?.default_branch}catch{return}}function Ad(e=process.env){if(e.GITHUB_ACTIONS===`true`){let t=/^refs\/pull\/(\d+)\//.exec(e.GITHUB_REF??``)?.[1],n=e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME;return n?{provider:`github`,repo:e.GITHUB_REPOSITORY,branch:n,defaultBranch:kd(),sha:e.GITHUB_SHA,pr:t?Number(t):void 0,jobUrl:e.GITHUB_RUN_ID?`${e.GITHUB_SERVER_URL??`https://github.com`}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:void 0}:void 0}if(e.GITLAB_CI===`true`){let t=e.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME||e.CI_COMMIT_REF_NAME;return t?{provider:`gitlab`,repo:e.CI_PROJECT_PATH,branch:t,defaultBranch:e.CI_DEFAULT_BRANCH,sha:e.CI_COMMIT_SHA,pr:e.CI_MERGE_REQUEST_IID?Number(e.CI_MERGE_REQUEST_IID):void 0,jobUrl:e.CI_JOB_URL}:void 0}if(e.BUILDKITE===`true`&&e.BUILDKITE_BRANCH)return{provider:`buildkite`,repo:e.BUILDKITE_REPO,branch:e.BUILDKITE_BRANCH,defaultBranch:e.BUILDKITE_PIPELINE_DEFAULT_BRANCH,sha:e.BUILDKITE_COMMIT,pr:e.BUILDKITE_PULL_REQUEST&&e.BUILDKITE_PULL_REQUEST!==`false`?Number(e.BUILDKITE_PULL_REQUEST):void 0,jobUrl:e.BUILDKITE_BUILD_URL}}var Q=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,jd=class{api;runId;model;signal;onRejected;constructor(e,t,n,r,i=()=>{}){this.api=e,this.runId=t,this.model=n,this.signal=r,this.onRejected=i}async call(e,t){try{return await this.api.post(`/local-runs/${this.runId}/${e}`,t,this.signal)}catch(e){throw e instanceof m&&(e.status===403||e.status===409)&&this.onRejected(e.message),e}}body(e,t){return{pageTitle:Q(e.pageTitle,500),mode:e.mode,heard:e.heard.slice(-80).map(e=>({...e,keys:Q(e.keys,200),speech:Q(e.speech,X.speech),notes:e.notes?.slice(0,10).map(e=>Q(e,X.listItem))})),position:Q(e.position,X.line),focus:Q(e.focus,X.line),focusIsEditable:e.focusIsEditable,openList:e.openList?.slice(0,500).map(e=>Q(e,X.listItem)),history:e.history.slice(-300).map(e=>Q(e,X.history)),pageText:Q(t,X.pageText)}}decide(e){return this.call(`decide`,this.body(e,``))}verifyCompletion(e,t){return this.call(`verify`,{context:this.body(e,e.pageText),evidence:Q(t,2e3)})}},Md=25,Nd=1e3,Pd=e=>({...e,keys:Q(e.keys,200),speech:Q(e.speech,X.transcriptSpeech)});function Fd(e){let{decision:t}=e;return{narration:e.narration&&Q(e.narration,X.narration),screenshotKey:e.screenshotKey,action:e.action,targetRole:e.targetRole&&Q(e.targetRole,200),targetName:e.targetName&&Q(e.targetName,X.line),typedValue:e.typedValue&&Q(e.typedValue,X.line),heard:e.heard?.slice(0,100).map(Pd),keystrokes:e.keystrokes,decision:t&&{...t,engine:Q(t.engine,200),reason:t.reason&&Q(t.reason,4e3),evidence:t.evidence&&Q(t.evidence,2e3)}}}var Id=e=>({...e,title:Q(e.title,500),detail:Q(e.detail,1e4),pageUrl:Q(e.pageUrl,X.line),selector:e.selector&&Q(e.selector,X.line)}),Ld=class{api;runId;onRejected;#e=[];#t;#n=Promise.resolve();error;constructor(e,t,n){this.api=e,this.runId=t,this.onRejected=n}sink(e){let t=``;return{activity:n=>{n&&n!==t&&this.push({type:`activity`,text:Q(n,200)}),t=n,e.activity(n)},stepStarted:async t=>{this.push({type:`stepStarted`,step:{n:t.n,pageUrl:Q(t.pageUrl,X.line),pageTitle:Q(t.pageTitle,500),narration:Q(t.narration,X.narration),tabStops:t.tabStops.slice(0,1e3).map(e=>({...e,name:Q(e.name,X.line)})),screenshotKey:t.screenshotKey}}),await e.stepStarted(t)},stepUpdated:async(t,n)=>{this.push({type:`stepUpdated`,n:t,patch:Fd(n)}),await e.stepUpdated(t,n)},findings:async t=>{t.length&&this.push({type:`findings`,findings:t.slice(0,500).map(Id)}),await e.findings(t)}}}push(e){this.#e.push(e),this.#e.length>=Md?this.flush():this.#t??=setTimeout(()=>this.flush(),Nd)}flush(){return clearTimeout(this.#t),this.#t=void 0,this.#n=this.#n.then(async()=>{for(;this.#e.length&&!this.error;){let e=this.#e.splice(0,Md);try{await this.api.post(`/local-runs/${this.runId}/events`,{events:e})}catch(e){this.error=e instanceof Error?e:Error(String(e)),e instanceof m&&(e.status===403||e.status===409)&&this.onRejected(e.message)}}}),this.#n}},$=class extends Error{},Rd=3e4,zd=e=>`ARIAWALK_DATA_${e.toUpperCase().replace(/[^A-Z0-9]/g,`_`)}`;function Bd(e,t,n=process.env){let r=[],i=e.map(e=>{let i=t[e.key]??n[zd(e.key)]??e.value;return i??r.push(e.key),{key:e.key,value:i??``,isSecret:e.secret}});if(r.length)throw new $(`This test needs secret values Ariawalk never sends: ${r.join(`, `)}. Pass ${r.map(e=>`--data ${e}=…`).join(` `)} or set ${r.map(zd).join(`, `)}.`);return i}var Vd={completed:ae(`Completed`),blocked:ie(`Blocked`),inconclusive:w(`Inconclusive`),error:ie(`Error`),cancelled:w(`Stopped`)};async function Hd(e,t,n){if(!d(p.executablePath()))throw new $(`Chromium is not installed yet. Run: npx ariawalk install`);let r=[];for(let i of t){let t=await e.get(`/tests/${i}`);Bd(t.data,n.data),r.push(t)}let i=[];for(let[t,a]of r.entries()){r.length>1&&T(S(`\n── ${t+1} of ${r.length} ──`));let o=await Ud(e,a,n);if(i.push(o),o.stoppedHere)break}if(r.length>1){T(),T(C(`${i.length} of ${r.length} tests run`));for(let e of i)T(` ${Vd[e.status]??e.status} ${e.name} ${S(e.url)}`);i.length<r.length&&T(S(` Not run: ${r.slice(i.length).map(e=>e.name).join(`, `)}`))}return i.reduce((e,t)=>t.code>e?t.code:e,i.length<r.length?2:0)}async function Ud(e,t,n){let r=n.ci?Ad():void 0,i=await e.post(`/local-runs`,{testId:t.id,baseUrl:n.baseUrl,ci:r}),a=Bd(i.data,n.data),o=e.as(i.token);T(`${C(t.name)} ${S(`· ${i.environment}`)}`),T(S(`${i.startUrl}`)),T(S(`Report: ${i.url}`)),T();let s=new AbortController,c=0,l=()=>{++c>1&&process.exit(130),T(w(`
|
|
168
|
+
Stopping after the current step… (Ctrl+C again to quit now)`)),s.abort(`Stopped from the terminal.`)};process.on(`SIGINT`,l);let u,d=e=>{u||(u=e,T(w(`\n${e}`)),s.abort(e))},f=setInterval(()=>{o.post(`/local-runs/${i.runId}/heartbeat`,{}).catch(e=>{e instanceof m&&(e.status===403||e.status===409)&&d(e.message)})},Rd),p=new Ld(o,i.runId,d),h=!1,g=async(e,t)=>{try{return(await o.put(`/local-runs/${i.runId}/screenshots/${e}`,t,`image/jpeg`,s.signal)).key}catch(e){!h&&!s.signal.aborted&&T(w(`Couldn't upload a screenshot: ${e instanceof Error?e.message:String(e)}`)),h=!0;return}},_;try{_=await Un({task:i.task,startUrl:i.startUrl,maxSteps:i.maxSteps,testData:a,screenReader:`nvda`,speechLanguage:i.speechLanguage,extendedVisualChecks:i.extendedVisualChecks,isUrlAllowed:e=>E(e,i.allowedHosts),signal:s.signal},{launchBrowser:()=>Wd(n),engine:new jd(o,i.runId,`ariawalk`,s.signal,d),sink:p.sink(ce({verbose:n.verbose})),saveScreenshot:n.screenshots?g:async()=>void 0})}finally{clearInterval(f),process.off(`SIGINT`,l)}if(u)return T(`${Vd.cancelled} ${u}`),T(`Report: ${i.url}`),{name:t.name,status:`cancelled`,url:i.url,code:2,stoppedHere:c>0};await p.flush(),T(),T(S(`Writing the review…`));let v;try{v=await o.post(`/local-runs/${i.runId}/finish`,{outcome:_.outcome,summary:_.summary&&Q(_.summary,4e3),error:_.error&&Q(_.error,4e3),steps:_.steps,scores:_.scores,pageSnapshots:_.pageSnapshots.slice(0,50).map(e=>({...e,snapshot:Q(e.snapshot,X.snapshot)})),transcript:_.transcript.slice(-5e3).map(e=>({...e,speech:Q(e.speech,X.transcriptSpeech)}))})}catch(e){throw T(`${Vd[_.outcome]??_.outcome} ${_.summary??_.error??``}`),Error(`The run ended but couldn't be saved: ${e instanceof Error?e.message:String(e)}`)}T(`${Vd[v.status]??v.status} ${v.summary??_.error??``}`),T(S([v.scores?`score ${v.scores.overall}`:null,`${v.findingsCount} finding${v.findingsCount===1?``:`s`}`,v.comparison?`since the previous run: ${v.comparison}`:null].filter(Boolean).join(` · `))),p.error&&T(w(`Some steps couldn't be uploaded: ${p.error.message}`)),T(`Report: ${v.url}`);let y=v.status===`completed`?0:v.status===`blocked`||v.status===`inconclusive`?1:2;return{name:t.name,status:v.status,url:v.url,code:y,stoppedHere:c>0}}async function Wd(e){return await p.launch({headless:!e.headed,slowMo:e.slowMo})}var Gd=`ariawalk-cli`,Kd=`urn:ietf:params:oauth:grant-type:device_code`,qd=e=>new Promise(t=>setTimeout(t,e));async function Jd(e,t,n){let r=await fetch(`${e}/api/auth${t}`,{method:`POST`,headers:{"content-type":`application/json`,"user-agent":`ariawalk-cli`},body:JSON.stringify(n)}),i=await r.json().catch(()=>({}));return r.ok?{ok:!0,data:i}:{ok:!1,error:i.error??`http_${r.status}`,description:i.error_description??i.message}}function Yd(e){let[n,r]=process.platform===`darwin`?[`open`,[e]]:process.platform===`win32`?[`cmd`,[`/c`,`start`,`""`,e]]:[`xdg-open`,[e]];try{let e=t(n,r,{stdio:`ignore`,detached:!0});e.on(`error`,()=>{}),e.unref()}catch{}}async function Xd(e,t){if(t){let n=e.find(e=>e.id===t||e.name.toLowerCase()===t.toLowerCase());if(!n)throw new $(`You're not in an organization called "${t}". Yours: ${e.map(e=>e.name).join(`, `)}.`);return n}if(e.length===1)return e[0];if(!e.length)throw new $(`Your account has no organization yet. Sign in to Ariawalk once, then try again.`);if(!process.stdin.isTTY)throw new $(`Pick an organization with --org: ${e.map(e=>`"${e.name}"`).join(`, `)}.`);T(`Which organization should the CLI use?`),e.forEach((e,t)=>T(` ${t+1}. ${e.name}`));let n=u({input:process.stdin,output:process.stdout});try{for(;;){let t=Number((await n.question(`Number (1-${e.length}): `)).trim());if(Number.isInteger(t)&&t>=1&&t<=e.length)return e[t-1]}}finally{n.close()}}async function Zd(e,t){let n=await Jd(e,`/device/code`,{client_id:Gd,scope:`cli`});if(!n.ok)throw Error(`Couldn't start the login: ${n.description??n.error}`);let r=n.data;T(`Your login code: ${C(r.user_code.length===8?`${r.user_code.slice(0,4)}-${r.user_code.slice(4)}`:r.user_code)}`),T(`Confirm it in your browser: ${r.verification_uri_complete}`),T(S(`(Or open ${r.verification_uri} on any device and enter the code.)`)),t.openBrowser&&Yd(r.verification_uri_complete),T(S(`Waiting for you to allow it…`));let i=Math.max(r.interval,1)*1e3,a=Date.now()+r.expires_in*1e3,o;for(;!o;){if(Date.now()>a)throw new $(`The login code expired. Run ariawalk login again.`);await qd(i);let t=await Jd(e,`/device/token`,{grant_type:Kd,device_code:r.device_code,client_id:Gd});if(t.ok)o=t.data.access_token;else if(t.error===`authorization_pending`)continue;else if(t.error===`slow_down`)i+=5e3;else if(t.error===`access_denied`)throw new $(`The login was denied in the browser.`);else if(t.error===`expired_token`)throw new $(`The login code expired. Run ariawalk login again.`);else throw Error(`Login failed: ${t.description??t.error}`)}let s=new v(e,o);try{let{organizations:e}=await s.get(`/cli/organizations`),n=await Xd(e,t.org);return await s.post(`/cli/key`,{organizationId:n.id,clientName:l()})}catch(t){throw await fetch(`${e}/api/auth/sign-out`,{method:`POST`,headers:{authorization:`Bearer ${o}`,"content-type":`application/json`},body:`{}`}).catch(()=>{}),t}}var Qd=`---
|
|
169
|
+
name: ariawalk
|
|
170
|
+
description: Test a website's accessibility the way a blind screen reader user experiences it, with the ariawalk CLI. Use when asked to check, test or fix accessibility (a11y, WCAG, screen readers, keyboard use) of a site or a change, especially one running on localhost.
|
|
171
|
+
---
|
|
169
172
|
|
|
170
|
-
|
|
173
|
+
# Ariawalk: accessibility tests from the command line
|
|
174
|
+
|
|
175
|
+
Ariawalk runs task-based accessibility tests. An AI agent tries a task (for
|
|
176
|
+
example "subscribe to the newsletter") the way a blind user would, with the NVDA
|
|
177
|
+
screen reader (emulated), deciding every key press only from what it hears. The
|
|
178
|
+
browser runs on this machine, so it can test \`localhost\` and private hosts. The
|
|
179
|
+
report lists what blocked the task, findings with WCAG criteria, and fixes.
|
|
180
|
+
|
|
181
|
+
## Before you start
|
|
182
|
+
|
|
183
|
+
- The CLI needs Chromium once: \`npx ariawalk install\`.
|
|
184
|
+
- Check the login with \`npx ariawalk whoami\`. If it isn't logged in, ask the user to
|
|
185
|
+
run \`npx ariawalk login\` themselves (it needs their browser), or to set
|
|
186
|
+
\`ARIAWALK_API_KEY\`. Never try to log in for them.
|
|
187
|
+
- Every run counts toward the organization's monthly runs: don't run tests in a loop
|
|
188
|
+
without a change in between.
|
|
189
|
+
|
|
190
|
+
## Commands (all non-interactive when given these arguments)
|
|
191
|
+
|
|
192
|
+
\`\`\`sh
|
|
193
|
+
npx ariawalk tests --json # every test: id, name, application, start URL, last result
|
|
194
|
+
npx ariawalk run <testId> --base-url http://localhost:3000
|
|
195
|
+
npx ariawalk report <runId or report URL> # the full report as Markdown: findings, fixes, what NVDA said
|
|
196
|
+
\`\`\`
|
|
197
|
+
|
|
198
|
+
- \`--base-url\` moves the test's start URL to another origin (keep its path). Use the
|
|
199
|
+
dev server's URL. Localhost and private hosts need no domain verification.
|
|
200
|
+
- Several tests: \`npx ariawalk run <id1> <id2>\`. Never call \`ariawalk run\` without
|
|
201
|
+
ids: that opens an interactive checklist meant for people.
|
|
202
|
+
- A test with secret test data needs its value from the environment:
|
|
203
|
+
\`ARIAWALK_DATA_<KEY>\` (for example \`ARIAWALK_DATA_PASSWORD\`). If one is missing the
|
|
204
|
+
CLI says which, before using a run; ask the user for it, don't invent one.
|
|
205
|
+
- \`run\` prints \`Report: <url>\` (the run id is the last part of the URL). Exit codes:
|
|
206
|
+
\`0\` task completed, \`1\` the site blocked the task (an accessibility failure),
|
|
207
|
+
\`2\` the run itself failed (setup, quota, login, stopped).
|
|
208
|
+
|
|
209
|
+
## The loop for fixing accessibility
|
|
210
|
+
|
|
211
|
+
1. Make sure the dev server is running, and find the matching test with
|
|
212
|
+
\`npx ariawalk tests --json\`.
|
|
213
|
+
2. Run it against the dev server and read the outcome.
|
|
214
|
+
3. Read \`npx ariawalk report <runId>\`. Fix the blocker first, then serious findings.
|
|
215
|
+
The report quotes what the screen reader said; fix names, roles, labels, focus
|
|
216
|
+
order and announcements in the code, not by special-casing the test.
|
|
217
|
+
4. Run the test again and compare: the report says what changed since the previous run.
|
|
218
|
+
|
|
219
|
+
Prefer semantic HTML (real buttons, links, labels, headings) over ARIA patches. Tell the
|
|
220
|
+
user what you changed and link the last report.
|
|
221
|
+
`;async function $d(e){let t=e.dir??(e.global?n.join(c(),`.claude`,`skills`):n.join(process.cwd(),`.claude`,`skills`)),r=n.join(t,`ariawalk`,`SKILL.md`),i=await o(r,`utf8`).catch(()=>null);return i===Qd?{file:r,status:`unchanged`}:(await a(n.dirname(r),{recursive:!0}),await s(r,Qd),{file:r,status:i===null?`installed`:`updated`})}async function ef(e,t){let n=await e.get(`/applications`),r=t?n.filter(e=>e.id===t||e.name.toLowerCase()===t.toLowerCase()):n;if(t&&!r.length)throw Error(`No application called "${t}". Yours: ${n.map(e=>e.name).join(`, `)||`none yet`}.`);let i=[];for(let t of r){let n=await e.get(`/applications/${t.id}`);for(let e of n.tests)i.push({...e,applicationId:t.id,applicationName:t.name})}return i}var tf={completed:ae,blocked:ie,inconclusive:w},nf=e=>e.lastRun?(tf[e.lastRun.status]??S)(e.lastRun.status):S(`never run`);function rf(e,t){let n=``;e.forEach((e,r)=>{e.applicationName!==n&&(n=e.applicationName,T(C(n))),T(t?` ${String(r+1).padStart(2)}. [${t.has(r)?`x`:` `}] ${e.name} ${S(`(production: ${nf(e)}${S(`)`)}`)}`:` ${e.name} ${S(e.id)} ${S(`production:`)} ${nf(e)}`)})}function af(e){e.length?(rf(e),T(),T(S(`Run one with: ariawalk run <id> --base-url http://localhost:3000 (or ariawalk run to pick from a list)`))):T(`No tests yet. Create one in Ariawalk first.`)}function of(e,t,n){let r=new Set(n);for(let n of e.toLowerCase().split(/[\s,]+/).filter(Boolean)){if(n===`a`||n===`all`){let e=r.size===t;if(r.clear(),!e)for(let e=0;e<t;e++)r.add(e);continue}if(n===`n`||n===`none`){r.clear();continue}let e=/^(\d+)(?:-(\d+))?$/.exec(n);if(!e)return`"${n}" isn't a test number. Type numbers like 2 or 4-6.`;let i=Number(e[1]),a=Number(e[2]??e[1]);if(i<1||a>t||i>a)return`Pick numbers from 1 to ${t}.`;for(let e=i;e<=a;e++)r.has(e-1)?r.delete(e-1):r.add(e-1)}return r}async function sf(e){let t=new Set,n=u({input:process.stdin,output:process.stdout});try{for(T(`Which tests should run? They run one after another on this machine.`);;){T(),rf(e,t);let r=(await n.question(`${t.size} picked. Type numbers to toggle (2 4-6), a for all, Enter to run, q to quit: `)).trim();if(r.toLowerCase()===`q`)return[];if(!r){if(t.size)return e.filter((e,n)=>t.has(n));T(w(`Pick at least one test, or q to quit.`));continue}let i=of(r,e.length,t);typeof i==`string`?T(w(i)):t=i}}finally{n.close()}}var cf=`0.2.0`,lf=`${C(`ariawalk`)} – run Ariawalk accessibility tests with the browser on your machine
|
|
222
|
+
|
|
223
|
+
${C(`Usage`)}
|
|
171
224
|
ariawalk install Download the Chromium the CLI uses (once per machine)
|
|
172
225
|
ariawalk login Log in with your browser (confirm a code at ariawalk.com/device)
|
|
173
226
|
--org <name|id> Organization to use, when you're in more than one
|
|
@@ -175,10 +228,15 @@ ${w(`Usage`)}
|
|
|
175
228
|
--key aw_… Use an existing API key instead (CI: set ARIAWALK_API_KEY)
|
|
176
229
|
ariawalk whoami Who you're logged in as, and in which organization
|
|
177
230
|
ariawalk logout Revoke this computer's key and forget it
|
|
178
|
-
ariawalk
|
|
179
|
-
|
|
231
|
+
ariawalk tests [--app <name|id>] [--json] List your tests with their ids (also: ariawalk run list)
|
|
232
|
+
ariawalk run [<testId>…] [options] Run tests; the browser runs here, the agent's decisions
|
|
233
|
+
and the report stay in Ariawalk. Without an id: pick
|
|
234
|
+
tests from a checklist
|
|
235
|
+
ariawalk report <runId|url> A run's full report as Markdown
|
|
236
|
+
ariawalk skills install [--global] Teach coding agents (Claude Code…) to use this CLI:
|
|
237
|
+
writes .claude/skills/ariawalk/SKILL.md (--global: in ~)
|
|
180
238
|
|
|
181
|
-
${
|
|
239
|
+
${C(`Run options`)}
|
|
182
240
|
--base-url <url> Test this origin instead of the test's own, e.g. http://localhost:3000
|
|
183
241
|
(localhost and private hosts need no domain verification)
|
|
184
242
|
--data <key=value> A test data value, e.g. a secret Ariawalk never sends (repeatable).
|
|
@@ -190,10 +248,10 @@ ${w(`Run options`)}
|
|
|
190
248
|
are still uploaded for the report)
|
|
191
249
|
--verbose Every key press, finding and reason
|
|
192
250
|
|
|
193
|
-
${
|
|
251
|
+
${C(`Global options`)}
|
|
194
252
|
--api-url <url> Ariawalk instance (default https://ariawalk.com, or ARIAWALK_API_URL)
|
|
195
253
|
--version, --help
|
|
196
254
|
|
|
197
|
-
${
|
|
255
|
+
${C(`Exit codes`)}
|
|
198
256
|
0 the task was completed · 1 the site blocked the task · 2 the run failed (setup, quota, key…)
|
|
199
|
-
`;function
|
|
257
|
+
`;function uf(e=[]){let t={};for(let n of e){let e=n.indexOf(`=`);if(e<1)throw new $(`--data takes key=value, got "${n}".`);t[n.slice(0,e)]=n.slice(e+1)}return t}async function df(e,t){let n=t.key;if(n){if(!/^aw_/.test(n))throw new $(`That doesn't look like an Ariawalk API key (they start with "aw_").`)}else n=(await Zd(e,{org:t.org,openBrowser:t.openBrowser})).key;let r=await new v(e,n).get(`/me`),i=await b({apiKey:n,apiUrl:e});T(`${ae(`Logged in`)} as ${r.user.email} in ${C(r.organization.name)}.`),T(S(`Key "${r.key.name}" saved in ${i}. Revoke it with ariawalk logout, or under API and MCP.`))}async function ff(e){let t=await e.get(`/me`);T(`${t.user.name} <${t.user.email}> in ${C(t.organization.name)}`),T(S(`Key "${t.key.name}" (${t.key.scope===`run`?`read and run`:`read only`}) · ${e.baseUrl}`))}async function pf(e){if(e)try{await e.post(`/cli/logout`,{})}catch(e){if(!(e instanceof m&&e.status===401))throw e}await ne(),T(e?`Logged out: the key is revoked and forgotten.`:`Not logged in.`)}function mf(){let e=console.log;console.log=(...t)=>{typeof t[0]==`string`&&/^\[[a-z-]+\] /.test(t[0])||e(...t)}}function hf(){let r=n.join(n.dirname(e(import.meta.url).resolve(`playwright/package.json`)),`cli.js`);return new Promise(e=>{let n=t(process.execPath,[`-`,`install`,`chromium`],{stdio:[`pipe`,`inherit`,`inherit`]});n.stdin.end(`require(${JSON.stringify(r)})`),n.on(`exit`,t=>e(t===0?0:2))})}async function gf(e){let{values:t,positionals:n}=r({args:e,allowPositionals:!0,options:{"api-url":{type:`string`},key:{type:`string`},org:{type:`string`},"no-browser":{type:`boolean`,default:!1},"base-url":{type:`string`},data:{type:`string`,multiple:!0},headed:{type:`boolean`,default:!1},"slow-mo":{type:`string`},"no-ci":{type:`boolean`,default:!1},"no-screenshots":{type:`boolean`,default:!1},verbose:{type:`boolean`,default:!1},app:{type:`string`},json:{type:`boolean`,default:!1},global:{type:`boolean`,default:!1},dir:{type:`string`},help:{type:`boolean`,short:`h`,default:!1},version:{type:`boolean`,short:`v`,default:!1}}}),[i,...a]=n;if(t.version)return T(cf),0;if(t.help||!i)return T(lf),i||t.help?0:2;if(i===`install`)return hf();if(i===`skills`){if(a[0]!==`install`)throw new $(`Did you mean: ariawalk skills install [--global]?`);let{file:e,status:n}=await $d({global:t.global,dir:t.dir});return T(n===`unchanged`?`The skill is up to date: ${e}`:`${ae(n===`installed`?`Installed`:`Updated`)} the ariawalk skill: ${e}`),T(S(`Coding agents like Claude Code now know how to run Ariawalk tests with this CLI.`)),0}let o=await te({apiUrl:t[`api-url`]});if(i===`login`)return await df(o.apiUrl,{key:t.key,org:t.org,openBrowser:!t[`no-browser`]}),0;if(i===`logout`){if(process.env.ARIAWALK_API_KEY)throw new $(`ARIAWALK_API_KEY is set: unset it, or revoke that key under API and MCP.`);return await pf(o.apiKey?new v(o.apiUrl,o.apiKey):void 0),0}if(i===`whoami`){if(!o.apiKey)throw new $(`Not logged in. Run ariawalk login.`);return await ff(new v(o.apiUrl,o.apiKey)),0}if(![`tests`,`run`,`report`].includes(i))throw new $(`Unknown command "${i}". See ariawalk --help.`);if(!o.apiKey)throw new $(`Log in first: ariawalk login (or set ARIAWALK_API_KEY).`);let s=new v(o.apiUrl,o.apiKey);if(i===`tests`||i===`run`&&a[0]===`list`){let e=await ef(s,t.app);return t.json?T(JSON.stringify(e,null,2)):af(e),0}if(i===`report`){let e=/([0-9a-f-]{36})\/?(?:compare)?\/?$/.exec(a[0]??``)?.[1];if(!e)throw new $(`Which run? ariawalk report <runId> or the report URL a run printed.`);return process.stdout.write(await s.getText(`/runs/${e}/report?format=markdown`)),0}let c=a;if(!c.length){if(!process.stdin.isTTY)throw new $(`Which tests? ariawalk run <testId>… (list them with ariawalk tests).`);let e=await ef(s,t.app);if(!e.length)throw new $(`No tests yet. Create one in Ariawalk first.`);if(c=(await sf(e)).map(e=>e.id),!c.length)return 0}let l=t[`slow-mo`]?Number(t[`slow-mo`]):void 0;if(l!==void 0&&!(l>=0))throw new $(`--slow-mo takes milliseconds, e.g. --slow-mo 250.`);return t.verbose||mf(),Hd(s,c,{baseUrl:t[`base-url`],data:uf(t.data),ci:!t[`no-ci`],screenshots:!t[`no-screenshots`],headed:t.headed,slowMo:l,verbose:t.verbose})}gf(process.argv.slice(2)).then(e=>process.exit(e),e=>{e instanceof $||e instanceof m?oe(e.message):oe(e instanceof Error?e.stack??e.message:String(e)),process.exit(2)});export{};
|