import { kebabCaseToCamelCase } from "../utils/kebabCaseToCamelCase.mjs";
import { readAsset } from "../_virtual/_utils_asset.mjs";

//#region ../chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs
const getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {
	let fileTemplate;
	switch (format) {
		case "ts":
			fileTemplate = "./tsTemplate.txt";
			break;
		case "cjs":
			fileTemplate = "./cjsTemplate.txt";
			break;
		case "json":
			fileTemplate = "./jsonTemplate.txt";
			break;
		default:
			fileTemplate = "./esmTemplate.txt";
			break;
	}
	const fileContent = readAsset(fileTemplate);
	const camelCaseKey = kebabCaseToCamelCase(key);
	const nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);
	const fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {
		if (typeof value === "object") return `\n  '${key$1}': ${JSON.stringify(value)},`;
		if (typeof value === "boolean" || typeof value === "number") return `\n  '${key$1}': ${value},`;
		if (typeof value === "string") return `\n  '${key$1}': '${value}',`;
		return `\n  '${key$1}': ${value},`;
	}).join("");
	return fileContent.replace("{{key}}", key).replaceAll("{{name}}", nonCapitalizedCamelCaseKey).replace("{{fileParams}}", fileParamsString);
};

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