import Q from "../../../classnames/index.mjs";
import * as n from "react";
import V from "../../../@ant-design/icons/es/icons/EllipsisOutlined.mjs";
import m from "../button/button.mjs";
import "../config-provider/index.mjs";
import W from "../space/index.mjs";
import { useCompactItemContext as X } from "../space/Compact.mjs";
import Y from "./dropdown.mjs";
import { ConfigContext as Z } from "../config-provider/context.mjs";
var ee = globalThis && globalThis.__rest || function(e, l) {
  var r = {};
  for (var t in e)
    Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (r[t] = e[t]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, t = Object.getOwnPropertySymbols(e); o < t.length; o++)
      l.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (r[t[o]] = e[t[o]]);
  return r;
};
const u = (e) => {
  const {
    getPopupContainer: l,
    getPrefixCls: r,
    direction: t
  } = n.useContext(Z), {
    prefixCls: o,
    type: s = "default",
    danger: p,
    disabled: i,
    loading: d,
    onClick: f,
    htmlType: g,
    children: y,
    className: C,
    menu: b,
    arrow: h,
    autoFocus: O,
    overlay: P,
    trigger: v,
    align: x,
    open: w,
    onOpenChange: T,
    placement: E,
    getPopupContainer: B,
    href: N,
    icon: R = /* @__PURE__ */ n.createElement(V, null),
    title: D,
    buttonsRender: _ = (M) => M,
    mouseEnterDelay: j,
    mouseLeaveDelay: S,
    overlayClassName: k,
    overlayStyle: I,
    destroyPopupOnHide: z,
    dropdownRender: L
  } = e, F = ee(e, ["prefixCls", "type", "danger", "disabled", "loading", "onClick", "htmlType", "children", "className", "menu", "arrow", "autoFocus", "overlay", "trigger", "align", "open", "onOpenChange", "placement", "getPopupContainer", "href", "icon", "title", "buttonsRender", "mouseEnterDelay", "mouseLeaveDelay", "overlayClassName", "overlayStyle", "destroyPopupOnHide", "dropdownRender"]), c = r("dropdown", o), H = `${c}-button`, a = {
    menu: b,
    arrow: h,
    autoFocus: O,
    align: x,
    disabled: i,
    trigger: i ? [] : v,
    onOpenChange: T,
    getPopupContainer: B || l,
    mouseEnterDelay: j,
    mouseLeaveDelay: S,
    overlayClassName: k,
    overlayStyle: I,
    destroyPopupOnHide: z,
    dropdownRender: L
  }, {
    compactSize: $,
    compactItemClassnames: A
  } = X(c, t), U = Q(H, A, C);
  "overlay" in e && (a.overlay = P), "open" in e && (a.open = w), "placement" in e ? a.placement = E : a.placement = t === "rtl" ? "bottomLeft" : "bottomRight";
  const q = /* @__PURE__ */ n.createElement(m, {
    type: s,
    danger: p,
    disabled: i,
    loading: d,
    onClick: f,
    htmlType: g,
    href: N,
    title: D
  }, y), G = /* @__PURE__ */ n.createElement(m, {
    type: s,
    danger: p,
    icon: R
  }), [J, K] = _([q, G]);
  return /* @__PURE__ */ n.createElement(W.Compact, Object.assign({
    className: U,
    size: $,
    block: !0
  }, F), J, /* @__PURE__ */ n.createElement(Y, Object.assign({}, a), K));
};
u.__ANT_BUTTON = !0;
const pe = u;
export {
  pe as default
};
