import { jsx as o, Fragment as m } from "@emotion/react/jsx-runtime";
import { useMemo as c } from "react";
import d from "../MemoizedIconButton/MemoizedIconButton.js";
import { ActionsGroup as a } from "../../../ActionsGroup/ActionsGroup.js";
const u = (s) => c(() => /* @__PURE__ */ o(m, { children: s.map((e) => {
  if (e.type === "groupActions") {
    const r = e.actions.map((l) => ({
      id: l.key,
      label: l.label,
      iconUrl: l.iconUrl,
      onClick: l.onClick,
      disabled: l.disabled
    })), i = (l) => {
      const n = e.actions.find((t) => t.key === l);
      n?.onClick && n.onClick();
    };
    return /* @__PURE__ */ o(
      a,
      {
        actions: r,
        value: e.selectedActionKey,
        onChange: i,
        variant: "horizontal",
        className: e.className
      },
      e.key
    );
  }
  return /* @__PURE__ */ o(
    d,
    {
      iconUrl: e.iconUrl,
      label: e.label,
      disabled: e.disabled,
      onClick: e.onClick || (() => {
      }),
      className: e.className,
      tooltipProps: e.tooltipProps
    },
    e.key
  );
}) }), [s]);
export {
  u as useButtonActions
};
