react-flip-toolkit
Version:
Configurable FLIP animation helpers for React
6 lines • 29.7 kB
JavaScript
/*!
* react-flip-toolkit v1.0.0
* MIT Licensed
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactFlipToolkit=e(require("react")):t.ReactFlipToolkit=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"currentTime",function(){return a}),r.d(e,"onFrameStart",function(){return b}),r.d(e,"onFrameUpdate",function(){return O}),r.d(e,"onFrameRender",function(){return w}),r.d(e,"onFrameEnd",function(){return P}),r.d(e,"cancelOnFrameStart",function(){return _}),r.d(e,"cancelOnFrameUpdate",function(){return M}),r.d(e,"cancelOnFrameRender",function(){return x}),r.d(e,"cancelOnFrameEnd",function(){return j}),r.d(e,"timeSinceLastFrame",function(){return F}),r.d(e,"currentFrameTime",function(){return C});var n=0,o="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),r=Math.max(0,16.7-(e-n));n=e+r,setTimeout(function(){return t(n)},r)};function i(t){var e=[],r=[],n=0,o=!1,i=0;return{cancel:function(t){var e=r.indexOf(t);-1!==e&&r.splice(e,1)},process:function(){for(o=!0,e=(t=[r,e])[0],(r=t[1]).length=0,n=e.length,i=0;i<n;i++)e[i]();var t;o=!1},schedule:function(i,a){void 0===a&&(a=!1),t();var u=a&&o,c=u?e:r;-1===c.indexOf(i)&&(c.push(i),u&&(n=e.length))}}}var a="undefined"!=typeof performance&&void 0!==performance.now?function(){return performance.now()}:function(){return Date.now()},u=!1,c=40,s=16.7,f=!0,l=0,p=0;function d(){u||(u=!0,f=!0,o(g))}var v=i(d),h=i(d),m=i(d),y=i(d);function g(t){u=!1,p=f?s:Math.max(Math.min(t-l,c),1),f||(s=p),l=t,v.process(),h.process(),m.process(),y.process(),u&&(f=!1)}var b=v.schedule,O=h.schedule,w=m.schedule,P=y.schedule,_=v.cancel,M=h.cancel,x=m.cancel,j=y.cancel,F=function(){return p},C=function(){return l}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(e,"__esModule",{value:!0});var u=r(14),c=r(15),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.create=function(t){return new e(t)},e.prototype.start=function(t){void 0===t&&(t={});var e=!1,r={stop:function(){}},n=this.props,o=n.init,u=a(n,["init"]),s=o(c.default(t,u,function(){e=!0,r.stop()}));return r=s?i({},r,s):r,t.registerParent&&t.registerParent(r),e&&r.stop(),r},e}(u.default);e.Action=s,e.default=function(t){return new s({init:t})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.createReversedEasing=function(t){return function(e){return 1-t(1-e)}},e.createMirroredEasing=function(t){return function(e){return e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2}},e.linear=function(t){return t},e.createExpoIn=function(t){return function(e){return Math.pow(e,t)}},e.easeIn=e.createExpoIn(2),e.easeOut=e.createReversedEasing(e.easeIn),e.easeInOut=e.createMirroredEasing(e.easeIn),e.circIn=function(t){return 1-Math.sin(Math.acos(t))},e.circOut=e.createReversedEasing(e.circIn),e.circInOut=e.createMirroredEasing(e.circOut),e.createBackIn=function(t){return function(e){return e*e*((t+1)*e-t)}},e.backIn=e.createBackIn(1.525),e.backOut=e.createReversedEasing(e.backIn),e.backInOut=e.createMirroredEasing(e.backIn),e.createAnticipateEasing=function(t){var r=e.createBackIn(t);return function(t){return(t*=2)<1?.5*r(t):.5*(2-Math.pow(2,-10*(t-1)))}},e.anticipate=e.createAnticipateEasing(1.525);var n=8,o=.001,i=1e-7,a=10,u=11,c=1/(u-1),s="undefined"!=typeof Float32Array,f=function(t,e){return 1-3*e+3*t},l=function(t,e){return 3*e-6*t},p=function(t){return 3*t},d=function(t,e,r){return 3*f(e,r)*t*t+2*l(e,r)*t+p(e)},v=function(t,e,r){return((f(e,r)*t+l(e,r))*t+p(e))*t};e.cubicBezier=function(t,e,r,f){var l=s?new Float32Array(u):new Array(u),p=!1,h=function(e){for(var s,f,p,h=0,m=1,y=u-1;m!=y&&l[m]<=e;++m)h+=c;return s=(e-l[--m])/(l[m+1]-l[m]),(p=d(f=h+s*c,t,r))>=o?function(e,o){for(var i=0,a=0;i<n;++i){if(0===(a=d(o,t,r)))return o;o-=(v(o,t,r)-e)/a}return o}(e,f):0===p?f:function(e,n,o){var u,c,s=0;do{(u=v(c=n+(o-n)/2,t,r)-e)>0?o=c:n=c}while(Math.abs(u)>i&&++s<a);return c}(e,h,h+c)},m=function(){p=!0,t==e&&r==f||function(){for(var e=0;e<u;++e)l[e]=v(e*c,t,r)}()};return function(n){return p||m(),t===e&&r===f?n:0===n?0:1===n?1:v(h(n),e,f)}}},function(t,e,r){"use strict";var n=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(0),i=r(4),a=r(5),u=function(t){return t};e.appendUnit=function(t){return function(e){return""+e+t}},e.applyOffset=function(t,e){var r=!0;void 0===e&&(e=t,r=!1);return function(n){return r?function(t){return t+e}(function(e){return e-t}(n)):(t=n,r=!0,e)}};var c=function(t,e,r){var n=t*t,o=e*e;return Math.sqrt(r*(o-n)+n)};e.blendColor=function(t,e){var r="string"==typeof t?i.color.parse(t):t,o="string"==typeof e?i.color.parse(e):e,u=n({},r),s=void 0!==t.hue||"string"==typeof t&&i.hsla.test(t)?a.getValueFromProgress:c;return function(t){for(var e in u=n({},u))"alpha"!==e&&u.hasOwnProperty(e)&&(u[e]=s(r[e],o[e],t));return u.alpha=a.getValueFromProgress(r.alpha,o.alpha,t),u}},e.clamp=function(t,e){return function(r){return Math.min(Math.max(r,t),e)}};var s=function(t,e){return function(r){return e(t(r))}};e.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce(s)},e.conditional=function(t,e){return function(r){return t(r)?e(r):r}};e.interpolate=function(t,e,r){var n,o,i,u,c=t.length;return 2!==c?function(t,e,r,n){var o=r-1;return t[0]>t[o]&&(t.reverse(),e.reverse()),function(i){if(i<=t[0])return e[0];if(i>=t[o])return e[o];for(var u=1;u<r&&!(t[u]>i||u===o);u++);var c=a.getProgressFromValue(t[u-1],t[u],i),s=n?n[u-1](c):c;return a.getValueFromProgress(e[u-1],e[u],s)}}(t,e,c,r):(n=t[0],o=t[1],i=e[0],u=e[1],function(t){return(t-n)*(u-i)/(o-n)+i})},e.generateStaticSpring=function(t){return void 0===t&&(t=u),function(e,r){return function(n){var o=r-n,i=-e*(0-t(Math.abs(o)));return o<=0?r+i:r-i}}},e.linearSpring=e.generateStaticSpring(),e.nonlinearSpring=e.generateStaticSpring(Math.sqrt),e.wrap=function(t,e){return function(r){var n=e-t;return((r-t)%n+n)%n+t}},e.smooth=function(t){void 0===t&&(t=50);var e=0,r=0;return function(n){var i=o.currentFrameTime(),u=i!==r?i-r:0,c=u?a.smooth(n,e,u,t):e;return r=i,e=c,c}},e.snap=function(t){if("number"==typeof t)return function(e){return Math.round(e/t)*t};var e=0,r=t.length;return function(n){var o=Math.abs(t[0]-n);for(e=1;e<r;e++){var i=t[e],a=Math.abs(i-n);if(0===a)return i;if(a>o)return t[e-1];if(e===r-1)return i;o=a}}},e.steps=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),function(n){var o=a.getProgressFromValue(e,r,n);return a.getValueFromProgress(e,r,a.stepProgress(t,o))}},e.transformMap=function(t){return function(e){var r=n({},e);for(var o in t)if(t.hasOwnProperty(o)){var i=t[o];r[o]=i(e[o])}return r}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"getValueFromFunctionString",function(){return u}),r.d(e,"splitCommaDelimited",function(){return c}),r.d(e,"splitColorValues",function(){return s}),r.d(e,"number",function(){return f}),r.d(e,"alpha",function(){return l}),r.d(e,"degrees",function(){return p}),r.d(e,"percent",function(){return d}),r.d(e,"px",function(){return v}),r.d(e,"scale",function(){return h}),r.d(e,"complex",function(){return g}),r.d(e,"rgbUnit",function(){return O}),r.d(e,"rgba",function(){return w}),r.d(e,"hsla",function(){return P}),r.d(e,"hex",function(){return _}),r.d(e,"color",function(){return M});var n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},i=function(t){return{test:(e=t,function(t){return"string"==typeof t&&-1!==t.indexOf(e)}),parse:parseFloat,transform:function(e){return""+e+t}};var e},a=function(t){return function(e){return"string"==typeof e&&0===e.indexOf(t)}},u=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},c=function(t){return"string"==typeof t?t.split(/,\s*/):[t]};function s(t){var e=t.length;return function(r){for(var n={},o=c(u(r)),i=0;i<e;i++)n[t[i]]=void 0!==o[i]?parseFloat(o[i]):1;return n}}var f={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},l=n({},f,{transform:o(0,1)}),p=i("deg"),d=i("%"),v=i("px"),h=n({},f,{default:1}),m=/(-)?(\d[\d\.]*)/g,y=function(t){return"${"+t+"}"},g={test:function(t){var e=t.match&&t.match(m);return void 0!==e&&e.constructor===Array&&e.length>1},parse:function(t){var e={};return t.match(m).forEach(function(t,r){return e[r]=parseFloat(t)}),e},createTransformer:function(t){var e=0,r=t.replace(m,function(){return y(""+e++)});return function(t){var e=r;for(var n in t)t.hasOwnProperty(n)&&(e=e.replace(y(n),t[n].toString()));return e}}},b=o(0,255),O=n({},f,{transform:function(t){return Math.round(b(t))}}),w={test:a("rgb"),parse:s(["red","green","blue","alpha"]),transform:function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha;return function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha;return"rgba("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({red:O.transform(e),green:O.transform(r),blue:O.transform(n),alpha:o})}},P={test:a("hsl"),parse:s(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha;return function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha;return"hsla("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({hue:Math.round(e),saturation:d.transform(r),lightness:d.transform(n),alpha:o})}},_=n({},w,{test:a("#"),parse:function(t){var e,r,n;return t.length>4?(e=t.substr(1,2),r=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),r=t.substr(2,1),n=t.substr(3,1),e+=e,r+=r,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:1}}}),M={test:function(t){return w.test(t)||P.test(t)||_.test(t)},parse:function(t){return w.test(t)?w.parse(t):P.test(t)?P.parse(t):_.test(t)?_.parse(t):t},transform:function(t){return function(t){return void 0!==t.red}(t)?w.transform(t):function(t){return void 0!==t.hue}(t)?P.transform(t):t}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return"number"==typeof t};e.isPoint=function(t){return void 0!==t.x&&void 0!==t.y},e.isPoint3D=function(t){return void 0!==t.z};var o={x:0,y:0,z:0},i=function(t,e){return Math.abs(t-e)};e.angle=function(t,r){return void 0===r&&(r=o),e.radiansToDegrees(Math.atan2(r.y-t.y,r.x-t.x))},e.degreesToRadians=function(t){return t*Math.PI/180},e.dilate=function(t,e,r){return t+(e-t)*r},e.distance=function(t,r){if(void 0===r&&(r=o),n(t)&&n(r))return i(t,r);if(e.isPoint(t)&&e.isPoint(r)){var a=i(t.x,r.x),u=i(t.y,r.y),c=e.isPoint3D(t)&&e.isPoint3D(r)?i(t.z,r.z):0;return Math.sqrt(Math.pow(a,2)+Math.pow(u,2)+Math.pow(c,2))}return 0},e.getProgressFromValue=function(t,e,r){var n=e-t;return 0===n?1:(r-t)/n},e.getValueFromProgress=function(t,e,r){return-r*t+r*e+t},e.pointFromAngleAndDistance=function(t,r,n){return r=e.degreesToRadians(r),{x:n*Math.cos(r)+t.x,y:n*Math.sin(r)+t.y}},e.radiansToDegrees=function(t){return 180*t/Math.PI},e.smooth=function(t,e,r,n){return void 0===n&&(n=0),o=e+r*(t-e)/Math.max(n,r),void 0===i&&(i=2),i=Math.pow(10,i),Math.round(o*i)/i;var o,i},e.speedPerFrame=function(t,e){return n(t)?t/(1e3/e):0},e.speedPerSecond=function(t,e){return e?t*(1e3/e):0},e.stepProgress=function(t,e){var r=1/(t-1),n=1-1/t,o=Math.min(e/n,1);return Math.floor(o/r)*r}},function(t,e,r){"use strict";r.d(e,"a",function(){return f});var n,o,i=r(7),a=r.n(i),u=r(12),c=r(2);r.n(c);function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var f=a.a.createContext("flip"),l=(o=n=function(t){function e(){var r,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=n=s(this,t.call.apply(t,[this].concat(i))),n.inProgressAnimations={},n.flipCallbacks={},s(n,r)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getSnapshotBeforeUpdate=function(t){return t.flipKey!==this.props.flipKey?Object(u.b)(this.el):null},e.prototype.componentDidUpdate=function(t,e,r){this.props.flipKey!==t.flipKey&&(this.inProgressAnimations=Object(u.a)({cachedFlipChildrenPositions:r,containerEl:this.el,duration:this.props.duration,ease:c[this.props.ease],inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks}))},e.prototype.render=function(){var t=this;return a.a.createElement(f.Provider,{value:this.flipCallbacks},a.a.createElement("div",{ref:function(e){return t.el=e}},this.props.children))},e}(i.Component),n.defaultProps={duration:250,ease:"easeOut"},o);e.b=l},function(e,r){e.exports=t},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=r(1);e.default=function(t){var e=t.getCount,r=t.getFirst,i=t.getOutput,a=t.mapApi,u=t.setProp,c=t.startActions;return function(t){return o.default(function(o){var s=o.update,f=o.complete,l=o.error,p=e(t),d=i(),v=function(){return s(d)},h=0,m=c(t,function(t,e){var r=!1;return t.start({complete:function(){r||(r=!0,++h===p&&n.onFrameUpdate(f))},error:l,update:function(t){u(d,e,t),n.onFrameUpdate(v,!0)}})});return Object.keys(r(m)).reduce(function(t,e){return t[e]=a(m,e),t},{})})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(8).default({getOutput:function(){return[]},getCount:function(t){return t.length},getFirst:function(t){return t[0]},mapApi:function(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.map(function(t,n){if(t[e])return Array.isArray(r[0])?t[e](r[0][n]):t[e].apply(t,r)})}},setProp:function(t,e,r){return t[e]=r},startActions:function(t,e){return t.map(function(t,r){return e(t,r)})}});e.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(t)}},function(t,e,r){t.exports=r(11)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(6);r.d(e,"Flipper",function(){return n.b});var o=r(21);r.d(e,"Flipped",function(){return o.a})},function(t,e,r){"use strict";r.d(e,"b",function(){return h}),r.d(e,"a",function(){return y});var n=r(13),o=r.n(n),i=r(2),a=(r.n(i),r(9)),u=r.n(a),c=r(20),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=function(t,e){return[].slice.call(t.querySelectorAll('*[data-inverse-flip-id="'+e+'"]'))},l=function(t,e){return!("string"==typeof t&&!(t=t.split(",").filter(function(t){return t})).some(function(t){return t===e}))},p=function(t,e){var r=e.matrix,n=e.opacity;t.style.transform="matrix("+[r[0],r[1],r[4],r[5],r[12],r[13]].join(", ")+")",t.style.opacity=n},d=function(t,e,r){return!(t.dataset.flipComponentIdFilter&&!l(t.dataset.flipComponentIdFilter,e)&&!l(t.dataset.flipComponentIdFilter,r))},v=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.flipStartId,o=r.flipEndId;t.forEach(function(t){if(d(t,n,o)){var r=e[12],i=e[13],a=e[0],u=e[5],c={};t.dataset.translateX&&(c.translateX=-r/a),t.dataset.translateY&&(c.translateY=-i/u),t.dataset.scaleX&&(c.scaleX=1/a),t.dataset.scaleY&&(c.scaleY=1/u),t.style.transform="translate("+c.translateX+"px, "+c.translateY+"px) scale("+c.scaleX+", "+c.scaleY+")"}})},h=function(t){return[].slice.apply(t.querySelectorAll("*[data-flip-id]")).map(function(t){return[t.dataset.flipId,{rect:t.getBoundingClientRect(),opacity:parseFloat(window.getComputedStyle(t).opacity),flipComponentId:t.dataset.flipComponentId}]}).reduce(function(t,e){var r;return s({},t,((r={})[e[0]]=e[1],r))},{})},m=function(t){var e=t.top,r=t.bottom,n=t.left,o=t.right;return r>0&&e<window.innerHeight&&o>0&&n<window.innerWidth},y=function(t){var e=t.inProgressAnimations,r=void 0===e?{}:e,n=t.cachedFlipChildrenPositions,a=void 0===n?{}:n,l=t.flipCallbacks,y=void 0===l?{}:l,g=t.containerEl,b=t.duration,O=t.ease,w=document.querySelector("body"),P=h(g);return Object.keys(P).forEach(function(t){if(a[t]&&P[t]){var e=a[t].rect,n=P[t].rect,l=a[t].opacity,h=P[t].opacity;if((m(e)||m(n))&&(e.left!==n.left||e.top!==n.top||e.width!==n.width||e.height!==n.height||l!==h)){var _=g.querySelector('*[data-flip-id="'+t+'"]'),M=a[t].flipComponentId,x=_.dataset.flipComponentId;if(d(_,M,x)){var j=c.b(getComputedStyle(_).transform),F={matrix:j},C={},E=[j];_.dataset.translateX&&E.push(c.e(e.left-n.left)),_.dataset.translateY&&E.push(c.f(e.top-n.top)),_.dataset.scaleX&&E.push(c.c(e.width/Math.max(n.width,1e-4))),_.dataset.scaleY&&E.push(c.d(e.height/Math.max(n.height,1e-4))),_.dataset.opacity&&(C.opacity=l,F.opacity=h),_.dataset.transformOrigin&&(_.style.transformOrigin=_.dataset.transformOrigin),f(_,t).forEach(function(t){t.dataset.transformOrigin&&(t.style.transformOrigin=t.dataset.transformOrigin)}),r[t]&&(r[t].stop(),r[t].onComplete(),delete r[t]),C.matrix=E.reduce(c.a),p(_,C),v(f(_,t),C,{flipStartId:M,flipEndId:x}),y[t]&&y[t].onStart&&y[t].onStart(_,M);var I={duration:_.dataset.flipDuration||b,ease:_.dataset.flipEase&&i[_.dataset.flipEase]||i[O]},A=function(){};y[t]&&y[t].onComplete&&(A=function(){return y[t].onComplete(_,M)});var S=u()(o()(s({from:C.matrix,to:F.matrix},I)),o()(s({from:{opacity:C.opacity},to:{opacity:F.opacity}},I))).start({update:function(e){var r=e[0],n=e[1];w.contains(_)?(p(_,s({},n,{matrix:r})),v(f(_,t),r,{flipStartId:M,flipEndId:x})):S&&S()},complete:function(){delete r[t],requestAnimationFrame(function(){_.style.transform=""}),A()}}).stop;r[t]={stop:S,onComplete:A}}}}}),r}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=r(1),i=r(5),a=r(2),u=r(3),c=r(16),s=r(17),f=u.clamp(0,1);e.default=function(t){return void 0===t&&(t={}),o.default(function(e){var r,o=e.update,l=e.complete,p=t.duration,d=void 0===p?300:p,v=t.ease,h=void 0===v?a.easeOut:v,m=t.flip,y=void 0===m?0:m,g=t.loop,b=void 0===g?0:g,O=t.yoyo,w=void 0===O?0:O,P=t.from,_=void 0===P?0:P,M=t.to,x=void 0===M?1:M,j=t.elapsed,F=void 0===j?0:j,C=t.playDirection,E=void 0===C?1:C,I=t.flipCount,A=void 0===I?0:I,S=t.yoyoCount,k=void 0===S?0:S,T=t.loopCount,R=void 0===T?0:T,V=s.default({from:_,to:x,ease:h}).start(o),Y=0,q=!1,D=function(){return E*=-1},U=function(){Y=f(i.getProgressFromValue(0,d,F)),V.seek(Y)},X=function(){q=!0,r=c.default().start(function(){F+=n.timeSinceLastFrame()*E,U(),function(){var t=1===E?q&&F>=d:q&&F<=0;if(!t)return!1;if(t&&!b&&!y&&!w)return!0;var e,r=!1;return b&&R<b?(F=0,R++,r=!0):y&&A<y?(F=d-F,_=(e=[x,_])[0],x=e[1],V=s.default({from:_,to:x,ease:h}).start(o),A++,r=!0):w&&k<w&&(D(),k++,r=!0),!r}()&&l&&(r.stop(),n.onFrameUpdate(l,!0))})},B=function(){q=!1,r&&r.stop()};return X(),{isActive:function(){return q},getElapsed:function(){return u.clamp(0,d)(F)},getProgress:function(){return Y},stop:function(){B()},pause:function(){return B(),this},resume:function(){return X(),this},seek:function(t){return F=i.getValueFromProgress(0,d,t),n.onFrameUpdate(U,!0),this},reverse:function(){return D(),this}}})}},function(t,e,r){"use strict";var n=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(3),i=function(){function t(t){void 0===t&&(t={}),this.props=t}return t.prototype.applyMiddleware=function(t){return this.create(n({},this.props,{middleware:this.props.middleware?[t].concat(this.props.middleware):[t]}))},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=1===t.length?t[0]:o.pipe.apply(void 0,t);return this.applyMiddleware(function(t){return function(e){return t(r(e))}})},t.prototype.while=function(t){return this.applyMiddleware(function(e,r){return function(n){return t(n)?e(n):r()}})},t.prototype.filter=function(t){return this.applyMiddleware(function(e,r){return function(r){return t(r)&&e(r)}})},t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){return function(t,e){var r=t.middleware,n=t.onComplete,o=this;this.isActive=!0,this.update=function(t){o.observer.update&&o.updateObserver(t)},this.complete=function(){o.observer.complete&&o.isActive&&o.observer.complete(),o.onComplete&&o.onComplete(),o.isActive=!1},this.error=function(t){o.observer.error&&o.isActive&&o.observer.error(t),o.isActive=!1},this.observer=e,this.updateObserver=function(t){return e.update(t)},this.onComplete=n,e.update&&r&&r.length&&r.forEach(function(t){return o.updateObserver=t(o.updateObserver,o.complete)})}}();e.Observer=n,e.default=function(t,e,r){var o=e.middleware;return new n({middleware:o,onComplete:r},"function"==typeof t?{update:t}:t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=r(1);e.default=function(){return o.default(function(t){var e=t.update,r=!0,o=n.currentTime(),i=function(){r&&(e(Math.max(n.currentFrameTime()-o,0)),n.onFrameUpdate(i))};return n.onFrameUpdate(i),{stop:function(){return r=!1}}})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4),o=r(1),i=r(18),a=r(5),u=r(2);e.default=i.default(function(t){var e=t.from,r=void 0===e?0:e,n=t.to,i=void 0===n?1:n,c=t.ease,s=void 0===c?u.linear:c;return o.default(function(t){var e=t.update;return{seek:function(t){return e(t)}}}).pipe(s,function(t){return a.getValueFromProgress(r,i,t)})},{ease:function(t){return"function"==typeof t},from:n.number.test,to:n.number.test})},function(t,e,r){"use strict";var n=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(4),i=r(19),a=r(9),u=r(3),c=o.color.test,s=function(t,e){return"string"==typeof e.from&&c(e.from)&&"string"==typeof e.to&&c(e.to)?t(n({},e,{from:0,to:1})).pipe(u.blendColor(e.from,e.to),o.color.transform):t(e)};e.default=function(t,e){var r=function(t){var e=Object.keys(t);return{getVectorKeys:function(r){return e.reduce(function(e,n){return void 0===r[n]||t[n](r[n])||e.push(n),e},[])},test:function(r){return r&&e.reduce(function(e,n){return e||void 0!==r[n]&&!t[n](r[n])},!1)}}}(e),o=r.test,u=r.getVectorKeys;return function(e){if(!o(e))return t(e);var r=u(e),f=e[r[0]];return Array.isArray(f)?function(t,e,r){var o=r[0],i=e[o].map(function(o,i){return s(t,r.reduce(function(t){return function(e,r){return e[r]=e[r][t],e}}(i),n({},e)))});return a.default.apply(void 0,i)}(t,e,r):"string"==typeof f&&c(f)?function(t,e){return s(t,e)}(t,e):function(t,e,r){var o=r[0],a=Object.keys(e[o]).reduce(function(o,i){return o[i]=s(t,r.reduce(function(t){return function(e,r){return e[r]=e[r][t],e}}(i),n({},e))),o},{});return i.default(a)}(t,e,r)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(8).default({getOutput:function(){return{}},getCount:function(t){return Object.keys(t).length},getFirst:function(t){return t[Object.keys(t)[0]]},mapApi:function(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Object.keys(t).reduce(function(n,o){return t[o][e]&&(r[0]&&void 0!==r[0][o]?n[o]=t[o][e](r[0][o]):n[o]=(i=t[o])[e].apply(i,r)),n;var i},{})}},setProp:function(t,e,r){return t[e]=r},startActions:function(t,e){return Object.keys(t).reduce(function(r,n){return r[n]=e(t[n],n),r},{})}});e.default=n},function(t,e,r){"use strict";function n(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var e=o();return e[0]=t[0],e[1]=t[1],e[4]=t[2],e[5]=t[3],e[12]=t[4],e[13]=t[5],e}throw new RangeError("Expected array with either 6 or 16 values.")}function o(){for(var t=[],e=0;e<16;e++)e%5==0?t.push(1):t.push(0);return t}function i(t,e){for(var r=n(t),o=n(e),i=[],a=0;a<4;a++)for(var u=[r[a],r[a+4],r[a+8],r[a+12]],c=0;c<4;c++){var s=4*c,f=[o[s],o[s+1],o[s+2],o[s+3]],l=u[0]*f[0]+u[1]*f[1]+u[2]*f[2]+u[3]*f[3];i[a+s]=l}return i}function a(t){if("string"==typeof t){var e=t.match(/matrix(3d)?\(([^)]+)\)/);if(e)return n(e[2].split(", ").map(parseFloat))}return o()}function u(t){var e=o();return e[0]=t,e}function c(t){var e=o();return e[5]=t,e}function s(t){var e=o();return e[12]=t,e}function f(t){var e=o();return e[13]=t,e}r.d(e,"a",function(){return i}),r.d(e,"b",function(){return a}),r.d(e,"c",function(){return u}),r.d(e,"d",function(){return c}),r.d(e,"e",function(){return s}),r.d(e,"f",function(){return f})},function(t,e,r){"use strict";var n=r(7),o=r.n(n),i=r(22),a=r.n(i),u=r(6),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};a.a.node.isRequired,a.a.string,a.a.string,a.a.bool,a.a.bool,a.a.bool,a.a.bool,a.a.bool,a.a.bool,a.a.bool,a.a.string,a.a.string,a.a.number,a.a.func,a.a.func,a.a.string,a.a.string;e.a=function(t){var e=t.children,r=t.flipId,i=t.onStart,a=t.onComplete,s=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["children","flipId","onStart","onComplete"]),f=void 0;try{f=n.Children.only(e)}catch(t){throw new Error("Each Flipped element must wrap a single child")}s.scale||s.translate||s.translateX||s.translateY||s.scaleX||s.opacity||s.scaleY||(s.all=!0),s.all?(delete s.all,Object.assign(s,{translateX:!0,translateY:!0,scaleX:!0,scaleY:!0,opacity:!0})):s.scale?(delete s.scale,Object.assign(s,{scaleX:!0,scaleY:!0})):s.translate&&(delete s.translate,Object.assign(s,{translateX:!0,translateY:!0}));var l=Object.entries(s).map(function(t){return[t[0].replace("translate","data-translate-").replace("scale","data-scale-").replace("opacity","data-opacity").replace("inverseFlipId","data-inverse-flip-id").replace("transformOrigin","data-transform-origin").replace("componentIdFilter","data-flip-component-id-filter").replace("componentId","data-flip-component-id").replace("ease","data-flip-ease").replace("duration","data-flip-duration").toLowerCase(),t[1]]}).reduce(function(t,e){var r;return c({},t,((r={})[e[0]]=e[1],r))},{});return r&&(l["data-flip-id"]=r),o.a.createElement(u.a.Consumer,null,function(t){return t[r]={onStart:i,onComplete:a},Object(n.cloneElement)(f,l)})}},function(t,e,r){t.exports=r(23)()},function(t,e,r){"use strict";var n=r(24),o=r(25),i=r(26);t.exports=function(){function t(t,e,r,n,a,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var r={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return r.checkPropTypes=n,r.PropTypes=r,r}},function(t,e,r){"use strict";function n(t){return function(){return t}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(t){return t},t.exports=o},function(t,e,r){"use strict";var n=function(t){};t.exports=function(t,e,r,o,i,a,u,c){if(n(e),!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,o,i,a,u,c],l=0;(s=new Error(e.replace(/%s/g,function(){return f[l++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}}},function(t,e,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}]).default});
//# sourceMappingURL=react-flip-toolkit.min.js.map