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