import { ButtonComponent } from '@agorapulse/ui-components/button';
import { createDropdownOverlay, DropdownTriggerDirective } from '@agorapulse/ui-components/dropdown-base';
import { CheckboxComponent } from '@agorapulse/ui-components/checkbox';
import { DatepickerMode, InputDatepickerComponent } from '@agorapulse/ui-components/datepicker';
import { provideUiComponentsSymbols } from '@agorapulse/ui-components/providers';
import { RadioComponent } from '@agorapulse/ui-components/radio';
import { ToggleComponent } from '@agorapulse/ui-components/toggle';
import { TooltipDirective } from '@agorapulse/ui-components/tooltip';
import { SymbolComponent, apInfo, apFeatureLock, apReset, apChevronDown as apChevronDown$1, apPlus, apRefresh, withSymbols, apFilter, apFilterFill } from '@agorapulse/ui-symbol';
import { apChevronDown } from '@agorapulse/ui-symbol/icons';
import * as i0 from '@angular/core';
import { signal, computed, Injectable, inject, input, output, Component, ChangeDetectionStrategy, effect, untracked, viewChild } from '@angular/core';
import * as i1 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import { SelectMultipleDirective, SelectSingleDirective, SelectLabelSingleComponent, SelectLabelMultipleComponent, DropdownItemMultipleTwoLinesComponent, DropdownItemMultipleOneLineComponent, DropdownItemSingleOneLineComponent, DropdownItemSingleTwoLinesComponent } from '@agorapulse/ui-components/select';
import { NgSelectComponent, NgOptionTemplateDirective, NgLabelTemplateDirective, NgMultiLabelTemplateDirective } from '@ng-select/ng-select';
import { isEqual } from 'es-toolkit';
import { FormFieldComponent } from '@agorapulse/ui-components/form-field';
import { ActionDropdownComponent } from '@agorapulse/ui-components/action-dropdown';
import { CounterComponent } from '@agorapulse/ui-components/counter';

class FilterState {
    _groups = signal([], ...(ngDevMode ? [{ debugName: "_groups" }] : /* istanbul ignore next */ []));
    // Deep-equal so that re-seeding with equivalent values does not notify downstream effects.
    _draft = signal({}, { ...(ngDevMode ? { debugName: "_draft" } : /* istanbul ignore next */ {}), equal: isEqual });
    _baseline = signal({}, { ...(ngDevMode ? { debugName: "_baseline" } : /* istanbul ignore next */ {}), equal: isEqual });
    activeFilterCount = computed(() => {
        let count = 0;
        for (const key in this._draft()) {
            const value = this._draft()[key];
            if (!value)
                continue;
            switch (value.filterType) {
                case 'checkbox':
                    if (value.selected.length > 0) {
                        count += 1;
                    }
                    break;
                case 'radio':
                    if (value.selected)
                        count += 1;
                    break;
                case 'toggle':
                    if (value.checked)
                        count += 1;
                    break;
                case 'select':
                    if (value.selectionType === 'single' && value.selected) {
                        count += 1;
                    }
                    else if (value.selectionType === 'multiple') {
                        count += value.selected.length > 0 ? 1 : 0;
                    }
                    break;
                case 'date-range':
                    if (value.selectedPeriod)
                        count += 1;
                    break;
            }
        }
        return count;
    }, ...(ngDevMode ? [{ debugName: "activeFilterCount" }] : /* istanbul ignore next */ []));
    groups = this._groups.asReadonly();
    draft = this._draft.asReadonly();
    isFilterCountActive = computed(() => this.activeFilterCount() > 0, ...(ngDevMode ? [{ debugName: "isFilterCountActive" }] : /* istanbul ignore next */ []));
    hasChanges = computed(() => !isEqual(this._draft(), this._baseline()), ...(ngDevMode ? [{ debugName: "hasChanges" }] : /* istanbul ignore next */ []));
    buttonsDisabled = computed(() => !this.hasChanges(), ...(ngDevMode ? [{ debugName: "buttonsDisabled" }] : /* istanbul ignore next */ []));
    /** Refresh the groups schema and (re-)seed the draft + baseline from config defaults. */
    initialize(groups) {
        this._groups.set(groups);
        const seeded = this.buildValues(groups);
        // Equivalent values (e.g. the consumer re-passed what it just received): keep draft + baseline as-is.
        if (isEqual(seeded, this._draft())) {
            return;
        }
        this._draft.set(seeded);
        this._baseline.set(seeded);
    }
    /** Adopt the current draft as the baseline (called on Apply / Save / Update). */
    commit() {
        this._baseline.set({ ...this._draft() });
    }
    buildValues(groups) {
        const values = {};
        for (const group of groups) {
            values[group.key] = this.buildInitialValue(group);
        }
        return values;
    }
    collapseHeader(key) {
        const group = this._groups().find(g => g.key === key);
        if (group) {
            group.expanded = !group.expanded;
            this._groups.update(gs => [...gs]);
        }
    }
    /** Get the draft value for a specific filter key */
    getValue(key) {
        return this._draft()[key];
    }
    /** Update a single filter's draft value */
    updateValue(key, value) {
        this._draft.update(draft => ({ ...draft, [key]: value }));
    }
    /** Toggle a checkbox item in a checkbox filter */
    toggleCheckbox(key, name, checked) {
        const current = this._draft()[key];
        if (current?.filterType !== 'checkbox')
            return;
        const selected = checked ? [...current.selected, name] : current.selected.filter(n => n !== name);
        this.updateValue(key, { filterType: 'checkbox', selected });
    }
    /** Set the selected radio value */
    setRadioValue(key, value) {
        this.updateValue(key, { filterType: 'radio', selected: value });
    }
    /** Set the toggle checked state */
    setToggleValue(key, checked) {
        this.updateValue(key, { filterType: 'toggle', checked });
    }
    /** Set selected indices for a select filter */
    setSingleSelectValue(key, selected) {
        this.updateValue(key, { filterType: 'select', selectionType: 'single', selected });
    }
    setMultipleSelectValue(key, selected) {
        this.updateValue(key, { filterType: 'select', selectionType: 'multiple', selected });
    }
    /** Set the selected period for a date range filter */
    setDateRangeValue(key, selectedPeriod) {
        this.updateValue(key, { filterType: 'date-range', selectedPeriod });
    }
    /** Return the current draft snapshot (used on Apply) */
    getSnapshot() {
        return { ...this._draft() };
    }
    /** Revert the draft to the committed baseline. */
    reset() {
        this._draft.set({ ...this._baseline() });
    }
    /** Clear all draft values to empty/default states */
    clear() {
        const cleared = {};
        for (const group of this._groups()) {
            cleared[group.key] = this.buildEmptyValue(group);
        }
        this._draft.set(cleared);
    }
    buildInitialValue(group) {
        switch (group.filterType) {
            case 'checkbox':
                return {
                    filterType: 'checkbox',
                    selected: group.defaultSelected ?? [],
                };
            case 'radio':
                const firstItem = group.items[0].value;
                return {
                    filterType: 'radio',
                    selected: group.defaultSelected ?? firstItem,
                };
            case 'toggle':
                return {
                    filterType: 'toggle',
                    checked: group.defaultSelected ?? false,
                };
            case 'select':
                if (group.selectionType === 'single') {
                    return {
                        filterType: 'select',
                        selectionType: 'single',
                        selected: group.defaultSelected ? group.defaultSelected : undefined,
                    };
                }
                else {
                    return {
                        filterType: 'select',
                        selectionType: 'multiple',
                        selected: group.defaultSelected ?? [],
                    };
                }
            case 'date-range':
                return {
                    filterType: 'date-range',
                    selectedPeriod: group.selectedPeriod,
                };
        }
    }
    buildEmptyValue(group) {
        switch (group.filterType) {
            case 'checkbox':
                return { filterType: 'checkbox', selected: [] };
            case 'radio':
                return { filterType: 'radio', selected: null };
            case 'toggle':
                return { filterType: 'toggle', checked: false };
            case 'select':
                if (group.selectionType === 'single') {
                    return { filterType: 'select', selectionType: 'single', selected: undefined };
                }
                return { filterType: 'select', selectionType: 'multiple', selected: [] };
            case 'date-range':
                return { filterType: 'date-range', selectedPeriod: undefined };
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
    static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterState });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterState, decorators: [{
            type: Injectable
        }] });

const MULTIPLE_DISPLAY_TYPES = new Set(['tag', 'label']);
class FilterLeafSelectComponent {
    filterState = inject(FilterState);
    item = input.required(...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked = output();
    multipleDisplayType = computed(() => {
        const dt = this.item().displayType;
        return MULTIPLE_DISPLAY_TYPES.has(dt) ? dt : 'label';
    }, ...(ngDevMode ? [{ debugName: "multipleDisplayType" }] : /* istanbul ignore next */ []));
    singleSelectValue = computed(() => {
        const value = this.filterState.getValue(this.item().key);
        return value?.filterType === 'select' && value.selectionType === 'single' ? value.selected : undefined;
    }, ...(ngDevMode ? [{ debugName: "singleSelectValue" }] : /* istanbul ignore next */ []));
    multipleSelectValue = computed(() => {
        const value = this.filterState.getValue(this.item().key);
        return value?.filterType === 'select' && value?.selectionType === 'multiple' ? value.selected : [];
    }, ...(ngDevMode ? [{ debugName: "multipleSelectValue" }] : /* istanbul ignore next */ []));
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterLeafSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: FilterLeafSelectComponent, isStandalone: true, selector: "ap-filter-leaf-select", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { lockedFeatureClicked: "lockedFeatureClicked" }, ngImport: i0, template: "@let selectItem = item();\n<div class=\"ap-filter-leaf__option\">\n    <ap-form-field>\n        @if (selectItem.label) {\n            <label for=\"select-{{ selectItem.key }}\">\n                {{ selectItem.label }}\n            </label>\n        }\n        @if (selectItem.selectionType === 'single') {\n            <ng-select\n                id=\"select-{{ selectItem.key }}\"\n                apSelectSingle\n                bindLabel=\"label\"\n                bindValue=\"value\"\n                [disabled]=\"!!selectItem.featureLocked\"\n                [items]=\"selectItem.items\"\n                [placeholder]=\"selectItem.placeholder ?? 'Select an option'\"\n                [inlineLabel]=\"selectItem.inlineLabel\"\n                [ngModel]=\"singleSelectValue()\"\n                (ngModelChange)=\"filterState.setSingleSelectValue(selectItem.key, $event)\"\n            >\n                <ng-template\n                    let-item=\"item\"\n                    ng-label-tmp>\n                    <ap-select-label-single\n                        [displayType]=\"selectItem.displayType\"\n                        [avatarUrl]=\"item.avatarUrl\"\n                        [network]=\"item.network\"\n                        [label]=\"item.label\" />\n                </ng-template>\n\n                <ng-template\n                    let-item=\"item\"\n                    let-item$=\"item$\"\n                    ng-option-tmp>\n                    @if (item.caption) {\n                        <ap-dropdown-item-single-two-lines\n                            [caption]=\"item$.caption\"\n                            [selected]=\"item$.selected\"\n                            [text]=\"item$.label\"\n                            [avatarUrl]=\"item$.avatarUrl\"\n                            [network]=\"item$.network\"\n                            [symbolId]=\"item$.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    } @else {\n                        <ap-dropdown-item-single-one-line\n                            [selected]=\"item$.selected\"\n                            [text]=\"item.label\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    }\n\n                </ng-template>\n\n            </ng-select>\n        } @else {\n            <ng-select\n                id=\"select-{{ selectItem.key }}\"\n                apSelectMultiple\n                bindLabel=\"label\"\n                bindValue=\"value\"\n                [items]=\"selectItem.items\"\n                [placeholder]=\"selectItem.placeholder ?? 'Select an option'\"\n                [inlineLabel]=\"selectItem.inlineLabel\"\n                [ngModel]=\"multipleSelectValue()\"\n                (ngModelChange)=\"filterState.setMultipleSelectValue(selectItem.key, $event)\">\n                <ng-template\n                    let-items=\"items\"\n                    let-clear=\"clear\"\n                    ng-multi-label-tmp>\n                    <ap-select-label-multiple\n                        bindValue=\"value\"\n                        bindLabel=\"label\"\n                        [displayType]=\"multipleDisplayType()\"\n                        [selectedItems]=\"items\"\n                        (removeItem)=\"clear($event)\"\n                    />\n                </ng-template>\n\n                <ng-template\n                    let-item=\"item\"\n                    let-item$=\"item$\"\n                    ng-option-tmp>\n                    @if (item.caption) {\n                        <ap-dropdown-item-multiple-two-lines\n                            [selected]=\"item$.selected\"\n                            [onlyText]=\"selectItem.onlyText ?? 'Only'\"\n                            [caption]=\"item.caption\"\n                            [text]=\"item.label\"\n                            [htmlId]=\"item$.htmlId\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    } @else {\n                        <ap-dropdown-item-multiple-one-line\n                            [onlyText]=\"selectItem.onlyText ?? 'Only'\"\n                            [selected]=\"item$.selected\"\n                            [htmlId]=\"item$.htmlId\"\n                            [text]=\"item.label\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    }\n                </ng-template>\n            </ng-select>\n        }\n    </ap-form-field>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "dropdownPosition", "appendTo", "outsideClickEvent", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "tabFocusOnClearButton", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "clearKeepsDisabledOptions", "deselectOnClick", "clearSearchOnAdd", "compareWith", "keyDownFn", "popover", "bindLabel", "bindValue", "appearance", "isOpen", "items"], outputs: ["bindLabelChange", "bindValueChange", "appearanceChange", "isOpenChange", "itemsChange", "blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"], exportAs: ["ngSelect"] }, { kind: "directive", type: SelectMultipleDirective, selector: "ng-select[apSelectMultiple]", inputs: ["maxItemsTooltip", "pinnedItemsEnabled"] }, { kind: "directive", type: SelectSingleDirective, selector: "ng-select[apSelectSingle]" }, { kind: "component", type: SelectLabelSingleComponent, selector: "ap-select-label-single", inputs: ["displayType", "label", "avatarUrl", "network", "showAvatarInitials", "roundedAvatar"] }, { kind: "component", type: SelectLabelMultipleComponent, selector: "ap-select-label-multiple", inputs: ["displayType", "tagColor", "selectedItems", "bindLabel", "bindValue", "bindAvatarUrl", "bindSymbolId", "roundedAvatar", "bindNetwork"], outputs: ["removeItem"] }, { kind: "directive", type: NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "component", type: DropdownItemMultipleTwoLinesComponent, selector: "ap-dropdown-item-multiple-two-lines", inputs: ["text", "caption", "selected", "htmlId", "disabled", "avatarUrl", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "onlyEnabled", "onlyText", "isFeatureLocked", "roundedAvatar", "network", "symbolColor", "symbolTooltipText"], outputs: ["selectOnly", "lockedFeatureClicked"] }, { kind: "component", type: DropdownItemMultipleOneLineComponent, selector: "ap-dropdown-item-multiple-one-line", inputs: ["text", "selected", "indeterminate", "htmlId", "disabled", "avatarUrl", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "onlyEnabled", "onlyText", "isFeatureLocked", "roundedAvatar", "network", "symbolColor", "symbolTooltipText"], outputs: ["selectOnly", "selectionChange", "lockedFeatureClicked"] }, { kind: "component", type: DropdownItemSingleOneLineComponent, selector: "ap-dropdown-item-single-one-line", inputs: ["text", "selected", "disabled", "avatarUrl", "showAvatarInitials", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "network", "roundedAvatar", "isFeatureLocked"], outputs: ["lockedFeatureClicked"] }, { kind: "component", type: DropdownItemSingleTwoLinesComponent, selector: "ap-dropdown-item-single-two-lines", inputs: ["text", "caption", "selected", "disabled", "avatarUrl", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "network", "roundedAvatar", "isFeatureLocked"], outputs: ["lockedFeatureClicked"] }, { kind: "directive", type: NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "directive", type: NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]" }, { kind: "component", type: FormFieldComponent, selector: "ap-form-field" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterLeafSelectComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ap-filter-leaf-select', imports: [
                        FormsModule,
                        NgSelectComponent,
                        SelectMultipleDirective,
                        SelectSingleDirective,
                        SelectLabelSingleComponent,
                        SelectLabelMultipleComponent,
                        NgOptionTemplateDirective,
                        DropdownItemMultipleTwoLinesComponent,
                        DropdownItemMultipleOneLineComponent,
                        DropdownItemSingleOneLineComponent,
                        DropdownItemSingleTwoLinesComponent,
                        NgLabelTemplateDirective,
                        NgMultiLabelTemplateDirective,
                        FormFieldComponent,
                    ], template: "@let selectItem = item();\n<div class=\"ap-filter-leaf__option\">\n    <ap-form-field>\n        @if (selectItem.label) {\n            <label for=\"select-{{ selectItem.key }}\">\n                {{ selectItem.label }}\n            </label>\n        }\n        @if (selectItem.selectionType === 'single') {\n            <ng-select\n                id=\"select-{{ selectItem.key }}\"\n                apSelectSingle\n                bindLabel=\"label\"\n                bindValue=\"value\"\n                [disabled]=\"!!selectItem.featureLocked\"\n                [items]=\"selectItem.items\"\n                [placeholder]=\"selectItem.placeholder ?? 'Select an option'\"\n                [inlineLabel]=\"selectItem.inlineLabel\"\n                [ngModel]=\"singleSelectValue()\"\n                (ngModelChange)=\"filterState.setSingleSelectValue(selectItem.key, $event)\"\n            >\n                <ng-template\n                    let-item=\"item\"\n                    ng-label-tmp>\n                    <ap-select-label-single\n                        [displayType]=\"selectItem.displayType\"\n                        [avatarUrl]=\"item.avatarUrl\"\n                        [network]=\"item.network\"\n                        [label]=\"item.label\" />\n                </ng-template>\n\n                <ng-template\n                    let-item=\"item\"\n                    let-item$=\"item$\"\n                    ng-option-tmp>\n                    @if (item.caption) {\n                        <ap-dropdown-item-single-two-lines\n                            [caption]=\"item$.caption\"\n                            [selected]=\"item$.selected\"\n                            [text]=\"item$.label\"\n                            [avatarUrl]=\"item$.avatarUrl\"\n                            [network]=\"item$.network\"\n                            [symbolId]=\"item$.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    } @else {\n                        <ap-dropdown-item-single-one-line\n                            [selected]=\"item$.selected\"\n                            [text]=\"item.label\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    }\n\n                </ng-template>\n\n            </ng-select>\n        } @else {\n            <ng-select\n                id=\"select-{{ selectItem.key }}\"\n                apSelectMultiple\n                bindLabel=\"label\"\n                bindValue=\"value\"\n                [items]=\"selectItem.items\"\n                [placeholder]=\"selectItem.placeholder ?? 'Select an option'\"\n                [inlineLabel]=\"selectItem.inlineLabel\"\n                [ngModel]=\"multipleSelectValue()\"\n                (ngModelChange)=\"filterState.setMultipleSelectValue(selectItem.key, $event)\">\n                <ng-template\n                    let-items=\"items\"\n                    let-clear=\"clear\"\n                    ng-multi-label-tmp>\n                    <ap-select-label-multiple\n                        bindValue=\"value\"\n                        bindLabel=\"label\"\n                        [displayType]=\"multipleDisplayType()\"\n                        [selectedItems]=\"items\"\n                        (removeItem)=\"clear($event)\"\n                    />\n                </ng-template>\n\n                <ng-template\n                    let-item=\"item\"\n                    let-item$=\"item$\"\n                    ng-option-tmp>\n                    @if (item.caption) {\n                        <ap-dropdown-item-multiple-two-lines\n                            [selected]=\"item$.selected\"\n                            [onlyText]=\"selectItem.onlyText ?? 'Only'\"\n                            [caption]=\"item.caption\"\n                            [text]=\"item.label\"\n                            [htmlId]=\"item$.htmlId\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    } @else {\n                        <ap-dropdown-item-multiple-one-line\n                            [onlyText]=\"selectItem.onlyText ?? 'Only'\"\n                            [selected]=\"item$.selected\"\n                            [htmlId]=\"item$.htmlId\"\n                            [text]=\"item.label\"\n                            [avatarUrl]=\"item.avatarUrl\"\n                            [network]=\"item.network\"\n                            [symbolId]=\"item.symbolId\"\n                            [isFeatureLocked]=\"item.featureLocked\"\n                            (lockedFeatureClicked)=\"lockedFeatureClicked.emit(item)\"\n                        />\n                    }\n                </ng-template>\n            </ng-select>\n        }\n    </ap-form-field>\n</div>\n" }]
        }], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], lockedFeatureClicked: [{ type: i0.Output, args: ["lockedFeatureClicked"] }] } });

class FilterLeafComponent {
    DatepickerMode = DatepickerMode;
    filterState = inject(FilterState);
    /** item propagated from FilterDropdownComponent */
    item = input.required(...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
    /** whether the leaf is closable */
    closable = input(true, ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
    isLastLeaf = input(false, ...(ngDevMode ? [{ debugName: "isLastLeaf" }] : /* istanbul ignore next */ []));
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked = output();
    /** Event emitted when a group with locked feature is clicked */
    filterDropdownGroupLockedClicked = output();
    displayLabelInLeaf = computed(() => {
        const item = this.item();
        return item.filterType === 'checkbox' || item.filterType === 'radio' || item.filterType === 'toggle';
    }, ...(ngDevMode ? [{ debugName: "displayLabelInLeaf" }] : /* istanbul ignore next */ []));
    checkboxItem = computed(() => {
        const item = this.item();
        return item.filterType === 'checkbox' ? item : undefined;
    }, ...(ngDevMode ? [{ debugName: "checkboxItem" }] : /* istanbul ignore next */ []));
    radioItem = computed(() => {
        const item = this.item();
        return item.filterType === 'radio' ? item : undefined;
    }, ...(ngDevMode ? [{ debugName: "radioItem" }] : /* istanbul ignore next */ []));
    toggleItem = computed(() => {
        const item = this.item();
        return item.filterType === 'toggle' ? item : undefined;
    }, ...(ngDevMode ? [{ debugName: "toggleItem" }] : /* istanbul ignore next */ []));
    selectItem = computed(() => {
        const item = this.item();
        return item.filterType === 'select' ? item : undefined;
    }, ...(ngDevMode ? [{ debugName: "selectItem" }] : /* istanbul ignore next */ []));
    dateRangeItem = computed(() => {
        const item = this.item();
        return item.filterType === 'date-range' ? item : undefined;
    }, ...(ngDevMode ? [{ debugName: "dateRangeItem" }] : /* istanbul ignore next */ []));
    radioValue = computed(() => {
        const value = this.filterState.getValue(this.item().key);
        return value?.filterType === 'radio' ? value.selected : null;
    }, ...(ngDevMode ? [{ debugName: "radioValue" }] : /* istanbul ignore next */ []));
    checkboxValue = computed(() => {
        const checkboxItem = this.checkboxItem();
        const checkboxValueByKey = {};
        checkboxItem?.items.forEach(item => (checkboxValueByKey[item.name] = false));
        const value = this.filterState.getValue(this.item().key);
        if (value && value.filterType === 'checkbox') {
            value.selected.forEach(item => (checkboxValueByKey[item] = true));
        }
        return checkboxValueByKey;
    }, ...(ngDevMode ? [{ debugName: "checkboxValue" }] : /* istanbul ignore next */ []));
    toggleValue = computed(() => {
        const value = this.filterState.getValue(this.item().key);
        return value?.filterType === 'toggle' ? value.checked : false;
    }, ...(ngDevMode ? [{ debugName: "toggleValue" }] : /* istanbul ignore next */ []));
    dateRangeValue = computed(() => {
        const value = this.filterState.getValue(this.item().key);
        return value?.filterType === 'date-range' ? value.selectedPeriod : { startDate: undefined, endDate: undefined };
    }, ...(ngDevMode ? [{ debugName: "dateRangeValue" }] : /* istanbul ignore next */ []));
    onHeaderClick() {
        if (this.closable() || !this.item().featureLocked) {
            this.filterState.collapseHeader(this.item().key);
        }
        if (this.item().featureLocked) {
            this.filterDropdownGroupLockedClicked.emit(this.item());
        }
    }
    onCheckboxChange(name, checked) {
        this.filterState.toggleCheckbox(this.item().key, name, checked);
    }
    onRadioClick(value) {
        this.filterState.setRadioValue(this.item().key, value);
    }
    onToggleChange(checked) {
        this.filterState.setToggleValue(this.item().key, checked);
    }
    onDateRangeChange(dateRange) {
        this.filterState.setDateRangeValue(this.item().key, dateRange);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterLeafComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: FilterLeafComponent, isStandalone: true, selector: "ap-filter-leaf", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, isLastLeaf: { classPropertyName: "isLastLeaf", publicName: "isLastLeaf", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { lockedFeatureClicked: "lockedFeatureClicked", filterDropdownGroupLockedClicked: "filterDropdownGroupLockedClicked" }, providers: [provideUiComponentsSymbols(apChevronDown, apInfo, apFeatureLock)], ngImport: i0, template: "<div [class.with-border-bottom]=\"!isLastLeaf()\" class=\"ap-filter-leaf\">\n\n    <div\n        (click)=\"onHeaderClick()\"\n        (keyup.enter)=\"onHeaderClick()\"\n        [class.ap-filter-leaf__closable]=\"closable() || item().featureLocked\"\n        [class.ap-filter-leaf__expanded]=\"(!closable() || item().expanded) && (!item().featureLocked || !closable())\"\n        class=\"ap-filter-leaf__header\" tabindex=\"0\">\n        <div class=\"ap-filter-leaf__title\">\n            <span>{{ item().title }}</span>\n            @if (item().tooltipText) {\n                <ap-symbol color=\"light-grey\" symbolId=\"info\" size=\"sm\" [apTooltip]=\"item().tooltipText\" />\n            }\n        </div>\n        @if (item().featureLocked) {\n            <div class=\"ap-filter-leaf__actions\">\n                <ap-symbol color=\"purple\" symbolId=\"feature-lock\" size=\"sm\"\n                           [apTooltip]=\"item().featureLockTooltipText\" />\n            </div>\n        } @else if (closable()) {\n            <div class=\"ap-filter-leaf__actions\" [class.ap-filter-leaf__chevron--rotated]=\"!item().expanded\">\n                <ap-symbol symbolId=\"chevron-up\" size=\"sm\" />\n            </div>\n        }\n    </div>\n\n    @if ((!closable() || item().expanded) && (!item().featureLocked || !closable())) {\n        <div class=\"ap-filter-leaf__content\">\n            @if (item().label && displayLabelInLeaf()) {\n                <span class=\"ap-filter-leaf__label\">{{ item().label }}</span>\n            }\n            @switch (item().filterType) {\n                @case ('checkbox') {\n                    @if (checkboxItem(); as vCheckboxItem) {\n                        @for (option of vCheckboxItem.items; track option.name) {\n                            <div class=\"ap-filter-leaf__option\">\n                                <ap-checkbox\n                                    [name]=\"'checkbox-' + option.name\"\n                                    [checked]=\"checkboxValue()[option.name]\"\n                                    [disabled]=\"!!option.disabled || item().featureLocked\"\n                                    (change)=\"onCheckboxChange(option.name, $event)\"\n                                >\n                                    <span>{{ option.label }}</span>\n                                </ap-checkbox>\n                            </div>\n                        }\n                    }\n                }\n                @case ('radio') {\n                    @if (radioItem(); as vRadioItem) {\n                        @for (option of vRadioItem.items; track option.radioId) {\n                            <div class=\"ap-filter-leaf__option\">\n                                <ap-radio\n                                    [radioId]=\"option.radioId\"\n                                    [value]=\"option.value\"\n                                    [disabled]=\"!!option.disabled || !!item().featureLocked\"\n                                    [name]=\"item().key\"\n                                    [ngModel]=\"radioValue()\"\n                                    (ngModelChange)=\"onRadioClick($event)\"\n                                >\n                                    <span>{{ option.label }}</span>\n                                </ap-radio>\n                            </div>\n                        }\n                    }\n                }\n                @case ('toggle') {\n                    @if (toggleItem(); as vToggleItem) {\n                        <div class=\"ap-filter-leaf__option\">\n                            <ap-toggle\n                                [name]=\"'toggle-' + vToggleItem.item.name\"\n                                [checked]=\"toggleValue()\"\n                                [disabled]=\"vToggleItem.item.disabled || item().featureLocked\"\n                                (change)=\"onToggleChange($event)\"\n                            />\n                            <span class=\"toggle\"\n                                  [class.disabled]=\"vToggleItem.item.disabled || item().featureLocked\">{{ vToggleItem.item.label }}</span>\n                        </div>\n                    }\n                }\n                @case ('select') {\n                    @if (selectItem(); as vSelectItem) {\n                        <ap-filter-leaf-select [item]=\"vSelectItem\"\n                                               (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\" />\n                    }\n                }\n                @case ('date-range') {\n                    @if (dateRangeItem(); as vDateRangeItem) {\n                        <ap-input-datepicker\n                            [disabled]=\"!!item().featureLocked\"\n                            [label]=\"vDateRangeItem.label\"\n                            [mode]=\"DatepickerMode.Range\"\n                            [placeholder]=\"vDateRangeItem.placeholder ?? 'Select date range'\"\n                            [minDate]=\"vDateRangeItem.minDate\"\n                            [maxDate]=\"vDateRangeItem.maxDate\"\n                            [dateFormat]=\"vDateRangeItem.dateFormat ?? 'MMMM DD, YYYY'\"\n                            [selectedPeriod]=\"dateRangeValue()\"\n                            (periodChanged)=\"onDateRangeChange($event)\"\n                        />\n                    }\n                }\n            }\n        </div>\n    }\n\n</div>\n", styles: [".ap-filter-leaf{display:flex;flex-direction:column}.ap-filter-leaf.with-border-bottom{border-bottom:1px solid var(--ref-color-grey-10)}.ap-filter-leaf__header{display:flex;align-items:center;justify-content:space-between;padding:var(--ref-spacing-sm)}.ap-filter-leaf__header.ap-filter-leaf__expanded{padding-bottom:var(--ref-spacing-xs)}.ap-filter-leaf__closable{cursor:pointer}.ap-filter-leaf__title{display:flex;align-items:center;gap:var(--ref-spacing-xxxs);flex:1 0 0;color:var(--ref-color-grey-100);font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-sm)}.ap-filter-leaf__label{color:var(--ref-color-grey-100);font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-regular);line-height:var(--ref-font-line-height-sm)}.ap-filter-leaf__chevron--rotated{transform:rotate(180deg)}.ap-filter-leaf__content{display:flex;flex-direction:column;gap:var(--ref-spacing-xs);padding:0 var(--ref-spacing-sm) var(--ref-spacing-sm)}.ap-filter-leaf__option{display:flex;gap:var(--ref-spacing-xxs);align-items:center;justify-content:flex-start}.ap-filter-leaf__option .toggle{font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}.ap-filter-leaf__option span.disabled{color:var(--ref-color-grey-60)}\n"], dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[apTooltip]", inputs: ["apTooltip", "apTooltipPosition", "apTooltipShowDelay", "apTooltipHideDelay", "apTooltipDuration", "apTooltipDisabled", "apTooltipTruncatedTextOnly", "apTooltipTemplateContext", "apTooltipVirtualScrollElement", "apTooltipTrigger", "apTooltipType", "apTooltipPresentationContext", "apTooltipListItems", "apTooltipShowAvatarCaption"], exportAs: ["apTooltip"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "component", type: CheckboxComponent, selector: "ap-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "disabled", "indeterminate", "checked", "required", "name"], outputs: ["change"] }, { kind: "component", type: RadioComponent, selector: "ap-radio", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "disabled", "labelPosition", "radioId", "formControlName", "value", "required", "name"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ToggleComponent, selector: "ap-toggle", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "labelPosition", "disabled", "checked", "required", "confirm", "confirmMessage", "confirmOk", "confirmCancel", "confirmTitle", "name"], outputs: ["change"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FilterLeafSelectComponent, selector: "ap-filter-leaf-select", inputs: ["item"], outputs: ["lockedFeatureClicked"] }, { kind: "component", type: InputDatepickerComponent, selector: "ap-input-datepicker", inputs: ["mode", "label", "placeholder", "firstDayOfWeek", "locale", "dateFormat", "disabled", "minDate", "maxDate", "selectedDate", "selectedDates", "selectedPeriod", "i18n", "showRanges", "showCustomRangeLabel", "rangesConfig", "showBackdrop", "defaultPosition"], outputs: ["periodChanged", "dateSelected"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterLeafComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ap-filter-leaf', imports: [
                        TooltipDirective,
                        SymbolComponent,
                        CheckboxComponent,
                        RadioComponent,
                        ToggleComponent,
                        FormsModule,
                        FilterLeafSelectComponent,
                        InputDatepickerComponent,
                        SymbolComponent,
                        SymbolComponent,
                    ], providers: [provideUiComponentsSymbols(apChevronDown, apInfo, apFeatureLock)], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class.with-border-bottom]=\"!isLastLeaf()\" class=\"ap-filter-leaf\">\n\n    <div\n        (click)=\"onHeaderClick()\"\n        (keyup.enter)=\"onHeaderClick()\"\n        [class.ap-filter-leaf__closable]=\"closable() || item().featureLocked\"\n        [class.ap-filter-leaf__expanded]=\"(!closable() || item().expanded) && (!item().featureLocked || !closable())\"\n        class=\"ap-filter-leaf__header\" tabindex=\"0\">\n        <div class=\"ap-filter-leaf__title\">\n            <span>{{ item().title }}</span>\n            @if (item().tooltipText) {\n                <ap-symbol color=\"light-grey\" symbolId=\"info\" size=\"sm\" [apTooltip]=\"item().tooltipText\" />\n            }\n        </div>\n        @if (item().featureLocked) {\n            <div class=\"ap-filter-leaf__actions\">\n                <ap-symbol color=\"purple\" symbolId=\"feature-lock\" size=\"sm\"\n                           [apTooltip]=\"item().featureLockTooltipText\" />\n            </div>\n        } @else if (closable()) {\n            <div class=\"ap-filter-leaf__actions\" [class.ap-filter-leaf__chevron--rotated]=\"!item().expanded\">\n                <ap-symbol symbolId=\"chevron-up\" size=\"sm\" />\n            </div>\n        }\n    </div>\n\n    @if ((!closable() || item().expanded) && (!item().featureLocked || !closable())) {\n        <div class=\"ap-filter-leaf__content\">\n            @if (item().label && displayLabelInLeaf()) {\n                <span class=\"ap-filter-leaf__label\">{{ item().label }}</span>\n            }\n            @switch (item().filterType) {\n                @case ('checkbox') {\n                    @if (checkboxItem(); as vCheckboxItem) {\n                        @for (option of vCheckboxItem.items; track option.name) {\n                            <div class=\"ap-filter-leaf__option\">\n                                <ap-checkbox\n                                    [name]=\"'checkbox-' + option.name\"\n                                    [checked]=\"checkboxValue()[option.name]\"\n                                    [disabled]=\"!!option.disabled || item().featureLocked\"\n                                    (change)=\"onCheckboxChange(option.name, $event)\"\n                                >\n                                    <span>{{ option.label }}</span>\n                                </ap-checkbox>\n                            </div>\n                        }\n                    }\n                }\n                @case ('radio') {\n                    @if (radioItem(); as vRadioItem) {\n                        @for (option of vRadioItem.items; track option.radioId) {\n                            <div class=\"ap-filter-leaf__option\">\n                                <ap-radio\n                                    [radioId]=\"option.radioId\"\n                                    [value]=\"option.value\"\n                                    [disabled]=\"!!option.disabled || !!item().featureLocked\"\n                                    [name]=\"item().key\"\n                                    [ngModel]=\"radioValue()\"\n                                    (ngModelChange)=\"onRadioClick($event)\"\n                                >\n                                    <span>{{ option.label }}</span>\n                                </ap-radio>\n                            </div>\n                        }\n                    }\n                }\n                @case ('toggle') {\n                    @if (toggleItem(); as vToggleItem) {\n                        <div class=\"ap-filter-leaf__option\">\n                            <ap-toggle\n                                [name]=\"'toggle-' + vToggleItem.item.name\"\n                                [checked]=\"toggleValue()\"\n                                [disabled]=\"vToggleItem.item.disabled || item().featureLocked\"\n                                (change)=\"onToggleChange($event)\"\n                            />\n                            <span class=\"toggle\"\n                                  [class.disabled]=\"vToggleItem.item.disabled || item().featureLocked\">{{ vToggleItem.item.label }}</span>\n                        </div>\n                    }\n                }\n                @case ('select') {\n                    @if (selectItem(); as vSelectItem) {\n                        <ap-filter-leaf-select [item]=\"vSelectItem\"\n                                               (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\" />\n                    }\n                }\n                @case ('date-range') {\n                    @if (dateRangeItem(); as vDateRangeItem) {\n                        <ap-input-datepicker\n                            [disabled]=\"!!item().featureLocked\"\n                            [label]=\"vDateRangeItem.label\"\n                            [mode]=\"DatepickerMode.Range\"\n                            [placeholder]=\"vDateRangeItem.placeholder ?? 'Select date range'\"\n                            [minDate]=\"vDateRangeItem.minDate\"\n                            [maxDate]=\"vDateRangeItem.maxDate\"\n                            [dateFormat]=\"vDateRangeItem.dateFormat ?? 'MMMM DD, YYYY'\"\n                            [selectedPeriod]=\"dateRangeValue()\"\n                            (periodChanged)=\"onDateRangeChange($event)\"\n                        />\n                    }\n                }\n            }\n        </div>\n    }\n\n</div>\n", styles: [".ap-filter-leaf{display:flex;flex-direction:column}.ap-filter-leaf.with-border-bottom{border-bottom:1px solid var(--ref-color-grey-10)}.ap-filter-leaf__header{display:flex;align-items:center;justify-content:space-between;padding:var(--ref-spacing-sm)}.ap-filter-leaf__header.ap-filter-leaf__expanded{padding-bottom:var(--ref-spacing-xs)}.ap-filter-leaf__closable{cursor:pointer}.ap-filter-leaf__title{display:flex;align-items:center;gap:var(--ref-spacing-xxxs);flex:1 0 0;color:var(--ref-color-grey-100);font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-sm)}.ap-filter-leaf__label{color:var(--ref-color-grey-100);font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-regular);line-height:var(--ref-font-line-height-sm)}.ap-filter-leaf__chevron--rotated{transform:rotate(180deg)}.ap-filter-leaf__content{display:flex;flex-direction:column;gap:var(--ref-spacing-xs);padding:0 var(--ref-spacing-sm) var(--ref-spacing-sm)}.ap-filter-leaf__option{display:flex;gap:var(--ref-spacing-xxs);align-items:center;justify-content:flex-start}.ap-filter-leaf__option .toggle{font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}.ap-filter-leaf__option span.disabled{color:var(--ref-color-grey-60)}\n"] }]
        }], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], isLastLeaf: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLastLeaf", required: false }] }], lockedFeatureClicked: [{ type: i0.Output, args: ["lockedFeatureClicked"] }], filterDropdownGroupLockedClicked: [{ type: i0.Output, args: ["filterDropdownGroupLockedClicked"] }] } });

class FilterDropdownComponent {
    overlay = createDropdownOverlay();
    filterState = inject(FilterState);
    initGroups = effect(() => {
        const groups = this.items();
        untracked(() => {
            if (groups) {
                this.filterState.initialize(groups);
            }
        });
    }, ...(ngDevMode ? [{ debugName: "initGroups" }] : /* istanbul ignore next */ []));
    emitOnValueChange = effect(() => {
        this.filterState.draft(); // track changes to draft
        const needApply = this.needApplyButton();
        untracked(() => {
            if (!needApply) {
                this.applyFilters.emit(this.filterState.getSnapshot());
            }
        });
    }, ...(ngDevMode ? [{ debugName: "emitOnValueChange" }] : /* istanbul ignore next */ []));
    filterGroupTemplate = viewChild('filterGroupTemplate', ...(ngDevMode ? [{ debugName: "filterGroupTemplate" }] : /* istanbul ignore next */ []));
    /**
     * The filter groups to display, with their default/initial selection. Configuration, not a live value
     * binding: update only on external changes — never feed the component's own output back in (apply→items→apply loop).
     */
    items = input(...(ngDevMode ? [undefined, { debugName: "items" }] : /* istanbul ignore next */ []));
    /** Whether the filter needs the apply button to be clicked for applyFilters to emit  */
    needApplyButton = input(true, ...(ngDevMode ? [{ debugName: "needApplyButton" }] : /* istanbul ignore next */ []));
    /** Whether the filter group can be closed (collapsed) by the user. If false, the group will always be expanded and the user won't see a toggle button. */
    closable = input(true, ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
    /** whether the feature to save presets is locked for the org */
    presetsFeatureLocked = input(false, ...(ngDevMode ? [{ debugName: "presetsFeatureLocked" }] : /* istanbul ignore next */ []));
    /** whether the mode is in preset mode */
    savePresetsMode = input(false, ...(ngDevMode ? [{ debugName: "savePresetsMode" }] : /* istanbul ignore next */ []));
    /** whether the user is currently editing presets. Only necessary if savePresetsMode is at true */
    editingPresetsMode = input(false, ...(ngDevMode ? [{ debugName: "editingPresetsMode" }] : /* istanbul ignore next */ []));
    /** Whether to show a backdrop that closes the dropdown when clicked */
    showBackdrop = input(true, ...(ngDevMode ? [{ debugName: "showBackdrop" }] : /* istanbul ignore next */ []));
    /** Default position for the dropdown relative to the trigger element */
    defaultPosition = input('right', ...(ngDevMode ? [{ debugName: "defaultPosition" }] : /* istanbul ignore next */ []));
    saveNewPresetsText = input('Save new presets', ...(ngDevMode ? [{ debugName: "saveNewPresetsText" }] : /* istanbul ignore next */ []));
    saveAsNewPresetText = input('Save as new preset', ...(ngDevMode ? [{ debugName: "saveAsNewPresetText" }] : /* istanbul ignore next */ []));
    savePresetText = input('Save preset', ...(ngDevMode ? [{ debugName: "savePresetText" }] : /* istanbul ignore next */ []));
    updateExistingPresetText = input('Update existing preset', ...(ngDevMode ? [{ debugName: "updateExistingPresetText" }] : /* istanbul ignore next */ []));
    resetFilterText = input('Reset filters', ...(ngDevMode ? [{ debugName: "resetFilterText" }] : /* istanbul ignore next */ []));
    applyFiltersText = input('Apply filters', ...(ngDevMode ? [{ debugName: "applyFiltersText" }] : /* istanbul ignore next */ []));
    clearFilterText = input('Clear filters', ...(ngDevMode ? [{ debugName: "clearFilterText" }] : /* istanbul ignore next */ []));
    /** Emits when the dropdown menu is opened */
    opened = output();
    /** Emits when the dropdown menu is closed */
    closed = output();
    /** Emits when save presets is clicked but is feature locked */
    presetsLockedClicked = output();
    /** Emits when save presets is clicked */
    saveNewPresets = output();
    /** Emits when save presets is clicked */
    updatePresets = output();
    /** Emits when filters are applied */
    applyFilters = output();
    /** Emits when user clicks on clear filter */
    clearFilters = output();
    /** Emits when user clicks on reset filter */
    resetFilters = output();
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked = output();
    /** Event emitted when a group with locked feature is clicked */
    filterDropdownGroupLockedClicked = output();
    isOpen = this.overlay.isOpen;
    savePresetsDropdownItems = computed(() => {
        if (!this.savePresetsMode() || !this.editingPresetsMode())
            return [];
        return [
            {
                name: 'saveAsNewPresets',
                startSymbolId: 'plus',
                label: this.saveAsNewPresetText(),
                dataTrack: 'save-new-preset',
            },
            {
                name: 'updatePresets',
                startSymbolId: 'refresh',
                label: this.updateExistingPresetText(),
                dataTrack: 'update-existing-preset',
            },
        ];
    }, ...(ngDevMode ? [{ debugName: "savePresetsDropdownItems" }] : /* istanbul ignore next */ []));
    /** Opens the dropdown menu at the specified trigger element */
    open(triggerElement) {
        const template = this.filterGroupTemplate();
        if (this.isOpen() || !template)
            return;
        this.overlay.open(template, triggerElement, {
            showBackdrop: this.showBackdrop(),
            defaultPosition: this.defaultPosition(),
            onClose: () => this.close(),
        });
        this.opened.emit();
    }
    /** Closes the dropdown menu and cleans up overlay resources */
    close() {
        if (!this.isOpen())
            return;
        this.overlay.close();
        this.closed.emit();
    }
    /** Toggles the dropdown menu open or closed state */
    toggle(triggerElement) {
        if (this.isOpen()) {
            this.close();
        }
        else {
            this.open(triggerElement);
        }
    }
    onApplyFilters() {
        this.applyFilters.emit(this.filterState.getSnapshot());
        this.filterState.commit();
    }
    onClearFilters() {
        this.filterState.clear();
        this.clearFilters.emit();
    }
    onResetFilters() {
        this.filterState.reset();
        this.resetFilters.emit();
    }
    onSavePresets() {
        if (this.presetsFeatureLocked()) {
            this.presetsLockedClicked.emit();
            return;
        }
        this.saveNewPresets.emit(this.filterState.getSnapshot());
        this.filterState.commit();
    }
    onUpdatePresets() {
        this.updatePresets.emit(this.filterState.getSnapshot());
        this.filterState.commit();
    }
    onActionDropdownItemClick(item) {
        switch (item.name) {
            case 'saveAsNewPresets':
                this.onSavePresets();
                break;
            case 'updatePresets':
                this.onUpdatePresets();
                break;
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: FilterDropdownComponent, isStandalone: true, selector: "ap-filter-dropdown", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, needApplyButton: { classPropertyName: "needApplyButton", publicName: "needApplyButton", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, presetsFeatureLocked: { classPropertyName: "presetsFeatureLocked", publicName: "presetsFeatureLocked", isSignal: true, isRequired: false, transformFunction: null }, savePresetsMode: { classPropertyName: "savePresetsMode", publicName: "savePresetsMode", isSignal: true, isRequired: false, transformFunction: null }, editingPresetsMode: { classPropertyName: "editingPresetsMode", publicName: "editingPresetsMode", isSignal: true, isRequired: false, transformFunction: null }, showBackdrop: { classPropertyName: "showBackdrop", publicName: "showBackdrop", isSignal: true, isRequired: false, transformFunction: null }, defaultPosition: { classPropertyName: "defaultPosition", publicName: "defaultPosition", isSignal: true, isRequired: false, transformFunction: null }, saveNewPresetsText: { classPropertyName: "saveNewPresetsText", publicName: "saveNewPresetsText", isSignal: true, isRequired: false, transformFunction: null }, saveAsNewPresetText: { classPropertyName: "saveAsNewPresetText", publicName: "saveAsNewPresetText", isSignal: true, isRequired: false, transformFunction: null }, savePresetText: { classPropertyName: "savePresetText", publicName: "savePresetText", isSignal: true, isRequired: false, transformFunction: null }, updateExistingPresetText: { classPropertyName: "updateExistingPresetText", publicName: "updateExistingPresetText", isSignal: true, isRequired: false, transformFunction: null }, resetFilterText: { classPropertyName: "resetFilterText", publicName: "resetFilterText", isSignal: true, isRequired: false, transformFunction: null }, applyFiltersText: { classPropertyName: "applyFiltersText", publicName: "applyFiltersText", isSignal: true, isRequired: false, transformFunction: null }, clearFilterText: { classPropertyName: "clearFilterText", publicName: "clearFilterText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed", presetsLockedClicked: "presetsLockedClicked", saveNewPresets: "saveNewPresets", updatePresets: "updatePresets", applyFilters: "applyFilters", clearFilters: "clearFilters", resetFilters: "resetFilters", lockedFeatureClicked: "lockedFeatureClicked", filterDropdownGroupLockedClicked: "filterDropdownGroupLockedClicked" }, providers: [FilterState, provideUiComponentsSymbols(apReset, apChevronDown$1, apPlus, apRefresh, apFeatureLock)], viewQueries: [{ propertyName: "filterGroupTemplate", first: true, predicate: ["filterGroupTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #filterGroupTemplate>\n    <div\n        class=\"ap-filter-dropdown\"\n        role=\"menu\"\n        tabindex=\"-1\"\n        aria-label=\"Filter dropdown\">\n\n        <div class=\"ap-filter-dropdown__content\">\n            @for (item of filterState.groups(); let last = $last; track item.key) {\n                <ap-filter-leaf\n                    [item]=\"item\"\n                    [closable]=\"closable()\"\n                    [isLastLeaf]=\"last\"\n                    (filterDropdownGroupLockedClicked)=\"filterDropdownGroupLockedClicked.emit($event)\"\n                    (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\" />\n            }\n        </div>\n\n        <div class=\"ap-filter-dropdown__footer\">\n            @if (savePresetsMode()) {\n                <div class=\"ap-filter-dropdown__footer--presets\">\n                    @if (!editingPresetsMode() || presetsFeatureLocked()) {\n                        <ap-button\n                            name=\"filter-dropdown-save-preset\"\n                            [config]=\"{ color: 'blue', style: 'stroked-transparent' }\"\n                            [disabled]=\"filterState.buttonsDisabled() && !presetsFeatureLocked()\"\n                            [locked]=\"presetsFeatureLocked()\"\n                            (click)=\"onSavePresets()\">\n                            {{ saveNewPresetsText() }}\n                        </ap-button>\n                    } @else {\n                        <ap-button\n                            name=\"filter-dropdown-edit-presets\"\n                            symbolId=\"chevron-down\"\n                            symbolPosition=\"right\"\n                            [apDropdownTrigger]=\"updatePresetsDropdown\"\n                            [config]=\"{ color: 'blue', style: 'stroked-transparent' }\"\n                            [disabled]=\"filterState.buttonsDisabled()\"\n                        >\n                            {{ savePresetText() }}\n                        </ap-button>\n                    }\n\n                    <ap-button\n                        name=\"filter-dropdown-reset-filters\"\n                        [symbolId]=\"'reset'\"\n                        [symbolPosition]=\"'left'\"\n                        [config]=\"{ color: 'blue', style: 'ghost' }\"\n                        [disabled]=\"filterState.buttonsDisabled()\"\n                        (click)=\"onResetFilters()\">\n                        {{ resetFilterText() }}\n                    </ap-button>\n                </div>\n            } @else {\n                <div class=\"ap-filter-dropdown__footer--apply\">\n                    <ap-button\n                        name=\"filter-dropdown-clear-filters\"\n                        [config]=\"{ color: 'blue', style: 'ghost' }\"\n                        [disabled]=\"filterState.buttonsDisabled()\"\n                        (click)=\"onClearFilters()\">\n                        {{ clearFilterText() }}\n                    </ap-button>\n\n                    @if (needApplyButton()) {\n                        <ap-button\n                            name=\"filter-dropdown-apply-filters\"\n                            [config]=\"{ color: 'blue', style: 'primary' }\"\n                            [disabled]=\"filterState.buttonsDisabled()\"\n                            (click)=\"onApplyFilters()\">\n                            {{ applyFiltersText() }}\n                        </ap-button>\n                    }\n                </div>\n            }\n        </div>\n    </div>\n\n</ng-template>\n\n<ap-action-dropdown\n    #updatePresetsDropdown\n    [items]=\"savePresetsDropdownItems()\"\n    (itemClick)=\"onActionDropdownItemClick($event)\"\n/>\n", styles: [":host{display:none}.ap-filter-dropdown{display:flex;flex-direction:column;width:420px;background-color:var(--comp-action-dropdown-background-color);border-radius:var(--comp-action-dropdown-border-radius);box-shadow:var(--comp-action-dropdown-box-shadow);outline:none;max-height:min(90vh,750px)}.ap-filter-dropdown__footer{padding:var(--ref-spacing-xxs) var(--ref-spacing-sm)}.ap-filter-dropdown__content{overflow-x:hidden;overflow-y:auto}.ap-filter-dropdown__footer{border-top:1px solid var(--comp-action-dropdown-divider-color)}.ap-filter-dropdown__footer--presets{display:flex;justify-content:space-between}.ap-filter-dropdown__footer--apply{display:flex;justify-content:flex-end;gap:var(--ref-spacing-sm)}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: FilterLeafComponent, selector: "ap-filter-leaf", inputs: ["item", "closable", "isLastLeaf"], outputs: ["lockedFeatureClicked", "filterDropdownGroupLockedClicked"] }, { kind: "directive", type: DropdownTriggerDirective, selector: "[apDropdownTrigger]", inputs: ["apDropdownTrigger"] }, { kind: "component", type: ActionDropdownComponent, selector: "ap-action-dropdown", inputs: ["items", "largeModeEnabled", "customWidth", "showBackdrop", "disabled", "defaultPosition"], outputs: ["opened", "closed", "itemClick"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterDropdownComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ap-filter-dropdown', imports: [ButtonComponent, FilterLeafComponent, DropdownTriggerDirective, ActionDropdownComponent], providers: [FilterState, provideUiComponentsSymbols(apReset, apChevronDown$1, apPlus, apRefresh, apFeatureLock)], template: "<ng-template #filterGroupTemplate>\n    <div\n        class=\"ap-filter-dropdown\"\n        role=\"menu\"\n        tabindex=\"-1\"\n        aria-label=\"Filter dropdown\">\n\n        <div class=\"ap-filter-dropdown__content\">\n            @for (item of filterState.groups(); let last = $last; track item.key) {\n                <ap-filter-leaf\n                    [item]=\"item\"\n                    [closable]=\"closable()\"\n                    [isLastLeaf]=\"last\"\n                    (filterDropdownGroupLockedClicked)=\"filterDropdownGroupLockedClicked.emit($event)\"\n                    (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\" />\n            }\n        </div>\n\n        <div class=\"ap-filter-dropdown__footer\">\n            @if (savePresetsMode()) {\n                <div class=\"ap-filter-dropdown__footer--presets\">\n                    @if (!editingPresetsMode() || presetsFeatureLocked()) {\n                        <ap-button\n                            name=\"filter-dropdown-save-preset\"\n                            [config]=\"{ color: 'blue', style: 'stroked-transparent' }\"\n                            [disabled]=\"filterState.buttonsDisabled() && !presetsFeatureLocked()\"\n                            [locked]=\"presetsFeatureLocked()\"\n                            (click)=\"onSavePresets()\">\n                            {{ saveNewPresetsText() }}\n                        </ap-button>\n                    } @else {\n                        <ap-button\n                            name=\"filter-dropdown-edit-presets\"\n                            symbolId=\"chevron-down\"\n                            symbolPosition=\"right\"\n                            [apDropdownTrigger]=\"updatePresetsDropdown\"\n                            [config]=\"{ color: 'blue', style: 'stroked-transparent' }\"\n                            [disabled]=\"filterState.buttonsDisabled()\"\n                        >\n                            {{ savePresetText() }}\n                        </ap-button>\n                    }\n\n                    <ap-button\n                        name=\"filter-dropdown-reset-filters\"\n                        [symbolId]=\"'reset'\"\n                        [symbolPosition]=\"'left'\"\n                        [config]=\"{ color: 'blue', style: 'ghost' }\"\n                        [disabled]=\"filterState.buttonsDisabled()\"\n                        (click)=\"onResetFilters()\">\n                        {{ resetFilterText() }}\n                    </ap-button>\n                </div>\n            } @else {\n                <div class=\"ap-filter-dropdown__footer--apply\">\n                    <ap-button\n                        name=\"filter-dropdown-clear-filters\"\n                        [config]=\"{ color: 'blue', style: 'ghost' }\"\n                        [disabled]=\"filterState.buttonsDisabled()\"\n                        (click)=\"onClearFilters()\">\n                        {{ clearFilterText() }}\n                    </ap-button>\n\n                    @if (needApplyButton()) {\n                        <ap-button\n                            name=\"filter-dropdown-apply-filters\"\n                            [config]=\"{ color: 'blue', style: 'primary' }\"\n                            [disabled]=\"filterState.buttonsDisabled()\"\n                            (click)=\"onApplyFilters()\">\n                            {{ applyFiltersText() }}\n                        </ap-button>\n                    }\n                </div>\n            }\n        </div>\n    </div>\n\n</ng-template>\n\n<ap-action-dropdown\n    #updatePresetsDropdown\n    [items]=\"savePresetsDropdownItems()\"\n    (itemClick)=\"onActionDropdownItemClick($event)\"\n/>\n", styles: [":host{display:none}.ap-filter-dropdown{display:flex;flex-direction:column;width:420px;background-color:var(--comp-action-dropdown-background-color);border-radius:var(--comp-action-dropdown-border-radius);box-shadow:var(--comp-action-dropdown-box-shadow);outline:none;max-height:min(90vh,750px)}.ap-filter-dropdown__footer{padding:var(--ref-spacing-xxs) var(--ref-spacing-sm)}.ap-filter-dropdown__content{overflow-x:hidden;overflow-y:auto}.ap-filter-dropdown__footer{border-top:1px solid var(--comp-action-dropdown-divider-color)}.ap-filter-dropdown__footer--presets{display:flex;justify-content:space-between}.ap-filter-dropdown__footer--apply{display:flex;justify-content:flex-end;gap:var(--ref-spacing-sm)}\n"] }]
        }], propDecorators: { filterGroupTemplate: [{ type: i0.ViewChild, args: ['filterGroupTemplate', { isSignal: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], needApplyButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "needApplyButton", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], presetsFeatureLocked: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetsFeatureLocked", required: false }] }], savePresetsMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "savePresetsMode", required: false }] }], editingPresetsMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editingPresetsMode", required: false }] }], showBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBackdrop", required: false }] }], defaultPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPosition", required: false }] }], saveNewPresetsText: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveNewPresetsText", required: false }] }], saveAsNewPresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveAsNewPresetText", required: false }] }], savePresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "savePresetText", required: false }] }], updateExistingPresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "updateExistingPresetText", required: false }] }], resetFilterText: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetFilterText", required: false }] }], applyFiltersText: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyFiltersText", required: false }] }], clearFilterText: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearFilterText", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], presetsLockedClicked: [{ type: i0.Output, args: ["presetsLockedClicked"] }], saveNewPresets: [{ type: i0.Output, args: ["saveNewPresets"] }], updatePresets: [{ type: i0.Output, args: ["updatePresets"] }], applyFilters: [{ type: i0.Output, args: ["applyFilters"] }], clearFilters: [{ type: i0.Output, args: ["clearFilters"] }], resetFilters: [{ type: i0.Output, args: ["resetFilters"] }], lockedFeatureClicked: [{ type: i0.Output, args: ["lockedFeatureClicked"] }], filterDropdownGroupLockedClicked: [{ type: i0.Output, args: ["filterDropdownGroupLockedClicked"] }] } });

class FilterDropdownButtonComponent {
    // FilterState is provided by the inner FilterDropdownComponent, so read the counter through it.
    filterDropdown = viewChild(FilterDropdownComponent, ...(ngDevMode ? [{ debugName: "filterDropdown" }] : /* istanbul ignore next */ []));
    isFilterCountActive = computed(() => this.filterDropdown()?.filterState.isFilterCountActive() ?? false, ...(ngDevMode ? [{ debugName: "isFilterCountActive" }] : /* istanbul ignore next */ []));
    activeFilterCount = computed(() => this.filterDropdown()?.filterState.activeFilterCount() ?? 0, ...(ngDevMode ? [{ debugName: "activeFilterCount" }] : /* istanbul ignore next */ []));
    /** text of the button, input specific to the button */
    buttonFilterText = input('Filters', ...(ngDevMode ? [{ debugName: "buttonFilterText" }] : /* istanbul ignore next */ []));
    /** input specific to the filter-dropdown */
    /**
     * The filter groups to display, with their default/initial selection. Configuration, not a live value
     * binding: update only on external changes — never feed the component's own output back in (apply→items→apply loop).
     */
    items = input(...(ngDevMode ? [undefined, { debugName: "items" }] : /* istanbul ignore next */ []));
    /** Whether the filter needs the apply button to be clicked for applyFilters to emit  */
    needApplyButton = input(true, ...(ngDevMode ? [{ debugName: "needApplyButton" }] : /* istanbul ignore next */ []));
    /** Whether the filter group can be closed (collapsed) by the user. If false, the group will always be expanded and the user won't see a toggle button. */
    closable = input(true, ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
    /** whether the feature to save presets is locked for the org */
    presetsFeatureLocked = input(false, ...(ngDevMode ? [{ debugName: "presetsFeatureLocked" }] : /* istanbul ignore next */ []));
    /** whether the mode is in preset mode */
    savePresetsMode = input(false, ...(ngDevMode ? [{ debugName: "savePresetsMode" }] : /* istanbul ignore next */ []));
    /** whether the user is currently editing presets. Only necessary if savePresetsMode is at true */
    editingPresetsMode = input(false, ...(ngDevMode ? [{ debugName: "editingPresetsMode" }] : /* istanbul ignore next */ []));
    /** Whether to show a backdrop that closes the dropdown when clicked */
    showBackdrop = input(true, ...(ngDevMode ? [{ debugName: "showBackdrop" }] : /* istanbul ignore next */ []));
    /** Whether the dropdown is disabled and cannot be opened */
    disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
    /** Default position for the dropdown relative to the trigger element */
    defaultPosition = input('right', ...(ngDevMode ? [{ debugName: "defaultPosition" }] : /* istanbul ignore next */ []));
    saveNewPresetsText = input('Save new presets', ...(ngDevMode ? [{ debugName: "saveNewPresetsText" }] : /* istanbul ignore next */ []));
    saveAsNewPresetText = input('Save as new preset', ...(ngDevMode ? [{ debugName: "saveAsNewPresetText" }] : /* istanbul ignore next */ []));
    savePresetText = input('Save preset', ...(ngDevMode ? [{ debugName: "savePresetText" }] : /* istanbul ignore next */ []));
    updateExistingPresetText = input('Update existing preset', ...(ngDevMode ? [{ debugName: "updateExistingPresetText" }] : /* istanbul ignore next */ []));
    resetFilterText = input('Reset filters', ...(ngDevMode ? [{ debugName: "resetFilterText" }] : /* istanbul ignore next */ []));
    applyFiltersText = input('Apply filters', ...(ngDevMode ? [{ debugName: "applyFiltersText" }] : /* istanbul ignore next */ []));
    clearFilterText = input('Clear filters', ...(ngDevMode ? [{ debugName: "clearFilterText" }] : /* istanbul ignore next */ []));
    /** Emits when the dropdown menu is opened */
    opened = output();
    /** Emits when the dropdown menu is closed */
    closed = output();
    /** Emits when save presets is clicked but is feature locked */
    presetsLockedClicked = output();
    /** Emits when save presets is clicked */
    saveNewPresets = output();
    /** Emits when save presets is clicked */
    updatePresets = output();
    /** Emits when filters are applied */
    applyFilters = output();
    /** Emits when user clicks on clear filter */
    clearFilters = output();
    /** Emits when user clicks on reset filter */
    resetFilters = output();
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked = output();
    /** Event emitted when a group with locked feature is clicked */
    filterDropdownGroupLockedClicked = output();
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterDropdownButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: FilterDropdownButtonComponent, isStandalone: true, selector: "ap-filter-dropdown-button", inputs: { buttonFilterText: { classPropertyName: "buttonFilterText", publicName: "buttonFilterText", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, needApplyButton: { classPropertyName: "needApplyButton", publicName: "needApplyButton", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, presetsFeatureLocked: { classPropertyName: "presetsFeatureLocked", publicName: "presetsFeatureLocked", isSignal: true, isRequired: false, transformFunction: null }, savePresetsMode: { classPropertyName: "savePresetsMode", publicName: "savePresetsMode", isSignal: true, isRequired: false, transformFunction: null }, editingPresetsMode: { classPropertyName: "editingPresetsMode", publicName: "editingPresetsMode", isSignal: true, isRequired: false, transformFunction: null }, showBackdrop: { classPropertyName: "showBackdrop", publicName: "showBackdrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, defaultPosition: { classPropertyName: "defaultPosition", publicName: "defaultPosition", isSignal: true, isRequired: false, transformFunction: null }, saveNewPresetsText: { classPropertyName: "saveNewPresetsText", publicName: "saveNewPresetsText", isSignal: true, isRequired: false, transformFunction: null }, saveAsNewPresetText: { classPropertyName: "saveAsNewPresetText", publicName: "saveAsNewPresetText", isSignal: true, isRequired: false, transformFunction: null }, savePresetText: { classPropertyName: "savePresetText", publicName: "savePresetText", isSignal: true, isRequired: false, transformFunction: null }, updateExistingPresetText: { classPropertyName: "updateExistingPresetText", publicName: "updateExistingPresetText", isSignal: true, isRequired: false, transformFunction: null }, resetFilterText: { classPropertyName: "resetFilterText", publicName: "resetFilterText", isSignal: true, isRequired: false, transformFunction: null }, applyFiltersText: { classPropertyName: "applyFiltersText", publicName: "applyFiltersText", isSignal: true, isRequired: false, transformFunction: null }, clearFilterText: { classPropertyName: "clearFilterText", publicName: "clearFilterText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed", presetsLockedClicked: "presetsLockedClicked", saveNewPresets: "saveNewPresets", updatePresets: "updatePresets", applyFilters: "applyFilters", clearFilters: "clearFilters", resetFilters: "resetFilters", lockedFeatureClicked: "lockedFeatureClicked", filterDropdownGroupLockedClicked: "filterDropdownGroupLockedClicked" }, providers: [withSymbols(apFilter, apFilterFill)], viewQueries: [{ propertyName: "filterDropdown", first: true, predicate: FilterDropdownComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<ap-button\n    [apDropdownTrigger]=\"filterDropdown\"\n    [config]=\"{ style: 'stroked', color: isFilterCountActive() ? 'blue' : 'grey' }\"\n    ariaLabel=\"Button toggling filters\"\n    name=\"toggle-filter\"\n    symbolPosition=\"left\">\n    <ap-symbol [symbolId]=\"isFilterCountActive() ? 'filter_fill' : 'filter'\" />\n    @if (isFilterCountActive()) {\n        <ap-counter\n            size=\"big\"\n            color=\"blue\"\n            [background]=\"true\">\n            {{ activeFilterCount() }}\n        </ap-counter>\n    }\n    {{ buttonFilterText() }}\n</ap-button>\n\n<ap-filter-dropdown\n    #filterDropdown\n    [presetsFeatureLocked]=\"presetsFeatureLocked()\"\n    [applyFiltersText]=\"applyFiltersText()\"\n    [clearFilterText]=\"clearFilterText()\"\n    [closable]=\"closable()\"\n    [defaultPosition]=\"defaultPosition()\"\n    [editingPresetsMode]=\"editingPresetsMode()\"\n    [items]=\"items()\"\n    [needApplyButton]=\"needApplyButton()\"\n    [resetFilterText]=\"resetFilterText()\"\n    [saveAsNewPresetText]=\"saveAsNewPresetText()\"\n    [saveNewPresetsText]=\"saveNewPresetsText()\"\n    [savePresetText]=\"savePresetText()\"\n    [savePresetsMode]=\"savePresetsMode()\"\n    [showBackdrop]=\"showBackdrop()\"\n    (applyFilters)=\"applyFilters.emit($event)\"\n    (clearFilters)=\"clearFilters.emit()\"\n    (closed)=\"closed.emit()\"\n    (filterDropdownGroupLockedClicked)=\"filterDropdownGroupLockedClicked.emit($event)\"\n    (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\"\n    (opened)=\"opened.emit()\"\n    (presetsLockedClicked)=\"presetsLockedClicked.emit()\"\n    (resetFilters)=\"resetFilters.emit()\"\n    (saveNewPresets)=\"saveNewPresets.emit($event)\"\n    (updatePresets)=\"updatePresets.emit($event)\"\n    [updateExistingPresetText]=\"updateExistingPresetText()\" />\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "directive", type: DropdownTriggerDirective, selector: "[apDropdownTrigger]", inputs: ["apDropdownTrigger"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "component", type: FilterDropdownComponent, selector: "ap-filter-dropdown", inputs: ["items", "needApplyButton", "closable", "presetsFeatureLocked", "savePresetsMode", "editingPresetsMode", "showBackdrop", "defaultPosition", "saveNewPresetsText", "saveAsNewPresetText", "savePresetText", "updateExistingPresetText", "resetFilterText", "applyFiltersText", "clearFilterText"], outputs: ["opened", "closed", "presetsLockedClicked", "saveNewPresets", "updatePresets", "applyFilters", "clearFilters", "resetFilters", "lockedFeatureClicked", "filterDropdownGroupLockedClicked"] }, { kind: "component", type: CounterComponent, selector: "ap-counter", inputs: ["color", "size", "notif", "background", "role"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: FilterDropdownButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ap-filter-dropdown-button', imports: [ButtonComponent, DropdownTriggerDirective, SymbolComponent, FilterDropdownComponent, CounterComponent], providers: [withSymbols(apFilter, apFilterFill)], template: "<ap-button\n    [apDropdownTrigger]=\"filterDropdown\"\n    [config]=\"{ style: 'stroked', color: isFilterCountActive() ? 'blue' : 'grey' }\"\n    ariaLabel=\"Button toggling filters\"\n    name=\"toggle-filter\"\n    symbolPosition=\"left\">\n    <ap-symbol [symbolId]=\"isFilterCountActive() ? 'filter_fill' : 'filter'\" />\n    @if (isFilterCountActive()) {\n        <ap-counter\n            size=\"big\"\n            color=\"blue\"\n            [background]=\"true\">\n            {{ activeFilterCount() }}\n        </ap-counter>\n    }\n    {{ buttonFilterText() }}\n</ap-button>\n\n<ap-filter-dropdown\n    #filterDropdown\n    [presetsFeatureLocked]=\"presetsFeatureLocked()\"\n    [applyFiltersText]=\"applyFiltersText()\"\n    [clearFilterText]=\"clearFilterText()\"\n    [closable]=\"closable()\"\n    [defaultPosition]=\"defaultPosition()\"\n    [editingPresetsMode]=\"editingPresetsMode()\"\n    [items]=\"items()\"\n    [needApplyButton]=\"needApplyButton()\"\n    [resetFilterText]=\"resetFilterText()\"\n    [saveAsNewPresetText]=\"saveAsNewPresetText()\"\n    [saveNewPresetsText]=\"saveNewPresetsText()\"\n    [savePresetText]=\"savePresetText()\"\n    [savePresetsMode]=\"savePresetsMode()\"\n    [showBackdrop]=\"showBackdrop()\"\n    (applyFilters)=\"applyFilters.emit($event)\"\n    (clearFilters)=\"clearFilters.emit()\"\n    (closed)=\"closed.emit()\"\n    (filterDropdownGroupLockedClicked)=\"filterDropdownGroupLockedClicked.emit($event)\"\n    (lockedFeatureClicked)=\"lockedFeatureClicked.emit($event)\"\n    (opened)=\"opened.emit()\"\n    (presetsLockedClicked)=\"presetsLockedClicked.emit()\"\n    (resetFilters)=\"resetFilters.emit()\"\n    (saveNewPresets)=\"saveNewPresets.emit($event)\"\n    (updatePresets)=\"updatePresets.emit($event)\"\n    [updateExistingPresetText]=\"updateExistingPresetText()\" />\n" }]
        }], propDecorators: { filterDropdown: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FilterDropdownComponent), { isSignal: true }] }], buttonFilterText: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonFilterText", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], needApplyButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "needApplyButton", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], presetsFeatureLocked: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetsFeatureLocked", required: false }] }], savePresetsMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "savePresetsMode", required: false }] }], editingPresetsMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editingPresetsMode", required: false }] }], showBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBackdrop", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], defaultPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPosition", required: false }] }], saveNewPresetsText: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveNewPresetsText", required: false }] }], saveAsNewPresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveAsNewPresetText", required: false }] }], savePresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "savePresetText", required: false }] }], updateExistingPresetText: [{ type: i0.Input, args: [{ isSignal: true, alias: "updateExistingPresetText", required: false }] }], resetFilterText: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetFilterText", required: false }] }], applyFiltersText: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyFiltersText", required: false }] }], clearFilterText: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearFilterText", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], presetsLockedClicked: [{ type: i0.Output, args: ["presetsLockedClicked"] }], saveNewPresets: [{ type: i0.Output, args: ["saveNewPresets"] }], updatePresets: [{ type: i0.Output, args: ["updatePresets"] }], applyFilters: [{ type: i0.Output, args: ["applyFilters"] }], clearFilters: [{ type: i0.Output, args: ["clearFilters"] }], resetFilters: [{ type: i0.Output, args: ["resetFilters"] }], lockedFeatureClicked: [{ type: i0.Output, args: ["lockedFeatureClicked"] }], filterDropdownGroupLockedClicked: [{ type: i0.Output, args: ["filterDropdownGroupLockedClicked"] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { FilterDropdownButtonComponent, FilterDropdownComponent };
//# sourceMappingURL=agorapulse-ui-components-filter-dropdown.mjs.map
