"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.js');
const require_primordials_array = require('../primordials/array.js');
const require_primordials_date = require('../primordials/date.js');
const require_strings_format = require('../strings/format.js');
const require_logger_symbols = require('../logger/symbols.js');
const require_logger_default = require('../logger/default.js');
let src_external_yoctocolors_cjs = require("../external/yoctocolors-cjs");
src_external_yoctocolors_cjs = require_runtime.__toESM(src_external_yoctocolors_cjs);

//#region src/stdio/footer.ts
/**
* @file Console footer/summary formatting utilities. Provides consistent footer
*   and summary formatting for CLI applications.
*/
const logger = require_logger_default.getDefaultLogger();
/**
* Create a formatted footer with optional message, timestamp, and duration.
* Useful for marking the end of CLI output or showing completion status.
*
* @example
*   ;```ts
*   const startTime = Date.now()
*   // ... do work
*   console.log(
*     createFooter('Build complete', {
*       width: 60,
*       color: 'green',
*       showDuration: true,
*       startTime,
*     }),
*   )
*   ```
*
* @param message - Optional message to display in footer.
* @param options - Footer formatting options.
*
* @returns Formatted footer string with border and optional info
*/
function createFooter(message, options) {
	const { borderChar = "=", color = "gray", showDuration = false, showTimestamp = false, startTime, width = 80 } = {
		__proto__: null,
		...options
	};
	const border = /* @__PURE__ */ require_strings_format.repeatString(borderChar, width);
	const lines = [];
	if (message) require_primordials_array.ArrayPrototypePush(lines, (color && src_external_yoctocolors_cjs.default[color] ? src_external_yoctocolors_cjs.default[color] : (s) => s)(message));
	if (showTimestamp) {
		const timestamp = new require_primordials_date.DateCtor().toISOString();
		require_primordials_array.ArrayPrototypePush(lines, src_external_yoctocolors_cjs.default.gray(`Completed at: ${timestamp}`));
	}
	if (showDuration && startTime) {
		const seconds = ((require_primordials_date.DateNow() - startTime) / 1e3).toFixed(2);
		require_primordials_array.ArrayPrototypePush(lines, src_external_yoctocolors_cjs.default.gray(`Duration: ${seconds}s`));
	}
	require_primordials_array.ArrayPrototypePush(lines, border);
	return lines.join("\n");
}
/**
* Create a summary footer with statistics and colored status indicators.
* Automatically formats success/failure/warning counts with appropriate colors.
* Useful for test results, build summaries, or batch operation reports.
*
* @example
*   ;```ts
*   console.log(
*     createSummaryFooter({
*       total: 150,
*       success: 145,
*       failed: 3,
*       skipped: 2,
*       warnings: 5,
*     }),
*   )
*   // Output: Total: 150 | ✓ 145 passed | ✗ 3 failed | ○ 2 skipped | ⚠ 5 warnings
*   // ========================================
*   ```
*
* @param stats - Statistics to display in the summary.
* @param options - Footer formatting options.
*
* @returns Formatted summary footer string with colored indicators
*/
function createSummaryFooter(stats, options) {
	const parts = [];
	if (stats.total !== void 0) require_primordials_array.ArrayPrototypePush(parts, `Total: ${stats.total}`);
	if (stats.success !== void 0) require_primordials_array.ArrayPrototypePush(parts, `${require_logger_symbols.LOG_SYMBOLS["success"]} ${stats.success} passed`);
	if (stats.failed !== void 0 && stats.failed > 0) require_primordials_array.ArrayPrototypePush(parts, `${require_logger_symbols.LOG_SYMBOLS["fail"]} ${stats.failed} failed`);
	if (stats.skipped !== void 0 && stats.skipped > 0) require_primordials_array.ArrayPrototypePush(parts, `${require_logger_symbols.LOG_SYMBOLS["skip"]} ${stats.skipped} skipped`);
	if (stats.warnings !== void 0 && stats.warnings > 0) require_primordials_array.ArrayPrototypePush(parts, `${require_logger_symbols.LOG_SYMBOLS["warn"]} ${stats.warnings} warnings`);
	if (stats.errors !== void 0 && stats.errors > 0) require_primordials_array.ArrayPrototypePush(parts, `${require_logger_symbols.LOG_SYMBOLS["fail"]} ${stats.errors} errors`);
	return createFooter(parts.join(" | "), {
		...options,
		showDuration: stats.duration !== void 0,
		...stats.duration !== void 0 && { startTime: stats.duration }
	});
}
/**
* Print a footer with optional success message. Uses `─` border character for a
* lighter appearance. Fixed width of 55 characters to match `printHeader()`.
*
* @example
*   ;```ts
*   printFooter('Analysis complete')
*   // Output:
*   // ───────────────────────────────────────────────────
*   // Analysis complete (in green)
*   ```
*
* @param message - Optional message to display (shown in green)
*/
function printFooter(message) {
	const border = /* @__PURE__ */ require_strings_format.repeatString("─", 55);
	logger.log(border);
	if (message) logger.log(src_external_yoctocolors_cjs.default.green(message));
}

//#endregion
exports.createFooter = createFooter;
exports.createSummaryFooter = createSummaryFooter;
exports.printFooter = printFooter;