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