(async()=>{const n=document.currentScript,s=n?.getAttribute("data-repo-url"),e=n?.getAttribute("data-repo-id");if(!s||!e)return;if(e.startsWith("forgejo")){console.log("fetch-repo.js: Forgejo server blocks cross-origin requests. Live JavaScript updates are not supported.");return}const o={github:{full_name:"full_name",description:"description",stargazers_count:"stargazers",forks:"forks"},gitlab:{name_with_namespace:"name_with_namespace",description:"description",star_count:"star_count",forks_count:"forks_count"},gitea:{full_name:"full_name",description:"description",stars_count:"stars_count",forks_count:"forks_count"},codeberg:{full_name:"full_name",description:"description",stars_count:"stars_count",forks_count:"forks_count"},forgejo:{full_name:"full_name",description:"description",stars_count:"stars_count",forks_count:"forks_count"},huggingface:{description:"description",likes:"likes",downloads:"downloads"}},i={huggingface:{description:e=>e?.replace(/Dataset Card for .+?\s+Dataset Summary\s+/,"").trim()||e}},t=Object.keys(o).find(t=>e.startsWith(t))||"github",a=o[t];try{const n=await fetch(s,{headers:{"User-agent":"Mozilla/4.0 Custom User Agent"}}),o=await n.json();if(!n.ok){console.error(`fetch-repo.js: HTTP Error: ${n.status} ${n.statusText}`);return}if(!o||typeof o!="object"){console.error("fetch-repo.js: Invalid or empty data received from remote");return}Object.entries(a).forEach(([n,s])=>{const a=document.getElementById(`${e}-${s}`);if(a){let e=o[n];i[t]?.[n]&&(e=i[t][n](e)),e!=null&&e!==""&&(a.innerHTML=e)}})}catch(e){console.error(`fetch-repo.js: ${e}`)}})()