\n `:`\n
\n No preview available\n
\n `}\n \n \n \n `,o.appendChild(t),l.appendChild(o)}))}async function g(){if(!(a||s>=e)){a=!0,i&&(i.textContent="Loading...",i.disabled=!0);try{r++;const l=`/api/sites-batch/${r}.json`,p=await fetch(l);if(404===p.status)return i&&(i.style.display="none"),e=s,void(a=!1);if(!p.ok)throw new Error(`Failed to fetch batch ${r}: ${p.status} ${p.statusText}`);const g=await p.json();if(!g||0===g.length)return i&&(i.style.display="none"),e=s,void(a=!1);const d=new Map(t.map((e=>[e.id,!0]))),b=g.filter((e=>!d.has(e.id)));b.length>0?(t.push(...b),m(b),s=t.length,n&&(n.textContent=s.toString()),i&&(s>=e||b.length<20?(i.style.display="none",e=s):(i.textContent=`Load more (${s} / ${e})`,i.disabled=!1)),c&&s>o.length&&(c.style.display="block")):g.length>0&&0===b.length&&i&&(i.style.display="none")}catch(e){console.error("Error loading more sites:",e),i&&(i.textContent="Error loading. Try again?",i.disabled=!1)}finally{a=!1}}}function d(){l&&(l.innerHTML="",m(o)),t=[...o],s=t.length,r=1,a=!1,n&&(n.textContent=s.toString()),i&&(i.textContent=`Load more (${s} / ${e})`,s=e?i.style.display="none":(i.style.display="block",i.textContent=`Load more (${s} / ${e})`,i.disabled=!1),i.addEventListener("click",g)),c){const e=c.parentNode;if(e){const o=document.createElement("button");o.id="reset-view-btn",o.className="text-gray-600 bg-transparent cursor-pointer text-base py-3 px-8 transition-colors",o.style.display="none",e.replaceChild(o,c),c=o}}c&&c.addEventListener("click",d),document.querySelectorAll('a[href^="/go/"]').forEach((e=>{e.removeEventListener("click",p),e.addEventListener("click",p)}))}}"complete"===document.readyState||"interactive"===document.readyState?b():document.addEventListener("DOMContentLoaded",b),document.addEventListener("astro:page-load",b),window.addEventListener("beforeunload",p)}()