';const d=a.getAttribute("id");document.getElementById(d)||(document.getElementById("latest").appendChild(a),t.addItemById(d))}catch(e){}},t=async e=>{const t=e.slice(0,10),i=t.slice(0,4);return(await(await fetch(`https://raw.githubusercontent.com/kherrick/hacker-news/main/archives/${i}/${t}/index.md`)).text()).split("\n").filter((e=>e.match(new RegExp("^\\* \\[")))).map((e=>{const t=e.replace("* ","").split("]("),i=t[0].slice(1),n=t[1].split(") - [")[0],s=t[1].split(") - [")[1],c=t[2].slice(0,-1);return{date:i.slice(0,10),itemComments:n,itemLink:c,itemTitle:s,time:i.slice(-8)}}))},i=async(i,n)=>{if(i.isIntersecting){const i=document.getElementById("latest").querySelector("section:last-child > section > h4 > span").textContent,s=getNextDateTime(i??"",-1),c=await t(s),o=c.findIndex((({time:e})=>e===s.slice(-8))),a=(e,t=[])=>(e.forEach((e=>{t.push(e)})),t);window.hackerNewsState={index:a(c,window.hackerNewsState.index),nextTimeIndex:o};let d=o+1;const l=Object.values(window.hackerNewsState.index);for(let t of l)d{const t=new UpdateQueue;e.forEach((e=>i(e,t)))}),{root:null,rootMargin:"0px",threshold:0});s.observe(n);let c=!0;const o=()=>{c=!c,c?s.observe(n):s.disconnect(n);for(let e of document.querySelectorAll("#latest > section"))e.style.display=c?"block":"none"},a=document.querySelector("#latest > h2");a.style.cursor="pointer",a.addEventListener("click",o)}