import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { C as CardBrandLabels } from './payment-method-option-utils.js';
import { u as radioListItem } from './parts.js';
import { d as defineCustomElement$3 } from './form-control-help-text3.js';
import { d as defineCustomElement$2 } from './form-control-radio2.js';

const JustifiSavedPaymentMethod$1 = /*@__PURE__*/ proxyCustomElement(class JustifiSavedPaymentMethod extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        this.paymentMethodOptionSelected = createEvent(this, "paymentMethodOptionSelected", 7);
        this.onPaymentMethodOptionClick = (e) => {
            e.preventDefault();
            this.paymentMethodOptionSelected.emit(this.paymentMethodOption);
        };
    }
    async resolvePaymentMethod(insuranceValidation) {
        var _a;
        if (!insuranceValidation.isValid) {
            return { validationError: true };
        }
        return { token: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id };
    }
    ;
    render() {
        var _a, _b, _c;
        return (h(Host, { key: '66b8725a684241fc105d182ee5982167b2007506', class: "payment-method" }, h("div", { key: 'd0370f70b880f6a83b18eaeeefce7b8fde342ce9', class: "radio-list-item p-3", part: radioListItem, onClick: this.onPaymentMethodOptionClick }, h("form-control-radio", { key: '76ed425815f77082ba1145aa2df04beef6044e07', name: "paymentMethodType", value: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id, checked: this.isSelected, label: `${CardBrandLabels[(_b = this.paymentMethodOption) === null || _b === void 0 ? void 0 : _b.brand] || ''} *${(_c = this.paymentMethodOption) === null || _c === void 0 ? void 0 : _c.acct_last_four}` }))));
    }
}, [256, "justifi-saved-payment-method", {
        "paymentMethodOption": [16],
        "isSelected": [4, "is-selected"],
        "resolvePaymentMethod": [64]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["justifi-saved-payment-method", "form-control-help-text", "form-control-radio"];
    components.forEach(tagName => { switch (tagName) {
        case "justifi-saved-payment-method":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, JustifiSavedPaymentMethod$1);
            }
            break;
        case "form-control-help-text":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "form-control-radio":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}
defineCustomElement$1();

const JustifiSavedPaymentMethod = JustifiSavedPaymentMethod$1;
const defineCustomElement = defineCustomElement$1;

export { JustifiSavedPaymentMethod, defineCustomElement };
