import a from "../../../@babel/runtime/helpers/esm/toConsumableArray.mjs";
import f from "./isVisible.mjs";
function n(r) {
  var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
  if (f(r)) {
    var t = r.nodeName.toLowerCase(), u = (
      // Focusable element
      ["input", "select", "textarea", "button"].includes(t) || // Editable element
      r.isContentEditable || // Anchor with href element
      t === "a" && !!r.getAttribute("href")
    ), l = r.getAttribute("tabindex"), s = Number(l), e = null;
    return l && !Number.isNaN(s) ? e = s : u && e === null && (e = 0), u && r.disabled && (e = null), e !== null && (e >= 0 || i && e < 0);
  }
  return !1;
}
function m(r) {
  var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, t = a(r.querySelectorAll("*")).filter(function(u) {
    return n(u, i);
  });
  return n(r, i) && t.unshift(r), t;
}
export {
  m as getFocusNodeList
};
