import { withoutDefaults } from '@wix/bex-core';
import { cairoFiltersPanelUsed } from '@wix/bex-core/bi';
import { action, makeObservable, observable } from 'mobx';
export class FiltersPanelState {
    constructor(params) {
        this.searchValue = '';
        this.onCloseButtonClick = action(async () => {
            const { reportBi, panels, pendingQuery } = this.toolbar;
            const result = await pendingQuery?.onCloseFiltersPanelClick();
            if (result === 'dismissed') {
                return;
            }
            this.clearSearch();
            panels.closeSidePanel();
            reportBi(withoutDefaults(cairoFiltersPanelUsed)({
                ...this.toolbar._commonDynamicBiParams(),
                origin: 'X Button',
                isOpened: false,
                feature: 'Filter',
            }));
        });
        this.toolbar = params.toolbar;
        makeObservable(this, {
            searchValue: observable.ref,
            setSearchValue: action.bound,
            clearSearch: action.bound,
        });
    }
    setSearchValue(value) {
        this.searchValue = value;
    }
    clearSearch() {
        this.searchValue = '';
    }
}
//# sourceMappingURL=FiltersPanelState.js.map