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