"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var classnames = require("classnames");
var PropTypes = require("prop-types");
var React = require("react");
require("./Progress.less");
var propTypes = {
    className: PropTypes.string,
    style: PropTypes.object,
    color: PropTypes.string,
    striped: PropTypes.bool,
    size: PropTypes.string,
    fill: PropTypes.number,
};
var cssClass = {
    CONTAINER: "ProgressBar--Progress",
    STRIPED: "ProgressBar--Progress--striped",
    color: function (c) { return "ProgressBar--Progress--" + c; },
    border: function (c, s) { return "ProgressBar--Progress--" + c + "--" + s; },
};
var Progress = /** @class */ (function (_super) {
    __extends(Progress, _super);
    function Progress() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Progress.prototype.render = function () {
        var _a = this.props, className = _a.className, style = _a.style, color = _a.color, size = _a.size, fill = _a.fill, striped = _a.striped;
        var colorStyle = cssClass.color(color);
        var colorBorderStyle = cssClass.border(color, size);
        if (color === "changing") {
            if (fill < 25) {
                colorStyle = cssClass.color("red");
                colorBorderStyle = cssClass.border("red", size);
            }
            else if (fill < 50) {
                colorStyle = cssClass.color("orange");
                colorBorderStyle = cssClass.border("red", size);
            }
            else if (fill < 75) {
                colorStyle = cssClass.color("blue");
                colorBorderStyle = cssClass.border("blue", size);
            }
            else {
                colorStyle = cssClass.color("green");
                colorBorderStyle = cssClass.border("green", size);
            }
        }
        if (fill === 0) {
            colorStyle = cssClass.color("none");
            colorBorderStyle = cssClass.border("none", size);
        }
        return (React.createElement("div", { className: classnames(cssClass.CONTAINER, striped ? cssClass.STRIPED : null, colorStyle, colorBorderStyle, className), style: __assign(__assign({}, style), { width: (fill === 0 ? 100 : fill) + "%" }) }));
    };
    Progress.propTypes = propTypes;
    return Progress;
}(React.PureComponent));
exports.default = Progress;
