import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { bucketIsEmpty, insightBucket } from "@gooddata/sdk-model";
import { BucketNames } from "@gooddata/sdk-ui";
import { ConfigurationPanelContent } from "./ConfigurationPanelContent.js";
import { messages } from "../../../locales.js";
import { ColorsSection } from "../configurationControls/colors/ColorsSection.js";
import { ConfigSection } from "../configurationControls/ConfigSection.js";
import { GeoViewportControl } from "../configurationControls/GeoViewportControl.js";
/**
 * Configuration panel for GeoAreaChart
 *
 * @remarks
 * This panel provides configuration options specific to geo area maps:
 * - Legend settings
 * - Area styling (fill opacity, border color, border width)
 * - Viewport configuration
 * - Color mapping
 *
 * @internal
 */
export class GeoAreaConfigurationPanel extends ConfigurationPanelContent {
    renderViewportSection() {
        const { properties, propertiesMeta, pushData } = this.props;
        return (_jsx(ConfigSection, { id: "map_section", title: messages["pointsMapTitle"].id, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData, children: _jsx(GeoViewportControl, { properties: properties, disabled: this.isControlDisabled(), pushData: pushData }) }));
    }
    renderConfigurationPanel() {
        return (_jsxs("div", { children: [this.renderLegendSection(), this.renderColorSection(), this.renderViewportSection(), this.renderInteractionsSection()] }));
    }
    renderColorSection() {
        const { properties, propertiesMeta, pushData, colors, references, isLoading } = this.props;
        const controlsDisabled = this.isControlDisabled();
        return (_jsx(ColorsSection, { properties: properties, propertiesMeta: propertiesMeta, references: references, colors: colors, controlsDisabled: controlsDisabled, pushData: pushData, hasMeasures // color configuration is category-driven
            : true, isLoading: isLoading, supportsChartFill: false }));
    }
    isControlDisabled() {
        const { insight, isError, isLoading } = this.props;
        return !!(!hasAreaAttribute(insight) || isError || isLoading);
    }
}
function hasAreaAttribute(insight) {
    if (!insight) {
        return false;
    }
    const bucket = insightBucket(insight, BucketNames.AREA);
    return bucket !== undefined && !bucketIsEmpty(bucket);
}
//# sourceMappingURL=GeoAreaConfigurationPanel.js.map