import { t as isBlockedObjectKey } from "./prototype-keys-D2nJOZIy.js";
import { o as normalizeProviderId } from "./model-selection-normalize-C6UmVR3Y.js";
import "./model-selection-BsLXn6vT.js";
import { t as parseGenerationModelRef } from "./model-ref-C7Ni5Z2D.js";
import { r as resolvePluginCapabilityProviders } from "./capability-provider-runtime-DL_5S2GH.js";
//#region src/music-generation/model-ref.ts
/**
* Model reference parsing for music generation.
*
* Music generation uses the same provider/model ref grammar as other media
* capabilities, but keeps this wrapper for a dedicated capability boundary.
*/
/** Parse a music generation model ref into provider and model ids. */
function parseMusicGenerationModelRef(raw) {
	return parseGenerationModelRef(raw);
}
//#endregion
//#region src/music-generation/provider-registry.ts
/**
* Registry for music generation providers.
*
* Built-ins and plugin-provided capability providers share one alias map while
* rejecting unsafe object keys before they reach Maps or config-derived lookups.
*/
const BUILTIN_MUSIC_GENERATION_PROVIDERS = [];
const UNSAFE_PROVIDER_IDS = new Set([
	"__proto__",
	"constructor",
	"prototype"
]);
function normalizeMusicGenerationProviderId(id) {
	const normalized = normalizeProviderId(id ?? "");
	if (!normalized || isBlockedObjectKey(normalized)) return;
	return normalized;
}
function isSafeMusicGenerationProviderId(id) {
	return Boolean(id && !UNSAFE_PROVIDER_IDS.has(id));
}
function resolvePluginMusicGenerationProviders(cfg) {
	return resolvePluginCapabilityProviders({
		key: "musicGenerationProviders",
		cfg
	});
}
function buildProviderMaps(cfg) {
	const canonical = /* @__PURE__ */ new Map();
	const aliases = /* @__PURE__ */ new Map();
	const register = (provider) => {
		const id = normalizeMusicGenerationProviderId(provider.id);
		if (!isSafeMusicGenerationProviderId(id)) return;
		canonical.set(id, provider);
		aliases.set(id, provider);
		for (const alias of provider.aliases ?? []) {
			const normalizedAlias = normalizeMusicGenerationProviderId(alias);
			if (isSafeMusicGenerationProviderId(normalizedAlias)) aliases.set(normalizedAlias, provider);
		}
	};
	for (const provider of BUILTIN_MUSIC_GENERATION_PROVIDERS) register(provider);
	for (const provider of resolvePluginMusicGenerationProviders(cfg)) register(provider);
	return {
		canonical,
		aliases
	};
}
/** List canonical music generation providers available for the current config. */
function listMusicGenerationProviders(cfg) {
	return [...buildProviderMaps(cfg).canonical.values()];
}
/** Resolve a music generation provider by canonical id or alias. */
function getMusicGenerationProvider(providerId, cfg) {
	const normalized = normalizeMusicGenerationProviderId(providerId);
	if (!normalized) return;
	return buildProviderMaps(cfg).aliases.get(normalized);
}
//#endregion
export { listMusicGenerationProviders as n, parseMusicGenerationModelRef as r, getMusicGenerationProvider as t };
