import * as __WEBPACK_EXTERNAL_MODULE__chakra_ui_react__ from "@chakra-ui/react";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__SliderTooltip_mjs__ from "./SliderTooltip.mjs";
const RPSlider = ({ marks, name, sliderTooltip, ...rest })=>{
    const [showTooltip, setShowTooltip] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const values = (marks || [])?.map(({ value })=>value);
    return /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__chakra_ui_react__.Slider, {
        "aria-label": "slider",
        name: name,
        ...rest,
        min: values?.length > 0 ? Math.min(...values) : void 0,
        max: values?.length > 0 ? Math.max(...values) : void 0,
        onChange: (value)=>rest?.onChange?.(value),
        onMouseEnter: ()=>setShowTooltip(true),
        onMouseLeave: ()=>setShowTooltip(false)
    }, marks?.map((mark, index)=>/*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__chakra_ui_react__.SliderMark, {
            key: `${mark.value}-${index}`,
            ...mark
        }, mark.label)), /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__chakra_ui_react__.SliderTrack, null, /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__chakra_ui_react__.SliderFilledTrack, null)), /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__SliderTooltip_mjs__["default"], {
        isOpen: showTooltip,
        ...sliderTooltip
    }, /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__chakra_ui_react__.SliderThumb, {
        boxSize: "18px",
        boxShadow: "1px 2px 0px 0px var(--chakra-colors-gray-200)",
        borderRadius: "18px",
        border: "2px solid",
        borderColor: "darkblue.700"
    })));
};
/* ESM default export */ const RPSlider_rslib_entry_ = RPSlider;
export { RPSlider_rslib_entry_ as default };
