import { createVNode, mergeProps } from "vue";
import { ListGroup } from "./list-group.mjs";
import { ListItem } from "./list-item.mjs";
import { ListSubheader } from "./list-subheader.mjs";
import { provideList } from "./composables/list.mjs";
import { Divider } from "../divider/divider.mjs";
import { genericComponent } from "../../utils/define-component.mjs";
const ListChildren = genericComponent()({
  name: "VeListChildren",
  props: {
    items: Array
  },
  setup(props, {
    slots
  }) {
    provideList();
    return () => {
      var _a, _b, _c;
      return (_c = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _c : (_b = props.items) == null ? void 0 : _b.map(({
        children,
        props: itemProps,
        type
      }, index) => {
        var _a2, _b2;
        switch (type) {
          case "divider":
            return createVNode(Divider, itemProps, null);
          case "subheader":
            return createVNode(ListSubheader, itemProps, slots);
          default:
            return children ? createVNode(ListGroup, {
              "value": itemProps == null ? void 0 : itemProps.value
            }, {
              default: () => createVNode(ListChildren, {
                "items": children
              }, slots),
              activator: ({
                props: activatorProps
              }) => {
                var _a3, _b3;
                return (_b3 = (_a3 = slots.header) == null ? void 0 : _a3.call(slots, {
                  item: itemProps,
                  index,
                  props: activatorProps
                })) != null ? _b3 : createVNode(ListItem, mergeProps(itemProps, activatorProps), null);
              }
            }) : (_b2 = (_a2 = slots.item) == null ? void 0 : _a2.call(slots, {
              item: itemProps,
              index
            })) != null ? _b2 : createVNode(ListItem, itemProps, slots);
        }
      });
    };
  }
});
export {
  ListChildren
};
//# sourceMappingURL=list-children.mjs.map
