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

const bpSdkFilterApplicationFormStateContainerCss = "";
const BpSdkFilterApplicationFormStateContainerStyle0 = bpSdkFilterApplicationFormStateContainerCss;

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

export { BpSdkFilterApplicationFormStateContainer as bp_sdk_filter_application_form_state_container };
