//>>built
define("dojox/gesture/Base","dojo/_base/kernel dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom dojo/on dojo/touch dojo/has ../main".split(" "),function(q,r,k,h,t,g,l,u,v){q.experimental("dojox.gesture.Base");h.getObject("gesture",!0,v);return r(null,{defaultEvent:" ",subEvents:[],touchOnly:!1,_elements:null,constructor:function(a){h.mixin(this,a);this.init()},init:function(){this._elements=[];if(u("touch")||!this.touchOnly){var a=this.defaultEvent;this.call=this._handle(a);this._events=
[a];k.forEach(this.subEvents,function(c){this[c]=this._handle(a+"."+c);this._events.push(a+"."+c)},this)}},_handle:function(a){var c=this;return function(b,d){var e=arguments;2<e.length&&(b=e[1],d=e[2]);if(b&&(b.nodeType||b.attachEvent||b.addEventListener)){var m=c._add(b,a,d);return{remove:function(){m.remove();c._remove(b,a)}}}return g(b,a,d)}},_add:function(a,c,b){var d=this._getGestureElement(a);if(!d){d={target:a,data:{},handles:{}};var e=h.hitch(this,"_process",d,"press"),m=h.hitch(this,"_process",
d,"move"),n=h.hitch(this,"_process",d,"release"),p=h.hitch(this,"_process",d,"cancel"),f=d.handles;this.touchOnly?(f.press=g(a,"touchstart",e),f.move=g(a,"touchmove",m),f.release=g(a,"touchend",n),f.cancel=g(a,"touchcancel",p)):(f.press=l.press(a,e),f.move=l.move(a,m),f.release=l.release(a,n),f.cancel=l.cancel(a,p));this._elements.push(d)}d.handles[c]=d.handles[c]?++d.handles[c]:1;return g(a,c,b)},_getGestureElement:function(a){for(var c=0,b;c<this._elements.length;c++)if(b=this._elements[c],b.target===
a)return b},_process:function(a,c,b){b._locking=b._locking||{};b._locking[this.defaultEvent]||this.isLocked(b.currentTarget)||("INPUT"==b.target.tagName&&"radio"!=b.target.type&&"checkbox"!=b.target.type||"TEXTAREA"==b.target.tagName||b.preventDefault(),b._locking[this.defaultEvent]=!0,this[c](a.data,b))},press:function(a,c){},move:function(a,c){},release:function(a,c){},cancel:function(a,c){},fire:function(a,c){a&&c&&(c.bubbles=!0,c.cancelable=!0,g.emit(a,c.type,c))},_remove:function(a,c){var b=
this._getGestureElement(a);if(b&&b.handles){b.handles[c]--;var d=b.handles;k.some(this._events,function(e){return 0<d[e]})||(this._cleanHandles(d),b=k.indexOf(this._elements,b),0<=b&&this._elements.splice(b,1))}},_cleanHandles:function(a){for(var c in a)a[c].remove&&a[c].remove(),delete a[c]},lock:function(a){this._lock=a},unLock:function(){this._lock=null},isLocked:function(a){return this._lock&&a?this._lock!==a&&t.isDescendant(a,this._lock):!1},destroy:function(){k.forEach(this._elements,function(a){this._cleanHandles(a.handles)},
this);this._elements=null}})});