"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Arrow_liquid=require("../arrow/Arrow.liquid.js"),Dots_liquid=require("../dot/Dots.liquid.js"),helpers=require("../arrow/common/helpers.js"),helpers$1=require("./common/helpers.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),attrs=require("./common/attrs.js"),helpers$2=require("../../../helpers.js");const Carousel=e=>{let{children:r,builderAttrs:s,builderProps:o,styles:t,isHiddenArrowWhenDisabled:l=!0,hiddenDotWhenOnlyOne:a,rootId:i,rawChildren:d,conditionAppendJs:c}=e,n=helpers.mappingNavigationCarousel(e.setting),u={...e,setting:n},{arrowButtonSize:p,arrowBackgroundColor:$,arrowGapToEachSide:g="16",roundedArrow:h,arrowIconSize:m,arrowCustomColor:v,arrowBorder:S,arrowShadow:w,showWhenHover:q}=n??{},{uniqueComponentId:y,loopConfig:C,arrowShowConfig:f,stateData:j}=helpers$1.getData(u),{rootClassRender:_,wrapperClassRender:A,wrapperInnerClass:D,sliderClass:k}=classes.getClass(u),{rootStyleRender:P,wrapperStyleRender:E,wrapperInnerStyle:I,sliderStyle:b}=styles.getStyle(u),{rootAttrRender:z,sliderAttr:R}=attrs.getAttr(u),x=()=>core.RenderIf(core.isLocalEnv,`<script ${helpers$2.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-carousel-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$2.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-carousel-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`),G=e=>{let r="next"===e;return Arrow_liquid.default({uid:o?.uid,componentId:y,custom:n?.arrowCustom??"",showArrow:f,arrowButtonSize:p||{},arrowIconSize:m||{},arrowBackgroundColor:$??"",arrowCustomColor:v,gapToEachSize:g,showWhenHover:q,arrowBorder:S||{},arrowCorner:h||{},arrowShadow:w||{},left:!r,onClick:e=>{e.stopPropagation()},vertical:n?.vertical,isHiddenWhenDisabled:l,rootId:i})},O=()=>core.template`
    ${d?.length?core.WrapRenderChildren({uid:o?.uid??"",customProps:d[0]?.customProps},d.map((e,r)=>{if(e)return core.template`${core.RenderChildren({...e,index:r,parentSettings:n,parentStyle:t,background:n?.background,parentUid:o?.uid})}`})):r??`<div>${helpers$2.getStaticLocale("Carousel","no_slider")}</div>`}`;return core.template`
    <gp-carousel gp-data='${j}' ${z} style="${P}" class="${_}">
      <div
        ${s}
        class="${A}"
        style="${E}"
      >
        <div class="${D}" style="${I}">
          ${G("prev")}
          <div ${R} class="${k}" style="${b}">
            ${O()}
          </div>
          ${G("next")}
        </div>
        ${Dots_liquid.default({loop:C,showDots:n?.dot,dotStyle:n?.dotStyle,dotGapToCarousel:n?.dotGapToCarousel,dotSize:n?.dotSize,vertical:n?.vertical,uniqueComponentId:y,hiddenWhenOnlyOne:a})}
      </div>
    </gp-carousel>
    ${c?`{% if ${c} %} ${x()} {% endif %}`:x()}

  `};exports.default=Carousel;
