"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.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stringify = void 0;
const Base_1 = require("./Base");
/**
 * Stringify class returns a plain string in a format of function
 * calls. The output is reliable and easy to test.
 */
class Stringify extends Base_1.Colors {
    constructor() {
        super(...arguments);
        this.chain = [];
    }
    transform(transformation, text) {
        this.chain.push(transformation);
        if (text !== undefined) {
            const output = `${this.chain.join('(')}(${text})${new Array(this.chain.length).join(')')}`;
            this.chain = [];
            return output;
        }
        return this;
    }
}
exports.Stringify = Stringify;
