{"version":3,"sources":["../../src/helpers/Output.ts","../../src/helpers/OutputUi.ts"],"names":["getCallbackValue","value","Output","constructor","options","color","t","template","text","ui","defaults","out","process","stdout","err","stderr","defaultOptions","OutputUI","OutputText","silent","colors","configure","merge","nl","write","useTemplateColoring","strip","writeln","resetOnNewLine","reset","line","dump","args","forEach","arg","inspect","inspectOptions","success","message","greenBright","join","warn","yellowBright","error","red","bold","styles","title","subtitle","warning","output","ora","borders","Table","single","top","topMid","topLeft","topRight","bottom","bottomMid","bottomLeft","bottomRight","left","leftMid","mid","midMid","right","rightMid","middle","double","borderless","CliTable3","_options","border","padding","colorizeBorder","str","colorizeTitle","width","length","lines","repeat","list","items","colorizeItem","firstItem","shift","push","lastItem","pop","item","table","rows","createTable","toString","chars","style","wordWrap","Object","entries","key","kebabCase","size","terminalSize"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAMA,gBAAAA,2BAAuBC,KAAAA,KAAAA;AACzB,EAAA,OAAO,OAAOA,KAAAA,KAAU,UAAcA,GAAAA,KAAAA,EAAkBA,GAAAA,KAAAA;AAC5D,CAFyB,EAAA,kBAAA,CAAA;AAoBlB,IAAMC,OAAAA,GAAN,MAAMA,OAAAA,CAAAA;;;;;;;;;AA8ETC,EAAAA,WAAAA,CAAYC,OAAiC,EAAA;AAxCtCC,IAAuBA,aAAAA,CAAAA,IAAAA,EAAAA,OAAAA,EAAAA,KAAAA,CAAAA;AAsBvBC;;;;;;;;;;;;;;;;;;;;AAA4BA,IAAAA,aAAAA,CAAAA,IAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA;AAC5BC,IAA4BA,aAAAA,CAAAA,IAAAA,EAAAA,UAAAA,EAAAA,QAAAA,CAAAA;AACnBC,IAAAA,aAAAA,CAAAA,IAAAA,EAAAA,MAAAA,CAAAA;AACAC,IAAAA,aAAAA,CAAAA,IAAAA,EAAAA,IAAAA,CAAAA;AAEhBL,IAAAA,aAAAA,CAAAA,IAAAA,EAAAA,SA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AAA;AAC7B,IAAOwF,OAAAA,KAAAA;AACX;;;;;;;;;;EAWAW,IAAO,GAAA;AACH,IAAA,OAAOC,YAAAA,EAAAA;AACX;AACJ,CAAA;AAhMavF,MAAAA,CAAAA,SAAAA,EAAAA,UAAAA,CAAAA;AAAN,IAAMA,QAAN,GAAA","file":"chunk-THGRPRC7.mjs","sourcesContent":["import { defaults, merge } from '@radicjs/utils';\nimport { InspectOptions } from 'node:util';\nimport { inspect } from 'util';\nimport { OutputTextMacros, OutputUiMacros } from '../types';\nimport { color, type ColorInstance, t, template } from '../utils/color.js';\nimport { Macroable, macroable } from '../utils/macroable.js';\nimport { OutputText } from './OutputText.js';\nimport { OutputUI } from './OutputUi.js';\n\nexport type CallbackOrValue<T> = T | (() => T);\n\n/**\n * Options for configuring the `Output` class.\n *\n * @property {boolean} [silent=false] - If true, suppresses all output.\n * @property {boolean} [colors=true] - If true, enables colored output.\n * @property {NodeJS.WriteStream} [out=process.stdout] - The output stream for standard messages.\n * @property {NodeJS.WriteStream} [err=process.stderr] - The output stream for error messages.\n * @property {boolean} [resetOnNewLine=true] - If true, resets styles on new lines.\n * @property {Record<string, string[]>} [styles] - Custom styles for different message types.\n * @property {InspectOptions} [inspectOptions] - Options for the `util.inspect` method.\n *\n * @example typescript\n * const options: OutputOptions = {\n *   silent: true,\n *   colors: false,\n *   out: process.stdout,\n *   err: process.stderr,\n *   resetOnNewLine: false,\n *   styles: {\n *     title: ['blue', 'bold'],\n *     error: ['red', 'underline']\n *   },\n *   inspectOptions: { depth: 2, colors: true }\n * };\n */\nexport interface OutputOptions {\n    silent?: CallbackOrValue<boolean>;\n    colors?: CallbackOrValue<boolean>;\n    out?: typeof process.stdout;\n    err?: typeof process.stderr;\n    resetOnNewLine?: boolean;\n    styles?: Record<string, string[]>;\n    inspectOptions?: InspectOptions;\n}\n\nconst getCallbackValue = <T>(value: CallbackOrValue<T>): T => {\n    return typeof value === 'function' ? (value as any)() : value;\n}\n\n/**\n * The `Output` class provides methods for formatted and styled console output.\n * - If we put `options.silent` to `true`, nothing will be printed\n * - If we put `options.colors` to `false`, no colors will be printed\n *\n * @example\n * const out = new Output({ silent: false });\n * out.write('Hello, World!');\n * out.success('Operation completed successfully.');\n * out.error('An error occurred.');\n * out.line(out.t`Hello {green.bold.dim World, this is colored!} and this aint`\n * out.line(`Hello {green.bold.dim World, this is colored!} and this aint`)\n * out.line(out.color.red('This is red text'));\n *\n */\n@macroable()\nexport class Output {\n    static defaultOptions: OutputOptions = {\n        silent: false,\n        colors: true,\n        resetOnNewLine: true,\n        styles: {\n            title: [ 'yellow', 'bold' ],\n            subtitle: [ 'yellow' ],\n            success: [ 'green', 'bold' ],\n            warning: [ 'orange', 'bold' ],\n            error: [ 'red', 'bold' ],\n        },\n    };\n\n    /**\n     * The output stream for standard messages.\n     * @type {typeof process.stdout}\n     @returns {typeof process.stdout}\n     * @readonly\n     * @example\n     * output.out.write('Hello, World!');\n     * output.out.write('Hello, World!').write('Hello, World!');\n     * output.out.write('Hello, World!').writeln('Hello, World!');\n     */\n    get out(): typeof process.stdout { return this.options.out as any; }\n\n    /**\n     * The output stream for standard messages.\n     * @type {typeof NodeJS.Process.stdout}\n     @returns {typeof NodeJS.Process.stdout}\n     * @readonly\n     * @example\n     * output.out.write('Hello, World!');\n     * output.out.write('Hello, World!').write('Hello, World!');\n     * output.out.write('Hello, World!').writeln('Hello, World!');\n     */\n    get err(): typeof process.stderr { return this.options.err as any; }\n\n    public color: ColorInstance = color;\n\n    /**\n     *\n     * Blocks are delimited by an opening curly brace ({), a style, some content, and a closing curly brace (}).\n     * Template styles are chained exactly like normal Chalk styles.\n     *\n     * @see https://github.com/chalk/chalk-template\n     * @example\n     * console.log(t`\n     *    There are also {#FF0000 shorthand hex styles} for\n     *    both the {#ABCDEF foreground}, {#:123456 background},\n     *    or {#ABCDEF:123456 both}.\n     *\n     *    There are {bold 5280 feet} in a mile.\n     *    In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.\n     * `)\n     *\n     * // Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent\n     * console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));\n     * console.log(chalkTemplate`{bold.rgb(10,100,200) Hello!}`);\n     */\n    public t: typeof t               = t;\n    public template: typeof template = template;\n    public readonly text: Macroable<OutputText, OutputTextMacros>;\n    public readonly ui: Macroable<OutputUI, OutputUiMacros>;\n\n    options: OutputOptions = {};\n\n    protected silent(): boolean { return getCallbackValue(this.options.silent); }\n    protected colors(): boolean { return getCallbackValue(this.options.colors); }\n\n    /**\n     * Creates an instance of `Output`.\n     *\n     * @param {Partial<OutputOptions>} options - Partial options to override the default settings.\n     *\n     * @example\n     * const output = new Output({ silent: true });\n     */\n    constructor(options: Partial<OutputOptions>) {\n        this.options = defaults(this.options, {\n            out: process.stdout,\n            err: process.stderr,\n        }, new.target.defaultOptions, options);\n        this.ui      = new OutputUI(this) as any;\n        this.text    = new OutputText(this) as any;\n    }\n\n    /**\n     * Configures the `Output` instance with new options.\n     *\n     * @param {Partial<OutputOptions>} options - Partial options to merge with the current settings.\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.configure({ colors: false });\n     */\n    configure(options: Partial<OutputOptions>) {\n        this.options = merge({}, this.options, options);\n        return this;\n    }\n\n    get nl(): this { return this.write('\\n',false); }\n\n    /**\n     * Writes text to the output stream.\n     *\n     * @param {string} text - The text to write.\n     * @param useTemplateColoring\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.write('Hello, World!');\n     */\n    write(text: string, useTemplateColoring=true): this {\n        if ( this.silent() ) {\n            return this;\n        }\n        if(useTemplateColoring) {\n            text = template(text);\n        }\n        if(this.colors() !== true){\n            text = this.text.strip(text);\n        }\n        this.out.write(text);\n        return this;\n    }\n\n    /**\n     * Writes text followed by a newline to the output stream.\n     *\n     * @param {string} [text=''] - The text to write.\n     * @param useTemplateColoring\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.writeln('Hello, World!');\n     */\n    writeln(text: string = '', useTemplateColoring=true): this {\n        this.write(text,useTemplateColoring);\n        if ( this.options.resetOnNewLine ) {\n            this.write(this.color.reset(' '));\n        }\n        this.write('\\n',useTemplateColoring);\n        return this;\n    }\n\n    /**\n     * Writes text followed by a newline to the output stream.\n     *\n     * @param {string} [text=''] - The text to write.\n     * @param useTemplateColoring\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.line('Hello, World!');\n     */\n    line(text: string = '', useTemplateColoring=true): this { return this.writeln(text,useTemplateColoring); }\n\n    /**\n     * Dumps the provided arguments to the output stream using `util.inspect`.\n     *\n     * @param {...any[]} args - The arguments to dump.\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.dump({ key: 'value' }, [1, 2, 3]);\n     */\n    dump(...args: any[]): this {\n        args.forEach(arg => this.out.write(inspect(arg, { ...this.options.inspectOptions, colors: this.colors() })) + '\\n');\n        return this;\n    }\n\n    /**\n     * Writes a success message to the output stream.\n     *\n     * @param {string} text - The success message.\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.success('Operation completed successfully.');\n     */\n    success(text: string) {\n        let message = [\n            this.color.greenBright('success: '),\n            ' ',\n            text,\n        ].join('');\n        return this.line(message);\n    }\n\n    /**\n     * Writes a warning message to the output stream.\n     *\n     * @param {string} text - The warning message.\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.warn('This is a warning message.');\n     */\n    warn(text: string) {\n        let message = [\n            this.color.yellowBright('warning: '),\n            ' ',\n            text,\n        ].join('');\n        return this.line(message);\n    }\n\n    /**\n     * Writes an error message to the output stream.\n     *\n     * @param {string} text - The error message.\n     * @returns {this} The current `Output` instance.\n     *\n     * @example\n     * output.error('An error occurred.');\n     */\n    error(text: string) {\n        let message = [\n            this.color.red.bold('error: '),\n            ' ',\n            text,\n        ].join('');\n        return this.line(message);\n    }\n\n    // @formatter:off\n    // get colorsEnabled(): boolean { return this.options?.colors === true; }\n    // get isSilent(): boolean { return this.options?.silent === true; }\n    // enableColors() { this.options.colors = true; return this; }\n    // disableColors() { this.options.colors = false; return this; }\n    // silence() { this.options.silent = true; return this; }\n    // unsilence() { this.options.silent = false; return this; }\n    // @formatter:on\n}\n","import ora from 'ora';\nimport terminalSize from 'term-size';\nimport { Output } from './Output.js';\nimport CliTable3 from 'cli-table3';\nimport { defaults, kebabCase } from '@radicjs/utils';\nimport { macroable } from '../utils/macroable.js';\n\n/**\n * Represents the border characters used in table rendering.\n *\n * @property {string} top - The character for the top border.\n * @property {string} topMid - The character for the top middle border.\n * @property {string} topLeft - The character for the top left corner.\n * @property {string} topRight - The character for the top right corner.\n * @property {string} bottom - The character for the bottom border.\n * @property {string} bottomMid - The character for the bottom middle border.\n * @property {string} bottomLeft - The character for the bottom left corner.\n * @property {string} bottomRight - The character for the bottom right corner.\n * @property {string} left - The character for the left border.\n * @property {string} leftMid - The character for the left middle border.\n * @property {string} mid - The character for the middle border.\n * @property {string} midMid - The character for the middle middle border.\n * @property {string} right - The character for the right border.\n * @property {string} rightMid - The character for the right middle border.\n * @property {string} middle - The character for the middle of the table.\n *\n * @example\n * const border: Border = {\n *   top: '─',\n *   topMid: '┬',\n *   topLeft: '┌',\n *   topRight: '┐',\n *   bottom: '─',\n *   bottomMid: '┴',\n *   bottomLeft: '└',\n *   bottomRight: '┘',\n *   left: '│',\n *   leftMid: '├',\n *   mid: '─',\n *   midMid: '┼',\n *   right: '│',\n *   rightMid: '┤',\n *   middle: '│',\n * };\n */\nexport interface Border {\n    top: string;\n    topMid: string;\n    topLeft: string;\n    topRight: string;\n    bottom: string;\n    bottomMid: string;\n    bottomLeft: string;\n    bottomRight: string;\n    left: string;\n    leftMid: string;\n    mid: string;\n    midMid: string;\n    right: string;\n    rightMid: string;\n    middle: string;\n}\n\n/**\n * Represents a collection of different border styles.\n *\n * @property {Border} single - Single line border style.\n * @property {Border} double - Double line border style.\n * @property {Border} borderless - Borderless style.\n * @property {Record<string, Border>} [key: string] - Additional custom border styles.\n *\n * @example\n * const borders: Borders = {\n *   single: { ... },\n *   double: { ... },\n *   borderless: { ... },\n *   custom: { ... },\n * };\n */\nexport interface Borders {\n    single: Border;\n    double: Border;\n    borderless: Border;\n    [key: string]: Border;\n}\n\n/**\n * Represents the type of border used in table rendering.\n *\n * @example\n * const borderType: BorderType = 'single';\n */\nexport type BorderType = keyof Borders\n\n/**\n * Options for configuring the title display in the `OutputUI` class.\n *\n * @property {BorderType} [border='single'] - The type of border to use.\n * @property {number} [padding=6] - The padding around the title text.\n * @property {(str: string) => string} [colorizeBorder] - Function to colorize the border.\n * @property {(str: string) => string} [colorizeTitle] - Function to colorize the title text.\n *\n * @example\n * const titleOptions: TitleOptions = {\n *   border: 'double',\n *   padding: 4,\n *   colorizeBorder: str => `\\x1b[34m${str}\\x1b[0m`,\n *   colorizeTitle: str => `\\x1b[32m${str}\\x1b[0m`,\n * };\n */\nexport interface TitleOptions {\n    border?: BorderType;\n    padding?: number;\n    colorizeBorder?: (str: string) => string;\n    colorizeTitle?: (str: string) => string;\n}\n\n/**\n * Options for configuring the list display in the `OutputUI` class.\n *\n * @property {string} [title] - The title of the list.\n * @property {BorderType} [border='single'] - The type of border to use.\n * @property {number} [padding=2] - The padding around the list items.\n * @property {(str: string) => string} [colorizeTitle] - Function to colorize the title text.\n * @property {(str: string) => string} [colorizeBorder] - Function to colorize the border.\n * @property {(str: string) => string} [colorizeItem] - Function to colorize the list items.\n *\n * @example\n * const listOptions: ListOptions = {\n *   title: 'My List',\n *   border: 'single',\n *   padding: 2,\n *   colorizeTitle: str => `\\x1b[32m${str}\\x1b[0m`,\n *   colorizeBorder: str => `\\x1b[34m${str}\\x1b[0m`,\n *   colorizeItem: str => `\\x1b[36m${str}\\x1b[0m`,\n * };\n */\nexport interface ListOptions {\n    title?: string;\n    border?: BorderType;\n    padding?: number;\n    colorizeTitle?: (str: string) => string;\n    colorizeBorder?: (str: string) => string;\n    colorizeItem?: (str: string) => string;\n}\n\n/**\n * Options for configuring the table constructor in the `OutputUI` class.\n *\n * @property {BorderType} [border='borderless'] - The type of border to use.\n * @property {CliTable3.TableConstructorOptions} [chars] - Custom characters for the table.\n * @property {CliTable3.TableConstructorOptions} [style] - Style options for the table.\n * @property {boolean} [wordWrap=true] - Whether to enable word wrapping.\n *\n * @example\n * const tableOptions: TableConstructorOptions = {\n *   border: 'double',\n *   chars: { ... },\n *   style: { 'padding-left': 1, 'padding-right': 1 },\n *   wordWrap: true,\n * };\n */\nexport interface TableConstructorOptions extends CliTable3.TableConstructorOptions {\n    border?: BorderType;\n}\n\n/**\n * The `OutputUI` class provides methods for rendering formatted and styled console output, including titles, lists, and tables.\n *\n * @property {typeof ora} ora - The ora spinner instance.\n * @property {Borders} borders - The available border styles.\n * @property {typeof CliTable3} Table - The table constructor.\n *\n * @example\n * const outputUI = new OutputUI(output);\n * outputUI.title('My Title');\n * outputUI.list(['Item 1', 'Item 2']);\n * const table = outputUI.createTable({ border: 'single' });\n * table.push(['Row 1', 'Row 2']);\n * console.log(table.toString());\n */\n@macroable()\nexport class OutputUI {\n    ora: typeof ora;\n    borders: Borders = {\n        single: {\n            top: '─',\n            topMid: '┬',\n            topLeft: '┌',\n            topRight: '┐',\n            bottom: '─',\n            bottomMid: '┴',\n            bottomLeft: '└',\n            bottomRight: '┘',\n            left: '│',\n            leftMid: '├',\n            mid: '─',\n            midMid: '┼',\n            right: '│',\n            rightMid: '┤',\n            middle: '│',\n        },\n        double: {\n            top: '═',\n            topMid: '╤',\n            topLeft: '╔',\n            topRight: '╗',\n            bottom: '═',\n            bottomMid: '╧',\n            bottomLeft: '╚',\n            bottomRight: '╝',\n            left: '║',\n            leftMid: '╟',\n            mid: '─',\n            midMid: '┼',\n            right: '║',\n            rightMid: '╢',\n            middle: '│',\n        },\n        borderless: {\n            top: '',\n            topMid: '',\n            topLeft: '',\n            topRight: '',\n            bottom: '',\n            bottomMid: '',\n            bottomLeft: '',\n            bottomRight: '',\n            left: '',\n            leftMid: '',\n            mid: '',\n            midMid: '',\n            right: '',\n            rightMid: '',\n            middle: ' ',\n        },\n    };\n\n    public Table: typeof CliTable3 = CliTable3;\n\n    /**\n     * Creates an instance of `OutputUI`.\n     *\n     * @param {Output} output - The `Output` instance to use for rendering.\n     *\n     * @example\n     * const outputUI = new OutputUI(output);\n     */\n    constructor(protected output: Output) {\n        this.ora = ora;\n    }\n\n    /**\n     * Renders a title with the specified options.\n     *\n     * @param {string} text - The title text to render.\n     * @param {TitleOptions} [_options={}] - The options for rendering the title.\n     *\n     * @example\n     * outputUI.title('My Title', { border: 'double', padding: 4 });\n     */\n    title(text: string, _options: TitleOptions = {}) {\n        let options: Required<TitleOptions> = defaults(_options, {\n            border: 'single',\n            padding: 6,\n            colorizeBorder: str => str,\n            colorizeTitle: this.output.template,\n        });\n\n        let borders: Border = this.borders[options.border] as any;\n        let { padding, colorizeTitle, colorizeBorder } = options;\n        let width = text.length + padding + padding;\n\n        var lines = [\n            colorizeBorder([borders.topLeft, borders.mid.repeat(width), borders.topRight].join('')),\n            [colorizeBorder(borders.left), ' '.repeat(padding), colorizeTitle(text), ' '.repeat(padding), colorizeBorder(borders.right)].join(''),\n            colorizeBorder([borders.bottomLeft, borders.bottom.repeat(width), borders.bottomRight].join('')),\n        ];\n        var title = lines.join('\\n');\n\n        this.output.line(title);\n    }\n\n    /**\n     * Renders a list with the specified items and options.\n     *\n     * @param {string[]} items - The list items to render.\n     * @param {ListOptions} [_options={}] - The options for rendering the list.\n     *\n     * @example\n     * outputUI.list(['Item 1', 'Item 2'], { title: 'My List', border: 'single' });\n     */\n    list(items: string[], _options: ListOptions = {}) {\n        let options: Required<ListOptions> = defaults(_options, {\n            border: 'single',\n            padding: 2,\n            colorizeBorder: str => str,\n            colorizeItem: this.output.template,\n            colorizeTitle: this.output.color.bold,\n        });\n        let borders = this.borders[options.border] as Border;\n        let { title, padding, colorizeItem, colorizeBorder, colorizeTitle } = options;\n        let lines = [];\n\n        let firstItem: string = title ? colorizeTitle(title) : colorizeItem(items.shift());\n        if (title) {\n            lines.push([colorizeBorder(borders.topLeft), colorizeBorder(borders.mid.repeat(padding - 1)), ' ', firstItem].join(''));\n        } else {\n            lines.push([colorizeBorder(borders.topLeft), ' '.repeat(padding), firstItem].join(''));\n        }\n        let lastItem = colorizeItem(items.pop());\n        items.forEach(item => {\n            lines.push([colorizeBorder(borders.leftMid), ' '.repeat(padding), colorizeItem(item)].join(''));\n        });\n        lines.push([colorizeBorder(borders.bottomLeft), ' '.repeat(padding), colorizeItem(lastItem)].join(''));\n        let list = lines.join('\\n');\n        this.output.line(list);\n    }\n\n    /**\n     * Renders a table with the specified rows and options.\n     *\n     * @param {any[]} rows - The rows to render in the table.\n     * @param {TableConstructorOptions} [options={}] - The options for rendering the table.\n     * @returns {string} The rendered table as a string.\n     *\n     * @example\n     * const table = outputUI.table([['Row 1', 'Row 2']], { border: 'single' });\n     * console.log(table);\n     */\n    table(rows: any[], options: TableConstructorOptions = {}) {\n        const table = this.createTable(options);\n        table.push(...rows);\n        return table.toString();\n    }\n\n    /**\n     * Creates a table with the specified options.\n     *\n     * @param {TableConstructorOptions} [options={}] - The options for creating the table.\n     * @returns {CliTable3} The created table instance.\n     *\n     * @example\n     * const table = outputUI.createTable({ border: 'single' });\n     * table.push(['Row 1', 'Row 2']);\n     * console.log(table.toString());\n     */\n    createTable(options: TableConstructorOptions = {}) {\n        options = defaults(options, {\n            border: 'borderless',\n            chars: {},\n            style: { 'padding-left': 0, 'padding-right': 3 },\n            wordWrap: true,\n        });\n        Object.entries(this.borders[options.border]).forEach(([key, value]) => {\n            options.chars[kebabCase(key)] = value;\n        });\n\n        const table = new this.Table(options);\n        return table;\n    }\n\n    /**\n     * Gets the current terminal size.\n     *\n     * @returns {terminalSize.Size} The current terminal size.\n     *\n     * @example\n     * const size = outputUI.size();\n     * console.log(`Width: ${size.columns}, Height: ${size.rows}`);\n     */\n    size() {\n        return terminalSize();\n    }\n}\n"]}