import { capitalize } from "vue";
import { AVAILABLE_CLIENTS, snippetz } from "@scalar/snippetz";
//#region src/v2/blocks/operation-code-sample/helpers/generate-client-options.ts
/** Helper to generate an ID for custom code samples */
var generateCustomId = (example) => `custom/${example.lang}`;
/**
* Generate client options for the request example block by filtering by allowed clients
*
* @param allowedClients - The list of allowed clients to include in the options
* @returns A list of client option groups
*/
var generateClientOptions = (allowedClients = AVAILABLE_CLIENTS) => {
	/** Create set of allowlist for quicker lookups */
	const allowedClientsSet = new Set(allowedClients);
	return snippetz().clients().flatMap((group) => {
		const options = group.clients.flatMap((plugin) => {
			const id = `${group.key}/${plugin.client}`;
			if (!allowedClientsSet.has(id)) return [];
			return {
				id,
				lang: plugin.client === "curl" ? "curl" : group.key,
				title: `${capitalize(group.title)} ${plugin.title}`,
				label: plugin.title,
				targetKey: group.key,
				targetTitle: group.title,
				clientKey: plugin.client
			};
		});
		if (options.length === 0) return [];
		return {
			label: group.title,
			key: group.key,
			options
		};
	});
};
//#endregion
export { generateClientOptions, generateCustomId };

//# sourceMappingURL=generate-client-options.js.map