\n `:`\n
\n No preview available\n
\n `}\n \n \n \n `,o.appendChild(t),l.appendChild(o)}))}async function b(){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 b=await p.json();if(!b||0===b.length)return i&&(i.style.display="none"),e=s,void(a=!1);const d=new Map(t.map((e=>[e.id,!0]))),g=b.filter((e=>!d.has(e.id)));g.length>0?(t.push(...g),m(g),s=t.length,n&&(n.textContent=s.toString()),i&&(s>=e||g.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")):b.length>0&&0===g.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",b)),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?g():document.addEventListener("DOMContentLoaded",g),document.addEventListener("astro:page-load",g),window.addEventListener("beforeunload",p)}()