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 __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { autoinject, customElement, TaskQueue } from "aurelia-framework";
import { bindable } from "aurelia-typed-observable-plugin";
export var UICircularProgress = (function () {
    function UICircularProgress(taskQueue) {
        this.taskQueue = taskQueue;
        this.value = 0;
    }
    UICircularProgress.prototype.attached = function () {
        var _this = this;
        this.taskQueue.queueMicroTask(function () {
            _this.radius = _this.circle.r.baseVal.value;
            _this.circumference = _this.radius * 2 * Math.PI;
            _this.circle.style.strokeDasharray = "".concat(_this.circumference, " ").concat(_this.circumference);
            _this.circle.style.strokeDashoffset = "".concat(_this.circumference);
        });
    };
    UICircularProgress.prototype.valueChanged = function (newVal, oldVal) {
        this.setProgress(this.value);
    };
    UICircularProgress.prototype.setProgress = function (percent) {
        var _this = this;
        this.taskQueue.queueMicroTask(function () {
            var offset = _this.circumference - percent / 100 * _this.circumference;
            _this.circle.style.strokeDashoffset = offset.toString();
        });
    };
    __decorate([
        bindable,
        __metadata("design:type", Number)
    ], UICircularProgress.prototype, "value", void 0);
    UICircularProgress = __decorate([
        customElement("ui-circular-progress"),
        autoinject,
        __metadata("design:paramtypes", [TaskQueue])
    ], UICircularProgress);
    return UICircularProgress;
}());

//# sourceMappingURL=ui-circular-progress.js.map
