import L from"./CzbA5VOJ.js";import f from"./YMgwR3Gi.js";import b from"./CTAcmMAz.js";import k from"./-hq_PDZF.js";import{K as S,am as C,M as R,m as n,j as r,i as v,A as u,D as z,w as h,l as p,k as o,C as m,v as B,F as _,B as y,t as E}from"./BCLrUOBx.js";import{u as U}from"./Bxmfm8sn.js";const T={data(){return{sliderLoaded:!1}},methods:{changed({index:e},s="home-hero"){const t=this,i=this.loadedImage(e,s),l=()=>{i.style.opacity=1};i==null||i.addEventListener("load",l),i==null||i.addEventListener("error",()=>{i.style.opacity=1,i.src=t==null?void 0:t.getImageURL()})},firstImgLoaded(e=0,s="home-hero"){const t=this,i=this.loadedImage(e,s),l=()=>{this.sliderLoaded=!0,i.style.opacity=1};i==null||i.addEventListener("load",l),i==null||i.addEventListener("error",()=>{this.sliderLoaded=!0,i.style.opacity=1,i.src=t==null?void 0:t.getImageURL()})},loadedImage(e=0,s="home-hero"){const t=document.getElementById(`${s}-${e}`);return t==null||t.setAttribute("src",t==null?void 0:t.getAttribute("data-src")),t}}},A={name:"ImagePopup",data(){return{sharePopOver:!1,scrollPosition:0}},components:{ImageSlider:k,LazyImage:b,SocialShare:L,PopOver:f},directives:{outsideClick:C},mixins:[U,T],props:{product:{type:Object},title:{type:String,default:""},activeId:{type:Number,default:1},imageList:{type:Array,default(){return[]}},noScroll:{type:Boolean,default:!0},stackedOnResponsive:{type:Boolean,default:!1}},computed:{imageCount(){return this.video?this.imageList.length+1:this.imageList.length},video(){var e;return((e=this.product)==null?void 0:e.video)||""},videoThumb(){var e;return((e=this.product)==null?void 0:e.video_thumb)||""},wishListed(){var e,s;return((e=this.profile)==null?void 0:e.id)&&((s=this.product)==null?void 0:s.wishlisted)},isFavourited(){return this.wishListed?"heart-fill-icon":"heart-icon"}},methods:{clickOnThumb(e){var s,t;(t=(s=this.$refs)==null?void 0:s.imageSlider)==null||t.changeSlide(e)},closePopOver(){this.sharePopOver=!1},closePopup(){this.$emit("close-popup")}},mounted(){this.noScroll&&document.body.classList.add("no-scroll")},unmounted(){document.body.classList.remove("no-scroll")}},D={class:"image-popup"},F={key:0,class:"image-popup-icons"},N={class:"thumb-wrapper"},V={class:"title mb-10"},j={"data-glide-el":"controls[nav]",class:"flex start wrap"},M=["data-glide-dir"],H={class:"slider-content"},K={class:"slider-content-inner"},q=["id","data-source"],G={key:0},J={class:"slider-content"},Q={class:"slider-content-inner"},W={controls:"",autostart:0},X=["src"];function Y(e,s,t,i,l,a){const O=L,I=f,g=b,P=k,w=R("outside-click");return r(),n("div",{class:m([{stacked:t.stackedOnResponsive},"image-popup-wrapper"])},[l.sharePopOver?(r(),v(I,{key:0,title:e.$t("socialShare.share"),layer:!0,onClose:a.closePopOver,"elem-id":"social-pop-over"},{content:h(()=>[p(O,{product:t.product},null,8,["product"])]),_:1},8,["title","onClose"])):u("",!0),z((r(),n("div",D,[t.stackedOnResponsive?(r(),n("div",F,[o("button",{class:"left-btn fav-btn",onClick:s[0]||(s[0]=B(d=>e.$emit("add-to-wishlist"),["prevent"]))},[o("i",{class:m([a.isFavourited,"m-0 icon"])},null,2)]),o("button",{class:"right-btn share-btn",onClick:s[1]||(s[1]=d=>l.sharePopOver=!l.sharePopOver)},s[3]||(s[3]=[o("i",{class:"m-0 icon share-icon"},null,-1)]))])):u("",!0),o("button",{class:"right-btn close-btn",onClick:s[2]||(s[2]=(...d)=>a.closePopup&&a.closePopup(...d))},s[4]||(s[4]=[o("i",{class:"m-0 icon close-icon"},null,-1)])),p(P,{ref:"imageSlider","active-slide":t.activeId,"image-count":a.imageCount,bullets:!0,"lazy-image":!0,onOnChange:e.changed,onOnLoaded:e.firstImgLoaded,class:"slider-wrapper"},{"bullet-area":h(()=>[o("div",N,[o("h5",V,E(t.title),1),o("div",j,[(r(!0),n(_,null,y(t.imageList,(d,c)=>(r(),v(g,{key:c,class:m(["img-handler",{active:c===e.currentSlider}]),"lazy-src":e.getThumbImageURL(d.image),"data-glide-dir":`=${c}`,height:"50",width:"50"},null,8,["lazy-src","class","data-glide-dir"]))),128)),a.videoThumb?(r(),n("div",{key:0,class:m(["img-handler video-thumb",{active:t.imageList.length===e.currentSlider}]),"data-glide-dir":`=${t.imageList.length}`},[p(g,{"lazy-src":e.getImageURL(a.videoThumb),height:"50",width:"50"},null,8,["lazy-src"]),s[5]||(s[5]=o("span",{class:"flex"},[o("i",{class:"icon play-icon"})],-1))],10,M)):u("",!0)])])]),content:h(()=>[(r(!0),n(_,null,y(t.imageList,(d,c)=>(r(),n("li",{key:c},[o("div",H,[o("div",K,[o("img",{id:e.generateElemId(c),class:"full-dimen opacity-0","data-source":e.getImageURL(d.image),alt:"Product image",height:"100",width:"100"},null,8,q)])])]))),128)),a.video?(r(),n("li",G,[o("div",J,[o("div",Q,[o("video",W,[o("source",{src:e.getVideoURL(a.video),type:"video/mp4"},null,8,X)])])])])):u("",!0)]),_:1},8,["active-slide","image-count","onOnChange","onOnLoaded"])])),[[w,a.closePopup]])],2)}const ie=S(A,[["render",Y]]);export{ie as default};
