{"version":3,"sources":["../../src/index.ts","../../src/getIdRefsByAttribute.ts","../../src/getNodeAccessibilityData/index.ts","../../src/getNodeAccessibilityData/getRole.ts","../../src/getLocalName.ts","../../src/isElement.ts","../../src/getNodeAccessibilityData/getAccessibleDescription.ts","../../src/getNodeAccessibilityData/getAccessibleName.ts","../../src/sanitizeString.ts","../../src/getNodeAccessibilityData/getAccessibleValue.ts","../../src/isDialogRole.ts","../../src/getNodeByIdRef.ts","../../src/isHiddenFromAccessibilityTree.ts","../../src/createAccessibilityTree.ts","../../src/commands/nodeMatchers.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getAttributesByRole.ts","../../src/getItemText.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/mapAttributeNameAndValueToLabel.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromAriaAttribute.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromHtmlEquivalentAttribute.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromImplicitHtmlElementValue/getLevelFromDocumentStructure.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromImplicitHtmlElementValue/getSet.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromImplicitHtmlElementValue/hasTreegridAncestor.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/getLabelFromImplicitHtmlElementValue/index.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/postProcessAriaValueNow.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/postProcessLabels.ts","../../src/getNodeAccessibilityData/getAccessibleAttributeLabels/index.ts","../../src/flattenTree.ts","../../src/commands/getIndexByRoleAndAttributes.ts","../../src/commands/getNextIndexByRoleAndAttributes.ts","../../src/commands/getPreviousIndexByRoleAndAttributes.ts","../../src/getElementFromNode.ts","../../src/commands/getElementNode.ts","../../src/commands/getNextIndexByIdRefsAttribute.ts","../../src/commands/jumpToControlledElement.ts","../../src/commands/jumpToDetailsElement.ts","../../src/commands/jumpToErrorMessageElement.ts","../../src/commands/moveToNextAlternateReadingOrderElement.ts","../../src/commands/moveToPreviousAlternateReadingOrderElement.ts","../../src/commands/index.ts","../../src/errors.ts","../../src/getLiveSpokenPhrase.ts","../../src/getSpokenPhrase.ts","../../src/observeDOM.ts","../../src/tick.ts","../../src/Virtual.ts"],"sourcesContent":["import { type StartOptions, Virtual } from \"./Virtual\";\n\n/**\n * [API Reference](https://www.guidepup.dev/docs/api/class-virtual)\n *\n * A Virtual Screen Reader instance that can be used to launch and control a\n * headless JavaScript screen reader which is compatible with any specification\n * compliant DOM implementation, e.g. jsdom, Jest, or any modern browser.\n *\n * Here's a typical example:\n *\n * ```ts\n * import { virtual } from \"@guidepup/virtual-screen-reader\";\n *\n * function setupBasicPage() {\n *   document.body.innerHTML = `\n *   <nav>Nav Text</nav>\n *   <section>\n *     <h1>Section Heading</h1>\n *     <p>Section Text</p>\n *     <article>\n *       <header>\n *         <h1>Article Header Heading</h1>\n *         <p>Article Header Text</p>\n *       </header>\n *       <p>Article Text</p>\n *     </article>\n *   </section>\n *   <footer>Footer</footer>\n *   `;\n * }\n *\n * describe(\"Screen Reader Tests\", () => {\n *   test(\"should traverse the page announcing the expected roles and content\", async () => {\n *     // Setup a page using a framework and testing library of your choice\n *     setupBasicPage();\n *\n *     // Start your Virtual Screen Reader instance\n *     await virtual.start({ container: document.body });\n *\n *     // Navigate your environment with the Virtual Screen Reader just as your users would\n *     while ((await virtual.lastSpokenPhrase()) !== \"end of document\") {\n *       await virtual.next();\n *     }\n *\n *     // Assert on what your users would really see and hear when using screen readers\n *     expect(await virtual.spokenPhraseLog()).toEqual([\n *       \"document\",\n *       \"navigation\",\n *       \"Nav Text\",\n *       \"end of navigation\",\n *       \"region\",\n *       \"heading, Section Heading, level 1\",\n *       \"Section Text\",\n *       \"article\",\n *       \"heading, Article Header Heading, level 1\",\n *       \"Article Header Text\",\n *       \"Article Text\",\n *       \"end of article\",\n *       \"end of region\",\n *       \"contentinfo\",\n *       \"Footer\",\n *       \"end of contentinfo\",\n *       \"end of document\",\n *     ]);\n *\n *     // Stop your Virtual Screen Reader instance\n *     await virtual.stop();\n *   });\n * });\n * ```\n */\nexport const virtual = new Virtual();\n\nexport { type StartOptions, Virtual };\n","export function getIdRefsByAttribute({\n  attributeName,\n  node,\n}: {\n  attributeName: string;\n  node: Element;\n}) {\n  return (node.getAttribute(attributeName) ?? \"\")\n    .trim()\n    .split(\" \")\n    .filter(Boolean);\n}\n","import { ARIARole, roles } from \"html-aria\";\nimport { getRole, presentationRoles } from \"./getRole\";\nimport { getAccessibleDescription } from \"./getAccessibleDescription\";\nimport { getAccessibleName } from \"./getAccessibleName\";\nimport { getAccessibleValue } from \"./getAccessibleValue\";\nimport { getLocalName } from \"../getLocalName\";\nimport { isDialogRole } from \"../isDialogRole\";\nimport { isElement } from \"../isElement\";\n\nconst childrenPresentationalRoles = new Set(\n  Object.entries(roles)\n    .filter(([, { childrenPresentational }]) => childrenPresentational)\n    .map(([key]) => key) as string[]\n);\n\nconst getSpokenRole = ({\n  isGeneric,\n  isPresentational,\n  node,\n  role,\n}: {\n  isGeneric: boolean;\n  isPresentational: boolean;\n  node: Node;\n  role: string;\n}) => {\n  if (isPresentational || isGeneric) {\n    return \"\";\n  }\n\n  if (isElement(node)) {\n    /**\n     * Assistive technologies SHOULD use the value of aria-roledescription when\n     * presenting the role of an element, but SHOULD NOT change other\n     * functionality based on the role of an element that has a value for\n     * aria-roledescription. For example, an assistive technology that provides\n     * functions for navigating to the next region or button SHOULD allow those\n     * functions to navigate to regions and buttons that have an\n     * aria-roledescription.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-roledescription\n     */\n    const roledescription = node.getAttribute(\"aria-roledescription\");\n\n    if (roledescription) {\n      return roledescription;\n    }\n  }\n\n  return role;\n};\n\n/**\n * Nodes that are [inert](https://html.spec.whatwg.org/multipage/interaction.html#inert)\n * are not exposed to an accessibility API.\n *\n * Note: an inert node can have descendants that are not inert. For example,\n * a [modal dialog](https://html.spec.whatwg.org/multipage/interaction.html#modal-dialogs-and-inert-subtrees)\n * can escape an inert subtree.\n *\n * REF: https://www.w3.org/TR/html-aam-1.0/#att-inert\n */\nconst getIsInert = ({\n  inheritedImplicitInert,\n  node,\n  role,\n}: {\n  inheritedImplicitInert: boolean;\n  node: Node;\n  role: string;\n}) => {\n  if (!isElement(node)) {\n    return inheritedImplicitInert;\n  }\n\n  // TODO: this doesn't cater to `<dialog>` elements which are model if opened\n  // by `show()` vs `showModal()`.\n  // REF: https://html.spec.whatwg.org/multipage/interaction.html#modal-dialogs-and-inert-subtrees\n  const isNativeModalDialog =\n    getLocalName(node) === \"dialog\" && node.hasAttribute(\"open\");\n\n  const isNonNativeModalDialog =\n    isDialogRole(role) && node.hasAttribute(\"aria-modal\");\n\n  const isModalDialog = isNonNativeModalDialog || isNativeModalDialog;\n  const isExplicitInert = node.hasAttribute(\"inert\");\n\n  return isExplicitInert || (inheritedImplicitInert && !isModalDialog);\n};\n\nexport function getNodeAccessibilityData({\n  allowedAccessibilityRoles,\n  inheritedImplicitInert,\n  inheritedImplicitPresentational,\n  node,\n}: {\n  allowedAccessibilityRoles: string[];\n  inheritedImplicitInert: boolean;\n  inheritedImplicitPresentational: boolean;\n  node: Node;\n}) {\n  const accessibleDescription = getAccessibleDescription(node);\n  const accessibleName = getAccessibleName(node);\n  const accessibleValue = getAccessibleValue(node);\n\n  const { explicitRole, implicitRole, role } = getRole({\n    accessibleName,\n    allowedAccessibilityRoles,\n    inheritedImplicitPresentational,\n    node,\n  });\n\n  const amendedAccessibleDescription =\n    accessibleDescription === accessibleName ? \"\" : accessibleDescription;\n\n  const isExplicitPresentational = presentationRoles.has(explicitRole);\n  const isPresentational = presentationRoles.has(role);\n  const isGeneric = role === \"generic\";\n\n  const spokenRole = getSpokenRole({\n    isGeneric,\n    isPresentational,\n    node,\n    role,\n  });\n\n  const { allowedChildRoles: allowedAccessibilityChildRoles } = roles[\n    role as ARIARole\n  ] ?? {\n    allowedChildRoles: [],\n  };\n\n  const { allowedChildRoles: implicitAllowedAccessibilityChildRoles } = roles[\n    implicitRole as ARIARole\n  ] ?? {\n    allowedChildRoles: [],\n  };\n\n  /**\n   * Any descendants of elements that have the characteristic \"Children\n   * Presentational: True\" unless the descendant is not allowed to be\n   * presentational because it meets one of the conditions for exception\n   * described in Presentational Roles Conflict Resolution. However, the text\n   * content of any excluded descendants is included.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion\n   */\n  const isChildrenPresentationalRole = childrenPresentationalRoles.has(role);\n\n  /**\n   * When an explicit or inherited role of presentation is applied to an\n   * element with the implicit semantic of a WAI-ARIA role that has Allowed\n   * Accessibility Child Roles, in addition to the element with the explicit\n   * role of presentation, the user agent MUST apply an inherited role of\n   * presentation to any owned elements that do not have an explicit role\n   * defined. Also, when an explicit or inherited role of presentation is\n   * applied to a host language element which has specifically allowed children\n   * as defined by the host language specification, in addition to the element\n   * with the explicit role of presentation, the user agent MUST apply an\n   * inherited role of presentation to any specifically allowed children that\n   * do not have an explicit role defined.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#presentational-role-inheritance\n   */\n  const isExplicitOrInheritedPresentation =\n    isExplicitPresentational || inheritedImplicitPresentational;\n  const isElementWithImplicitAllowedAccessibilityChildRoles =\n    !!implicitAllowedAccessibilityChildRoles.length;\n  const childrenInheritPresentationExceptAllowedRoles =\n    isExplicitOrInheritedPresentation &&\n    isElementWithImplicitAllowedAccessibilityChildRoles;\n\n  const childrenPresentational =\n    isChildrenPresentationalRole ||\n    childrenInheritPresentationExceptAllowedRoles;\n\n  const isInert = getIsInert({\n    inheritedImplicitInert,\n    node,\n    role,\n  });\n\n  return {\n    accessibleDescription: amendedAccessibleDescription,\n    accessibleName,\n    accessibleValue,\n    allowedAccessibilityChildRoles,\n    childrenPresentational,\n    isExplicitPresentational,\n    isInert,\n    role,\n    spokenRole,\n  };\n}\n","import { ALL_ROLES, ARIARole, getRole as getHtmlAriaRole } from \"html-aria\";\nimport { getLocalName } from \"../getLocalName\";\nimport { isElement } from \"../isElement\";\n\nexport const presentationRoles = new Set([\"presentation\", \"none\"]);\n\nexport const synonymRolesMap: Record<string, string> = {\n  img: \"image\",\n  presentation: \"none\",\n  directory: \"list\",\n};\n\nconst allowedNonAbstractRoles = new Set(ALL_ROLES);\n\nconst rolesRequiringName = new Set([\"form\", \"region\"]);\n\nexport const globalStatesAndProperties = [\n  \"aria-atomic\",\n  \"aria-braillelabel\",\n  \"aria-brailleroledescription\",\n  \"aria-busy\",\n  \"aria-controls\",\n  \"aria-describedby\",\n  \"aria-description\",\n  \"aria-details\",\n  \"aria-dropeffect\",\n  \"aria-flowto\",\n  \"aria-grabbed\",\n  \"aria-hidden\",\n  \"aria-keyshortcuts\",\n  \"aria-label\",\n  \"aria-labelledby\",\n  \"aria-live\",\n  \"aria-owns\",\n  \"aria-relevant\",\n  \"aria-roledescription\",\n];\n\nconst FOCUSABLE_SELECTOR = [\n  \"input:not([type=hidden]):not([disabled])\",\n  \"button:not([disabled])\",\n  \"select:not([disabled])\",\n  \"textarea:not([disabled])\",\n  '[contenteditable=\"\"]',\n  '[contenteditable=\"true\"]',\n  \"a[href]\",\n  \"[tabindex]:not([disabled])\",\n].join(\", \");\n\nfunction isFocusable(node: HTMLElement) {\n  return node.matches(FOCUSABLE_SELECTOR);\n}\n\nfunction hasGlobalStateOrProperty(node: HTMLElement) {\n  return globalStatesAndProperties.some((global) => node.hasAttribute(global));\n}\n\nfunction mapAliasedRoles(role: string) {\n  const canonical = synonymRolesMap[role];\n\n  return canonical ?? role;\n}\n\nfunction getExplicitRole({\n  accessibleName,\n  allowedAccessibilityRoles,\n  inheritedImplicitPresentational,\n  node,\n}: {\n  accessibleName: string;\n  allowedAccessibilityRoles: string[];\n  inheritedImplicitPresentational: boolean;\n  node: HTMLElement;\n}) {\n  const rawRoles = node.getAttribute(\"role\")?.trim().split(\" \") ?? [];\n\n  const authorErrorFilteredRoles = rawRoles\n    /**\n     * As stated in the Definition of Roles section, it is considered an\n     * authoring error to use abstract roles in content.\n     * User agents MUST NOT map abstract roles via the standard role mechanism\n     * of the accessibility API.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#document-handling_author-errors_roles\n     */\n    .filter((role) => allowedNonAbstractRoles.has(role as ARIARole))\n    /**\n     * Certain landmark roles require names from authors. In situations where\n     * an author has not specified names for these landmarks, it is\n     * considered an authoring error. The user agent MUST treat such elements\n     * as if no role had been provided. If a valid fallback role had been\n     * specified, or if the element had an implicit ARIA role, then user\n     * agents would continue to expose that role, instead. Instances of such\n     * roles are as follows:\n     *\n     * - form\n     * - region\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#document-handling_author-errors_roles\n     */\n    .filter((role) => !!accessibleName || !rolesRequiringName.has(role));\n\n  /**\n   * If an allowed child element has an explicit non-presentational role, user\n   * agents MUST ignore an inherited presentational role and expose the element\n   * with its explicit role. If the action of exposing the explicit role causes\n   * the accessibility tree to be malformed, the expected results are\n   * undefined.\n   *\n   * See also \"Children Presentational: True\".\n   *\n   * REF:\n   *\n   * - https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none\n   * - https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion\n   * - https://www.w3.org/TR/wai-aria-1.2/#mustContain\n   */\n\n  const isExplicitAllowedChildElement = allowedAccessibilityRoles.some(\n    (allowedExplicitRole) =>\n      authorErrorFilteredRoles?.[0] === allowedExplicitRole\n  );\n\n  if (inheritedImplicitPresentational && !isExplicitAllowedChildElement) {\n    authorErrorFilteredRoles.unshift(\"none\");\n  }\n\n  if (!authorErrorFilteredRoles?.length) {\n    return \"\";\n  }\n\n  const filteredRoles = authorErrorFilteredRoles\n    /**\n     * If an element is focusable, user agents MUST ignore the\n     * presentation/none role and expose the element with its implicit role, in\n     * order to ensure that the element is operable.\n     *\n     * If an element has global WAI-ARIA states or properties, user agents MUST\n     * ignore the presentation role and instead expose the element's implicit\n     * role. However, if an element has only non-global, role-specific WAI-ARIA\n     * states or properties, the element MUST NOT be exposed unless the\n     * presentational role is inherited and an explicit non-presentational role\n     * is applied.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none\n     */\n    .filter((role) => {\n      if (!presentationRoles.has(role)) {\n        return true;\n      }\n\n      if (hasGlobalStateOrProperty(node) || isFocusable(node)) {\n        return false;\n      }\n\n      return true;\n    });\n\n  return filteredRoles?.[0] ?? \"\";\n}\n\nexport function getRole({\n  accessibleName,\n  allowedAccessibilityRoles,\n  inheritedImplicitPresentational,\n  node,\n}: {\n  accessibleName: string;\n  allowedAccessibilityRoles: string[];\n  inheritedImplicitPresentational: boolean;\n  node: Node;\n}): { explicitRole: string; implicitRole: string; role: string } {\n  if (!isElement(node)) {\n    return { explicitRole: \"\", implicitRole: \"\", role: \"\" };\n  }\n\n  const baseExplicitRole = getExplicitRole({\n    accessibleName,\n    allowedAccessibilityRoles,\n    inheritedImplicitPresentational,\n    node,\n  });\n  const explicitRole = mapAliasedRoles(baseExplicitRole);\n\n  // Feature detect AOM support\n  // TODO: this isn't quite right, computed role might not be the implicit\n  // role, it might be the explicit one as `computedRole` does not\n  // distinguish between them.\n  if (\"computedRole\" in node) {\n    const role = node.computedRole as string;\n\n    return { explicitRole, implicitRole: role, role };\n  }\n\n  // Backwards compatibility\n  const isBodyElement = getLocalName(node) === \"body\";\n\n  const baseImplicitRole = isBodyElement\n    ? \"document\"\n    : getHtmlAriaRole(node, { ignoreRoleAttribute: true })?.name ?? \"\";\n\n  const implicitRole = mapAliasedRoles(baseImplicitRole);\n\n  if (explicitRole) {\n    return { explicitRole, implicitRole, role: explicitRole };\n  }\n\n  return {\n    explicitRole,\n    implicitRole,\n    role: implicitRole,\n  };\n}\n","export const getLocalName = (element: Element) =>\n  element.localName ?? element.tagName.toLowerCase();\n","const ELEMENT_NODE = 1;\n\nexport function isElement(node: Node): node is HTMLElement {\n  return node.nodeType === ELEMENT_NODE;\n}\n","import { computeAccessibleDescription } from \"dom-accessibility-api\";\nimport { isElement } from \"../isElement\";\n\nexport function getAccessibleDescription(node: Node) {\n  return isElement(node) ? computeAccessibleDescription(node).trim() : \"\";\n}\n","import { computeAccessibleName } from \"dom-accessibility-api\";\nimport { isElement } from \"../isElement\";\nimport { sanitizeString } from \"../sanitizeString\";\n\nexport function getAccessibleName(node: Node): string {\n  // Feature detect AOM support\n  if (\"computedName\" in node) {\n    return node.computedName as string;\n  }\n\n  return isElement(node)\n    ? computeAccessibleName(node).trim()\n    : // `node.textContent` is only `null` for `document` and `doctype`.\n       \n      sanitizeString(node.textContent!);\n}\n","export function sanitizeString(string: string) {\n  return string.trim().replace(/\\s+/g, \" \");\n}\n","import { getLocalName } from \"../getLocalName\";\nimport { isElement } from \"../isElement\";\n\nexport type HTMLElementWithValue =\n  | HTMLButtonElement\n  | HTMLDataElement\n  | HTMLInputElement\n  | HTMLLIElement\n  | HTMLMeterElement\n  | HTMLOptionElement\n  | HTMLProgressElement\n  | HTMLParamElement;\n\nconst ignoredInputTypes = new Set([\"checkbox\", \"radio\"]);\nconst allowedLocalNames = new Set([\n  \"button\",\n  \"data\",\n  \"input\",\n  // \"li\",\n  \"meter\",\n  \"option\",\n  \"progress\",\n  \"param\",\n]);\n\nfunction getSelectValue(node: HTMLSelectElement) {\n  const selectedOptions = [...node.options].filter(\n    (optionElement) => optionElement.selected\n  );\n\n  if (node.multiple) {\n    return [...selectedOptions]\n      .map((optionElement) => getValue(optionElement))\n      .join(\"; \");\n  }\n\n  if (selectedOptions.length === 0) {\n    return \"\";\n  }\n\n  return getValue(selectedOptions[0]);\n}\n\nfunction getInputValue(node: HTMLInputElement) {\n  if (ignoredInputTypes.has(node.type)) {\n    return \"\";\n  }\n\n  return getValue(node);\n}\n\nfunction getValue(node: HTMLElementWithValue) {\n  const localName = getLocalName(node);\n\n  // TODO: handle use of explicit roles where a value taken from content is\n  // expected, e.g. combobox.\n  // See core-aam/combobox-value-calculation-manual.html\n  if (!allowedLocalNames.has(localName)) {\n    return \"\";\n  }\n\n  if (\n    node.getAttribute(\"aria-valuetext\") ||\n    node.getAttribute(\"aria-valuenow\")\n  ) {\n    return \"\";\n  }\n\n  return typeof node.value === \"number\" ? `${node.value}` : node.value;\n}\n\nexport function getAccessibleValue(node: Node) {\n  if (!isElement(node)) {\n    return \"\";\n  }\n\n  switch (getLocalName(node)) {\n    case \"input\": {\n      return getInputValue(node as HTMLInputElement);\n    }\n    case \"select\": {\n      return getSelectValue(node as HTMLSelectElement);\n    }\n  }\n\n  return getValue(node as HTMLElementWithValue);\n}\n","const dialogRoles = new Set([\"dialog\", \"alertdialog\"]);\n\nexport const isDialogRole = (role: string) => dialogRoles.has(role);\n","import { isElement } from \"./isElement\";\n\nexport function getNodeByIdRef({\n  container,\n  idRef,\n}: {\n  container: Node;\n  idRef: string;\n}) {\n  if (!isElement(container) || !idRef) {\n    return null;\n  }\n\n  return container.querySelector(`#${CSS.escape(idRef)}`);\n}\n","import { isElement } from \"./isElement\";\n\nconst TEXT_NODE = 3;\n\nexport function isHiddenFromAccessibilityTree(node: Node | null): node is null {\n  if (!node) {\n    return true;\n  }\n\n  // `node.textContent` is only `null` for `document` and `doctype`.\n\n  if (node.nodeType === TEXT_NODE && node.textContent!.trim()) {\n    return false;\n  }\n\n  if (!isElement(node)) {\n    return true;\n  }\n\n  try {\n    if (node.hidden === true) {\n      return true;\n    }\n\n    if (node.getAttribute(\"aria-hidden\") === \"true\") {\n      return true;\n    }\n\n    const getComputedStyle = node.ownerDocument.defaultView?.getComputedStyle;\n    const computedStyle = getComputedStyle?.(node);\n\n    if (\n      computedStyle?.visibility === \"hidden\" ||\n      computedStyle?.display === \"none\"\n    ) {\n      return true;\n    }\n  } catch {\n    // Some elements aren't supported by DOM implementations such as JSDOM.\n    // E.g. `<math>`, see https://github.com/jsdom/jsdom/issues/3515\n    // We ignore these nodes at the moment as we can't support them.\n    return true;\n  }\n\n  return false;\n}\n","import { AccessibleAttributeToLabelMap } from \"./getNodeAccessibilityData/getAccessibleAttributeLabels/index\";\nimport { getIdRefsByAttribute } from \"./getIdRefsByAttribute\";\nimport { getNodeAccessibilityData } from \"./getNodeAccessibilityData/index\";\nimport { getNodeByIdRef } from \"./getNodeByIdRef\";\nimport { isDialogRole } from \"./isDialogRole\";\nimport { isElement } from \"./isElement\";\nimport { isHiddenFromAccessibilityTree } from \"./isHiddenFromAccessibilityTree\";\n\nexport interface AccessibilityNode {\n  accessibleAttributeLabels: string[];\n  accessibleAttributeToLabelMap: AccessibleAttributeToLabelMap;\n  accessibleDescription: string;\n  accessibleName: string;\n  accessibleValue: string;\n  allowedAccessibilityChildRoles: string[];\n  alternateReadingOrderParents: Node[];\n  childrenPresentational: boolean;\n  isInert: boolean;\n  node: Node;\n  parentAccessibilityNodeTree: AccessibilityNodeTree | null;\n  parent: Node | null;\n  parentDialog: HTMLElement | null;\n  role: string;\n  spokenRole: string;\n}\n\nexport interface AccessibilityNodeTree\n  extends Omit<\n    AccessibilityNode,\n    \"accessibleAttributeLabels\" | \"accessibleAttributeToLabelMap\"\n  > {\n  children: AccessibilityNodeTree[];\n}\n\ninterface AccessibilityContext {\n  alternateReadingOrderMap: Map<Node, Set<Node>>;\n  container: Node;\n  ownedNodes: Set<Node>;\n  visitedNodes: Set<Node>;\n}\n\nfunction addAlternateReadingOrderNodes(\n  node: Element,\n  alternateReadingOrderMap: Map<Node, Set<Node>>,\n  container: Element\n) {\n  const idRefs = getIdRefsByAttribute({\n    attributeName: \"aria-flowto\",\n    node,\n  });\n\n  idRefs.forEach((idRef) => {\n    const childNode = getNodeByIdRef({ container, idRef });\n\n    if (!childNode) {\n      return;\n    }\n\n    const currentParentNodes =\n      alternateReadingOrderMap.get(childNode) ?? new Set<Node>();\n\n    currentParentNodes.add(node);\n\n    alternateReadingOrderMap.set(childNode, currentParentNodes);\n  });\n}\n\nfunction mapAlternateReadingOrder(node: Node) {\n  const alternateReadingOrderMap = new Map<Node, Set<Node>>();\n\n  if (!isElement(node)) {\n    return alternateReadingOrderMap;\n  }\n\n  node\n    .querySelectorAll(\"[aria-flowto]\")\n    .forEach((parentNode) =>\n      addAlternateReadingOrderNodes(parentNode, alternateReadingOrderMap, node)\n    );\n\n  return alternateReadingOrderMap;\n}\n\nfunction addOwnedNodes(\n  node: Element,\n  ownedNodes: Set<Node>,\n  container: Element\n) {\n  const idRefs = getIdRefsByAttribute({\n    attributeName: \"aria-owns\",\n    node,\n  });\n\n  idRefs.forEach((idRef) => {\n    const ownedNode = getNodeByIdRef({ container, idRef });\n\n    if (!!ownedNode && !ownedNodes.has(ownedNode)) {\n      ownedNodes.add(ownedNode);\n    }\n  });\n}\n\nfunction getAllOwnedNodes(node: Node) {\n  const ownedNodes = new Set<Node>();\n\n  if (!isElement(node)) {\n    return ownedNodes;\n  }\n\n  node\n    .querySelectorAll(\"[aria-owns]\")\n    .forEach((owningNode) => addOwnedNodes(owningNode, ownedNodes, node));\n\n  return ownedNodes;\n}\n\nfunction getOwnedNodes(node: Node, container: Node) {\n  const ownedNodes = new Set<Node>();\n\n  if (!isElement(node) || !isElement(container)) {\n    return ownedNodes;\n  }\n\n  addOwnedNodes(node, ownedNodes, container);\n\n  return ownedNodes;\n}\n\nfunction growTree(\n  node: Node,\n  tree: Omit<\n    AccessibilityNodeTree,\n    \"accessibleAttributeLabels\" | \"accessibleAttributeToLabelMap\"\n  >,\n  {\n    alternateReadingOrderMap,\n    container,\n    ownedNodes,\n    visitedNodes,\n  }: AccessibilityContext\n): AccessibilityNodeTree {\n  /**\n   * Authors MUST NOT create circular references with aria-owns. In the case of\n   * authoring error with aria-owns, the user agent MAY ignore some aria-owns\n   * element references in order to build a consistent model of the content.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-owns\n   */\n  if (visitedNodes.has(node)) {\n    return tree;\n  }\n\n  visitedNodes.add(node);\n\n  const parentDialog = isDialogRole(tree.role)\n    ? (tree.node as HTMLElement)\n    : tree.parentDialog;\n\n  if (parentDialog) {\n    tree.parentDialog = parentDialog;\n  }\n\n  node.childNodes.forEach((childNode) => {\n    if (isHiddenFromAccessibilityTree(childNode)) {\n      return;\n    }\n\n    // REF: https://github.com/w3c/aria/issues/1817#issuecomment-1261602357\n    if (ownedNodes.has(childNode)) {\n      return;\n    }\n\n    const alternateReadingOrderParents = alternateReadingOrderMap.has(childNode)\n      ? // `alternateReadingOrderMap.has(childNode)` null guards here.\n\n        Array.from(alternateReadingOrderMap.get(childNode)!)\n      : [];\n\n    const {\n      accessibleDescription,\n      accessibleName,\n      accessibleValue,\n      allowedAccessibilityChildRoles,\n      childrenPresentational,\n      isExplicitPresentational,\n      isInert,\n      role,\n      spokenRole,\n    } = getNodeAccessibilityData({\n      allowedAccessibilityRoles: tree.allowedAccessibilityChildRoles,\n      inheritedImplicitInert: tree.isInert,\n      inheritedImplicitPresentational: tree.childrenPresentational,\n      node: childNode,\n    });\n\n    const childTree = growTree(\n      childNode,\n      {\n        accessibleDescription,\n        accessibleName,\n        accessibleValue,\n        allowedAccessibilityChildRoles,\n        alternateReadingOrderParents,\n        children: [],\n        childrenPresentational,\n        isInert,\n        node: childNode,\n        parentAccessibilityNodeTree: null, // Added during flattening\n        parent: node,\n        parentDialog,\n        role,\n        spokenRole,\n      },\n      { alternateReadingOrderMap, container, ownedNodes, visitedNodes }\n    );\n\n    if (isExplicitPresentational) {\n      tree.children.push(...childTree.children);\n    } else {\n      tree.children.push(childTree);\n    }\n  });\n\n  /**\n   * If an element has both aria-owns and DOM children then the order of the\n   * child elements with respect to the parent/child relationship is the DOM\n   * children first, then the elements referenced in aria-owns. If the author\n   * intends that the DOM children are not first, then list the DOM children in\n   * aria-owns in the desired order. Authors SHOULD NOT use aria-owns as a\n   * replacement for the DOM hierarchy. If the relationship is represented in\n   * the DOM, do not use aria-owns.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-owns\n   */\n  const ownedChildNodes = getOwnedNodes(node, container);\n\n  ownedChildNodes.forEach((childNode) => {\n    if (isHiddenFromAccessibilityTree(childNode)) {\n      return;\n    }\n\n    const alternateReadingOrderParents = alternateReadingOrderMap.has(childNode)\n      ? // `alternateReadingOrderMap.has(childNode)` null guards here.\n\n        Array.from(alternateReadingOrderMap.get(childNode)!)\n      : [];\n\n    const {\n      accessibleDescription,\n      accessibleName,\n      accessibleValue,\n      allowedAccessibilityChildRoles,\n      childrenPresentational,\n      isInert,\n      isExplicitPresentational,\n      role,\n      spokenRole,\n    } = getNodeAccessibilityData({\n      allowedAccessibilityRoles: tree.allowedAccessibilityChildRoles,\n      inheritedImplicitInert: tree.isInert,\n      inheritedImplicitPresentational: tree.childrenPresentational,\n      node: childNode,\n    });\n\n    const childTree = growTree(\n      childNode,\n      {\n        accessibleDescription,\n        accessibleName,\n        accessibleValue,\n        allowedAccessibilityChildRoles,\n        alternateReadingOrderParents,\n        children: [],\n        childrenPresentational,\n        isInert,\n        node: childNode,\n        parentAccessibilityNodeTree: null, // Added during flattening\n        parent: node,\n        parentDialog,\n        role,\n        spokenRole,\n      },\n      { alternateReadingOrderMap, container, ownedNodes, visitedNodes }\n    );\n\n    if (isExplicitPresentational) {\n      tree.children.push(...childTree.children);\n    } else {\n      tree.children.push(childTree);\n    }\n  });\n\n  return tree;\n}\n\nexport function createAccessibilityTree(\n  node: Node | null\n): AccessibilityNodeTree | null {\n  if (isHiddenFromAccessibilityTree(node)) {\n    return null;\n  }\n\n  const alternateReadingOrderMap = mapAlternateReadingOrder(node);\n  const ownedNodes = getAllOwnedNodes(node);\n  const visitedNodes = new Set<Node>();\n\n  const {\n    accessibleDescription,\n    accessibleName,\n    accessibleValue,\n    allowedAccessibilityChildRoles,\n    childrenPresentational,\n    isInert,\n    role,\n    spokenRole,\n  } = getNodeAccessibilityData({\n    allowedAccessibilityRoles: [],\n    node,\n    inheritedImplicitPresentational: false,\n    inheritedImplicitInert: false,\n  });\n\n  const tree = growTree(\n    node,\n    {\n      accessibleDescription,\n      accessibleName,\n      accessibleValue,\n      allowedAccessibilityChildRoles,\n      alternateReadingOrderParents: [],\n      children: [],\n      childrenPresentational,\n      isInert,\n      node,\n      parentAccessibilityNodeTree: null,\n      parent: null,\n      parentDialog: null,\n      role,\n      spokenRole,\n    },\n    {\n      alternateReadingOrderMap,\n      container: node,\n      ownedNodes,\n      visitedNodes,\n    }\n  );\n\n  return tree;\n}\n","import { AccessibilityNode } from \"../createAccessibilityTree\";\nimport { AriaAttributes } from \"./types\";\n\nexport function matchesRoles(\n  node: AccessibilityNode,\n  roles?: Readonly<string[]>\n) {\n  if (!roles?.length) {\n    return true;\n  }\n\n  return roles.includes(node.role);\n}\n\nexport function matchesAccessibleAttributes(\n  node: AccessibilityNode,\n  ariaAttributes?: Readonly<AriaAttributes>\n) {\n  if (!ariaAttributes) {\n    return true;\n  }\n\n  for (const [name, value] of Object.entries(ariaAttributes)) {\n    if (node.accessibleAttributeToLabelMap[name]?.value !== value) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","import { ARIAAttribute, ARIARole, roles } from \"html-aria\";\nimport { globalStatesAndProperties } from \"../getRole\";\n\nconst ignoreAttributesWithAccessibleValue = new Set([\"aria-placeholder\"]);\n\nconst nonSpecCompliantAttributeMap: Record<\n  string,\n  Record<string, boolean | number | string | null>\n> = {\n  listitem: { \"aria-level\": null },\n  option: { \"aria-selected\": false },\n};\n\nexport const getAttributesByRole = ({\n  accessibleValue,\n  role,\n}: {\n  accessibleValue: string;\n  role: string;\n}): [string, string | null][] => {\n  const {\n    supported: supportedAttributes = [],\n    defaultAttributeValues = {},\n    prohibited: prohibitedAttributes = [],\n  } = roles[role as ARIARole] ?? {};\n\n  const implicitRoleAttributes = {\n    ...defaultAttributeValues,\n    ...nonSpecCompliantAttributeMap[role],\n  };\n\n  const uniqueAttributes = Array.from(\n    new Set([\n      ...Object.keys(implicitRoleAttributes),\n      ...supportedAttributes,\n      ...globalStatesAndProperties,\n    ])\n  )\n    .filter(\n      (attribute) => !prohibitedAttributes.includes(attribute as ARIAAttribute)\n    )\n    .filter(\n      (attribute) =>\n        !accessibleValue || !ignoreAttributesWithAccessibleValue.has(attribute)\n    );\n\n  return uniqueAttributes.map((attribute) => [\n    attribute,\n    attribute in implicitRoleAttributes &&\n    implicitRoleAttributes[attribute] !== null\n      ? implicitRoleAttributes[attribute].toString()\n      : null,\n  ]);\n};\n","import { AccessibilityNode } from \"./createAccessibilityTree\";\n\nexport const getItemText = (\n  accessibilityNode: Pick<\n    AccessibilityNode,\n    \"accessibleName\" | \"accessibleValue\"\n  >\n) => {\n  const { accessibleName, accessibleValue } = accessibilityNode;\n  const announcedValue =\n    accessibleName === accessibleValue ? \"\" : accessibleValue;\n\n  return [accessibleName, announcedValue].filter(Boolean).join(\", \");\n};\n","import { getAccessibleName } from \"../getAccessibleName\";\nimport { getAccessibleValue } from \"../getAccessibleValue\";\nimport { getItemText } from \"../../getItemText\";\nimport { getNodeByIdRef } from \"../../getNodeByIdRef\";\n\ntype ValueOf<T> = T[keyof T];\n\nconst STATE = {\n  BUSY: \"busy\",\n  CHECKED: \"checked\",\n  CURRENT: \"current item\",\n  DISABLED: \"disabled\",\n  EXPANDED: \"expanded\",\n  INVALID: \"invalid\",\n  MODAL: \"modal\",\n  MULTI_SELECTABLE: \"multi-selectable\",\n  PARTIALLY_CHECKED: \"partially checked\",\n  PARTIALLY_PRESSED: \"partially pressed\",\n  PRESSED: \"pressed\",\n  READ_ONLY: \"read only\",\n  REQUIRED: \"required\",\n  SELECTED: \"selected\",\n};\n\n// https://www.w3.org/TR/wai-aria-1.2/#state_prop_def\nconst ariaPropertyToVirtualLabelMap: Record<\n  string,\n  ((mapperArgs: MapperArgs) => string | null) | null\n> = {\n  \"aria-activedescendant\": idRef(\"active descendant\"),\n  \"aria-atomic\": null, // Handled by live region logic\n  \"aria-autocomplete\": token({\n    inline: \"autocomplete inlined\",\n    list: \"autocomplete in list\",\n    both: \"autocomplete inlined and in list\",\n    none: \"no autocomplete\",\n  }),\n  \"aria-braillelabel\": null, // Currently won't do - not implementing a braille screen reader\n  \"aria-brailleroledescription\": null, // Currently won't do - not implementing a braille screen reader\n  \"aria-busy\": state(STATE.BUSY),\n  \"aria-checked\": tristate(STATE.CHECKED, STATE.PARTIALLY_CHECKED),\n  \"aria-colcount\": integer(\"column count\"),\n  \"aria-colindex\": integer(\"column index\"),\n  \"aria-colindextext\": string(\"column index\"),\n  \"aria-colspan\": integer(\"column span\"),\n  \"aria-controls\": idRefs(\"control\", \"controls\"), // Handled by virtual.perform()\n  \"aria-current\": token({\n    page: \"current page\",\n    step: \"current step\",\n    location: \"current location\",\n    date: \"current date\",\n    time: \"current time\",\n    true: STATE.CURRENT,\n    false: `not ${STATE.CURRENT}`,\n  }),\n  \"aria-describedby\": null, // Handled by accessible description\n  \"aria-description\": null, // Handled by accessible description\n  \"aria-details\": idRefs(\"linked details\", \"linked details\", false),\n  \"aria-disabled\": state(STATE.DISABLED),\n  \"aria-dropeffect\": null, // Deprecated in WAI-ARIA 1.1\n  \"aria-errormessage\": errorMessageIdRefs(\"error message\", \"error messages\"),\n  \"aria-expanded\": state(STATE.EXPANDED),\n  \"aria-flowto\": idRefs(\"alternate reading order\", \"alternate reading orders\"), // Handled by virtual.perform()\n  \"aria-grabbed\": null, // Deprecated in WAI-ARIA 1.1\n  \"aria-haspopup\": token({\n    /**\n     * Assistive technologies SHOULD NOT expose the aria-haspopup property if\n     * it has a value of false.\n     *\n     * REF: // https://www.w3.org/TR/wai-aria-1.2/#aria-haspopup\n     */\n    false: null,\n    true: \"has popup menu\",\n    menu: \"has popup menu\",\n    listbox: \"has popup listbox\",\n    tree: \"has popup tree\",\n    grid: \"has popup grid\",\n    dialog: \"has popup dialog\",\n  }),\n  \"aria-hidden\": null, // Excluded from accessibility tree\n  \"aria-invalid\": token({\n    grammar: \"grammatical error detected\",\n    false: `not ${STATE.INVALID}`,\n    spelling: \"spelling error detected\",\n    true: STATE.INVALID,\n  }),\n  \"aria-keyshortcuts\": string(\"key shortcuts\"),\n  \"aria-label\": null, // Handled by accessible name\n  \"aria-labelledby\": null, // Handled by accessible name\n  \"aria-level\": integer(\"level\"),\n  \"aria-live\": null, // Handled by live region logic\n  \"aria-modal\": state(STATE.MODAL),\n  \"aria-multiselectable\": state(STATE.MULTI_SELECTABLE),\n  \"aria-orientation\": token({\n    horizontal: \"orientated horizontally\",\n    vertical: \"orientated vertically\",\n  }),\n  \"aria-owns\": null, // Handled by accessibility tree construction\n  \"aria-placeholder\": string(\"placeholder\"),\n  \"aria-posinset\": integer(\"position\"),\n  \"aria-pressed\": tristate(STATE.PRESSED, STATE.PARTIALLY_PRESSED),\n  \"aria-readonly\": state(STATE.READ_ONLY),\n  \"aria-relevant\": null, // Handled by live region logic\n  \"aria-required\": state(STATE.REQUIRED),\n  \"aria-roledescription\": null, // Handled by accessible description\n  \"aria-rowcount\": integer(\"row count\"),\n  \"aria-rowindex\": integer(\"row index\"),\n  \"aria-rowindextext\": string(\"row index\"),\n  \"aria-rowspan\": integer(\"row span\"),\n  \"aria-selected\": state(STATE.SELECTED),\n  \"aria-setsize\": integer(\"set size\"),\n  \"aria-sort\": token({\n    ascending: \"sorted in ascending order\",\n    descending: \"sorted in descending order\",\n    none: \"no defined sort order\",\n    other: \"non ascending / descending sort order applied\",\n  }),\n  \"aria-valuemax\": number(\"max value\"),\n  \"aria-valuemin\": number(\"min value\"),\n  \"aria-valuenow\": number(\"current value\"),\n  \"aria-valuetext\": string(\"current value\"),\n};\n\ninterface MapperArgs {\n  attributeValue: string;\n  container: Node;\n  negative?: boolean;\n  node?: HTMLElement;\n}\n\nfunction state(stateValue: ValueOf<typeof STATE>) {\n  return function stateMapper({ attributeValue, negative }: MapperArgs) {\n    if (negative) {\n      return attributeValue !== \"false\" ? `not ${stateValue}` : stateValue;\n    }\n\n    return attributeValue !== \"false\" ? stateValue : `not ${stateValue}`;\n  };\n}\n\nfunction errorMessageIdRefs(\n  propertyDescriptionSuffixSingular: string,\n  propertyDescriptionSuffixPlural: string,\n  printCount = true\n) {\n  return function mapper({ attributeValue, container, node }: MapperArgs) {\n    // TODO: use implicit values for aria-invalid:\n    // - spellcheck\n    // - pattern\n    if (node?.getAttribute(\"aria-invalid\") === \"false\") {\n      return \"\";\n    }\n\n    return idRefs(\n      propertyDescriptionSuffixSingular,\n      propertyDescriptionSuffixPlural,\n      printCount\n    )({ attributeValue, container });\n  };\n}\n\nfunction idRefs(\n  propertyDescriptionSuffixSingular: string,\n  propertyDescriptionSuffixPlural: string,\n  printCount = true\n) {\n  return function mapper({ attributeValue, container }: MapperArgs) {\n    const idRefsCount = attributeValue\n      .trim()\n      .split(\" \")\n      .filter(\n        (idRef) => !!container && !!getNodeByIdRef({ container, idRef })\n      ).length;\n\n    if (idRefsCount === 0) {\n      return \"\";\n    }\n\n    return `${printCount ? `${idRefsCount} ` : \"\"}${\n      idRefsCount === 1\n        ? propertyDescriptionSuffixSingular\n        : propertyDescriptionSuffixPlural\n    }`;\n  };\n}\n\nfunction idRef(propertyName: string) {\n  return function mapper({ attributeValue: idRef, container }: MapperArgs) {\n    const node = getNodeByIdRef({ container, idRef });\n\n    if (!node) {\n      return \"\";\n    }\n\n    const accessibleName = getAccessibleName(node);\n    const accessibleValue = getAccessibleValue(node);\n    const itemText = getItemText({ accessibleName, accessibleValue });\n\n    return concat(propertyName)({ attributeValue: itemText, container });\n  };\n}\n\nfunction tristate(\n  stateValue: ValueOf<typeof STATE>,\n  mixedValue: ValueOf<typeof STATE>\n) {\n  return function stateMapper({ attributeValue }: MapperArgs) {\n    if (attributeValue === \"mixed\") {\n      return mixedValue;\n    }\n\n    return attributeValue !== \"false\" ? stateValue : `not ${stateValue}`;\n  };\n}\n\nfunction token(tokenMap: Record<string, string | null>) {\n  return function tokenMapper({ attributeValue }: MapperArgs) {\n    return tokenMap[attributeValue];\n  };\n}\n\nfunction concat(propertyName: string) {\n  return function mapper({ attributeValue }: MapperArgs) {\n    return attributeValue ? `${propertyName} ${attributeValue}` : \"\";\n  };\n}\n\nfunction integer(propertyName: string) {\n  return concat(propertyName);\n}\n\nfunction number(propertyName: string) {\n  return concat(propertyName);\n}\n\nfunction string(propertyName: string) {\n  return concat(propertyName);\n}\n\nexport const mapAttributeNameAndValueToLabel = ({\n  attributeName,\n  attributeValue,\n  container,\n  negative = false,\n  node,\n}: {\n  attributeName: string;\n  attributeValue: string | null;\n  container: Node;\n  negative?: boolean;\n  node: HTMLElement;\n}) => {\n  if (typeof attributeValue !== \"string\") {\n    return null;\n  }\n\n  const mapper = ariaPropertyToVirtualLabelMap[attributeName];\n\n  return mapper?.({ attributeValue, container, negative, node }) ?? null;\n};\n","import { mapAttributeNameAndValueToLabel } from \"./mapAttributeNameAndValueToLabel\";\n\nexport const getLabelFromAriaAttribute = ({\n  attributeName,\n  container,\n  node,\n}: {\n  attributeName: string;\n  container: Node;\n  node: HTMLElement;\n}): { label: string; value: string } => {\n  const attributeValue = node.getAttribute(attributeName);\n\n  return {\n    label:\n      mapAttributeNameAndValueToLabel({\n        attributeName,\n        attributeValue,\n        container,\n        node,\n      }) ?? \"\",\n    value: attributeValue ?? \"\",\n  };\n};\n","import { getLocalName } from \"../../getLocalName\";\nimport { mapAttributeNameAndValueToLabel } from \"./mapAttributeNameAndValueToLabel\";\n\nconst isNotMatchingElement = ({\n  elements,\n  node,\n}: {\n  elements: string[];\n  node: HTMLElement;\n}) => elements.length && !elements.includes(getLocalName(node));\n\nconst isNotMatchingProperties = ({\n  node,\n  properties,\n}: {\n  node: HTMLElement;\n  properties: { key: string; value: string }[];\n}) =>\n  properties.length &&\n  !properties.some(({ key, value }) => node.getAttribute(key) === value);\n\n// REFs:\n// - https://www.w3.org/TR/html-aria/#docconformance-attr\n// - https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings\nconst ariaToHTMLAttributeMapping: Record<\n  string,\n  Array<{\n    elements?: string[];\n    implicitMissingValue?: string;\n    name: string;\n    negative?: boolean;\n    properties?: { key: string; value: string }[];\n    value?: string;\n  }>\n> = {\n  \"aria-autocomplete\": [\n    { elements: [\"form\"], name: \"autocomplete\" },\n    { elements: [\"input\", \"select\", \"textarea\"], name: \"autocomplete\" },\n  ],\n  \"aria-checked\": [\n    {\n      elements: [\"input\"],\n      implicitMissingValue: \"false\",\n      name: \"checked\",\n      properties: [\n        { key: \"type\", value: \"checkbox\" },\n        { key: \"type\", value: \"radio\" },\n      ],\n    },\n    {\n      value: \"mixed\",\n      name: \"indeterminate\",\n    },\n  ],\n  \"aria-colspan\": [{ elements: [\"td\", \"th\"], name: \"colspan\" }],\n  \"aria-controls\": [\n    {\n      elements: [\"input\"],\n      name: \"list\",\n    },\n  ],\n  \"aria-disabled\": [\n    {\n      elements: [\"button\", \"input\", \"optgroup\", \"option\", \"select\", \"textarea\"],\n      name: \"disabled\",\n    },\n    {\n      // TODO: Form controls within a valid legend child element of a fieldset\n      // with a disabled attribute do not become disabled.\n      elements: [\"fieldset\"],\n      name: \"disabled\",\n    },\n  ],\n\n  // TODO: Set properties on the summary element.\n  // REF: https://www.w3.org/TR/html-aam-1.0/#att-open-details\n  // \"aria-expanded\": [{ elements: [\"details\"], name: \"open\" }],\n\n  // TODO: Set properties on the dialog element.\n  // REF: https://www.w3.org/TR/html-aam-1.0/#att-open-dialog\n\n  // Not announced, indeed it will be hidden from the accessibility tree.\n  // \"aria-hidden\": [{ name: \"hidden\" }],\n\n  \"aria-invalid\": [\n    // TODO: If the value doesn't match the pattern: aria-invalid=\"true\";\n    // Otherwise, aria-invalid=\"false\"\n    // REF: https://www.w3.org/TR/html-aam-1.0/#att-pattern\n    // { elements: [\"input\"], name: \"pattern\" },\n    // TODO: aria-invalid=\"spelling\" or grammar\n    // REF: https://www.w3.org/TR/html-aam-1.0/#att-spellcheck\n    // { elements: [\"input\"], name: \"spellcheck\" },\n  ],\n\n  \"aria-multiselectable\": [{ elements: [\"select\"], name: \"multiple\" }],\n  \"aria-placeholder\": [\n    { elements: [\"input\", \"textarea\"], name: \"placeholder\" },\n  ],\n  \"aria-valuemax\": [\n    { elements: [\"input\"], name: \"max\" },\n    { elements: [\"meter\", \"progress\"], name: \"max\" },\n  ],\n  \"aria-valuemin\": [\n    { elements: [\"input\"], name: \"min\" },\n    { elements: [\"meter\", \"progress\"], name: \"min\" },\n  ],\n  \"aria-valuenow\": [{ elements: [\"meter\", \"progress\"], name: \"value\" }],\n  \"aria-readonly\": [\n    { elements: [\"input\", \"textarea\"], name: \"readonly\" },\n    { name: \"contenteditable\", negative: true },\n  ],\n  \"aria-required\": [\n    { elements: [\"input\", \"select\", \"textarea\"], name: \"required\" },\n  ],\n  \"aria-rowspan\": [{ elements: [\"td\", \"th\"], name: \"rowspan\" }],\n  \"aria-selected\": [{ elements: [\"option\"], name: \"selected\" }],\n};\n\nexport const getLabelFromHtmlEquivalentAttribute = ({\n  attributeName,\n  container,\n  node,\n}: {\n  attributeName: string;\n  container: Node;\n  node: HTMLElement;\n}): { label: string; value: string } => {\n  const htmlAttribute = ariaToHTMLAttributeMapping[attributeName];\n\n  if (!htmlAttribute?.length) {\n    return { label: \"\", value: \"\" };\n  }\n\n  for (const {\n    elements = [],\n    implicitMissingValue,\n    name,\n    negative = false,\n    properties = [],\n    value,\n  } of htmlAttribute) {\n    if (isNotMatchingElement({ elements, node })) {\n      continue;\n    }\n\n    if (isNotMatchingProperties({ node, properties })) {\n      continue;\n    }\n\n    const attributeValue = node.hasAttribute(name)\n      ? value ?? node.getAttribute(name)!\n      : node.hasAttribute(attributeName)\n      ? null\n      : implicitMissingValue ?? null;\n\n    const label = mapAttributeNameAndValueToLabel({\n      attributeName,\n      attributeValue,\n      container,\n      negative,\n      node,\n    });\n\n    if (label) {\n      return { label, value: attributeValue ?? \"\" };\n    }\n  }\n\n  return { label: \"\", value: \"\" };\n};\n","import type { AccessibilityNodeTree } from \"../../../createAccessibilityTree\";\n\n/**\n * If the DOM ancestry accurately represents the level, the user agent can\n * calculate the level of an item from the document structure. This attribute\n * can be used to provide an explicit indication of the level when that is\n * not possible to calculate from the document structure or the aria-owns\n * attribute. User agent support for automatic calculation of level may vary;\n * authors SHOULD test with user agents and assistive technologies to\n * determine whether this attribute is needed. If the author intends for the\n * user agent to calculate the level, the author SHOULD omit this attribute.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-level\n */\nexport const getLevelFromDocumentStructure = ({\n  level = 1,\n  role,\n  tree,\n}: {\n  level?: number;\n  role: string;\n  tree: AccessibilityNodeTree | null;\n}): string => {\n  if (!tree) {\n    return `${level}`;\n  }\n\n  if (tree.role === role) {\n    level++;\n  }\n\n  const parentTree = tree.parentAccessibilityNodeTree;\n\n  if (!parentTree) {\n    return `${level}`;\n  }\n\n  return getLevelFromDocumentStructure({\n    role,\n    tree: parentTree,\n    level,\n  });\n};\n","import type { AccessibilityNodeTree } from \"../../../createAccessibilityTree\";\nimport { isElement } from \"../../../isElement\";\n\nconst getFirstNestedChildrenByRole = ({\n  role,\n  tree,\n}: {\n  role: string;\n  tree: AccessibilityNodeTree;\n}): AccessibilityNodeTree[] =>\n  tree.children.flatMap((child) => {\n    if (child.role === role) {\n      return child;\n    }\n\n    return getFirstNestedChildrenByRole({ role, tree: child });\n  });\n\nconst getParentByRole = ({\n  role,\n  tree,\n}: {\n  role: string;\n  tree: AccessibilityNodeTree;\n}): AccessibilityNodeTree => {\n  let parentTree = tree;\n\n  while (parentTree.role !== role && parentTree.parentAccessibilityNodeTree) {\n    parentTree = parentTree.parentAccessibilityNodeTree;\n  }\n\n  return parentTree;\n};\n\nconst getSiblingsByRoleAndLevel = ({\n  role,\n  parentRole = role,\n  tree,\n}: {\n  role: string;\n  parentRole?: string;\n  tree: AccessibilityNodeTree;\n}): AccessibilityNodeTree[] => {\n  const parentTree = getParentByRole({ role: parentRole, tree });\n\n  return getFirstNestedChildrenByRole({ role, tree: parentTree });\n};\n\nconst getFormOwnerTree = ({ tree }: { tree: AccessibilityNodeTree }) =>\n  getParentByRole({ role: \"form\", tree });\n\nconst getRadioInputsByName = ({\n  name,\n  tree,\n}: {\n  name: string;\n  tree: AccessibilityNodeTree;\n}): AccessibilityNodeTree[] =>\n  tree.children.flatMap((child) => {\n    if (isElement(child.node) && child.node.getAttribute(\"name\") === name) {\n      return child;\n    }\n\n    return getRadioInputsByName({ name, tree: child });\n  });\n\n/**\n * The radio button group that contains an input element a also contains all\n * the other input elements b that fulfill all of the following conditions:\n *\n * - The input element b's type attribute is in the Radio Button state.\n * - Either a and b have the same form owner, or they both have no form owner.\n * - Both a and b are in the same tree.\n * - They both have a name attribute, their name attributes are not empty, and\n *   the value of a's name attribute equals the value of b's name attribute.\n *\n * REF: https://html.spec.whatwg.org/multipage/input.html#radio-button-group\n */\nconst getRadioGroup = ({\n  node,\n  tree,\n}: {\n  node: HTMLElement;\n  tree: AccessibilityNodeTree;\n}) => {\n  /**\n   * Authors SHOULD ensure that elements with role radio are explicitly grouped\n   * in order to indicate which ones affect the same value. This is achieved by\n   * enclosing the radio elements in an element with role radiogroup. If it is\n   * not possible to make the radio buttons DOM children of the radiogroup,\n   * authors SHOULD use the aria-owns attribute on the radiogroup element to\n   * indicate the relationship to its children.\n   */\n  if (node.localName !== \"input\") {\n    return getSiblingsByRoleAndLevel({\n      role: \"radio\",\n      parentRole: \"radiogroup\",\n      tree,\n    });\n  }\n\n  if (!node.hasAttribute(\"name\")) {\n    return [];\n  }\n\n  const name = node.getAttribute(\"name\")!;\n\n  if (!name) {\n    return [];\n  }\n\n  const formOwnerTree = getFormOwnerTree({ tree });\n\n  return getRadioInputsByName({ name, tree: formOwnerTree });\n};\n\nconst getChildrenByRole = ({\n  role,\n  tree,\n}: {\n  role: string;\n  tree: AccessibilityNodeTree;\n}): AccessibilityNodeTree[] =>\n  tree.children.filter((child) => child.role === role);\n\n/**\n * aria-level, aria-posinset, and aria-setsize are all 1-based. When the\n * property is not present or is \"0\", it indicates the property is not\n * computed or not supported. If any of these properties are specified by the\n * author as either \"0\" or a negative number, user agents SHOULD use \"1\"\n * instead.\n *\n * If aria-level is not provided or inherited for an element of role treeitem\n * or comment, user agents implementing IAccessible2 or ATK/AT-SPI MUST\n * compute it by following the explicit or computed RELATION_NODE_CHILD_OF\n * relations.\n *\n * If aria-posinset and aria-setsize are not provided, user agents MUST\n * compute them as follows:\n *\n * - for role=\"treeitem\" and role=\"comment\", walk the tree backward and\n * forward until the explicit or computed level becomes less than the current\n * item's level. Count items only if they are at the same level as the\n * current item.\n * - Otherwise, if the role supports aria-posinset and aria-setsize, process\n * the parent (DOM parent or parent defined by aria-owns), counting items\n * that have the same role.\n * - Because these value are 1-based, include the current item in the\n * computation. For aria-posinset, include the current item and other group\n * items if they are before the current item in the DOM. For aria-setsize,\n * add to that the number of items in the same group after the current item\n * in the DOM.\n *\n * If the author provides one or more of aria-setsize and aria-posinset, it\n * is the author's responsibility to supply them for all elements in the set.\n * User agent correction of missing values in this case is not defined.\n *\n * REF: https://www.w3.org/TR/core-aam-1.2/#mapping_additional_position\n */\nexport const getSet = ({\n  node,\n  role,\n  tree,\n}: {\n  node: HTMLElement;\n  tree: AccessibilityNodeTree;\n  role: string;\n}): Pick<AccessibilityNodeTree, \"node\">[] => {\n  if (role === \"treeitem\") {\n    return getSiblingsByRoleAndLevel({ role, tree });\n  }\n\n  /**\n   * With aria-setsize value reflecting number of type=radio input elements\n   * within the radio button group and aria-posinset value reflecting the\n   * elements position within the radio button group.\n   *\n   * REF: https://www.w3.org/TR/html-aam-1.0/#el-input-radio\n   */\n  if (role === \"radio\") {\n    return getRadioGroup({ node, tree });\n  }\n\n  return getChildrenByRole({\n    role,\n    tree,\n  });\n};\n","import type { AccessibilityNodeTree } from \"../../../createAccessibilityTree\";\n\nexport const hasTreegridAncestor = (\n  tree: AccessibilityNodeTree | null\n): boolean => {\n  if (!tree) {\n    return false;\n  }\n\n  if (tree.role === \"treegrid\") {\n    return true;\n  }\n\n  if (!tree.parentAccessibilityNodeTree) {\n    return false;\n  }\n\n  return hasTreegridAncestor(tree.parentAccessibilityNodeTree);\n};\n","import type { AccessibilityNodeTree } from \"../../../createAccessibilityTree\";\nimport { getLevelFromDocumentStructure } from \"./getLevelFromDocumentStructure\";\nimport { getLocalName } from \"../../../getLocalName\";\nimport { getSet } from \"./getSet\";\nimport { hasTreegridAncestor } from \"./hasTreegridAncestor\";\nimport { mapAttributeNameAndValueToLabel } from \"../mapAttributeNameAndValueToLabel\";\n\nconst headingLocalNameToLevelMap: Record<string, string> = {\n  h1: \"1\",\n  h2: \"2\",\n  h3: \"3\",\n  h4: \"4\",\n  h5: \"5\",\n  h6: \"6\",\n};\n\nconst getNodeSet = ({\n  node,\n  role,\n  tree,\n}: {\n  node: HTMLElement;\n  tree: AccessibilityNodeTree | null;\n  role: string;\n}): Pick<AccessibilityNodeTree, \"node\">[] | null => {\n  if (!tree) {\n    return null;\n  }\n\n  /**\n   * When an article is in the context of a feed, the author MAY specify\n   * values for aria-posinset and aria-setsize.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#article\n   *\n   * This is interpreted as the author being allowed to specify a value when\n   * nested in a feed, but there are no requirements in the specifications\n   * for an article role to expose an implicit value, even within a feed.\n   */\n  if (role === \"article\") {\n    return null;\n  }\n\n  /**\n   * While the row role can be used in a table, grid, or treegrid, the semantics\n   * of aria-expanded, aria-posinset, aria-setsize, and aria-level are only\n   * applicable to the hierarchical structure of an interactive tree grid.\n   * Therefore, authors MUST NOT apply aria-expanded, aria-posinset,\n   * aria-setsize, and aria-level to a row that descends from a table or grid,\n   * and user agents SHOULD NOT expose any of these four properties to assistive\n   * technologies unless the row descends from a treegrid.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#row\n   */\n  if (role === \"row\" && !hasTreegridAncestor(tree)) {\n    return null;\n  }\n\n  return getSet({\n    node,\n    role,\n    tree,\n  });\n};\n\nconst levelItemRoles = new Set([\"listitem\", \"treeitem\"]);\n\ntype Mapper = ({\n  node,\n  tree,\n  role,\n}: {\n  node: HTMLElement;\n  tree: AccessibilityNodeTree | null;\n  role: string;\n}) => string;\n\nconst mapHtmlElementAriaToImplicitValue: Record<string, Mapper> = {\n  /**\n   * Used in Roles:\n   *\n   * - heading\n   * - listitem\n   * - row\n   *\n   * Inherits into Roles:\n   *\n   * - treeitem\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-level\n   */\n  \"aria-level\": ({ role, tree, node }) => {\n    if (role === \"heading\") {\n      const localName = getLocalName(node);\n\n      return headingLocalNameToLevelMap[localName];\n    }\n\n    /**\n     * While the row role can be used in a table, grid, or treegrid, the semantics\n     * of aria-expanded, aria-posinset, aria-setsize, and aria-level are only\n     * applicable to the hierarchical structure of an interactive tree grid.\n     * Therefore, authors MUST NOT apply aria-expanded, aria-posinset,\n     * aria-setsize, and aria-level to a row that descends from a table or grid,\n     * and user agents SHOULD NOT expose any of these four properties to assistive\n     * technologies unless the row descends from a treegrid.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#row\n     */\n    if (role === \"row\" && hasTreegridAncestor(tree)) {\n      return getLevelFromDocumentStructure({\n        role,\n        tree,\n      });\n    }\n\n    if (levelItemRoles.has(role)) {\n      return getLevelFromDocumentStructure({\n        role,\n        tree,\n      });\n    }\n\n    return \"\";\n  },\n  /**\n   * Used in Roles:\n   *\n   * - article\n   * - listitem\n   * - menuitem\n   * - option\n   * - radio\n   * - row\n   * - tab\n   *\n   * Inherits into Roles:\n   *\n   * - menuitemcheckbox\n   * - menuitemradio\n   * - treeitem\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-posinset\n   */\n  \"aria-posinset\": ({ node, tree, role }) => {\n    const nodeSet = getNodeSet({ node, role, tree });\n\n    if (!nodeSet?.length) {\n      return \"\";\n    }\n\n    const index = nodeSet.findIndex((child) => child.node === node);\n\n    return `${index + 1}`;\n  },\n  /**\n   * Used in Roles:\n   *\n   * - article\n   * - listitem\n   * - menuitem\n   * - option\n   * - radio\n   * - row\n   * - tab\n   *\n   * Inherits into Roles:\n   *\n   * - menuitemcheckbox\n   * - menuitemradio\n   * - treeitem\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-setsize\n   */\n  \"aria-setsize\": ({ node, tree, role }) => {\n    const nodeSet = getNodeSet({ node, role, tree });\n\n    if (!nodeSet?.length) {\n      return \"\";\n    }\n\n    return `${nodeSet.length}`;\n  },\n};\n\nexport const getLabelFromImplicitHtmlElementValue = ({\n  attributeName,\n  container,\n  node,\n  parentAccessibilityNodeTree,\n  role,\n}: {\n  attributeName: string;\n  container: Node;\n  node: HTMLElement;\n  parentAccessibilityNodeTree: AccessibilityNodeTree | null;\n  role: string;\n}): { label: string; value: string } => {\n  const implicitValue = mapHtmlElementAriaToImplicitValue[attributeName]?.({\n    node,\n    tree: parentAccessibilityNodeTree,\n    role,\n  });\n\n  return {\n    label:\n      mapAttributeNameAndValueToLabel({\n        attributeName,\n        attributeValue: implicitValue,\n        container,\n        node,\n      }) ?? \"\",\n    value: implicitValue ?? \"\",\n  };\n};\n","const percentageBasedValueRoles = new Set([\"progressbar\", \"scrollbar\"]);\n\nconst isNumberLike = (value: string) => {\n  return !isNaN(parseFloat(value));\n};\n\nconst toNumber = (value: string) => parseFloat(value);\nconst toPercentageLabel = (value: number | string) => `current value ${value}%`;\n\n/**\n * If aria-valuetext is specified, assistive technologies render that instead\n * of the value of aria-valuenow.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-valuenow\n */\nexport const postProcessAriaValueNow = ({\n  max,\n  min,\n  role,\n  value,\n}: {\n  max: string;\n  min: string;\n  role: string;\n  value: string;\n}) => {\n  if (!percentageBasedValueRoles.has(role)) {\n    return value;\n  }\n\n  if (!isNumberLike(value)) {\n    return value;\n  }\n\n  /**\n   * For progressbar elements and scrollbar elements, assistive technologies\n   * SHOULD render the value to users as a percent, calculated as a position\n   * on the range from aria-valuemin to aria-valuemax if both are defined,\n   * otherwise the actual value with a percent indicator. For elements with\n   * role slider and spinbutton, assistive technologies SHOULD render the\n   * actual value to users.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-valuenow\n   */\n\n  if (isNumberLike(max) && isNumberLike(min)) {\n    const percentage = +(\n      ((toNumber(value) - toNumber(min)) / (toNumber(max) - toNumber(min))) *\n      100\n    ).toFixed(2);\n\n    return toPercentageLabel(percentage);\n  }\n\n  return toPercentageLabel(value);\n};\n","import type { AccessibleAttributeToLabelMap } from \".//index\";\nimport { postProcessAriaValueNow } from \"./postProcessAriaValueNow\";\n\nconst priorityReplacementMap: [string, string][] = [\n  [\"aria-colindextext\", \"aria-colindex\"],\n  [\"aria-rowindextext\", \"aria-rowindex\"],\n  /**\n   * If aria-valuetext is specified, assistive technologies SHOULD render that\n   * value instead of the value of aria-valuenow.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-valuetext\n   */\n  [\"aria-valuetext\", \"aria-valuenow\"],\n];\n\nexport const postProcessLabels = ({\n  labels,\n  role,\n}: {\n  labels: AccessibleAttributeToLabelMap;\n  role: string;\n}) => {\n  for (const [preferred, dropped] of priorityReplacementMap) {\n    if (labels[preferred] && labels[dropped]) {\n      labels[dropped].value = \"\";\n    }\n  }\n\n  if (labels[\"aria-valuenow\"]) {\n    labels[\"aria-valuenow\"].label = postProcessAriaValueNow({\n      value: labels[\"aria-valuenow\"].value,\n      min: labels[\"aria-valuemin\"]?.value,\n      max: labels[\"aria-valuemax\"]?.value,\n      role,\n    });\n  }\n\n  if (labels[\"aria-setsize\"]?.value === \"-1\") {\n    /**\n     * If the total number of items is unknown, authors SHOULD set the value of\n     * aria-setsize to -1.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-setsize\n     */\n    labels[\"aria-setsize\"].label = \"set size unknown\";\n  }\n\n  return labels;\n};\n","import type { AccessibilityNodeTree } from \"../../createAccessibilityTree\";\nimport { getAttributesByRole } from \"./getAttributesByRole\";\nimport { getLabelFromAriaAttribute } from \"./getLabelFromAriaAttribute\";\nimport { getLabelFromHtmlEquivalentAttribute } from \"./getLabelFromHtmlEquivalentAttribute\";\nimport { getLabelFromImplicitHtmlElementValue } from \"./getLabelFromImplicitHtmlElementValue/index\";\nimport { isElement } from \"../../isElement\";\nimport { mapAttributeNameAndValueToLabel } from \"./mapAttributeNameAndValueToLabel\";\nimport { postProcessLabels } from \"./postProcessLabels\";\n\nexport type AccessibleAttributeToLabelMap = Record<\n  string,\n  { label: string; value: string }\n>;\n\nexport const getAccessibleAttributeLabels = ({\n  accessibleValue,\n  alternateReadingOrderParents,\n  container,\n  node,\n  parentAccessibilityNodeTree,\n  role,\n}: {\n  accessibleValue: string;\n  alternateReadingOrderParents: Node[];\n  container: Node;\n  node: Node;\n  parentAccessibilityNodeTree: AccessibilityNodeTree | null;\n  role: string;\n}): {\n  accessibleAttributeLabels: string[];\n  accessibleAttributeToLabelMap: AccessibleAttributeToLabelMap;\n} => {\n  if (!isElement(node)) {\n    return {\n      accessibleAttributeLabels: [],\n      accessibleAttributeToLabelMap: {},\n    };\n  }\n\n  const labels: AccessibleAttributeToLabelMap = {};\n  const attributes = getAttributesByRole({ accessibleValue, role });\n\n  attributes.forEach(([attributeName, implicitAttributeValue]) => {\n    const {\n      label: labelFromHtmlEquivalentAttribute,\n      value: valueFromHtmlEquivalentAttribute,\n    } = getLabelFromHtmlEquivalentAttribute({\n      attributeName,\n      container,\n      node,\n    });\n\n    if (labelFromHtmlEquivalentAttribute) {\n      labels[attributeName] = {\n        label: labelFromHtmlEquivalentAttribute,\n        value: valueFromHtmlEquivalentAttribute,\n      };\n\n      return;\n    }\n\n    const { label: labelFromAriaAttribute, value: valueFromAriaAttribute } =\n      getLabelFromAriaAttribute({\n        attributeName,\n        container,\n        node,\n      });\n\n    if (labelFromAriaAttribute) {\n      labels[attributeName] = {\n        label: labelFromAriaAttribute,\n        value: valueFromAriaAttribute,\n      };\n\n      return;\n    }\n\n    const {\n      label: labelFromImplicitHtmlElementValue,\n      value: valueFromImplicitHtmlElementValue,\n    } = getLabelFromImplicitHtmlElementValue({\n      attributeName,\n      container,\n      node,\n      parentAccessibilityNodeTree,\n      role,\n    });\n\n    if (labelFromImplicitHtmlElementValue) {\n      labels[attributeName] = {\n        label: labelFromImplicitHtmlElementValue,\n        value: valueFromImplicitHtmlElementValue,\n      };\n\n      return;\n    }\n\n    const labelFromImplicitAriaAttributeValue = mapAttributeNameAndValueToLabel(\n      {\n        attributeName,\n        attributeValue: implicitAttributeValue,\n        container,\n        node,\n      }\n    );\n\n    if (labelFromImplicitAriaAttributeValue) {\n      labels[attributeName] = {\n        label: labelFromImplicitAriaAttributeValue,\n        value: implicitAttributeValue ?? \"\",\n      };\n\n      return;\n    }\n  });\n\n  const accessibleAttributeToLabelMap = postProcessLabels({ labels, role });\n  const accessibleAttributeLabels = Object.values(accessibleAttributeToLabelMap)\n    .map(({ label }) => label)\n    .filter(Boolean);\n\n  /**\n   * aria-flowto MUST requirements:\n   *\n   * The reading order goes both directions, and a user needs to be aware of the\n   * alternate reading order so that they can invoke the functionality.\n   *\n   * The reading order goes both directions, and a user needs to be able to\n   * travel backwards through their chosen reading order.\n   *\n   * REF: https://a11ysupport.io/tech/aria/aria-flowto_attribute\n   */\n  if (alternateReadingOrderParents.length > 0) {\n    accessibleAttributeLabels.push(\n      `${alternateReadingOrderParents.length} previous alternate reading ${\n        alternateReadingOrderParents.length === 1 ? \"order\" : \"orders\"\n      }`\n    );\n  }\n\n  return { accessibleAttributeLabels, accessibleAttributeToLabelMap };\n};\n","import type {\n  AccessibilityNode,\n  AccessibilityNodeTree,\n} from \"./createAccessibilityTree\";\nimport { getAccessibleAttributeLabels } from \"./getNodeAccessibilityData/getAccessibleAttributeLabels\";\nimport type { HTMLElementWithValue } from \"./getNodeAccessibilityData/getAccessibleValue\";\n\nexport const END_OF_ROLE_PREFIX = \"end of\";\nexport const END_OF_NO_ROLE_PREFIX = \"end\";\n\nconst TEXT_NODE = 3;\n\nfunction shouldIgnoreChildren(tree: AccessibilityNodeTree) {\n  const { accessibleName, children, node } = tree;\n\n  if (!accessibleName) {\n    return false;\n  }\n\n  if (children.length > 1) {\n    return false;\n  }\n\n  if (children.every((child) => child.node.nodeType !== TEXT_NODE)) {\n    return false;\n  }\n\n  return (\n    accessibleName ===\n    (\n      node.textContent ||\n      `${(node as HTMLElementWithValue).value}` ||\n      \"\"\n    )?.trim()\n  );\n}\n\nexport function flattenTree(\n  container: Node,\n  tree: AccessibilityNodeTree,\n  parentAccessibilityNodeTree: AccessibilityNodeTree | null\n): AccessibilityNode[] {\n  const { children, ...treeNode } = tree;\n\n  treeNode.parentAccessibilityNodeTree = parentAccessibilityNodeTree;\n\n  const { accessibleAttributeLabels, accessibleAttributeToLabelMap } =\n    getAccessibleAttributeLabels({\n      ...treeNode,\n      container,\n    });\n\n  const treeNodeWithAttributeLabels = {\n    ...treeNode,\n    accessibleAttributeLabels,\n    accessibleAttributeToLabelMap,\n  };\n\n  const isAnnounced =\n    !treeNodeWithAttributeLabels.isInert &&\n    (!!treeNodeWithAttributeLabels.accessibleName ||\n      !!treeNodeWithAttributeLabels.accessibleDescription ||\n      treeNodeWithAttributeLabels.accessibleAttributeLabels.length > 0 ||\n      !!treeNodeWithAttributeLabels.spokenRole);\n\n  const ignoreChildren = shouldIgnoreChildren(tree);\n\n  const flattenedTree = ignoreChildren\n    ? []\n    : children.flatMap((child) =>\n        flattenTree(container, child, {\n          ...treeNodeWithAttributeLabels,\n          children,\n        })\n      );\n\n  const isRoleContainer =\n    !!flattenedTree.length && !ignoreChildren && isAnnounced;\n\n  if (isAnnounced) {\n    flattenedTree.unshift(treeNodeWithAttributeLabels);\n  }\n\n  if (isRoleContainer) {\n    flattenedTree.push({\n      ...treeNodeWithAttributeLabels,\n      spokenRole: treeNodeWithAttributeLabels.spokenRole\n        ? `${END_OF_ROLE_PREFIX} ${treeNodeWithAttributeLabels.spokenRole}`\n        : END_OF_NO_ROLE_PREFIX,\n    });\n  }\n\n  return flattenedTree;\n}\n","import { matchesAccessibleAttributes, matchesRoles } from \"./nodeMatchers\";\nimport { AccessibilityNode } from \"../createAccessibilityTree\";\nimport type { AriaAttributes } from \"./types\";\nimport { END_OF_ROLE_PREFIX } from \"../flattenTree\";\n\nexport interface GetIndexFilters {\n  /** Matches a node only if the node has any of these roles */\n  roles?: Readonly<string[]>;\n\n  /** Matches a node only if the node has **all** of these aria attributes */\n  ariaAttributes?: Readonly<AriaAttributes>;\n}\n\nexport function getIndexByRoleAndAttributes({\n  filters,\n  reorderedTree,\n  tree,\n}: {\n  filters: GetIndexFilters;\n  reorderedTree: AccessibilityNode[];\n  tree: AccessibilityNode[];\n}) {\n  const accessibilityNode = reorderedTree.find(\n    (node) =>\n      !node.spokenRole.startsWith(END_OF_ROLE_PREFIX) &&\n      matchesRoles(node, filters.roles) &&\n      matchesAccessibleAttributes(node, filters.ariaAttributes)\n  );\n\n  if (!accessibilityNode) {\n    return null;\n  }\n\n  return tree.findIndex((node) => node === accessibilityNode);\n}\n","import {\n  getIndexByRoleAndAttributes,\n  type GetIndexFilters,\n} from \"./getIndexByRoleAndAttributes\";\nimport type { VirtualCommandArgs } from \"./types\";\n\nexport type GetNextIndexArgs = Omit<VirtualCommandArgs, \"container\">;\n\nexport function getNextIndexByRoleAndAttributes(\n  filters: Readonly<GetIndexFilters>\n) {\n  return function getNextIndexByRoleAndAttributesInner({\n    currentIndex,\n    tree,\n  }: GetNextIndexArgs) {\n    const reorderedTree = tree\n      .slice(currentIndex + 1)\n      .concat(tree.slice(0, currentIndex + 1));\n\n    return getIndexByRoleAndAttributes({ filters, reorderedTree, tree });\n  };\n}\n","import {\n  getIndexByRoleAndAttributes,\n  type GetIndexFilters,\n} from \"./getIndexByRoleAndAttributes\";\nimport type { GetNextIndexArgs } from \"./getNextIndexByRoleAndAttributes\";\n\ntype GetPreviousIndexArgs = GetNextIndexArgs;\n\nexport function getPreviousIndexByRoleAndAttributes(\n  filters: Readonly<GetIndexFilters>\n) {\n  return function getPreviousIndexInner({\n    currentIndex,\n    tree,\n  }: GetPreviousIndexArgs) {\n    const reorderedTree = tree\n      .slice(0, currentIndex)\n      .reverse()\n      .concat(tree.slice(currentIndex).reverse());\n\n    return getIndexByRoleAndAttributes({ filters, reorderedTree, tree });\n  };\n}\n","import { isElement } from \"./isElement\";\n\nexport const getElementFromNode = (node: Node): HTMLElement => {\n  return isElement(node) ? node : node.parentElement!;\n};\n","import { AccessibilityNode } from \"../createAccessibilityTree\";\nimport { getElementFromNode } from \"../getElementFromNode\";\n\nexport function getElementNode(\n  accessibilityNode: AccessibilityNode\n): HTMLElement {\n  const { node } = accessibilityNode;\n\n  return getElementFromNode(node);\n}\n","import { getElementNode } from \"./getElementNode\";\nimport { getIdRefsByAttribute } from \"../getIdRefsByAttribute\";\nimport { getNodeByIdRef } from \"../getNodeByIdRef\";\nimport { isElement } from \"../isElement\";\nimport { VirtualCommandArgs } from \"./types\";\n\nexport interface GetNextIndexByIdRefsAttributeArgs extends VirtualCommandArgs {\n  attributeName: string;\n  index?: number;\n}\n\nexport function getNextIndexByIdRefsAttribute({\n  attributeName,\n  index = 0,\n  container,\n  currentIndex,\n  tree,\n}: GetNextIndexByIdRefsAttributeArgs) {\n  if (!isElement(container)) {\n    return;\n  }\n\n  // Degree of trust that this isn't called with a current index that can't\n  // actually index the tree.\n   \n  const currentAccessibilityNode = tree.at(currentIndex)!;\n  const currentNode = getElementNode(currentAccessibilityNode);\n\n  const idRefs = getIdRefsByAttribute({\n    attributeName,\n    node: currentNode,\n  });\n\n  const idRef = idRefs[index];\n  const targetNode = getNodeByIdRef({ container, idRef });\n\n  if (!targetNode) {\n    return;\n  }\n\n  const nodeIndex = tree.findIndex(({ node }) => node === targetNode);\n\n  if (nodeIndex !== -1) {\n    return nodeIndex;\n  }\n\n  const nodeIndexByParent = tree.findIndex(\n    ({ parent }) => parent === targetNode\n  );\n\n  if (nodeIndexByParent !== -1) {\n    return nodeIndexByParent;\n  }\n\n  return;\n}\n","import { getNextIndexByIdRefsAttribute } from \"./getNextIndexByIdRefsAttribute\";\nimport { VirtualCommandArgs } from \"./types\";\n\nexport interface JumpToControlledElementCommandArgs extends VirtualCommandArgs {\n  index?: number;\n}\n\n/**\n * aria-controls:\n *\n * Identifies the element (or elements) whose contents or presence\n * are controlled by the current element. See related aria-owns.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-controls\n *\n * MUST requirement:\n *\n * The controlled element might not be close to the element with\n * aria-controls and the user might find it convenient to jump directly to\n * the controlled element.\n *\n * REF: https://a11ysupport.io/tech/aria/aria-controls_attribute\n */\nexport function jumpToControlledElement({\n  index = 0,\n  container,\n  currentIndex,\n  tree,\n}: JumpToControlledElementCommandArgs) {\n  return getNextIndexByIdRefsAttribute({\n    attributeName: \"aria-controls\",\n    index,\n    container,\n    currentIndex,\n    tree,\n  });\n}\n","import { getNextIndexByIdRefsAttribute } from \"./getNextIndexByIdRefsAttribute\";\nimport { VirtualCommandArgs } from \"./types\";\n\n/**\n * aria-details:\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-details\n *\n * SHOULD requirement:\n *\n * If the details are not adjacent to the element with aria-details, it might\n * be helpful to jump directly to the reference or have it conveyed.\n *\n * REF: https://a11ysupport.io/tech/aria/aria-details_attribute\n */\nexport function jumpToDetailsElement({\n  container,\n  currentIndex,\n  tree,\n}: VirtualCommandArgs) {\n  return getNextIndexByIdRefsAttribute({\n    attributeName: \"aria-details\",\n    index: 0,\n    container,\n    currentIndex,\n    tree,\n  });\n}\n","import { getNextIndexByIdRefsAttribute } from \"./getNextIndexByIdRefsAttribute\";\nimport { VirtualCommandArgs } from \"./types\";\n\nexport interface JumpToErrorMessageElementCommandArgs\n  extends VirtualCommandArgs {\n  index?: number;\n}\n\n/**\n * aria-errormessage:\n *\n * REFs:\n * - https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage\n * - https://a11ysupport.io/tech/aria/aria-errormessage_attribute\n */\nexport function jumpToErrorMessageElement({\n  index = 0,\n  container,\n  currentIndex,\n  tree,\n}: JumpToErrorMessageElementCommandArgs) {\n  return getNextIndexByIdRefsAttribute({\n    attributeName: \"aria-errormessage\",\n    index,\n    container,\n    currentIndex,\n    tree,\n  });\n}\n","import { getNextIndexByIdRefsAttribute } from \"./getNextIndexByIdRefsAttribute\";\nimport { VirtualCommandArgs } from \"./types\";\n\nexport interface MoveToNextAlternateReadingOrderElement\n  extends VirtualCommandArgs {\n  index?: number;\n}\n\n/**\n * aria-flowto:\n *\n * However, when aria-flowto is provided with multiple ID\n * references, assistive technologies SHOULD present the referenced\n * elements as path choices.\n *\n * In the case of one or more ID references, user agents or assistive\n * technologies SHOULD give the user the option of navigating to any of the\n * targeted elements. The name of the path can be determined by the name of\n * the target element of the aria-flowto attribute. Accessibility APIs can\n * provide named path relationships.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-flowto\n *\n * MUST requirements:\n *\n * A user needs to understand that the current element flows to another element\n * so that they can invoke the functionality.\n *\n * A user needs to be able to follow the alternate reading order.\n *\n * REF: https://a11ysupport.io/tech/aria/aria-flowto_attribute\n */\nexport function moveToNextAlternateReadingOrderElement({\n  index,\n  container,\n  currentIndex,\n  tree,\n}: MoveToNextAlternateReadingOrderElement) {\n  return getNextIndexByIdRefsAttribute({\n    attributeName: \"aria-flowto\",\n    index,\n    container,\n    currentIndex,\n    tree,\n  });\n}\n","import { isElement } from \"../isElement\";\nimport { VirtualCommandArgs } from \"./types\";\n\nexport interface MoveToNextAlternateReadingOrderElement\n  extends VirtualCommandArgs {\n  index?: number;\n}\n\n/**\n * aria-flowto:\n *\n * However, when aria-flowto is provided with multiple ID\n * references, assistive technologies SHOULD present the referenced\n * elements as path choices.\n *\n * In the case of one or more ID references, user agents or assistive\n * technologies SHOULD give the user the option of navigating to any of the\n * targeted elements. The name of the path can be determined by the name of\n * the target element of the aria-flowto attribute. Accessibility APIs can\n * provide named path relationships.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-flowto\n *\n * MUST requirements:\n *\n * The reading order goes both directions, and a user needs to be aware of the\n * alternate reading order so that they can invoke the functionality.\n *\n * The reading order goes both directions, and a user needs to be able to\n * travel backwards through their chosen reading order.\n *\n * REF: https://a11ysupport.io/tech/aria/aria-flowto_attribute\n */\nexport function moveToPreviousAlternateReadingOrderElement({\n  index = 0,\n  container,\n  currentIndex,\n  tree,\n}: MoveToNextAlternateReadingOrderElement) {\n  if (!isElement(container)) {\n    return;\n  }\n\n  // Degree of trust that this isn't called with a current index that can't\n  // actually index the tree.\n   \n  const { alternateReadingOrderParents } = tree.at(currentIndex)!;\n  const targetNode = alternateReadingOrderParents[index];\n\n  if (!targetNode) {\n    return;\n  }\n\n  return tree.findIndex(({ node }) => node === targetNode);\n}\n","import { getNextIndexByRoleAndAttributes } from \"./getNextIndexByRoleAndAttributes\";\nimport { getPreviousIndexByRoleAndAttributes } from \"./getPreviousIndexByRoleAndAttributes\";\nimport { jumpToControlledElement } from \"./jumpToControlledElement\";\nimport { jumpToDetailsElement } from \"./jumpToDetailsElement\";\nimport { jumpToErrorMessageElement } from \"./jumpToErrorMessageElement\";\nimport { moveToNextAlternateReadingOrderElement } from \"./moveToNextAlternateReadingOrderElement\";\nimport { moveToPreviousAlternateReadingOrderElement } from \"./moveToPreviousAlternateReadingOrderElement\";\nimport { VirtualCommandArgs } from \"./types\";\n\nconst quickLandmarkNavigationRoles = [\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role banner.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#banner\n   */\n  \"banner\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role complementary.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#complementary\n   */\n  \"complementary\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role contentinfo.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#contentinfo\n   */\n  \"contentinfo\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * figures.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#figure\n   */\n  \"figure\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role form.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#form\n   */\n  \"form\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role main.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#main\n   */\n  \"main\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role navigation.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#navigation\n   */\n  \"navigation\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role region.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#region\n   */\n  \"region\",\n\n  /**\n   * Assistive technologies SHOULD enable users to quickly navigate to\n   * elements with role search.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#search\n   */\n  \"search\",\n] as const;\n\nconst quickAriaRoleNavigationRoles = [\n  ...quickLandmarkNavigationRoles,\n  /**\n   * WAI-ARIA doesn't specify that assistive technologies should enable users\n   * to quickly navigate to elements with role heading. However, it is very\n   * common for assistive technology users to navigate between headings.\n   *\n   * REF:\n   * - https://www.w3.org/TR/wai-aria-1.2/#heading\n   * - https://webaim.org/projects/screenreadersurvey10/#heading\n   * - https://webaim.org/projects/screenreadersurvey10/#finding\n   *\n   * MUST requirements:\n   *\n   * Headings provide an outline of the page and users need to be able to\n   * quickly navigate to different sections of the page.\n   *\n   * REF: https://a11ysupport.io/tech/aria/heading_role\n   */\n  \"heading\",\n  /**\n   * WAI-ARIA doesn't specify that assistive technologies should enable users\n   * to quickly navigate to elements with role link. However, it is very\n   * common for assistive technology users to navigate between links.\n   *\n   * REF:\n   * - https://www.w3.org/TR/wai-aria-1.2/#link\n   * - https://webaim.org/projects/screenreadersurvey10/#finding\n   */\n  \"link\",\n] as const;\n\ninterface QuickAriaRoleNavigationCommands {\n  /**\n   * Move to the next element with a [`banner`](https://www.w3.org/TR/wai-aria-1.2/#banner)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next banner element.\n   *   await virtual.perform(virtual.commands.moveToNextBanner);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextBanner: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`banner`](https://www.w3.org/TR/wai-aria-1.2/#banner)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous banner element.\n   *   await virtual.perform(virtual.commands.moveToPreviousBanner);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousBanner: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`complementary`](https://www.w3.org/TR/wai-aria-1.2/#complementary)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next complementary element.\n   *   await virtual.perform(virtual.commands.moveToNextComplementary);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextComplementary: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`complementary`](https://www.w3.org/TR/wai-aria-1.2/#complementary)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous complementary element.\n   *   await virtual.perform(virtual.commands.moveToPreviousComplementary);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousComplementary: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`contentinfo`](https://www.w3.org/TR/wai-aria-1.2/#contentinfo)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next contentinfo element.\n   *   await virtual.perform(virtual.commands.moveToNextContentInfo);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextContentinfo: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`contentinfo`](https://www.w3.org/TR/wai-aria-1.2/#contentinfo)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous contentinfo element.\n   *   await virtual.perform(virtual.commands.moveToPreviousContentinfo);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousContentinfo: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`figure`](https://www.w3.org/TR/wai-aria-1.2/#figure)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next figure element.\n   *   await virtual.perform(virtual.commands.moveToNextFigure);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextFigure: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`figure`](https://www.w3.org/TR/wai-aria-1.2/#figure)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous figure element.\n   *   await virtual.perform(virtual.commands.moveToPreviousFigure);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousFigure: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`form`](https://www.w3.org/TR/wai-aria-1.2/#form)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next form element.\n   *   await virtual.perform(virtual.commands.moveToNextForm);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextForm: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`form`](https://www.w3.org/TR/wai-aria-1.2/#form)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous form element.\n   *   await virtual.perform(virtual.commands.moveToPreviousForm);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousForm: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`main`](https://www.w3.org/TR/wai-aria-1.2/#main)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next main element.\n   *   await virtual.perform(virtual.commands.moveToNextMain);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextMain: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`main`](https://www.w3.org/TR/wai-aria-1.2/#main)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous main element.\n   *   await virtual.perform(virtual.commands.moveToPreviousMain);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousMain: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`navigation`](https://www.w3.org/TR/wai-aria-1.2/#navigation)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next navigation element.\n   *   await virtual.perform(virtual.commands.moveToNextNavigation);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextNavigation: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`navigation`](https://www.w3.org/TR/wai-aria-1.2/#navigation)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous navigation element.\n   *   await virtual.perform(virtual.commands.moveToPreviousNavigation);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousNavigation: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`region`](https://www.w3.org/TR/wai-aria-1.2/#region)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next region element.\n   *   await virtual.perform(virtual.commands.moveToNextRegion);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextRegion: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`region`](https://www.w3.org/TR/wai-aria-1.2/#region)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous region element.\n   *   await virtual.perform(virtual.commands.moveToPreviousRegion);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousRegion: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`search`](https://www.w3.org/TR/wai-aria-1.2/#search)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next search element.\n   *   await virtual.perform(virtual.commands.moveToNextSearch);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextSearch: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`search`](https://www.w3.org/TR/wai-aria-1.2/#search)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous search element.\n   *   await virtual.perform(virtual.commands.moveToPreviousSearch);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousSearch: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeading);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeading: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeading);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeading: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a [`link`](https://www.w3.org/TR/wai-aria-1.2/#link)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next link element.\n   *   await virtual.perform(virtual.commands.moveToNextLink);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextLink: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a [`link`](https://www.w3.org/TR/wai-aria-1.2/#link)\n   * role.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous link element.\n   *   await virtual.perform(virtual.commands.moveToPreviousLink);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousLink: (args: VirtualCommandArgs) => number | null;\n}\n\nconst quickAriaRoleNavigationCommands: QuickAriaRoleNavigationCommands =\n  quickAriaRoleNavigationRoles.reduce<Record<string, unknown>>(\n    (accumulatedCommands, role) => {\n      // The roles are defined above and all non-empty.\n       \n      const moveToNextCommand = `moveToNext${role\n        .at(0)!\n        .toUpperCase()}${role.slice(1)}`;\n\n      // The roles are defined above and all non-empty.\n       \n      const moveToPreviousCommand = `moveToPrevious${role\n        .at(0)!\n        .toUpperCase()}${role.slice(1)}`;\n\n      return {\n        ...accumulatedCommands,\n        [moveToNextCommand]: getNextIndexByRoleAndAttributes({ roles: [role] }),\n        [moveToPreviousCommand]: getPreviousIndexByRoleAndAttributes({\n          roles: [role],\n        }),\n      };\n    },\n    {}\n  ) as {\n    [K in\n      | `moveToNext${Capitalize<(typeof quickAriaRoleNavigationRoles)[number]>}`\n      | `moveToPrevious${Capitalize<\n          (typeof quickAriaRoleNavigationRoles)[number]\n        >}`]: (args: VirtualCommandArgs) => number | null;\n  };\n\ntype HeadingLevel = \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n\nconst headingLevels: HeadingLevel[] = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"];\n\ninterface HeadingLevelNavigationCommands {\n  /**\n   * Move to the next element with a level 1 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 1 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel1);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel1: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 1 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 1 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel1);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel1: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a level 2 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 2 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel2);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel2: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 2 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 2 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel2);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel2: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a level 3 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 3 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel3);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel3: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 3 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 3 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel3);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel3: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a level 4 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 4 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel4);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel4: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 4 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 4 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel4);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel4: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a level 5 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 5 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel5);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel5: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 5 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 5 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel5);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel5: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the next element with a level 6 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next level 6 heading element.\n   *   await virtual.perform(virtual.commands.moveToNextHeadingLevel6);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextHeadingLevel6: (args: VirtualCommandArgs) => number | null;\n  /**\n   * Move to the previous element with a level 6 [`heading`](https://www.w3.org/TR/wai-aria-1.2/#heading)\n   * role:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous level 6 heading element.\n   *   await virtual.perform(virtual.commands.moveToPreviousHeadingLevel6);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousHeadingLevel6: (args: VirtualCommandArgs) => number | null;\n}\n\nconst headingLevelNavigationCommands: HeadingLevelNavigationCommands =\n  headingLevels.reduce((accumulatedCommands, headingLevel) => {\n    const moveToNextCommand = `moveToNextHeadingLevel${headingLevel}`;\n    const moveToPreviousCommand = `moveToPreviousHeadingLevel${headingLevel}`;\n\n    return {\n      ...accumulatedCommands,\n      [moveToNextCommand]: getNextIndexByRoleAndAttributes({\n        ariaAttributes: { \"aria-level\": headingLevel },\n      }),\n      [moveToPreviousCommand]: getPreviousIndexByRoleAndAttributes({\n        ariaAttributes: { \"aria-level\": headingLevel },\n      }),\n    };\n  }, {}) as {\n    [K in\n      | `moveToNextHeadingLevel${HeadingLevel}`\n      | `moveToPreviousHeadingLevel${HeadingLevel}`]: (\n      args: VirtualCommandArgs\n    ) => number | null;\n  };\n\nexport const commands = {\n  /**\n   * Jump to an element controlled by the current element in the Virtual Screen\n   * Reader focus. See [aria-controls](https://www.w3.org/TR/wai-aria-1.2/#aria-controls).\n   *\n   * When using with `virtual.perform()`, pass an index option to select which\n   * controlled element is jumped to when there are more than one:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to jump to the second controlled element.\n   *   await virtual.perform(virtual.commands.jumpToControlledElement, { index: 1 });\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  jumpToControlledElement,\n  /**\n   * Jump to an element that describes the current element in the Virtual\n   * Screen Reader focus. See [aria-details](https://www.w3.org/TR/wai-aria-1.2/#aria-details).\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to jump to the details element.\n   *   await virtual.perform(virtual.commands.jumpToDetailsElement);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  jumpToDetailsElement,\n  /**\n   * Jump to an element that provides an error message for the current element\n   * in the Virtual Screen Reader focus. See [aria-errormessage](https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage).\n   *\n   * When using with `virtual.perform()`, pass an `index` option to select\n   * which error message element is jumped to when there are more than one:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to jump to the second error message element.\n   *   await virtual.perform(virtual.commands.jumpToErrorMessageElement, {\n   *     index: 1,\n   *   });\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  jumpToErrorMessageElement,\n  /**\n   * Move to the next element in an alternate reading order. See\n   * [aria-flowto](https://www.w3.org/TR/wai-aria-1.2/#aria-flowto).\n   *\n   * When using with `virtual.perform()`, pass an `index` option to select\n   * which alternate reading order element is jumped to when there are more\n   * than one:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the second choice element of next alternate reading order.\n   *   await virtual.perform(\n   *     virtual.commands.moveToNextAlternateReadingOrderElement,\n   *     { index: 1 }\n   *   );\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextAlternateReadingOrderElement,\n  /**\n   * Move to the previous element in an alternate reading order. See\n   * [aria-flowto](https://www.w3.org/TR/wai-aria-1.2/#aria-flowto).\n   *\n   * When using with `virtual.perform()`, pass an `index` option to select\n   * which alternate reading order element is jumped to when there are more than\n   * one:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the second choice element of previous alternate reading order.\n   *   await virtual.perform(\n   *     virtual.commands.moveToPreviousAlternateReadingOrderElement,\n   *     { index: 1 }\n   *   );\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousAlternateReadingOrderElement,\n  ...quickAriaRoleNavigationCommands,\n  /**\n   * Move to the next element with any [`landmark`](https://www.w3.org/TR/wai-aria-1.2/#landmark)\n   * role:\n   *\n   * - [`banner`](https://www.w3.org/TR/wai-aria-1.2/#banner)\n   * - [`complementary`](https://www.w3.org/TR/wai-aria-1.2/#complementary)\n   * - [`contentinfo`](https://www.w3.org/TR/wai-aria-1.2/#contentinfo)\n   * - [`figure`](https://www.w3.org/TR/wai-aria-1.2/#figure)\n   * - [`form`](https://www.w3.org/TR/wai-aria-1.2/#form)\n   * - [`landmark`](https://www.w3.org/TR/wai-aria-1.2/#landmark)\n   * - [`main`](https://www.w3.org/TR/wai-aria-1.2/#main)\n   * - [`navigation`](https://www.w3.org/TR/wai-aria-1.2/#navigation)\n   * - [`region`](https://www.w3.org/TR/wai-aria-1.2/#region)\n   * - [`search`](https://www.w3.org/TR/wai-aria-1.2/#search)\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next landmark element.\n   *   await virtual.perform(virtual.commands.moveToNextLandmark);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToNextLandmark: getNextIndexByRoleAndAttributes({\n    roles: quickLandmarkNavigationRoles,\n  }),\n  /**\n   * Move to the previous element with any [`landmark`](https://www.w3.org/TR/wai-aria-1.2/#landmark)\n   * role:\n   *\n   * - [`banner`](https://www.w3.org/TR/wai-aria-1.2/#banner)\n   * - [`complementary`](https://www.w3.org/TR/wai-aria-1.2/#complementary)\n   * - [`contentinfo`](https://www.w3.org/TR/wai-aria-1.2/#contentinfo)\n   * - [`figure`](https://www.w3.org/TR/wai-aria-1.2/#figure)\n   * - [`form`](https://www.w3.org/TR/wai-aria-1.2/#form)\n   * - [`landmark`](https://www.w3.org/TR/wai-aria-1.2/#landmark)\n   * - [`main`](https://www.w3.org/TR/wai-aria-1.2/#main)\n   * - [`navigation`](https://www.w3.org/TR/wai-aria-1.2/#navigation)\n   * - [`region`](https://www.w3.org/TR/wai-aria-1.2/#region)\n   * - [`search`](https://www.w3.org/TR/wai-aria-1.2/#search)\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the previous landmark element.\n   *   await virtual.perform(virtual.commands.moveToPreviousLandmark);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  moveToPreviousLandmark: getPreviousIndexByRoleAndAttributes({\n    roles: quickLandmarkNavigationRoles,\n  }),\n  ...headingLevelNavigationCommands,\n};\n\nexport type VirtualCommands = {\n  [K in keyof typeof commands]: (typeof commands)[K];\n};\n","export const ERR_NOT_IMPLEMENTED = \"Not implemented\";\nexport const ERR_VIRTUAL_MISSING_CONTAINER = \"A container was not provided\";\nexport const ERR_VIRTUAL_NOT_STARTED = \"Virtual Screen Reader was not started\";\n","import { getAccessibleName } from \"./getNodeAccessibilityData/getAccessibleName\";\nimport { getAccessibleValue } from \"./getNodeAccessibilityData/getAccessibleValue\";\nimport { getElementFromNode } from \"./getElementFromNode\";\nimport { getRole } from \"./getNodeAccessibilityData/getRole\";\nimport { isElement } from \"./isElement\";\nimport { sanitizeString } from \"./sanitizeString\";\n\ntype ValueOf<T> = T[keyof T];\n\n/**\n * Live region roles:\n *\n * - alert\n * - log\n * - marquee\n * - status\n * - timer\n * - alertdialog\n *\n * Live region attributes:\n *\n * - aria-atomic\n * - TODO: aria-busy\n * - aria-live\n * - aria-relevant\n *\n * When live regions are marked as polite, assistive technologies SHOULD\n * announce updates at the next graceful opportunity, such as at the end of\n * speaking the current sentence or when the user pauses typing. When live\n * regions are marked as assertive, assistive technologies SHOULD notify the\n * user immediately.\n *\n * REF:\n *\n * - https://www.w3.org/TR/wai-aria-1.2/#live_region_roles\n * - https://www.w3.org/TR/wai-aria-1.2/#window_roles\n * - https://www.w3.org/TR/wai-aria-1.2/#attrs_liveregions\n * - https://www.w3.org/TR/wai-aria-1.2/#aria-live\n */\n\nexport const LIVE = {\n  ASSERTIVE: \"assertive\",\n  OFF: \"off\",\n  POLITE: \"polite\",\n};\n\nconst RELEVANT = {\n  ADDITIONS: \"additions\",\n  ALL: \"all\",\n  REMOVALS: \"removals\",\n  TEXT: \"text\",\n};\n\nconst RELEVANT_VALUES = new Set(Object.values(RELEVANT));\nconst DEFAULT_ATOMIC = false;\nconst DEFAULT_LIVE = LIVE.OFF;\nconst DEFAULT_RELEVANT = [RELEVANT.ADDITIONS, RELEVANT.TEXT];\n\nfunction getSpokenPhraseForNode(node: Node) {\n  return (\n    getAccessibleName(node) ||\n    getAccessibleValue(node) ||\n    // `node.textContent` is only `null` if the `node` is a `document` or a\n    // `doctype`. We don't consider either.\n    sanitizeString(node.textContent!)\n  );\n}\n\nfunction getAllSpokenPhrase({\n  addedNodes,\n  removedNodes,\n  target,\n  type,\n}: {\n  addedNodes: NodeList;\n  removedNodes: NodeList;\n  target: Node;\n  type: MutationRecordType;\n}) {\n  return [\n    ...getAdditionsSpokenPhrase({\n      addedNodes,\n    }),\n    ...getRemovalsSpokenPhrase({\n      removedNodes,\n    }),\n    ...getTextSpokenPhrase({\n      addedNodes,\n      target,\n      type,\n    }),\n  ];\n}\n\nfunction getAdditionsSpokenPhrase({ addedNodes }: { addedNodes: NodeList }) {\n  return Array.from(addedNodes).filter(isElement).map(getSpokenPhraseForNode);\n}\n\nfunction getRemovalsSpokenPhrase({ removedNodes }: { removedNodes: NodeList }) {\n  return Array.from(removedNodes).map(\n    (removedNode) => `removal: ${getSpokenPhraseForNode(removedNode)}`\n  );\n}\n\nconst TEXT_NODE = 3;\n\n/**\n * TODO: When text changes are denoted as relevant, user agents MUST monitor\n * any descendant node change that affects the text alternative computation of\n * the live region as if the accessible name were determined from contents\n * (nameFrom: contents). For example, a text change would be triggered if the\n * HTML alt attribute of a contained image changed. However, no change would be\n * triggered if there was a text change to a node outside the live region, even\n * if that node was referenced (via aria-labelledby) by an element contained in\n * the live region.\n */\nfunction getTextSpokenPhrase({\n  addedNodes,\n  target,\n  type,\n}: {\n  addedNodes: NodeList;\n  target: Node;\n  type: MutationRecordType;\n}) {\n  switch (type) {\n    case \"childList\": {\n      if (!addedNodes.length) {\n        break;\n      }\n\n      return Array.from(addedNodes)\n        .filter((node) => node.nodeType === TEXT_NODE)\n        .map(getSpokenPhraseForNode);\n    }\n    case \"characterData\": {\n      return [getSpokenPhraseForNode(target)];\n    }\n  }\n\n  return [];\n}\n\nconst relevantToSpokenPhraseMap = {\n  [RELEVANT.ADDITIONS]: getAdditionsSpokenPhrase,\n  [RELEVANT.ALL]: getAllSpokenPhrase,\n  [RELEVANT.REMOVALS]: getRemovalsSpokenPhrase,\n  [RELEVANT.TEXT]: getTextSpokenPhrase,\n};\n\nconst roleToImplicitLiveRegionStatesAndPropertiesMap: Record<\n  string,\n  { atomic?: boolean; live: ValueOf<typeof LIVE> }\n> = {\n  alert: {\n    atomic: true,\n    live: LIVE.ASSERTIVE,\n  },\n  log: {\n    live: LIVE.POLITE,\n  },\n  marquee: {\n    live: LIVE.OFF,\n  },\n  status: {\n    atomic: true,\n    live: LIVE.POLITE,\n  },\n  timer: {\n    live: LIVE.OFF,\n  },\n  alertdialog: {\n    atomic: true,\n    live: LIVE.ASSERTIVE,\n  },\n};\n\nfunction getLiveRegionAttributes(\n  {\n    container,\n    target,\n  }: {\n    container: Node | null;\n    target: Element;\n  },\n  {\n    atomic,\n    live,\n    liveTarget,\n    relevant,\n  }: {\n    atomic?: boolean;\n    live?: ValueOf<typeof LIVE>;\n    liveTarget?: Element;\n    relevant?: ValueOf<typeof RELEVANT>[];\n  } = {}\n): {\n  atomic: boolean;\n  live: ValueOf<typeof LIVE>;\n  liveTarget?: Element;\n  relevant: ValueOf<typeof RELEVANT>[];\n} {\n  // TODO: it would be far better if worked with the accessibility tree rather\n  // than reconstructing here and making assumptions (though probable) about\n  // the allowed roles or inherited presentational roles.\n  const accessibleName = getAccessibleName(target);\n  const { role } = getRole({\n    accessibleName,\n    allowedAccessibilityRoles: [],\n    inheritedImplicitPresentational: false,\n    node: target,\n  });\n\n  const implicitAttributes =\n    roleToImplicitLiveRegionStatesAndPropertiesMap[role];\n\n  if (typeof atomic === \"undefined\" && target.hasAttribute(\"aria-atomic\")) {\n    atomic = target.getAttribute(\"aria-atomic\") === \"true\";\n  }\n\n  if (typeof live === \"undefined\" && target.hasAttribute(\"aria-live\")) {\n    live = target.getAttribute(\"aria-live\") as ValueOf<typeof LIVE>;\n    liveTarget = target;\n  }\n\n  if (typeof live === \"undefined\" && implicitAttributes) {\n    live = implicitAttributes.live;\n    liveTarget = target;\n\n    if (typeof atomic === \"undefined\") {\n      atomic = implicitAttributes.atomic;\n    }\n  }\n\n  if (typeof relevant === \"undefined\" && target.hasAttribute(\"aria-relevant\")) {\n    // The `target.hasAttribute(\"aria-relevant\")` check is sufficient to guard\n    // against the `target.getAttribute(\"aria-relevant\")` being null.\n\n    relevant = target\n      .getAttribute(\"aria-relevant\")!\n      .split(\" \")\n      .filter(\n        (token) => !!RELEVANT_VALUES.has(token as ValueOf<typeof RELEVANT>)\n      ) as ValueOf<typeof RELEVANT>[];\n\n    if (relevant.includes(RELEVANT.ALL)) {\n      relevant = [RELEVANT.ALL];\n    }\n  }\n\n  if (\n    typeof atomic !== \"undefined\" &&\n    typeof live !== \"undefined\" &&\n    typeof relevant !== \"undefined\"\n  ) {\n    return {\n      atomic,\n      live,\n      liveTarget,\n      relevant,\n    };\n  }\n\n  const targetAncestor = target.parentElement;\n\n  if (target === container || targetAncestor === null) {\n    return {\n      atomic: atomic ?? DEFAULT_ATOMIC,\n      live: live ?? DEFAULT_LIVE,\n      liveTarget,\n      relevant: relevant ?? DEFAULT_RELEVANT,\n    };\n  }\n\n  return getLiveRegionAttributes(\n    { container, target: targetAncestor },\n    {\n      atomic,\n      live,\n      liveTarget,\n      relevant,\n    }\n  );\n}\n\nexport function getLiveSpokenPhrase({\n  container,\n  mutation: { addedNodes, removedNodes, target, type },\n}: {\n  container: Node | null;\n  mutation: MutationRecord;\n}): string {\n  const { atomic, live, liveTarget, relevant } = getLiveRegionAttributes({\n    container,\n    target: getElementFromNode(target),\n  });\n\n  if (live === LIVE.OFF || !liveTarget) {\n    return \"\";\n  }\n\n  /**\n   * TODO: Indicates whether assistive technologies will present all, or only\n   * parts of, the changed region based on the change notifications defined by\n   * the aria-relevant attribute.\n   *\n   * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-atomic\n   *\n   * This indicates that the behaviour of aria-atomic is informed by\n   * aria-relevant in some way, which is not explained well by the\n   * specification.\n   *\n   * Given the lack of aria-relevant usage this is perhaps not one to dwell on?\n   * REF: https://github.com/w3c/aria/issues/712\n   */\n  if (atomic) {\n    return `${live}: ${getSpokenPhraseForNode(liveTarget)}`;\n  }\n\n  const spokenPhrases = relevant\n    .flatMap((relevantType) =>\n      relevantToSpokenPhraseMap[relevantType]({\n        addedNodes,\n        removedNodes,\n        target,\n        type,\n      })\n    )\n    .filter(Boolean)\n    .join(\", \");\n\n  if (!spokenPhrases) {\n    return \"\";\n  }\n\n  return `${live}: ${spokenPhrases}`;\n}\n","import { AccessibilityNode } from \"./createAccessibilityTree\";\n\nexport const getSpokenPhrase = (accessibilityNode: AccessibilityNode) => {\n  const {\n    accessibleAttributeLabels,\n    accessibleDescription,\n    accessibleName,\n    accessibleValue,\n    spokenRole,\n  } = accessibilityNode;\n\n  const announcedValue =\n    accessibleName === accessibleValue ? \"\" : accessibleValue;\n\n  return [\n    spokenRole,\n    accessibleName,\n    announcedValue,\n    accessibleDescription,\n    ...accessibleAttributeLabels,\n  ]\n    .filter(Boolean)\n    .join(\", \");\n};\n","import { isElement } from \"./isElement\";\nimport type { Root } from \"./Virtual\";\n\nexport function observeDOM(\n  root: Root | undefined,\n  node: Node,\n  onChange: MutationCallback\n): () => void {\n  if (!isElement(node)) {\n    return () => {};\n  }\n\n  const MutationObserver =\n    typeof root !== \"undefined\" ? root?.MutationObserver : null;\n\n  if (MutationObserver) {\n    const mutationObserver = new MutationObserver(onChange);\n\n    mutationObserver.observe(node, {\n      attributes: true,\n      characterData: true,\n      childList: true,\n      subtree: true,\n    });\n\n    return () => {\n      mutationObserver.disconnect();\n    };\n  }\n\n  return () => {\n    // gracefully fallback to not supporting Accessibility Tree refreshes if\n    // the DOM changes.\n  };\n}\n","export async function tick() {\n  return await new Promise<void>((resolve) => setTimeout(() => resolve()));\n}\n","import {\n  AccessibilityNode,\n  createAccessibilityTree,\n} from \"./createAccessibilityTree\";\nimport { commands, type VirtualCommands } from \"./commands/index\";\nimport {\n  ERR_VIRTUAL_MISSING_CONTAINER,\n  ERR_VIRTUAL_NOT_STARTED,\n} from \"./errors\";\nimport { getLiveSpokenPhrase, LIVE } from \"./getLiveSpokenPhrase\";\nimport { flattenTree } from \"./flattenTree\";\nimport { getElementNode } from \"./commands/getElementNode\";\nimport { getItemText } from \"./getItemText\";\nimport { getSpokenPhrase } from \"./getSpokenPhrase\";\nimport { observeDOM } from \"./observeDOM\";\nimport { tick } from \"./tick\";\nimport { userEvent } from \"@testing-library/user-event\";\nimport type { VirtualCommandArgs } from \"./commands/types\";\n\n/**\n * Modifiers ported from https://github.com/guidepup/guidepup to prevent ESM\n * issues by Guidepup's usage of node builtins etc.\n */\n\nconst MacOSModifiers: Record<string, string> = {\n  /**\n   * The Command (alias cmd, ⌘) key.\n   */\n  Command: \"command\",\n  CommandLeft: \"command\",\n  CommandRight: \"command\",\n  Meta: \"command\",\n  /**\n   * The Control (alias ctrl, ⌃) key.\n   */\n  Control: \"control\",\n  ControlLeft: \"control\",\n  ControlRight: \"control\",\n  /**\n   * The Option (alias alt, ⌥) key.\n   */\n  Option: \"option\",\n  OptionLeft: \"option\",\n  OptionRight: \"option\",\n  Alt: \"option\",\n  AltLeft: \"option\",\n  AltRight: \"option\",\n  /**\n   * The Shift (alias ⇧) key.\n   */\n  Shift: \"shift\",\n  ShiftLeft: \"shift\",\n  ShiftRight: \"shift\",\n};\n\nconst WindowsModifiers: Record<string, string> = {\n  /**\n   * Hold down the Control (alias ctrl, ⌃) key.\n   */\n  Control: \"control\",\n  /**\n   * Hold down the Alt (alias ⎇) key.\n   */\n  Alt: \"alt\",\n  /**\n   * Hold down the Shift (alias ⇧) key.\n   */\n  Shift: \"shift\",\n};\n\nexport interface Root {\n  document?: Document;\n  MutationObserver?: typeof MutationObserver;\n}\n\nexport interface StartOptions {\n  /**\n   * The bounding HTML element to use the Virtual Screen Reader in.\n   *\n   * To use the entire page pass `document.body`.\n   */\n  container: Node;\n\n  /**\n   * The window instance.\n   *\n   * Only required if the `window` instance is not already globally available.\n   * For example, when you are in a Node environment and using a custom DOM\n   * implementation that is not attached to the global scope.\n   *\n   * Defaults to using the global `window` instance.\n   */\n  window?: Root;\n\n  /**\n   * Display the Virtual Screen Reader cursor visually on the target element.\n   *\n   * Note: There is a performance overhead to visually rendering the cursor.\n   *\n   * Defaults to `false`.\n   */\n  displayCursor?: boolean;\n}\n\nconst defaultUserEventOptions = {\n  delay: 0,\n  skipHover: true,\n};\n\n/**\n * TODO: When a modal element is displayed, assistive technologies SHOULD\n * navigate to the element unless focus has explicitly been set elsewhere.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-modal\n */\n\n/**\n * TODO: When an assistive technology reading cursor moves from one article to\n * another, assistive technologies SHOULD set user agent focus on the article\n * that contains the reading cursor. If the reading cursor lands on a focusable\n * element inside the article, the assistive technology MAY set focus on that\n * element in lieu of setting focus on the containing article.\n *\n * REF: https://www.w3.org/TR/wai-aria-1.2/#feed\n */\n\n/**\n * [API Reference](https://www.guidepup.dev/docs/api/class-virtual)\n *\n * A Virtual Screen Reader class that can be used to launch and control a\n * headless JavaScript screen reader which is compatible with any specification\n * compliant DOM implementation, e.g. jsdom, Jest, or any modern browser.\n *\n * Here's a typical example:\n *\n * ```ts\n * import { Virtual } from \"@guidepup/virtual-screen-reader\";\n *\n * function setupBasicPage() {\n *   document.body.innerHTML = `\n *   <nav>Nav Text</nav>\n *   <section>\n *     <h1>Section Heading</h1>\n *     <p>Section Text</p>\n *     <article>\n *       <header>\n *         <h1>Article Header Heading</h1>\n *         <p>Article Header Text</p>\n *       </header>\n *       <p>Article Text</p>\n *     </article>\n *   </section>\n *   <footer>Footer</footer>\n *   `;\n * }\n *\n * describe(\"Screen Reader Tests\", () => {\n *   test(\"should traverse the page announcing the expected roles and content\", async () => {\n *     // Setup a page using a framework and testing library of your choice\n *     setupBasicPage();\n *\n *     // Create a new Virtual Screen Reader instance\n *     const virtual = new Virtual();\n *\n *     // Start your Virtual Screen Reader instance\n *     await virtual.start({ container: document.body });\n *\n *     // Navigate your environment with the Virtual Screen Reader just as your users would\n *     while ((await virtual.lastSpokenPhrase()) !== \"end of document\") {\n *       await virtual.next();\n *     }\n *\n *     // Assert on what your users would really see and hear when using screen readers\n *     expect(await virtual.spokenPhraseLog()).toEqual([\n *       \"document\",\n *       \"navigation\",\n *       \"Nav Text\",\n *       \"end of navigation\",\n *       \"region\",\n *       \"heading, Section Heading, level 1\",\n *       \"Section Text\",\n *       \"article\",\n *       \"heading, Article Header Heading, level 1\",\n *       \"Article Header Text\",\n *       \"Article Text\",\n *       \"end of article\",\n *       \"end of region\",\n *       \"contentinfo\",\n *       \"Footer\",\n *       \"end of contentinfo\",\n *       \"end of document\",\n *     ]);\n *\n *     // Stop your Virtual Screen Reader instance\n *     await virtual.stop();\n *   });\n * });\n * ```\n */\nexport class Virtual {\n  #activeNode: AccessibilityNode | null = null;\n  #container: Node | null = null;\n  #cursor: HTMLDivElement | null = null;\n  #itemTextLog: string[] = [];\n  #spokenPhraseLog: string[] = [];\n  #treeCache: AccessibilityNode[] | null = null;\n  #disconnectDOMObserver: (() => void) | null = null;\n  #boundHandleFocusChange: ((event: Event) => Promise<void>) | null = null;\n\n  #checkContainer() {\n    if (!this.#container) {\n      throw new Error(ERR_VIRTUAL_NOT_STARTED);\n    }\n  }\n\n  #createCursor(root: Root | undefined) {\n    if (!root?.document) {\n      return;\n    }\n\n    this.#cursor = root.document.createElement(\"div\");\n\n    this.#cursor.ariaHidden = \"true\";\n    this.#cursor.style.border = \"2px dashed #1f1f1f\";\n    this.#cursor.style.outline = \"2px dashed #f0f0f0\";\n    this.#cursor.style.minHeight = \"4px\";\n    this.#cursor.style.minWidth = \"4px\";\n    this.#cursor.style.position = \"absolute\";\n    this.#cursor.style.left = \"0px\";\n    this.#cursor.style.top = \"0px\";\n    this.#cursor.style.margin = \"0px\";\n    this.#cursor.style.padding = \"2px\";\n    this.#cursor.style.pointerEvents = \"none\";\n    this.#cursor.style.zIndex = \"calc(Infinity)\";\n    this.#cursor.dataset.testid = \"virtual-screen-reader-cursor\";\n\n    this.#container!.appendChild(this.#cursor);\n  }\n\n  #setActiveNode(accessibilityNode: AccessibilityNode) {\n    this.#activeNode = accessibilityNode;\n\n    if (!this.#cursor) {\n      return;\n    }\n\n    const rect = getElementNode(accessibilityNode).getBoundingClientRect();\n\n    this.#cursor.style.top = `${rect.top - 2}px`;\n    this.#cursor.style.left = `${rect.left - 4}px`;\n    this.#cursor.style.width = `${rect.width}px`;\n    this.#cursor.style.height = `${rect.height}px`;\n  }\n\n  #getAccessibilityTree() {\n    if (!this.#treeCache) {\n      const tree = createAccessibilityTree(this.#container);\n\n      this.#treeCache =\n        this.#container && tree ? flattenTree(this.#container, tree, null) : [];\n    }\n\n    return this.#treeCache;\n  }\n\n  #getModalAccessibilityTree() {\n    const tree = this.#getAccessibilityTree();\n\n    if (!this.#activeNode) {\n      return tree;\n    }\n\n    const isModal =\n      this.#activeNode.parentDialog?.getAttribute(\"aria-modal\") === \"true\";\n\n    if (!isModal) {\n      return tree;\n    }\n\n    /**\n     * Assistive technologies MAY limit navigation to the modal element's\n     * contents.\n     *\n     * REF: https://www.w3.org/TR/wai-aria-1.2/#aria-modal\n     */\n    return tree.filter(\n      ({ parentDialog }) => this.#activeNode!.parentDialog === parentDialog\n    );\n  }\n\n  #invalidateTreeCache() {\n    this.#treeCache = null;\n  }\n\n  async #handleFocusChange({ target }: Event) {\n    await tick();\n\n    this.#invalidateTreeCache();\n    const tree = this.#getAccessibilityTree();\n\n    if (!tree.length) {\n      return;\n    }\n\n    // We've covered the tree having no length so there should be at least one\n    // matching node, but if not we will not update the state\n    const newActiveNode = tree.find(({ node }) => node === target);\n\n    if (!newActiveNode) {\n      return;\n    }\n\n    this.#updateState(newActiveNode, true);\n  }\n\n  #focusActiveElement() {\n    // Is only called following a null guard for `this.#activeNode`.\n\n    const target = getElementNode(this.#activeNode!);\n    target?.focus();\n  }\n\n  async #announceLiveRegions(mutations: MutationRecord[]) {\n    await tick();\n\n    const container = this.#container;\n\n    mutations\n      .map((mutation) =>\n        getLiveSpokenPhrase({\n          container,\n          mutation,\n        })\n      )\n      .filter(Boolean)\n      .forEach((spokenPhrase) => {\n        this.#spokenPhraseLog.push(spokenPhrase);\n      });\n  }\n\n  #spokenPhraseLogWithoutLiveRegions() {\n    return this.#spokenPhraseLog.filter(\n      (spokenPhrase) =>\n        !spokenPhrase.startsWith(LIVE.ASSERTIVE) &&\n        !spokenPhrase.startsWith(LIVE.POLITE)\n    );\n  }\n\n  #updateState(accessibilityNode: AccessibilityNode, ignoreIfNoChange = false) {\n    /**\n     * When the dialog is correctly labeled and focus is moved to an element\n     * (often an interactive element, such as a button) inside the dialog,\n     * screen readers should announce the dialog's accessible role, name and\n     * optionally description, along with announcing the focused element.\n     *\n     * REF: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role#possible_effects_on_user_agents_and_assistive_technology\n     */\n    if (\n      accessibilityNode.parentDialog !== null &&\n      accessibilityNode.parentDialog !== this.#activeNode?.parentDialog\n    ) {\n      // One of the few cases where you will get two logs for a single\n      // interaction.\n      //\n      // We don't need to perform the `ignoreIfNoChange` check as this will\n      // only fire if the parent dialog element has changed, and if that\n      // happens we can be fairly confident that item under the virtual\n      // cursor has changed.\n      const tree = this.#getAccessibilityTree();\n      const parentDialogNode = tree.find(\n        ({ node }) => node === accessibilityNode.parentDialog\n      )!;\n\n      const spokenPhrase = getSpokenPhrase(parentDialogNode);\n      const itemText = getItemText(parentDialogNode);\n\n      this.#itemTextLog.push(itemText);\n      this.#spokenPhraseLog.push(spokenPhrase);\n    }\n\n    this.#setActiveNode(accessibilityNode);\n\n    const spokenPhrase = getSpokenPhrase(accessibilityNode);\n    const itemText = getItemText(accessibilityNode);\n\n    if (\n      ignoreIfNoChange &&\n      spokenPhrase === this.#spokenPhraseLogWithoutLiveRegions().at(-1) &&\n      itemText === this.#itemTextLog.at(-1)\n    ) {\n      return;\n    }\n\n    this.#itemTextLog.push(itemText);\n    this.#spokenPhraseLog.push(spokenPhrase);\n  }\n\n  async #refreshState(ignoreIfNoChange: boolean) {\n    await tick();\n\n    this.#invalidateTreeCache();\n    const tree = this.#getAccessibilityTree();\n    const currentIndex = this.#getCurrentIndexByNode(tree);\n\n    // This only fires after keyboard like interactions, both of which null\n    // guard the `this.#activeNode` so it stands that we should still be able\n    // to find it in the tree.\n\n    const newActiveNode = tree.at(currentIndex)!;\n\n    this.#updateState(newActiveNode, ignoreIfNoChange);\n  }\n\n  #getCurrentIndex(tree: AccessibilityNode[]) {\n    return tree.findIndex(\n      ({\n        accessibleDescription,\n        accessibleName,\n        accessibleValue,\n        node,\n        role,\n        spokenRole,\n      }) =>\n        accessibleDescription === this.#activeNode?.accessibleDescription &&\n        accessibleName === this.#activeNode?.accessibleName &&\n        accessibleValue === this.#activeNode?.accessibleValue &&\n        node === this.#activeNode?.node &&\n        role === this.#activeNode?.role &&\n        spokenRole === this.#activeNode?.spokenRole\n    );\n  }\n\n  #getCurrentIndexByNode(tree: AccessibilityNode[]) {\n    return tree.findIndex(({ node }) => node === this.#activeNode?.node);\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-active-node)\n   *\n   * Getter for the active node under the Virtual Screen Reader cursor.\n   *\n   * Note that this is not always the same as the currently focused node.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the next element.\n   *   await virtual.next();\n   *\n   *   // Log the currently focused node.\n   *   console.log(virtual.activeNode);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @returns {Node|null}\n   */\n  get activeNode() {\n    return this.#activeNode?.node ?? null;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-commands)\n   *\n   * Getter for all Virtual Screen Reader commands.\n   *\n   * Use with the `await virtual.perform(command)` command to invoke an action:\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next landmark.\n   *   await virtual.perform(virtual.commands.moveToNextLandmark);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  get commands() {\n    return Object.fromEntries<keyof VirtualCommands>(\n      (Object.keys(commands) as (keyof VirtualCommands)[]).map(\n        (command: keyof VirtualCommands) => [command, command]\n      )\n    ) as { [K in keyof VirtualCommands]: K };\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-detect)\n   *\n   * Detect whether the screen reader is supported for the current OS:\n   *\n   * - `true` for all OS\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   const isVirtualSupportedScreenReader = await virtual.detect();\n   *\n   *   console.log(isVirtualSupportedScreenReader);\n   * });\n   * ```\n   *\n   * @returns {Promise<boolean>}\n   */\n  async detect() {\n    return true;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-default)\n   *\n   * Detect whether the screen reader is the default screen reader for the current OS.\n   *\n   * - `false` for all OS\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   const isVirtualDefaultScreenReader = await virtual.default();\n   *\n   *   console.log(isVirtualDefaultScreenReader);\n   * });\n   * ```\n   *\n   * @returns {Promise<boolean>}\n   */\n  async default() {\n    return false;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-start)\n   *\n   * Turn the Virtual Screen Reader on.\n   *\n   * This must be called before any other Virtual command can be issued.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader on the entire page.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // ... perform some commands.\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @param {object} [options] Additional options.\n   */\n  // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n  // @ts-ignore for non-TS users we default the container to `null` which\n  // prompts the missing container error.\n  async start(\n    { container, displayCursor = false, window: root }: StartOptions = {\n      container: null as never,\n      displayCursor: false,\n    }\n  ) {\n    if (!container) {\n      throw new Error(ERR_VIRTUAL_MISSING_CONTAINER);\n    }\n\n    if (!root && typeof window !== \"undefined\") {\n      root = window;\n    }\n\n    this.#container = container;\n\n    if (displayCursor) {\n      this.#createCursor(root);\n    }\n\n    this.#disconnectDOMObserver = observeDOM(\n      root,\n      container,\n      (mutations: MutationRecord[]) => {\n        this.#invalidateTreeCache();\n        this.#announceLiveRegions(mutations);\n      }\n    );\n\n    const tree = this.#getAccessibilityTree();\n\n    if (!tree.length) {\n      return;\n    }\n\n    this.#boundHandleFocusChange = this.#handleFocusChange.bind(this);\n\n    this.#container.addEventListener(\"focusin\", this.#boundHandleFocusChange);\n\n    this.#updateState(tree[0]);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-stop)\n   *\n   * Turn the Virtual Screen Reader off.\n   *\n   * Calling this method will clear any item text or spoken phrases collected by Virtual.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // ... perform some commands.\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async stop() {\n    this.#disconnectDOMObserver?.();\n    this.#container?.removeEventListener(\"focusin\", this.#boundHandleFocusChange);\n    this.#invalidateTreeCache();\n\n    if (this.#cursor) {\n      this.#container?.removeChild(this.#cursor);\n      this.#cursor = null;\n    }\n\n    this.#activeNode = null;\n    this.#container = null;\n    this.#itemTextLog = [];\n    this.#spokenPhraseLog = [];\n    this.#boundHandleFocusChange = null;\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-previous)\n   *\n   * Move the screen reader cursor to the previous location.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the previous item.\n   *   await virtual.previous();\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async previous() {\n    this.#checkContainer();\n    await tick();\n\n    const tree = this.#getModalAccessibilityTree();\n\n    if (!tree.length) {\n      return;\n    }\n\n    const currentIndex = this.#getCurrentIndex(tree);\n    const nextIndex = currentIndex === -1 ? 0 : currentIndex - 1;\n    // We've covered the tree having no length so there must be at least one\n    // index, and we ensure to zero-guard with the logic above.\n\n    const newActiveNode = tree.at(nextIndex)!;\n\n    this.#updateState(newActiveNode);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-next)\n   *\n   * Move the screen reader cursor to the next location.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the next item.\n   *   await virtual.next();\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async next() {\n    this.#checkContainer();\n    await tick();\n\n    const tree = this.#getModalAccessibilityTree();\n\n    if (!tree.length) {\n      return;\n    }\n\n    const currentIndex = this.#getCurrentIndex(tree);\n    const nextIndex =\n      currentIndex === -1 || currentIndex === tree.length - 1\n        ? 0\n        : currentIndex + 1;\n    // We've covered the tree having no length so there must be at least one\n    // index, and we ensure to zero-guard with the logic above.\n\n    const newActiveNode = tree.at(nextIndex)!;\n\n    this.#updateState(newActiveNode);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-act)\n   *\n   * Perform the default action for the item in the Virtual Screen Reader cursor.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the next item.\n   *   await virtual.next();\n   *\n   *   // Perform the default action for the item.\n   *   await virtual.act();\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async act() {\n    this.#checkContainer();\n    await tick();\n\n    if (!this.#activeNode) {\n      return;\n    }\n\n    const target = getElementNode(this.#activeNode);\n\n    /**\n     * The user agent SHOULD simulate a click on the DOM element which is\n     * mapped to that accessible object.\n     *\n     * REF: https://www.w3.org/TR/core-aam-1.2/#mapping_actions\n     */\n    await userEvent.click(target, defaultUserEventOptions);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-interact)\n   *\n   * No-op to provide same API across screen readers.\n   *\n   * The Virtual Screen Reader does not require users to perform an additional\n   * command to interact with the item in the Virtual Screen Reader cursor.\n   */\n  async interact() {\n    this.#checkContainer();\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-stop-interacting)\n   *\n   * No-op to provide same API across screen readers.\n   *\n   * The Virtual Screen Reader does not require users to perform an additional\n   * command to interact with the item in the Virtual Screen Reader cursor.\n   */\n  async stopInteracting() {\n    this.#checkContainer();\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-press)\n   *\n   * Press a key on the active item.\n   *\n   * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\n   * value or a single character to generate the text for. A superset of the `key` values can be found\n   * [on the MDN key values page](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n   *\n   * `F1` - `F20`, `Digit0` - `Digit9`, `KeyA` - `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n   * `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n   *\n   * Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta` (OS permitting).\n   *\n   * Holding down `Shift` will type the text that corresponds to the `key` in the upper case.\n   *\n   * If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\n   * texts.\n   *\n   * Shortcuts such as `key: \"Control+f\"` or `key: \"Control+Shift+f\"` are supported as well. When specified with the\n   * modifier, modifier is pressed and being held while the subsequent key is being pressed.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Open a find text modal.\n   *   await virtual.press(\"Command+f\");\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @param {string} key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.\n   */\n  async press(key: string) {\n    this.#checkContainer();\n    await tick();\n\n    if (!this.#activeNode) {\n      return;\n    }\n\n    const rawKeys = key.replace(/{/g, \"{{\").replace(/\\[/g, \"[[\").split(\"+\");\n    const modifiers: string[] = [];\n    const keys: string[] = [];\n\n    rawKeys.forEach((rawKey) => {\n      if (\n        typeof MacOSModifiers[rawKey] !== \"undefined\" ||\n        typeof WindowsModifiers[rawKey] !== \"undefined\"\n      ) {\n        modifiers.push(rawKey);\n      } else {\n        keys.push(rawKey);\n      }\n    });\n\n    const keyboardCommand = [\n      ...modifiers.map((modifier) => `{${modifier}>}`),\n      ...keys.map((key) => `{${key}}`),\n      ...modifiers.reverse().map((modifier) => `{/${modifier}}`),\n    ].join(\"\");\n\n    this.#focusActiveElement();\n    await userEvent.keyboard(keyboardCommand, defaultUserEventOptions);\n    await this.#refreshState(true);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-type)\n   *\n   * Type text into the active item.\n   *\n   * To press a special key, like `Control` or `ArrowDown`, use `virtual.press(key)`.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Type a username and key Enter.\n   *   await virtual.type(\"my-username\");\n   *   await virtual.press(\"Enter\");\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @param {string} text Text to type into the active item.\n   */\n  async type(text: string) {\n    this.#checkContainer();\n    await tick();\n\n    if (!this.#activeNode) {\n      return;\n    }\n\n    const target = getElementNode(this.#activeNode);\n    await userEvent.type(target, text, defaultUserEventOptions);\n    await this.#refreshState(true);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-perform)\n   *\n   * Perform a Virtual Screen Reader command.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Perform action to move to the next landmark.\n   *   await virtual.perform(virtual.commands.moveToNextLandmark);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @param {string} command Screen reader command.\n   * @param {object} [options] Command options.\n   */\n  async perform<\n    T extends keyof VirtualCommands,\n    K extends Omit<Parameters<VirtualCommands[T]>[0], keyof VirtualCommandArgs>\n  >(command: T, options?: { [L in keyof K]: K[L] }) {\n    this.#checkContainer();\n    await tick();\n\n    const tree = this.#getModalAccessibilityTree();\n\n    if (!tree.length) {\n      return;\n    }\n\n    const currentIndex = this.#getCurrentIndex(tree);\n    const nextIndex = commands[command]?.({\n      ...options,\n      // `this.#checkContainer();` above null guards us here.\n\n      container: this.#container!,\n      currentIndex,\n      tree,\n    });\n\n    if (typeof nextIndex !== \"number\") {\n      return;\n    }\n\n    // We know the tree has length, and we guard against the command not being\n    // able to find an index in the tree so we are fine.\n\n    const newActiveNode = tree.at(nextIndex)!;\n    this.#updateState(newActiveNode);\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-click)\n   *\n   * Click the mouse.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Left-click the mouse.\n   *   await virtual.click();\n   *\n   *   // Left-click the mouse using specific options.\n   *   await virtual.click({ button: \"left\", clickCount: 1 });\n   *\n   *   // Double-right-click the mouse.\n   *   await virtual.click({ button: \"right\", clickCount: 2 });\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @param {object} [options] Click options.\n   */\n  async click({ button = \"left\", clickCount = 1 } = {}) {\n    this.#checkContainer();\n    await tick();\n\n    if (!this.#activeNode) {\n      return;\n    }\n\n    const key = `[Mouse${button[0].toUpperCase()}${button.slice(1)}]`;\n    const keys = key.repeat(clickCount);\n    const target = getElementNode(this.#activeNode);\n\n    await userEvent.pointer(\n      [{ target }, { keys, target }],\n      defaultUserEventOptions\n    );\n\n    return;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-last-spoken-phrase)\n   *\n   * Get the last spoken phrase.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the next item.\n   *   await virtual.next();\n   *\n   *   // Get the phrase spoken by the Virtual Screen Reader from moving to the next item above.\n   *   const lastSpokenPhrase = await virtual.lastSpokenPhrase();\n   *   console.log(lastSpokenPhrase);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @returns {Promise<string>} The last spoken phrase.\n   */\n  async lastSpokenPhrase() {\n    this.#checkContainer();\n    await tick();\n\n    return this.#spokenPhraseLog.at(-1) ?? \"\";\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-item-text)\n   *\n   * Get the text of the item in the Virtual Screen Reader cursor.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move to the next item.\n   *   await virtual.next();\n   *\n   *   // Get the text (if any) for the item currently in focus by the Virtual\n   *   // screen reader cursor.\n   *   const itemText = await virtual.itemText();\n   *   console.log(itemText);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @returns {Promise<string>} The item's text.\n   */\n  async itemText() {\n    this.#checkContainer();\n    await tick();\n\n    return this.#itemTextLog.at(-1) ?? \"\";\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-spoken-phrase-log)\n   *\n   * Get the log of all spoken phrases for this Virtual Screen Reader instance.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move through several items.\n   *   for (let i = 0; i < 10; i++) {\n   *     await virtual.next();\n   *   }\n   *\n   *   // Get the phrase spoken by the Virtual Screen Reader from moving through the\n   *   // items above.\n   *   const spokenPhraseLog = await virtual.spokenPhraseLog();\n   *   console.log(spokenPhraseLog);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @returns {Promise<string[]>} The spoken phrase log.\n   */\n  async spokenPhraseLog() {\n    this.#checkContainer();\n\n    await tick();\n\n    return this.#spokenPhraseLog;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-item-text-log)\n   *\n   * Get the log of all visited item text for this Virtual Screen Reader instance.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // Move through several items.\n   *   for (let i = 0; i < 10; i++) {\n   *     await virtual.next();\n   *   }\n   *\n   *   // Get the text (if any) for all the items visited by the Virtual screen\n   *   // reader cursor.\n   *   const itemTextLog = await virtual.itemTextLog();\n   *   console.log(itemTextLog);\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   *\n   * @returns {Promise<string[]>} The item text log.\n   */\n  async itemTextLog() {\n    this.#checkContainer();\n\n    await tick();\n\n    return this.#itemTextLog;\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-clear-spoken-phrase-log)\n   *\n   * Clear the log of all spoken phrases for this Virtual Screen Reader\n   * instance.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // ... perform some commands.\n   *\n   *   // Clear the spoken phrase log.\n   *   await virtual.clearSpokenPhraseLog();\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async clearSpokenPhraseLog() {\n    this.#checkContainer();\n\n    await tick();\n\n    this.#spokenPhraseLog = [];\n  }\n\n  /**\n   * [API Reference](https://www.guidepup.dev/docs/api/class-virtual#virtual-clear-item-text-log)\n   *\n   * Clear the log of all visited item text for this Virtual Screen Reader\n   * instance.\n   *\n   * ```ts\n   * import { virtual } from \"@guidepup/virtual-screen-reader\";\n   *\n   * test(\"example test\", async () => {\n   *   // Start the Virtual Screen Reader.\n   *   await virtual.start({ container: document.body });\n   *\n   *   // ... perform some commands.\n   *\n   *   // Clear the item text log.\n   *   await virtual.clearItemTextLog();\n   *\n   *   // Stop the Virtual Screen Reader.\n   *   await virtual.stop();\n   * });\n   * ```\n   */\n  async clearItemTextLog() {\n    this.#checkContainer();\n\n    await tick();\n\n    this.#itemTextLog = [];\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AACF,GAGG;AACD,UAAQ,KAAK,aAAa,aAAa,KAAK,IACzC,KAAK,EACL,MAAM,GAAG,EACT,OAAO,OAAO;AACnB;;;ACXA,IAAAA,oBAAgC;;;ACAhC,uBAAgE;;;ACAzD,IAAM,eAAe,CAAC,YAC3B,QAAQ,aAAa,QAAQ,QAAQ,YAAY;;;ACDnD,IAAM,eAAe;AAEd,SAAS,UAAU,MAAiC;AACzD,SAAO,KAAK,aAAa;AAC3B;;;AFAO,IAAM,oBAAoB,oBAAI,IAAI,CAAC,gBAAgB,MAAM,CAAC;AAE1D,IAAM,kBAA0C;AAAA,EACrD,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AACb;AAEA,IAAM,0BAA0B,IAAI,IAAI,0BAAS;AAEjD,IAAM,qBAAqB,oBAAI,IAAI,CAAC,QAAQ,QAAQ,CAAC;AAE9C,IAAM,4BAA4B;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AA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAM,uBAAuB;AAC3B,SAAK,gBAAgB;AAErB,UAAM,KAAK;AAEX,SAAK,mBAAmB,CAAC;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAM,mBAAmB;AACvB,SAAK,gBAAgB;AAErB,UAAM,KAAK;AAEX,SAAK,eAAe,CAAC;AAAA,EACvB;AACF;;;A7C3oCO,IAAM,UAAU,IAAI,QAAQ;","names":["import_html_aria","getHtmlAriaRole","import_dom_accessibility_api","string","idRef","idRefs","idRef","roles","import_html_aria","idRef","TEXT_NODE","idRefs","idRef","TEXT_NODE","token","spokenPhrase","itemText","key"]}