text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/3.38/esri/copyright.txt for details.
  //>>built
  define("esri/toolbars/draw","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Color dojo/_base/window dojo/has dojo/sniff dojo/keys dojo/dom-construct dojo/dom-style dojo/dom-geometry ../kernel ../sniff ./_toolbar ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../graphic ../geometry/jsonUtils ../geometry/webMercatorUtils ../geometry/Polyline ../geometry/Polygon ../geometry/Multipoint ../geometry/Rect dojo/i18n!../nls/jsapi".split(" "),
  function(I,n,A,q,y,z,t,C,J,D,E,K,L,P,M,F,x,G,v,N,O,w,r,B,H,u){var h=I(M,{declaredClass:"esri.toolbars.Draw",_eventMap:{"draw-complete":!0,"draw-end":["geometry"]},constructor:function(b,a){this.markerSymbol=new F(F.STYLE_SOLID,10,new x(x.STYLE_SOLID,new y([255,0,0]),2),new y([0,0,0,.25]));this.lineSymbol=new x(x.STYLE_SOLID,new y([255,0,0]),2);this.fillSymbol=new G(G.STYLE_SOLID,new x(x.STYLE_SOLID,new y([255,0,0]),2),new y([0,0,0,.25]));this._points=[];this._mouse=!t("esri-touch")&&!t("esri-pointer");
  this._defaultOptions={showTooltips:!0,drawTime:75,tolerance:8,tooltipOffset:15};this._options=n.mixin(n.mixin({},this._defaultOptions),a||{});if(C("ios")||C("android"))this._options.showTooltips=!1;this._onKeyDownHandler=n.hitch(this,this._onKeyDownHandler);this._onMouseDownHandler=n.hitch(this,this._onMouseDownHandler);this._onMouseUpHandler=n.hitch(this,this._onMouseUpHandler);this._onClickHandler=n.hitch(this,this._onClickHandler);this._onMouseMoveHandler=n.hitch(this,this._onMouseMoveHandler);
  this._onMouseDragHandler=n.hitch(this,this._onMouseDragHandler);this._onDblClickHandler=n.hitch(this,this._onDblClickHandler);this._updateTooltip=n.hitch(this,this._updateTooltip);this._hideTooltip=n.hitch(this,this._hideTooltip);this._redrawGraphic=n.hitch(this,this._redrawGraphic)},_geometryType:null,respectDrawingVertexOrder:!1,setRespectDrawingVertexOrder:function(b){this.respectDrawingVertexOrder=b},setMarkerSymbol:function(b){this.markerSymbol=b},setLineSymbol:function(b){this.lineSymbol=b},
  setFillSymbol:function(b){this.fillSymbol=b},activate:function(b,a){this._geometryType&&this.deactivate();var c=this.map,d=q.connect,f=h;this._options=n.mixin(n.mixin({},this._options),a||{});c.navigationManager.setImmediateClick(!1);switch(b){case f.ARROW:case f.LEFT_ARROW:case f.RIGHT_ARROW:case f.UP_ARROW:case f.DOWN_ARROW:case f.TRIANGLE:case f.CIRCLE:case f.ELLIPSE:case f.RECTANGLE:this._deactivateMapTools(!0,!1,!1,!0);this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);this._mouse?
  (this._onMouseDownHandler_connect=d(c,"onMouseDown",this._onMouseDownHandler),this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseUp",this._onMouseUpHandler)):(this._onMouseDownHandler_connect=d(c,"onMouseDragStart",this._onMouseDownHandler),this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseDragEnd",this._onMouseUpHandler));t("esri-touch")&&(this._onMouseDownHandler2_connect=
  d(c,"onSwipeStart",this._onMouseDownHandler),this._onMouseDragHandler2_connect=d(c,"onSwipeMove",this._onMouseDragHandler),this._onMouseUpHandler2_connect=d(c,"onSwipeEnd",this._onMouseUpHandler));break;case f.POINT:this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);break;case f.LINE:case f.EXTENT:case f.FREEHAND_POLYLINE:case f.FREEHAND_POLYGON:this._deactivateMapTools(!0,!1,!1,!0);this._mouse?(this._onMouseDownHandler_connect=d(c,"onMouseDown",this._onMouseDownHandler),this._onMouseDragHandler_connect=
  d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseUp",this._onMouseUpHandler)):(this._onMouseDownHandler_connect=d(c,"onMouseDragStart",this._onMouseDownHandler),this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseDragEnd",this._onMouseUpHandler));t("esri-touch")&&(this._onMouseDownHandler2_connect=d(c,"onSwipeStart",this._onMouseDownHandler),this._onMouseDragHandler2_connect=d(c,"onSwipeMove",
  this._onMouseDragHandler),this._onMouseUpHandler2_connect=d(c,"onSwipeEnd",this._onMouseUpHandler));break;case f.POLYLINE:case f.POLYGON:case f.MULTI_POINT:c.navigationManager.setImmediateClick(!0);this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);this._onDblClickHandler_connect=d(c,"onDblClick",this._onDblClickHandler);this._dblClickZoom=c.isDoubleClickZoom;c.disableDoubleClickZoom();break;default:console.error("Unsupported geometry type: "+b);return}this._onKeyDown_connect=d(c,"onKeyDown",
  this._onKeyDownHandler);this._redrawConnect=d(c,"onExtentChange",this._redrawGraphic);this._geometryType=b;this._toggleTooltip(!0);c.snappingManager&&"freehandpolyline"!==this._geometryType&&"freehandpolygon"!==this._geometryType&&(c.snappingManager._startSelectionLayerQuery(),c.snappingManager._setUpSnapping());this.onActivate(this._geometryType)},deactivate:function(){var b=this.map;this._clear();var a=q.disconnect;a(this._onMouseMoveHandler_connect);a(this._onMouseDownHandler_connect);a(this._onMouseDragHandler_connect);
  a(this._onMouseUpHandler_connect);a(this._onMouseDownHandler2_connect);a(this._onMouseDragHandler2_connect);a(this._onMouseUpHandler2_connect);a(this._onClickHandler_connect);a(this._onDblClickHandler_connect);a(this._onKeyDown_connect);a(this._redrawConnect);this._onMouseDownHandler_connect=this._onMouseMoveHandler_connect=this._onMouseDragHandler_connect=this._onMouseUpHandler_connect=this._onMouseDownHandler2_connect=this._onMouseDragHandler2_connect=this._onMouseUpHandler2_connect=this._onClickHandler_connect=
  this._onDblClickHandler_connect=this._onKeyDown_connect=this._redrawConnect=null;b.snappingManager&&(b.snappingManager._stopSelectionLayerQuery(),b.snappingManager._killOffSnapping());switch(this._geometryType){case h.CIRCLE:case h.ELLIPSE:case h.TRIANGLE:case h.ARROW:case h.LEFT_ARROW:case h.RIGHT_ARROW:case h.UP_ARROW:case h.DOWN_ARROW:case h.RECTANGLE:case h.LINE:case h.EXTENT:case h.FREEHAND_POLYLINE:case h.FREEHAND_POLYGON:this._activateMapTools(!0,!1,!1,!0);break;case h.POLYLINE:case h.POLYGON:case h.MULTI_POINT:this._dblClickZoom&&
  b.enableDoubleClickZoom()}a=this._geometryType;this._geometryType=null;b.navigationManager.setImmediateClick(!1);this._toggleTooltip(!1);this.onDeactivate(a)},_clear:function(){this._graphic&&this.map.graphics.remove(this._graphic,!0);this._graphic=null;this.map.snappingManager&&this.map.snappingManager._setGraphic(null);this._points=[]},finishDrawing:function(){var b=this._points,a=this.map.spatialReference,c=h;b=b.slice(0,b.length);switch(this._geometryType){case c.POLYLINE:if(!this._graphic||2>
  b.length)return;var d=new w(a);d.addPath([].concat(b));break;case c.POLYGON:if(!this._graphic||3>b.length)return;d=new r(a);b=[].concat(b,[b[0].offset(0,0)]);r.prototype.isClockwise(b)||this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),b.reverse());d.addRing(b);break;case c.MULTI_POINT:d=new B(a),A.forEach(b,function(f){d.addPoint(f)})}q.disconnect(this._onMouseMoveHandler_connect);this._clear();this._setTooltipMessage(0);
  this._drawEnd(d)},_drawEnd:function(b){if(b){var a=this.map.spatialReference,c;this.onDrawEnd(b);a&&(a.isWebMercator()?c=O.webMercatorToGeographic(b,!0):4326===a.wkid&&(c=N.fromJson(b.toJson())));this.onDrawComplete({geometry:b,geographicGeometry:c})}},_normalizeRect:function(b,a,c){var d=b.x;b=b.y;var f=a.x;a=a.y;return{x:Math.min(d,f),y:Math.max(b,a),width:Math.abs(d-f),height:Math.abs(b-a),spatialReference:c}},_onMouseDownHandler:function(b){this._dragged=!1;if(this.map.snappingManager)var a=this.map.snappingManager._snappingPoint;
  var c=a||b.mapPoint,d=h;a=this.map;var f=a.spatialReference;this._points.push(c.offset(0,0));switch(this._geometryType){case d.LINE:this._graphic=a.graphics.add(new v(new w({paths:[[[c.x,c.y],[c.x,c.y]]],spatialReference:f}),this.lineSymbol),!0);a.snappingManager&&a.snappingManager._setGraphic(this._graphic);break;case d.FREEHAND_POLYLINE:this._oldPoint=b.screenPoint;c=new w(f);c.addPath(this._points);this._graphic=a.graphics.add(new v(c,this.lineSymbol),!0);a.snappingManager&&a.snappingManager._setGraphic(this._graphic);
  break;case d.CIRCLE:case d.ELLIPSE:case d.TRIANGLE:case d.ARROW:case d.LEFT_ARROW:case d.RIGHT_ARROW:case d.UP_ARROW:case d.DOWN_ARROW:case d.RECTANGLE:case d.FREEHAND_POLYGON:this._oldPoint=b.screenPoint,c=new r(f),c.addRing(this._points),this._graphic=a.graphics.add(new v(c,this.fillSymbol),!0),a.snappingManager&&a.snappingManager._setGraphic(this._graphic)}t("esri-touch")&&b.preventDefault();if(1===this._points.length)this.onDrawStart()},_onMouseMoveHandler:function(b){if(this.map.snappingManager)var a=
  this.map.snappingManager._snappingPoint;b=a||b.mapPoint;a=this._graphic.geometry;switch(this._geometryType){case h.POLYLINE:case h.POLYGON:var c=this._points.length,d=!!a.getPoint(0,c);b=b.offset(0,0);d?a.setPoint(0,c,b):a.insertPoint(0,c,b);this._graphic.setGeometry(a)}},_onMouseDragHandler:function(b){if(this._graphic||this._points.length)if(t("esri-touch")&&!this._points.length)b.preventDefault();else{this._dragged=!0;if(this.map.snappingManager)var a=this.map.snappingManager._snappingPoint;var c=
  this._points[0],d=a||b.mapPoint,f=this.map,k=f.spatialReference;a=this._graphic;var l=h,m=f.toScreen(c),g=f.toScreen(d),e=[];e=g.x-m.x;g=g.y-m.y;var p=Math.sqrt(e*e+g*g);switch(this._geometryType){case l.CIRCLE:this._hideTooltip();a.geometry=r.createCircle({center:m,r:p,numberOfPoints:60,map:f});a.setGeometry(a.geometry);break;case l.ELLIPSE:this._hideTooltip();a.geometry=r.createEllipse({center:m,longAxis:e,shortAxis:g,numberOfPoints:60,map:f});a.setGeometry(a.geometry);break;case l.TRIANGLE:this._hideTooltip();
  e=[[0,-p],[.8660254037844386*p,.5*p],[-.8660254037844386*p,.5*p],[0,-p]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.ARROW:this._hideTooltip();c=g/p;f=e/p;d=.25*f*p;k=.25*p/(g/e);p*=.25*c;e=[[e,g],[e-d*(1+24/k),g+24*f-p],[e-d*(1+12/k),g+12*f-p],[-12*c,12*f],[12*c,-12*f],[e-d*(1-12/k),g-12*f-p],[e-d*(1-24/k),g-24*f-p],[e,g]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.LEFT_ARROW:this._hideTooltip();e=0>=e?[[e,0],[.75*e,g],[.75*e,.5*
  g],[0,.5*g],[0,-.5*g],[.75*e,-.5*g],[.75*e,-g],[e,0]]:[[0,0],[.25*e,g],[.25*e,.5*g],[e,.5*g],[e,-.5*g],[.25*e,-.5*g],[.25*e,-g],[0,0]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.RIGHT_ARROW:this._hideTooltip();e=0<=e?[[e,0],[.75*e,g],[.75*e,.5*g],[0,.5*g],[0,-.5*g],[.75*e,-.5*g],[.75*e,-g],[e,0]]:[[0,0],[.25*e,g],[.25*e,.5*g],[e,.5*g],[e,-.5*g],[.25*e,-.5*g],[.25*e,-g],[0,0]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.UP_ARROW:this._hideTooltip();
  e=0>=g?[[0,g],[-e,.75*g],[-.5*e,.75*g],[-.5*e,0],[.5*e,0],[.5*e,.75*g],[e,.75*g],[0,g]]:[[0,0],[-e,.25*g],[-.5*e,.25*g],[-.5*e,g],[.5*e,g],[.5*e,.25*g],[e,.25*g],[0,0]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.DOWN_ARROW:this._hideTooltip();e=0<=g?[[0,g],[-e,.75*g],[-.5*e,.75*g],[-.5*e,0],[.5*e,0],[.5*e,.75*g],[e,.75*g],[0,g]]:[[0,0],[-e,.25*g],[-.5*e,.25*g],[-.5*e,g],[.5*e,g],[.5*e,.25*g],[e,.25*g],[0,0]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);
  break;case l.RECTANGLE:this._hideTooltip();e=[[0,0],[e,0],[e,g],[0,g],[0,0]];a.geometry=this._toPolygon(e,m.x,m.y);a.setGeometry(a.geometry);break;case l.LINE:a.setGeometry(n.mixin(a.geometry,{paths:[[[c.x,c.y],[d.x,d.y]]]}));break;case l.EXTENT:a&&f.graphics.remove(a,!0);a=new H(this._normalizeRect(c,d,k));a._originOnly=!0;this._graphic=f.graphics.add(new v(a,this.fillSymbol),!0);f.snappingManager&&f.snappingManager._setGraphic(this._graphic);break;case l.FREEHAND_POLYLINE:this._hideTooltip();if(!1===
  this._canDrawFreehandPoint(b)){t("esri-touch")&&b.preventDefault();return}this._points.push(b.mapPoint.offset(0,0));a.geometry._insertPoints([d.offset(0,0)],0);a.setGeometry(a.geometry);break;case l.FREEHAND_POLYGON:this._hideTooltip();if(!1===this._canDrawFreehandPoint(b)){t("esri-touch")&&b.preventDefault();return}this._points.push(b.mapPoint.offset(0,0));a.geometry._insertPoints([d.offset(0,0)],0);a.setGeometry(a.geometry)}t("esri-touch")&&b.preventDefault()}},_canDrawFreehandPoint:function(b){if(!this._oldPoint)return!1;
  var a=this._oldPoint.x-b.screenPoint.x,c=this._oldPoint.y-b.screenPoint.y,d=this._options.tolerance;if((0>a?-1*a:a)<d&&(0>c?-1*c:c)<d)return!1;a=new Date;if(a-this._startTime<this._options.drawTime)return!1;this._startTime=a;this._oldPoint=b.screenPoint;return!0},_onMouseUpHandler:function(b){if(this._dragged&&this._graphic){0===this._points.length&&this._points.push(b.mapPoint.offset(0,0));if(this.map.snappingManager)var a=this.map.snappingManager._snappingPoint;var c=this._points[0];a=a||b.mapPoint;
  var d=this.map.spatialReference,f=h;switch(this._geometryType){case f.CIRCLE:case f.ELLIPSE:case f.TRIANGLE:case f.ARROW:case f.LEFT_ARROW:case f.RIGHT_ARROW:case f.UP_ARROW:case f.DOWN_ARROW:case f.RECTANGLE:var k=this._graphic.geometry;break;case f.LINE:k=new w({paths:[[[c.x,c.y],[a.x,a.y]]],spatialReference:d});break;case f.EXTENT:k=(new H(this._normalizeRect(c,a,d))).getExtent();break;case f.FREEHAND_POLYLINE:k=new w(d);k.addPath([].concat(this._points,[a.offset(0,0)]));break;case f.FREEHAND_POLYGON:k=
  new r(d),c=[].concat(this._points,[a.offset(0,0),this._points[0].offset(0,0)]),r.prototype.isClockwise(c)||this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),c.reverse()),k.addRing(c)}t("esri-touch")&&b.preventDefault();this._clear();this._drawEnd(k)}else this._clear()},_isPointToPointTool:function(b){switch(b){case h.POLYLINE:case h.POLYGON:case h.MULTI_POINT:return!0;default:return!1}},_onClickHandler:function(b){if(this.map.snappingManager)var a=
  this.map.snappingManager._snappingPoint;a=a||b.mapPoint;b=this.map;var c=b.toScreen(a),d=h;if(this._isPointToPointTool(this._geometryType)){var f=this._points[this._points.length-1];if(a&&f&&a.x===f.x&&a.y===f.y)return;this._points.push(a.offset(0,0))}switch(this._geometryType){case d.POINT:this.onDrawStart();this._drawEnd(a.offset(0,0));this._setTooltipMessage(0);break;case d.POLYLINE:1===this._points.length?(a=new w(b.spatialReference),a.addPath(this._points),this._graphic=b.graphics.add(new v(a,
  this.lineSymbol),!0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic,{snapToLastVertex:!1}),this._onMouseMoveHandler_connect=q.connect(b,"onMouseMove",this._onMouseMoveHandler),this.onDrawStart()):(this._graphic.geometry.setPoint(0,this._points.length-1,a.offset(0,0)),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.lineSymbol));break;case d.POLYGON:1===this._points.length?(a=new r(b.spatialReference),a.addRing(this._points),this._graphic=b.graphics.add(new v(a,this.fillSymbol),
  !0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic,{snapToLastVertex:!1}),this._onMouseMoveHandler_connect=q.connect(b,"onMouseMove",this._onMouseMoveHandler),this.onDrawStart()):(this._graphic.geometry.setPoint(0,this._points.length-1,a.offset(0,0)),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.fillSymbol));break;case d.MULTI_POINT:a=this._points;1===a.length?(c=new B(b.spatialReference),c.addPoint(a[a.length-1]),this._graphic=b.graphics.add(new v(c,this.markerSymbol),
  !0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic),this.onDrawStart()):(this._graphic.geometry.addPoint(a[a.length-1]),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.markerSymbol));break;case d.ARROW:this._addShape([[0,0],[-24,24],[-24,12],[-96,12],[-96,-12],[-24,-12],[-24,-24],[0,0]],c.x,c.y);break;case d.LEFT_ARROW:this._addShape([[0,0],[24,24],[24,12],[96,12],[96,-12],[24,-12],[24,-24],[0,0]],c.x,c.y);break;case d.RIGHT_ARROW:this._addShape([[0,0],[-24,24],[-24,
  12],[-96,12],[-96,-12],[-24,-12],[-24,-24],[0,0]],c.x,c.y);break;case d.UP_ARROW:this._addShape([[0,0],[-24,24],[-12,24],[-12,96],[12,96],[12,24],[24,24],[0,0]],c.x,c.y);break;case d.DOWN_ARROW:this._addShape([[0,0],[-24,-24],[-12,-24],[-12,-96],[12,-96],[12,-24],[24,-24],[0,0]],c.x,c.y);break;case d.TRIANGLE:this._addShape([[0,-48],[41.56921938165306,24],[-41.56921938165306,24],[0,-48]],c.x,c.y);break;case d.RECTANGLE:this._addShape([[0,-96],[96,-96],[96,0],[0,0],[0,-96]],c.x-48,c.y+48);break;case d.CIRCLE:this._clear();
  this.onDrawStart();this._drawEnd(r.createCircle({center:c,r:48,numberOfPoints:60,map:b}));break;case d.ELLIPSE:this._clear(),this.onDrawStart(),this._drawEnd(r.createEllipse({center:c,longAxis:48,shortAxis:24,numberOfPoints:60,map:b}))}this._setTooltipMessage(this._points.length)},_addShape:function(b,a,c){this._setTooltipMessage(0);this._clear();this.onDrawStart();this._drawEnd(this._toPolygon(b,a,c))},_toPolygon:function(b,a,c){var d=this.map,f=new r(d.spatialReference);f.addRing(A.map(b,function(k){return d.toMap({x:k[0]+
  a,y:k[1]+c})}));return f},_onDblClickHandler:function(b){var a=this._points,c=this.map.spatialReference,d=h;t("esri-touch")&&a.push(b.mapPoint);var f=a[a.length-1],k=a[a.length-2];a=f&&k&&f.x===k.x&&f.y===k.y?a.slice(0,a.length-1):a.slice(0,a.length);switch(this._geometryType){case d.POLYLINE:if(!this._graphic||2>a.length){q.disconnect(this._onMouseMoveHandler_connect);this._clear();this._onClickHandler(b);return}var l=new w(c);l.addPath([].concat(a));break;case d.POLYGON:if(!this._graphic||3>a.length)return;
  l=new r(c);b=[].concat(a,[a[0].offset(0,0)]);r.prototype.isClockwise(b)||this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),b.reverse());l.addRing(b);break;case d.MULTI_POINT:l=new B(c),A.forEach(a,function(m){l.addPoint(m)})}q.disconnect(this._onMouseMoveHandler_connect);this._clear();this._setTooltipMessage(0);this._drawEnd(l)},_onKeyDownHandler:function(b){b.keyCode===J.ESCAPE&&(q.disconnect(this._onMouseMoveHandler_connect),
  this._clear(),this._setTooltipMessage(0))},_toggleTooltip:function(b){this._options.showTooltips&&(b?this._tooltip||(this._tooltip=D.create("div",{"class":"esriMapTooltip"},this.map.container),K.isBodyLtr()||E.set(this._tooltip,"direction","rtl"),this._tooltip.style.display="none",this._tooltip.style.position="fixed",this._setTooltipMessage(0),this._onTooltipMouseEnterHandler_connect=q.connect(this.map,"onMouseOver",this._updateTooltip),this._onTooltipMouseLeaveHandler_connect=q.connect(this.map,
  "onMouseOut",this._hideTooltip),this._onTooltipMouseMoveHandler_connect=q.connect(this.map,"onMouseMove",this._updateTooltip)):this._tooltip&&(q.disconnect(this._onTooltipMouseEnterHandler_connect),q.disconnect(this._onTooltipMouseLeaveHandler_connect),q.disconnect(this._onTooltipMouseMoveHandler_connect),D.destroy(this._tooltip),this._tooltip=null))},_hideTooltip:function(){var b=this._tooltip;b&&(b.style.display="none")},_setTooltipMessage:function(b){var a=this._tooltip;if(a){var c="";switch(this._geometryType){case h.POINT:c=
  u.toolbars.draw.addPoint;break;case h.ARROW:case h.LEFT_ARROW:case h.RIGHT_ARROW:case h.UP_ARROW:case h.DOWN_ARROW:case h.TRIANGLE:case h.RECTANGLE:case h.CIRCLE:case h.ELLIPSE:c=u.toolbars.draw.addShape;break;case h.LINE:case h.EXTENT:case h.FREEHAND_POLYLINE:case h.FREEHAND_POLYGON:c=u.toolbars.draw.freehand;break;case h.POLYLINE:case h.POLYGON:c=u.toolbars.draw.start;1===b?c=u.toolbars.draw.resume:2<=b&&(c=u.toolbars.draw.complete);break;case h.MULTI_POINT:c=u.toolbars.draw.addMultipoint,1<=b&&
  (c=u.toolbars.draw.finish)}a.innerHTML=c}},_updateTooltip:function(b){var a=this._tooltip;if(a){if(b.clientX||b.pageY){var c=b.clientX;b=b.clientY}else c=b.clientX+z.body().scrollLeft-z.body().clientLeft,b=b.clientY+z.body().scrollTop-z.body().clientTop;a.style.display="none";E.set(a,{left:c+this._options.tooltipOffset+"px",top:b+"px"});a.style.display=""}},_redrawGraphic:function(b,a,c,d){(c||this.map.wrapAround180)&&(b=this._graphic)&&b.setGeometry(b.geometry)},onActivate:function(){},onDeactivate:function(){},
  onDrawComplete:function(){},onDrawStart:function(){},onDrawEnd:function(){}});n.mixin(h,{POINT:"point",MULTI_POINT:"multipoint",LINE:"line",EXTENT:"extent",POLYLINE:"polyline",POLYGON:"polygon",FREEHAND_POLYLINE:"freehandpolyline",FREEHAND_POLYGON:"freehandpolygon",ARROW:"arrow",LEFT_ARROW:"leftarrow",RIGHT_ARROW:"rightarrow",UP_ARROW:"uparrow",DOWN_ARROW:"downarrow",TRIANGLE:"triangle",CIRCLE:"circle",ELLIPSE:"ellipse",RECTANGLE:"rectangle"});t("extend-esri")&&n.setObject("toolbars.Draw",h,L);return h});