import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { g as getAssetPath } from './assetPath.js';
import { d as defineCustomElement$3 } from './ecl-button2.js';
import { d as defineCustomElement$2 } from './ecl-icon2.js';

const eclExpandableEcCss = ".ecl-button.sc-ecl-expandable-ec{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border-radius:0;border-width:0;box-sizing:border-box;cursor:pointer;display:inline-block;font:normal normal 400 1rem/1.25rem arial,sans-serif;font-weight:700;margin:0;padding:.75rem 1rem;text-decoration:none}.ecl-button.sc-ecl-expandable-ec:active,.ecl-button.sc-ecl-expandable-ec:hover{box-shadow:none;text-decoration:none}.ecl-button.sc-ecl-expandable-ec:focus-visible{outline:2px solid #fff;outline-offset:-4px;text-decoration:none}.ecl-button[disabled].sc-ecl-expandable-ec,.ecl-button[disabled].sc-ecl-expandable-ec:hover{cursor:not-allowed;text-decoration:none}.ecl-button__container.sc-ecl-expandable-ec{align-items:center;display:flex}.ecl-button__icon.sc-ecl-expandable-ec{flex-shrink:0}.ecl-button__icon.sc-ecl-expandable-ec+.ecl-button__label.sc-ecl-expandable-ec,.ecl-button__icon--before.sc-ecl-expandable-ec{margin-inline-end:.5rem}.ecl-button__icon--after.sc-ecl-expandable-ec,.ecl-button__label.sc-ecl-expandable-ec+.ecl-button__icon.sc-ecl-expandable-ec{margin-inline-start:.5rem}.ecl-button--primary.sc-ecl-expandable-ec{background-color:#004494;color:#fff}.ecl-button--primary.sc-ecl-expandable-ec:active,.ecl-button--primary.sc-ecl-expandable-ec:hover{background-color:#002f67}.ecl-button--primary[disabled].sc-ecl-expandable-ec{background-color:rgba(0,68,148,.5);color:hsla(0,0%,100%,.5)}.ecl-button--primary[disabled].sc-ecl-expandable-ec:hover{background-color:rgba(0,47,103,.5);color:hsla(0,0%,100%,.5)}.ecl-button--secondary.sc-ecl-expandable-ec{background-color:#fff;border:2px solid #004494;color:#004494;padding:calc(.75rem - 2px) calc(1rem - 2px)}.ecl-button--secondary.sc-ecl-expandable-ec:active,.ecl-button--secondary.sc-ecl-expandable-ec:hover{border-color:#002f67;color:#002f67}.ecl-button--secondary.sc-ecl-expandable-ec:focus-visible{box-shadow:inset 0 0 0 4px #004494;outline:2px solid #fff}.ecl-button--secondary[disabled].sc-ecl-expandable-ec{background-color:hsla(0,0%,100%,.5);border-color:rgba(0,68,148,.5);color:rgba(0,68,148,.5)}.ecl-button--secondary[disabled].sc-ecl-expandable-ec:hover{border-color:rgba(0,47,103,.5);color:rgba(0,47,103,.5)}.ecl-button--ghost.sc-ecl-expandable-ec{color:#004494}.ecl-button--ghost.sc-ecl-expandable-ec:active,.ecl-button--ghost.sc-ecl-expandable-ec:hover{color:#002f67}.ecl-button--ghost.sc-ecl-expandable-ec:focus-visible{outline:2px solid #004494}.ecl-button--ghost[disabled].sc-ecl-expandable-ec{color:rgba(0,68,148,.5)}.ecl-button--ghost[disabled].sc-ecl-expandable-ec:hover{color:rgba(0,47,103,.5)}.ecl-button--call.sc-ecl-expandable-ec{background-color:#ffd617;color:#000}.ecl-button--call.sc-ecl-expandable-ec:active,.ecl-button--call.sc-ecl-expandable-ec:hover{background-color:#f8ae21;border-color:#f8ae21}.ecl-button--call.sc-ecl-expandable-ec:focus-visible{outline:2px solid #000}.ecl-button--call[disabled].sc-ecl-expandable-ec{background-color:rgba(255,214,23,.5);color:rgba(0,0,0,.5)}.ecl-button--call[disabled].sc-ecl-expandable-ec:hover{background-color:rgba(248,174,33,.5)}.ecl-expandable.sc-ecl-expandable-ec{margin:0}.ecl-expandable__toggle[aria-expanded=true].sc-ecl-expandable-ec .ecl-icon.sc-ecl-expandable-ec{transform:rotate(0deg)}.ecl-expandable__content.sc-ecl-expandable-ec{border-bottom:1px solid #cfcfcf;color:#404040;font:normal normal 400 1rem/1.5rem arial,sans-serif;margin-top:1rem;padding-bottom:1.5rem;padding-inline-start:1rem}.ecl-expandable__content.sc-ecl-expandable-ec>.sc-ecl-expandable-ec:first-child{margin-top:0}.ecl-expandable__content.sc-ecl-expandable-ec>.sc-ecl-expandable-ec:last-child{margin-bottom:0}.no-js.sc-ecl-expandable-ec .ecl-expandable__content.sc-ecl-expandable-ec{display:block}.ecl-expandable__content.sc-ecl-expandable-ec p.sc-ecl-expandable-ec{max-width:80ch}";

const eclExpandableEuCss = ".ecl-button.sc-ecl-expandable-eu{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border-radius:4px;border-width:0;box-sizing:border-box;cursor:pointer;display:inline-block;font:normal normal 400 1rem/1.25rem arial,sans-serif;font-weight:400;margin:0;padding:.75rem 1rem;text-decoration:none}.ecl-button.sc-ecl-expandable-eu:active,.ecl-button.sc-ecl-expandable-eu:hover{box-shadow:0 2px 4px rgba(9,49,142,.08),0 0 10px rgba(9,49,142,.04),0 4px 5px rgba(9,49,142,.04),0 -4px 4px rgba(9,49,142,.04);text-decoration:none}.ecl-button.sc-ecl-expandable-eu:focus-visible{outline:2px solid #fff;outline-offset:-4px;text-decoration:none}.ecl-button[disabled].sc-ecl-expandable-eu,.ecl-button[disabled].sc-ecl-expandable-eu:hover{cursor:not-allowed;text-decoration:none}.ecl-button__container.sc-ecl-expandable-eu{align-items:center;display:flex}.ecl-button__icon.sc-ecl-expandable-eu{flex-shrink:0}.ecl-button__icon.sc-ecl-expandable-eu+.ecl-button__label.sc-ecl-expandable-eu,.ecl-button__icon--before.sc-ecl-expandable-eu{margin-inline-end:.5rem}.ecl-button__icon--after.sc-ecl-expandable-eu,.ecl-button__label.sc-ecl-expandable-eu+.ecl-button__icon.sc-ecl-expandable-eu{margin-inline-start:.5rem}.ecl-button--primary.sc-ecl-expandable-eu{background-color:#0e47cb;color:#fff}.ecl-button--primary.sc-ecl-expandable-eu:active,.ecl-button--primary.sc-ecl-expandable-eu:hover{background-color:#3e6cd5}.ecl-button--primary[disabled].sc-ecl-expandable-eu{background-color:rgba(14,71,203,.5);color:hsla(0,0%,100%,.5)}.ecl-button--primary[disabled].sc-ecl-expandable-eu:hover{background-color:rgba(62,108,213,.5);color:hsla(0,0%,100%,.5)}.ecl-button--secondary.sc-ecl-expandable-eu{background-color:#fff;border:2px solid #0e47cb;color:#0e47cb;padding:calc(.75rem - 2px) calc(1rem - 2px)}.ecl-button--secondary.sc-ecl-expandable-eu:active,.ecl-button--secondary.sc-ecl-expandable-eu:hover{border-color:#0e47cb;color:#0e47cb}.ecl-button--secondary.sc-ecl-expandable-eu:focus-visible{box-shadow:inset 0 0 0 4px #0e47cb;outline:2px solid #fff}.ecl-button--secondary[disabled].sc-ecl-expandable-eu{background-color:hsla(0,0%,100%,.5)}.ecl-button--secondary[disabled].sc-ecl-expandable-eu,.ecl-button--secondary[disabled].sc-ecl-expandable-eu:hover{border-color:rgba(14,71,203,.5);color:rgba(14,71,203,.5)}.ecl-button--ghost.sc-ecl-expandable-eu,.ecl-button--ghost.sc-ecl-expandable-eu:active,.ecl-button--ghost.sc-ecl-expandable-eu:hover{color:#0e47cb}.ecl-button--ghost.sc-ecl-expandable-eu:focus-visible{outline:2px solid #0e47cb}.ecl-button--ghost[disabled].sc-ecl-expandable-eu,.ecl-button--ghost[disabled].sc-ecl-expandable-eu:hover{color:rgba(14,71,203,.5)}.ecl-button--call.sc-ecl-expandable-eu{background-color:#fc0;color:#171a22}.ecl-button--call.sc-ecl-expandable-eu:active,.ecl-button--call.sc-ecl-expandable-eu:hover{background-color:#fc0;border-color:#fc0}.ecl-button--call.sc-ecl-expandable-eu:focus-visible{outline:2px solid #000}.ecl-button--call[disabled].sc-ecl-expandable-eu{color:rgba(23,26,34,.5)}.ecl-button--call[disabled].sc-ecl-expandable-eu,.ecl-button--call[disabled].sc-ecl-expandable-eu:hover{background-color:rgba(255,204,0,.5)}.ecl-expandable.sc-ecl-expandable-eu{margin:0}.ecl-expandable__toggle[aria-expanded=true].sc-ecl-expandable-eu .ecl-icon.sc-ecl-expandable-eu{transform:rotate(0deg)}.ecl-expandable__content.sc-ecl-expandable-eu{border-bottom:1px solid #cfcfcf;color:#515560;font:normal normal 400 1rem/1.5rem arial,sans-serif;margin-top:1rem;padding-bottom:1.5rem;padding-inline-start:1rem}.ecl-expandable__content.sc-ecl-expandable-eu>.sc-ecl-expandable-eu:first-child{margin-top:0}.ecl-expandable__content.sc-ecl-expandable-eu>.sc-ecl-expandable-eu:last-child{margin-bottom:0}.no-js.sc-ecl-expandable-eu .ecl-expandable__content.sc-ecl-expandable-eu{display:block}";

const EclExpandable$1 = /*@__PURE__*/ proxyCustomElement(class EclExpandable extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.styleClass = '';
        this.eclScript = false;
        this.isExpanded = false;
        this.labelCollapsed = '';
        this.labelExpanded = '';
        this.theme = 'ec';
    }
    componentDidRender() {
        const p = this.el.querySelectorAll('p');
        if (p[0]) {
            p.forEach((paragraph) => {
                paragraph.classList.add(`sc-ecl-expandable-${this.theme}`);
            });
        }
        const src = getAssetPath('./build/scripts/ecl-expandable-vanilla.js');
        if (document.querySelector(`script[src="${src}"]`)) {
            document.querySelector(`script[src="${src}"]`).remove();
        }
        const script = document.createElement('script');
        script.src = src;
        script.onload = () => {
            const expandable = new ECL.Expandable(this.el);
            expandable.init();
        };
        document.body.appendChild(script);
    }
    getClass() {
        return [
            `ecl-expandable`,
            this.styleClass
        ].join(' ');
    }
    render() {
        return (h("div", { class: this.getClass() }, h("ecl-button", { theme: this.theme, variant: "secondary", "style-class": `ecl-expandable__toggle sc-ecl-expandable-${this.theme}`, type: "button", ariaControls: `${this.el.id}-content`, "data-ecl-expandable-toggle": true, "data-ecl-label-expanded": this.labelExpanded, "data-ecl-label-collapsed": this.labelCollapsed }, h("span", { class: "ecl-button__label", "data-ecl-label": true }, this.labelCollapsed), h("ecl-icon", { slot: "icon-after", icon: "corner-arrow", size: "fluid", theme: this.theme, transform: "rotate-180", "style-class": `ecl-button__icon ecl-button__icon--after sc-ecl-button-${this.theme} sc-ecl-expandable-${this.theme}` })), h("div", { class: "ecl-expandable__content", id: `${this.el.id}-content`, hidden: true }, h("slot", null))));
    }
    static get assetsDirs() { return ["build"]; }
    get el() { return this; }
    static get style() { return {
        ec: eclExpandableEcCss,
        eu: eclExpandableEuCss
    }; }
}, [38, "ecl-expandable", {
        "styleClass": [1, "style-class"],
        "eclScript": [4, "ecl-script"],
        "isExpanded": [4, "is-expanded"],
        "labelCollapsed": [1, "label-collapsed"],
        "labelExpanded": [1, "label-expanded"],
        "theme": [1]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["ecl-expandable", "ecl-button", "ecl-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "ecl-expandable":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, EclExpandable$1);
            }
            break;
        case "ecl-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "ecl-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const EclExpandable = EclExpandable$1;
const defineCustomElement = defineCustomElement$1;

export { EclExpandable, defineCustomElement };

//# sourceMappingURL=ecl-expandable.js.map