"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("react");
const Icons = require("./Icons/Icons.js");
const useAppState = require("../lib/useAppState.js");
const emotionReactJsxRuntime_browser_esm = require("../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
require("./Tabs.js");
const Button = ({
  onClick,
  link,
  label,
  icon,
  className,
  type,
  onCloseModal,
  Link
}) => {
  const {
    navigate
  } = useAppState.useAppState();
  const toClick = (e) => {
    if (onClick && typeof onClick === "string") {
      if (onClick === "closeModal") {
        return onCloseModal();
      }
      return console.log("onClick string");
    }
    if (link && typeof link === "string")
      return navigate(link) || navigate(-1);
    return onClick && onClick(e);
  };
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("button", {
    type: type || "button",
    onClick: toClick,
    className: "inline-flex items-center px-5 py-3 border-solid text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-600 hover:text-sky-600 hover:border-sky-600 " + className,
    children: [icon && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Icons.Icons, {
      name: icon,
      className: "inline-flex w-5 h-5 mr-1 opacity-95"
    }), label]
  });
};
const Buttons = ({
  data,
  onCloseModal,
  className,
  contentClassName
}) => {
  let mainLayout = [], leftLayout = [], rightLayout = [];
  {
    data.map((item, index) => {
      if (item.layout === "left") {
        leftLayout.push(/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Button, {
          ...item,
          onCloseModal
        }, index));
        return;
      }
      if (item.layout === "right") {
        rightLayout.push(/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Button, {
          ...item,
          onCloseModal
        }, index));
        return;
      }
      mainLayout.push(/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Button, {
        ...item,
        onCloseModal
      }, index));
    });
  }
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    className: `flex mt-6 ${leftLayout.length !== 0 || rightLayout.length !== 0 ? "justify-between" : ""} ${className || ""}`,
    children: [leftLayout && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      children: leftLayout
    }), mainLayout && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: contentClassName || "",
      children: mainLayout
    }), rightLayout && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      children: rightLayout
    })]
  });
};
exports.Button = Button;
exports.Buttons = Buttons;
//# sourceMappingURL=Button.js.map
