import K from "../../../@ant-design/icons/es/icons/DownOutlined.mjs";
import L from "../../../@ant-design/icons/es/icons/UpOutlined.mjs";
import m from "../../../classnames/index.mjs";
import Q from "../../../rc-input-number/es/InputNumber.mjs";
import * as r from "react";
import { getStatusClassNames as C, getMergedStatus as X } from "../_util/statusUtils.mjs";
import Z from "../config-provider/index.mjs";
import ee from "../config-provider/DisabledContext.mjs";
import re from "../config-provider/hooks/useSize.mjs";
import { FormItemInputContext as te, NoFormStyle as S } from "../form/context.mjs";
import { useCompactItemContext as oe, NoCompactStyle as E } from "../space/Compact.mjs";
import ne from "./style/index.mjs";
import ae from "../config-provider/hooks/useCSSVarCls.mjs";
import { ConfigContext as se } from "../config-provider/context.mjs";
var le = globalThis && globalThis.__rest || function(o, p) {
  var l = {};
  for (var t in o)
    Object.prototype.hasOwnProperty.call(o, t) && p.indexOf(t) < 0 && (l[t] = o[t]);
  if (o != null && typeof Object.getOwnPropertySymbols == "function")
    for (var n = 0, t = Object.getOwnPropertySymbols(o); n < t.length; n++)
      p.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[n]) && (l[t[n]] = o[t[n]]);
  return l;
};
const h = /* @__PURE__ */ r.forwardRef((o, p) => {
  const {
    getPrefixCls: l,
    direction: t
  } = r.useContext(se), n = r.useRef(null);
  r.useImperativeHandle(p, () => n.current);
  const {
    className: v,
    rootClassName: z,
    size: u,
    disabled: c,
    prefixCls: P,
    addonBefore: w,
    addonAfter: I,
    prefix: j,
    bordered: $ = !0,
    readOnly: _,
    status: D,
    controls: a
  } = o, F = le(o, ["className", "rootClassName", "size", "disabled", "prefixCls", "addonBefore", "addonAfter", "prefix", "bordered", "readOnly", "status", "controls"]), e = l("input-number", P), y = ae(e), [V, i, B] = ne(e, y), {
    compactSize: R,
    compactItemClassnames: T
  } = oe(e, t);
  let d = /* @__PURE__ */ r.createElement(L, {
    className: `${e}-handler-up-inner`
  }), f = /* @__PURE__ */ r.createElement(K, {
    className: `${e}-handler-down-inner`
  });
  const A = typeof a == "boolean" ? a : void 0;
  typeof a == "object" && (d = typeof a.upIcon > "u" ? d : /* @__PURE__ */ r.createElement("span", {
    className: `${e}-handler-up-inner`
  }, a.upIcon), f = typeof a.downIcon > "u" ? f : /* @__PURE__ */ r.createElement("span", {
    className: `${e}-handler-down-inner`
  }, a.downIcon));
  const {
    hasFeedback: b,
    status: H,
    isFormItemInput: k,
    feedbackIcon: U
  } = r.useContext(te), g = X(H, D), s = re((J) => {
    var x;
    return (x = u ?? R) !== null && x !== void 0 ? x : J;
  }), W = r.useContext(ee), O = c ?? W, M = m({
    [`${e}-lg`]: s === "large",
    [`${e}-sm`]: s === "small",
    [`${e}-rtl`]: t === "rtl",
    [`${e}-borderless`]: !$,
    [`${e}-in-form-item`]: k
  }, C(e, g), i), Y = `${e}-group`, q = b && /* @__PURE__ */ r.createElement(r.Fragment, null, U), G = /* @__PURE__ */ r.createElement(Q, Object.assign({
    ref: n,
    disabled: O,
    className: m(B, y, v, z, T),
    upHandler: d,
    downHandler: f,
    prefixCls: e,
    readOnly: _,
    controls: A,
    prefix: j,
    suffix: q,
    addonAfter: I && /* @__PURE__ */ r.createElement(E, null, /* @__PURE__ */ r.createElement(S, {
      override: !0,
      status: !0
    }, I)),
    addonBefore: w && /* @__PURE__ */ r.createElement(E, null, /* @__PURE__ */ r.createElement(S, {
      override: !0,
      status: !0
    }, w)),
    classNames: {
      input: M
    },
    classes: {
      affixWrapper: m(C(`${e}-affix-wrapper`, g, b), {
        [`${e}-affix-wrapper-sm`]: s === "small",
        [`${e}-affix-wrapper-lg`]: s === "large",
        [`${e}-affix-wrapper-rtl`]: t === "rtl",
        [`${e}-affix-wrapper-borderless`]: !$
      }, i),
      wrapper: m({
        [`${Y}-rtl`]: t === "rtl",
        [`${e}-wrapper-disabled`]: O
      }, i),
      group: m({
        [`${e}-group-wrapper-sm`]: s === "small",
        [`${e}-group-wrapper-lg`]: s === "large",
        [`${e}-group-wrapper-rtl`]: t === "rtl"
      }, C(`${e}-group-wrapper`, g, b), i)
    }
  }, F));
  return V(G);
}), N = h, me = (o) => /* @__PURE__ */ r.createElement(Z, {
  theme: {
    components: {
      InputNumber: {
        handleVisible: !0
      }
    }
  }
}, /* @__PURE__ */ r.createElement(h, Object.assign({}, o)));
process.env.NODE_ENV !== "production" && (N.displayName = "InputNumber");
N._InternalPanelDoNotUseOrYouWillBeFired = me;
const $e = N;
export {
  $e as default
};
