import * as a from "react";
import U from "../../../@ant-design/icons/es/icons/CloseOutlined.mjs";
import W from "../../../@ant-design/icons/es/icons/EllipsisOutlined.mjs";
import q from "../../../@ant-design/icons/es/icons/PlusOutlined.mjs";
import N from "../../../classnames/index.mjs";
import B from "../../../rc-tabs/es/Tabs.mjs";
import { devUseWarning as F } from "../_util/warning.mjs";
import "../config-provider/index.mjs";
import G from "../config-provider/hooks/useSize.mjs";
import H from "./hooks/useAnimateConfig.mjs";
import J from "./hooks/useLegacyItems.mjs";
import K from "./style/index.mjs";
import M from "../config-provider/hooks/useCSSVarCls.mjs";
import Q from "./TabPane.mjs";
import { ConfigContext as X } from "../config-provider/context.mjs";
var Y = globalThis && globalThis.__rest || function(e, n) {
  var s = {};
  for (var t in e)
    Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (s[t] = e[t]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
      n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (s[t[i]] = e[t[i]]);
  return s;
};
const p = (e) => {
  const {
    type: n,
    className: s,
    rootClassName: t,
    size: i,
    onEdit: d,
    hideAdd: y,
    centered: O,
    addIcon: E,
    popupClassName: P,
    children: S,
    items: h,
    animated: x,
    style: z,
    indicatorSize: c
  } = e, u = Y(e, ["type", "className", "rootClassName", "size", "onEdit", "hideAdd", "centered", "addIcon", "popupClassName", "children", "items", "animated", "style", "indicatorSize"]), {
    prefixCls: I,
    moreIcon: T = /* @__PURE__ */ a.createElement(W, null)
  } = u, {
    direction: $,
    tabs: o,
    getPrefixCls: f,
    getPopupContainer: j
  } = a.useContext(X), r = f("tabs", I), m = M(r), [_, b, C] = K(r, m);
  let v;
  n === "editable-card" && (v = {
    onEdit: (l, D) => {
      let {
        key: L,
        event: R
      } = D;
      d == null || d(l === "add" ? R : L, l);
    },
    removeIcon: /* @__PURE__ */ a.createElement(U, null),
    addIcon: E || /* @__PURE__ */ a.createElement(q, null),
    showAdd: y !== !0
  });
  const k = f();
  if (process.env.NODE_ENV !== "production") {
    const l = F("Tabs");
    process.env.NODE_ENV !== "production" && l(!("onPrevClick" in e) && !("onNextClick" in e), "breaking", "`onPrevClick` and `onNextClick` has been removed. Please use `onTabScroll` instead.");
  }
  const w = J(h, S), V = H(r, x), g = G(i), A = Object.assign(Object.assign({}, o == null ? void 0 : o.style), z);
  return _(/* @__PURE__ */ a.createElement(B, Object.assign({
    direction: $,
    getPopupContainer: j,
    moreTransitionName: `${k}-slide-up`
  }, u, {
    items: w,
    className: N({
      [`${r}-${g}`]: g,
      [`${r}-card`]: ["card", "editable-card"].includes(n),
      [`${r}-editable-card`]: n === "editable-card",
      [`${r}-centered`]: O
    }, o == null ? void 0 : o.className, s, t, b, C, m),
    popupClassName: N(P, b, C, m),
    style: A,
    editable: v,
    moreIcon: T,
    prefixCls: r,
    animated: V,
    indicatorSize: c ?? (o == null ? void 0 : o.indicatorSize)
  })));
};
p.TabPane = Q;
process.env.NODE_ENV !== "production" && (p.displayName = "Tabs");
const ue = p;
export {
  ue as default
};
