//#region src/voice/metadata/registry.ts
const registry = /* @__PURE__ */ new Map();
function normalizeKey(capability, providerId) {
	return `${capability}:${providerId.trim().toLowerCase()}`;
}
function registerVoiceProviderMetadata(metadata) {
	const keys = [normalizeKey(metadata.capability, metadata.id)];
	for (const alias of metadata.aliases ?? []) keys.push(normalizeKey(metadata.capability, alias));
	for (const key of keys) registry.set(key, metadata);
	return () => {
		for (const key of keys) if (registry.get(key) === metadata) registry.delete(key);
	};
}
function getVoiceProviderMetadata(capability, providerId) {
	return registry.get(normalizeKey(capability, providerId));
}
function listVoiceProviderMetadata(capability) {
	const seen = /* @__PURE__ */ new Set();
	const result = [];
	for (const metadata of registry.values()) {
		if (seen.has(metadata)) continue;
		if (capability && metadata.capability !== capability) continue;
		seen.add(metadata);
		result.push(metadata);
	}
	return result;
}
function _clearVoiceProviderMetadataRegistryForTests() {
	registry.clear();
}
//#endregion
export { _clearVoiceProviderMetadataRegistryForTests, getVoiceProviderMetadata, listVoiceProviderMetadata, registerVoiceProviderMetadata };

//# sourceMappingURL=registry.js.map