import{t as i}from"./use-toast-BiL_AQz9.js";import{t as c}from"./createLucideIcon-DA8ZBm4D.js";import{t as l}from"./es-Bvr8zSR1.js";var s=c("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const n={toMarkdown:t=>n.replace(t,"md"),toHTML:t=>n.replace(t,"html"),toPNG:t=>n.replace(t,"png"),toPY:t=>n.replace(t,"py"),withoutExtension:t=>{let o=t.split(".");return o.length===1?t:o.slice(0,-1).join(".")},replace:(t,o)=>t.endsWith(`.${o}`)?t:`${n.withoutExtension(t)}.${o}`};async function d(t,o){let e=document.getElementById("App"),a=(e==null?void 0:e.scrollTop)??0;document.body.classList.add("printing");try{r(await l(t),n.toPNG(o))}catch{i({title:"Error",description:"Failed to download as PNG.",variant:"danger"})}finally{document.body.classList.remove("printing"),requestAnimationFrame(()=>{e==null||e.scrollTo(0,a)})}}function r(t,o){let e=document.createElement("a");e.href=t,e.download=o,e.click(),e.remove()}function m(t,o){let e=URL.createObjectURL(t);r(e,o),URL.revokeObjectURL(e)}export{s as a,n as i,r as n,d as r,m as t};
