import v from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import x from "../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import p from "../../../classnames/index.mjs";
import * as b from "react";
import E from "../context.mjs";
import { getOffset as u } from "../util.mjs";
function D(e) {
  var c, i = e.prefixCls, h = e.style, S = e.start, g = e.end, s = e.index, n = e.onStartMove, k = e.replaceCls, r = b.useContext(E), C = r.direction, l = r.min, m = r.max, y = r.disabled, M = r.range, N = r.classNames, f = "".concat(i, "-track"), a = u(S, l, m), o = u(g, l, m), d = function(_) {
    !y && n && n(_, -1);
  }, t = {};
  switch (C) {
    case "rtl":
      t.right = "".concat(a * 100, "%"), t.width = "".concat(o * 100 - a * 100, "%");
      break;
    case "btt":
      t.bottom = "".concat(a * 100, "%"), t.height = "".concat(o * 100 - a * 100, "%");
      break;
    case "ttb":
      t.top = "".concat(a * 100, "%"), t.height = "".concat(o * 100 - a * 100, "%");
      break;
    default:
      t.left = "".concat(a * 100, "%"), t.width = "".concat(o * 100 - a * 100, "%");
  }
  var w = k || p(f, (c = {}, x(c, "".concat(f, "-").concat(s + 1), s !== null && M), x(c, "".concat(i, "-track-draggable"), n), c), N.track);
  return /* @__PURE__ */ b.createElement("div", {
    className: w,
    style: v(v({}, t), h),
    onMouseDown: d,
    onTouchStart: d
  });
}
export {
  D as default
};
