'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),o=require("react"),t=require("../dot/Dots.js"),s=require("../arrow/Arrow.js"),a=require("../arrow/common/helpers.js"),l=require("../../hooks/useCarousel.js"),i=require("./common/classes.js"),d=require("./common/styles.js"),n=require("./common/attrs.js"),u=require("./common/helpers.js");const c=o.forwardRef((c,m)=>{let{children:p,builderAttrs:h,builderProps:C,styles:v,isHiddenArrowWhenDisabled:w=!0,hiddenDotWhenOnlyOne:j,elmRef:S}=c,k=a.mappingNavigationCarousel(c.setting),g={...c,setting:k},{arrowButtonSize:x,arrowBackgroundColor:y,arrowGapToEachSide:f="16",roundedArrow:b,arrowIconSize:q,arrowCustomColor:P,arrowBorder:T,arrowShadow:N,showWhenHover:z}=k??{},{totalSlideItem:A,isInfinity:D,slider:E,currentSlide:I,localRef:O,showNavigation:W,isRenderDots:B,slideMaxIndex:H,handleDotClick:F,getItemsPerPage:G,sliderRef:_,handleNextAndPrevSlide:M,dispatchEventSelectSlide:R,getNumberOfFullWidthShow:U}=l.useCarousel(g,m),{loopConfig:V,arrowShowConfig:J}=u.getData(g),{rootClassRender:K,wrapperClassRender:L,wrapperInnerClass:Q,sliderClass:X}=i.getClass(g),{rootStyleRender:Y,wrapperStyleRender:Z,wrapperInnerStyle:$}=d.getStyle(g),{rootAttrRender:ee,sliderAttr:er}=n.getAttr(g),eo=r.useCurrentDevice(),et=k?.sneakPeak?.[eo],es=r=>{let o="next"===r,t=o?!D&&E?.track?.details?.abs===H:!D&&E?.track?.details?.abs===0;return e.jsx(s.default,{uid:C?.uid,custom:k?.arrowCustom??"",showArrow:J,arrowButtonSize:x||{},arrowIconSize:q||{},arrowBackgroundColor:y||"",arrowCustomColor:P,gapToEachSize:f,showWhenHover:z,arrowBorder:T||{},arrowCorner:b||{},arrowShadow:N||{},onClick:e=>{e.stopPropagation(),M(r)},left:!o,disabled:t,vertical:k?.vertical,isHiddenWhenDisabled:w,rootId:c?.parentClass})};return e.jsx("div",{ref:S,...ee,className:K,style:Y,children:e.jsxs("div",{ref:O,...h,className:L,style:Z,children:[e.jsxs("div",{className:Q,style:$,children:[W&&es("prev"),e.jsx("div",{ref:_,...er,className:X,children:e.jsx(e.Fragment,{children:r.isEmptyChildren(p)?e.jsx("div",{children:"No Slider"}):o.Children.map(r.filterToolbarPreview(p),(r,t)=>o.isValidElement(r)?e.jsx(r.type,{...r.props,index:t,parentSettings:k,parentStyle:v,background:k?.background,parentUid:C?.uid,dispatchEventSelectSlide:R}):null)})}),W&&es("next")]}),B&&e.jsx(t.default,{showDots:k?.dot,dotStyle:k?.dotStyle,totalSlideItem:A,slideItemsPerPage:G(),currentSlide:I,enabledSneakPeak:et,vertical:k?.vertical,loop:V,dotColor:k?.dotColor,dotGapToCarousel:k?.dotGapToCarousel,dotSize:k?.dotSize,dotActiveColor:k?.dotActiveColor,hiddenWhenOnlyOne:j,sneakPeakType:k?.sneakPeakType,numberOfFullWidthShow:U(eo),onHandleClick:F}),r.filterToolbarPreview(p,!0)]})})});exports.default=c;
