import { Input, Component, NgModule } from '@angular/core';
import { coerceNumberProperty } from '@angular/cdk/coercion';

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var NtProgressCircleComponent = (function () {
    function NtProgressCircleComponent() {
        this._max = 100;
        this._value = 0;
        this._radius = 60;
        this.size = 'medium';
        this.color = '';
        this.class = '';
    }
    Object.defineProperty(NtProgressCircleComponent.prototype, "dasharray", {
        get: function () {
            return this.radius * 2 * Math.PI;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "width", {
        get: function () { return this.radius * 2 + 20; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "height", {
        get: function () { return this.radius * 2 + 20; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "radius", {
        get: function () { return this._radius; },
        set: function (value) { this._radius = coerceNumberProperty(value, 100); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "max", {
        get: function () { return this._max; },
        set: function (value) { this._max = coerceNumberProperty(value, 100); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "value", {
        get: function () { return this._value; },
        set: function (value) { this._value = coerceNumberProperty(value); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressCircleComponent.prototype, "percent", {
        get: function () {
            var percent = this.value / this.max * 100;
            return percent > 100 ? 100 : percent;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "radius", null);
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "max", null);
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "value", null);
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "size", void 0);
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "color", void 0);
    __decorate([
        Input()
    ], NtProgressCircleComponent.prototype, "class", void 0);
    NtProgressCircleComponent = __decorate([
        Component({
            selector: 'nt-progress-circle',
            template: "<div class=\"progress-container\">\n  <svg attr.viewPort=\"0 0 {{width / 2}} {{height / 2}}\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\n    [attr.width]=\"width\" [attr.height]=\"height\">\n    <circle\n      [attr.r]=\"radius\"\n      [attr.cx]=\"width / 2\"\n      [attr.cy]=\"height / 2\"\n      fill=\"transparent\"\n      [attr.stroke-dasharray]=\"dasharray\"\n      [attr.stroke-dashoffset]=\"0\"></circle>\n\n    <circle\n      class=\"progress-meter-circle\"\n      [attr.r]=\"radius\"\n      [attr.cx]=\"width / 2\"\n      [attr.cy]=\"height / 2\"\n      fill=\"transparent\"\n      [attr.stroke-dasharray]=\"dasharray\"\n      [attr.stroke-dashoffset]=\"dasharray - (dasharray / 100 * percent)\"></circle>\n  </svg>\n  <div class=\"progress-inner\">\n    <ng-content></ng-content>\n  </div>\n</div>\n<!-- <div class=\"nt-progress-circle-inner\"><ng-content></ng-content></div> -->\n",
            host: {
                '[class]': '["nt-progress-circle", color, size, class].join(" ")'
            }
        })
    ], NtProgressCircleComponent);
    return NtProgressCircleComponent;
}());

var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var NtProgressComponent = (function () {
    function NtProgressComponent() {
        this._max = 100;
        this._value = 0;
        this.size = 'medium';
        this.color = '';
        this.class = '';
    }
    Object.defineProperty(NtProgressComponent.prototype, "max", {
        get: function () { return this._max; },
        set: function (value) { this._max = coerceNumberProperty(value, 100); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressComponent.prototype, "value", {
        get: function () { return this._value; },
        set: function (value) { this._value = coerceNumberProperty(value); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtProgressComponent.prototype, "percent", {
        get: function () {
            var percent = this.value / this.max * 100;
            return percent > 100 ? 100 : percent;
        },
        enumerable: true,
        configurable: true
    });
    __decorate$1([
        Input()
    ], NtProgressComponent.prototype, "max", null);
    __decorate$1([
        Input()
    ], NtProgressComponent.prototype, "value", null);
    __decorate$1([
        Input()
    ], NtProgressComponent.prototype, "size", void 0);
    __decorate$1([
        Input()
    ], NtProgressComponent.prototype, "color", void 0);
    __decorate$1([
        Input()
    ], NtProgressComponent.prototype, "class", void 0);
    NtProgressComponent = __decorate$1([
        Component({
            selector: 'nt-progress',
            template: "<span class=\"progress-meter\" [style.width.%]=\"percent > 100 ? 100 : percent\">\n  <div class=\"progress-meter-text\"><ng-content></ng-content></div>\n</span>\n",
            host: {
                '[class]': '["progress", color, size, class].join(" ")'
            }
        })
    ], NtProgressComponent);
    return NtProgressComponent;
}());

var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var NtProgressModule = (function () {
    function NtProgressModule() {
    }
    NtProgressModule = __decorate$2([
        NgModule({
            exports: [NtProgressComponent, NtProgressCircleComponent],
            declarations: [NtProgressComponent, NtProgressCircleComponent]
        })
    ], NtProgressModule);
    return NtProgressModule;
}());

export { NtProgressCircleComponent, NtProgressComponent, NtProgressModule };
//# sourceMappingURL=progress.js.map
