import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { P as PAYMENT_METHODS } from './ModularCheckout.js';
import { d as defineCustomElement$7 } from './bank-account-billing-form-simple2.js';
import { d as defineCustomElement$6 } from './billing-form-full2.js';
import { d as defineCustomElement$5 } from './card-billing-form-simple2.js';
import { d as defineCustomElement$4 } from './custom-popper2.js';
import { d as defineCustomElement$3 } from './form-control-select2.js';
import { d as defineCustomElement$2 } from './form-control-text2.js';
import { d as defineCustomElement$1 } from './form-control-tooltip2.js';

const BillingForm = /*@__PURE__*/ proxyCustomElement(class BillingForm extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
    }
    get showSimpleCardBillingForm() {
        return this.paymentMethodType === PAYMENT_METHODS.NEW_CARD && this.hideCardBillingForm;
    }
    get showSimpleBankAccountBillingForm() {
        return this.paymentMethodType === PAYMENT_METHODS.NEW_BANK_ACCOUNT && this.hideBankAccountBillingForm;
    }
    async getValues() {
        var _a;
        return (_a = this.selectedFormRef) === null || _a === void 0 ? void 0 : _a.getValues();
    }
    async validate() {
        var _a;
        return (_a = this.selectedFormRef) === null || _a === void 0 ? void 0 : _a.validate();
    }
    render() {
        if (this.showSimpleBankAccountBillingForm) {
            return (h(Host, null, h("bank-account-billing-form-simple", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
        }
        if (this.showSimpleCardBillingForm) {
            return (h(Host, null, h("card-billing-form-simple", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
        }
        return (h(Host, null, h("billing-form-full", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
    }
}, [256, "billing-form", {
        "legend": [1025],
        "hideCardBillingForm": [4, "hide-card-billing-form"],
        "hideBankAccountBillingForm": [4, "hide-bank-account-billing-form"],
        "paymentMethodType": [1, "payment-method-type"],
        "getValues": [64],
        "validate": [64]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["billing-form", "bank-account-billing-form-simple", "billing-form-full", "card-billing-form-simple", "custom-popper", "form-control-select", "form-control-text", "form-control-tooltip"];
    components.forEach(tagName => { switch (tagName) {
        case "billing-form":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, BillingForm);
            }
            break;
        case "bank-account-billing-form-simple":
            if (!customElements.get(tagName)) {
                defineCustomElement$7();
            }
            break;
        case "billing-form-full":
            if (!customElements.get(tagName)) {
                defineCustomElement$6();
            }
            break;
        case "card-billing-form-simple":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "custom-popper":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "form-control-select":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "form-control-text":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "form-control-tooltip":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}
defineCustomElement();

export { BillingForm as B, defineCustomElement as d };
