"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),GalleryCarousel=require("../gallery-carousel/GalleryCarousel.js"),ProductGalleryGrid=require("../child/ProductGalleryGrid.js"),ProductFeaturedImageCarousel=require("../child/ProductFeaturedImageCarousel.js"),getProductImagesStyles=require("../../composables/getProductImagesStyles.js"),getProductImagesClassName=require("../../composables/getProductImagesClassName.js"),useFeatureImageWithGallery=require("../../hooks/useFeatureImageWithGallery.js");const FeatureImageWithGallery=e=>{let{setting:r,styles:a,builderProps:t,gallery:s,onHandleClickImage:l,priorityFeatureImage:u,children:i,noDataChildren:d}=e,o={...r,...a},{isShowCarousel:m,featureImageHeight:c,featureWrapperImage:g,onClickFeatureArrow:n,activeIndexFromFeatureImage:I,setOnClickFeatureArrow:j,onHandleLoadedFeatureImage:p,setActiveIndexFromFeatureImage:y}=useFeatureImageWithGallery.useFeatureImageWithGallery(e);if(s?.[0]?.id==="noImageError")return jsxRuntime.jsx(jsxRuntime.Fragment,{children:d});let{ftImageGalleryClasses:x,imageGalleryWrapperClasses:P}=getProductImagesClassName.getProductImagesClassName(e),{wrapperFeaturedImageStyle:C,featureImageStyle:F,galleryImageStyle:h}=getProductImagesStyles.getProductImagesStyles(o,{gallery:s,featureImageHeight:c});return jsxRuntime.jsxs("div",{className:core.cls("gp-grid gp-w-full gp-relative"),style:C,children:[jsxRuntime.jsx("div",{className:x,style:F,children:jsxRuntime.jsx(ProductFeaturedImageCarousel.default,{imgRef:g,productImages:s,...o,onHandleClick:(e,r)=>l(e||"",r),onHandleLoaded:p,onHandleUpdateActiveIndex:y,onClickArrow:e=>j(e),builderPropUID:t?.uid,builderPropsClass:`gp-product-images-feature-${t?.uid}`,children:i})}),s.length>1&&jsxRuntime.jsx("div",{className:P,style:h,children:m?jsxRuntime.jsx(GalleryCarousel.default,{productImages:s,position:o?.position,...o,builderPropUID:t?.uid,onHandleClick:(e,r)=>l(e||"",r),activeIndexFormFeatureImage:I,priorityFeatureImage:u,onClickFeatureArrow:n,builderPropsClass:`gp-product-images-gallery-${t?.uid}`}):jsxRuntime.jsx(ProductGalleryGrid.default,{productImages:s,...o,builderPropUID:t?.uid,onHandleClick:(e,r)=>l(e||"",r),activeIndexFormFeatureImage:I,isHiddenInteraction:!0})})]})};exports.default=FeatureImageWithGallery;
