'use strict';

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

const EclFileTranslationsItem = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.variant = 'default';
        this.downloadAttribute = false;
    }
    getClass() {
        const styleClasses = [
            `ecl-file__translation-item`,
            `sc-ecl-file-${this.theme}`,
            this.styleClass
        ];
        return styleClasses.join(' ');
    }
    getChildrenClass() {
        return `ecl-file__translation-${this.variant === 'default' ? 'info' : 'detail'}`;
    }
    getTitle() {
        return index.h("div", { class: `ecl-file__translation-title sc-ecl-file-${this.theme}`, lang: this.language, id: `${this.parentId}-lang` }, this.fileTitle);
    }
    getMeta() {
        return index.h("div", { class: `ecl-file__translation-meta sc-ecl-file-${this.theme}` }, this.meta);
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    componentDidLoad() {
        const parentFile = this.el.closest('.ecl-file');
        if (parentFile) {
            this.parentId = parentFile.id;
            this.downloadAttribute = parentFile.hasAttribute('download-attribute');
        }
    }
    render() {
        return (index.h("li", { key: '23764b3fbef06dbe1c2066bac073ec636c8f1d09', class: this.getClass() }, this.variant == 'thumbnail' ?
            index.h("div", { class: `ecl-file__translation-detail sc-ecl-file-${this.theme}` }, this.getTitle()) : '', this.variant == 'thumbnail' ?
            index.h("div", { class: `ecl-file__translation-info sc-ecl-file-${this.theme}` }, this.getMeta()) :
            index.h("div", { class: `ecl-file__translation-info sc-ecl-file-${this.theme}` }, this.getTitle(), this.getMeta()), index.h("div", { key: 'c93de33506c208cdd6051ed061ae333f4db17a8f', class: `ecl-file__translation-action sc-ecl-file-${this.theme}` }, index.h("ecl-link", Object.assign({ key: 'd3252a42c74807648c1723fcf503acf2bfd4f520', path: this.downloadLink, variant: "standalone", styleClass: `ecl-file__translation-download sc-ecl-file-${this.theme}`, theme: this.theme, "aria-labelledby": `${this.parentId}-label ${this.parentId}-title ${this.parentId}-link`, id: `${this.parentId}-link` }, (this.downloadAttribute ? { download: true } : {})), this.downloadLabel, index.h("ecl-icon", { key: '21e52be1752d43ac107d4cb83436ad0a8dd6055c', slot: "icon-after", size: "fluid", icon: "download", theme: this.theme })))));
    }
    get el() { return index.getElement(this); }
};

exports.ecl_file_translations_item = EclFileTranslationsItem;
