import { r as registerInstance, h } from './index-77a9c9e7.js';

const bpSdkQuoteRequestProductCss = "";
const BpSdkQuoteRequestProductStyle0 = bpSdkQuoteRequestProductCss;

const BpSdkQuoteRequestProduct = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.limits = [];
        this.name = undefined;
        this.vehicles = [];
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-quote-request-product');
        customElements.whenDefined('bp-sdk-external-quote-request-product').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-quote-request-product", { limits: this.limits, name: this.name, vehicles: this.vehicles });
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-quote-request-product__container" }, h("div", { class: "bp-sdk-online-quote__product bp-sdk-quote__product" }, h("h2", { class: "bp-sdk-online-quote__product-name bp-sdk-quote__product-name" }, this.name), h("div", { class: "bp-sdk-online-quote__coverages bp-sdk-quote__coverages" }, h("div", null, h("bp-sdk-quote-request-coverage-list", { coverages: this.limits }), h("bp-sdk-quote-request-vehicle-coverage", { vehicles: this.vehicles }), this.name === 'Commercial Auto' && (h("div", { class: "bp-sdk-quote__coverages-disclaimer-text-container" }, h("span", { class: "bp-sdk-quote__coverages-disclaimer-text" }, "*Coverages differ by state. Any coverage legally required in your state is applied to this quote."))))))));
    }
};
BpSdkQuoteRequestProduct.style = BpSdkQuoteRequestProductStyle0;

const bpSdkQuoteRequestProductContainerCss = "";
const BpSdkQuoteRequestProductContainerStyle0 = bpSdkQuoteRequestProductContainerCss;

const BpSdkQuoteRequestProductContainer = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.product = undefined;
        this.useExternal = false;
        this.limits = [];
        this.vehicles = [];
        this.name = undefined;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-quote-request-product-container');
        customElements.whenDefined('bp-sdk-external-quote-request-product-container').then(() => {
            this.useExternal = true;
        });
        this.onProductChange(this.product);
    }
    onProductChange(product) {
        var _a, _b;
        this.limits = this.getLimit(product);
        this.name = product === null || product === void 0 ? void 0 : product.name;
        this.vehicles = (_b = (_a = product === null || product === void 0 ? void 0 : product.coverage) === null || _a === void 0 ? void 0 : _a.vehicles) !== null && _b !== void 0 ? _b : [];
    }
    getLimit(product) {
        var _a, _b, _c, _d;
        return ((_d = (!!((_b = (_a = product === null || product === void 0 ? void 0 : product.coverage) === null || _a === void 0 ? void 0 : _a.limit_and_deductible) === null || _b === void 0 ? void 0 : _b.length)
            ? product.coverage.limit_and_deductible
            : (_c = product === null || product === void 0 ? void 0 : product.coverage) === null || _c === void 0 ? void 0 : _c.limit_and_deductible_default)) !== null && _d !== void 0 ? _d : []);
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-quote-request-product-container", { product: this.product });
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-quote-request-product-container__container" }, h("bp-sdk-quote-request-product", { limits: this.limits, name: this.name, vehicles: this.vehicles })));
    }
    static get watchers() { return {
        "product": ["onProductChange"]
    }; }
};
BpSdkQuoteRequestProductContainer.style = BpSdkQuoteRequestProductContainerStyle0;

const bpSdkQuoteRequestVehicleCoverageCss = "";
const BpSdkQuoteRequestVehicleCoverageStyle0 = bpSdkQuoteRequestVehicleCoverageCss;

const BpSdkQuoteRequestVehicleCoverage = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.vehicles = [];
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-quote-request-vehicle-coverage');
        customElements.whenDefined('bp-sdk-external-quote-request-vehicle-coverage').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-quote-request-vehicle-coverage", { vehicles: this.vehicles });
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-quote-request-vehicle-coverage__container" }, this.vehicles.map((vehicle) => (h("div", { class: "bp-sdk-online-quote__coverages-vehicle-coverage__item bp-sdk-quote__coverages-vehicle-coverage__item" }, h("div", { class: "bp-sdk-online-quote__coverages-vehicle-description-container bp-sdk-quote__coverages-vehicle-description-container" }, h("span", { class: "bp-sdk-online-quote__coverages-vehicle-description bp-sdk-quote__coverages-vehicle-description" }, `${vehicle.year} ${vehicle.make} ${vehicle.model}`)), h("bp-sdk-quote-request-coverage-list", { coverages: vehicle.limit_and_deductible }))))));
    }
};
BpSdkQuoteRequestVehicleCoverage.style = BpSdkQuoteRequestVehicleCoverageStyle0;

export { BpSdkQuoteRequestProduct as bp_sdk_quote_request_product, BpSdkQuoteRequestProductContainer as bp_sdk_quote_request_product_container, BpSdkQuoteRequestVehicleCoverage as bp_sdk_quote_request_vehicle_coverage };
