(function(fn){if(typeof define==='function'&&define.amd){define([],fn);}else if((typeof module!=="undefined"&&module!==null)&&module.exports){module.exports=fn;}else{fn();}})(function(){var assign=Object.assign||window.jQuery&&jQuery.extend;var threshold=8;var requestFrame=(function(){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(fn,element){return window.setTimeout(function(){fn();},25);});})();(function(){if(typeof window.CustomEvent==="function")return false;function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt;} CustomEvent.prototype=window.Event.prototype;window.CustomEvent=CustomEvent;})();var ignoreTags={textarea:true,input:true,select:true,button:true};var mouseevents={move:'mousemove',cancel:'mouseup dragstart',end:'mouseup'};var touchevents={move:'touchmove',cancel:'touchend',end:'touchend'};var rspaces=/\s+/;var eventOptions={bubbles:true,cancelable:true};var eventsSymbol=typeof Symbol==="function"?Symbol('events'):{};function createEvent(type){return new CustomEvent(type,eventOptions);} function getEvents(node){return node[eventsSymbol]||(node[eventsSymbol]={});} function on(node,types,fn,data,selector){types=types.split(rspaces);var events=getEvents(node);var i=types.length;var handlers,type;function handler(e){fn(e,data);} while(i--){type=types[i];handlers=events[type]||(events[type]=[]);handlers.push([fn,handler]);node.addEventListener(type,handler);}} function off(node,types,fn,selector){types=types.split(rspaces);var events=getEvents(node);var i=types.length;var type,handlers,k;if(!events){return;} while(i--){type=types[i];handlers=events[type];if(!handlers){continue;} k=handlers.length;while(k--){if(handlers[k][0]===fn){node.removeEventListener(type,handlers[k][1]);handlers.splice(k,1);}}}} function trigger(node,type,properties){var event=createEvent(type);if(properties){assign(event,properties);} node.dispatchEvent(event);} function Timer(fn){var callback=fn,active=false,running=false;function trigger(time){if(active){callback();requestFrame(trigger);running=true;active=false;} else{running=false;}} this.kick=function(fn){active=true;if(!running){trigger();}};this.end=function(fn){var cb=callback;if(!fn){return;} if(!running){fn();} else{callback=active?function(){cb();fn();}:fn;active=true;}};} function noop(){} function preventDefault(e){e.preventDefault();} function isIgnoreTag(e){return!!ignoreTags[e.target.tagName.toLowerCase()];} function isPrimaryButton(e){return(e.which===1&&!e.ctrlKey&&!e.altKey);} function identifiedTouch(touchList,id){var i,l;if(touchList.identifiedTouch){return touchList.identifiedTouch(id);} i=-1;l=touchList.length;while(++i