"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@gem-sdk/core"),s=require("../../common/hoverAction.js"),o=require("../../composables/getProductImagesStyles.js"),a=require("../../composables/getProductImagesClassName.js"),l=require("../../composables/getProductImagesAttr.js"),u=require("@gem-sdk/system"),i=require("../../common/styles.js"),n=require("../../../../../carousel-v3/components/root/Carousel.js"),d=require("../../../../../carousel-v3/components/item/CarouselItem.js"),c=require("./ProductFeaturedImageOnly.js"),m=require("../../hooks/useProductFeaturedImageCarousel.js"),g=require("../../common/common.js");const p=t.forwardRef((p,h)=>{let{productImages:v,imgRef:f,onHandleClick:j,onClickArrow:y,onHandleLoaded:I,onHandleUpdateActiveIndex:C,swiperUpdateTrigger:q,builderPropUID:x,builderPropsClass:M,carouselInstanceUID:S,parentUid:w,enableThumbsLink:P=!0,...b}=p,O=t.useRef(null),{ref:R,imageActive:k,imageActiveIndex:A,imageShowWhenHover:H,enableOpenLightBox:N,filteredProductImages:B,isRenderFeatureCarousel:F,genRandomKey:W,getAspectRatioFinal:D,emitUpdateActiveIndex:L}=m.useProductFeaturedImageCarousel(p);t.useImperativeHandle(h,()=>({getSwiper:()=>O.current?.getSwiper()||null}));let T=r.useCurrentDevice(),{galleryItemClasses:_,featureImageOnlyOneImageClasses:G}=a.getProductImagesClassName(b),{featuredImageCarouselStyle:V,featureImageCarouselItemStyle:z}=o.getProductImagesStyles(b),E=u.createStyle({...i.getFeaturedImageOnlyOneImageStyle({setting:b,options:{enableRadius:!0,enableHeight:!0}})}),{featuredImageCarouselSettingAttrs:J}=l.getProductImagesAttr(b);return e.jsx("div",{ref:R,"data-slot":"children",className:"product-feature-image",children:F?e.jsx(n.default,{ref:O,parentClass:M,elmRef:f,setting:J,styles:V,builderProps:{uid:x},rootId:S,isHiddenArrowWhenDisabled:!0,onLoaded:e=>I&&I(e),onChangeActive:e=>L(e),onClickArrow:()=>y&&y(W()),moveToIdx:A,disableMarginAuto:!0,thumbsSwiper:P?g.getGalleryCarouselSelector({carouselInstanceUID:S,builderPropUID:x}):void 0,onHandleChangeSlideByInteraction:e=>{let t=B?.length??0;j(B?.[e>=t?0:e]?.id??"",N)},children:B?.map(t=>e.jsx(d.default,{contentType:"productImage",className:_("gp-ft-image-item !gp-min-w-full !gp-max-w-full"),onClickItem:()=>{let e=r.getResponsiveValueByScreen(b?.ftClickOpenLightBox,T);"none"!==e&&j(t?.id??"",N)},style:{...z,aspectRatio:D()?.[T]},onMouseMove:e=>s.handleMouseMove(e,b),onMouseOut:e=>s.handleMouseOut(e),children:e.jsx(c.default,{image:t,imageShowWhenHover:H,setting:b,aspectRatio:D()})},t?.id))}):e.jsx("div",{ref:f,className:"gp-flex gp-w-full",style:{...r.makeStyleResponsive("jc",b?.align)},"data-id":x,children:e.jsx("div",{"aria-hidden":"true",className:G,style:E,onMouseMove:e=>s.handleMouseMove(e,b),onMouseOut:e=>s.handleMouseOut(e),onBlur:()=>void 0,onClick:()=>{j(k?.id??"",N)},children:e.jsx(c.default,{image:k,imageShowWhenHover:H,setting:b,aspectRatio:D(k)})})})})});var h=t.memo(p);exports.default=h;
