import { formatPath } from "./chokidar/dist/esm/utils/formatter.mjs";
import { getUnmergedDictionaries } from "./unmerged-dictionaries-entry/dist/esm/index.mjs";
import { relative } from "node:path";
import { colon, colorizeKey, colorizeNumber, getAppLogger, getConfiguration } from "@intlayer/config";

//#region ../@intlayer/cli/dist/esm/listContentDeclaration.mjs
const listContentDeclarationRows = (options) => {
	const config = getConfiguration(options?.configOptions);
	const unmergedDictionariesRecord = getUnmergedDictionaries(config);
	return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
		key: dictionary.key ?? "",
		path: relative(config.content.baseDir, dictionary.filePath ?? "Remote")
	}));
};
const listContentDeclaration = (options) => {
	const appLogger = getAppLogger(getConfiguration(options?.configOptions), { config: { prefix: "" } });
	const rows = listContentDeclarationRows(options);
	const lines = rows.map((r) => [
		colon(` - ${colorizeKey(r.key)}`, {
			colSize: rows.map((r$1) => r$1.key.length),
			maxSize: 60
		}),
		" - ",
		formatPath(r.path)
	].join(""));
	appLogger(`Content declaration files:`);
	lines.forEach((l) => {
		appLogger(l, { level: "info" });
	});
	appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);
};

//#endregion
export { listContentDeclaration };
//# sourceMappingURL=listContentDeclaration.mjs.map