'use client';
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useProduct as r,useCurrentDevice as i,useShopStore as a,useRenderMode as c,getResponsiveValueByScreen as n,cls as s,makeStyle as h}from"@gem-sdk/core";import{memo as l,useMemo as f}from"react";import p from"../../../../../image/components/NextImage.js";import m from"./MediaIcon.js";import{isFeatureMedia as d,getZoomImageClass as g,getZoomLenClass as y}from"../../common/productFeaturedImage.js";import u from"./ProductFeatureVideo.js";let v={src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",id:"noImageError",width:480,height:480,alt:"no image",contentType:"IMAGE"};var E=l(({image:l,imageShowWhenHover:E,setting:T,aspectRatio:b})=>{var w;let I=r(),x=i(),L=a(e=>e.storefrontUrl),{isEditMode:j,isPreviewSharePageMode:N}=c(),O=f(()=>"none"!==n(T.ftClickOpenLightBox,x),[x,T.ftClickOpenLightBox]),k=f(()=>!j&&["VIDEO","EXTERNAL_VIDEO"].includes(l?.contentType||"")&&!O,[j,l?.contentType,O]),R=f(()=>l?{...l,src:k?l.src:d(l?.contentType)?l?.previewImage:l.src}:v,[l,k]),$=f(()=>{if(N)return"javascript:void(0)";if(!L)return"#";let e=new URL(L);return I?`${e.protocol}//${e.host}/products/${I.handle}`:"#"},[L,I,N]),z=f(()=>T?.hoverEffect!=="none"&&!d(R?.contentType),[R?.contentType,T?.hoverEffect]),B=f(()=>T?.hoverEffect=="zoom"&&T?.zoomType=="glasses"&&!d(R?.contentType),[R?.contentType,T?.hoverEffect,T?.zoomType]);return e(t,{children:(w=e(t,{children:k?e(u,{type:R?.contentType,url:R.src??"",aspectRatio:b}):o(t,{children:[e(p,{draggable:"false",src:R.src,width:R?.width,height:R?.height,alt:R?.alt,setting:{aspectRatio:b,layout:T?.ftLayout},priority:T?.preload,className:"featured-image-only",style:{width:"100%",height:"100%",cursor:"pointer"}}),e(m,{contentType:R?.contentType??""}),z&&e(p,{draggable:"false",src:T?.hoverEffect==="other"?E?.src:R.src,width:T?.hoverEffect==="other"?E?.width:R.width,height:T?.hoverEffect==="other"?E?.height:R.height,alt:T?.hoverEffect==="other"?E?.alt:R.alt,setting:{layout:T.ftLayout,aspectRatio:b},style:{width:"100%",height:"100%"},className:s("hover-image featured-image-only !gp-max-w-none",g()),priority:T?.preload}),B&&e("div",{className:s(y(),"room-len"),style:{...h({bgi:`url("${R?.src}")`})}})]})}),"product-link"===n(T.ftClickOpenLightBox,x)?e("a",{title:I?.title,href:$,className:"gp-w-full",children:w}):w)})});export{E as default};
