//>>built
define("dojo/on",["./has!dom-addeventlistener?:./aspect","./_base/kernel","./has"],function(s,t,e){function u(a,c,b,d,i){if(d=c.match(/(.*):(.*)/))return c=d[2],d=d[1],f.selector(d,c).call(i,a,b);e("touch")&&(v.test(c)&&(b=k(b)),!e("event-orientationchange")&&"orientationchange"==c&&(c="resize",a=window,b=k(b)));l&&(b=l(b));if(a.addEventListener){var h=c in m,g=h?m[c]:c;a.addEventListener(g,b,h);return{remove:function(){a.removeEventListener(g,b,h)}}}if(n&&a.attachEvent)return n(a,"on"+c,b);throw Error("Target must be an event emitter");
}function w(){this.cancelable=!1}function x(){this.bubbles=!1}var o=window.ScriptEngineMajorVersion;e.add("jscript",o&&o()+ScriptEngineMinorVersion()/10);e.add("event-orientationchange",e("touch")&&!e("android"));e.add("event-stopimmediatepropagation",window.Event&&!!window.Event.prototype&&!!window.Event.prototype.stopImmediatePropagation);e.add("event-focusin",function(a,c,b){return"onfocusin"in b});e("touch")&&e.add("touch-can-modify-event-delegate",function(){var a=function(){};a.prototype=document.createEvent("MouseEvents");
try{var c=new a;c.target=null;return null===c.target}catch(b){return!1}});var f=function(a,c,b,d){return"function"==typeof a.on&&"function"!=typeof c&&!a.nodeType?a.on(c,b):f.parse(a,c,b,u,d,this)};f.pausable=function(a,c,b,d){var i,a=f(a,c,function(){if(!i)return b.apply(this,arguments)},d);a.pause=function(){i=!0};a.resume=function(){i=!1};return a};f.once=function(a,c,b){var d=f(a,c,function(){d.remove();return b.apply(this,arguments)});return d};f.parse=function(a,c,b,d,i,h){if(c.call)return c.call(h,
a,b);if(-1<c.indexOf(",")){for(var c=c.split(/\s*,\s*/),g=[],e=0,f;f=c[e++];)g.push(d(a,f,b,i,h));g.remove=function(){for(var a=0;a<g.length;a++)g[a].remove()};return g}return d(a,c,b,i,h)};var v=/^touch/;f.selector=function(a,c,b){return function(d,i){function h(c){for(g=g&&g.matches?g:t.query;!g.matches(c,a,d);)if(c==d||!1===b||!(c=c.parentNode)||1!=c.nodeType)return;return c}var g="function"==typeof a?{matches:a}:this,e=c.bubble;return e?f(d,e(h),i):f(d,c,function(a){var b=h(a.target);if(b)return i.call(b,
a)})}};var y=[].slice,z=f.emit=function(a,c,b){var d=y.call(arguments,2),e="on"+c;if("parentNode"in a){var h=d[0]={},g;for(g in b)h[g]=b[g];h.preventDefault=w;h.stopPropagation=x;h.target=a;h.type=c;b=h}do a[e]&&a[e].apply(a,d);while(b&&b.bubbles&&(a=a.parentNode));return b&&b.cancelable&&b},m=e("event-focusin")?{}:{focusin:"focus",focusout:"blur"};if(!e("event-stopimmediatepropagation"))var A=function(){this.modified=this.immediatelyStopped=!0},l=function(a){return function(c){if(!c.immediatelyStopped)return c.stopImmediatePropagation=
A,a.apply(this,arguments)}};if(e("dom-addeventlistener"))f.emit=function(a,c,b){if(a.dispatchEvent&&document.createEvent){var d=(a.ownerDocument||document).createEvent("HTMLEvents");d.initEvent(c,!!b.bubbles,!!b.cancelable);for(var e in b)e in d||(d[e]=b[e]);return a.dispatchEvent(d)&&d}return z.apply(f,arguments)};else{f._fixEvent=function(a,c){if(!a)a=(c&&(c.ownerDocument||c.document||c).parentWindow||window).event;if(!a)return a;j&&a.type==j.type&&(a=j);if(!a.target){a.target=a.srcElement;a.currentTarget=
c||a.srcElement;if("mouseover"==a.type)a.relatedTarget=a.fromElement;if("mouseout"==a.type)a.relatedTarget=a.toElement;if(!a.stopPropagation)a.stopPropagation=B,a.preventDefault=C;switch(a.type){case "keypress":var b="charCode"in a?a.charCode:a.keyCode;10==b?(b=0,a.keyCode=13):13==b||27==b?b=0:3==b&&(b=99);a.charCode=b;b=a;b.keyChar=b.charCode?String.fromCharCode(b.charCode):"";b.charOrCode=b.keyChar||b.keyCode}}return a};var j,p=function(a){this.handle=a};p.prototype.remove=function(){delete _dojoIEListeners_[this.handle]};
var D=function(a){return function(c){var c=f._fixEvent(c,this),b=a.call(this,c);c.modified&&(j||setTimeout(function(){j=null}),j=c);return b}},n=function(a,c,b){b=D(b);if(((a.ownerDocument?a.ownerDocument.parentWindow:a.parentWindow||a.window||window)!=top||5.8>e("jscript"))&&!e("config-_allow_leaks")){"undefined"==typeof _dojoIEListeners_&&(_dojoIEListeners_=[]);var d=a[c];if(!d||!d.listeners){var f=d,d=Function("event","var callee = arguments.callee; for(var i = 0; i<callee.listeners.length; i++){var listener = _dojoIEListeners_[callee.listeners[i]]; if(listener){listener.call(this,event);}}");
d.listeners=[];a[c]=d;d.global=this;f&&d.listeners.push(_dojoIEListeners_.push(f)-1)}d.listeners.push(a=d.global._dojoIEListeners_.push(b)-1);return new p(a)}return s.after(a,c,b,!0)},B=function(){this.cancelBubble=!0},C=f._preventDefault=function(){this.bubbledKeyCode=this.keyCode;if(this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0;this.returnValue=!1}}if(e("touch"))var q=function(){},r=window.orientation,k=function(a){return function(c){var b=c.corrected;if(!b){var d=c.type;try{delete c.type}catch(f){}if(c.type){if(e("touch-can-modify-event-delegate"))q.prototype=
c,b=new q;else{var b={},h;for(h in c)b[h]=c[h]}b.preventDefault=function(){c.preventDefault()};b.stopPropagation=function(){c.stopPropagation()}}else b=c,b.type=d;c.corrected=b;if("resize"==d){if(r==window.orientation)return null;r=window.orientation;b.type="orientationchange";return a.call(this,b)}if(!("rotation"in b))b.rotation=0,b.scale=1;var d=b.changedTouches[0],g;for(g in d)delete b[g],b[g]=d[g]}return a.call(this,b)}};return f});