import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2019-2026 GoodData Corporation
import cx from "classnames";
import { getLayoutConfiguration } from "../../../_staging/dashboard/flexibleLayout/layoutConfiguration.js";
import { useDashboardSelector } from "../../../model/react/DashboardStoreProvider.js";
import { selectIsSectionInsertedByPlugin } from "../../../model/store/ui/uiSelectors.js";
import { SectionHotspot } from "../dragAndDrop/draggableWidget/SectionHotspot.js";
import { getRefsForSection } from "../refs.js";
import { SectionHeaderEditable } from "./EditableHeader/SectionHeaderEditable.js";
export function DashboardLayoutEditSectionHeader({ section, parentLayoutItemSize, isEmptySection, }) {
    const { sections } = getLayoutConfiguration(section.layout().raw());
    const refs = getRefsForSection(section);
    const isEditingDisabled = useDashboardSelector(selectIsSectionInsertedByPlugin(refs));
    if (isEmptySection) {
        return null;
    }
    const path = section.index();
    return (_jsxs("div", { className: "gd-fluid-layout-row-header s-fluid-layout-row-header", children: [path.parent && path.parent?.length >= 0 ? null : (_jsx(SectionHotspot, { index: path, targetPosition: "above", itemSize: parentLayoutItemSize })), _jsx("div", { className: cx({
                    "gd-fluid-layout-row-header-container--with-headers": sections.areHeadersEnabled,
                    "gd-fluid-layout-row-header-container--no-headers": !sections.areHeadersEnabled,
                }), children: sections.areHeadersEnabled && !isEditingDisabled ? (_jsx(SectionHeaderEditable, { title: section.title(), description: section.description(), section: section })) : null })
        ] }));
}
//# sourceMappingURL=DashboardLayoutEditSectionHeader.js.map