import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { MCountryCodeISO2 } from '../../utils/country/country';
import { Enums } from '../../utils/enums/enums';
import { REGEX_CSS_NUMBER_VALUE } from '../../utils/props-validation/props-validation';
import { ModulVue } from '../../utils/vue/vue';
import { COUNTRY_FLAG_NAME } from '../component-names';
import WithRender from './country-flag.html';
var MCountryFlag = /** @class */ (function (_super) {
    __extends(MCountryFlag, _super);
    function MCountryFlag() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MCountryFlag.prototype.emitClick = function (event) { };
    MCountryFlag.prototype.emitKeydown = function (event) { };
    MCountryFlag.prototype.emitMouseOver = function (event) { };
    MCountryFlag.prototype.emitMouseLeave = function (event) { };
    Object.defineProperty(MCountryFlag.prototype, "svg", {
        get: function () {
            try {
                var svg = this.codeIso2 ? require("./svg/" + this.codeIso2 + ".svg") : '';
                return svg.length > 4 ? svg.slice(0, 4) + " width=\"" + this.width + "\" height=\"" + this.height + "\"" + svg.slice(4) : svg;
            }
            catch (e) {
                this.$log.warn("The file " + e + " could not be loaded.");
                return '';
            }
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop({
            default: MCountryCodeISO2.Canada,
            validator: function (value) { return Enums.toValueArray(MCountryCodeISO2).indexOf(value) !== -1; }
        })
    ], MCountryFlag.prototype, "codeIso2", void 0);
    __decorate([
        Prop({
            default: '1em',
            validator: function (value) {
                return REGEX_CSS_NUMBER_VALUE.test(value);
            }
        })
    ], MCountryFlag.prototype, "width", void 0);
    __decorate([
        Prop({
            default: '1em',
            validator: function (value) {
                return REGEX_CSS_NUMBER_VALUE.test(value);
            }
        })
    ], MCountryFlag.prototype, "height", void 0);
    __decorate([
        Emit('click')
    ], MCountryFlag.prototype, "emitClick", null);
    __decorate([
        Emit('keydown')
    ], MCountryFlag.prototype, "emitKeydown", null);
    __decorate([
        Emit('mouseover')
    ], MCountryFlag.prototype, "emitMouseOver", null);
    __decorate([
        Emit('mouseleave')
    ], MCountryFlag.prototype, "emitMouseLeave", null);
    MCountryFlag = __decorate([
        WithRender,
        Component
    ], MCountryFlag);
    return MCountryFlag;
}(ModulVue));
export { MCountryFlag };
var MCountryFlagPlugin = {
    install: function (v) {
        v.component(COUNTRY_FLAG_NAME, MCountryFlag);
    }
};
export default MCountryFlagPlugin;
//# sourceMappingURL=country-flag.js.map