//>>built
define("dojox/geo/charting/KeyboardInteractionSupport","dojo/_base/lang dojo/_base/declare dojo/_base/event dojo/_base/connect dojo/_base/html dojo/dom dojox/lang/functional dojo/keys".split(" "),function(y,u,v,c,w,x,r,d){return u("dojox.geo.charting.KeyboardInteractionSupport",null,{_map:null,_zoomEnabled:!1,constructor:function(a,b){this._map=a;b&&(this._zoomEnabled=b.enableZoom)},connect:function(){var a=x.byId(this._map.container);w.attr(a,{tabindex:0,role:"presentation","aria-label":"map"});
this._keydownListener=c.connect(a,"keydown",this,"keydownHandler");this._onFocusListener=c.connect(a,"focus",this,"onFocus");this._onBlurListener=c.connect(a,"blur",this,"onBlur")},disconnect:function(){c.disconnect(this._keydownListener);this._keydownListener=null;c.disconnect(this._onFocusListener);this._onFocusListener=null;c.disconnect(this._onBlurListener);this._onBlurListener=null},keydownHandler:function(a){switch(a.keyCode){case d.LEFT_ARROW:this._directTo(-1,-1,1,-1);break;case d.RIGHT_ARROW:this._directTo(-1,
-1,-1,1);break;case d.UP_ARROW:this._directTo(1,-1,-1,-1);break;case d.DOWN_ARROW:this._directTo(-1,1,-1,-1);break;case d.SPACE:this._map.selectedFeature&&!this._map.selectedFeature._isZoomIn&&this._zoomEnabled&&this._map.selectedFeature._zoomIn();break;case d.ESCAPE:this._map.selectedFeature&&this._map.selectedFeature._isZoomIn&&this._zoomEnabled&&this._map.selectedFeature._zoomOut();break;default:return}v.stop(a)},onFocus:function(a){if(!this._map.selectedFeature&&!this._map.focused){this._map.focused=
!0;a=!1;if(this._map.lastSelectedFeature)var b=this._map.lastSelectedFeature;else{var k=this._map.getMapCenter(),l=Infinity;r.forIn(this._map.mapObj.features,function(e){var g=Math.sqrt(Math.pow(e._center[0]-k.x,2)+Math.pow(e._center[1]-k.y,2));g<l&&(l=g,b=e)});a=!0}b&&(a&&b._onclickHandler(null),this._map.mapObj.marker.show(b.id))}},onBlur:function(){this._map.lastSelectedFeature=this._map.selectedFeature},_directTo:function(a,b,k,l){var e=this._map.selectedFeature,g=e._center[0],t=e._center[1],
m=Infinity,h=null;r.forIn(this._map.mapObj.features,function(f){var p=Math.abs(g-f._center[0]),q=Math.abs(t-f._center[1]),n=p+q;0<(a-b)*(t-f._center[1])&&p<q&&m>n&&(m=n,h=f);0<(k-l)*(g-f._center[0])&&p>q&&m>n&&(m=n,h=f)});h&&(this._map.mapObj.marker.hide(),h._onclickHandler(null),this._map.mapObj.marker.show(h.id))}})});