diff --git a/index.html b/index.html
index 8eda822..8d88538 100644
--- a/index.html
+++ b/index.html
@@ -901,10 +901,16 @@ const API = {
getHstTags() { return this.fetch("/hst?select=mrf,ref,name_es,name_en,alias", "tzzr_core_hst", { fallback: [] }); },
getGroups() { return this.fetch("/api_groups", "public", { fallback: [] }); },
- getLibraries(base) {
+ async getLibraries(base) {
const config = CONFIG.BASES[base];
- if (!config?.hasLibraries) return Promise.resolve([]);
- return this.fetch(`/api_library_list_${base}`, "public", { fallback: [] });
+ if (!config?.hasLibraries) return [];
+ // Get unique library MRFs from library_${base}
+ const relations = await this.fetch(`/library_${base}?select=mrf_library`, config.schema, { fallback: [] });
+ const uniqueMrfs = [...new Set(relations.map(r => r.mrf_library))];
+ if (uniqueMrfs.length === 0) return [];
+ // Fetch tag info for those MRFs
+ const mrfFilter = uniqueMrfs.map(m => `"${m}"`).join(',');
+ return this.fetch(`/${config.table}?mrf=in.(${mrfFilter})&select=mrf,alias,name_es,name_en,img_thumb_url`, config.schema, { fallback: [] });
},
async getLibraryMembers(base, libraryMrf) {