define("@widget/GALLERY/bs-gallery8-Gallery-9284fbcd.js",["exports","~/c/bs-dataAids"],(function(e,t){"use strict";function r(){return r=Object.assign||function(e){for(var t=1;t=e}));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null==(r=n.get(t.target))||r.forEach((function(e){e(a,t)}))}))}),e);o=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},a.set(t,r)}return r}(r),c=i.id,s=i.observer,g=i.elements,p=g.get(e)||[];return g.has(e)||g.set(e,p),p.push(t),s.observe(e),function(){p.splice(p.indexOf(t),1),0===p.length&&(g.delete(e),s.unobserve(e)),0===g.size&&(s.disconnect(),a.delete(c))}}var s=["children","as","triggerOnce","threshold","root","rootMargin","onChange","skip","trackVisibility","delay","initialInView","fallbackInView"];function g(e){return"function"!=typeof e.children}var p=function(e){var t,a;function n(t){var r;return(r=e.call(this,t)||this).node=null,r._unobserveCb=null,r.handleNode=function(e){r.node&&(r.unobserve(),e||r.props.triggerOnce||r.props.skip||r.setState({inView:!!r.props.initialInView,entry:void 0})),r.node=e||null,r.observeNode()},r.handleChange=function(e,t){e&&r.props.triggerOnce&&r.unobserve(),g(r.props)||r.setState({inView:e,entry:t}),r.props.onChange&&r.props.onChange(e,t)},r.state={inView:!!t.initialInView,entry:void 0},r}a=e,(t=n).prototype=Object.create(a.prototype),t.prototype.constructor=t,o(t,a);var i=n.prototype;return i.componentDidUpdate=function(e){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold&&e.skip===this.props.skip&&e.trackVisibility===this.props.trackVisibility&&e.delay===this.props.delay||(this.unobserve(),this.observeNode())},i.componentWillUnmount=function(){this.unobserve(),this.node=null},i.observeNode=function(){if(this.node&&!this.props.skip){var e=this.props,t=e.threshold,r=e.root,o=e.rootMargin,a=e.trackVisibility,n=e.delay,i=e.fallbackInView;this._unobserveCb=c(this.node,this.handleChange,{threshold:t,root:r,rootMargin:o,trackVisibility:a,delay:n},i)}},i.unobserve=function(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)},i.render=function(){if(!g(this.props)){var e=this.state,t=e.inView,o=e.entry;return this.props.children({inView:t,entry:o,ref:this.handleNode})}var a=this.props,n=a.children,i=a.as,l=function(e,t){if(null==e)return{};var r,o,a={},n=Object.keys(e);for(o=0;o=0||(a[r]=e[r]);return a}(a,s);return(global.React||guac.react).createElement(i||"div",r({ref:this.handleNode},l),n)},n}((global.React||guac.react).Component);p.displayName="InView",p.defaultProps={threshold:0,triggerOnce:!1,initialInView:!1};const{Link:u}=(global.Core||guac["@wsb/guac-widget-core"]).components,d=e=>{let{caption:t}=e;return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{category:"accent",section:"overlay",style:{background:"linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.75))",padding:"small",paddingTop:"medium",position:"absolute",width:"100%",bottom:"0px","@md":{padding:"medium",paddingTop:"large"}}},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Text,{tag:"figcaption",richtext:!0},t))};d.propTypes={caption:(global.PropTypes||guac["prop-types"]).string};const b=e=>{let{uniformHeight:r,imageData:o,caption:a,externalLink:n,...i}=e;const[l,s]=function(e){var t=void 0===e?{}:e,r=t.threshold,o=t.delay,a=t.trackVisibility,n=t.rootMargin,i=t.root,l=t.triggerOnce,s=t.skip,g=t.initialInView,p=t.fallbackInView,u=(global.React||guac.react).useRef(),d=(global.React||guac.react).useState({inView:!!g}),b=d[0],h=d[1],y=(global.React||guac.react).useCallback((function(e){void 0!==u.current&&(u.current(),u.current=void 0),s||e&&(u.current=c(e,(function(e,t){h({inView:e,entry:t}),t.isIntersecting&&l&&u.current&&(u.current(),u.current=void 0)}),{root:i,rootMargin:n,threshold:r,trackVisibility:a,delay:o},p))}),[Array.isArray(r)?r.toString():r,i,n,l,s,a,p,o]);(global.React||guac.react).useEffect((function(){u.current||!b.entry||l||s||h({inView:!!g})}));var f=[y,b.inView,b.entry];return f.ref=f[0],f.inView=f[1],f.entry=f[2],f}({threshold:0}),g={opacity:s?1:0,display:"block",transition:"opacity .5s ease-in-out",width:r?"auto":"95vw",height:r?"38vh":"auto",maxHeight:"100%","@md":{width:r?"auto":"35vw",height:r?"50vh":"auto"}},p=(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Image,t._({},i,{imageData:{...o,outputWidth:600},style:g}));return(global.React||guac.react).createElement("figure",{ref:l,style:{margin:0,padding:0,flexShrink:0,position:"relative",marginRight:r?"16px":"24px"}},n?(global.React||guac.react).createElement(u,{linkData:n},p):p,a&&(global.React||guac.react).createElement(d,{caption:a}))};b.propTypes={caption:(global.PropTypes||guac["prop-types"]).string,uniformHeight:(global.PropTypes||guac["prop-types"]).bool,imageData:(global.PropTypes||guac["prop-types"]).object,externalLink:(global.PropTypes||guac["prop-types"]).object};const h={box:{display:"flex",alignItems:"center",flexWrap:"nowrap",overflow:"auto",WebkitOverflowScrolling:"touch",scrollBehavior:"smooth"},indicator:{display:"none",height:"2px",width:"24px",background:"currentColor",margin:"4px",marginTop:"medium",borderRadius:"2px",cursor:"pointer",position:"relative",":after":{content:"''",display:"block",position:"absolute",top:"-16px",bottom:"-16px",left:"0px",right:"0px",padding:"4px"},"@md":{display:"block"}}},y={flexShrink:0,width:"24px",minHeight:"1px","@md":{width:"calc((100vw / 2) - (984px / 2) + 24px)"},"@lg":{width:"calc((100vw / 2) - (1160px / 2) + 24px)"},"@xl":{width:"calc((100vw / 2) - (1280px / 2) + 24px)"}},f=e=>{let{style:t}=e;return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{...y,...t}})};function m(e){let{galleryImages:r,uniformWidthOrHeight:o,enableImageDimension:a}=e;const n=(global.React||guac.react).useRef(null),[i,l]=(global.React||guac.react).useState(0),[c,s]=(global.React||guac.react).useState(0),g=(global.React||guac.react).useCallback((e=>{let{target:{scrollLeft:t,scrollWidth:r,offsetWidth:o}}=e;const a=i-1,n=(r-o)/a,l=Math.min(Math.floor(t/n),a);c!==l&&s(l)}),[i,c]);(global.React||guac.react).useEffect((()=>{const e=()=>{if(n.current){const e=Math.ceil(n.current.scrollWidth/n.current.offsetWidth);i!==e&&l(e)}},t=Array.from(document.querySelectorAll(".gallery-8-img"));return window.requestAnimationFrame(e),window.addEventListener("resize",e),t.forEach((t=>{t.addEventListener("load",e)})),()=>{window.removeEventListener("resize",e),t.forEach((t=>{t.removeEventListener("load",e)}))}}),[r,i]);const p="uniformHeight"===o;return(global.React||guac.react).createElement((global.React||guac.react).Fragment,null,(global.React||guac.react).createElement("div",{ref:n,onScroll:g,style:h.box},(global.React||guac.react).createElement(f,null),r.map(((e,r)=>{let{image:o,caption:n,externalLink:i}=e;const l={uniformHeight:p,caption:n,externalLink:i,className:"gallery-8-img",style:{cursor:"pointer"},imageData:{...o,enableImageDimension:a},"data-aid":t.a(r),...t.g(r,{isImage:!0})};return(global.React||guac.react).createElement(b,t._({key:r},l))})),(global.React||guac.react).createElement(f,{style:{width:p?"8px":0}})),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Container,null,i>1&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.HorizontalBox,{align:"middle"},Array.from({length:i}).map(((e,t)=>(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{key:t,style:{...h.indicator,color:t===c?"highContrast":"ultraLowContrast"},onClick:()=>{n.current.scrollLeft=n.current.scrollWidth/i*t}}))))))}f.propTypes={style:(global.PropTypes||guac["prop-types"]).object},m.propTypes={id:(global.PropTypes||guac["prop-types"]).string,category:(global.PropTypes||guac["prop-types"]).string,device:(global.PropTypes||guac["prop-types"]).string,galleryImages:(global.PropTypes||guac["prop-types"]).array.isRequired,renderAsThumbnail:(global.PropTypes||guac["prop-types"]).bool,renderMode:(global.PropTypes||guac["prop-types"]).string,section:(global.PropTypes||guac["prop-types"]).string,size:(global.PropTypes||guac["prop-types"]).string,staticContent:(global.PropTypes||guac["prop-types"]).object,uniformWidthOrHeight:(global.PropTypes||guac["prop-types"]).string,enableImageDimension:(global.PropTypes||guac["prop-types"]).bool},e.default=m,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-gallery8-Gallery-9284fbcd.js.map