import { r as registerInstance, h } from './index-77a9c9e7.js';
import { s as store } from './redux-store.service-dc54f48e.js';
import './index.esm.min-db2d29e8.js';

const bpSdkFilterContainerCss = "";
const BpSdkFilterContainerStyle0 = bpSdkFilterContainerCss;

const BpSdkFilterContainer = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.handleSubscriptions = () => {
            this.storeUnsubscribe && this.storeUnsubscribe();
            this.storeUnsubscribe = store.mapStateToProps(this, this.mapStateToProps);
        };
        this.mapStateToProps = (state) => {
            return {
                isHidden: !!(this.filter && this.filter(state)),
            };
        };
        this.filter = undefined;
        this.isHidden = false;
        this.useExternal = false;
    }
    resetState() { }
    onFilterChange() {
        this.handleSubscriptions();
    }
    connectedCallback() {
        this.resetState();
        this.handleSubscriptions();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-filter-container');
        customElements.whenDefined('bp-sdk-external-filter-container').then(() => {
            this.useExternal = true;
        });
        this.onFilterChange();
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-filter-container", { filter: this.filter, isHidden: this.isHidden });
    }
    renderInternal() {
        return (!this.isHidden && (h("div", { class: "bp-sdk-filter-container__container" }, h("host", null))));
    }
    static get watchers() { return {
        "filter": ["onFilterChange"]
    }; }
};
BpSdkFilterContainer.style = BpSdkFilterContainerStyle0;

export { BpSdkFilterContainer as bp_sdk_filter_container };
