const a = (r, t) => {
  const l = (n) => {
    if (!n || n === t)
      return null;
    if (n.getAttribute("role") === "group") {
      const e = n.previousElementSibling;
      if (e instanceof HTMLElement && e.getAttribute("role") === "treeitem")
        return e;
    }
    return l(n.parentElement);
  };
  return l(r.parentElement);
}, c = (r) => {
  const t = r.nextElementSibling;
  return (t == null ? void 0 : t.getAttribute("role")) === "group" ? t.querySelector('[role="treeitem"]') : null;
}, s = (r, t) => {
  const l = (n) => {
    if (!n || n === t)
      return !1;
    if (n.getAttribute("role") === "group") {
      const e = n.previousElementSibling;
      if ((e == null ? void 0 : e.getAttribute("aria-expanded")) === "false")
        return !0;
    }
    return l(n.parentElement);
  };
  return l(r.parentElement);
}, f = (r) => Array.from(
  r.querySelectorAll('[role="treeitem"]')
).filter((t) => !s(t, r)), m = (r) => 6 + (r - 1) * 22, g = (r) => {
  const t = r.querySelector("[title]");
  return (t == null ? void 0 : t.textContent) ?? r.textContent ?? null;
}, b = (r, t) => {
  const l = (e) => !e || e === t ? null : e.getAttribute("role") === "group" || e.getAttribute("role") === "tree" ? e : l(e.parentElement), n = l(r.parentElement) ?? t;
  return Array.from(n.children).flatMap((e) => {
    const o = e.querySelector(
      ':scope > [role="treeitem"][aria-expanded]'
    ), i = e instanceof HTMLElement && e.getAttribute("role") === "treeitem" && e.hasAttribute("aria-expanded") ? e : null;
    return [o, i].filter((u) => u !== null);
  });
}, d = (r, t) => {
  r.querySelectorAll('[role="treeitem"]').forEach((n) => {
    n.setAttribute("tabindex", n === t ? "0" : "-1");
  });
};
export {
  m as calculatePaddingLeft,
  c as getFirstChildTreeItem,
  a as getParentTreeItem,
  b as getSiblingFolders,
  g as getTreeItemLabel,
  f as getVisibleTreeItems,
  d as updateRovingTabindex
};
