"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),common=require("../../common/common.js"),productGallery=require("../../common/productGallery.js"),getProductImagesClassName=require("../../composables/getProductImagesClassName.js"),getProductImagesStyles=require("../../composables/getProductImagesStyles.js"),getProductImagesAttr=require("../../composables/getProductImagesAttr.js"),productFeaturedImage=require("../../common/productFeaturedImage.js"),MediaIcon=require("../child/MediaIcon.js"),ButtonOpenLightBox=require("../lightbox/ButtonOpenLightBox.js"),NextImage=require("../../../../../image/components/NextImage.js"),Carousel=require("../../../../../carousel-v3/components/root/Carousel.js"),CarouselItem=require("../../../../../carousel-v3/components/item/CarouselItem.js"),useGalleryCarousel=require("../../hooks/useGalleryCarousel.js"),system=require("@gem-sdk/system");const ProductGalleryCarousel=e=>{let{builderPropUID:t,productImages:s,onSwiperReady:r,activeIndexFormFeatureImage:a,onClickFeatureArrow:o,builderPropsClass:u,arrow:l,priorityFeatureImage:i,...m}=e,c=core.useCurrentDevice(),{galleryItemClasses:n}=getProductImagesClassName.getProductImagesClassName(m),{galleryCarouselSettingAttrs:d}=getProductImagesAttr.getProductImagesAttr(m),{galleryCarouselStyle:g,galleryCarouselItemStyle:p}=getProductImagesStyles.getProductImagesStyles(m),{isDisplay:y,shapeByLayout:I,isShowButtonLightbox:j,filteredProductImages:x,handleClickCarouselItem:C,safeMoveToIdx:h,setSliderReady:q}=useGalleryCarousel.useGalleryCarousel(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:y&&jsxRuntime.jsx(Carousel.default,{parentClass:u,rootClass:u,setting:d,styles:g,slidesClass:productGallery.getEditorMinHeightClass(c,m.position,m.navigationPosition),builderProps:{uid:`${t}-carousel`},moveToIdx:h,isHiddenArrowWhenDisabled:!0,disableMarginAuto:!0,isEnableCheckHasScrollableContent:!0,onLoaded:e=>{e&&q(!0)},onSwiperReady:r,children:x?.map(e=>{let s=productFeaturedImage.isFeatureMedia(e.contentType)?e.previewImage:e.src;return jsxRuntime.jsxs(CarouselItem.default,{contentType:"productImage",className:n(`gp-gallery-image-item gem-slider-item-${t}`),onClickItem:()=>C(e?.id),style:p,"data-id":e?.id,children:[jsxRuntime.jsx(NextImage.default,{draggable:"false",src:s,width:e?.width,height:e?.height,alt:e?.alt,setting:{aspectRatio:common.getAspectRatio(I),layout:m?.layout,qualityPercent:m?.qualityPercent,qualityType:m?.qualityType},style:{width:"100%",height:"100%",cursor:"pointer"},className:"product-list-image"}),jsxRuntime.jsx(MediaIcon.default,{contentType:e?.contentType||""}),system.If(j,jsxRuntime.jsx(ButtonOpenLightBox.default,{}))]},e?.id)})})})};exports.default=ProductGalleryCarousel;
