var _a;
import { __decorate, __extends } from "tslib";
import Vue from 'vue';
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { ICON_FILE_NAME, ICON_NAME } from '../component-names';
import IconPluggin, { MIcon } from '../icon/icon';
import WithRender from './icon-file.html';
// Extensions list
var EXT_IMAGE = 'bmp,eps,gif,jpeg,jpg,png,tif,tiff,psd,ai,indd';
var EXT_TEXT = 'txt,csv';
var EXT_DOC = 'doc,docx';
var EXT_VSD = 'vsd,vsdx';
var EXT_PPT = 'ppt,pptx,pps,ppsx';
var EXT_XLS = 'xls,xlsx,xlt,xlv,xlw';
var EXT_ACCDB = 'mdb,accdb';
var EXT_PDF = 'pdf';
var EXT_RM = 'rm';
var EXT_MOV = 'mov';
var EXT_WMA = 'wma,wmv,asf';
var EXT_SWF = 'swf,flv,fla';
var EXT_VIDEO = 'mpeg,mp4,avi';
var EXT_MUSIC = 'mp3,ogg,wav,aiff,aac,ra';
var EXT_ARCHIVE = 'zip,rar,tar,gtar,gz';
var EXT_OPEN_OFFICE = 'sxw,sxi,sxd,sxc,sxm,sxg';
var EXT_ODT = 'odt';
var EXT_ODP = 'odp';
var EXT_ODG = 'odg';
var EXT_ODS = 'ods';
var EXT_ODF = 'odf';
var EXT_ODB = 'odb';
var EXT_DWG = 'dwg,dao,cao,dxf,dwf';
var EXT_MARKUP_XML = 'xml';
var EXT_MARKUP_HTML = 'html,htm';
var EXT_CODE_CSS = 'css,scss';
var EXT_CODE_JSON = 'json';
var EXT_CODE_SCRIPT = 'js,ts';
// Extensions Groups
var GROUP_IMAGE = 'm-svg__file-image';
var GROUP_TEXT = 'm-svg__file-text';
var GROUP_WORD = 'm-svg__file-word';
var GROUP_VISIO = 'm-svg__file-visio';
var GROUP_POWERPOINT = 'm-svg__file-powerpoint';
var GROUP_EXCEL = 'm-svg__file-excel';
var GROUP_ACCESS = 'm-svg__file-access';
var GROUP_PDF = 'm-svg__file-pdf';
var GROUP_REALPLAYER = 'm-svg__file-realplayer';
var GROUP_QUICKTIME = 'm-svg__file-quicktime';
var GROUP_MEDIAPLAYER = 'm-svg__file-mediaplayer';
var GROUP_FLASH = 'm-svg__file-flash';
var GROUP_VIDEO = 'm-svg__file-video';
var GROUP_AUDIO = 'm-svg__file-audio';
var GROUP_ZIP = 'm-svg__file-zip';
var GROUP_OPENOFFICE_DEFAULT = 'm-svg__file-openoffice-default';
var GROUP_OPENOFFICE_WRITTER = 'm-svg__file-openoffice-writter';
var GROUP_OPENOFFICE_IMPRESS = 'm-svg__file-openoffice-impress';
var GROUP_OPENOFFICE_DRAW = 'm-svg__file-openoffice-draw';
var GROUP_OPENOFFICE_CALC = 'm-svg__file-openoffice-calc';
var GROUP_OPENOFFICE_MATH = 'm-svg__file-openoffice-math';
var GROUP_OPENOFFICE_BASE = 'm-svg__file-openoffice-base';
var GROUP_DWG = 'm-svg__file-dwg';
var GROUP_CODE = 'm-svg__file-code';
var GROUP_MARKUP = 'm-svg__file-markup';
var GROUP_OTHER = 'm-svg__file-default';
// Extensions Tooltips
var TOOLTIP_IMAGE = 'image';
var TOOLTIP_TEXT = 'txt';
var TOOLTIP_WORD = 'doc';
var TOOLTIP_VISIO = 'vsd';
var TOOLTIP_POWERPOINT = 'ppt';
var TOOLTIP_EXCEL = 'xls';
var TOOLTIP_ACCESS = 'accdb';
var TOOLTIP_PDF = 'pdf';
var TOOLTIP_REALPLAYER = 'rm';
var TOOLTIP_QUICKTIME = 'mov';
var TOOLTIP_MEDIAPLAYER = 'wma';
var TOOLTIP_FLASH = 'swf';
var TOOLTIP_VIDEO = 'video';
var TOOLTIP_AUDIO = 'music';
var TOOLTIP_ZIP = 'zip';
var TOOLTIP_OPENOFFICE_DEFAULT = 'openoffice1';
var TOOLTIP_OPENOFFICE_WRITTER = 'odt';
var TOOLTIP_OPENOFFICE_IMPRESS = 'odp';
var TOOLTIP_OPENOFFICE_DRAW = 'odg';
var TOOLTIP_OPENOFFICE_CALC = 'ods';
var TOOLTIP_OPENOFFICE_MATH = 'odf';
var TOOLTIP_OPENOFFICE_BASE = 'odb';
var TOOLTIP_DWG = 'dwg';
var TOOLTIP_MARKUP_XML = 'xml';
var TOOLTIP_MARKUP_HTML = 'html';
var TOOLTIP_CODE_CSS = 'css';
var TOOLTIP_CODE_JSON = 'json';
var TOOLTIP_CODE_SCRIPT = 'js';
var TOOLTIP_OTHER = 'default';
var MIconFile = /** @class */ (function (_super) {
    __extends(MIconFile, _super);
    function MIconFile() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.tooltipGroup = {};
        _this.fileMap = {};
        return _this;
    }
    MIconFile.prototype.onClick = function (event) { };
    MIconFile.prototype.onKeydown = function (event) { };
    Object.defineProperty(MIconFile.prototype, "spriteId", {
        get: function () {
            var cleanExtension = this.extension ? this.extension.replace('.', '').toLowerCase() : '';
            return this.fileMap[cleanExtension] || GROUP_OTHER;
        },
        enumerable: false,
        configurable: true
    });
    MIconFile.prototype.beforeMount = function () {
        this.mapExtensionsGroup(EXT_IMAGE, GROUP_IMAGE, TOOLTIP_IMAGE);
        this.mapExtensionsGroup(EXT_TEXT, GROUP_TEXT, TOOLTIP_TEXT);
        this.mapExtensionsGroup(EXT_DOC, GROUP_WORD, TOOLTIP_WORD);
        this.mapExtensionsGroup(EXT_VSD, GROUP_VISIO, TOOLTIP_VISIO);
        this.mapExtensionsGroup(EXT_PPT, GROUP_POWERPOINT, TOOLTIP_POWERPOINT);
        this.mapExtensionsGroup(EXT_XLS, GROUP_EXCEL, TOOLTIP_EXCEL);
        this.mapExtensionsGroup(EXT_ACCDB, GROUP_ACCESS, TOOLTIP_ACCESS);
        this.mapExtensionsGroup(EXT_PDF, GROUP_PDF, TOOLTIP_PDF);
        this.mapExtensionsGroup(EXT_RM, GROUP_REALPLAYER, TOOLTIP_REALPLAYER);
        this.mapExtensionsGroup(EXT_MOV, GROUP_QUICKTIME, TOOLTIP_QUICKTIME);
        this.mapExtensionsGroup(EXT_WMA, GROUP_MEDIAPLAYER, TOOLTIP_MEDIAPLAYER);
        this.mapExtensionsGroup(EXT_SWF, GROUP_FLASH, TOOLTIP_FLASH);
        this.mapExtensionsGroup(EXT_VIDEO, GROUP_VIDEO, TOOLTIP_VIDEO);
        this.mapExtensionsGroup(EXT_MUSIC, GROUP_AUDIO, TOOLTIP_AUDIO);
        this.mapExtensionsGroup(EXT_ARCHIVE, GROUP_ZIP, TOOLTIP_ZIP);
        this.mapExtensionsGroup(EXT_OPEN_OFFICE, GROUP_OPENOFFICE_DEFAULT, TOOLTIP_OPENOFFICE_DEFAULT);
        this.mapExtensionsGroup(EXT_ODT, GROUP_OPENOFFICE_WRITTER, TOOLTIP_OPENOFFICE_WRITTER);
        this.mapExtensionsGroup(EXT_ODP, GROUP_OPENOFFICE_IMPRESS, TOOLTIP_OPENOFFICE_IMPRESS);
        this.mapExtensionsGroup(EXT_ODG, GROUP_OPENOFFICE_DRAW, TOOLTIP_OPENOFFICE_DRAW);
        this.mapExtensionsGroup(EXT_ODS, GROUP_OPENOFFICE_CALC, TOOLTIP_OPENOFFICE_CALC);
        this.mapExtensionsGroup(EXT_ODF, GROUP_OPENOFFICE_MATH, TOOLTIP_OPENOFFICE_MATH);
        this.mapExtensionsGroup(EXT_ODB, GROUP_OPENOFFICE_BASE, TOOLTIP_OPENOFFICE_BASE);
        this.mapExtensionsGroup(EXT_DWG, GROUP_DWG, TOOLTIP_DWG);
        this.mapExtensionsGroup(EXT_CODE_CSS, GROUP_CODE, TOOLTIP_CODE_CSS);
        this.mapExtensionsGroup(EXT_CODE_JSON, GROUP_CODE, TOOLTIP_CODE_JSON);
        this.mapExtensionsGroup(EXT_CODE_SCRIPT, GROUP_CODE, TOOLTIP_CODE_SCRIPT);
        this.mapExtensionsGroup(EXT_MARKUP_XML, GROUP_MARKUP, TOOLTIP_MARKUP_XML);
        this.mapExtensionsGroup(EXT_MARKUP_HTML, GROUP_MARKUP, TOOLTIP_MARKUP_HTML);
    };
    Object.defineProperty(MIconFile.prototype, "svgTitle", {
        get: function () {
            var cleanExtension = this.extension ? this.extension.replace('.', '').toLowerCase() : '';
            var currentTooltip = this.tooltipGroup[cleanExtension] || TOOLTIP_OTHER;
            var i18n = (Vue.prototype).$i18n;
            var tooltipContent = i18n.translate("m-icon-file:" + currentTooltip);
            return tooltipContent;
        },
        enumerable: false,
        configurable: true
    });
    MIconFile.prototype.mapExtensionsGroup = function (extensions, category, tooltip) {
        var _this = this;
        extensions.split(',').forEach(function (ex) { return _this.fileMap[ex] = category; });
        extensions.split(',').forEach(function (ex) { return _this.tooltipGroup[ex] = tooltip; });
    };
    __decorate([
        Prop()
    ], MIconFile.prototype, "extension", void 0);
    __decorate([
        Prop({ default: '24px' })
    ], MIconFile.prototype, "size", void 0);
    __decorate([
        Emit('click')
    ], MIconFile.prototype, "onClick", null);
    __decorate([
        Emit('keydown')
    ], MIconFile.prototype, "onKeydown", null);
    MIconFile = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[ICON_NAME] = MIcon,
                _a)
        })
    ], MIconFile);
    return MIconFile;
}(Vue));
export { MIconFile };
var IconFilePlugin = {
    install: function (v, options) {
        v.use(IconPluggin);
        v.component(ICON_FILE_NAME, MIconFile);
    }
};
export default IconFilePlugin;
//# sourceMappingURL=icon-file.js.map