import{u}from"./BE7GDBwC.js";import{j as o,l as c,a2 as d,c as m,Y as g,o as f}from"./Bgmy51Qv.js";const v=["data-src","alt","title"],z={__name:"ImageLazy",props:{alt:{type:String,default:null},title:{type:String,default:null},lazySrc:{type:String,default:null}},setup(l){const n=o(0),r=o(null);let e=null;c(()=>{e=new IntersectionObserver(([t])=>{t.isIntersecting&&(t.target.setAttribute("src",l.lazySrc),e.unobserve(t.target))},{root:null,threshold:0}),e.observe(r.value),r.value.addEventListener("load",()=>{var t;(t=r.value)==null||t.removeAttribute("data-src"),r.value&&(n.value=1)})}),d(()=>{e&&e.disconnect()});const{getImageURL:s}=u(),i=t=>{const a=t.target;a.dataset.errorHandled!=="true"&&(a.dataset.errorHandled="true",e==null||e.unobserve(a),a.removeAttribute("data-src"),a.src=s(),n.value=1)};return(t,a)=>(f(),m("img",{ref_key:"lazyImage",ref:r,"data-src":l.lazySrc,alt:l.alt,title:l.title,height:"50",width:"50",style:g({opacity:n.value}),onError:i},null,44,v))}};export{z as _};
