'use strict';

var index = require('./index-Bkm7eeWO.js');

const eclSpinnerEcCss = () => `.ecl-spinner.sc-ecl-spinner-ec{align-items:center;display:none;flex-direction:column;margin:0 var(--s-xs);position:relative;z-index:51}.ecl-spinner--visible.sc-ecl-spinner-ec{display:inline-flex}.ecl-spinner__loader.sc-ecl-spinner-ec{animation:rotate 2s linear infinite;height:2rem;stroke:var(--cm-border-primary);transform-origin:center center;width:2rem}.ecl-spinner__text.sc-ecl-spinner-ec{color:var(--cm-on-surface-brand);font:var(--f-m);margin-top:var(--s-xs)}.ecl-spinner__circle.sc-ecl-spinner-ec{animation:dash 1.5s ease-in-out infinite,color 6s ease-in-out infinite;stroke-dasharray:1,200;stroke-dashoffset:0}@keyframes rotate{to{transform:rotate(1turn)}}@keyframes dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.ecl-spinner--centered.sc-ecl-spinner-ec{left:0;margin-left:auto;margin-right:auto;position:absolute;right:0;top:var(--s-2xl)}.ecl-spinner--inverted.sc-ecl-spinner-ec .ecl-spinner__loader.sc-ecl-spinner-ec{stroke:var(--cm-border-inverted,#fff)}.ecl-spinner--inverted.sc-ecl-spinner-ec .ecl-spinner__text.sc-ecl-spinner-ec{color:var(--cm-on-surface-inverted,#fff)}.ecl-spinner--l.sc-ecl-spinner-ec .ecl-spinner__loader.sc-ecl-spinner-ec{height:3rem;width:3rem}.ecl-spinner--s.sc-ecl-spinner-ec{flex-direction:row;justify-content:center}.ecl-spinner--s.sc-ecl-spinner-ec .ecl-spinner__loader.sc-ecl-spinner-ec{height:1.5rem;width:1.5rem}.ecl-spinner--s.sc-ecl-spinner-ec .ecl-spinner__text.sc-ecl-spinner-ec{margin-inline-start:var(--s-xs);margin-top:0}.ecl-spinner--s.sc-ecl-spinner-ec .ecl-spinner__circle.sc-ecl-spinner-ec{stroke-width:2px}.ecl-spinner__overlay.sc-ecl-spinner-ec{background-color:hsla(0,0%,100%,.9);display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:50}.ecl-spinner__overlay--visible.sc-ecl-spinner-ec{display:block}.ecl-spinner__overlay--visible.sc-ecl-spinner-ec~.ecl-spinner--visible.sc-ecl-spinner-ec{position:fixed}.ecl-spinner__overlay--visible.sc-ecl-spinner-ec~.ecl-spinner--inverted.sc-ecl-spinner-ec .ecl-spinner__loader.sc-ecl-spinner-ec{stroke:var(--cm-border-primary)}.ecl-spinner__overlay--visible.sc-ecl-spinner-ec~.ecl-spinner--inverted.sc-ecl-spinner-ec .ecl-spinner__text.sc-ecl-spinner-ec{color:var(--cm-on-surface-brand)}`;

const eclSpinnerEuCss = () => `.ecl-spinner.sc-ecl-spinner-eu{align-items:center;display:none;flex-direction:column;margin:0 var(--s-xs);position:relative;z-index:51}.ecl-spinner--visible.sc-ecl-spinner-eu{display:inline-flex}.ecl-spinner__loader.sc-ecl-spinner-eu{animation:rotate 2s linear infinite;height:2rem;stroke:var(--c-p-80);transform-origin:center center;width:2rem}.ecl-spinner__text.sc-ecl-spinner-eu{color:var(--c-d);font:var(--f-m);margin-top:var(--s-xs)}.ecl-spinner__circle.sc-ecl-spinner-eu{animation:dash 1.5s ease-in-out infinite,color 6s ease-in-out infinite;stroke-dasharray:1,200;stroke-dashoffset:0}@keyframes rotate{to{transform:rotate(1turn)}}@keyframes dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.ecl-spinner--centered.sc-ecl-spinner-eu{left:0;margin-left:auto;margin-right:auto;position:absolute;right:0;top:var(--s-2xl)}.ecl-spinner--inverted.sc-ecl-spinner-eu .ecl-spinner__loader.sc-ecl-spinner-eu{stroke:var(--cm-border-inverted,#fff)}.ecl-spinner--inverted.sc-ecl-spinner-eu .ecl-spinner__text.sc-ecl-spinner-eu{color:var(--cm-on-surface-inverted,#fff)}.ecl-spinner--l.sc-ecl-spinner-eu .ecl-spinner__loader.sc-ecl-spinner-eu{height:3rem;width:3rem}.ecl-spinner--s.sc-ecl-spinner-eu{flex-direction:row;justify-content:center}.ecl-spinner--s.sc-ecl-spinner-eu .ecl-spinner__loader.sc-ecl-spinner-eu{height:1.5rem;width:1.5rem}.ecl-spinner--s.sc-ecl-spinner-eu .ecl-spinner__text.sc-ecl-spinner-eu{margin-inline-start:var(--s-xs);margin-top:0}.ecl-spinner--s.sc-ecl-spinner-eu .ecl-spinner__circle.sc-ecl-spinner-eu{stroke-width:2px}.ecl-spinner__overlay.sc-ecl-spinner-eu{background-color:hsla(0,0%,100%,.9);display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:50}.ecl-spinner__overlay--visible.sc-ecl-spinner-eu{display:block}.ecl-spinner__overlay--visible.sc-ecl-spinner-eu~.ecl-spinner--visible.sc-ecl-spinner-eu{position:fixed}.ecl-spinner__overlay--visible.sc-ecl-spinner-eu~.ecl-spinner--inverted.sc-ecl-spinner-eu .ecl-spinner__loader.sc-ecl-spinner-eu{stroke:var(--c-p-80)}.ecl-spinner__overlay--visible.sc-ecl-spinner-eu~.ecl-spinner--inverted.sc-ecl-spinner-eu .ecl-spinner__text.sc-ecl-spinner-eu{color:var(--c-d)}`;

const EclSpinner = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.styleClass = '';
        this.variant = 'primary';
        this.centered = false;
        this.visible = false;
        this.overlay = false;
        this.size = 'm';
    }
    getClass() {
        const classes = [
            `ecl-spinner`,
            `ecl-spinner--${this.variant}`,
            `ecl-spinner--${this.size}`,
            this.styleClass
        ];
        if (this.centered) {
            classes.push('ecl-spinner--centered');
        }
        if (this.visible) {
            classes.push('ecl-spinner--visible');
        }
        return classes.join(' ');
    }
    getOverlayClass() {
        const overlayClasses = ['ecl-spinner__overlay'];
        if (this.visible) {
            overlayClasses.push('ecl-spinner__overlay--visible');
        }
        return overlayClasses.join(' ');
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    render() {
        return (index.h("div", { key: 'f6b9df140cee02cc56773002f025d14a2c7f765b' }, this.overlay ?
            index.h("div", { class: this.getOverlayClass() }) : '', index.h("div", { key: '5ac55203ce2cef9152fa2ea7f47c9b976326d823', class: this.getClass() }, index.h("svg", { key: '21430148d4016c1817b8096a88555d7da9faa287', class: "ecl-spinner__loader", viewBox: "25 25 50 50" }, index.h("circle", { key: '3f592d92f897af5fd08cc73748d56439f7a8edd2', class: "ecl-spinner__circle", cx: "50", cy: "50", r: "20", fill: "none", "stroke-width": "4px", "stroke-miterlimit": "10", "vector-effect": "non-scaling-stroke" })), index.h("div", { key: 'a9324842893c48ad58f6076ff12e4e26e85ceb4f', class: "ecl-spinner__text" }, index.h("slot", { key: '4c5b8ba0fb99edabb545b142dd43d06756c42de7' })))));
    }
};
EclSpinner.style = {
    ec: eclSpinnerEcCss(),
    eu: eclSpinnerEuCss()
};

exports.ecl_spinner = EclSpinner;
