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

const bpSdkFilterRemoteApplicationFormStateContainerCss = "";
const BpSdkFilterRemoteApplicationFormStateContainerStyle0 = bpSdkFilterRemoteApplicationFormStateContainerCss;

const BpSdkFilterRemoteApplicationFormStateContainer = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.handleSubscriptions = () => {
            this.storeUnsubscribe && this.storeUnsubscribe();
            this.storeUnsubscribe = store.mapStateToProps(this, this.mapStateToProps);
        };
        this.mapStateToProps = (state) => {
            return {
                state: lR(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-remote-application-form-state-container');
        customElements.whenDefined('bp-sdk-external-filter-remote-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-remote-application-form-state-container", { state: this.state, targetState: this.targetState });
    }
    renderInternal() {
        return (this.targetState === this.state && (h("div", { class: "bp-sdk-filter-remote-application-form-state-container__container" }, h("host", null))));
    }
};
BpSdkFilterRemoteApplicationFormStateContainer.style = BpSdkFilterRemoteApplicationFormStateContainerStyle0;

export { BpSdkFilterRemoteApplicationFormStateContainer as bp_sdk_filter_remote_application_form_state_container };
