import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2019-2026 GoodData Corporation
import { memo } from "react";
import { AnomalyColorControl } from "./AnomalyColorControl.js";
import { AnomalySensitivityControl } from "./AnomalySensitivityControl.js";
import { AnomalySizeControl } from "./AnomalySizeControl.js";
import { messages } from "../../../../locales.js";
import { ConfigSection } from "../ConfigSection.js";
import { AnomalyIndicatorControl } from "./AnomalyIndicatorControl.js";
export const AnomaliesSection = memo(function AnomaliesSection({ controlsDisabled = false, enabled = false, colors, properties = {}, propertiesMeta = {}, defaultAnomaliesEnabled = false, pushData = () => { }, }) {
    const defaultColor = {
        type: "rgb",
        value: {
            r: 255,
            g: 0,
            b: 0,
        },
    };
    const anomaliesEnabled = properties?.controls?.["anomalies"]?.enabled ?? defaultAnomaliesEnabled;
    const anomaliesSensitivity = properties?.controls?.["anomalies"]?.sensitivity ?? "medium";
    const anomaliesSize = properties?.controls?.["anomalies"]?.size ?? "small";
    const anomaliesColor = properties?.controls?.["anomalies"]?.color ?? defaultColor;
    const anomaliesToggleDisabledByVisualization = !(propertiesMeta?.anomalies_enabled ?? true);
    const toggleDisabled = controlsDisabled || anomaliesToggleDisabledByVisualization || !enabled;
    const forecastControlsDisabled = !anomaliesEnabled || toggleDisabled;
    const showDisabledMessage = controlsDisabled || anomaliesToggleDisabledByVisualization || !enabled;
    return (_jsxs(ConfigSection, { id: "anomalies_section", valuePath: "anomalies.enabled", className: "gd-anomalies-section adi-bucket-configuration", title: messages["anomaliesTitle"].id, propertiesMeta: propertiesMeta, properties: properties, canBeToggled: true, toggleDisabled: toggleDisabled, toggledOn: anomaliesEnabled, pushData: pushData, showDisabledMessage: showDisabledMessage, toggleMessageId: messages["anomaliesDisabledTooltip"].id, children: [
            _jsx(AnomalySensitivityControl, { disabled: forecastControlsDisabled, value: anomaliesSensitivity, showDisabledMessage: showDisabledMessage, properties: properties, pushData: pushData }), _jsxs(AnomalyIndicatorControl, { title: messages["anomaliesIndicator"].id, children: [
                    _jsx(AnomalyColorControl, { colorPalette: colors.colorPalette, disabled: forecastControlsDisabled, value: anomaliesColor, showDisabledMessage: showDisabledMessage, properties: properties, pushData: pushData }), _jsx(AnomalySizeControl, { disabled: forecastControlsDisabled, value: anomaliesSize, showDisabledMessage: showDisabledMessage, properties: properties, pushData: pushData })
                ] })
        ] }));
});
//# sourceMappingURL=AnomaliesSection.js.map