import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2019-2025 GoodData Corporation
import { messages } from "../../../../locales.js";
import { DEFAULT_CLUSTERING_THRESHOLD } from "../../../constants/scatter.js";
import { InputControl } from "../InputControl.js";
export function ClusteringThresholdControl({ disabled, valuePath, properties, pushData, }) {
    return (_jsx(InputControl, { valuePath: valuePath, labelText: messages["clusteringThreshold"].id, placeholder: messages["clusteringThresholdPlaceholder"].id, type: "number", value: properties?.controls?.["clustering"]?.threshold ?? `${DEFAULT_CLUSTERING_THRESHOLD}`, disabled: disabled, properties: properties, pushData: pushData, description: messages["clusteringThresholdTooltip"].id, descriptionValues: {
            link: (chunks) => (_jsx("a", { href: "https://www.gooddata.com/docs/cloud/create-visualizations/smart-functions/#UseSmartFunctions-Clustering", target: "_blank", rel: "noopener noreferrer", children: chunks })),
        }, transformFn: (value) => {
            const parsedValue = parseFloat(value);
            const isValid = parsedValue > 0 && parsedValue < 1;
            // For invalid or empty input, transform to default value.
            if (value === "" || !isValid) {
                return `${DEFAULT_CLUSTERING_THRESHOLD}`;
            }
            return value;
        } }));
}
//# sourceMappingURL=ClusteringThresholdControl.js.map