import { jsxs as e, jsx as o } from "react/jsx-runtime";
import v from "react";
import { noop as B } from "es-toolkit/function";
import x from "../button/Button.js";
import { getTrackingLabelFromNode as k } from "../../utils/analytics/getTrackingLabelFromNode.js";
import i from "../../utils/classNames.js";
import { useDialogContext as w } from "./dialogContext.js";
const H = (n) => {
  const { title: t, subtitle: s, headerButtons: l, onCloseButtonClick: c = B, ...m } = n, { onClose: h, isSmallestDialog: a, showXsDialogBorders: u, showCloseButton: g } = w(), r = a ? u : !0, p = a ? !1 : g, b = i("modal-header", !r && "border-bottom-none"), C = i(
    "modal-header-text",
    !r && "padding-bottom-0 width-100pct"
  ), d = k(t), N = (f) => {
    c(), h(f);
  };
  return /* @__PURE__ */ e("div", { ...m, className: b, "aria-label": "dialog header", children: [
    /* @__PURE__ */ e("div", { className: C, children: [
      s && /* @__PURE__ */ o("div", { className: "modal-header-subtitle", children: s }),
      /* @__PURE__ */ o("div", { className: "modal-header-title", children: t })
    ] }),
    /* @__PURE__ */ e("div", { className: "modal-header-buttons", children: [
      l && !a && /* @__PURE__ */ e(v.Fragment, { children: [
        l,
        /* @__PURE__ */ o("div", { className: "modal-header-buttons-spacer" })
      ] }),
      p && /* @__PURE__ */ o(
        x,
        {
          bsStyle: "muted",
          iconOnly: !0,
          iconName: "rioglyph-remove",
          autoTrackingKey: d && `dialog::closed::${d}`,
          className: "modal-header-close close",
          onClick: N,
          "data-testid": "close",
          "aria-label": "dialog close button"
        }
      )
    ] })
  ] });
};
export {
  H as default
};
//# sourceMappingURL=DialogHeader.js.map
