"use client";
import * as SliderPrimitive from '@radix-ui/react-slider';
import * as React from 'react';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { jsxs, jsx } from 'react/jsx-runtime';

function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var Slider = React.forwardRef(({ className, thumbLabels, ...props }, ref) => {
  const values = props.value ?? props.defaultValue ?? [0];
  const rootLabel = props["aria-label"];
  const rootLabelledBy = props["aria-labelledby"];
  if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && thumbLabels && thumbLabels.length !== values.length) {
    console.warn(
      `Slider: thumbLabels.length (${thumbLabels.length}) does not match value.length (${values.length}). Missing labels fall back to indexed names; extra labels are ignored.`
    );
  }
  return /* @__PURE__ */ jsxs(
    SliderPrimitive.Root,
    {
      ref,
      className: cn("relative flex w-full touch-none select-none items-center", className),
      ...props,
      children: [
        /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full border border-foreground/[0.08] bg-secondary", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
        values.map((_, i) => {
          const explicit = thumbLabels?.[i];
          const fallback = values.length === 1 ? rootLabel : rootLabel ? `${rootLabel} (${i + 1} of ${values.length})` : void 0;
          return /* @__PURE__ */ jsx(
            SliderPrimitive.Thumb,
            {
              "aria-label": explicit ?? fallback,
              "aria-labelledby": explicit || fallback ? void 0 : rootLabelledBy,
              className: cn(
                "block h-5 w-5 rounded-full border-2 border-primary bg-background",
                "transition-all duration-[var(--duration-normal,200ms)] ease-out shadow-md",
                "hover:shadow-lg hover:scale-110",
                "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
                "disabled:pointer-events-none disabled:opacity-50"
              )
            },
            i
          );
        })
      ]
    }
  );
});
Slider.displayName = "Slider";

export { Slider };
//# sourceMappingURL=slider.js.map
//# sourceMappingURL=slider.js.map