import { ar as c } from "./index.B_XvPxIW.js"; const m = (t, r) => { switch (t.nodeType) { case Node.ELEMENT_NODE: return u(t, r); case Node.TEXT_NODE: return (t.textContent || "").trim(); } return ""; }, o = [ "button", "cell", "checkbox", "columnheader", "gridcell", "heading", "link", "menuitem", // TODO: (content contained in a child menu element is excluded.) "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem" // TODO: (content included in a child group element is excluded.) ], u = (t, r) => { let e; return ["NOSCRIPT", "SCRIPT", "STYLE"].includes(t.tagName) ? "" : !(r != null && r.recurByLabelledBy) && (e = l(t), e !== "") || (e = s(t), e !== "") || (e = f(t), e !== "") || (e = b(t, r == null ? void 0 : r.recurByChildren), e !== "") || (e = d(t), e !== "") ? e : ""; }, l = (t) => { const r = t.getAttribute("aria-labelledby"); if (!r) return ""; const e = document.getElementById(r); return e ? u(e, { recurByLabelledBy: !0 }) : ""; }, s = (t) => t.getAttribute("aria-label") || "", f = (t) => { var r, e, n; if (t.tagName === "INPUT") { const a = t.getAttribute("type") || ""; if (["reset", "submit", "button"].includes(a)) return t.getAttribute("value") || ""; if (a === "image") return t.getAttribute("alt") || ""; const i = document.querySelector(`label[for="${t.id}"]`); if (i) return i.textContent || ""; } return t.tagName === "IMG" || t.tagName === "AREA" ? t.getAttribute("alt") || "" : t.tagName === "FIELDSET" ? ((r = t.querySelector("legend")) == null ? void 0 : r.textContent) || "" : t.tagName === "FIGURE" ? ((e = t.querySelector("figcaption")) == null ? void 0 : e.textContent) || "" : t.tagName === "TABLE" && ((n = t.querySelector("caption")) == null ? void 0 : n.textContent) || ""; }, b = (t, r = !1) => { if (!r) { const n = c(t) || ""; if (!o.includes(n)) return ""; } let e = ""; for (const n of t.childNodes) e += m(n, { recurByChildren: !0 }); return e; }, d = (t) => { if (t.tagName === "INPUT") { const r = t.getAttribute("type") || ""; if (["text", "tel", "password", "search", "url"].includes(r)) return t.title || t.getAttribute("placeholder") || ""; if (r === "submit") return "submit"; if (r === "reset") return "reset"; if (r === "image") return t.title || "Submit Query"; } return t.tagName === "TEXTAREA" ? t.title || t.getAttribute("placeholder") || "" : t.tagName === "SUMMARY" ? "Details" : t.title || ""; }; export { o as N, m as c };