//>>built
define("dijit/focus","dojo/aspect dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/Evented dojo/_base/lang dojo/on dojo/domReady dojo/sniff dojo/Stateful dojo/_base/window dojo/window ./a11y ./registry ./main".split(" "),function(t,B,u,C,D,v,E,l,m,F,n,G,H,w,I,p,q){var x,y,h=new (B([G,E],{curNode:null,activeStack:[],constructor:function(){var a=l.hitch(this,function(c){u.isDescendant(this.curNode,c)&&this.set("curNode",null);u.isDescendant(this.prevNode,c)&&this.set("prevNode",
null)});t.before(v,"empty",a);t.before(v,"destroy",a)},registerIframe:function(a){return this.registerWin(a.contentWindow,a)},registerWin:function(a,c){var e=this,b=a.document&&a.document.body;if(b){var g=n("pointer-events")?"pointerdown":n("MSPointer")?"MSPointerDown":n("touch-events")?"mousedown, touchstart":"mousedown",d=m(a.document,g,function(f){f&&f.target&&null==f.target.parentNode||e._onTouchNode(c||f.target,"mouse")}),r=m(b,"focusin",function(f){if(f.target.tagName){var z=f.target.tagName.toLowerCase();
"#document"!=z&&"body"!=z&&(I.isFocusable(f.target)?e._onFocusNode(c||f.target):e._onTouchNode(c||f.target))}}),A=m(b,"focusout",function(f){e._onBlurNode(c||f.target)});return{remove:function(){d.remove();r.remove();A.remove();b=d=r=A=null}}}},_onBlurNode:function(a){a=(new Date).getTime();a<x+100||(this._clearFocusTimer&&clearTimeout(this._clearFocusTimer),this._clearFocusTimer=setTimeout(l.hitch(this,function(){this.set("prevNode",this.curNode);this.set("curNode",null)}),0),this._clearActiveWidgetsTimer&&
clearTimeout(this._clearActiveWidgetsTimer),a<y+100||(this._clearActiveWidgetsTimer=setTimeout(l.hitch(this,function(){delete this._clearActiveWidgetsTimer;this._setStack([])}),0)))},_onTouchNode:function(a,c){y=(new Date).getTime();this._clearActiveWidgetsTimer&&(clearTimeout(this._clearActiveWidgetsTimer),delete this._clearActiveWidgetsTimer);D.contains(a,"dijitPopup")&&(a=a.firstChild);var e=[];try{for(;a;){var b=C.get(a,"dijitPopupParent");if(b)a=p.byId(b).domNode;else if(a.tagName&&"body"==a.tagName.toLowerCase()){if(a===
H.body())break;a=w.get(a.ownerDocument).frameElement}else{var g=a.getAttribute&&a.getAttribute("widgetId"),d=g&&p.byId(g);!d||"mouse"==c&&d.get("disabled")||e.unshift(g);a=a.parentNode}}}catch(r){}this._setStack(e,c)},_onFocusNode:function(a){a&&9!=a.nodeType&&(x=(new Date).getTime(),this._clearFocusTimer&&(clearTimeout(this._clearFocusTimer),delete this._clearFocusTimer),this._onTouchNode(a),a!=this.curNode&&(this.set("prevNode",this.curNode),this.set("curNode",a)))},_setStack:function(a,c){var e=
this.activeStack,b=e.length-1,g=a.length-1;if(a[g]!=e[b]){this.set("activeStack",a);var d;for(d=b;0<=d&&e[d]!=a[d];d--)if(b=p.byId(e[d]))b._hasBeenBlurred=!0,b.set("focused",!1),b._focusManager==this&&b._onBlur(c),this.emit("widget-blur",b,c);for(d++;d<=g;d++)if(b=p.byId(a[d]))b.set("focused",!0),b._focusManager==this&&b._onFocus(c),this.emit("widget-focus",b,c)}},focus:function(a){if(a)try{a.focus()}catch(c){}}}));F(function(){var a=h.registerWin(w.get(document));n("ie")&&m(window,"unload",function(){a&&
(a.remove(),a=null)})});q.focus=function(a){h.focus(a)};for(var k in h)/^_/.test(k)||(q.focus[k]="function"==typeof h[k]?l.hitch(h,k):h[k]);h.watch(function(a,c,e){q.focus[a]=e});return h});