import { jsx as e } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as u, useModuleSkeleton as p } from "@m4l/core";
import c from "../../hooks/useSideBar/index.js";
import { useComponentSize as f } from "../../../../hooks/useComponentSize/index.js";
import { TEST_PROP_ID as S } from "../../../../test/constants_no_mock.js";
import { getNameDataTestId as b } from "../../tests/utils.js";
import { ContainerTreeGroupItemsStyled as I, ContainerContentGroupsStyled as h, ContainerContentTitleStyled as C } from "../../slots/SideBarSlots.js";
import { NodeMenuItemMain as D } from "./subcomponents/NodeMenuItemMain/NodeMenuItemMain.js";
import { MenuItem as T } from "../../../extended/mui/MenuItem/MenuItem.js";
const w = (r) => {
  const { menuData: t, anchored: n } = c(), { getLabel: i } = u(), { size: s } = r, { currentSize: m } = f(s), a = p(), l = {
    noItems: t.length === 0,
    anchored: n
  }, d = () => /* @__PURE__ */ e(C, { ownerState: { disabled: !0 }, children: /* @__PURE__ */ e(
    T,
    {
      disabled: !0,
      label: i("sidebar.label_no_items")
    }
  ) });
  return /* @__PURE__ */ e(
    I,
    {
      ownerState: l,
      role: "bodysidebar",
      ...process.env.NODE_ENV !== "production" ? { [S]: b("content-groups") } : {},
      children: t.length > 0 ? t.map((o) => (
        /* Render title section in menusidebar */
        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
          D,
          {
            item: o,
            size: m,
            defaultOpen: !a
          }
        ) }, o.title)
      )) : d()
    }
  );
};
export {
  w as TreeGroupItems
};
