import { maskSecretLength } from "./mask-secret-length.js";
//#region src/gateway/hono/lib/safe-providers-config.ts
/**
* Build a redacted `providersConfig` map for the gateway console (image / audio / video keys).
*/
function buildSafeProvidersConfigForWeb(providers) {
	if (!providers || typeof providers !== "object") return {};
	const out = {};
	for (const [id, raw] of Object.entries(providers)) {
		if (!id) continue;
		if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
		const o = raw;
		const entry = { apiKey: typeof o.apiKey === "string" && o.apiKey.trim() ? maskSecretLength(o.apiKey) : "" };
		if (typeof o.region === "string" && o.region.trim()) entry.region = o.region.trim();
		if (typeof o.baseUrl === "string" && o.baseUrl.trim()) entry.baseUrl = o.baseUrl.trim();
		if (typeof o.imageBaseUrl === "string" && o.imageBaseUrl.trim()) entry.imageBaseUrl = o.imageBaseUrl.trim();
		out[id] = entry;
	}
	return out;
}
//#endregion
export { buildSafeProvidersConfigForWeb };

//# sourceMappingURL=safe-providers-config.js.map