import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
// (C) 2021-2026 GoodData Corporation
import { useCallback, useMemo, useState } from "react";
import { useIntl } from "react-intl";
import { DashboardAttributeFilterConfigModeValues, dashboardAttributeFilterItemDisplayForm, dashboardAttributeFilterItemLocalIdentifier, dashboardAttributeFilterItemTitle, dashboardAttributeFilterItemValidateElementsBy, filterObjRef, isDashboardAttributeFilter, } from "@gooddata/sdk-model";
import { AttributeDatasetInfo, AttributeFilterButton, AttributeFilterDependencyTooltip, AttributeFilterDropdownButton, AttributeFilterElementsSelect, AttributeFilterLoading, AttributeFilterStatusBar, SingleSelectionAttributeFilterStatusBar, TextFilterBody, useAttributeFilterContext, useAutoOpenAttributeFilterDropdownButton, useOnCloseAttributeFilterDropdownButton, } from "@gooddata/sdk-ui-filters";
import { LOADING_HEIGHT, LoadingMask } from "@gooddata/sdk-ui-kit";
import { attributeFilterToDashboardAttributeFilter } from "../../../_staging/dashboard/dashboardFilterConverter.js";
import { useAttributes } from "../../../_staging/sharedHooks/useAttributes.js";
import { dashboardAttributeFilterItemToAttributeFilter } from "../../../converters/filterConverters.js";
import { useDashboardSelector } from "../../../model/react/DashboardStoreProvider.js";
import { useDashboardUserInteraction } from "../../../model/react/useDashboardUserInteraction.js";
import { selectBackendCapabilities } from "../../../model/store/backendCapabilities/backendCapabilitiesSelectors.js";
import { selectAvailableAttributeFilterSelectionTypes, selectEnableImmediateAttributeFilterDisplayAsLabelMigration, selectIsApplyFiltersAllAtOnceEnabledAndSet, selectLocale, } from "../../../model/store/config/configSelectors.js";
import { selectIsFilterFromCrossFilteringByLocalIdentifier } from "../../../model/store/drill/drillSelectors.js";
import { selectIsInEditMode } from "../../../model/store/renderMode/renderModeSelectors.js";
import { selectAttributeFilterConfigsModeMap, selectAttributeFilterConfigsModeMapByTab, selectAttributeFilterConfigsSelectionTypeMap, selectAttributeFilterConfigsSelectionTypeMapByTab, } from "../../../model/store/tabs/attributeFilterConfigs/attributeFilterConfigsSelectors.js";
import { selectIsAttributeFilterDependentByLocalIdentifier, selectIsAttributeFilterDependentByLocalIdentifierForTab, selectPreloadedAttributesWithReferences, } from "../../../model/store/tabs/filterContext/filterContextSelectors.js";
import { getVisibilityIcon } from "../utils.js";
import { AttributeFilterParentFilteringProvider, useAttributeFilterParentFiltering, } from "./AttributeFilterParentFilteringContext.js";
import { CustomAttributeFilterDropdownActions, CustomConfigureAttributeFilterDropdownActions, } from "./CustomDropdownActions.js";
import { AttributeFilterConfiguration } from "./dashboardDropdownBody/configuration/AttributeFilterConfiguration.js";
import { useAttributeDataSet } from "./dashboardDropdownBody/configuration/hooks/useAttributeDataSet.js";
import { mergeDashboardAttributeFilterMetadata } from "./mergeDashboardAttributeFilterMetadata.js";
import { useAttributeFilterConfigTexts } from "./useAttributeFilterConfigTexts.js";
import { useDependentDateFilters } from "./useDependentDateFilters.js";
import { useParentFilters } from "./useParentFilters.js";
/**
 * Default implementation of the attribute filter to use on the dashboard's filter bar.
 *
 * This will use the SDK's AttributeFilter with the button styled same as we have it today on KD.
 *
 * @alpha
 */
export function DefaultDashboardAttributeFilter(props) {
    const isInEditMode = useDashboardSelector(selectIsInEditMode);
    // Wait for batch preload of the required attribute filter data (labels and datasets), otherwise, each filter will spawn its own request.
    const filtersPreloaded = useDashboardSelector(selectPreloadedAttributesWithReferences);
    const showFilter = isInEditMode || filtersPreloaded;
    const LoadingComponent = props.AttributeFilterLoadingComponent || AttributeFilterLoading;
    if (!showFilter) {
        return _jsx(LoadingComponent, {});
    }
    return _jsx(DefaultDashboardAttributeFilterInner, { ...props });
}
/**
 * @internal
 */
export function StandaloneDashboardAttributeFilter(props) {
    return _jsx(DefaultDashboardAttributeFilterInner, { ...props });
}
function DefaultDashboardAttributeFilterInner(props) {
    const { filter, workingFilter, onFilterChanged, isDraggable, readonly, autoOpen, onClose, displayAsLabel, overlayPositionType, tabId, passDropdownButton = true, } = props;
    const { parentFilters, parentFilterOverAttribute } = useParentFilters(filter, tabId);
    const { dependentDateFilters } = useDependentDateFilters(filter, tabId);
    const locale = useDashboardSelector(selectLocale);
    const isEditMode = useDashboardSelector(selectIsInEditMode);
    const capabilities = useDashboardSelector(selectBackendCapabilities);
    // Extract common properties using wide utilities; narrow props only for standard filters
    const filterLocalId = dashboardAttributeFilterItemLocalIdentifier(filter);
    const filterTitle = dashboardAttributeFilterItemTitle(filter);
    const filterDisplayFormRef = dashboardAttributeFilterItemDisplayForm(filter);
    const filterValidateElementsBy = dashboardAttributeFilterItemValidateElementsBy(filter);
    const standardFilter = isDashboardAttributeFilter(filter) ? filter : undefined;
    const filterSelectionMode = standardFilter?.attributeFilter.selectionMode;
    // Use tab-specific selectors when tabId is provided
    // Always call all hooks unconditionally
    const attributeFilterConfigsModeMapByTab = useDashboardSelector(selectAttributeFilterConfigsModeMapByTab);
    const attributeFilterConfigsModeMapActive = useDashboardSelector(selectAttributeFilterConfigsModeMap);
    const attributeFilterConfigsModeMap = useMemo(() => tabId
        ? (attributeFilterConfigsModeMapByTab[tabId] ?? new Map())
        : attributeFilterConfigsModeMapActive, [tabId, attributeFilterConfigsModeMapByTab, attributeFilterConfigsModeMapActive]);
    const attributeFilter = useMemo(() => dashboardAttributeFilterItemToAttributeFilter(filter), [filter]);
    const workingAttributeFilter = useMemo(() => dashboardAttributeFilterItemToAttributeFilter(workingFilter ?? filter), [workingFilter, filter]);
    const [isConfigurationOpen, setIsConfigurationOpen] = useState(false);
    const userInteraction = useDashboardUserInteraction();
    // Always call selectors unconditionally, select the right one based on tabId
    const isAttributeFilterDependentActive = useDashboardSelector(selectIsAttributeFilterDependentByLocalIdentifier(filterLocalId));
    const isAttributeFilterDependentForTab = useDashboardSelector(tabId
        ? selectIsAttributeFilterDependentByLocalIdentifierForTab(filterLocalId, tabId)
        : selectIsAttributeFilterDependentByLocalIdentifier(filterLocalId));
    const isAttributeFilterDependent = tabId
        ? isAttributeFilterDependentForTab
        : isAttributeFilterDependentActive;
    const isVirtualAttributeFilter = useDashboardSelector(selectIsFilterFromCrossFilteringByLocalIdentifier(filterLocalId));
    const enableImmediateAttributeFilterDisplayAsLabelMigration = useDashboardSelector(selectEnableImmediateAttributeFilterDisplayAsLabelMigration);
    const isApplyAllAtOnceEnabledAndSet = useDashboardSelector(selectIsApplyFiltersAllAtOnceEnabledAndSet);
    const allAvailableSelectionTypes = useDashboardSelector(selectAvailableAttributeFilterSelectionTypes);
    const attributeFilterConfigsSelectionTypeMapByTab = useDashboardSelector(selectAttributeFilterConfigsSelectionTypeMapByTab);
    const attributeFilterConfigsSelectionTypeMapActive = useDashboardSelector(selectAttributeFilterConfigsSelectionTypeMap);
    const selectionTypeMap = useMemo(() => tabId
        ? (attributeFilterConfigsSelectionTypeMapByTab[tabId] ?? new Map())
        : attributeFilterConfigsSelectionTypeMapActive, [tabId, attributeFilterConfigsSelectionTypeMapByTab, attributeFilterConfigsSelectionTypeMapActive]);
    const filterSelectionType = selectionTypeMap.get(filterLocalId);
    const availableSelectionTypes = useMemo(() => {
        // Respect the per-filter selectionType config in both edit and view mode
        if (filterSelectionType === "list") {
            return allAvailableSelectionTypes.filter((mode) => mode === "elements");
        }
        if (filterSelectionType === "text") {
            return allAvailableSelectionTypes.filter((mode) => mode !== "elements");
        }
        if (filterSelectionType === "listOrText") {
            return allAvailableSelectionTypes;
        }
        // Fallback for existing filters without config: default to listOrText
        // Exception: list filter with single selection mode → listOnly
        if (standardFilter && filterSelectionMode === "single") {
            return allAvailableSelectionTypes.filter((mode) => mode === "elements");
        }
        return allAvailableSelectionTypes;
    }, [allAvailableSelectionTypes, standardFilter, filterSelectionType, filterSelectionMode]);
    const filterRef = useMemo(() => {
        return filterObjRef(attributeFilter);
    }, [attributeFilter]);
    const intl = useIntl();
    const { cancelText, closeText, saveText, applyText, displayValuesAsText, filterByText, titleText, resetTitleText, selectionTitleText, multiSelectionOptionText, multiSelectionOptionTooltip, singleSelectionOptionText, singleSelectionDisabledTooltip, parentFiltersDisabledTooltip, modeCategoryTitleText, selectionTypeAsText, selectionTypeListAndTextText, selectionTypeListText, selectionTypeTextText, selectionTypeListAndTextTooltip, selectionTypeListTooltip, selectionTypeTextTooltip, selectionTypeSingleDisabledTooltip, } = useAttributeFilterConfigTexts();
    // Show available mode dropdown only when at least one text mode FF is enabled
    const showSelectionTypeSection = allAvailableSelectionTypes.some((mode) => mode === "arbitrary" || mode === "match");
    const onCloseFilter = useCallback(() => {
        if (onClose) {
            onClose();
        }
    }, [onClose]);
    const attributeFilterRef = useMemo(() => {
        return [filterRef];
    }, [filterRef]);
    const { attributes } = useAttributes(attributeFilterRef);
    const visibilityIcon = useMemo(() => getVisibilityIcon(attributeFilterConfigsModeMap.get(filterLocalId), isEditMode, !!capabilities.supportsHiddenAndLockedFiltersOnUI, intl), [
        attributeFilterConfigsModeMap,
        filterLocalId,
        isEditMode,
        capabilities.supportsHiddenAndLockedFiltersOnUI,
        intl,
    ]);
    const CustomDropdownButton = useMemo(() => {
        function DropdownButton(props) {
            useAutoOpenAttributeFilterDropdownButton(props, Boolean(autoOpen));
            useOnCloseAttributeFilterDropdownButton(props, onCloseFilter);
            const { isOpen, title } = props;
            const { defaultAttributeFilterTitle, displayFormChangeStatus, attributeFilterDisplayForm } = useAttributeFilterParentFiltering();
            const { attributeDataSet } = useAttributeDataSet(attributeFilterDisplayForm);
            const displayAttributeTooltip = isEditMode && displayFormChangeStatus !== "running";
            const filterDependencyIconTooltip = intl.formatMessage({ id: "filter.dependency.icon.tooltip" }, {
                filterTitle: title,
                strong: (chunks) => _jsx("strong", { children: chunks }),
            });
            const filterDependencyIconAriaLabel = intl.formatMessage({
                id: "filter.dependency.icon.aria.label",
            });
            const CustomTooltipComponent = useMemo(() => {
                // When text filter FFs are enabled, the attribute filter dropdown header
                // has its own help icon (AttributeFilterDetailsBubble), so hide this one.
                if (showSelectionTypeSection) {
                    return undefined;
                }
                function TooltipComponent() {
                    return (_jsx(AttributeDatasetInfo, { title: title, defaultAttributeFilterTitle: defaultAttributeFilterTitle, attributeDataSet: attributeDataSet }));
                }
                if (displayAttributeTooltip && attributeDataSet && isOpen) {
                    return TooltipComponent;
                }
                return undefined;
            }, [displayAttributeTooltip, defaultAttributeFilterTitle, attributeDataSet, isOpen, title]);
            const shouldExtendTitle = !!capabilities.supportsKeepingDependentFiltersSelection && isAttributeFilterDependent;
            const titleExtension = shouldExtendTitle ? (_jsx(AttributeFilterDependencyTooltip, { tooltipContent: filterDependencyIconTooltip, ariaLabel: filterDependencyIconAriaLabel })) : null;
            return (_jsx(AttributeFilterDropdownButton, { ...props, isDraggable: isDraggable, TooltipContentComponent: CustomTooltipComponent, titleExtension: titleExtension, className: isVirtualAttributeFilter ? "gd-virtual-attribute-filter-dropdown-button" : undefined }));
        }
        return DropdownButton;
    }, [
        autoOpen,
        onCloseFilter,
        isEditMode,
        intl,
        capabilities.supportsKeepingDependentFiltersSelection,
        isAttributeFilterDependent,
        isDraggable,
        isVirtualAttributeFilter,
        showSelectionTypeSection,
    ]);
    const CustomDropdownActions = useMemo(() => {
        function DropdownActions(props) {
            const { currentDisplayFormRef, committedSelectionElements } = useAttributeFilterContext();
            const withoutApply = useDashboardSelector(selectIsApplyFiltersAllAtOnceEnabledAndSet);
            const { title, configurationChanged, displayFormChanged, titleChanged, onConfigurationSave, onConfigurationClose, selectionModeChanged, selectionTypeChanged, modeChanged, limitingItemsChanged, onDependentDateFiltersConfigurationChanged, } = useAttributeFilterParentFiltering();
            const isTitleDefined = !!title && title.trim().length > 0;
            const isSaveDisabled = isTitleDefined
                ? !(configurationChanged ||
                    displayFormChanged ||
                    titleChanged ||
                    selectionModeChanged ||
                    selectionTypeChanged ||
                    modeChanged ||
                    limitingItemsChanged ||
                    onDependentDateFiltersConfigurationChanged)
                : true;
            return (_jsx(_Fragment, { children: isConfigurationOpen ? (_jsx(CustomConfigureAttributeFilterDropdownActions, { isSaveDisabled: isSaveDisabled, onSaveButtonClick: () => {
                        onConfigurationSave(currentDisplayFormRef, committedSelectionElements);
                        setIsConfigurationOpen(false);
                    }, onCancelButtonClick: () => {
                        setIsConfigurationOpen(false);
                    }, cancelText: cancelText, saveText: saveText })) : (_jsx(CustomAttributeFilterDropdownActions, { ...props, filterDisplayFormRef: filterDisplayFormRef, filterSelectionMode: filterSelectionMode, applyText: applyText, cancelText: withoutApply ? closeText : cancelText, onConfigurationButtonClick: () => {
                        setIsConfigurationOpen(true);
                        onConfigurationClose();
                        userInteraction.attributeFilterInteraction("attributeFilterConfigurationOpened");
                    }, attributes: attributes })) }));
        }
        return DropdownActions;
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [
        isConfigurationOpen,
        cancelText,
        saveText,
        filterDisplayFormRef,
        filterSelectionMode,
        applyText,
        attributes,
    ]);
    const CustomElementsSelect = useMemo(() => {
        function ElementsSelect(props) {
            const { displayFormChangeStatus } = useAttributeFilterParentFiltering();
            const closeHandler = useCallback(() => {
                setIsConfigurationOpen(false);
            }, []);
            if (displayFormChangeStatus === "running") {
                return _jsx(LoadingMask, { height: LOADING_HEIGHT });
            }
            return (_jsx(_Fragment, { children: isConfigurationOpen ? (_jsx(AttributeFilterConfiguration, { intl: intl, closeHandler: closeHandler, filterRef: filterRef, filterByText: filterByText, displayValuesAsText: displayValuesAsText, titleText: titleText, resetTitleText: resetTitleText, selectionTitleText: selectionTitleText, multiSelectionOptionText: multiSelectionOptionText, multiSelectionOptionTooltip: multiSelectionOptionTooltip, singleSelectionOptionText: singleSelectionOptionText, modeCategoryTitleText: modeCategoryTitleText, singleSelectionDisabledTooltip: singleSelectionDisabledTooltip, parentFiltersDisabledTooltip: parentFiltersDisabledTooltip, showConfigModeSection: !!capabilities.supportsHiddenAndLockedFiltersOnUI, showSelectionTypeSection: showSelectionTypeSection, selectionTypeAsText: selectionTypeAsText, selectionTypeListAndTextText: selectionTypeListAndTextText, selectionTypeListAndTextTooltip: selectionTypeListAndTextTooltip, selectionTypeListText: selectionTypeListText, selectionTypeListTooltip: selectionTypeListTooltip, selectionTypeTextText: selectionTypeTextText, selectionTypeTextTooltip: selectionTypeTextTooltip, selectionTypeSingleDisabledTooltip: selectionTypeSingleDisabledTooltip })) : (_jsx(AttributeFilterElementsSelect, { ...props })) }));
        }
        return ElementsSelect;
    }, [
        isConfigurationOpen,
        filterRef,
        filterByText,
        displayValuesAsText,
        titleText,
        resetTitleText,
        selectionTitleText,
        multiSelectionOptionText,
        multiSelectionOptionTooltip,
        singleSelectionOptionText,
        singleSelectionDisabledTooltip,
        parentFiltersDisabledTooltip,
        modeCategoryTitleText,
        intl,
        capabilities,
        showSelectionTypeSection,
        selectionTypeAsText,
        selectionTypeListAndTextText,
        selectionTypeListText,
        selectionTypeListTooltip,
        selectionTypeTextText,
        selectionTypeTextTooltip,
        selectionTypeListAndTextTooltip,
        selectionTypeSingleDisabledTooltip,
    ]);
    const CustomTextFilterBody = useMemo(() => {
        function CustomTextFilter(props) {
            const closeHandler = useCallback(() => {
                setIsConfigurationOpen(false);
            }, []);
            return (_jsx(_Fragment, { children: isConfigurationOpen ? (_jsx(AttributeFilterConfiguration, { intl: intl, closeHandler: closeHandler, filterRef: filterRef, filterByText: filterByText, displayValuesAsText: displayValuesAsText, titleText: titleText, resetTitleText: resetTitleText, selectionTitleText: selectionTitleText, multiSelectionOptionText: multiSelectionOptionText, multiSelectionOptionTooltip: multiSelectionOptionTooltip, singleSelectionOptionText: singleSelectionOptionText, modeCategoryTitleText: modeCategoryTitleText, singleSelectionDisabledTooltip: singleSelectionDisabledTooltip, parentFiltersDisabledTooltip: parentFiltersDisabledTooltip, showConfigModeSection: !!capabilities.supportsHiddenAndLockedFiltersOnUI, showSelectionTypeSection: showSelectionTypeSection, selectionTypeAsText: selectionTypeAsText, selectionTypeListAndTextText: selectionTypeListAndTextText, selectionTypeListAndTextTooltip: selectionTypeListAndTextTooltip, selectionTypeListText: selectionTypeListText, selectionTypeListTooltip: selectionTypeListTooltip, selectionTypeTextText: selectionTypeTextText, selectionTypeTextTooltip: selectionTypeTextTooltip, selectionTypeSingleDisabledTooltip: selectionTypeSingleDisabledTooltip })) : (_jsx(TextFilterBody, { ...props })) }));
        }
        return CustomTextFilter;
    }, [
        isConfigurationOpen,
        filterRef,
        filterByText,
        displayValuesAsText,
        titleText,
        resetTitleText,
        selectionTitleText,
        multiSelectionOptionText,
        multiSelectionOptionTooltip,
        singleSelectionOptionText,
        singleSelectionDisabledTooltip,
        parentFiltersDisabledTooltip,
        modeCategoryTitleText,
        intl,
        capabilities,
        showSelectionTypeSection,
        selectionTypeAsText,
        selectionTypeListAndTextText,
        selectionTypeListText,
        selectionTypeListTooltip,
        selectionTypeTextText,
        selectionTypeTextTooltip,
        selectionTypeListAndTextTooltip,
        selectionTypeSingleDisabledTooltip,
    ]);
    const createStatusBarComponent = (params) => {
        const { filterSelectionMode, isApplyAllAtOnceEnabledAndSet, supportsShowingFilteredElements, userInteraction, } = params;
        function CustomStatusBar(props) {
            const context = useAttributeFilterContext();
            const afterClearIrrelevantSelection = useCallback(() => {
                if (isApplyAllAtOnceEnabledAndSet) {
                    context?.onApply?.(true, true);
                }
            }, [context]);
            const enableShowingFilteredElements = !!supportsShowingFilteredElements;
            const handleShowFilteredElements = () => {
                props.onShowFilteredElements?.();
                userInteraction.attributeFilterInteraction("attributeFilterShowAllValuesClicked");
            };
            if (filterSelectionMode === "single" && !props.isInverted) {
                return (_jsx(SingleSelectionAttributeFilterStatusBar, { ...props, onShowFilteredElements: handleShowFilteredElements, enableShowingFilteredElements: enableShowingFilteredElements }));
            }
            return (_jsx(AttributeFilterStatusBar, { ...props, onShowFilteredElements: handleShowFilteredElements, onClearIrrelevantSelection: () => {
                    props.onClearIrrelevantSelection?.();
                    afterClearIrrelevantSelection();
                    userInteraction.attributeFilterInteraction("attributeFilterClearIrrelevantValuesClicked");
                }, enableShowingFilteredElements: enableShowingFilteredElements }));
        }
        return CustomStatusBar;
    };
    const CustomStatusBarComponent = useMemo(() => {
        return createStatusBarComponent({
            filterSelectionMode: filterSelectionMode,
            isApplyAllAtOnceEnabledAndSet,
            supportsShowingFilteredElements: capabilities.supportsShowingFilteredElements ?? false,
            userInteraction,
        });
    }, [
        filterSelectionMode,
        capabilities.supportsShowingFilteredElements,
        userInteraction,
        isApplyAllAtOnceEnabledAndSet,
    ]);
    const AttributeFilterComponent = props.AttributeFilterComponent ?? AttributeFilterButton;
    const filterContent = (_jsx(AttributeFilterComponent, { title: filterTitle, resetOnParentFilterChange: false, filter: isApplyAllAtOnceEnabledAndSet ? workingAttributeFilter : attributeFilter, displayAsLabel: displayAsLabel, overlayPositionType: overlayPositionType, onApply: (newFilter, isInverted, selectionMode, selectionTitles, displayAsLabel, isResultOfMigration, additionalProps) => {
            const isSelectionInvalid = additionalProps?.isSelectionInvalid ?? false;
            const applyToWorkingOnly = additionalProps?.applyToWorkingOnly ?? false;
            // Convert the SDK-level filter to a dashboard filter item.
            // The result may be a text filter (arbitrary/match) after a mode switch.
            const convertedFilter = mergeDashboardAttributeFilterMetadata(filter, attributeFilterToDashboardAttributeFilter(newFilter, filterLocalId, filterTitle, selectionTitles, isInverted, selectionMode));
            if (isApplyAllAtOnceEnabledAndSet) {
                onFilterChanged(convertedFilter, displayAsLabel, true, false, isSelectionInvalid);
            }
            if (!applyToWorkingOnly) {
                onFilterChanged(convertedFilter, displayAsLabel, false, isResultOfMigration, isSelectionInvalid);
            }
        }, onSelect: (newFilter, isInverted, selectionMode, selectionTitles, displayAsLabel, isResultOfMigration, additionalProps) => {
            if (isApplyAllAtOnceEnabledAndSet) {
                // Convert the SDK-level filter to a dashboard filter item.
                // The result may be a text filter (arbitrary/match) after a mode switch.
                const convertedFilter = mergeDashboardAttributeFilterMetadata(filter, attributeFilterToDashboardAttributeFilter(newFilter, filterLocalId, filterTitle, selectionTitles, isInverted, selectionMode));
                onFilterChanged(convertedFilter, displayAsLabel, true, isResultOfMigration, additionalProps?.isSelectionInvalid);
            }
        }, parentFilters: parentFilters, dependentDateFilters: dependentDateFilters, parentFilterOverAttribute: parentFilterOverAttribute, validateElementsBy: filterValidateElementsBy, locale: locale, DropdownButtonComponent: passDropdownButton ? CustomDropdownButton : undefined, DropdownActionsComponent: CustomDropdownActions, ElementsSelectComponent: CustomElementsSelect, TextFilterBodyComponent: CustomTextFilterBody, fullscreenOnMobile: true, selectionMode: filterSelectionMode, selectFirst: true, attributeFilterMode: readonly
            ? DashboardAttributeFilterConfigModeValues.READONLY
            : DashboardAttributeFilterConfigModeValues.ACTIVE, customIcon: visibilityIcon, StatusBarComponent: CustomStatusBarComponent, enableImmediateAttributeFilterDisplayAsLabelMigration: enableImmediateAttributeFilterDisplayAsLabelMigration, withoutApply: isApplyAllAtOnceEnabledAndSet, menuConfig: { availableSelectionTypes, showLabelsSwitch: false }, hideTooltips: !isEditMode, showHeader: showSelectionTypeSection }));
    return (_jsx(AttributeFilterParentFilteringProvider, { filterItem: filter, attributes: attributes, displayAsLabel: displayAsLabel, children: filterContent }));
}
