import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { c as createStore } from './index4.js';
import { d as defineCustomElement$3 } from './pn-product-card2.js';
import { d as defineCustomElement$2 } from './pn-product-tile-info2.js';
import { d as defineCustomElement$1 } from './pn-product-tile-price2.js';

// Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
const { state, onChange } = createStore({
    i18n: {
        componentheading: '',
        deliveryscopeheading: '',
        sizeheading: '',
        resultlistheading: '',
        weightlabel: '',
        maxweightlabel: '',
        maxmeasurementlabel: '',
        senddirectcta: '',
        stampshopcta: '',
    },
    market: {
        currency: '',
    },
});

const pnFindServiceAndPriceResultCss = "pn-button-dropdown .pn-button-dropdown>pn-button>.pn-button{min-height:initial}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}@media screen and (max-width: 767px){.sr-only-mobile{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}}";
const PnFindServiceAndPriceResultStyle0 = pnFindServiceAndPriceResultCss;

const PnfindServiceAndPriceResult = /*@__PURE__*/ proxyCustomElement(class PnfindServiceAndPriceResult extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.item = null;
        this.shownitems = [];
        this.weightText = '';
    }
    componentWillLoad() {
        this.composeItems();
    }
    composeItems() {
        this.shownitems = [this.item];
        // this.shownitems = [];
        // if (this.item.pricestamps) {
        //   this.shownitems.push({...this.item, priceagent: null, pricesenddirect: null});
        // }
        // if (this.item.priceagent) {
        //   this.shownitems.push({...this.item, pricestamps: null, pricesenddirect: null});
        // }
        // if (this.item.pricesenddirect) {
        //   this.shownitems.push({...this.item, pricestamps: null, priceagent: null});
        // }
        // Parcels are always in KG. Letter KG must be converted from grams
        // this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
        // (this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight/1000) + " kg" : this.item.maxweight + " g";
    }
    render() {
        return (h(Host, { key: 'bf4e52c4adcba72ffeb9063b1fd30dafe6fa39eb' }, this.shownitems.map(item => (h("pn-product-card", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), item.description ? h("div", { class: "description" }, item.description) : null, item.info ? h("div", { class: "description" }, item.info) : null)), item.maxweight ? h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText }) : null, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null, item.pricesenddirect ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null)))));
    }
    static get watchers() { return {
        "item": ["composeItems"]
    }; }
    static get style() { return PnFindServiceAndPriceResultStyle0; }
}, [0, "pn-find-service-and-price-result", {
        "item": [1040],
        "shownitems": [16],
        "weightText": [32]
    }, undefined, {
        "item": ["composeItems"]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["pn-find-service-and-price-result", "pn-product-card", "pn-product-tile-info", "pn-product-tile-price"];
    components.forEach(tagName => { switch (tagName) {
        case "pn-find-service-and-price-result":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, PnfindServiceAndPriceResult);
            }
            break;
        case "pn-product-card":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "pn-product-tile-info":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "pn-product-tile-price":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}

export { PnfindServiceAndPriceResult as P, defineCustomElement as d, state as s };

//# sourceMappingURL=pn-find-service-and-price-result2.js.map