text: /*! formstone v0.6.3 [touch.js] 2015-06-01 | MIT License | formstone.it */
  
  !function(a,b,c){"use strict";function d(a){a.touches=[],a.touching=!1,a.tap?(a.pan=!1,a.scale=!1,a.swipe=!1,b.support.touch?this.on([s.touchStart,s.pointerDown].join(" "),a,g):this.on(s.click,a,l)):(a.pan||a.swipe||a.scale)&&(a.tap=!1,a.swipe&&(a.pan=!0),a.scale&&(a.axis=!1),a.axis?(a.axisX="x"===a.axis,a.axisY="y"===a.axis):p(this,"none"),this.on([s.touchStart,s.pointerDown].join(" "),a,f),a.pan&&!b.support.touch&&this.on(s.mouseDown,a,g))}function e(a){p(this.off(s.namespace),"")}function f(a){a.preventManipulation&&a.preventManipulation();var b=a.data,c=a.originalEvent;if(c.type.match(/(up|end)$/i))return void k(a);if(c.pointerId){var d=!1;for(var e in b.touches)b.touches[e].id===c.pointerId&&(d=!0,b.touches[e].pageX=c.clientX,b.touches[e].pageY=c.clientY);d||b.touches.push({id:c.pointerId,pageX:c.clientX,pageY:c.clientY})}else b.touches=c.touches;c.type.match(/(down|start)$/i)?g(a):c.type.match(/move$/i)&&h(a)}function g(b){var c=b.data,d="undefined"!==a.type(c.touches)?c.touches[0]:null;if(c.touching||(c.startE=b.originalEvent,c.startX=d?d.pageX:b.pageX,c.startY=d?d.pageY:b.pageY,c.startT=(new Date).getTime(),c.scaleD=1,c.passed=!1),c.tap)c.clicked=!1,c.$el.on([s.touchMove,s.pointerMove].join(" "),c,f).on([s.touchEnd,s.touchCancel,s.pointerUp,s.pointerCancel].join(" "),c,f);else if(c.pan||c.scale){c.$links&&c.$links.off(s.click);var e=m(c.scale?s.scaleStart:s.panStart,b,c.startX,c.startY,c.scaleD,0,0,"","");if(c.scale&&c.touches&&c.touches.length>=2){var g=c.touches;c.pinch={startX:n(g[0].pageX,g[1].pageX),startY:n(g[0].pageY,g[1].pageY),startD:o(g[1].pageX-g[0].pageX,g[1].pageY-g[0].pageY)},e.pageX=c.startX=c.pinch.startX,e.pageY=c.startY=c.pinch.startY}c.touching||(c.touching=!0,c.pan&&u.on(s.mouseMove,c,h).on(s.mouseUp,c,k),u.on([s.touchMove,s.touchEnd,s.touchCancel,s.pointerMove,s.pointerUp,s.pointerCancel].join(" "),c,f),c.$el.trigger(e))}}function h(b){var c=b.data,d="undefined"!==a.type(c.touches)?c.touches[0]:null,e=d?d.pageX:b.pageX,f=d?d.pageY:b.pageY,g=e-c.startX,h=f-c.startY,i=g>0?"right":"left",j=h>0?"down":"up",l=Math.abs(g)>v,p=Math.abs(h)>v;if(c.tap)(l||p)&&c.$el.off([s.touchMove,s.touchEnd,s.touchCancel,s.pointerMove,s.pointerUp,s.pointerCancel].join(" "));else if(c.pan||c.scale)if(!c.passed&&c.axis&&(c.axisX&&p||c.axisY&&l))k(b);else{!c.passed&&(!c.axis||c.axis&&c.axisX&&l||c.axisY&&p)&&(c.passed=!0),c.passed&&(t.killEvent(b),t.killEvent(c.startE));var q=!0,r=m(c.scale?s.scale:s.pan,b,e,f,c.scaleD,g,h,i,j);if(c.scale)if(c.touches&&c.touches.length>=2){var u=c.touches;c.pinch.endX=n(u[0].pageX,u[1].pageX),c.pinch.endY=n(u[0].pageY,u[1].pageY),c.pinch.endD=o(u[1].pageX-u[0].pageX,u[1].pageY-u[0].pageY),c.scaleD=c.pinch.endD/c.pinch.startD,r.pageX=c.pinch.endX,r.pageY=c.pinch.endY,r.scale=c.scaleD,r.deltaX=c.pinch.endX-c.pinch.startX,r.deltaY=c.pinch.endY-c.pinch.startY}else c.pan||(q=!1);q&&c.$el.trigger(r)}}function i(b,c){b.on(s.click,c,j);var d=a._data(b[0],"events").click;d.unshift(d.pop())}function j(a){t.killEvent(a,!0),a.data.$links.off(s.click)}function k(b){var c=b.data;if(c.tap)c.$el.off([s.touchMove,s.touchEnd,s.touchCancel,s.pointerMove,s.pointerUp,s.pointerCancel,s.mouseMove,s.mouseUp].join(" ")),c.startE.preventDefault(),l(b);else if(c.pan||c.scale){var d="undefined"!==a.type(c.touches)?c.touches[0]:null,e=d?d.pageX:b.pageX,f=d?d.pageY:b.pageY,g=e-c.startX,h=f-c.startY,j=(new Date).getTime(),k=c.scale?s.scaleEnd:s.panEnd,n=g>0?"right":"left",o=h>0?"down":"up",p=Math.abs(g)>1,q=Math.abs(h)>1;if(c.swipe&&Math.abs(g)>v&&j-c.startT<w&&(k=s.swipe),c.axis&&(c.axisX&&q||c.axisY&&p)||p||q){c.$links=c.$el.find("a");for(var r=0,t=c.$links.length;t>r;r++)i(c.$links.eq(r),c)}var x=m(k,b,e,f,c.scaleD,g,h,n,o);u.off([s.touchMove,s.touchEnd,s.touchCancel,s.mouseMove,s.mouseUp,s.pointerMove,s.pointerUp,s.pointerCancel].join(" ")),c.$el.trigger(x),c.touches=[],c.scale}c.touching=!1}function l(a){t.killEvent(a);var b=a.data;if(!b.clicked){"click"!==a.type&&(b.clicked=!0);var c=b.startE?b.startX:a.pageX,d=b.startE?b.startY:a.pageY,e=m(s.tap,a.originalEvent,c,d,1,0,0);b.$el.trigger(e)}}function m(b,c,d,e,f,g,h,i,j){return a.Event(b,{originalEvent:c,bubbles:!0,pageX:d,pageY:e,scale:f,deltaX:g,deltaY:h,directionX:i,directionY:j})}function n(a,b){return(a+b)/2}function o(a,b){return Math.sqrt(a*a+b*b)}function p(a,b){a.css({"-ms-touch-action":b,"touch-action":b})}var q=!b.window.PointerEvent,r=b.Plugin("touch",{widget:!0,defaults:{axis:!1,pan:!1,scale:!1,swipe:!1,tap:!1},methods:{_construct:d,_destruct:e},events:{pointerDown:q?"MSPointerDown":"pointerdown",pointerUp:q?"MSPointerUp":"pointerup",pointerMove:q?"MSPointerMove":"pointermove",pointerCancel:q?"MSPointerCancel":"pointercancel"}}),s=r.events,t=r.functions,u=b.$window,v=10,w=50;s.tap="tap",s.pan="pan",s.panStart="panstart",s.panEnd="panend",s.scale="scale",s.scaleStart="scalestart",s.scaleEnd="scaleend",s.swipe="swipe"}(jQuery,Formstone);