"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { cn } from "../../lib/utils.js";
import { SliderRoot } from "../../node_modules/@base-ui/react/esm/slider/root/SliderRoot.js";
import { SliderControl } from "../../node_modules/@base-ui/react/esm/slider/control/SliderControl.js";
import { SliderTrack } from "../../node_modules/@base-ui/react/esm/slider/track/SliderTrack.js";
import { SliderIndicator } from "../../node_modules/@base-ui/react/esm/slider/indicator/SliderIndicator.js";
import { SliderThumb } from "../../node_modules/@base-ui/react/esm/slider/thumb/SliderThumb.js";
function Slider({
  className,
  defaultValue,
  value,
  min = 0,
  max = 100,
  ...props
}) {
  const _values = React.useMemo(
    () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
    [value, defaultValue, min, max]
  );
  return /* @__PURE__ */ jsx(
    SliderRoot,
    {
      className: "data-horizontal:w-full data-vertical:h-full",
      "data-slot": "slider",
      defaultValue,
      value,
      min,
      max,
      thumbAlignment: "edge",
      ...props,
      children: /* @__PURE__ */ jsxs(
        SliderControl,
        {
          className: cn(
            "data-vertical:min-h-40 relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:w-auto data-vertical:flex-col",
            className
          ),
          children: [
            /* @__PURE__ */ jsx(
              SliderTrack,
              {
                "data-slot": "slider-track",
                className: "bg-muted rounded-full data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5 relative overflow-hidden select-none",
                children: /* @__PURE__ */ jsx(
                  SliderIndicator,
                  {
                    "data-slot": "slider-range",
                    className: "bg-primary select-none data-horizontal:h-full data-vertical:w-full"
                  }
                )
              }
            ),
            Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
              SliderThumb,
              {
                "data-slot": "slider-thumb",
                className: "border-primary ring-ring/50 size-4 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden block shrink-0 select-none disabled:pointer-events-none disabled:opacity-50"
              },
              index
            ))
          ]
        }
      )
    }
  );
}
export {
  Slider
};
//# sourceMappingURL=slider.js.map
