const require_logger = require('./config/dist/esm/logger.cjs');
const require_formatter = require('./utils/formatter.cjs');

//#region ../@intlayer/webpack/dist/esm/chokidar/dist/esm/filterInvalidDictionaries.mjs
const isInvalidDictionary = (dictionary, configuration) => {
	const appLogger = require_logger.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 ${require_logger.colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? require_formatter.formatPath(dictionary.filePath) : require_logger.colorizePath("Remote")}`, { level: "error" });
		return false;
	}
	return true;
};
const filterInvalidDictionaries = (dictionaries, configuration) => (dictionaries ?? [])?.filter((dictionary) => isInvalidDictionary(dictionary, configuration));

//#endregion
exports.filterInvalidDictionaries = filterInvalidDictionaries;
exports.isInvalidDictionary = isInvalidDictionary;
//# sourceMappingURL=filterInvalidDictionaries.cjs.map