import chalkDefault, * as chalkNs from 'chalk';
const ID = (string) => String(string);
function getSourceFns(x) {
    if (!x)
        return {};
    const src = x;
    const pick = (chave) => {
        const valor = src[chave];
        return typeof valor === 'function' ? valor : undefined;
    };
    return {
        cyan: pick('cyan'),
        green: pick('green'),
        red: pick('red'),
        yellow: pick('yellow'),
        magenta: pick('magenta'),
        bold: pick('bold'),
        gray: pick('gray'),
        dim: pick('dim')
    };
}
function makeChalkLike(src) {
    const base = {
        cyan: src.cyan ?? ID,
        green: src.green ?? ID,
        red: src.red ?? ID,
        yellow: src.yellow ?? ID,
        magenta: src.magenta ?? ID,
        bold: src.bold ?? ID,
        gray: src.gray ?? ID,
        dim: src.dim ?? ID
    };
    const attachBoldChain = (colorFn) => {
        const fn = ((string) => colorFn(String(string)));
        fn.bold = ((string) => colorFn(base.bold(String(string))));
        return fn;
    };
    const cyan = attachBoldChain(base.cyan);
    const green = attachBoldChain(base.green);
    const red = attachBoldChain(base.red);
    const yellow = attachBoldChain(base.yellow);
    const magenta = attachBoldChain(base.magenta);
    const gray = attachBoldChain(base.gray);
    const dim = ((string) => base.dim(String(string)));
    const bold = ((string) => base.bold(String(string)));
    bold.cyan = ((string) => base.cyan(base.bold(String(string))));
    bold.green = ((string) => base.green(base.bold(String(string))));
    bold.red = ((string) => base.red(base.bold(String(string))));
    bold.yellow = ((string) => base.yellow(base.bold(String(string))));
    bold.magenta = ((string) => base.magenta(base.bold(String(string))));
    bold.gray = ((string) => base.gray(base.bold(String(string))));
    bold.dim = ((string) => base.dim(base.bold(String(string))));
    return {
        cyan,
        green,
        red,
        yellow,
        magenta,
        bold,
        gray,
        dim
    };
}
const resolvedUnknown = chalkDefault ?? chalkNs.default ?? chalkNs;
export const chalk = makeChalkLike(getSourceFns(resolvedUnknown));
//# sourceMappingURL=chalk-safe.js.map