"use strict";
/**
 * @poppinss/colors
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Kleur = void 0;
const kleur_1 = __importDefault(require("kleur"));
const Base_1 = require("./Base");
/**
 * Exposes the API to print colorful text. The reason we wrap `kleur`
 * is that, during tests we make use of a mock version of kleur
 * that makes the testing more reasonable.
 */
class Kleur extends Base_1.Colors {
    transform(transformation, text) {
        if (text !== undefined) {
            const output = (this.chain || kleur_1.default)[transformation](text);
            this.chain = undefined;
            return output;
        }
        if (this.chain) {
            this.chain = this.chain[transformation]();
        }
        else {
            this.chain = kleur_1.default[transformation]();
        }
        return this;
    }
}
exports.Kleur = Kleur;
