define("@widget/LAYOUT/bs-BackgroundCarousel-Component-e8d1f5c2.js",["exports","~/c/bs-_rollupPluginBabelHelpers","~/c/bs-dataAids","@wsb/guac-widget-shared@^1/lib/components/Carousel","~/c/bs-index","~/c/bs-overlayTypes","~/c/bs-utils","~/c/bs-PortalContainer"],(function(e,a,o,t,r,p,l,s){"use strict";const n="slides";(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,video:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,coordinates:(global.PropTypes||guac["prop-types"]).shape({x:(global.PropTypes||guac["prop-types"]).number,y:(global.PropTypes||guac["prop-types"]).number}),editedAspectRatio:(global.PropTypes||guac["prop-types"]).string,height:(global.PropTypes||guac["prop-types"]).string,width:(global.PropTypes||guac["prop-types"]).string,left:(global.PropTypes||guac["prop-types"]).string,top:(global.PropTypes||guac["prop-types"]).string,rotation:(global.PropTypes||guac["prop-types"]).string,scale:(global.PropTypes||guac["prop-types"]).number,position:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number});const g=(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,coordinates:(global.PropTypes||guac["prop-types"]).shape({x:(global.PropTypes||guac["prop-types"]).number,y:(global.PropTypes||guac["prop-types"]).number}),editedAspectRatio:(global.PropTypes||guac["prop-types"]).string,height:(global.PropTypes||guac["prop-types"]).string,width:(global.PropTypes||guac["prop-types"]).string,left:(global.PropTypes||guac["prop-types"]).string,top:(global.PropTypes||guac["prop-types"]).string,rotation:(global.PropTypes||guac["prop-types"]).string,scale:(global.PropTypes||guac["prop-types"]).number,position:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number}),i=(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,video:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number}),c=(global.PropTypes||guac["prop-types"]).shape({autoplay:(global.PropTypes||guac["prop-types"]).bool,autoplayDelay:(global.PropTypes||guac["prop-types"]).number,transition:(global.PropTypes||guac["prop-types"]).oneOf(["fade","slide"]),type:(global.PropTypes||guac["prop-types"]).oneOf(["imagesOnly",n]),dots:(global.PropTypes||guac["prop-types"]).bool,arrows:(global.PropTypes||guac["prop-types"]).bool,slides:(global.PropTypes||guac["prop-types"]).arrayOf((global.PropTypes||guac["prop-types"]).shape({image:g,heroContent:(global.PropTypes||guac["prop-types"]).shape({tagline:(global.PropTypes||guac["prop-types"]).string,tagline2:(global.PropTypes||guac["prop-types"]).string,cta:(global.PropTypes||guac["prop-types"]).object})})),alignmentOption:(global.PropTypes||guac["prop-types"]).string,themeConfig:(global.PropTypes||guac["prop-types"]).shape({height:(global.PropTypes||guac["prop-types"]).string,maxWidthPercent:(global.PropTypes||guac["prop-types"]).number})});(global.PropTypes||guac["prop-types"]).shape({mediaType:(global.PropTypes||guac["prop-types"]).oneOf([p.I,p.V,p.S]).isRequired,background:g,video:i,slideshow:c});const{DEFAULT:d,ALT:u,OVERLAY:b}=(global.Core||guac["@wsb/guac-widget-core"]).constants.sectionTypes,y=e=>{let{data:a,blur:o,children:t,dataRoute:r,dataAid:l,overlay:s,treatment:n,style:g={},backgroundSize:i,section:c,showOverlay:d,disableOverlayMobile:u}=e;const{image:y,position:h,alt:m,overlayAlpha:T}=a;if(!y)return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,null,t);const P=n===p.L,w=i||"cover",v={...(h||"").indexOf(" ")>-1?{backgroundPosition:h}:{},...g};return P?(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.Background,{backgroundSize:"contain",imageData2:{...a,additionalUrlParams:["fx-bl=s:30"]},backgroundSize2:"cover","data-aid":l,"data-field-id":r,"aria-label":m,section:b,style:v,overlay:s,treatment:n,"data-ht":n,overlayAlpha:d?T:0,disableOverlayMobile:u,imageData:a},t):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.Background,{"data-aid":l,"data-field-id":r,"aria-label":m,section:c,style:v,overlay:s,treatment:n,"data-ht":n,backgroundSize:w,overlayAlpha:d?T:0,disableOverlayMobile:u,imageData:a,blur:o},t)};y.propTypes={blur:(global.PropTypes||guac["prop-types"]).bool,data:g.isRequired,dataAid:(global.PropTypes||guac["prop-types"]).string,children:(global.PropTypes||guac["prop-types"]).any,overlay:(global.PropTypes||guac["prop-types"]).oneOf([p.C,p.P,p.N,p.A,p.a]),section:(global.PropTypes||guac["prop-types"]).oneOf([d,u,b]),style:(global.PropTypes||guac["prop-types"]).object,treatment:(global.PropTypes||guac["prop-types"]).oneOf([p.F,p.b,p.c,p.B,p.L]),backgroundSize:(global.PropTypes||guac["prop-types"]).string,mobileSize:(global.PropTypes||guac["prop-types"]).string,dataRoute:(global.PropTypes||guac["prop-types"]).string,showOverlay:(global.PropTypes||guac["prop-types"]).bool,disableOverlayMobile:(global.PropTypes||guac["prop-types"]).bool},y.defaultProps={blur:!1,dataAid:o.D.BACKGROUND_IMAGE_RENDERED,overlay:p.a,section:b,showOverlay:!0};class h extends(global.React||guac.react).Component{constructor(){super(...arguments),a._(this,"goToSlide",((e,a)=>{a.stopPropagation(),this.props.goToSlide(e)}))}render(){const{numSlides:e,selectedIndex:o,editingIndex:t,visible:r,containerId:p}=this.props;if(e<=1)return null;const l={list:{listStyle:"none",padding:0,marginTop:0,marginBottom:p?0:"medium","@md":{marginBottom:p?0:"large"}},listItem:{display:"inline-block",cursor:"pointer"},wrapper:{display:r?"block":"none",position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",width:"100%",zIndex:2}},n=[];for(let r=0;r=0?{"data-field-id":"slides","data-field-route":`/mediaData/slides/${r}`}:{"data-edit-interactive":!0};n.push((global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,a.a({tag:"li",key:`dot-${r}`,style:l.listItem,onClick:this.goToSlide.bind(null,r)},p),(global.React||guac.react).createElement(e,{"data-aid":`SLIDE_SELECTION_DOT_${r}`})))}const g=(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{tag:"ul",style:l.list},n);return p?(global.React||guac.react).createElement(s.P,{containerId:p},g):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:l.wrapper},g)}}h.propTypes={numSlides:(global.PropTypes||guac["prop-types"]).number,selectedIndex:(global.PropTypes||guac["prop-types"]).number,goToSlide:(global.PropTypes||guac["prop-types"]).func,editingIndex:(global.PropTypes||guac["prop-types"]).number,visible:(global.PropTypes||guac["prop-types"]).bool,containerId:(global.PropTypes||guac["prop-types"]).string};const m=(global.React||guac.react).createContext("");function T(e){const{numSlides:o,editingIndex:t,visible:r,containerId:l,mobileContainerId:n,nextSlide:g,prevSlide:i,viewDevice:c,renderMode:d}=e,[u,b]=(global.React||guac.react).useState(!1),[y,h]=(global.React||guac.react).useState(!1),T=(global.React||guac.react).useContext(m),P=(global.React||guac.react).useCallback((e=>{e.stopPropagation(),i()}),[i]),w=(global.React||guac.react).useCallback((e=>{e.stopPropagation(),g()}),[g]),v=(global.React||guac.react).useCallback((e=>{const a=d===(global.Core||guac["@wsb/guac-widget-core"]).constants.renderModes.PUBLISH?"xs"===e.size:function(e){return/mobile/i.test(e)}(c);y&&a===u||(b(a),h(!0))}),[c,d,u,y,b,h]);if(o<=1)return null;const C={overlay:{display:r&&y?"flex":"none",justifyContent:"center",position:"absolute","@xs-only":{bottom:0,left:"small",right:"small",marginBottom:"small"},"@sm":{left:0,right:0,top:T===p.d?"unset":"calc(50% - 20px)",bottom:T===p.d?30:"unset"}}},f=t>=0?{"data-route":"/mediaData"}:{},E=(global.React||guac.react).createElement((global.React||guac.react).Fragment,null,(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX.MatchMedia,{onChange:v}),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Group.SlideshowArrows,null,(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Button.Previous,a.a({onClick:P,"data-edit-interactive":!0},f)),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Button.Next,a.a({onClick:w,"data-edit-interactive":!0},f))));return u&&n?(global.React||guac.react).createElement(s.P,{containerId:n},E):l?(global.React||guac.react).createElement(s.P,{containerId:l},E):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:C.overlay},E)}T.propTypes={numSlides:(global.PropTypes||guac["prop-types"]).number,prevSlide:(global.PropTypes||guac["prop-types"]).func,nextSlide:(global.PropTypes||guac["prop-types"]).func,editingIndex:(global.PropTypes||guac["prop-types"]).number,visible:(global.PropTypes||guac["prop-types"]).bool,containerId:(global.PropTypes||guac["prop-types"]).string,mobileContainerId:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,viewDevice:(global.PropTypes||guac["prop-types"]).string};class P extends(global.React||guac.react).Component{componentDidUpdate(){const{goToSlide:e,editingIndex:a}=this.props;"number"==typeof a&&a>=0&&e(a)}render(){return null}}P.propTypes={renderKey:(global.PropTypes||guac["prop-types"]).number,editingIndex:(global.PropTypes||guac["prop-types"]).number,goToSlide:(global.PropTypes||guac["prop-types"]).func};const{renderModes:{LAYOUT:w,DISPLAY:v,PUBLISH:C,EDIT:f}}=(global.Core||guac["@wsb/guac-widget-core"]).constants,E=[/mediaData\/slides\/(\d+).*/,/mediaData\/(\d+).*\/image/];class I extends(global.React||guac.react).Component{constructor(){super(...arguments),this.state={currentSlide:0,showText:!1,navOpen:!1},this.afterChange=this.afterChange.bind(this),this.beforeChange=this.beforeChange.bind(this),this.handleNavDrawerOpened=this.handleNavDrawerOpened.bind(this),this.handleNavDrawerClosed=this.handleNavDrawerClosed.bind(this),this.getSlideEditingIndex=this.getSlideEditingIndex.bind(this),this._loadedImages=new Set}fireTransitionEvent(e){window.dispatchEvent(new CustomEvent("slideshowTransition",{detail:{slide:e,id:this.props.slideshow.themeConfig.slideshowId}}))}afterChange(e){const{renderMode:a,slideshow:o}=this.props,{type:t,themeConfig:{useHeroCarousel:r}}=o;a!==C||t!==n||r||l.p(o,e),this.setState({currentSlide:e,showText:!1},(()=>{setTimeout((()=>{this.setState({showText:!0})}),800)})),this.fireTransitionEvent(e)}beforeChange(e){this.fireTransitionEvent(e)}handleNavDrawerOpened(){this.setState({navOpen:!0})}handleNavDrawerClosed(){this.setState({navOpen:!1})}componentDidMount(){this.afterChange(0),window.addEventListener("NavigationDrawerOpened",this.handleNavDrawerOpened),window.addEventListener("NavigationDrawerClosed",this.handleNavDrawerClosed)}componentWillUnmount(){window.removeEventListener("NavigationDrawerOpened",this.handleNavDrawerOpened),window.removeEventListener("NavigationDrawerClosed",this.handleNavDrawerClosed)}getSlideEditingIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{renderMode:a}=this.props;if(a===C)return-1;let o=-1;return E.forEach((a=>{const t=e.match(a);t&&t[1]&&(o=parseInt(t[1],10))})),o}render(){const{slideshow:e,renderMode:p,mutatorPath:s,dataRoute:g,viewDevice:i,heroContainerStyle:c,...d}=this.props,{currentSlide:u,showText:b,navOpen:m}=this.state,{slides:C,type:E,autoplay:I,autoplayDelay:S,transition:R,dots:D,arrows:x,alignmentOption:O,heroIdPrefix:k,themeConfig:A}=e,{maxWidthPercent:U=100,useHeroCarousel:M,dotsContainerId:N,arrowsContainerId:B,mobileArrowsContainerId:L}=A,X=[w,v].includes(p),_={height:"100%",...c};let H=!1;const z=new Set(X?[0]:[u-1<0?C.length-1:u-1,u,u+1===C.length?0:u+1]),W=C.map(((e,t)=>{const s=e||{},g=s.image||{},i=`${o.D.HEADER_SLIDE}_${t}`,c=x?Math.min(U,80):U;let h;if(E===n&&!M){let e=!1;!H&&s.tagline&&(e=!0,H=!0),h=(global.React||guac.react).createElement(l.S,{slide:s,index:t,forceH1:e,alignmentOption:O,heroIdPrefix:k,themeConfig:A,renderMode:p,currentSlide:u,showText:b,slideWidthPercent:c,style:_})}return g.image&&(this._loadedImages.has(g.image)||z.has(t))?(this._loadedImages.add(g.image),(global.React||guac.react).createElement(y,a.a({key:t,data:{overlayAlpha:r.D,...g}},(global._||guac.lodash).pick(d,Object.keys(y.propTypes)),{style:_,dataAid:i,dataRoute:""}),h)):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{key:t,style:_,dataAid:i},h)})),j=this.getSlideEditingIndex(s),$={mobile:!1,position:"bottom",editingIndex:j,viewDevice:i,renderMode:p},F=[];D&&F.push({component:h,props:{...$,visible:!m,containerId:N}}),x&&F.push({component:T,props:{...$,visible:!m,containerId:B,mobileContainerId:L}});let Y=I;if(X||m)Y=!1;else if(p===f){Y=I&&-1===j;const e=u===j?0:Math.random();F.push({component:P,props:{renderKey:e,editingIndex:j}})}const G=parseFloat(S),K={style:{container:{height:"100%"},containerInner:{height:"100%"},track:{height:"100%"},..."slide"===R?{slide:{opacity:1}}:{}},viewportWidth:"100%",viewportHeight:"100%",height:"100%",slideWidth:"100%",slideHeight:"100%",autoplay:Y,autoplaySpeed:Number.isNaN(G)?7e3:Math.max(1e3*G,2e3),transition:R,transitionDuration:1e3,infinite:!0,lazyLoad:!1,dots:!1,arrows:!1,draggable:Y||D||x,pauseOnHover:!1,afterChange:this.afterChange,beforeChange:this.beforeChange,controls:F};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{height:"100%"}},p===f&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{"data-field-id":g,style:{position:"absolute",top:0,bottom:0,left:0,right:0}}),(global.React||guac.react).createElement(t.default,K,W))}}I.propTypes={slideshow:(global.PropTypes||guac["prop-types"]).object,heroTrackId:(global.PropTypes||guac["prop-types"]).string,dataRoute:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,viewDevice:(global.PropTypes||guac["prop-types"]).string,mutatorPath:(global.PropTypes||guac["prop-types"]).string,heroContainerStyle:(global.PropTypes||guac["prop-types"]).object},e.default=I,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-BackgroundCarousel-Component-e8d1f5c2.js.map