import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { J as JustifiAnalytics } from './Analytics.js';
import { c as checkPkgVersion } from './check-pkg-version.js';
import { w as waitForConfig } from './config-state.js';
import { S as StyledHost } from './styled-host.js';
import './justifi-details2.js';
import './event-types.js';
import './justifi-radio-list-item2.js';
import { d as defineCustomElement$4 } from './card-form2.js';
import { d as defineCustomElement$3 } from './hidden-input2.js';
import { d as defineCustomElement$2 } from './iframe-input2.js';

const JustifiCardForm$1 = /*@__PURE__*/ proxyCustomElement(class JustifiCardForm extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        this.__attachShadow();
    }
    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() {
        return this.cardFormElement.validate();
    }
    async tokenize({ clientId, paymentMethodMetadata, account, }) {
        return this.cardFormElement.tokenize({ clientId, paymentMethodMetadata, account });
    }
    render() {
        return (h(StyledHost, { key: 'e8591312a00d22c68812fda0b56a125ffd763e01' }, h("card-form", { key: 'e987ea9f3bcd2bf0aa8b2c6749bff3b902f20519', ref: (el) => (this.cardFormElement = el) })));
    }
}, [257, "justifi-card-form", {
        "validate": [64],
        "tokenize": [64]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["justifi-card-form", "card-form", "hidden-input", "iframe-input"];
    components.forEach(tagName => { switch (tagName) {
        case "justifi-card-form":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, JustifiCardForm$1);
            }
            break;
        case "card-form":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "hidden-input":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "iframe-input":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}
defineCustomElement$1();

const JustifiCardForm = JustifiCardForm$1;
const defineCustomElement = defineCustomElement$1;

export { JustifiCardForm, defineCustomElement };
