1 |
- {"ast":null,"code":"/**\n * implements https://w3c.github.io/accname/\n */\nimport ArrayFrom from \"./polyfills/array.from.mjs\";\nimport SetLike from \"./polyfills/SetLike.mjs\";\nimport { hasAnyConcreteRoles, isElement, isHTMLTableCaptionElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, safeWindow, isHTMLFieldSetElement, isHTMLLegendElement, isHTMLOptGroupElement, isHTMLTableElement, isHTMLSlotElement, isSVGSVGElement, isSVGTitleElement, queryIdRefs, getLocalName } from \"./util.mjs\";\n\n/**\n * A string of characters where all carriage returns, newlines, tabs, and form-feeds are replaced with a single space, and multiple spaces are reduced to a single space. The string contains only character data; it does not contain any markup.\n */\n\n/**\n *\n * @param {string} string -\n * @returns {FlatString} -\n */\nfunction asFlatString(s) {\n return s.trim().replace(/\\s\\s+/g, \" \");\n}\n\n/**\n *\n * @param node -\n * @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName`\n * @returns {boolean} -\n */\nfunction isHidden(node, getComputedStyleImplementation) {\n if (!isElement(node)) {\n return false;\n }\n if (node.hasAttribute(\"hidden\") || node.getAttribute(\"aria-hidden\") === \"true\") {\n return true;\n }\n var style = getComputedStyleImplementation(node);\n return style.getPropertyValue(\"display\") === \"none\" || style.getPropertyValue(\"visibility\") === \"hidden\";\n}\n\n/**\n * @param {Node} node -\n * @returns {boolean} - As defined in step 2E of https://w3c.github.io/accname/#mapping_additional_nd_te\n */\nfunction isControl(node) {\n return hasAnyConcreteRoles(node, [\"button\", \"combobox\", \"listbox\", \"textbox\"]) || hasAbstractRole(node, \"range\");\n}\nfunction hasAbstractRole(node, role) {\n if (!isElement(node)) {\n return false;\n }\n switch (role) {\n case \"range\":\n return hasAnyConcreteRoles(node, [\"meter\", \"progressbar\", \"scrollbar\", \"slider\", \"spinbutton\"]);\n default:\n throw new TypeError(\"No knowledge about abstract role '\".concat(role, \"'. This is likely a bug :(\"));\n }\n}\n\n/**\n * element.querySelectorAll but also considers owned tree\n * @param element\n * @param selectors\n */\nfunction querySelectorAllSubtree(element, selectors) {\n var elements = ArrayFrom(element.querySelectorAll(selectors));\n queryIdRefs(element, \"aria-owns\").forEach(function (root) {\n // babel transpiles this assuming an iterator\n elements.push.apply(elements, ArrayFrom(root.querySelectorAll(selectors)));\n });\n return elements;\n}\nfunction querySelectedOptions(listbox) {\n if (isHTMLSelectElement(listbox)) {\n // IE11 polyfill\n return listbox.selectedOptions || querySelectorAllSubtree(listbox, \"[selected]\");\n }\n return querySelectorAllSubtree(listbox, '[aria-selected=\"true\"]');\n}\nfunction isMarkedPresentational(node) {\n return hasAnyConcreteRoles(node, [\"none\", \"presentation\"]);\n}\n\n/**\n * Elements specifically listed in html-aam\n *\n * We don't need this for `label` or `legend` elements.\n * Their implicit roles already allow \"naming from content\".\n *\n * sources:\n *\n * - https://w3c.github.io/html-aam/#table-element\n */\nfunction isNativeHostLanguageTextAlternativeElement(node) {\n return isHTMLTableCaptionElement(node);\n}\n\n/**\n * https://w3c.github.io/aria/#namefromcontent\n */\nfunction allowsNameFromContent(node) {\n return hasAnyConcreteRoles(node, [\"button\", \"cell\", \"checkbox\", \"columnheader\", \"gridcell\", \"heading\", \"label\", \"legend\", \"link\", \"menuitem\", \"menuitemcheckbox\", \"menuitemradio\", \"option\", \"radio\", \"row\", \"rowheader\", \"switch\", \"tab\", \"tooltip\", \"treeitem\"]);\n}\n\n/**\n * TODO https://github.com/eps1lon/dom-accessibility-api/issues/100\n */\nfunction isDescendantOfNativeHostLanguageTextAlternativeElement(\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet\nnode) {\n return false;\n}\nfunction getValueOfTextbox(element) {\n if (isHTMLInputElement(element) || isHTMLTextAreaElement(element)) {\n return element.value;\n }\n // https://github.com/eps1lon/dom-accessibility-api/issues/4\n return element.textContent || \"\";\n}\nfunction getTextualContent(declaration) {\n var content = declaration.getPropertyValue(\"content\");\n if (/^[\"'].*[\"']$/.test(content)) {\n return content.slice(1, -1);\n }\n return \"\";\n}\n\n/**\n * https://html.spec.whatwg.org/multipage/forms.html#category-label\n * TODO: form-associated custom elements\n * @param element\n */\nfunction isLabelableElement(element) {\n var localName = getLocalName(element);\n return localName === \"button\" || localName === \"input\" && element.getAttribute(\"type\") !== \"hidden\" || localName === \"meter\" || localName === \"output\" || localName === \"progress\" || localName === \"select\" || localName === \"textarea\";\n}\n\n/**\n * > [...], then the first such descendant in tree order is the label element's labeled control.\n * -- https://html.spec.whatwg.org/multipage/forms.html#labeled-control\n * @param element\n */\nfunction findLabelableElement(element) {\n if (isLabelableElement(element)) {\n return element;\n }\n var labelableElement = null;\n element.childNodes.forEach(function (childNode) {\n if (labelableElement === null && isElement(childNode)) {\n var descendantLabelableElement = findLabelableElement(childNode);\n if (descendantLabelableElement !== null) {\n labelableElement = descendantLabelableElement;\n }\n }\n });\n return labelableElement;\n}\n\n/**\n * Polyfill of HTMLLabelElement.control\n * https://html.spec.whatwg.org/multipage/forms.html#labeled-control\n * @param label\n */\nfunction getControlOfLabel(label) {\n if (label.control !== undefined) {\n return label.control;\n }\n var htmlFor = label.getAttribute(\"for\");\n if (htmlFor !== null) {\n return label.ownerDocument.getElementById(htmlFor);\n }\n return findLabelableElement(label);\n}\n\n/**\n * Polyfill of HTMLInputElement.labels\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/labels\n * @param element\n */\nfunction getLabels(element) {\n var labelsProperty = element.labels;\n if (labelsProperty === null) {\n return labelsProperty;\n }\n if (labelsProperty !== undefined) {\n return ArrayFrom(labelsProperty);\n }\n\n // polyfill\n if (!isLabelableElement(element)) {\n return null;\n }\n var document = element.ownerDocument;\n return ArrayFrom(document.querySelectorAll(\"label\")).filter(function (label) {\n return getControlOfLabel(label) === element;\n });\n}\n\n/**\n * Gets the contents of a slot used for computing the accname\n * @param slot\n */\nfunction getSlotContents(slot) {\n // Computing the accessible name for elements containing slots is not\n // currently defined in the spec. This implementation reflects the\n // behavior of NVDA 2020.2/Firefox 81 and iOS VoiceOver/Safari 13.6.\n var assignedNodes = slot.assignedNodes();\n if (assignedNodes.length === 0) {\n // if no nodes are assigned to the slot, it displays the default content\n return ArrayFrom(slot.childNodes);\n }\n return assignedNodes;\n}\n\n/**\n * implements https://w3c.github.io/accname/#mapping_additional_nd_te\n * @param root\n * @param options\n * @returns\n */\nexport function computeTextAlternative(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var consultedNodes = new SetLike();\n var window = safeWindow(root);\n var _options$compute = options.compute,\n compute = _options$compute === void 0 ? \"name\" : _options$compute,\n _options$computedStyl = options.computedStyleSupportsPseudoElements,\n computedStyleSupportsPseudoElements = _options$computedStyl === void 0 ? options.getComputedStyle !== undefined : _options$computedStyl,\n _options$getComputedS = options.getComputedStyle,\n getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS,\n _options$hidden = options.hidden,\n hidden = _options$hidden === void 0 ? false : _options$hidden;\n\n // 2F.i\n function computeMiscTextAlternative(node, context) {\n var accumulatedText = \"\";\n if (isElement(node) && computedStyleSupportsPseudoElements) {\n var pseudoBefore = getComputedStyle(node, \"::before\");\n var beforeContent = getTextualContent(pseudoBefore);\n accumulatedText = \"\".concat(beforeContent, \" \").concat(accumulatedText);\n }\n\n // FIXME: Including aria-owns is not defined in the spec\n // But it is required in the web-platform-test\n var childNodes = isHTMLSlotElement(node) ? getSlotContents(node) : ArrayFrom(node.childNodes).concat(queryIdRefs(node, \"aria-owns\"));\n childNodes.forEach(function (child) {\n var result = computeTextAlternative(child, {\n isEmbeddedInLabel: context.isEmbeddedInLabel,\n isReferenced: false,\n recursion: true\n });\n // TODO: Unclear why display affects delimiter\n // see https://github.com/w3c/accname/issues/3\n var display = isElement(child) ? getComputedStyle(child).getPropertyValue(\"display\") : \"inline\";\n var separator = display !== \"inline\" ? \" \" : \"\";\n // trailing separator for wpt tests\n accumulatedText += \"\".concat(separator).concat(result).concat(separator);\n });\n if (isElement(node) && computedStyleSupportsPseudoElements) {\n var pseudoAfter = getComputedStyle(node, \"::after\");\n var afterContent = getTextualContent(pseudoAfter);\n accumulatedText = \"\".concat(accumulatedText, \" \").concat(afterContent);\n }\n return accumulatedText.trim();\n }\n\n /**\n *\n * @param element\n * @param attributeName\n * @returns A string non-empty string or `null`\n */\n function useAttribute(element, attributeName) {\n var attribute = element.getAttributeNode(attributeName);\n if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== \"\") {\n consultedNodes.add(attribute);\n return attribute.value;\n }\n return null;\n }\n function computeTooltipAttributeValue(node) {\n if (!isElement(node)) {\n return null;\n }\n return useAttribute(node, \"title\");\n }\n function computeElementTextAlternative(node) {\n if (!isElement(node)) {\n return null;\n }\n\n // https://w3c.github.io/html-aam/#fieldset-and-legend-elements\n if (isHTMLFieldSetElement(node)) {\n consultedNodes.add(node);\n var children = ArrayFrom(node.childNodes);\n for (var i = 0; i < children.length; i += 1) {\n var child = children[i];\n if (isHTMLLegendElement(child)) {\n return computeTextAlternative(child, {\n isEmbeddedInLabel: false,\n isReferenced: false,\n recursion: false\n });\n }\n }\n } else if (isHTMLTableElement(node)) {\n // https://w3c.github.io/html-aam/#table-element\n consultedNodes.add(node);\n var _children = ArrayFrom(node.childNodes);\n for (var _i = 0; _i < _children.length; _i += 1) {\n var _child = _children[_i];\n if (isHTMLTableCaptionElement(_child)) {\n return computeTextAlternative(_child, {\n isEmbeddedInLabel: false,\n isReferenced: false,\n recursion: false\n });\n }\n }\n } else if (isSVGSVGElement(node)) {\n // https://www.w3.org/TR/svg-aam-1.0/\n consultedNodes.add(node);\n var _children2 = ArrayFrom(node.childNodes);\n for (var _i2 = 0; _i2 < _children2.length; _i2 += 1) {\n var _child2 = _children2[_i2];\n if (isSVGTitleElement(_child2)) {\n return _child2.textContent;\n }\n }\n return null;\n } else if (getLocalName(node) === \"img\" || getLocalName(node) === \"area\") {\n // https://w3c.github.io/html-aam/#area-element\n // https://w3c.github.io/html-aam/#img-element\n var nameFromAlt = useAttribute(node, \"alt\");\n if (nameFromAlt !== null) {\n return nameFromAlt;\n }\n } else if (isHTMLOptGroupElement(node)) {\n var nameFromLabel = useAttribute(node, \"label\");\n if (nameFromLabel !== null) {\n return nameFromLabel;\n }\n }\n if (isHTMLInputElement(node) && (node.type === \"button\" || node.type === \"submit\" || node.type === \"reset\")) {\n // https://w3c.github.io/html-aam/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-description-computation\n var nameFromValue = useAttribute(node, \"value\");\n if (nameFromValue !== null) {\n return nameFromValue;\n }\n\n // TODO: l10n\n if (node.type === \"submit\") {\n return \"Submit\";\n }\n // TODO: l10n\n if (node.type === \"reset\") {\n return \"Reset\";\n }\n }\n var labels = getLabels(node);\n if (labels !== null && labels.length !== 0) {\n consultedNodes.add(node);\n return ArrayFrom(labels).map(function (element) {\n return computeTextAlternative(element, {\n isEmbeddedInLabel: true,\n isReferenced: false,\n recursion: true\n });\n }).filter(function (label) {\n return label.length > 0;\n }).join(\" \");\n }\n\n // https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation\n // TODO: wpt test consider label elements but html-aam does not mention them\n // We follow existing implementations over spec\n if (isHTMLInputElement(node) && node.type === \"image\") {\n var _nameFromAlt = useAttribute(node, \"alt\");\n if (_nameFromAlt !== null) {\n return _nameFromAlt;\n }\n var nameFromTitle = useAttribute(node, \"title\");\n if (nameFromTitle !== null) {\n return nameFromTitle;\n }\n\n // TODO: l10n\n return \"Submit Query\";\n }\n if (hasAnyConcreteRoles(node, [\"button\"])) {\n // https://www.w3.org/TR/html-aam-1.0/#button-element\n var nameFromSubTree = computeMiscTextAlternative(node, {\n isEmbeddedInLabel: false,\n isReferenced: false\n });\n if (nameFromSubTree !== \"\") {\n return nameFromSubTree;\n }\n }\n return null;\n }\n function computeTextAlternative(current, context) {\n if (consultedNodes.has(current)) {\n return \"\";\n }\n\n // 2A\n if (!hidden && isHidden(current, getComputedStyle) && !context.isReferenced) {\n consultedNodes.add(current);\n return \"\";\n }\n\n // 2B\n var labelAttributeNode = isElement(current) ? current.getAttributeNode(\"aria-labelledby\") : null;\n // TODO: Do we generally need to block query IdRefs of attributes we have already consulted?\n var labelElements = labelAttributeNode !== null && !consultedNodes.has(labelAttributeNode) ? queryIdRefs(current, \"aria-labelledby\") : [];\n if (compute === \"name\" && !context.isReferenced && labelElements.length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Can't be null here otherwise labelElements would be empty\n consultedNodes.add(labelAttributeNode);\n return labelElements.map(function (element) {\n // TODO: Chrome will consider repeated values i.e. use a node multiple times while we'll bail out in computeTextAlternative.\n return computeTextAlternative(element, {\n isEmbeddedInLabel: context.isEmbeddedInLabel,\n isReferenced: true,\n // this isn't recursion as specified, otherwise we would skip\n // `aria-label` in\n // <input id=\"myself\" aria-label=\"foo\" aria-labelledby=\"myself\"\n recursion: false\n });\n }).join(\" \");\n }\n\n // 2C\n // Changed from the spec in anticipation of https://github.com/w3c/accname/issues/64\n // spec says we should only consider skipping if we have a non-empty label\n var skipToStep2E = context.recursion && isControl(current) && compute === \"name\";\n if (!skipToStep2E) {\n var ariaLabel = (isElement(current) && current.getAttribute(\"aria-label\") || \"\").trim();\n if (ariaLabel !== \"\" && compute === \"name\") {\n consultedNodes.add(current);\n return ariaLabel;\n }\n\n // 2D\n if (!isMarkedPresentational(current)) {\n var elementTextAlternative = computeElementTextAlternative(current);\n if (elementTextAlternative !== null) {\n consultedNodes.add(current);\n return elementTextAlternative;\n }\n }\n }\n\n // special casing, cheating to make tests pass\n // https://github.com/w3c/accname/issues/67\n if (hasAnyConcreteRoles(current, [\"menu\"])) {\n consultedNodes.add(current);\n return \"\";\n }\n\n // 2E\n if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {\n if (hasAnyConcreteRoles(current, [\"combobox\", \"listbox\"])) {\n consultedNodes.add(current);\n var selectedOptions = querySelectedOptions(current);\n if (selectedOptions.length === 0) {\n // defined per test `name_heading_combobox`\n return isHTMLInputElement(current) ? current.value : \"\";\n }\n return ArrayFrom(selectedOptions).map(function (selectedOption) {\n return computeTextAlternative(selectedOption, {\n isEmbeddedInLabel: context.isEmbeddedInLabel,\n isReferenced: false,\n recursion: true\n });\n }).join(\" \");\n }\n if (hasAbstractRole(current, \"range\")) {\n consultedNodes.add(current);\n if (current.hasAttribute(\"aria-valuetext\")) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard\n return current.getAttribute(\"aria-valuetext\");\n }\n if (current.hasAttribute(\"aria-valuenow\")) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard\n return current.getAttribute(\"aria-valuenow\");\n }\n // Otherwise, use the value as specified by a host language attribute.\n return current.getAttribute(\"value\") || \"\";\n }\n if (hasAnyConcreteRoles(current, [\"textbox\"])) {\n consultedNodes.add(current);\n return getValueOfTextbox(current);\n }\n }\n\n // 2F: https://w3c.github.io/accname/#step2F\n if (allowsNameFromContent(current) || isElement(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement(current)) {\n var accumulatedText2F = computeMiscTextAlternative(current, {\n isEmbeddedInLabel: context.isEmbeddedInLabel,\n isReferenced: false\n });\n if (accumulatedText2F !== \"\") {\n consultedNodes.add(current);\n return accumulatedText2F;\n }\n }\n if (current.nodeType === current.TEXT_NODE) {\n consultedNodes.add(current);\n return current.textContent || \"\";\n }\n if (context.recursion) {\n consultedNodes.add(current);\n return computeMiscTextAlternative(current, {\n isEmbeddedInLabel: context.isEmbeddedInLabel,\n isReferenced: false\n });\n }\n var tooltipAttributeValue = computeTooltipAttributeValue(current);\n if (tooltipAttributeValue !== null) {\n consultedNodes.add(current);\n return tooltipAttributeValue;\n }\n\n // TODO should this be reachable?\n consultedNodes.add(current);\n return \"\";\n }\n return asFlatString(computeTextAlternative(root, {\n isEmbeddedInLabel: false,\n // by spec computeAccessibleDescription starts with the referenced elements as roots\n isReferenced: compute === \"description\",\n recursion: false\n }));\n}","map":{"version":3,"names":["ArrayFrom","SetLike","hasAnyConcreteRoles","isElement","isHTMLTableCaptionElement","isHTMLInputElement","isHTMLSelectElement","isHTMLTextAreaElement","safeWindow","isHTMLFieldSetElement","isHTMLLegendElement","isHTMLOptGroupElement","isHTMLTableElement","isHTMLSlotElement","isSVGSVGElement","isSVGTitleElement","queryIdRefs","getLocalName","asFlatString","s","trim","replace","isHidden","node","getComputedStyleImplementation","hasAttribute","getAttribute","style","getPropertyValue","isControl","hasAbstractRole","role","TypeError","concat","querySelectorAllSubtree","element","selectors","elements","querySelectorAll","forEach","root","push","apply","querySelectedOptions","listbox","selectedOptions","isMarkedPresentational","isNativeHostLanguageTextAlternativeElement","allowsNameFromContent","isDescendantOfNativeHostLanguageTextAlternativeElement","getValueOfTextbox","value","textContent","getTextualContent","declaration","content","test","slice","isLabelableElement","localName","findLabelableElement","labelableElement","childNodes","childNode","descendantLabelableElement","getControlOfLabel","label","control","undefined","htmlFor","ownerDocument","getElementById","getLabels","labelsProperty","labels","document","filter","getSlotContents","slot","assignedNodes","length","computeTextAlternative","options","arguments","consultedNodes","window","_options$compute","compute","_options$computedStyl","computedStyleSupportsPseudoElements","getComputedStyle","_options$getComputedS","bind","_options$hidden","hidden","computeMiscTextAlternative","context","accumulatedText","pseudoBefore","beforeContent","child","result","isEmbeddedInLabel","isReferenced","recursion","display","separator","pseudoAfter","afterContent","useAttribute","attributeName","attribute","getAttributeNode","has","add","computeTooltipAttributeValue","computeElementTextAlternative","children","i","_children","_i","_child","_children2","_i2","_child2","nameFromAlt","nameFromLabel","type","nameFromValue","map","join","_nameFromAlt","nameFromTitle","nameFromSubTree","current","labelAttributeNode","labelElements","skipToStep2E","ariaLabel","elementTextAlternative","selectedOption","accumulatedText2F","nodeType","TEXT_NODE","tooltipAttributeValue"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/dom-accessibility-api/sources/accessible-name-and-description.ts"],"sourcesContent":["/**\n * implements https://w3c.github.io/accname/\n */\nimport ArrayFrom from \"./polyfills/array.from\";\nimport SetLike from \"./polyfills/SetLike\";\nimport {\n\thasAnyConcreteRoles,\n\tisElement,\n\tisHTMLTableCaptionElement,\n\tisHTMLInputElement,\n\tisHTMLSelectElement,\n\tisHTMLTextAreaElement,\n\tsafeWindow,\n\tisHTMLFieldSetElement,\n\tisHTMLLegendElement,\n\tisHTMLOptGroupElement,\n\tisHTMLTableElement,\n\tisHTMLSlotElement,\n\tisSVGSVGElement,\n\tisSVGTitleElement,\n\tqueryIdRefs,\n\tgetLocalName,\n} from \"./util\";\n\n/**\n * A string of characters where all carriage returns, newlines, tabs, and form-feeds are replaced with a single space, and multiple spaces are reduced to a single space. The string contains only character data; it does not contain any markup.\n */\ntype FlatString = string & {\n\t__flat: true;\n};\n\n/**\n * interface for an options-bag where `window.getComputedStyle` can be mocked\n */\nexport interface ComputeTextAlternativeOptions {\n\tcompute?: \"description\" | \"name\";\n\t/**\n\t * Set to true if window.computedStyle supports the second argument.\n\t * This should be false in JSDOM. Otherwise JSDOM will log console errors.\n\t */\n\tcomputedStyleSupportsPseudoElements?: boolean;\n\t/**\n\t * mock window.getComputedStyle. Needs `content`, `display` and `visibility`\n\t */\n\tgetComputedStyle?: typeof window.getComputedStyle;\n\t/**\n\t * Set to `true` if you want to include hidden elements in the accessible name and description computation.\n\t * Skips 2A in https://w3c.github.io/accname/#computation-steps.\n\t * @default false\n\t */\n\thidden?: boolean;\n}\n\n/**\n *\n * @param {string} string -\n * @returns {FlatString} -\n */\nfunction asFlatString(s: string): FlatString {\n\treturn s.trim().replace(/\\s\\s+/g, \" \") as FlatString;\n}\n\n/**\n *\n * @param node -\n * @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName`\n * @returns {boolean} -\n */\nfunction isHidden(\n\tnode: Node,\n\tgetComputedStyleImplementation: typeof window.getComputedStyle\n): node is Element {\n\tif (!isElement(node)) {\n\t\treturn false;\n\t}\n\n\tif (\n\t\tnode.hasAttribute(\"hidden\") ||\n\t\tnode.getAttribute(\"aria-hidden\") === \"true\"\n\t) {\n\t\treturn true;\n\t}\n\n\tconst style = getComputedStyleImplementation(node);\n\treturn (\n\t\tstyle.getPropertyValue(\"display\") === \"none\" ||\n\t\tstyle.getPropertyValue(\"visibility\") === \"hidden\"\n\t);\n}\n\n/**\n * @param {Node} node -\n * @returns {boolean} - As defined in step 2E of https://w3c.github.io/accname/#mapping_additional_nd_te\n */\nfunction isControl(node: Node): boolean {\n\treturn (\n\t\thasAnyConcreteRoles(node, [\"button\", \"combobox\", \"listbox\", \"textbox\"]) ||\n\t\thasAbstractRole(node, \"range\")\n\t);\n}\n\nfunction hasAbstractRole(node: Node, role: string): node is Element {\n\tif (!isElement(node)) {\n\t\treturn false;\n\t}\n\n\tswitch (role) {\n\t\tcase \"range\":\n\t\t\treturn hasAnyConcreteRoles(node, [\n\t\t\t\t\"meter\",\n\t\t\t\t\"progressbar\",\n\t\t\t\t\"scrollbar\",\n\t\t\t\t\"slider\",\n\t\t\t\t\"spinbutton\",\n\t\t\t]);\n\t\tdefault:\n\t\t\tthrow new TypeError(\n\t\t\t\t`No knowledge about abstract role '${role}'. This is likely a bug :(`\n\t\t\t);\n\t}\n}\n\n/**\n * element.querySelectorAll but also considers owned tree\n * @param element\n * @param selectors\n */\nfunction querySelectorAllSubtree(\n\telement: Element,\n\tselectors: string\n): Element[] {\n\tconst elements = ArrayFrom(element.querySelectorAll(selectors));\n\n\tqueryIdRefs(element, \"aria-owns\").forEach((root) => {\n\t\t// babel transpiles this assuming an iterator\n\t\telements.push.apply(elements, ArrayFrom(root.querySelectorAll(selectors)));\n\t});\n\n\treturn elements;\n}\n\nfunction querySelectedOptions(listbox: Element): ArrayLike<Element> {\n\tif (isHTMLSelectElement(listbox)) {\n\t\t// IE11 polyfill\n\t\treturn (\n\t\t\tlistbox.selectedOptions || querySelectorAllSubtree(listbox, \"[selected]\")\n\t\t);\n\t}\n\treturn querySelectorAllSubtree(listbox, '[aria-selected=\"true\"]');\n}\n\nfunction isMarkedPresentational(node: Node): node is Element {\n\treturn hasAnyConcreteRoles(node, [\"none\", \"presentation\"]);\n}\n\n/**\n * Elements specifically listed in html-aam\n *\n * We don't need this for `label` or `legend` elements.\n * Their implicit roles already allow \"naming from content\".\n *\n * sources:\n *\n * - https://w3c.github.io/html-aam/#table-element\n */\nfunction isNativeHostLanguageTextAlternativeElement(\n\tnode: Node\n): node is Element {\n\treturn isHTMLTableCaptionElement(node);\n}\n\n/**\n * https://w3c.github.io/aria/#namefromcontent\n */\nfunction allowsNameFromContent(node: Node): boolean {\n\treturn hasAnyConcreteRoles(node, [\n\t\t\"button\",\n\t\t\"cell\",\n\t\t\"checkbox\",\n\t\t\"columnheader\",\n\t\t\"gridcell\",\n\t\t\"heading\",\n\t\t\"label\",\n\t\t\"legend\",\n\t\t\"link\",\n\t\t\"menuitem\",\n\t\t\"menuitemcheckbox\",\n\t\t\"menuitemradio\",\n\t\t\"option\",\n\t\t\"radio\",\n\t\t\"row\",\n\t\t\"rowheader\",\n\t\t\"switch\",\n\t\t\"tab\",\n\t\t\"tooltip\",\n\t\t\"treeitem\",\n\t]);\n}\n\n/**\n * TODO https://github.com/eps1lon/dom-accessibility-api/issues/100\n */\nfunction isDescendantOfNativeHostLanguageTextAlternativeElement(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet\n\tnode: Node\n): boolean {\n\treturn false;\n}\n\nfunction getValueOfTextbox(element: Element): string {\n\tif (isHTMLInputElement(element) || isHTMLTextAreaElement(element)) {\n\t\treturn element.value;\n\t}\n\t// https://github.com/eps1lon/dom-accessibility-api/issues/4\n\treturn element.textContent || \"\";\n}\n\nfunction getTextualContent(declaration: CSSStyleDeclaration): string {\n\tconst content = declaration.getPropertyValue(\"content\");\n\tif (/^[\"'].*[\"']$/.test(content)) {\n\t\treturn content.slice(1, -1);\n\t}\n\treturn \"\";\n}\n\n/**\n * https://html.spec.whatwg.org/multipage/forms.html#category-label\n * TODO: form-associated custom elements\n * @param element\n */\nfunction isLabelableElement(element: Element): boolean {\n\tconst localName = getLocalName(element);\n\n\treturn (\n\t\tlocalName === \"button\" ||\n\t\t(localName === \"input\" && element.getAttribute(\"type\") !== \"hidden\") ||\n\t\tlocalName === \"meter\" ||\n\t\tlocalName === \"output\" ||\n\t\tlocalName === \"progress\" ||\n\t\tlocalName === \"select\" ||\n\t\tlocalName === \"textarea\"\n\t);\n}\n\n/**\n * > [...], then the first such descendant in tree order is the label element's labeled control.\n * -- https://html.spec.whatwg.org/multipage/forms.html#labeled-control\n * @param element\n */\nfunction findLabelableElement(element: Element): Element | null {\n\tif (isLabelableElement(element)) {\n\t\treturn element;\n\t}\n\tlet labelableElement: Element | null = null;\n\telement.childNodes.forEach((childNode) => {\n\t\tif (labelableElement === null && isElement(childNode)) {\n\t\t\tconst descendantLabelableElement = findLabelableElement(childNode);\n\t\t\tif (descendantLabelableElement !== null) {\n\t\t\t\tlabelableElement = descendantLabelableElement;\n\t\t\t}\n\t\t}\n\t});\n\n\treturn labelableElement;\n}\n\n/**\n * Polyfill of HTMLLabelElement.control\n * https://html.spec.whatwg.org/multipage/forms.html#labeled-control\n * @param label\n */\nfunction getControlOfLabel(label: HTMLLabelElement): Element | null {\n\tif (label.control !== undefined) {\n\t\treturn label.control;\n\t}\n\n\tconst htmlFor = label.getAttribute(\"for\");\n\tif (htmlFor !== null) {\n\t\treturn label.ownerDocument.getElementById(htmlFor);\n\t}\n\n\treturn findLabelableElement(label);\n}\n\n/**\n * Polyfill of HTMLInputElement.labels\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/labels\n * @param element\n */\nfunction getLabels(element: Element): HTMLLabelElement[] | null {\n\tconst labelsProperty = (element as HTMLInputElement).labels as\n\t\t| HTMLInputElement[\"labels\"]\n\t\t| undefined;\n\n\tif (labelsProperty === null) {\n\t\treturn labelsProperty;\n\t}\n\tif (labelsProperty !== undefined) {\n\t\treturn ArrayFrom(labelsProperty);\n\t}\n\n\t// polyfill\n\tif (!isLabelableElement(element)) {\n\t\treturn null;\n\t}\n\tconst document = element.ownerDocument;\n\n\treturn ArrayFrom(document.querySelectorAll(\"label\")).filter((label) => {\n\t\treturn getControlOfLabel(label) === element;\n\t});\n}\n\n/**\n * Gets the contents of a slot used for computing the accname\n * @param slot\n */\nfunction getSlotContents(slot: HTMLSlotElement): Node[] {\n\t// Computing the accessible name for elements containing slots is not\n\t// currently defined in the spec. This implementation reflects the\n\t// behavior of NVDA 2020.2/Firefox 81 and iOS VoiceOver/Safari 13.6.\n\tconst assignedNodes = slot.assignedNodes();\n\tif (assignedNodes.length === 0) {\n\t\t// if no nodes are assigned to the slot, it displays the default content\n\t\treturn ArrayFrom(slot.childNodes);\n\t}\n\treturn assignedNodes;\n}\n\n/**\n * implements https://w3c.github.io/accname/#mapping_additional_nd_te\n * @param root\n * @param options\n * @returns\n */\nexport function computeTextAlternative(\n\troot: Element,\n\toptions: ComputeTextAlternativeOptions = {}\n): string {\n\tconst consultedNodes = new SetLike<Node>();\n\n\tconst window = safeWindow(root);\n\tconst {\n\t\tcompute = \"name\",\n\t\tcomputedStyleSupportsPseudoElements = options.getComputedStyle !==\n\t\t\tundefined,\n\t\t// This might be overengineered. I don't know what happens if I call\n\t\t// window.getComputedStyle(elementFromAnotherWindow) or if I don't bind it\n\t\t// the type declarations don't require a `this`\n\t\t// eslint-disable-next-line no-restricted-properties\n\t\tgetComputedStyle = window.getComputedStyle.bind(window),\n\t\thidden = false,\n\t} = options;\n\n\t// 2F.i\n\tfunction computeMiscTextAlternative(\n\t\tnode: Node,\n\t\tcontext: { isEmbeddedInLabel: boolean; isReferenced: boolean }\n\t): string {\n\t\tlet accumulatedText = \"\";\n\t\tif (isElement(node) && computedStyleSupportsPseudoElements) {\n\t\t\tconst pseudoBefore = getComputedStyle(node, \"::before\");\n\t\t\tconst beforeContent = getTextualContent(pseudoBefore);\n\t\t\taccumulatedText = `${beforeContent} ${accumulatedText}`;\n\t\t}\n\n\t\t// FIXME: Including aria-owns is not defined in the spec\n\t\t// But it is required in the web-platform-test\n\t\tconst childNodes = isHTMLSlotElement(node)\n\t\t\t? getSlotContents(node)\n\t\t\t: ArrayFrom(node.childNodes).concat(queryIdRefs(node, \"aria-owns\"));\n\t\tchildNodes.forEach((child) => {\n\t\t\tconst result = computeTextAlternative(child, {\n\t\t\t\tisEmbeddedInLabel: context.isEmbeddedInLabel,\n\t\t\t\tisReferenced: false,\n\t\t\t\trecursion: true,\n\t\t\t});\n\t\t\t// TODO: Unclear why display affects delimiter\n\t\t\t// see https://github.com/w3c/accname/issues/3\n\t\t\tconst display = isElement(child)\n\t\t\t\t? getComputedStyle(child).getPropertyValue(\"display\")\n\t\t\t\t: \"inline\";\n\t\t\tconst separator = display !== \"inline\" ? \" \" : \"\";\n\t\t\t// trailing separator for wpt tests\n\t\t\taccumulatedText += `${separator}${result}${separator}`;\n\t\t});\n\n\t\tif (isElement(node) && computedStyleSupportsPseudoElements) {\n\t\t\tconst pseudoAfter = getComputedStyle(node, \"::after\");\n\t\t\tconst afterContent = getTextualContent(pseudoAfter);\n\t\t\taccumulatedText = `${accumulatedText} ${afterContent}`;\n\t\t}\n\n\t\treturn accumulatedText.trim();\n\t}\n\n\t/**\n\t *\n\t * @param element\n\t * @param attributeName\n\t * @returns A string non-empty string or `null`\n\t */\n\tfunction useAttribute(\n\t\telement: Element,\n\t\tattributeName: string\n\t): string | null {\n\t\tconst attribute = element.getAttributeNode(attributeName);\n\t\tif (\n\t\t\tattribute !== null &&\n\t\t\t!consultedNodes.has(attribute) &&\n\t\t\tattribute.value.trim() !== \"\"\n\t\t) {\n\t\t\tconsultedNodes.add(attribute);\n\t\t\treturn attribute.value;\n\t\t}\n\t\treturn null;\n\t}\n\n\tfunction computeTooltipAttributeValue(node: Node): string | null {\n\t\tif (!isElement(node)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn useAttribute(node, \"title\");\n\t}\n\n\tfunction computeElementTextAlternative(node: Node): string | null {\n\t\tif (!isElement(node)) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// https://w3c.github.io/html-aam/#fieldset-and-legend-elements\n\t\tif (isHTMLFieldSetElement(node)) {\n\t\t\tconsultedNodes.add(node);\n\t\t\tconst children = ArrayFrom(node.childNodes);\n\t\t\tfor (let i = 0; i < children.length; i += 1) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (isHTMLLegendElement(child)) {\n\t\t\t\t\treturn computeTextAlternative(child, {\n\t\t\t\t\t\tisEmbeddedInLabel: false,\n\t\t\t\t\t\tisReferenced: false,\n\t\t\t\t\t\trecursion: false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isHTMLTableElement(node)) {\n\t\t\t// https://w3c.github.io/html-aam/#table-element\n\t\t\tconsultedNodes.add(node);\n\t\t\tconst children = ArrayFrom(node.childNodes);\n\t\t\tfor (let i = 0; i < children.length; i += 1) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (isHTMLTableCaptionElement(child)) {\n\t\t\t\t\treturn computeTextAlternative(child, {\n\t\t\t\t\t\tisEmbeddedInLabel: false,\n\t\t\t\t\t\tisReferenced: false,\n\t\t\t\t\t\trecursion: false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isSVGSVGElement(node)) {\n\t\t\t// https://www.w3.org/TR/svg-aam-1.0/\n\t\t\tconsultedNodes.add(node);\n\t\t\tconst children = ArrayFrom(node.childNodes);\n\t\t\tfor (let i = 0; i < children.length; i += 1) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (isSVGTitleElement(child)) {\n\t\t\t\t\treturn child.textContent;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t} else if (getLocalName(node) === \"img\" || getLocalName(node) === \"area\") {\n\t\t\t// https://w3c.github.io/html-aam/#area-element\n\t\t\t// https://w3c.github.io/html-aam/#img-element\n\t\t\tconst nameFromAlt = useAttribute(node, \"alt\");\n\t\t\tif (nameFromAlt !== null) {\n\t\t\t\treturn nameFromAlt;\n\t\t\t}\n\t\t} else if (isHTMLOptGroupElement(node)) {\n\t\t\tconst nameFromLabel = useAttribute(node, \"label\");\n\t\t\tif (nameFromLabel !== null) {\n\t\t\t\treturn nameFromLabel;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tisHTMLInputElement(node) &&\n\t\t\t(node.type === \"button\" ||\n\t\t\t\tnode.type === \"submit\" ||\n\t\t\t\tnode.type === \"reset\")\n\t\t) {\n\t\t\t// https://w3c.github.io/html-aam/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-description-computation\n\t\t\tconst nameFromValue = useAttribute(node, \"value\");\n\t\t\tif (nameFromValue !== null) {\n\t\t\t\treturn nameFromValue;\n\t\t\t}\n\n\t\t\t// TODO: l10n\n\t\t\tif (node.type === \"submit\") {\n\t\t\t\treturn \"Submit\";\n\t\t\t}\n\t\t\t// TODO: l10n\n\t\t\tif (node.type === \"reset\") {\n\t\t\t\treturn \"Reset\";\n\t\t\t}\n\t\t}\n\n\t\tconst labels = getLabels(node);\n\t\tif (labels !== null && labels.length !== 0) {\n\t\t\tconsultedNodes.add(node);\n\t\t\treturn ArrayFrom(labels)\n\t\t\t\t.map((element) => {\n\t\t\t\t\treturn computeTextAlternative(element, {\n\t\t\t\t\t\tisEmbeddedInLabel: true,\n\t\t\t\t\t\tisReferenced: false,\n\t\t\t\t\t\trecursion: true,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.filter((label) => {\n\t\t\t\t\treturn label.length > 0;\n\t\t\t\t})\n\t\t\t\t.join(\" \");\n\t\t}\n\n\t\t// https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation\n\t\t// TODO: wpt test consider label elements but html-aam does not mention them\n\t\t// We follow existing implementations over spec\n\t\tif (isHTMLInputElement(node) && node.type === \"image\") {\n\t\t\tconst nameFromAlt = useAttribute(node, \"alt\");\n\t\t\tif (nameFromAlt !== null) {\n\t\t\t\treturn nameFromAlt;\n\t\t\t}\n\n\t\t\tconst nameFromTitle = useAttribute(node, \"title\");\n\t\t\tif (nameFromTitle !== null) {\n\t\t\t\treturn nameFromTitle;\n\t\t\t}\n\n\t\t\t// TODO: l10n\n\t\t\treturn \"Submit Query\";\n\t\t}\n\n\t\tif (hasAnyConcreteRoles(node, [\"button\"])) {\n\t\t\t// https://www.w3.org/TR/html-aam-1.0/#button-element\n\t\t\tconst nameFromSubTree = computeMiscTextAlternative(node, {\n\t\t\t\tisEmbeddedInLabel: false,\n\t\t\t\tisReferenced: false,\n\t\t\t});\n\t\t\tif (nameFromSubTree !== \"\") {\n\t\t\t\treturn nameFromSubTree;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfunction computeTextAlternative(\n\t\tcurrent: Node,\n\t\tcontext: {\n\t\t\tisEmbeddedInLabel: boolean;\n\t\t\tisReferenced: boolean;\n\t\t\trecursion: boolean;\n\t\t}\n\t): string {\n\t\tif (consultedNodes.has(current)) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\t// 2A\n\t\tif (\n\t\t\t!hidden &&\n\t\t\tisHidden(current, getComputedStyle) &&\n\t\t\t!context.isReferenced\n\t\t) {\n\t\t\tconsultedNodes.add(current);\n\t\t\treturn \"\" as FlatString;\n\t\t}\n\n\t\t// 2B\n\t\tconst labelAttributeNode = isElement(current)\n\t\t\t? current.getAttributeNode(\"aria-labelledby\")\n\t\t\t: null;\n\t\t// TODO: Do we generally need to block query IdRefs of attributes we have already consulted?\n\t\tconst labelElements =\n\t\t\tlabelAttributeNode !== null && !consultedNodes.has(labelAttributeNode)\n\t\t\t\t? queryIdRefs(current, \"aria-labelledby\")\n\t\t\t\t: [];\n\t\tif (\n\t\t\tcompute === \"name\" &&\n\t\t\t!context.isReferenced &&\n\t\t\tlabelElements.length > 0\n\t\t) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Can't be null here otherwise labelElements would be empty\n\t\t\tconsultedNodes.add(labelAttributeNode!);\n\n\t\t\treturn labelElements\n\t\t\t\t.map((element) => {\n\t\t\t\t\t// TODO: Chrome will consider repeated values i.e. use a node multiple times while we'll bail out in computeTextAlternative.\n\t\t\t\t\treturn computeTextAlternative(element, {\n\t\t\t\t\t\tisEmbeddedInLabel: context.isEmbeddedInLabel,\n\t\t\t\t\t\tisReferenced: true,\n\t\t\t\t\t\t// this isn't recursion as specified, otherwise we would skip\n\t\t\t\t\t\t// `aria-label` in\n\t\t\t\t\t\t// <input id=\"myself\" aria-label=\"foo\" aria-labelledby=\"myself\"\n\t\t\t\t\t\trecursion: false,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.join(\" \");\n\t\t}\n\n\t\t// 2C\n\t\t// Changed from the spec in anticipation of https://github.com/w3c/accname/issues/64\n\t\t// spec says we should only consider skipping if we have a non-empty label\n\t\tconst skipToStep2E =\n\t\t\tcontext.recursion && isControl(current) && compute === \"name\";\n\t\tif (!skipToStep2E) {\n\t\t\tconst ariaLabel = (\n\t\t\t\t(isElement(current) && current.getAttribute(\"aria-label\")) ||\n\t\t\t\t\"\"\n\t\t\t).trim();\n\t\t\tif (ariaLabel !== \"\" && compute === \"name\") {\n\t\t\t\tconsultedNodes.add(current);\n\t\t\t\treturn ariaLabel;\n\t\t\t}\n\n\t\t\t// 2D\n\t\t\tif (!isMarkedPresentational(current)) {\n\t\t\t\tconst elementTextAlternative = computeElementTextAlternative(current);\n\t\t\t\tif (elementTextAlternative !== null) {\n\t\t\t\t\tconsultedNodes.add(current);\n\t\t\t\t\treturn elementTextAlternative;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// special casing, cheating to make tests pass\n\t\t// https://github.com/w3c/accname/issues/67\n\t\tif (hasAnyConcreteRoles(current, [\"menu\"])) {\n\t\t\tconsultedNodes.add(current);\n\t\t\treturn \"\";\n\t\t}\n\n\t\t// 2E\n\t\tif (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {\n\t\t\tif (hasAnyConcreteRoles(current, [\"combobox\", \"listbox\"])) {\n\t\t\t\tconsultedNodes.add(current);\n\t\t\t\tconst selectedOptions = querySelectedOptions(current);\n\t\t\t\tif (selectedOptions.length === 0) {\n\t\t\t\t\t// defined per test `name_heading_combobox`\n\t\t\t\t\treturn isHTMLInputElement(current) ? current.value : \"\";\n\t\t\t\t}\n\t\t\t\treturn ArrayFrom(selectedOptions)\n\t\t\t\t\t.map((selectedOption) => {\n\t\t\t\t\t\treturn computeTextAlternative(selectedOption, {\n\t\t\t\t\t\t\tisEmbeddedInLabel: context.isEmbeddedInLabel,\n\t\t\t\t\t\t\tisReferenced: false,\n\t\t\t\t\t\t\trecursion: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t})\n\t\t\t\t\t.join(\" \");\n\t\t\t}\n\t\t\tif (hasAbstractRole(current, \"range\")) {\n\t\t\t\tconsultedNodes.add(current);\n\t\t\t\tif (current.hasAttribute(\"aria-valuetext\")) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard\n\t\t\t\t\treturn current.getAttribute(\"aria-valuetext\")!;\n\t\t\t\t}\n\t\t\t\tif (current.hasAttribute(\"aria-valuenow\")) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard\n\t\t\t\t\treturn current.getAttribute(\"aria-valuenow\")!;\n\t\t\t\t}\n\t\t\t\t// Otherwise, use the value as specified by a host language attribute.\n\t\t\t\treturn current.getAttribute(\"value\") || \"\";\n\t\t\t}\n\t\t\tif (hasAnyConcreteRoles(current, [\"textbox\"])) {\n\t\t\t\tconsultedNodes.add(current);\n\t\t\t\treturn getValueOfTextbox(current);\n\t\t\t}\n\t\t}\n\n\t\t// 2F: https://w3c.github.io/accname/#step2F\n\t\tif (\n\t\t\tallowsNameFromContent(current) ||\n\t\t\t(isElement(current) && context.isReferenced) ||\n\t\t\tisNativeHostLanguageTextAlternativeElement(current) ||\n\t\t\tisDescendantOfNativeHostLanguageTextAlternativeElement(current)\n\t\t) {\n\t\t\tconst accumulatedText2F = computeMiscTextAlternative(current, {\n\t\t\t\tisEmbeddedInLabel: context.isEmbeddedInLabel,\n\t\t\t\tisReferenced: false,\n\t\t\t});\n\t\t\tif (accumulatedText2F !== \"\") {\n\t\t\t\tconsultedNodes.add(current);\n\t\t\t\treturn accumulatedText2F;\n\t\t\t}\n\t\t}\n\n\t\tif (current.nodeType === current.TEXT_NODE) {\n\t\t\tconsultedNodes.add(current);\n\t\t\treturn current.textContent || \"\";\n\t\t}\n\n\t\tif (context.recursion) {\n\t\t\tconsultedNodes.add(current);\n\t\t\treturn computeMiscTextAlternative(current, {\n\t\t\t\tisEmbeddedInLabel: context.isEmbeddedInLabel,\n\t\t\t\tisReferenced: false,\n\t\t\t});\n\t\t}\n\n\t\tconst tooltipAttributeValue = computeTooltipAttributeValue(current);\n\t\tif (tooltipAttributeValue !== null) {\n\t\t\tconsultedNodes.add(current);\n\t\t\treturn tooltipAttributeValue;\n\t\t}\n\n\t\t// TODO should this be reachable?\n\t\tconsultedNodes.add(current);\n\t\treturn \"\";\n\t}\n\n\treturn asFlatString(\n\t\tcomputeTextAlternative(root, {\n\t\t\tisEmbeddedInLabel: false,\n\t\t\t// by spec computeAccessibleDescription starts with the referenced elements as roots\n\t\t\tisReferenced: compute === \"description\",\n\t\t\trecursion: false,\n\t\t})\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,4BAAwB;AAC9C,OAAOC,OAAO,MAAM,yBAAqB;AACzC,SACCC,mBAAmB,EACnBC,SAAS,EACTC,yBAAyB,EACzBC,kBAAkB,EAClBC,mBAAmB,EACnBC,qBAAqB,EACrBC,UAAU,EACVC,qBAAqB,EACrBC,mBAAmB,EACnBC,qBAAqB,EACrBC,kBAAkB,EAClBC,iBAAiB,EACjBC,eAAe,EACfC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,QACN,YAAQ;;AAEf;AACA;AACA;;AA2BA;AACA;AACA;AACA;AACA;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