import { r as registerInstance, h } from './index-CV0Pyo1O.js';
import { c as checkPkgVersion } from './check-pkg-version-D5BxTNyL.js';
import { J as JustifiAnalytics } from './Analytics-C76Y5Pqf.js';
import { w as waitForConfig } from './config-state-kKn89dp1.js';
import { S as StyledHost } from './styled-host-D84RBv1W.js';
import './event-types-CZfYo5-1.js';
import './package-CqcLgdsl.js';
import './Api-BulOmiMS.js';
import './utils-C25uIOK0.js';
import './dinero-HXpYMWUU.js';
import './Plaid-DxSkT8pY.js';
import './Pagination-CLHwhyvu.js';
import './Business-BcNb9bVO.js';
import './index-cDVGjRkU.js';

const JustifiBankAccountForm = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
    }
    async componentWillLoad() {
        await waitForConfig();
        checkPkgVersion();
        this.analytics = new JustifiAnalytics(this);
    }
    disconnectedCallback() {
        var _a;
        (_a = this.analytics) === null || _a === void 0 ? void 0 : _a.cleanup();
    }
    async validate() {
        if (!this.bankAccountFormElement) {
            return false;
        }
        return this.bankAccountFormElement.validate();
    }
    async tokenize({ clientId, paymentMethodMetadata, account }) {
        if (!this.bankAccountFormElement) {
            return {
                error: {
                    message: 'Bank account form is not available.',
                },
            };
        }
        return this.bankAccountFormElement.tokenize({ clientId, paymentMethodMetadata, account });
    }
    render() {
        return (h(StyledHost, { key: '3c8a48f6060f14433ae94399fc48097cb138e301' }, h("bank-account-form", { key: '30cd40b60629f5c7f874194dd7641ee3737e8b69', ref: (el) => (this.bankAccountFormElement = el) })));
    }
};

export { JustifiBankAccountForm as justifi_bank_account_form };
