import { colorizeKey, colorizePath, getAppLogger } from "./config/dist/esm/logger.mjs";
import { formatPath } from "./utils/formatter.mjs";

//#region ../@intlayer/webpack/dist/esm/chokidar/dist/esm/filterInvalidDictionaries.mjs
const isInvalidDictionary = (dictionary, configuration) => {
	const appLogger = getAppLogger(configuration);
	if (!dictionary) return false;
	const location = Boolean(dictionary.location === "local") ? "Local" : "Remote";
	const hasKey = Boolean(dictionary.key);
	const hasContent = Boolean(dictionary.content);
	if (!hasKey) {
		appLogger(`${location} dictionary has no key`, { level: "error" });
		appLogger(JSON.stringify(dictionary, null, 2), { level: "error" });
		return false;
	}
	if (!hasContent) {
		appLogger(`${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath("Remote")}`, { level: "error" });
		return false;
	}
	return true;
};
const filterInvalidDictionaries = (dictionaries, configuration) => (dictionaries ?? [])?.filter((dictionary) => isInvalidDictionary(dictionary, configuration));

//#endregion
export { filterInvalidDictionaries, isInvalidDictionary };
//# sourceMappingURL=filterInvalidDictionaries.mjs.map