import { jsx as _jsx } from "react/jsx-runtime";
import { determineWidthForScreen } from "../../../_staging/layout/sizing.js";
import { isInitialPlaceholderWidget } from "../../../widgets/placeholders/types.js";
import { useScreenSize } from "../../dashboard/components/DashboardScreenSizeContext.js";
import { DashboardLayoutEditSectionHeader } from "./DashboardLayoutEditSectionHeader.js";
import { DashboardLayoutItemViewRenderer } from "./DashboardLayoutItemViewRenderer.js";
import { buildEmptyItemFacadeWithSetSize } from "./utils/emptyFacade.js";
const containsOnlyPlaceholders = (section) => {
    return section.items().every((widget) => isInitialPlaceholderWidget(widget.widget()));
};
export function DashboardLayoutEditSectionHeaderRenderer({ section, parentLayoutItemSize, }) {
    const screen = useScreenSize();
    const gridWidth = determineWidthForScreen(screen, parentLayoutItemSize);
    const emptyItem = buildEmptyItemFacadeWithSetSize(gridWidth, section.index());
    const isInitialDropzone = section.isFirst() && containsOnlyPlaceholders(section);
    return (_jsx(DashboardLayoutItemViewRenderer, { DefaultItemRenderer: DashboardLayoutItemViewRenderer, item: emptyItem, 
        // header is always at the top, this information is not usable by it but required by
        // the shared interface with widget
        rowIndex: -1, children: _jsx(DashboardLayoutEditSectionHeader, { section: section, parentLayoutItemSize: parentLayoutItemSize, isEmptySection: isInitialDropzone }) }));
}
//# sourceMappingURL=DashboardLayoutEditSectionHeaderRenderer.js.map