import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useDashboardSelector } from "../../../model/react/DashboardStoreProvider.js";
import { useWidgetSelection } from "../../../model/react/useWidgetSelection.js";
import { selectSettings } from "../../../model/store/config/configSelectors.js";
import { CreationPanel } from "./CreationPanel.js";
import { FloatingToolbar } from "./FloatingToolbar.js";
import { SidebarResizeChrome } from "./SidebarResizeChrome.js";
/**
 * @internal
 */
export function SidebarConfigurationPanel(props) {
    const { configurationPanelClassName, WrapCreatePanelItemWithDragComponent, WrapInsightListItemWithDragComponent, AttributeFilterComponentSet, InsightWidgetComponentSet, RichTextWidgetComponentSet, VisualizationSwitcherWidgetComponentSet, DashboardLayoutWidgetComponentSet, } = props;
    const { deselectWidgets } = useWidgetSelection();
    const DeleteDropZoneComponent = props.DeleteDropZoneComponent;
    const settings = useDashboardSelector(selectSettings);
    const enableEnhancedInsightPicker = settings?.enableEnhancedInsightPicker ?? false;
    const enableDashboardSidebarResize = settings?.enableDashboardSidebarResize ?? false;
    if (enableEnhancedInsightPicker) {
        return _jsx(FloatingToolbar, {});
    }
    const content = (_jsxs(_Fragment, { children: [
            _jsx("div", { className: "flex-panel-full-height", children: _jsx(CreationPanel, { className: configurationPanelClassName, WrapCreatePanelItemWithDragComponent: WrapCreatePanelItemWithDragComponent, WrapInsightListItemWithDragComponent: WrapInsightListItemWithDragComponent, AttributeFilterComponentSet: AttributeFilterComponentSet, InsightWidgetComponentSet: InsightWidgetComponentSet, RichTextWidgetComponentSet: RichTextWidgetComponentSet, VisualizationSwitcherWidgetComponentSet: VisualizationSwitcherWidgetComponentSet, DashboardLayoutWidgetComponentSet: DashboardLayoutWidgetComponentSet }) }), _jsx(DeleteDropZoneComponent, {})
        ] }));
    if (enableDashboardSidebarResize) {
        return _jsx(SidebarResizeChrome, { onContainerClick: deselectWidgets, children: content });
    }
    return (_jsx("div", { className: "col gd-flex-item gd-sidebar-container", onClick: deselectWidgets, children: content }));
}
