Repository navigation
Expand file tree
/
Copy pathimpulse.min.js
More file actions
54 lines (54 loc) · 26.9 KB
/
Copy pathimpulse.min.js
File metadata and controls
54 lines (54 loc) · 26.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
!function(v){if("object"==typeof exports)module.exports=v();else if("function"==typeof define&&define.amd)define(v);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self);b.Impulse=v()}}(function(){return function b(d,g,c){function a(e,k){if(!g[e]){if(!d[e]){var l="function"==typeof require&&require;if(!k&&l)return l(e,!0);if(f)return f(e,!0);throw Error("Cannot find module '"+e+"'");}l=g[e]={exports:{}};d[e][0].call(l.exports,function(c){var f=
d[e][1][c];return a(f?f:c)},l,l.exports,b,d,g,c)}return g[e].exports}for(var f="function"==typeof require&&require,k=0;k<c.length;k++)a(c[k]);return a}({1:[function(b,d,g){var c=b("./body"),a=b("./simulation"),f=b("./boundry");g=b("./animation");var k=b("./vector"),e=b("./util").height;d.exports=g({defaultOptions:{acceleration:1E3,bounce:!1,minBounceDistance:5,damping:.2,restitution:.2},onStart:function(b,l,h,n,m,q){q=h.sub(l).normalize();var r=q.mult(n.acceleration),t=q.mult(n.bounceAcceleration||
n.acceleration),d=f({left:h.x>l.x?-Infinity:h.x,right:h.x>l.x?h.x:Infinity,top:h.y>l.y?-Infinity:h.y,bottom:h.y>l.y?h.y:Infinity}),g;if(.001>h.sub(l).norm()&&.001>b.norm())return m.done(h,b);var s=n.restitution||n.damping,u=this._body=c(b,l,{accelerate:function(a,c){return g?t:r},update:function(a,c){d.contains(a)?m.state(a,c):n.bounce&&Math.abs(e(t.norm(),c.norm()*s,0))>n.minBounceDistance?(g=!0,u.position=k(h),u.velocity.selfMult(-n.damping),m.state(h,u.velocity)):m.done(h,c)}});a.addBody(this._body)},
onEnd:function(){a.removeBody(this._body)}})},{"./animation":2,"./body":4,"./boundry":5,"./simulation":11,"./util":13,"./vector":14}],2:[function(b,d,g){var c=b("lodash.defaults"),a=window.Promise||b("promise"),f=b("./boundry"),k=b("./vector"),e=b("component-emitter"),p={to:function(a,c){this._to=a instanceof f?a:k(a,c);return this},velocity:function(a,c){this._velocity=k(a,c);return this},from:function(a,c){this._from=k(a,c);return this},_updateState:function(a,c){this._phys.position(a);this._phys.velocity(c)},
cancel:function(){this._onEnd();this._running=!1;this._reject()},running:function(){return this._running||!1},start:function(){var a=this,h=this._from?this._from:this._phys.position(),e=this._to?this._to:this._phys.position(),m=this._velocity?this._velocity:this._phys.velocity(),b=c({},this._opts||{},this._defaultOpts);this._phys._startAnimation(this);this._running=!0;e instanceof f&&(e=e.nearestIntersect(h,m));this._onStart(m,h,e,b,{state:function(c,e){a._updateState(c,e)},done:function(c,e){a._updateState(c,
e);a._onEnd();a._running=!1;a._resolve({position:c,velocity:e})},cancel:function(c,e){a._updateState(c,e);a._onEnd();a._running=!1;a._reject()}});return a._ended}};d.exports=function(c){var h=function(e,h){var b=this;this._opts=h;this._phys=e;this._onStart=c.onStart;this._onEnd=c.onEnd;this._defaultOpts=c.defaultOptions;this._ended=new a(function(a,c){b._resolve=a;b._reject=c});this.start=this.start.bind(this)};e(h.prototype);h.prototype=p;return h}},{"./boundry":5,"./vector":14,"component-emitter":19,
"lodash.defaults":20,promise:27}],3:[function(b,d,g){function c(c,e,b){this._phys=c;this._opts=a({},b||{},p);this._position=c.position();this._velocity=c.velocity();this._attachment="function"===typeof e.position?e.position.bind(e):e}var a=b("lodash.defaults"),f=b("./vector"),k=b("./simulation"),e=b("./body"),p={tension:100,damping:10,seperation:0,offset:{x:0,y:0}};d.exports=c;c.prototype.position=function(a,c){if(0===arguments.length)return this._position;this._body?this._body.position=this._position=
f(a,c):this._position=f(a,c)};c.prototype.velocity=function(a,c){this._body?this._body.velocity=this._velocity=f(a,c):this._velocity=f(a,c)};c.prototype.cancel=function(a,c){this._running=!1;k.removeBody(this._body)};c.prototype.stop=function(a,c){this._running=!1;k.removeBody(this._body)};c.prototype.running=function(a,c){return this._running};window.unit=0;c.prototype.start=function(){var a=this._attachment,c=this._opts,b=this._phys,m=this._velocity,f=this._position,r=this;b._startAnimation(this);
this._running=!0;var d=this._body=e(m,f,{accelerate:function(e,b){var m=e.position.selfSub(a()),f=m.norm(),m=m.normalize();0===m.x&&0===m.y&&(m.x=m.y=1,m.normalize());return m.selfMult(-c.tension).selfMult(f-c.seperation).selfSub(e.velocity.selfMult(c.damping))},update:function(a,e){r._position=d.position;r._velocity=d.velocity;if(c.offset){var m=a.add(c.offset);b.position(m)}else b.position(a);b.velocity(e)}});k.addBody(d);return this}},{"./body":4,"./simulation":11,"./vector":14,"lodash.defaults":20}],
4:[function(b,d,g){function c(b,k,e){if(!(this instanceof c))return new c(b,k,e);this.previousPosition=this.position=a(k);this.velocity=a(b);this._fns=e}var a=b("./vector");d.exports=c;c.prototype.update=function(a){a=this.previousPosition.clone().lerp(this.position,a);this._fns.update(a,this.velocity)};c.prototype.accelerate=function(a,c){return this._fns.accelerate(a,c)};c.prototype.atRest=function(){return.01>this.velocity.norm()};c.prototype.atPosition=function(c){return.01>this.position.sub(a(c)).norm()}},
{"./vector":14}],5:[function(b,d,g){function c(a,c,b){a=(a-c.y)/b.y;return c.add(b.clone().mult(a))}function a(a,c,b){a=(a-c.x)/b.x;return c.add(b.clone().mult(a))}function f(a){if(!(this instanceof f))return new f(a);this.left="undefined"!==typeof a.left?a.left:-Infinity;this.right="undefined"!==typeof a.right?a.right:Infinity;this.top="undefined"!==typeof a.top?a.top:-Infinity;this.bottom="undefined"!==typeof a.bottom?a.bottom:Infinity}var k=b("./vector");d.exports=f;f.prototype.applyDamping=function(a,
c){var b=a.x,h=a.y;b<this.left&&(b=this.left-(this.left-b)*c);h<this.top&&(h=this.top-(this.top-h)*c);b>this.right&&(b=this.right-(this.right-b)*c);h>this.bottom&&(h=this.bottom-(this.bottom-h)*c);return k(b,h)};f.prototype.contains=function(a){return a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};f.prototype.nearestIntersect=function(b,f){var d=k(f).normalize();b=k(b);var h;0>f.y&&(h=c(this.top,b,d));0<f.y&&(h=c(this.bottom,b,d));var n;if(n=h)n=h.x,n=n>=this.left&&n<=this.right;
if(n)return h;0>f.x&&(h=a(this.left,b,d));0<f.x&&(h=a(this.right,b,d));if(d=h)d=h.y,d=d>=this.top&&d<=this.bottom;if(d)return h;h=Math.abs(b.x-this.left)<Math.abs(b.x-this.right)?this.left:this.right;d=Math.abs(b.y-this.top)<Math.abs(b.y-this.bottom)?this.top:this.bottom;return h<d?k(h,b.y):k(b.x,d)}},{"./vector":14}],6:[function(b,d,g){var c=b("./body"),a=b("./simulation"),f=b("./boundry");b=b("./animation");d.exports=b({defaultOptions:{deceleration:400},onStart:function(b,e,d,l,h,n){var m=d.sub(e).normalize(),
q=m.mult(l.deceleration).negate(),r=f({left:Math.min(d.x,e.x),right:Math.max(d.x,e.x),top:Math.min(d.y,e.y),bottom:Math.max(d.y,e.y)});b=m.mult(b.norm());this._body=c(b,e,{accelerate:function(a,c){return q},update:function(a,c){m.directionEqual(c)?r.contains(a)?h.state(a,c):h.done(d,c):h.cancel(a,{x:0,y:0})}});a.addBody(this._body)},onEnd:function(){a.removeBody(this._body)}})},{"./animation":2,"./body":4,"./boundry":5,"./simulation":11}],7:[function(b,d,g){function c(c,b,d){this._phys=c;"function"===
typeof b?(this._startFn=b,b={}):this._startFn=d;this._opts=a({},f,b);b=(b=this._opts.handle)&&!b.length?[b]:b&&b.length?[].slice.call(b):c.els;b.forEach(this._setupHandle,this)}g=b("component-emitter");var a=b("lodash.defaults"),f={};d.exports=c;g(c.prototype);c.prototype.moved=function(){return 10<this._interaction.distance()};c.prototype._setupHandle=function(a){a.addEventListener("touchstart",this._start.bind(this));a.addEventListener("mousedown",this._start.bind(this));a.addEventListener("touchmove",
this._move.bind(this));window.addEventListener("mousemove",this._move.bind(this));a.addEventListener("touchend",this._end.bind(this));window.addEventListener("mouseup",this._end.bind(this))};c.prototype._start=function(a){this._startTime=Date.now();a.preventDefault();this._mousedown=!0;this._interaction=this._phys.interact({boundry:this._opts.boundry,damping:this._opts.damping,direction:this._opts.direction});var c=this._interaction.start(a);this._startFn&&this._startFn(c);this.emit("start",a)};c.prototype._move=
function(a){this._mousedown&&(a.preventDefault(),this._interaction.update(a),this.emit("move",a))};c.prototype._end=function(a){this._mousedown&&(a.preventDefault(),this._mousedown=!1,this._interaction.end(),this.emit("end",a))}},{"component-emitter":19,"lodash.defaults":20}],8:[function(b,d,g){function c(b){if(!(this instanceof c))return new c(b);"function"===typeof b?(this._render=b,this.els=[]):(this.els=b.length?[].slice.call(b):[b],this._renderer=new f(this.els),this._render=this._renderer.update.bind(this._renderer));
this._position=a(0,0);this._velocity=a(0,0)}b("./simulation");var a=b("./vector"),f=b("./renderer");b("lodash.defaults");var k=b("./spring"),e=b("./attach-spring"),p=b("./decelerate"),l=b("./accelerate"),h=b("./drag"),n=b("./interact");g=b("./boundry");b=window.Promise||b("promise");d.exports=c;c.Boundry=g;c.Vector=a;c.Promise=b;c.prototype.style=function(){this._renderer.style.apply(this._renderer,arguments);return this};c.prototype.visible=function(){this._renderer.visible.apply(this._renderer,
arguments);return this};c.prototype.direction=function(a){var c=this.velocity(),b,f;0>c.x?b="left":0<c.x&&(b="right");0>c.y?f="up":0<c.y&&(f="down");c=b+(f||"").toUpperCase();return a===b||a===f||a===c};c.prototype.atRest=function(){var a=this.velocity();return 0===a.x&&0===a.y};c.prototype._startAnimation=function(a){this._currentAnimation&&this._currentAnimation.running()&&this._currentAnimation.cancel();this._currentAnimation=a};c.prototype.velocity=function(c,b){if(!arguments.length)return this._velocity;
this._velocity=a(c,b);return this};c.prototype.position=function(c,b){if(!arguments.length)return this._position.clone();this._position=a(c,b);this._render(this._position.x,this._position.y);return this};c.prototype.interact=function(a){return new n(this,a)};c.prototype.drag=function(a,c){return new h(this,a,c)};c.prototype.spring=function(a){return new k(this,a)};c.prototype.decelerate=function(a){return new p(this,a)};c.prototype.accelerate=function(a){return new l(this,a)};c.prototype.attachSpring=
function(a,c){return new e(this,a,c)}},{"./accelerate":1,"./attach-spring":3,"./boundry":5,"./decelerate":6,"./drag":7,"./interact":9,"./renderer":10,"./simulation":11,"./spring":12,"./vector":14,"lodash.defaults":20,promise:27}],9:[function(b,d,g){function c(c,b){this._phys=c;this._running=!1;this._opts=a({},b,l)}var a=b("lodash.defaults"),f=b("touch-velocity"),k=b("./vector"),e=b("Promise"),p=b("./util");b=b("./boundry");d.exports=c;var l={boundry:b({}),damping:0,direction:"both"};c.prototype.position=
function(a,c){var b=this._opts.direction,f=this._opts.boundry,e=k(a,c);"both"!==b&&"horizontal"!==b&&(e.x=0);"both"!==b&&"vertical"!==b&&(e.y=0);this._veloX.updatePosition(e.x);this._veloY.updatePosition(e.y);this._phys.velocity(this._veloX.getVelocity(),this._veloY.getVelocity());e=f.applyDamping(e,this._opts.damping);this._phys.position(e);return this};c.prototype.update=function(a){a=a.originalEvent||a;a=p.eventVector(a).sub(this._startPosition);this.position(a);return this};c.prototype.start=
function(a){var c=this,b=a&&p.eventVector(a),d=this._phys.position();this._running=!0;this._phys._startAnimation(this);this._startPosition=a&&b.sub(d);this._initialPosition=this._phys.position();this._veloX=new f;this._veloY=new f;this.position(d);return this._ended=new e(function(a,b){c._resolve=a;c._reject=b})};c.prototype.distance=function(){return this._initialPosition.sub(this._phys.position()).norm()};c.prototype.cancel=function(){this._running=!1;this._reject(Error("Canceled the interaction"))};
c.prototype.running=function(){return this._running};c.prototype.end=function(){this._phys.velocity(this._veloX.getVelocity(),this._veloY.getVelocity());this._resolve({velocity:this._phys.velocity(),position:this._phys.position()});return this._ended}},{"./boundry":5,"./util":13,"./vector":14,Promise:16,"lodash.defaults":20,"touch-velocity":31}],10:[function(b,d,g){function c(){p(function(){c();for(var a=k.length-1;0<=a;a--)k[a]()})}function a(a){"undefined"===typeof a.length&&(a=[a]);this.els=a;
this.styles={};this.invisibleEls=[];k.push(this.render.bind(this))}var f=["Webkit","Moz","Ms","ms"],k=[],e=function(a){for(var c,b=0;b<f.length;b++)if(c=f[b]+a[0].toUpperCase()+a.slice(1),"undefined"!==typeof document.body.style[c])return c;return a}("transform"),p=b("raf");c();var l="translate translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skew skewX skewY skewZ".split(" ");d.exports=a;a.prototype.render=function(){if(this.currentPosition){var a,c=this.els,
b=this.currentPosition,f=this.styles,d,k=Object.keys(f),g=c.length,p=k.length,s,u;for(s=0;s<g;s++)if(a=[],this.visibleFn&&!this.visibleFn(b,s))this.invisibleEls[s]||(c[s].style.webkitTransform="translate3d(0, -99999px, 0)"),this.invisibleEls[s]=!0;else{this.invisibleEls[s]=!1;for(u=0;u<p;u++)prop=k[u],d="function"===typeof f[prop]?f[prop](b.x,b.y,s):f[prop],-1!==l.indexOf(prop)?a.push(prop+"("+d+")"):c[s].style[prop]=d;a=a.join(" ");a+=" translateZ(0)";c[s].style[e]=a}}};a.prototype.style=function(a,
c){if("object"===typeof a)for(prop in a)a.hasOwnProperty(prop)&&this.style(prop,a[prop]);this.styles[a]=c;return this};a.prototype.visible=function(a){this.visibleFn=a;return this};a.prototype.update=function(a,c){this.currentPosition={x:a,y:c}}},{raf:29}],11:[function(b,d,g){function c(a,c,b,f){var e=k(0,0);e.selfAdd(a);e.selfAdd(c.add(b).selfMult(2));e.selfAdd(f);e.selfMult(1/6);return e}function a(a,c,b,f){var e={};e.position=p.setv(f.dx).selfMult(b).selfAdd(a.position);e.velocity=l.setv(f.dv).selfMult(b).selfAdd(a.velocity);
return{dx:e.velocity.clone(),dv:a.accelerate(e,c).clone()}}function f(){requestAnimationFrame(function(){f();var b=Date.now()/1E3,d=b-n;n=b;.05<d&&(d=.05);for(m+=d;.015<=m;){for(b=0;b<e.length;b++){e[b].previousPosition=e[b].position.clone();var d=e[b],k=q,l=a(d,k,0,h),g=a(d,k,.0075,l),p=a(d,k,.0075,g),w=a(d,k,.015,p),k=c(l.dx,g.dx,p.dx,w.dx),l=c(l.dv,g.dv,p.dv,w.dv);d.position.selfAdd(k.selfMult(.015));d.velocity.selfAdd(l.selfMult(.015))}q+=.015;m-=.015}for(b=0;b<e.length;b++)e[b].update(m/.015)},
16)}var k=b("./vector"),e=[],p=k(0,0),l=k(0,0),h={dx:k(0,0),dv:k(0,0)},n=Date.now()/1E3,m=0,q=0;f();d.exports.addBody=function(a){e.push(a);return a};d.exports.removeBody=function(a){a=e.indexOf(a);0<=a&&e.splice(a,1)}},{"./vector":14}],12:[function(b,d,g){var c=b("./body"),a=b("./simulation");b("./boundry");b=b("./animation");d.exports=b({defaultOptions:{tension:100,damping:10},onStart:function(b,d,e,g,l){var h=this._body=new c(b,d,{accelerate:function(a,c){return a.position.selfSub(e).selfMult(-g.tension).selfSub(a.velocity.mult(g.damping))},
update:function(a,c){h.atRest()&&h.atPosition(e)?l.done(e,{x:0,y:0}):l.state(a,c)}});a.addBody(this._body)},onEnd:function(){a.removeBody(this._body)}})},{"./animation":2,"./body":4,"./boundry":5,"./simulation":11}],13:[function(b,d,g){var c=b("./vector");d.exports.height=function(a,c,b){var e=-c/(2*a);return a*e*e+c*e+b};d.exports.eventVector=function(a){return c({x:a.touches&&a.touches[0].pageX||a.pageX,y:a.touches&&a.touches[0].pageY||a.pageY})}},{"./vector":14}],14:[function(b,d,g){function c(a,
b){if(!(this instanceof c))return new c(a,b);"undefined"!==typeof a.x?(this.x=a.x,this.y=a.y):(this.x=a||0,this.y=b||0)}d.exports=c;c.prototype.equals=function(a){return a.x===this.x&&a.y===this.y};c.prototype.directionEqual=function(a){return 0<a.x===0<this.x&&0<this.y===0<a.y};c.prototype.dot=function(a){return this.x*a.x+this.y*a.y};c.prototype.negate=function(){return c(this.x,this.y).mult(-1)};c.prototype.norm=function(){return Math.sqrt(this.normsq())};c.prototype.clone=function(){return c(this.x,
this.y)};c.prototype.normsq=function(){return this.x*this.x+this.y*this.y};c.prototype.normalize=function(){var a=this.norm();if(0===a)return this;a=1/a;this.x*=a;this.y*=a;return this};c.prototype.mult=function(a,b){return a instanceof c?new c(a.x*this.x,a.y*this.y):"undefined"===typeof b?new c(a*this.x,a*this.y):new c(a*this.x,b*this.y)};c.prototype.selfMult=function(a,b){if(a instanceof c)return this.x*=a.x,this.y*=a.y,this;if("undefined"===typeof b)return this.x*=a,this.y*=a,this;this.x*=a;this.y*=
b;return this};c.prototype.selfAdd=function(a,c){if("undefined"!==typeof a.x)return this.x+=a.x,this.y+=a.y,this;if("undefined"===typeof c)return this.x+=a,this.y+=a,this;this.x+=a;this.y+=c;return this};c.prototype.selfSub=function(a,c){if("undefined"!==typeof a.x)return this.x-=a.x,this.y-=a.y,this;if("undefined"===typeof c)return this.x-=a,this.y-=a,this;this.x-=a;this.y-=c;return this};c.prototype.sub=function(a,b){return"undefined"!==typeof a.x?new c(this.x-a.x,this.y-a.y):"undefined"===typeof b?
new c(this.x-a,this.y-a):new c(this.x-a,this.y-b)};c.prototype.add=function(a,b){return"undefined"!==typeof a.x?new c(this.x+a.x,this.y+a.y):"undefined"===typeof b?new c(this.x+a,this.y+a):new c(this.x+a,this.y+b)};c.prototype.setv=function(a){this.x=a.x;this.y=a.y;return this};c.prototype.lerp=function(a,c){return this.mult(1-c).add(a.mult(c))}},{}],15:[function(b,d,g){function c(b){function d(a){null===m?r.push(a):k(function(){var c=m?a.onFulfilled:a.onRejected;if(null===c)(m?a.resolve:a.reject)(q);
else{var b;try{b=c(q)}catch(e){a.reject(e);return}a.resolve(b)}})}function l(a){try{if(a===t)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"===typeof a||"function"===typeof a)){var c=a.then;if("function"===typeof c){f(c.bind(a),l,h);return}}m=!0;q=a;g()}catch(b){h(b)}}function h(a){m=!1;q=a;g()}function g(){for(var a=0,c=r.length;a<c;a++)d(r[a]);r=null}if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof b)throw new TypeError("not a function");
var m=null,q=null,r=[],t=this;this.then=function(b,e){return new c(function(c,f){d(new a(b,e,c,f))})};f(b,l,h)}function a(a,c,b,d){this.onFulfilled="function"===typeof a?a:null;this.onRejected="function"===typeof c?c:null;this.resolve=b;this.reject=d}function f(a,c,b){var d=!1;try{a(function(a){d||(d=!0,c(a))},function(a){d||(d=!0,b(a))})}catch(f){d||(d=!0,b(f))}}var k=b("asap");d.exports=c},{asap:17}],16:[function(b,d,g){function c(c){this.then=function(b){return"function"!==typeof b?this:new a(function(a,
d){f(function(){try{a(b(c))}catch(e){d(e)}})})}}var a=b("./core.js"),f=b("asap");d.exports=a;c.prototype=Object.create(a.prototype);var k=new c(!0),e=new c(!1),p=new c(null),l=new c(void 0),h=new c(0),n=new c("");a.resolve=function(b){if(b instanceof a)return b;if(null===b)return p;if(void 0===b)return l;if(!0===b)return k;if(!1===b)return e;if(0===b)return h;if(""===b)return n;if("object"===typeof b||"function"===typeof b)try{var d=b.then;if("function"===typeof d)return new a(d.bind(b))}catch(f){return new a(function(a,
c){c(f)})}return new c(b)};a.from=a.cast=function(c){var b=Error("Promise.from and Promise.cast are deprecated, use Promise.resolve instead");b.name="Warning";console.warn(b.stack);return a.resolve(c)};a.denodeify=function(c,b){b=b||Infinity;return function(){var d=this,e=Array.prototype.slice.call(arguments);return new a(function(a,f){for(;e.length&&e.length>b;)e.pop();e.push(function(c,b){c?f(c):a(b)});c.apply(d,e)})}};a.nodeify=function(c){return function(){var b=Array.prototype.slice.call(arguments),
d="function"===typeof b[b.length-1]?b.pop():null;try{return c.apply(this,arguments).nodeify(d)}catch(e){if(null===d||"undefined"==typeof d)return new a(function(a,c){c(e)});f(function(){d(e)})}}};a.all=function(){var c=1===arguments.length&&Array.isArray(arguments[0]),b=Array.prototype.slice.call(c?arguments[0]:arguments);c||(c=Error("Promise.all should be called with a single array, calling it with multiple arguments is deprecated"),c.name="Warning",console.warn(c.stack));return new a(function(a,
c){function d(f,k){try{if(k&&("object"===typeof k||"function"===typeof k)){var h=k.then;if("function"===typeof h){h.call(k,function(a){d(f,a)},c);return}}b[f]=k;0===--e&&a(b)}catch(m){c(m)}}if(0===b.length)return a([]);for(var e=b.length,f=0;f<b.length;f++)d(f,b[f])})};a.reject=function(c){return new a(function(a,b){b(c)})};a.race=function(c){return new a(function(b,d){c.forEach(function(c){a.resolve(c).then(b,d)})})};a.prototype.done=function(a,c){(arguments.length?this.then.apply(this,arguments):
this).then(null,function(a){f(function(){throw a;})})};a.prototype.nodeify=function(a){if("function"!=typeof a)return this;this.then(function(c){f(function(){a(null,c)})},function(c){f(function(){a(c)})})};a.prototype["catch"]=function(a){return this.then(null,a)}},{"./core.js":15,asap:17}],17:[function(b,d,g){(function(c){function a(){for(;b.next;){b=b.next;var c=b.task;b.task=void 0;var d=b.domain;d&&(b.domain=void 0,d.enter());try{c()}catch(k){if(l)throw d&&d.exit(),setTimeout(a,0),d&&d.enter(),
k;setTimeout(function(){throw k;},0)}d&&d.exit()}e=!1}var b={task:void 0,next:null},k=b,e=!1,g=void 0,l=!1;if("undefined"!==typeof c&&c.nextTick)l=!0,g=function(){c.nextTick(a)};else if("function"===typeof setImmediate)g="undefined"!==typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!==typeof MessageChannel){var h=new MessageChannel;h.port1.onmessage=a;g=function(){h.port2.postMessage(0)}}else g=function(){setTimeout(a,0)};d.exports=function(a){k=k.next={task:a,
domain:l&&c.domain,next:null};e||(e=!0,g())}}).call(this,b("/Users/zach/Development/impulse/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/zach/Development/impulse/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18}],18:[function(b,d,g){b=d.exports={};b.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if("undefined"!==typeof window&&
window.postMessage&&window.addEventListener){var c=[];window.addEventListener("message",function(a){var b=a.source;b!==window&&null!==b||"process-tick"!==a.data||(a.stopPropagation(),0<c.length&&c.shift()())},!0);return function(a){c.push(a);window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}();b.title="browser";b.browser=!0;b.env={};b.argv=[];b.binding=function(c){throw Error("process.binding is not supported");};b.cwd=function(){return"/"};b.chdir=function(c){throw Error("process.chdir is not supported");
}},{}],19:[function(b,d,g){function c(a){if(a){for(var b in c.prototype)a[b]=c.prototype[b];return a}}d.exports=c;c.prototype.on=c.prototype.addEventListener=function(a,c){this._callbacks=this._callbacks||{};(this._callbacks[a]=this._callbacks[a]||[]).push(c);return this};c.prototype.once=function(a,c){function b(){d.off(a,b);c.apply(this,arguments)}var d=this;this._callbacks=this._callbacks||{};b.fn=c;this.on(a,b);return this};c.prototype.off=c.prototype.removeListener=c.prototype.removeAllListeners=
c.prototype.removeEventListener=function(a,c){this._callbacks=this._callbacks||{};if(0==arguments.length)return this._callbacks={},this;var b=this._callbacks[a];if(!b)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,g=0;g<b.length;g++)if(d=b[g],d===c||d.fn===c){b.splice(g,1);break}return this};c.prototype.emit=function(a){this._callbacks=this._callbacks||{};var c=[].slice.call(arguments,1),b=this._callbacks[a];if(b)for(var b=b.slice(0),d=0,g=b.length;d<g;++d)b[d].apply(this,
c);return this};c.prototype.listeners=function(a){this._callbacks=this._callbacks||{};return this._callbacks[a]||[]};c.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],20:[function(b,d,g){var c=b("lodash.keys"),a=b("lodash._objecttypes");d.exports=function(b,d,e){var g,l=b,h=l;if(!l)return h;for(var n=arguments,m=0,q="number"==typeof e?2:n.length;++m<q;)if((l=n[m])&&a[typeof l])for(var r=-1,t=a[typeof l]&&c(l),x=t?t.length:0;++r<x;)g=t[r],"undefined"==typeof h[g]&&(h[g]=l[g]);
return h}},{"lodash._objecttypes":21,"lodash.keys":22}],21:[function(b,d,g){d.exports={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1}},{}],22:[function(b,d,g){g=b("lodash._isnative");var c=b("lodash.isobject");b=b("lodash._shimkeys");var a=g(a=Object.keys)&&a;d.exports=a?function(b){return c(b)?a(b):[]}:b},{"lodash._isnative":23,"lodash._shimkeys":24,"lodash.isobject":25}],23:[function(b,d,g){var c=RegExp("^"+String(Object.prototype.toString).replace(/[.*+?^${}()|[\]\\]/g,
"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");d.exports=function(a){return"function"==typeof a&&c.test(a)}},{}],24:[function(b,d,g){var c=b("lodash._objecttypes"),a=Object.prototype.hasOwnProperty;d.exports=function(b){var d,e=[];if(!b||!c[typeof b])return e;for(d in b)a.call(b,d)&&e.push(d);return e}},{"lodash._objecttypes":21}],25:[function(b,d,g){var c=b("lodash._objecttypes");d.exports=function(a){return!(!a||!c[typeof a])}},{"lodash._objecttypes":21}],26:[function(b,d,g){d.exports=b(15)},
{asap:28}],27:[function(b,d,g){arguments[4][16][0].apply(g,arguments)},{"./core.js":26,asap:28}],28:[function(b,d,g){d.exports=b(17)},{"/Users/zach/Development/impulse/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18}],29:[function(b,d,g){var c=b("performance-now"),a="undefined"===typeof window?{}:window;b=["moz","webkit"];var f=a.requestAnimationFrame,k=a.cancelAnimationFrame||a.cancelRequestAnimationFrame;for(g=0;g<b.length&&!f;g++)f=a[b[g]+"RequestAnimationFrame"],
k=a[b[g]+"CancelAnimationFrame"]||a[b[g]+"CancelRequestAnimationFrame"];if(!f||!k)var e=0,p=0,l=[],h=1E3/60,f=function(a){if(0===l.length){var b=c(),d=Math.max(0,h-(b-e));e=d+b;setTimeout(function(){for(var a=l.slice(0),b=l.length=0;b<a.length;b++)a[b].cancelled||a[b].callback(e)},d)}l.push({handle:++p,callback:a,cancelled:!1});return p},k=function(a){for(var b=0;b<l.length;b++)l[b].handle===a&&(l[b].cancelled=!0)};d.exports=function(){return f.apply(a,arguments)};d.exports.cancel=function(){k.apply(a,
arguments)}},{"performance-now":30}],30:[function(b,d,g){(function(b){(function(){var a,f,g;"undefined"!==typeof performance&&null!==performance&&performance.now?d.exports=function(){return performance.now()}:"undefined"!==typeof b&&null!==b&&b.hrtime?(d.exports=function(){return(a()-g)/1E6},f=b.hrtime,a=function(){var a;a=f();return 1E9*a[0]+a[1]},g=a()):Date.now?(d.exports=function(){return Date.now()-g},g=Date.now()):(d.exports=function(){return(new Date).getTime()-g},g=(new Date).getTime())}).call(this)}).call(this,
b("/Users/zach/Development/impulse/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/zach/Development/impulse/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18}],31:[function(b,d,g){function c(){this.positionQueue=[];this.timeQueue=[]}d.exports=c;c.prototype.reset=function(){this.positionQueue.splice(0);this.timeQueue.splice(0)};c.prototype.pruneQueue=function(a){for(;this.timeQueue.length&&this.timeQueue[0]<
Date.now()-a;)this.timeQueue.shift(),this.positionQueue.shift()};c.prototype.updatePosition=function(a){this.positionQueue.push(a);this.timeQueue.push(Date.now());this.pruneQueue(50)};c.prototype.getVelocity=function(){this.pruneQueue(1E3);var a=this.timeQueue.length;return 2>a?0:(this.positionQueue[a-1]-this.positionQueue[0])/((this.timeQueue[a-1]-this.timeQueue[0])/1E3)}},{}]},{},[8])(8)});