javascript:(()=>{try{let e="https://cdn.jsdelivr.net/gh/eesazahed/summarize-hacklet@main/bookmarklet/popup.min.css",t=t=>{let r=document.querySelector(".summary-popup");r&&r.remove();let a=document.createElement("div");if(a.className="summary-popup",a.innerHTML="
"+t+"
",!document.querySelector("link[href='"+e+"']")){let i=document.createElement("link");i.rel="stylesheet",i.href=e,document.head.appendChild(i)}a.querySelector(".summary-close").addEventListener("click",()=>{a.classList.add("fade-out"),setTimeout(()=>a.remove(),300)}),document.body.appendChild(a)},r=e=>e.replace(/\*\*(.*?)\*\*/gim,"$1").replace(/\*(.*?)\*/gim,"$1").replace(/\n/gim,"
"),a=window.getSelection().toString().trim();if(""===a){t("You need to select some text to summarize.");return}t("Generating summary..."),fetch("https://summarize-hacklet.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})}).then(e=>e.json()).then(e=>{if(!e.summary){t("No summary returned.");return}let a=r(e.summary);t("")}).catch(e=>{t("Error: "+e)})}catch{alert("Could not fetch API")}})();