react-stonecutter
Version:
Animated grid layout component for React
1 lines • 27.7 kB
JavaScript
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e){t.exports=require("react")},function(t,e){t.exports=require("prop-types")},function(t,e){t.exports=require("lodash.omit")},function(t,e){t.exports=require("shallowequal")},function(t,e){t.exports=require("react-motion")},function(t,e){t.exports=require("react-transition-group-plus")},function(t,e){t.exports=require("react-motion/lib/stripStyle")},function(t,e){t.exports=require("lodash.partition")},function(t,e){t.exports=require("lodash.debounce")},function(t,e){t.exports=require("enquire.js")},function(t,e){t.exports=require("imagesloaded")},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"enter",function(){return S}),n.d(r,"exit",function(){return P}),n.d(r,"entered",function(){return x});var o={};n.r(o),n.d(o,"quadIn",function(){return _}),n.d(o,"quadOut",function(){return T}),n.d(o,"quadInOut",function(){return I}),n.d(o,"cubicIn",function(){return z}),n.d(o,"cubicOut",function(){return C}),n.d(o,"cubicInOut",function(){return q}),n.d(o,"quartIn",function(){return R}),n.d(o,"quartOut",function(){return H}),n.d(o,"quartInOut",function(){return M}),n.d(o,"quintIn",function(){return U}),n.d(o,"quintOut",function(){return A}),n.d(o,"quintInOut",function(){return X}),n.d(o,"sineIn",function(){return D}),n.d(o,"sineOut",function(){return L}),n.d(o,"sineInOut",function(){return Y}),n.d(o,"expoIn",function(){return F}),n.d(o,"expoOut",function(){return B}),n.d(o,"expoInOut",function(){return G}),n.d(o,"circIn",function(){return Z}),n.d(o,"circOut",function(){return N}),n.d(o,"circInOut",function(){return J}),n.d(o,"backIn",function(){return K}),n.d(o,"backOut",function(){return Q}),n.d(o,"backInOut",function(){return V});var i={};n.r(i),n.d(i,"enter",function(){return ie}),n.d(i,"exit",function(){return ue}),n.d(i,"entered",function(){return ce});var u={};n.r(u),n.d(u,"enter",function(){return le}),n.d(u,"exit",function(){return se}),n.d(u,"entered",function(){return fe});var c={};n.r(c),n.d(c,"enter",function(){return pe}),n.d(c,"exit",function(){return ye}),n.d(c,"entered",function(){return de});var a={};n.r(a),n.d(a,"enter",function(){return be}),n.d(a,"exit",function(){return he}),n.d(a,"entered",function(){return ge});var l={};n.r(l),n.d(l,"enterExit",function(){return ve}),n.d(l,"enter",function(){return Oe}),n.d(l,"exit",function(){return we}),n.d(l,"entered",function(){return je});var s={};n.r(s),n.d(s,"enter",function(){return ke}),n.d(s,"exit",function(){return Se}),n.d(s,"entered",function(){return Pe});var f={};n.r(f),n.d(f,"enter",function(){return xe}),n.d(f,"exit",function(){return Ee}),n.d(f,"entered",function(){return We});var p=n(0),y=n.n(p),d=n(1),m=n.n(d),b=n(5),h=n.n(b),g=n(3),v=n.n(g),O=n(2),w=n.n(O),j=function(t,e){var n=e.columnWidth,r=e.itemHeight,o=void 0===r?150:r,i=e.columns,u=e.gutterWidth,c=e.gutterHeight;return{positions:t.map(function(t,e){var r=e%i,a=Math.floor(e/i);return[r*n+r*u,a*o+a*c]}),gridWidth:i*n+(i-1)*u,gridHeight:Math.ceil(t.length/i)*(o+c)-c}},k=function(){return{scale:0,opacity:0}},S=k,P=k,x=function(){return{scale:1,opacity:1}},E={columns:m.a.number.isRequired,columnWidth:m.a.number.isRequired,gutterWidth:m.a.number,gutterHeight:m.a.number,component:m.a.string,layout:m.a.func,enter:m.a.func,entered:m.a.func,exit:m.a.func,perspective:m.a.number,lengthUnit:m.a.string,angleUnit:m.a.string},W={lengthUnit:"px",angleUnit:"deg",component:"div",gutterWidth:0,gutterHeight:0,layout:j,enter:S,entered:x,exit:P},_="cubic-bezier(0.55, 0.085, 0.68, 0.53)",T="cubic-bezier(0.25, 0.46, 0.45, 0.94)",I="cubic-bezier(0.455, 0.03, 0.515, 0.955)",z="cubic-bezier(0.55, 0.055, 0.675, 0.19)",C="cubic-bezier(0.215, 0.61, 0.355, 1)",q="cubic-bezier(0.645, 0.045, 0.355, 1)",R="cubic-bezier(0.895, 0.03, 0.685, 0.22)",H="cubic-bezier(0.165, 0.84, 0.44, 1)",M="cubic-bezier(0.77, 0, 0.175, 1)",U="cubic-bezier(0.755, 0.05, 0.855, 0.06)",A="cubic-bezier(0.23, 1, 0.32, 1)",X="cubic-bezier(0.86, 0, 0.07, 1)",D="cubic-bezier(0.47, 0, 0.745, 0.715)",L="cubic-bezier(0.39, 0.575, 0.565, 1)",Y="cubic-bezier(0.445, 0.05, 0.55, 0.95)",F="cubic-bezier(0.95, 0.05, 0.795, 0.035)",B="cubic-bezier(0.19, 1, 0.22, 1)",G="cubic-bezier(1, 0, 0, 1)",Z="cubic-bezier(0.6, 0.04, 0.98, 0.335)",N="cubic-bezier(0.075, 0.82, 0.165, 1)",J="cubic-bezier(0.785, 0.135, 0.15, 0.86)",K="cubic-bezier(0.6, -0.28, 0.735, 0.045)",Q="cubic-bezier(0.175, 0.885, 0.32, 1.275)",V="cubic-bezier(0.68, -0.55, 0.265, 1.55)",$=function(t){if("string"!=typeof t.type)throw new Error("Expected children to be simple React Elements but got a React Component. Try wrapping your components e.g. <li key={id}><MyComponent /></li>")},tt=[{name:"translateX",unit:"length"},{name:"translateY",unit:"length"},{name:"perspective",unit:"length"},{name:"translateZ",unit:"length"},{name:"skew",unit:"angle"},{name:"skewX",unit:"angle"},{name:"skewY",unit:"angle"},{name:"scale"},{name:"scaleX"},{name:"scaleY"},{name:"scaleZ"},{name:"rotate",unit:"angle"},{name:"rotateX",unit:"angle"},{name:"rotateY",unit:"angle"}],et=function(t){return{translateX:t[0],translateY:t[1]}},nt=function(t,e,n){var r=[];return tt.forEach(function(o){if("perspective"===o.name)void 0!==e&&r.push("perspective(".concat(e).concat(n[o.unit],")"));else if(void 0!==t[o.name]){var i=function(t){var e=Number(t);return e!=e}(t[o.name])?0:t[o.name];r.push("".concat(o.name,"(").concat(i).concat(o.unit?n[o.unit]:"",")"))}}),r.join(" ")};function rt(t){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(){return(ot=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function it(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){st(t,e,n[e])})}return t}function ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ct(t){return(ct=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function at(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lt(t,e){return(lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function st(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ft=function(t){function e(){var t,n,r,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,u=new Array(i),c=0;c<i;c++)u[c]=arguments[c];return r=this,o=(t=ct(e)).call.apply(t,[this].concat(u)),n=!o||"object"!==rt(o)&&"function"!=typeof o?at(r):o,st(at(n),"state",{style:{zIndex:2}}),st(at(n),"setEndStyle",function(t,e){if(clearTimeout(n.leaveTimeout),n.itemIsMounted){var r=t.position,o=t.gridProps,i=t.gridState;n.setState(function(n){return{style:it({},n.style,{zIndex:e},o.entered(t,o,i),et(r))}})}}),n}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&<(t,e)}(e,p["Component"]),n=e,(r=[{key:"componentDidMount",value:function(){this.itemIsMounted=!0}},{key:"componentWillReceiveProps",value:function(t){var e=this;v()(t,this.props)||requestAnimationFrame(function(){e.setEndStyle(t,2)})}},{key:"componentWillUnmount",value:function(){this.itemIsMounted=!1,clearTimeout(this.leaveTimeout)}},{key:"componentWillAppear",value:function(t){this.setEndStyle(this.props,2),t()}},{key:"componentWillEnter",value:function(t){var e=this;clearTimeout(this.leaveTimeout);var n=this.props,r=n.position,o=n.gridProps,i=n.gridState;requestAnimationFrame(function(){e.setState(function(t){return{style:it({},t.style,et(r),{zIndex:1},o.enter(e.props,o,i))}}),t()})}},{key:"componentDidEnter",value:function(){var t=this;requestAnimationFrame(function(){requestAnimationFrame(function(){t.setEndStyle(t.props,1)})})}},{key:"componentWillLeave",value:function(t){var e=this,n=this.props,r=n.gridProps,o=n.gridState,i=n.duration;requestAnimationFrame(function(){e.itemIsMounted&&(e.setState(function(t){return{style:it({},t.style,{zIndex:0},r.exit(e.props,r,o))}}),e.leaveTimeout=setTimeout(t,i))})}},{key:"render",value:function(){var t=this.props,e=t.transition,n=t.perspective,r=t.lengthUnit,o=t.angleUnit,i=t.children,u=y.a.Children.only(i),c=u.type,a=this.state.style,l=a.translateX,s=a.translateY,f=a.opacity,p=a.zIndex;if(void 0===l||void 0===s)return null;var d=nt(a,n,{length:r,angle:o}),m=w()(u.props,["itemRect","itemHeight"]);return y.a.createElement(c,ot({},m,{style:it({},m.style,{position:"absolute",top:0,left:0,zIndex:p,opacity:f,transform:d,transition:e,WebkitTransform:d,WebkitTransition:e})}))}}])&&ut(n.prototype,r),o&&ut(n,o),e}();function pt(t){return(pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yt(){return(yt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function dt(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function mt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){Ot(t,e,n[e])})}return t}function bt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ht(t,e){return!e||"object"!==pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function gt(t){return(gt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function vt(t,e){return(vt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ot(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var wt=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=ht(this,gt(e).call(this,t))).state=n.doLayout(t),n}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&vt(t,e)}(e,p["Component"]),n=e,(r=[{key:"componentWillReceiveProps",value:function(t){v()(t,this.props)||this.setState(this.doLayout(t))}},{key:"doLayout",value:function(t){var e=t.layout(y.a.Children.toArray(t.children).map(function(t){return $(t),mt({},t.props,{key:t.key})}),t),n=e.positions;return{gridWidth:e.gridWidth,gridHeight:e.gridHeight,positions:n}}},{key:"render",value:function(){var t=this,e=w()(this.props,["itemHeight","measured","columns","columnWidth","gutterWidth","gutterHeight","layout","enter","entered","exit","perspective","springConfig","angleUnit"]),n=e.component,r=e.style,o=e.children,i=e.duration,u=e.easing,c=e.lengthUnit,a=dt(e,["component","style","children","duration","easing","lengthUnit"]),l=y.a.Children.toArray(o),s=this.state,f=s.positions,p=s.gridWidth,d=s.gridHeight,m=["opacity","transform"].map(function(t){return"".concat(t," ").concat(i,"ms ").concat(u)}).join(", "),b=l.map(function(e,n){return y.a.createElement(ft,yt({key:e.key,position:f[n]},t.props,{transition:m,gridProps:t.props,gridState:t.state}),e)});return y.a.createElement(h.a,yt({component:n,style:mt({position:"relative"},r,{width:"".concat(p).concat(c),height:"".concat(d).concat(c)})},a),b)}}])&&bt(n.prototype,r),o&&bt(n,o),e}();Ot(wt,"propTypes",mt({},E,{duration:m.a.number.isRequired,easing:m.a.string})),Ot(wt,"defaultProps",mt({},W,{easing:C}));var jt=n(4),kt=n(6),St=n.n(kt);function Pt(t){return(Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function xt(){return(xt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Et(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function Wt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){Ct(t,e,n[e])})}return t}function _t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Tt(t){return(Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function It(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zt(t,e){return(zt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var qt=function(t){function e(t){var n,r,o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=this,o=Tt(e).call(this,t),n=!o||"object"!==Pt(o)&&"function"!=typeof o?It(r):o,Ct(It(n),"willEnter",function(t){var e=n.state,r=e.gridWidth,o=e.gridHeight,i=n.props.enter;return Wt({},St()(t.style),{zIndex:1},i(t.data.element.props,n.props,{gridWidth:r,gridHeight:o}))}),Ct(It(n),"willLeave",function(t){var e=n.props,r=e.exit,o=e.springConfig,i=n.state,u=i.gridWidth,c=i.gridHeight,a=r(t.data.element.props,n.props,{gridWidth:u,gridHeight:c});return Wt({},t.style,{zIndex:0},Rt(a,o))}),n.state=n.doLayout(t),n}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&zt(t,e)}(e,p["Component"]),n=e,(r=[{key:"componentWillReceiveProps",value:function(t){v()(t,this.props)||this.setState(this.doLayout(t))}},{key:"doLayout",value:function(t){var e=y.a.Children.toArray(t.children).map(function(t){return $(t),{key:t.key,data:{element:t}}}),n=t.layout(e.map(function(t){return Wt({},t.data.element.props,{key:t.data.element.key})}),t),r=n.positions,o=n.gridWidth,i=n.gridHeight;return{styles:r.map(function(n,r){return Wt({},e[r],{style:Wt({},e[r].style,{zIndex:2},Rt(t.entered(e[r].data.element.props,t,{gridWidth:o,gridHeight:i}),t.springConfig),Rt(et(n),t.springConfig))})}),gridWidth:o,gridHeight:i}}},{key:"render",value:function(){var t=w()(this.props,["itemHeight","measured","columns","columnWidth","gutterWidth","gutterHeight","layout","enter","entered","exit","springConfig","duration","easing"]),e=t.component,n=t.style,r=t.perspective,o=t.lengthUnit,i=t.angleUnit,u=Et(t,["component","style","perspective","lengthUnit","angleUnit"]),c=this.state,a=c.styles,l=c.gridWidth,s=c.gridHeight;return y.a.createElement(jt.TransitionMotion,{styles:a,willEnter:this.willEnter,willLeave:this.willLeave},function(t){return y.a.createElement(e,xt({style:Wt({position:"relative"},n,{width:"".concat(l).concat(o),height:"".concat(s).concat(o)})},u),t.map(function(t){var e=t.style,n=e.opacity,u=e.zIndex,c=t.data,a=c.element.type,l=nt(t.style,r,{length:o,angle:i}),s=w()(c.element.props,["itemRect","itemHeight"]);return y.a.createElement(a,xt({key:c.element.key},s,{style:Wt({},s.style,{position:"absolute",top:0,left:0,zIndex:u,opacity:n,transform:l,WebkitTransform:l,msTransform:l})}))}))})}}])&&_t(n.prototype,r),o&&_t(n,o),e}();function Rt(t,e){return Object.keys(t).reduce(function(n,r){return n[r]=Object(jt.spring)(t[r],e),n},{})}function Ht(t){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Mt(){return(Mt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function At(t){return(At=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Xt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Dt(t,e){return(Dt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Lt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Ct(qt,"propTypes",Wt({},E,{springConfig:m.a.shape({stiffness:m.a.number,damping:m.a.number,precision:m.a.number})})),Ct(qt,"defaultProps",Wt({},W,{springConfig:{stiffness:60,damping:14,precision:.1}}));var Yt="undefined"!=typeof window?n(9):null,Ft=function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.maxWidth,i=r.minPadding,u=void 0===i?0:i,c=r.defaultColumns,a=void 0===c?4:c;return n=e=function(e){function n(){var t,e,r,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);for(var i=arguments.length,u=new Array(i),c=0;c<i;c++)u[c]=arguments[c];return r=this,e=!(o=(t=At(n)).call.apply(t,[this].concat(u)))||"object"!==Ht(o)&&"function"!=typeof o?Xt(r):o,Lt(Xt(e),"state",{columns:a}),e}var r,i,c;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Dt(t,e)}(n,p["Component"]),r=n,(i=[{key:"componentDidMount",value:function(){for(var t=this,e=this.props,n=e.columnWidth,r=e.gutterWidth,i=[],c=function(t){return t*(n+r)-r+u},a=2;c(a)<=o+n+r;a++)i.push(c(a));this.breakpoints=i.map(function(t,e,n){return["screen",e>0&&"(min-width: ".concat(n[e-1],"px)"),e<n.length-1&&"(max-width: ".concat(t,"px)")].filter(Boolean).join(" and ")}).map(function(e,n){return{breakpoint:e,handler:function(){return t.setState({columns:n+1})}}}),this.breakpoints.forEach(function(t){var e=t.breakpoint,n=t.handler;return Yt.register(e,{match:n})})}},{key:"componentWillUnmount",value:function(){this.breakpoints.forEach(function(t){var e=t.breakpoint,n=t.handler;return Yt.unregister(e,n)})}},{key:"render",value:function(){return y.a.createElement(t,Mt({},this.props,this.state))}}])&&Ut(r.prototype,i),c&&Ut(r,c),n}(),Lt(e,"defaultProps",{gutterWidth:W.gutterWidth}),n},Bt=n(7),Gt=n.n(Bt),Zt=n(8),Nt=n.n(Zt);function Jt(t){return(Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Kt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Qt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){ne(t,e,n[e])})}return t}function Vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $t(t){return($t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function te(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ee(t,e){return(ee=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ne(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var re="undefined"!=typeof window?n(10):null,oe=function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.measureImages,i=r.background;return n=e=function(e){function n(t){var e,r,u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),r=this,u=$t(n).call(this,t),e=!u||"object"!==Jt(u)&&"function"!=typeof u?te(r):u,ne(te(e),"measureElements",function(){if(e.elementsToMeasureContainer){var t=e.elementsToMeasureContainer.children;t.length&&(o?Array.from(t).filter(function(t){return!e.loading[t.dataset.stonecutterkey]}).forEach(function(t){e.loading[t.dataset.stonecutterkey]=!0,re(t,{background:i},function(){e.measureElementWithImages(t,5)})}):(e.rects=Array.from(t).reduce(function(t,e){return t[e.dataset.stonecutterkey]=e.getBoundingClientRect(),t},{}),e.updateRects()))}}),ne(te(e),"measureElementWithImages",function(t,n){var r=t.getBoundingClientRect();r&&r.height>0?(e.rects[t.dataset.stonecutterkey]=r,delete e.loading[t.dataset.stonecutterkey],e.updateRectsDebounced()):n>0&&(clearTimeout(e.retryTimeouts[t.dataset.stonecutterkey]),e.retryTimeouts[t.dataset.stonecutterkey]=setTimeout(e.measureElement,20,t,--n))}),ne(te(e),"updateRects",function(){e.setState(function(t){var n=te(e).rects;return e.rects={},{rects:Qt({},t.rects,n)}})}),e.rects={},e.loading={},e.retryTimeouts={},e.state={rects:{}},e}var r,u,c;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ee(t,e)}(n,p["Component"]),r=n,(u=[{key:"componentDidMount",value:function(){this.updateRectsDebounced=Nt()(this.updateRects,20),this.measureElements()}},{key:"componentDidUpdate",value:function(){this.measureElements()}},{key:"componentWillUnmount",value:function(){var t=this;Object.keys(this.retryTimeouts).forEach(function(e){clearTimeout(t.retryTimeouts[e])})}},{key:"render",value:function(){var e=this,n=this.props,r=n.component,o=n.children,i=n.columnWidth,u=this.state.rects,c=Kt(Gt()(y.a.Children.toArray(o),function(t){return!u[t.key]}),2),a=c[0],l=c[1],s=a.map(function(t){return y.a.cloneElement(t,{style:Qt({},t.props.style,{width:i}),"data-stonecutterkey":t.key})}),f=l.map(function(t){return y.a.cloneElement(t,{itemRect:u[t.key]})});return y.a.createElement("span",null,f.length>0&&y.a.createElement(t,this.props,f),s.length>0&&y.a.createElement(r,{style:{width:0,height:0,padding:0,margin:0,overflow:"hidden",visibility:"hidden"},ref:function(t){e.elementsToMeasureContainer=t}},s))}}])&&Vt(r.prototype,u),c&&Vt(r,c),n}(),ne(e,"defaultProps",{component:W.component}),n},ie=function(){return{rotateX:-90,scale:1,opacity:1}},ue=function(){return{rotateX:-90,scale:0,opacity:0}},ce=function(){return{rotateX:0,scale:1,opacity:1}},ae=function(t,e,n){var r=e.columns,o=e.columnWidth;return{translateX:(r*o+(r-1)*e.gutterWidth-o)/2,translateY:n.gridHeight/2,scale:0,opacity:0}},le=ae,se=ae,fe=function(){return{scale:1,opacity:1}},pe=function(){return{translateX:-500,opacity:0}},ye=function(t,e,n){return{translateX:n.gridWidth+500,opacity:0}},de=function(){return{opacity:1}},me=function(){return{translateY:0,opacity:0}},be=me,he=me,ge=function(){return{opacity:1}},ve=function(t,e,n){return{translateY:n.gridHeight+500,opacity:0}},Oe=ve,we=ve,je=function(){return{opacity:1}},ke=function(){return{scale:0,opacity:0,rotate:-720}},Se=function(){return{scale:0,opacity:0}},Pe=function(){return{scale:1,opacity:1,rotate:0}},xe=function(){return{skew:90,rotate:45,scale:0,opacity:0}},Ee=function(){return{skew:-90,rotate:-45,scale:0,opacity:0}},We=function(){return{skew:0,rotate:0,scale:1,opacity:1}};n.d(e,"layout",function(){return _e}),n.d(e,"enterExitStyle",function(){return Te}),n.d(e,"CSSGrid",function(){return wt}),n.d(e,"SpringGrid",function(){return qt}),n.d(e,"measureItems",function(){return oe}),n.d(e,"makeResponsive",function(){return Ft}),n.d(e,"easings",function(){return o});var _e={pinterest:function(t,e){for(var n=e.columns,r=e.columnWidth,o=e.gutterWidth,i=e.gutterHeight,u=[],c=0;c<n;c++)u.push(0);return{positions:t.map(function(t){var e=u.indexOf(Math.min.apply(null,u)),n=t.itemHeight||t.itemRect&&t.itemRect.height;if(!n||"number"!=typeof n)throw new Error('Each child must have an "itemHeight" prop or an "itemRect.height" prop.');var c=e*r+e*o,a=u[e];return u[e]+=Math.round(n)+i,[c,a]}),gridWidth:n*r+(n-1)*o,gridHeight:Math.max.apply(null,u)-i}},simple:j},Te={foldUp:i,fromCenter:u,fromLeftToRight:c,fromTop:a,fromBottom:l,newspaper:s,simple:r,skew:f};e.default={CSSGrid:wt,SpringGrid:qt,measureItems:oe,makeResponsive:Ft,easings:o,layout:_e,enterExitStyle:Te}}]);