"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers$1=require("../../helpers.js"),NextImage_liquid=require("../../image/components/NextImage.liquid.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),attrs=require("../common/attrs.js"),helpers=require("../common/helpers.js"),Label_liquid=require("./Label.liquid.js"),SlideHandle_liquid=require("./SlideHandle.liquid.js");const CompareImage=e=>{let{leftImage:t,rightImage:s,advanced:a,translate:l,builderData:r,pageContext:i,preload:y=!1,onSliderPositionChange:d}=e,{hover:m,styles:g,handle:c,handleSize:o,leftImageAlt:n,leftImageTitle:p,leftImageCss:S,leftImageLabel:u,rightImageAlt:h,rightImageTitle:L,rightImageCss:b,rightImageLabel:q,sliderLineWidth:$,sliderLineColor:f,sliderPositionPercentage:I,vertical:A,componentUid:C,tempImage:j,aspectRatio:_,defaultRatio:v,isHorizontal:w,hasLeftLabel:N,hasRightLabel:O,qualityType:x,qualityPercent:D,getLeftImageSrc:H,getRightImageSrc:P}=helpers.getData(e),W=H({isLiquid:!0}),z=P({isLiquid:!0}),E=system.createStyle({...styles.getOuterWrapperStyles(g)}),k=system.createStyle({...styles.getWrapperWidth({width:g?.width,leftImageWidth:t?.width,rightImageWidth:s?.width})}),F=system.createStyle({...styles.getContainerStyles({aspectRatio:_,builderData:r})}),G=system.createStyle({...styles.getLazyPlaceholderStyle(_)}),M=system.createStyle({...styles.getImageStyles({type:"right",props:e})}),R=system.createStyle({...styles.getImageStyles({type:"left",props:e})}),J=system.createStyle({...styles.getLabelStyles({styles:g,type:"left",isHorizontal:w})}),T=system.createStyle({...styles.getLabelStyles({styles:g,type:"right",isHorizontal:w})}),U=system.createStyle({...styles.getArrowStyles({type:"left"})}),V=system.createStyle({...styles.getArrowStyles({type:"right"})}),B=system.createStyle({...styles.getLineStyles({isHorizontal:w,sliderLineColor:f,sliderLineWidth:$})}),K=system.createStyle({...styles.getHandleStyles({handleSize:o,isHorizontal:w,sliderLineColor:f,sliderLineWidth:$})}),Q=system.createStyle({...styles.getHandleCustomStyles()}),X=system.createStyle({...styles.getSliderStyles({hover:m,handleSize:o,isHorizontal:w})}),Y=system.createClass({...classes.getOuterWrapperClasses(a?.cssClass)}),Z=system.createClass({...classes.getLabelClasses(g)}),ee=system.createClass({...classes.getLabelContainerClasses()}),et=attrs.getLabelAttrs({componentUid:C,positionId:"left",label:u??""}),es=attrs.getLabelAttrs({componentUid:C,positionId:"right",label:q??""}),ea=system.createAttr({...attrs.getImageLiquidAttrs({priority:y,src:z,title:L,isDisableObjectFit:!0,isDisableAspectStyle:!0,id:`right-image-${C}`})}),el=system.createAttr({...attrs.getImageLiquidAttrs({priority:y,src:W,title:p,isDisableObjectFit:!0,isDisableAspectStyle:!0,id:`left-image-${C}`})}),er=attrs.getLabelLiquidAttrs({translate:l,pageContext:i,translateLabel:"leftImageLabel"}),ei=attrs.getLabelLiquidAttrs({translate:l,pageContext:i,translateLabel:"rightImageLabel"}),ey=system.createAttr({...attrs.getImagePlaceholderAttrs({width:j?.width,height:j?.height})}),ed=system.createStateOrContext({hover:m,handle:c,vertical:A,leftImage:t,rightImage:s,handleSize:o,aspectRatio:_,defaultRatio:v,componentUid:C,leftImageCss:S,rightImageCss:b,sliderLineColor:f,sliderLineWidth:$,sliderPositionPercentage:I,onSliderPositionChange:d}),em=()=>core.template`
      <img alt="" ${ey} style="${G}" />
    `,eg=()=>NextImage_liquid.default({...ea,alt:h,style:M,setting:{qualityType:x,qualityPercent:D},enableLazyLoadImage:!y,isNotLazyload:y,customAttrs:{"data-testid":"right-image"}}),ec=()=>NextImage_liquid.default({...el,alt:n,style:R,setting:{qualityType:x,qualityPercent:D},enableLazyLoadImage:!y,isNotLazyload:y,customAttrs:{"data-testid":"left-image"}}),eo=()=>SlideHandle_liquid.default({componentUid:C,customHandle:c,lineStyles:B,sliderStyles:X,handleStyles:K,customHandleStyles:Q,leftArrowStyles:U,rightArrowStyles:V}),en=()=>Label_liquid.default({...et,...er,styles:g,childrenClass:Z,childrenStyle:J,containerClass:ee,containerStyle:{}}),ep=()=>Label_liquid.default({...es,...ei,styles:g,childrenClass:Z,childrenStyle:T,containerClass:ee,containerStyle:{}}),eS=()=>`${system.If(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-image-comparison-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-image-comparison-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}`;return core.template`
    <gp-image-comparison
      data-id="${C}"
      style="${E}"
      class="${Y}"
      gp-data='${JSON.stringify(ed)}'
    >
      <div id="img-comparison-wrapper-${C}" style="${k}">
        <div
          id="img-comparison-container-${C}"
          data-testid="container"
          style="${F}"
        >
          ${em()}
          ${eg()}
          ${ec()}
          ${eo()}
          ${system.If(N,en(),"")}
          ${system.If(O,ep(),"")}
        </div>
      </div>
    </gp-image-comparison>
    ${eS()}
  `};exports.default=CompareImage;
