import O from "../../../@ant-design/icons/es/icons/ExclamationCircleFilled.mjs";
import P from "../../../classnames/index.mjs";
import * as t from "react";
import N from "../_util/ActionButton.mjs";
import { getRenderPropValue as x } from "../_util/getRenderPropValue.mjs";
import h from "../button/button.mjs";
import { convertLegacyProps as j } from "../button/buttonHelpers.mjs";
import "../config-provider/index.mjs";
import T from "../locale/en_US.mjs";
import $ from "../popover/PurePanel.mjs";
import k from "./style/index.mjs";
import { ConfigContext as C } from "../config-provider/context.mjs";
import w from "../locale/useLocale.mjs";
var S = globalThis && globalThis.__rest || function(o, n) {
  var l = {};
  for (var e in o)
    Object.prototype.hasOwnProperty.call(o, e) && n.indexOf(e) < 0 && (l[e] = o[e]);
  if (o != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, e = Object.getOwnPropertySymbols(o); r < e.length; r++)
      n.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, e[r]) && (l[e[r]] = o[e[r]]);
  return l;
};
const B = (o) => {
  const {
    prefixCls: n,
    okButtonProps: l,
    cancelButtonProps: e,
    title: r,
    description: i,
    cancelText: a,
    okText: s,
    okType: m = "primary",
    icon: p = /* @__PURE__ */ t.createElement(O, null),
    showCancel: d = !0,
    close: v,
    onConfirm: g,
    onCancel: y,
    onPopupClick: b
  } = o, {
    getPrefixCls: E
  } = t.useContext(C), [c] = w("Popconfirm", T.Popconfirm), f = x(r), u = x(i);
  return /* @__PURE__ */ t.createElement("div", {
    className: `${n}-inner-content`,
    onClick: b
  }, /* @__PURE__ */ t.createElement("div", {
    className: `${n}-message`
  }, p && /* @__PURE__ */ t.createElement("span", {
    className: `${n}-message-icon`
  }, p), /* @__PURE__ */ t.createElement("div", {
    className: `${n}-message-text`
  }, f && /* @__PURE__ */ t.createElement("div", {
    className: P(`${n}-title`)
  }, f), u && /* @__PURE__ */ t.createElement("div", {
    className: `${n}-description`
  }, u))), /* @__PURE__ */ t.createElement("div", {
    className: `${n}-buttons`
  }, d && /* @__PURE__ */ t.createElement(h, Object.assign({
    onClick: y,
    size: "small"
  }, e), a ?? (c == null ? void 0 : c.cancelText)), /* @__PURE__ */ t.createElement(N, {
    buttonProps: Object.assign(Object.assign({
      size: "small"
    }, j(m)), l),
    actionFn: g,
    close: v,
    prefixCls: E("btn"),
    quitOnNullishReturnValue: !0,
    emitEvent: !0
  }, s ?? (c == null ? void 0 : c.okText))));
}, L = (o) => {
  const {
    prefixCls: n,
    placement: l,
    className: e,
    style: r
  } = o, i = S(o, ["prefixCls", "placement", "className", "style"]), {
    getPrefixCls: a
  } = t.useContext(C), s = a("popconfirm", n), [m] = k(s);
  return m(/* @__PURE__ */ t.createElement($, {
    placement: l,
    className: P(s, e),
    style: r,
    content: /* @__PURE__ */ t.createElement(B, Object.assign({
      prefixCls: s
    }, i))
  }));
}, K = L;
export {
  B as Overlay,
  K as default
};
