import b from "../../@babel/runtime/helpers/esm/extends.mjs";
import w from "../../@babel/runtime/helpers/esm/defineProperty.mjs";
import * as e from "react";
import N from "../../classnames/index.mjs";
import x from "../../rc-util/es/hooks/useMobile.mjs";
import D from "../../rc-util/es/raf.mjs";
var P = 200, I = 600;
function y(a) {
  var r = a.prefixCls, E = a.upNode, M = a.downNode, l = a.upDisabled, p = a.downDisabled, R = a.onStep, s = e.useRef(), i = e.useRef([]), u = e.useRef();
  u.current = R;
  var c = function() {
    clearTimeout(s.current);
  }, d = function(t, v) {
    t.preventDefault(), c(), u.current(v);
    function S() {
      u.current(v), s.current = setTimeout(S, P);
    }
    s.current = setTimeout(S, I);
  };
  e.useEffect(function() {
    return function() {
      c(), i.current.forEach(function(o) {
        return D.cancel(o);
      });
    };
  }, []);
  var h = x();
  if (h)
    return null;
  var n = "".concat(r, "-handler"), T = N(n, "".concat(n, "-up"), w({}, "".concat(n, "-up-disabled"), l)), C = N(n, "".concat(n, "-down"), w({}, "".concat(n, "-down-disabled"), p)), m = function() {
    return i.current.push(D(c));
  }, f = {
    unselectable: "on",
    role: "button",
    onMouseUp: m,
    onMouseLeave: m
  };
  return /* @__PURE__ */ e.createElement("div", {
    className: "".concat(n, "-wrap")
  }, /* @__PURE__ */ e.createElement("span", b({}, f, {
    onMouseDown: function(t) {
      d(t, !0);
    },
    "aria-label": "Increase Value",
    "aria-disabled": l,
    className: T
  }), E || /* @__PURE__ */ e.createElement("span", {
    unselectable: "on",
    className: "".concat(r, "-handler-up-inner")
  })), /* @__PURE__ */ e.createElement("span", b({}, f, {
    onMouseDown: function(t) {
      d(t, !1);
    },
    "aria-label": "Decrease Value",
    "aria-disabled": p,
    className: C
  }), M || /* @__PURE__ */ e.createElement("span", {
    unselectable: "on",
    className: "".concat(r, "-handler-down-inner")
  })));
}
export {
  y as default
};
