import { j as t } from "../../_virtual/jsx-runtime.js";
import { forwardRef as p } from "react";
import g from "../../icons/Close.js";
import { getId as k } from "../../utils/index.js";
import { Button as l } from "../Button/index.js";
import { IconButton as u } from "../IconButton/index.js";
import { Wrapper as I, IconWrapper as b, Container as z, Title as v, Content as w, Actions as B, CloseIcon as M } from "./styles.js";
import { getIcon as R } from "./utils.js";
function S({
  dismissAction: n,
  primaryAction: a,
  variant: r,
  compact: o,
  showClose: d,
  title: s,
  onClose: x,
  children: m,
  className: j,
  componentName: f = "banner",
  ...i
}, C) {
  const h = a || n, c = R(i.icon, r), e = k(i["data-testid"]);
  return /* @__PURE__ */ t.jsxs(
    I,
    {
      variant: r,
      componentName: f,
      className: j,
      role: "alert",
      "data-testid": i["data-testid"],
      "data-trackid": i["data-trackid"],
      ref: C,
      children: [
        c && /* @__PURE__ */ t.jsx(b, { "data-testid": e("icon"), children: c }),
        /* @__PURE__ */ t.jsxs(z, { compact: o, "data-testid": e("container"), children: [
          s && !o && /* @__PURE__ */ t.jsx(v, { "data-testid": e("title"), children: s }),
          /* @__PURE__ */ t.jsx(w, { "data-testid": e("content"), children: m }),
          h && /* @__PURE__ */ t.jsxs(
            B,
            {
              "data-testid": e("actions"),
              compact: o,
              showClose: d,
              children: [
                n && /* @__PURE__ */ t.jsx(
                  l,
                  {
                    variant: "ghost",
                    onClick: n.onClick,
                    size: "xSmall",
                    "data-testid": e("secondary-action"),
                    children: n.label
                  }
                ),
                a && /* @__PURE__ */ t.jsx(
                  l,
                  {
                    variant: "primary",
                    onClick: a.onClick,
                    size: "xSmall",
                    "data-testid": e("primary-action"),
                    children: a.label
                  }
                )
              ]
            }
          )
        ] }),
        d && /* @__PURE__ */ t.jsx(
          M,
          {
            compact: o,
            "data-testid": e("close-icon-wrapper"),
            children: /* @__PURE__ */ t.jsx(
              u,
              {
                icon: /* @__PURE__ */ t.jsx(g, {}),
                size: "medium",
                variant: "ghost-tertiary",
                onClick: x,
                "data-testid": e("close-icon-button")
              }
            )
          }
        )
      ]
    }
  );
}
const H = p(S);
export {
  H as MessagingContent,
  S as MessagingContentComponent
};
