import G from"./BXbJi1vF.js";import H from"./CTAcmMAz.js";import J from"./-hq_PDZF.js";import K from"./DNFXRInd.js";import{Y as Q,r as i,f as d,y as X,h as ee,m as l,j as a,F as C,k as o,i as se,A as L,l as v,v as $,p as s,w as te,B as oe,C as A,t as B}from"./BCLrUOBx.js";import"./CzbA5VOJ.js";import"./YMgwR3Gi.js";import"./ChGwzFWX.js";const ae={class:"detail-image shimmer-wrapper"},ie=["onClick"],le={class:"mt-5 pb-15 center-text lh-30 hide-md"},ne={key:0},re={key:1},me={class:"pleceholder-zoomer-base-container center-text"},ce=["src","alt"],Ie={__name:"ProductImages",props:{product:{type:Object},images:{type:Array,default(){return[]}},mainImage:{type:String,default:""},title:{type:String,default:""}},emits:["image-popup"],setup(R,{expose:x,emit:T}){const V=R,{product:b,images:N,mainImage:c,title:z}=Q(V),O=T,g=i(null),w=e=>{g.value&&g.value.selectSliderImage(e)},h=i(!1);i(!1),i(!0);const f=i(!1),U=i(0),n=i(0),r=i(!1),M=d(()=>{var e;return((e=m.value[n.value])==null?void 0:e.image)||c.value}),m=d(()=>[{image:c.value},...N.value]),P=d(()=>{var e;return((e=b.value)==null?void 0:e.video_thumb)||""}),_=d(()=>window.innerWidth<=992),{getThumbImageURL:y,getImageURL:I}=X(),j=e=>{n.value=e},D=()=>{f.value=!0},E=()=>{f.value=!1},F=()=>{_.value||(r.value=!1),O("image-popup",r.value)};x({zoomActiveChange:e=>{w(e),n.value=e}});const k=async e=>{r.value=!0,setTimeout(()=>{w(e||n.value)},100)};return ee(async()=>{_.value&&(r.value=!0);const e=document.createElement("img");e.onload=()=>{h.value=!0},e.onerror=()=>{h.value=!0},e.src=I(c.value)}),(e,t)=>{const W=G,S=H,Y=J,Z=K;return a(),l("div",ae,[h.value?(a(),l(C,{key:0},[o("div",{class:"hide-md mx-h-100",onMouseleave:E,onMouseover:D},[v(W,{image:s(y)(s(M)),"zoom-image":s(I)(s(M)),onClick:t[0]||(t[0]=$(u=>k(),["prevent"]))},null,8,["image","zoom-image"]),v(Y,{class:"thumb-slider"},{content:te(()=>[(a(!0),l(C,null,oe(s(m),(u,p)=>(a(),l("li",{key:p,onClick:$(q=>k(p),["prevent"])},[v(S,{class:A([n.value===p?"choosed-thumb":"","responsive-image"]),"lazy-src":s(y)(u.image),onMouseover:q=>j(p)},null,8,["class","lazy-src","onMouseover"])],8,ie))),128)),s(P)?(a(),l("li",{key:0,class:"video-thumb",onClick:t[1]||(t[1]=$(u=>k(s(m).length),["prevent"]))},[v(S,{class:A([n.value===s(m).length?"choosed-thumb":"","responsive-image"]),"lazy-src":s(I)(s(P))},null,8,["class","lazy-src"]),t[3]||(t[3]=o("span",{class:"flex"},[o("i",{class:"icon play-icon"})],-1))])):L("",!0)]),_:1})],32),r.value?(a(),se(Z,{key:0,ref_key:"imagePopupRef",ref:g,title:s(z),product:s(b),"active-id":U.value,"no-scroll":!s(_),"image-list":s(m),"stacked-on-responsive":!0,onClosePopup:F,onAddToWishlist:t[2]||(t[2]=u=>e.$emit("add-to-wishlist"))},null,8,["title","product","active-id","no-scroll","image-list"])):L("",!0),o("p",le,[f.value?(a(),l("span",re,B(e.$t("productImage.extendedView")),1)):(a(),l("span",ne,B(e.$t("productImage.rollOver")),1))])],64)):(a(),l(C,{key:1},[o("div",me,[o("img",{class:"preload-img",src:s(y)(s(c)),alt:s(z),height:"100",width:"100"},null,8,ce)]),t[4]||(t[4]=o("div",{class:"pleceholder-thumb-list"},[o("div",{class:"responsive-image shimmer"}),o("div",{class:"responsive-image shimmer"}),o("div",{class:"responsive-image shimmer"})],-1))],64))])}}};export{Ie as default};
