!function(){var p,d,t="ontouchstart"in window,e=t?"touchstart":"mousedown",c=t?"touchmove":"mousemove",s=t?"touchend":"mouseup";zk.Swipe=zk.$extends(zk.Object,{$init:function(t,o,s){if(this.widget=t,this.node=o=o?jq(o,zk)[0]:t.node||(t.$n?t.$n():null),!o)throw"Handle required for "+t;this.opts=zk.$default(s,{scrollThreshold:5,duration:500,minDisplacement:30,maxDisplacement:75}),jq(this.node).on(e,this.proxy(this._swipeStart))},destroy:function(t){jq(t).off(e,this.proxy(this._swipeStart)),this.widget=this.node=this.opts=null},_swipeStart:function(t){var o=t.originalEvent,t=o.touches?o.touches[0]:o;p={time:o.timeStamp||Date.now(),coords:[t.pageX,t.pageY]},jq(this.node).on(c,this.proxy(this._swipeMove)).one(s,this.proxy(this._swipeEnd))},_swipeMove:function(t){var o,s,e;p&&(e=(o=t.originalEvent).touches?o.touches[0]:o,o.stopPropagation(),d={time:o.timeStamp||Date.now(),coords:[e.pageX,e.pageY]},s=Math.abs(p.coords[0]-d.coords[0]),t=Math.abs(p.coords[1]-d.coords[1]),((e=this.opts.scrollThreshold)<s||e<t)&&o.preventDefault())},_swipeEnd:function(t){var o,s,e,i,n,a,r,h;jq(this.node).off(c,this.proxy(this._swipeMove)),p&&d&&((r=d.time-p.time)<this.opts.duration&&(o=p.coords[0]-d.coords[0],a=p.coords[1]-d.coords[1],s=this.opts.minDisplacement,e=this.opts.maxDisplacement,i=Math.abs(o),n=Math.abs(a),s<i&&n<e?h=0<o?"left":"right":s<n&&i<e&&(h=0<a?"up":"down")),(a=this.widget)&&(r=new zk.Event(a,"onSwipe",{dispX:i,dispY:n,dispT:r,dir:h},{start:p,stop:d,dir:h},t),(h=r.target)&&!h.$weave&&(t=r.name,r.stopped||h["do"+t.substring(2)+"_"].call(h,r)))),p=d=null}})}();