\n `:`\n
\n No preview available\n
\n `}\n \n \n \n `,o.appendChild(t),i.appendChild(o)}))}async function g(){if(!(a||r>=e)){a=!0,l&&(l.textContent="Loading...",l.disabled=!0);try{s++;const i=`/api/sites-batch/${s}.json`,p=await fetch(i);if(404===p.status)return l&&(l.style.display="none"),e=r,void(a=!1);if(!p.ok)throw new Error(`Failed to fetch batch ${s}: ${p.status} ${p.statusText}`);const g=await p.json();if(!g||0===g.length)return l&&(l.style.display="none"),e=r,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),r=t.length,n&&(n.textContent=r.toString()),l&&(r>=e||b.length<20?(l.style.display="none",e=r):(l.textContent=`Load more (${r} / ${e})`,l.disabled=!1)),c&&r>o.length&&(c.style.display="block")):g.length>0&&0===b.length&&l&&(l.style.display="none")}catch(e){console.error("Error loading more sites:",e),l&&(l.textContent="Error loading. Try again?",l.disabled=!1)}finally{a=!1}}}function d(){i&&(i.innerHTML="",m(o)),t=[...o],r=t.length,s=1,a=!1,n&&(n.textContent=r.toString()),l&&(l.textContent=`Load more (${r} / ${e})`,r=e?l.style.display="none":(l.style.display="block",l.textContent=`Load more (${r} / ${e})`,l.disabled=!1),l.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)}()