'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-ceff47a0.js');
const index_esm_min = require('./index.esm.min-f57d151c.js');
const reduxStore_service = require('./redux-store.service-10b7725a.js');

const bpSdkFilterRemoteApplicationFormStateContainerCss = "";
const BpSdkFilterRemoteApplicationFormStateContainerStyle0 = bpSdkFilterRemoteApplicationFormStateContainerCss;

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

exports.bp_sdk_filter_remote_application_form_state_container = BpSdkFilterRemoteApplicationFormStateContainer;
