import x from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import h from "../../../classnames/index.mjs";
import * as a from "react";
import M from "../context.mjs";
import { getIndex as S } from "../util.mjs";
import C from "./Track.mjs";
function $(n) {
  var i = n.prefixCls, g = n.style, t = n.values, o = n.startPoint, p = n.onStartMove, s = a.useContext(M), y = s.included, f = s.range, d = s.min, u = s.styles, v = s.classNames, c = a.useMemo(function() {
    if (!f) {
      if (t.length === 0)
        return [];
      var l = o ?? d, e = t[0];
      return [{
        start: Math.min(l, e),
        end: Math.max(l, e)
      }];
    }
    for (var m = [], r = 0; r < t.length - 1; r += 1)
      m.push({
        start: t[r],
        end: t[r + 1]
      });
    return m;
  }, [t, f, o, d]), k = null;
  return (v.tracks || u.tracks) && (k = /* @__PURE__ */ a.createElement(C, {
    index: null,
    prefixCls: i,
    start: c[0].start,
    end: c[c.length - 1].end,
    replaceCls: h(v.tracks, "".concat(i, "-tracks")),
    style: u.tracks
  })), y ? /* @__PURE__ */ a.createElement(a.Fragment, null, k, c.map(function(l, e) {
    var m = l.start, r = l.end;
    return /* @__PURE__ */ a.createElement(C, {
      index: e,
      prefixCls: i,
      style: x(x({}, S(g, e)), u.track),
      start: m,
      end: r,
      key: e,
      onStartMove: p
    });
  })) : null;
}
export {
  $ as default
};
