"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

var vendor = _interopRequire(require("./vendor"));

var Node = _interopRequire(require("./node"));

// CSS declaration like “color: black” in rules

var Declaration = (function (Node) {
    function Declaration(defaults) {
        _classCallCheck(this, Declaration);

        this.type = "decl";
        Node.call(this, defaults);
    }

    _inherits(Declaration, Node);

    // Stringify declaration

    Declaration.prototype.stringify = function stringify(builder, semicolon) {
        var before = this.style("before");
        if (before) builder(before);

        var between = this.style("between", "colon");
        var string = this.prop + between + this.stringifyRaw("value");

        if (this.important) {
            string += this._important || " !important";
        }

        if (semicolon) string += ";";
        builder(string, this);
    };

    return Declaration;
})(Node);

module.exports = Declaration;