var _a;
import { __decorate, __extends } from "tslib";
import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import { ACCORDION_TRANSITION_NAME, CHARACTER_COUNT_NAME } from '../component-names';
import { MAccordionTransition } from '../transitions/accordion-transition/accordion-transition';
import WithRender from './character-count.html?style=./character-count.scss';
var MCharacterCount = /** @class */ (function (_super) {
    __extends(MCharacterCount, _super);
    function MCharacterCount() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(MCharacterCount.prototype, "hasCounter", {
        get: function () {
            return this.maxLength > 0 && this.valueLength >= Math.max(0, Math.min(this.threshold, this.maxLength));
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop()
    ], MCharacterCount.prototype, "valueLength", void 0);
    __decorate([
        Prop({
            required: true,
            validator: function (value) {
                if (value === undefined) {
                    console.error('character-count component expects prop maxLength to be defined.');
                }
                return value !== undefined;
            }
        })
    ], MCharacterCount.prototype, "maxLength", void 0);
    __decorate([
        Prop({ default: 0 })
    ], MCharacterCount.prototype, "threshold", void 0);
    __decorate([
        Prop({ default: true })
    ], MCharacterCount.prototype, "transition", void 0);
    MCharacterCount = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[ACCORDION_TRANSITION_NAME] = MAccordionTransition,
                _a)
        })
    ], MCharacterCount);
    return MCharacterCount;
}(Vue));
export { MCharacterCount };
var CharacterCountPlugin = {
    install: function (v, options) {
        v.component(CHARACTER_COUNT_NAME, MCharacterCount);
    }
};
export default CharacterCountPlugin;
//# sourceMappingURL=character-count.js.map