let instance;
const instanceKey = 'data_3929942';

class MobileFiltersUI {

    _isOpen = false;

    constructor(key) {
        if (key !== instanceKey) {
            throw new Error('Cannot instantiate like this');
        }
    }

    show() {
        this._isOpen = true;
        jQuery('.fusecommerce-filters-background').addClass('active');
        jQuery('body').addClass('no-scroll');
        setTimeout(() => {
            jQuery('.fusecommerce-filters-content').addClass('show');
        }, 100)
    }

    hide() {
        this._isOpen = false;
        jQuery('.fusecommerce-filters-content').removeClass('show');
        setTimeout(() => {
            jQuery('.fusecommerce-filters-background').removeClass('active');
            jQuery('body').removeClass('no-scroll');
        }, 250)
    }

    isOpen() {
        return jQuery('.fusecommerce-filters-background').hasClass('active');
    }

    isMobileFilters() {
        const isBelowMd = window.matchMedia('(max-width: 767px)').matches;
        return isBelowMd;
    }

    static getInstance() {
        if (!instance) {
            instance = new MobileFiltersUI(instanceKey);
        }
        return instance;
    }
}
export default MobileFiltersUI;