import { jsx as t, jsxs as p } from "react/jsx-runtime";
/* empty css                       */
import { justifyContentEnd as b, justifyContentCenter as w, justifyContentBetween as B, justifyContentStart as R } from "./index-general.module.js";
import { classNames as y } from "./index-classNames.js";
import { AnimatedConditional as C } from "./index-AnimatedConditional.js";
import { Popover as x } from "./index-Popover.js";
import { Render as L } from "./index-Render.js";
import "react";
import { Button as s, ButtonTypes as i } from "./index-Button.js";
import { ComponentContainer as M } from "./index-ComponentContainer.js";
const H = (N) => {
  const {
    positive: e,
    negative: n,
    neutral: o,
    className: P,
    buttonsPosition: g,
    padding: k,
    buttonsShape: d = "default",
    children: r,
    showTopBorder: j
  } = N;
  let c = "";
  switch (g) {
    case "start":
      c = R;
      break;
    case "end":
      c = b;
      break;
    case "between":
      c = B;
      break;
    case "center":
      c = w;
      break;
    default:
      c = b;
  }
  const a = (e == null ? void 0 : e.iconPlacement) ?? "right", m = (n == null ? void 0 : n.iconPlacement) ?? "left", l = (o == null ? void 0 : o.iconPlacement) ?? "left", f = !!e, I = !!n && !(n != null && n.hidden), h = !!o && !(o != null && o.hidden);
  return t(M, {
    style: {
      padding: k ?? "16px 32px 32px 32px"
    },
    className: y("modal-footer", j ? "modal-footer-border" : "", P),
    children: r || p("div", {
      className: y("modal-footer-buttons", c),
      children: [t(C, {
        animation: "none",
        condition: I,
        children: t(s, {
          type: (n == null ? void 0 : n.type) ?? i.default,
          testId: "modal-negative-cta",
          iconLeft: m === "left" ? n == null ? void 0 : n.icon : void 0,
          iconRight: m === "right" ? n == null ? void 0 : n.icon : void 0,
          disabled: n == null ? void 0 : n.disabled,
          isLoading: n == null ? void 0 : n.isLoading,
          className: "right-btn",
          onClick: () => {
            n == null || n.cta();
          },
          shape: d,
          replacements: n == null ? void 0 : n.replacements,
          children: n == null ? void 0 : n.text
        })
      }), p(L, {
        className: "modal-footer-group",
        if: h || f,
        children: [t(L, {
          if: h,
          children: t(x, {
            position: "right",
            message: o == null ? void 0 : o.popoverMessage,
            children: t(s, {
              type: (o == null ? void 0 : o.type) ?? i.secondary,
              testId: "modal-negative-cta",
              iconLeft: l === "left" ? o == null ? void 0 : o.icon : void 0,
              iconRight: l === "right" ? o == null ? void 0 : o.icon : void 0,
              disabled: o == null ? void 0 : o.disabled,
              isLoading: o == null ? void 0 : o.isLoading,
              className: "center-btn",
              onClick: () => {
                o == null || o.cta();
              },
              shape: d,
              replacements: o == null ? void 0 : o.replacements,
              children: o == null ? void 0 : o.text
            })
          })
        }), t(C, {
          animation: "none",
          condition: f,
          children: t(x, {
            position: "right",
            message: e == null ? void 0 : e.popoverMessage,
            children: t(s, {
              type: (e == null ? void 0 : e.type) ?? i.primary,
              testId: "modal-positive-cta",
              iconLeft: a === "left" ? e == null ? void 0 : e.icon : void 0,
              iconRight: a === "right" ? e == null ? void 0 : e.icon : void 0,
              disabled: e == null ? void 0 : e.disabled,
              isLoading: e == null ? void 0 : e.isLoading,
              onClick: () => {
                e == null || e.cta();
              },
              shape: d,
              replacements: e == null ? void 0 : e.replacements,
              children: e == null ? void 0 : e.text
            })
          })
        })]
      })]
    })
  });
};
export {
  H as ModalFooter
};
