define("@widget/SHOP_PRODUCT_GROUP/bs-productGroup3-ProductGroup-a675c082.js",["exports","~/c/bs-BaseContainer","@wsb/guac-widget-shared@^1/lib/common/ols-core/core-bundle","~/c/bs-YotpoUtils","@wsb/guac-widget-shared@^1/lib/components/Carousel"],(function(e,t,o,a,r){"use strict";const s="chevronLeft",l="chevronRight",p=32,c=220,i=380,n=300,g=8,d=480,u=80,b={position:"absolute",top:"calc(50% - 60px)",width:`${28}px`,color:"section",cursor:"pointer",zIndex:"2"},y={leftArrow:{...b,left:`-${p}px`},rightArrow:{...b,right:`-${p}px`}},h=e=>{const{Element:{Block:t,Icon:o}}=(global.Core||guac["@wsb/guac-widget-core"]).UX2,{icon:a,prevSlide:r,nextSlide:l}=e;return(global.React||guac.react).createElement(t,{id:a,style:a===s?y.leftArrow:y.rightArrow},(global.React||guac.react).createElement(o,{onClick:a===s?r:l,icon:a,size:"medium"}))};h.propTypes={icon:(global.PropTypes||guac["prop-types"]).string,prevSlide:(global.PropTypes||guac["prop-types"]).func,nextSlide:(global.PropTypes||guac["prop-types"]).func,numSlides:(global.PropTypes||guac["prop-types"]).number,currentAssetIndex:(global.PropTypes||guac["prop-types"]).number};var m="MOBILE_RENDER_DEVICE";const P={wrapper:{display:"flex",justifyContent:"center",marginHorizontal:`-${g/2}px`},slide:{paddingHorizontal:g/2+"px"}},w=e=>{let{children:t,slideWidth:o}=e;const{Block:a}=(global.Core||guac["@wsb/guac-widget-core"]).UX2.Element;return(global.React||guac.react).createElement(a,{style:P.wrapper},t.map((e=>(global.React||guac.react).createElement(a,{key:e.key,style:{width:`${o}px`,...P.slide}},e))))};w.propTypes={children:(global.PropTypes||guac["prop-types"]).any,slideWidth:(global.PropTypes||guac["prop-types"]).number};const{MatchMedia:R}=(global.Core||guac["@wsb/guac-widget-core"]).UX;const{renderModes:T}=(global.Core||guac["@wsb/guac-widget-core"]).constants,f={slide:{opacity:1},track:{display:"flex"}},S=e=>{let{slideWidth:t}=e;return{marginLeft:(t+g)/2+"px",...f.track}},E=e=>({marginLeft:`-${e.left}`,marginRight:`-${e.right}`}),C=e=>{let{children:t,currentAssetIndex:o,viewDevice:a,size:d,renderMode:b}=e;const[y,P]=(global.React||guac.react).useState(0),[R,C]=(global.React||guac.react).useState({left:"",right:""}),[M,W]=(global.React||guac.react).useState({left:"",right:""});(global.React||guac.react).useEffect((()=>{const e=document.querySelector('[data-container-id="fp-carousel-wrapper"]');if(e){const t=window.getComputedStyle(e);P(t.width)}const t=document.querySelector('[data-container-id="ols-featured-products"]');if(t){const e=window.getComputedStyle(t),o={left:e.marginLeft,right:e.marginRight},a={left:e.paddingLeft,right:e.paddingRight};C(o),W(a)}}),[d]);const I="xs"===d&&b===T.PUBLISH||a===m,x=!I&&("sm"===d&&b===T.PUBLISH||0===parseInt(R.left,10)||0===parseInt(R.right,10)),v=parseInt(y,10),D=I?1:Math.floor(v/(g+c)),k=Math.floor(D/2),B=t.length>D,A=x&&B,O=(e=>{let{isMobile:t,isInsetWithOverflow:o,containerWidth:a,slidesToShow:r,viewDevice:s}=e;if(t){const e=a-u;return s===m?Math.min(e,n):Math.min(e,i)}return o?Math.floor((a-2*p-(r-1)*g)/r):Math.floor((a-(r-1)*g)/r)})({isMobile:I,isInsetWithOverflow:A,containerWidth:v,slidesToShow:D,viewDevice:a}),U=[{component:h,position:"top",props:{icon:s,currentAssetIndex:o}},{component:h,position:"bottom",props:{icon:l,currentAssetIndex:o}}];return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{"data-container-id":"fp-carousel-wrapper",style:I&&E(M)},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:A&&{marginLeft:`${p}px`,marginRight:`${p}px`}},D>0&&(B?(global.React||guac.react).createElement(r.default,{style:{...f,track:D%2?f.track:S({slideWidth:O})},lazyLoad:!1,viewportWidth:"100%",initialSlide:k,children:t,dots:!1,arrows:!1,draggable:I,cellPadding:g,slideWidth:O,controls:I?[]:U,infinite:!0}):(global.React||guac.react).createElement(w,{children:t,slideWidth:O}))))};C.propTypes={children:(global.PropTypes||guac["prop-types"]).array,currentAssetIndex:(global.PropTypes||guac["prop-types"]).number,viewDevice:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,size:(global.PropTypes||guac["prop-types"]).string};var M,W=(M=C,class extends(global.React||guac.react).Component{constructor(){super(...arguments),this.handleMatchMedia=this.handleMatchMedia.bind(this),this.state={}}handleMatchMedia(e){this.state.size!==e.size&&this.setState({size:e.size})}render(){const{size:e}=this.state;return(global.React||guac.react).createElement("div",null,(global.React||guac.react).createElement(M,t._({},this.props,{size:e})),(global.React||guac.react).createElement(R,{onChange:this.handleMatchMedia}))}});class I extends(global.React||guac.react).Component{constructor(){super(...arguments),t.b(this,"onClickThumbnail",(e=>{this.setState({currentAssetIndex:e})})),this.handleClickViewAll=this.handleClickViewAll.bind(this),this.onClickThumbnail=this.onClickThumbnail.bind(this),this.state={containerWidth:null,currentAssetIndex:0}}componentDidUpdate(){"undefined"!=typeof yotpo&&setTimeout((()=>{const e=yotpo.allWidgetsReadyCallback;e&&0===e.filter((e=>e.name===a.h.name)).length&&yotpo.allWidgetsReadyCallback.push(a.h),yotpo.initWidgets()}),0)}handleClickViewAll(e){e.preventDefault(),o.RouteHandler.navigate(o.ShopViewConstants.PRODUCT_LISTING),o.ScrollWidgetActions.scrollShopWidget()}get showError(){const{willUseSampleData:e,useStaticData:t,error:o,configError:a,provisionHasError:r}=this.props;return!e&&!t&&(!!r||(a&&a.hasOwnProperty("status")||o&&o.hasOwnProperty("status")))}renderProductData(e){const{products:o,renderPrices:r,renderMode:s,shopWidgetSamePage:l,shopWidgetPageId:p,shopWidgetRoute:c,productDataWasLoaded:i,willUseSampleData:n,imageCropMethod:g,featuredProductsImageShape:u,featuredProductsShowBorder:b,showOnlyProductNameToggle:y,viewDevice:h,domainName:m,shopRoute:P,smartRibbonsSale:w,smartRibbonsBestseller:R,smartRibbonsNewProduct:T,smartRibbonsSaleOption:f,smartRibbonsBestsellerOption:S,smartRibbonsNewProductOption:E,smartRibbonStyle:C}=this.props,{Element:{Block:M}}=(global.Core||guac["@wsb/guac-widget-core"]).UX2,I={marginTop:"xxsmall",textAlign:"left"},x=b&&{style:{paddingRight:"!2px"}};let v;if(this.showError)v=(global.React||guac.react).createElement(t.E,{message:e("products.error_fetching_product_data")});else{if(!n&&!i)return null;if(o&&o.length){const e=o.map((e=>(global.React||guac.react).createElement(M,t._({key:e.slug},x),(global.React||guac.react).createElement(t.P,{productItemAs:(global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.CommerceCardItem,product:e,renderPrices:r,renderMode:s,shopWidgetSamePage:l,shopWidgetPageId:p,shopWidgetRoute:c,imageCropMethod:g,imageShape:u,isForegroundImage:!0,imageDimensions:{outputWidth:d},hasImageBorder:b,showOnlyProductName:y,cardSize:{xs:"large",sm:"small"},smartRibbonsSale:w,smartRibbonsBestseller:R,smartRibbonsNewProduct:T,selectedSaleRibbon:f,selectedBestsellerRibbon:S,selectedNewProductRibbon:E,smartRibbonStyle:C,ratings:(global.React||guac.react).createElement(a.P,{product:e,containerStyle:I,renderMode:s,domainName:m,shopRoute:P}),ratingsAlignLeft:!0}))));v=(global.React||guac.react).createElement(W,{onClickThumbnail:this.onClickThumbnail,currentAssetIndex:this.state.currentAssetIndex,viewDevice:h,renderMode:s},e)}else v=(global.React||guac.react).createElement(a.N,null)}return v}render(){const{fetching:e,products:o,willUseSampleData:r,renderMode:s,shopWidgetSamePage:l,shopWidgetPageId:p,shopWidgetRoute:c,translate:i}=this.props,n=this.renderProductData(i),{Block:g}=(global.Core||guac["@wsb/guac-widget-core"]).UX2.Element;return(global.React||guac.react).createElement(g,null,(global.React||guac.react).createElement(a.Y,{products:o}),(global.React||guac.react).createElement(g,{"data-route":""},n,(global.React||guac.react).createElement(a.B,{translate:i,productsLength:o.length,renderMode:s,shopWidgetSamePage:l,shopWidgetPageId:p,shopWidgetRoute:c,handleClickViewAll:this.handleClickViewAll})),(global.React||guac.react).createElement(t.F,{fetching:e,willUseSampleData:r}))}}I.propTypes={products:(global.PropTypes||guac["prop-types"]).array,imageCropMethod:(global.PropTypes||guac["prop-types"]).string,featuredProductsImageShape:(global.PropTypes||guac["prop-types"]).string,featuredProductsShowBorder:(global.PropTypes||guac["prop-types"]).bool,showOnlyProductNameToggle:(global.PropTypes||guac["prop-types"]).bool,error:(global.PropTypes||guac["prop-types"]).object,configError:(global.PropTypes||guac["prop-types"]).object,renderPrices:(global.PropTypes||guac["prop-types"]).any,renderMode:(global.PropTypes||guac["prop-types"]).string,shopWidgetSamePage:(global.PropTypes||guac["prop-types"]).bool,shopWidgetPageId:(global.PropTypes||guac["prop-types"]).any,shopWidgetRoute:(global.PropTypes||guac["prop-types"]).any,productDataWasLoaded:(global.PropTypes||guac["prop-types"]).bool,fetching:(global.PropTypes||guac["prop-types"]).bool,willUseSampleData:(global.PropTypes||guac["prop-types"]).bool,useStaticData:(global.PropTypes||guac["prop-types"]).bool,provisionHasError:(global.PropTypes||guac["prop-types"]).bool,viewDevice:(global.PropTypes||guac["prop-types"]).string,domainName:(global.PropTypes||guac["prop-types"]).string,shopRoute:(global.PropTypes||guac["prop-types"]).string,translate:(global.PropTypes||guac["prop-types"]).func,smartRibbonsSale:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsBestseller:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsNewProduct:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsSaleOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonsBestsellerOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonsNewProductOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonStyle:(global.PropTypes||guac["prop-types"]).string},I.defaultProps={products:[],configError:null,willUseSampleData:!1,provisionHasError:!1,useStaticData:!1,translate:()=>{}};var x=t.m(I,(e=>({translate:e.translate})));const v=e=>(global.React||guac.react).createElement(t.B,t._({},e,{Component:x}));v.propTypes={sectionTitle:(global.PropTypes||guac["prop-types"]).string,imageCropMethod:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,category:(global.PropTypes||guac["prop-types"]).string,section:(global.PropTypes||guac["prop-types"]).string,isReseller:(global.PropTypes||guac["prop-types"]).bool,order:(global.PropTypes||guac["prop-types"]).any,sampleProductsData:(global.PropTypes||guac["prop-types"]).object,isInternalPage:(global.PropTypes||guac["prop-types"]).bool,staticContent:(global.PropTypes||guac["prop-types"]).object,shopRoute:(global.PropTypes||guac["prop-types"]).string,domainName:(global.PropTypes||guac["prop-types"]).string,useStaticData:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsSale:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsBestseller:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsNewProduct:(global.PropTypes||guac["prop-types"]).bool,smartRibbonsSaleOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonsBestsellerOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonsNewProductOption:(global.PropTypes||guac["prop-types"]).string,smartRibbonStyle:(global.PropTypes||guac["prop-types"]).string},e.default=v,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-productGroup3-ProductGroup-a675c082.js.map