define("@wsb/guac-widget-shared/lib/components/Masonry-fbc3de73.js",["exports"],(function(e){"use strict";var t=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},n=Object.create(null);function i(e,t){return n[e]=n[e]||[],n[e].push(t),this}function o(e,t){return t._once=!0,i(e,t),this}function r(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t?n[e].splice(n[e].indexOf(t),1):delete n[e],this}function a(e){for(var t=this,i=arguments.length,o=Array(i>1?i-1:0),a=1;a0&&void 0!==arguments[0]?arguments[0]:{},t=void 0,i=void 0,o=void 0,r=void 0,a=void 0,s=void 0,c=void 0,l=void 0,d=void 0,u=void 0,p=void 0,h=void 0,g=void 0,f=0===e.packed.indexOf("data-")?e.packed:"data-"+e.packed,b=e.sizes.slice().reverse(),m=!1!==e.position,y=e.container.nodeType?e.container:document.querySelector(e.container),v={all:function(){return z(y.children)},new:function(){return z(y.children).filter((function(e){return!e.hasAttribute(""+f)}))}},k=[R,T,P],C=[M,x,O,q],w=n({pack:j,update:W,resize:D});return w;function E(e){e.forEach((function(e){return e()}))}function z(e){return Array.prototype.slice.call(e)}function I(e){return Array.apply(null,Array(e)).map((function(){return 0}))}function L(){return b.map((function(e){return e.mq&&window.matchMedia("(min-width: "+e.mq+")").matches})).indexOf(!0)}function R(){o=L()}function T(){r=-1===o?b[b.length-1]:b[o]}function P(){s=I(r.columns)}function M(){p=v[t?"new":"all"]()}function x(){0!==p.length&&(h=p.map((function(e){return e.clientWidth})),g=p.map((function(e){return e.clientHeight})))}function O(){p.forEach((function(e,t){a=s.indexOf(Math.min.apply(Math,s)),e.style.position="absolute",c=s[a]+"px",l=a*h[t]+a*r.gutter+"px",m?(e.style.top=c,e.style.left=l):e.style.transform="translate3d("+l+", "+c+", 0)",e.setAttribute(f,""),d=h[t],u=g[t],d&&u&&(s[a]+=u+r.gutter)}))}function q(){y.style.position="relative",y.style.width=r.columns*d+(r.columns-1)*r.gutter+"px",y.style.height=Math.max.apply(Math,s)-r.gutter+"px"}function A(){i||(window.requestAnimationFrame(_),i=!0)}function _(){o!==L()&&(j(),w.emit("resize",r)),i=!1}function j(){return t=!1,E(k.concat(C)),w.emit("pack")}function W(){return t=!0,E(C),w.emit("update")}function D(){return window[!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?"addEventListener":"removeEventListener"]("resize",A),w}}({position:!1,container:o,packed:"data-packed",sizes:"PREVIEW"===t&&"mobile"===e?[i[0]]:i})}addEventToChildren(){return(global.React||guac.react).Children.map(this.props.children,(e=>(global.React||guac.react).cloneElement(e,{onLoad:this.handleLoad,onError:this.handleLoad})))}componentDidMount(){const{renderMode:e,device:t,onLoad:n,container:i}=this.props;this.bricksInstance=this.initializeBricks(),"PREVIEW"===e&&"mobile"===t&&this.bricksInstance.pack(),n&&this.bricksInstance.once("pack",n),i&&(this.container="string"==typeof i?document.querySelector(i):i),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){if(e.device!==this.props.device)this.bricksInstance.pack();else{const e=this.getChildrenLength();e{this.container=e}},this.addEventToChildren())}}o.propTypes={children:(global.PropTypes||guac["prop-types"]).array,device:(global.PropTypes||guac["prop-types"]).string,sizes:(global.PropTypes||guac["prop-types"]).array,imageRefs:(global.PropTypes||guac["prop-types"]).array,renderMode:(global.PropTypes||guac["prop-types"]).string,container:(global.PropTypes||guac["prop-types"]).oneOfType([(global.PropTypes||guac["prop-types"]).string,(global.PropTypes||guac["prop-types"]).node]),onLoad:(global.PropTypes||guac["prop-types"]).func},o.defaultProps={sizes:[{columns:2,gutter:0},{mq:`${i}px`,columns:3,gutter:0}]},e.default=o,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=Masonry-fbc3de73.js.map