forked from Esri/arcgis-js-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_coremap.js
25 lines (24 loc) · 39.2 KB
/
_coremap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// COPYRIGHT © 201 Esri
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// This material is licensed for use under the Esri Master License
// Agreement (MLA), and is bound by the terms of that agreement.
// You may redistribute and use this code without modification,
// provided you adhere to the terms of the MLA and include this
// copyright notice.
//
// See use restrictions at https://www.esri.com/legal/pdfs/mla_e204_e300/english
//
// For additional information, contact:
// Environmental Systems Research Institute, Inc.
// Attn: Contracts and Legal Services Department
// 380 New York Street
// Redlands, California, USA 92373
// USA
//
// email: [email protected]
//
// See https://js.arcgis.com/3.33/esri/copyright.txt for details.
define(["require","module","dojo/_base/kernel","dojo/_base/declare","dojo/_base/connect","dojo/_base/Deferred","dojo/_base/lang","dojo/_base/array","dojo/_base/event","dojo/_base/unload","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/dom-geometry","dojo/dom-style","dojo/sniff","dijit/registry","dojox/gfx/matrix","./kernel","./config","./basemaps","./lang","./Evented","./fx","./deferredUtils","./tileUtils","./urlUtils","./PluginTarget","./Color","./promiseList","./arcade/Dictionary","./geometry/Point","./geometry/ScreenPoint","./geometry/Extent","./geometry/Rect","./geometry/mathUtils","./geometry/scaleUtils","./geometry/screenUtils","./geometry/webMercatorUtils","./layers/GraphicsLayer","./layers/TileInfo","./layers/LOD","./layers/ArcGISTiledMapServiceLayer","./layers/MapImageLayer","./layers/OpenStreetMapLayer","./layers/support/webglUtils","./dijit/Popup","./plugins/popupManager","dojo/uacss"],(function(e,t,i,n,s,a,r,o,h,l,d,c,_,u,p,f,g,m,y,x,v,L,b,w,E,R,I,C,M,z,A,D,W,S,T,O,P,H,G,F,U,j,k,B,Z,N,V,$){var J,q=G.toMapPoint,X=G.toScreenPoint,Q=s.connect,Y=s.disconnect,K=r.hitch,ee=f.set,te=o.indexOf,ie=r.mixin,ne=0,se=v.defaults.map,ae=se.layerNamePrefix,re=se.graphicsLayerNamePrefix,oe=new RegExp("^"+ae+"(\\d+)$"),he=new RegExp("^"+re+"(\\d+)$"),le=function(){},de=0;function ce(e,t){var i=e.lods;i.sort((function(e,t){return e.scale>t.scale?-1:e.scale<t.scale?1:0}));var n=[];i=o.filter(i,(function(e){if(-1===te(n,e.scale))return n.push(e.scale),!0}));var s=t.lods=[];o.forEach(i,(function(e,t){(s[t]=new k(e)).level=t})),t.tileInfo=new j(ie(e,{lods:s}))}var _e=V.isWebGLEnabled(),ue=n([w,M],{declaredClass:"esri._CoreMap",tables:null,resizeDelay:300,invalidExtent:"Map does not have a valid extent.",invalidGeometry:"Geometry (wkid: ${geometry}) cannot be converted to spatial reference of the map (wkid: ${map})",unknownBasemap:'Unable to find basemap definition for: "${basemapName}". Try one of these: ${list}',invalidBasemap:'Unable to add basemap: "${basemapName}".',unknownLayerType:'Unknown basemap layer type: "${type}" found in basemap definition for: "${basemapName}".',visible:!0,webglEnabled:_e,_eventMap:{"basemap-change":!0,"extent-change":["extent","delta","levelChange","lod"],"layer-add":["layer"],"layer-add-result":["layer","error"],"layer-remove":["layer"],"layer-reorder":["layer","index"],"layer-resume":["layer"],"layer-suspend":["layer"],"layers-add-result":["layers"],"layers-removed":!0,"layers-reordered":["layerIds"],load:["map"],pan:["extent","delta"],"pan-end":["extent","delta"],"pan-start":["extent","screenPoint"],reposition:["x","y"],resize:["extent","width","height"],scale:["matrix","immediate"],"time-extent-change":["timeExtent"],"before-unload":["map"],unload:["map"],"update-end":["error"],"update-start":!0,zoom:["extent","zoomFactor","anchor"],"zoom-end":["extent","zoomFactor","anchor","level"],"zoom-start":["extent","zoomFactor","anchor","level"],click:!0,"dbl-click":!0,"key-down":!0,"key-up":!0,"mouse-down":!0,"mouse-drag":!0,"mouse-drag-end":!0,"mouse-drag-start":!0,"mouse-move":!0,"mouse-out":!0,"mouse-over":!0,"mouse-up":!0,"mouse-wheel":!0,"basic-tap":!0,"double-tap":!0,"pinch-end":!0,"pinch-move":!0,"pinch-start":!0,"processed-double-tap":!0,"processed-tap":!0,"swipe-end":!0,"swipe-move":!0,"swipe-start":!0,tap:!0,"two-finger-tap":!0},constructor:function(t,i){i=i||{},this.registerConnectEvents(),ie(this,{_internalLayerIds:[],_layers:[],_layerDivs:[],_basemapPending:!1,_connects:[],_layerAddPromises:{},_zoomAnimDiv:null,_zoomAnim:null,_layersDiv:null,_firstLayerId:null,_delta:null,_cursor:null,_ratioW:1,_ratioH:1,_params:null,_minResolution:0,_maxResolution:0,cursor:null,layerIds:[],graphicsLayerIds:[],graphics:null,_labels:null,loaded:!1,__panning:!1,__zooming:!1,__container:null,root:null,__LOD:null,__tileInfo:null,__visibleRect:null,__visibleDelta:null,_rids:[],_webglContextOwners:[]});var n=this.container=d.byId(t),s=this.id=c.get(n,"id")||m.getUniqueId(this.declaredClass);_.add(n,"map");var a=p.getContentBox(n),r=_.add,o=u.create;this.position=new S(0,0),this._reposition();var h=this.width=a.w>0?a.w:se.width,f=this.height=a.h>0?a.h:se.height,g=this.root=o("div",{id:s+"_root",style:{width:h+"px",height:f+"px",direction:"ltr"}});r(g,"esriMapContainer");var y=this.__container=o("div",{id:s+"_container"},g);ee(y,"position","absolute"),r(y,"esriMapContainer"),n.appendChild(g);var x=this._params=ie({slider:!0,nav:!1,zoom:-1,minZoom:-1,maxZoom:-1,scale:-1,minScale:0,maxScale:0,showInfoWindowOnClick:!0,displayGraphicsOnPan:!0,wrapAround180:!0,fitExtent:!1,optimizePanAnimation:!0},i);this.setWebGLEnabled(null!=x.webglEnabled?x.webglEnabled:this.webglEnabled),this.maxWebGLContexts=null!=x.maxWebGLContexts?x.maxWebGLContexts:-1,this.wrapAround180=x.wrapAround180,this.optimizePanAnimation=x.optimizePanAnimation,this.setBackgroundColor(x.backgroundColor),b.isDefined(x.resizeDelay)&&(this.resizeDelay=x.resizeDelay),x.lods&&(ce({rows:512,cols:512,dpi:96,format:"JPEG",compressionQuality:75,origin:{x:-180,y:90},spatialReference:{wkid:4326},lods:x.lods},x),this.__tileInfo=x.tileInfo),this.extent=x.extent,this._extentUtil({mapCenter:x.center,targetLevel:x.zoom,targetScale:x.scale}),this.__visibleRect=new O(0,0,h,f),this.__visibleDelta=new O(0,0,h,f);var v=this._layersDiv=o("div",{id:s+"_layers"});if(r(v,"esriMapLayers"),y.appendChild(v),this._zoomAnimDiv=o("div",{style:{position:"absolute"}}),x.infoWindow)this.infoWindow=x.infoWindow;else{var L=this.infoWindow=new $(x.popupOptions,o("div"));L.startup(),L._ootb=!0,ee(L.domNode,"zIndex",40)}if(x.showLabels){var w=this;e(["./layers/LabelLayer"],(function(e){J=e,w._createLabelLayer()})),this.on("load",(function(){w._createLabelLayer()}))}this.addPlugin(this._getAbsMid("./plugins/popupManager"),{enabled:x.showInfoWindowOnClick}),this._zoomStartHandler=K(this,this._zoomStartHandler),this._zoomingHandler=K(this,this._zoomingHandler),this._zoomEndHandler=K(this,this._zoomEndHandler),this._panningHandler=K(this,this._panningHandler),this._panEndHandler=K(this,this._panEndHandler),this._endTranslate=K(this,this._endTranslate),this._timedResize=K(this,this._timedResize),this._execResize=K(this,this._execResize),this._processLabelLayers=K(this,this._processLabelLayers),this._updateLabelLayers=K(this,this._updateLabelLayers),this.resize=K(this,this.resize),l.addOnWindowUnload(this,this.destroy)},_getAbsMid:function(i){return e.toAbsMid?e.toAbsMid(i):t.id.replace(/\/[^\/]*$/gi,"/")+i},_cleanUp:function(){var e=this.infoWindow;e&&(e._ootb&&e.destroy?e.destroy():e.unsetMap(this),delete this.infoWindow),Y(this._tsTimeExtentChange_connect),this.removePlugin("./plugins/popupManager"),u.destroy(this.root),this.root=null},_addLayer:function(e,t,i){if(e.id){var n=e.id.match(e instanceof U?he:oe);n&&n[1]&&(n=Number(n[1]),ne<=n&&(ne=n+1))}var s,a=e.id||(e instanceof U?re:ae)+ne++;if(e.id=a,this._layers[a]=e,e._isRefLayer="top"===i,i=!b.isDefined(i)||i<0||i>t.length||"top"===i?t.length:i,!e._isRefLayer)for(;(s=this.getLayer(t[i-1]))&&s._isRefLayer;)i--;var r=!(this._firstLayerId||this.loaded||this._basemapPending||0!==i||t!==this.layerIds&&t!==this.graphicsLayerIds);r&&(this._firstLayerId=a),t.splice(i,0,a);var o=K(this,this._addLayerHandler),h=this,l=this._connects,d=function(){e.loaded?h._onLoadFix?(h._onLoadFix=!1,setTimeout((function(){o(e)}),0)):o(e):(h["_"+a+"_addtoken_load"]=Q(e,"onLoad",h,"_addLayerHandler"),h["_"+a+"_addtoken_err"]=Q(e,"onError",h,(function(i){o(e,i,t)})))};return this.loaded||r||e.loaded&&-1===te(this.graphicsLayerIds,a)?d():l.push(Q(this,"onLoad",d)),e},_forgetLayer:function(e){var t=e.id;Y(this["_"+t+"_addtoken_load"]),Y(this["_"+t+"_addtoken_err"]);var i=this._layerAddPromises[t];i&&(delete this._layerAddPromises[t],i.cancel())},_addLayerHandler:function(e,t,i){if(t)this._attachLayerToMap(e,t,i);else if(e._prepareToAttach){(this._layerAddPromises[e.id]=e._prepareToAttach(this)).always(r.hitch(this,(function(t){t&&"cancel"===t.dojoType||this._attachLayerToMap(e,null,i)})))}else e.declaredClass&&e.declaredClass.toLowerCase().indexOf("vectortilelayer")>-1&&!this.isWebGLContextAvailable()?(t=new Error("Too many WebGL contexts. Unable to add the layer: ",e.url),this._attachLayerToMap(e,t,this.layerIds)):this._attachLayerToMap(e,t,i)},_attachLayerToMap:function(e,t,i){var n,s,a,r,o=this.id,h=e.id,l=te(e instanceof U?this.graphicsLayerIds:this.layerIds,h),d=l,c=!1,_=this._params;if(this._forgetLayer(e),t)return delete this._layers[h],void(-1!==l&&(i.splice(l,1),this.onLayerAddResult(e,t)));if(-1===l&&(d=20+(l=te(this._internalLayerIds,h)),c=!0),h===this._firstLayerId){if(s=e.spatialReference,!(a=this.extent&&this.extent.spatialReference)||a.equals(s)||!e.tileInfo&&e.url||(a=null),n=this.spatialReference=a||s,this.wrapAround180=!!(this.wrapAround180&&n&&n._isWrappable()),e.tileInfo&&(this.__tileInfo?(r=this.__tileInfo.lods,this.__tileInfo=ie({},e.tileInfo),this.__tileInfo.lods=r):(ce(ie({},e.tileInfo),_),this.__tileInfo=_.tileInfo)),this.wrapAround180){var u=this.__tileInfo,p=n._getInfo();(!u||Math.abs(p.origin[0]-u.origin.x)>p.dx)&&(this.wrapAround180=!1),this.wrapAround180&&u&&I._addFrameInfo(u,p)}if(_.units=e.units,(r=this.__tileInfo&&this.__tileInfo.lods)&&r.length){var f,g=_.minScale,m=_.maxScale,y=-1,x=-1,v=!1,L=!1;for(f=0;f<r.length;f++)g>0&&!v&&g>=r[f].scale&&(y=r[f].level,v=!0),m>0&&!L&&m>=r[f].scale&&(x=f>0?r[f-1].level:-1,L=!0);for(-1===_.minZoom&&(_.minZoom=0===g?r[0].level:y),-1===_.maxZoom&&(_.maxZoom=0===m?r[r.length-1].level:x),f=0;f<r.length;f++)_.minZoom===r[f].level&&(_.minScale=r[f].scale,this._minResolution=r[f].resolution),_.maxZoom===r[f].level&&(_.maxScale=r[f].scale,this._maxResolution=r[f].resolution)}else _.minZoom=_.maxZoom=_.zoom=-1}if(e instanceof U){if(!this._gc)this._gc=new U._GraphicsContainer,this._gc._setMap(this,this._layersDiv).id=o+"_gc";this._attachGraphicsLayer(e).id=o+"_"+h}else{var b=e._setMap(this,this._layersDiv,d,this.__LOD);b.id=o+"_"+h,this._layerDivs[h]=b,this._reorderLayers(this.layerIds),c||-1===e.declaredClass.indexOf("VETiledLayer")||this._onBingLayerAdd(e)}if(h===this._firstLayerId&&(this.graphics=new U({id:o+"_graphics",displayOnPan:_.displayGraphicsOnPan}),this._addLayer(this.graphics,this._internalLayerIds,20)),e===this.graphics){var w,E,R=this._layers[this._firstLayerId],C=_.zoom,M=_.scale,z=_.center,A=R.initialExtent||R.fullExtent;if(this._firstLayerId=null,this.extent&&(this.extent=this._convertGeometry(this,this.extent)),!this.extent&&A&&(z&&(z=this._convertGeometry(A,z)),z&&(A=A.centerAt(z),z=null)),(E=this.extent||A&&new T(A.toJson()))&&(C>-1?E=this.__getExtentForLevel(C,null,E).extent:M>0&&(E=H.getExtentForScale(this,M,E))),!E)return void console.log("Map: "+this.invalidExtent);w=this._fixExtent(E,_.fitExtent),this.extent=w.extent,this.__LOD=w.lod,this.__setExtent(this.extent),this.loaded=!0,this.attr("data-loaded",""),this.infoWindow.setMap(this),this.onLoad(this)}c||(this.onLayerAdd(e),this.onLayerAddResult(e)),Y(this[h+"_addLayerHandler_connect"])},_convertGeometry:function(e,t){var i=e&&e.spatialReference,n=t&&t.spatialReference;return i&&n&&!i.equals(n)&&(i._canProject(n)?i.isWebMercator()?t=F.geographicToWebMercator(t):4326===i.wkid&&(t=F.webMercatorToGeographic(t,!0)):(console.log("Map: "+b.substitute({geometry:n.wkid||n.wkt,map:i.wkid||i.wkt},this.invalidGeometry)),t=null)),t},_attachGraphicsLayer:function(e){var t=e.id,i=e._setMap(this,this._gc._surface);return this._layerDivs[t]=i,this._reorderLayers(this.graphicsLayerIds),i},_detachGraphicsLayer:function(e){e.loaded&&e.getMap()&&e._unsetMap(this,this._gc._surface)},_reorderLayers:function(e){var t=this.onLayerReorder,i=u.place,n=this._layerDivs,s=this._layers,a=this._gc?this._gc._surface.getEventSource():null;if(e===this.graphicsLayerIds)o.forEach(e,(function(e,i){var a=n[e],r=s[e];a&&(this._gc._reorderLayer(r,a,i),t(r,i))}),this);else{var r,h=this.graphics,l=h?h.id:null,d=this._layersDiv;o.forEach(e,(function(e,a){r=n[e],e!==l&&r&&(i(r,d,a),t(s[e],a))})),this._mapImageLyr&&this._placeMapImageLyr(),a&&(a=g("ie")<9?a.parentNode:a,i(a,a.parentNode,"last"))}this.onLayersReordered([].concat(e))},_zoomStartHandler:function(){this.__zoomStart(this._zoomAnimDiv.startingExtent,this._zoomAnimDiv.anchor)},_zoomingHandler:function(e){var t=parseFloat(e.left),i=parseFloat(e.top),n=new T(t,i-parseFloat(e.height),t+parseFloat(e.width),i,this.spatialReference),s=this.extent.getWidth()/n.getWidth();this.__zoom(n,s,this._zoomAnimDiv.anchor)},_zoomEndHandler:function(){var e=this._zoomAnimDiv,t=e.extent,i=this.extent.getWidth()/t.getWidth(),n=e.anchor,s=e.newLod,a=e.levelChange;e.extent=e.anchor=e.levelChange=e.startingExtent=e.newLod=this._delta=this._zoomAnim=null,this.__zoomEnd(t,i,n,s,a)},_panningHandler:function(e){if(isNaN(parseFloat(e.left))||isNaN(parseFloat(e.top))){var t=Math.round,i=this._panAnim.node;e.left=-1*(this._delta.x-t(this.width/2))+"px",e.top=-1*(this._delta.y-t(this.height/2))+"px",f.set(i,"left",e.left),f.set(i,"top",e.top)}var n=new S(parseFloat(e.left),parseFloat(e.top)),s=this.toMap(n);this.onPan(this.extent.offset(this.extent.xmin-s.x,this.extent.ymax-s.y),n)},_panEndHandler:function(e){this.__panning=!1;var t=Math.round,i=new S(-t(parseFloat(e.style.left)),-t(parseFloat(e.style.top))),n=i.x,s=i.y,a=this.__visibleRect,r=this.__visibleDelta;a.x+=-n,a.y+=-s,r.x+=-n,r.y+=-s,ee(this._zoomAnimDiv,{left:"0px",top:"0px"});var o=this.extent,h=this._ratioW,l=this._ratioH;o=new T(o.xmin+n/h,o.ymin-s/l,o.xmax+n/h,o.ymax-s/l,this.spatialReference),i.setX(-i.x),i.setY(-i.y),this._delta=this._panAnim=null,this._updateExtent(o),this.onPanEnd(o,i),this._fireExtChg([o,i,!1,this.__LOD])},_fixExtent:function(e,t){for(var i=this._reshapeExtent(e),n=1.25;!0===t&&(i.extent.getWidth()<e.getWidth()||i.extent.getHeight()<e.getHeight())&&i.lod.level>0&&n<=3;)i=this._reshapeExtent(e.expand(n)),n+=.25;return i},_getFrameWidth:function(){var e=-1,t=this.spatialReference._getInfo();if(this.__LOD){var i=this.__LOD._frameInfo;i&&(e=i[3])}else t&&(e=Math.round(2*t.valid[1]/(this.extent.getWidth()/this.width)));return e},_fixAspectRatio:function(e){var t=e.getWidth(),i=e.getHeight(),n=t/i,s=this.width/this.height,a=0,r=0;return this.width>this.height?t>i?s>n?a=i*s-t:r=t/s-i:a=i*s-t:this.width<this.height?t<i&&s>n?a=i*s-t:r=t/s-i:t<i?a=i-t:t>i&&(r=t/s-i),a&&(e.xmin-=a/2,e.xmax+=a/2),r&&(e.ymin-=r/2,e.ymax+=r/2),e},_reshapeExtent:function(e){return e=this._fixAspectRatio(e),this._getAdjustedExtent(e)},_getAdjustedExtent:function(e){if(this.__tileInfo)return I.getCandidateTileInfo(this,this.__tileInfo,e);var t=H.getScale(this,e),i=this.getMinScale(),n=this.getMaxScale();return!i||t<=i?!n||t>=n||(e=H.getExtentForScale(this,n,e)):e=H.getExtentForScale(this,i,e),{extent:e}},_onBingLayerAdd:function(e){this["__"+e.id+"_vis_connect"]=s.connect(e,"onVisibilityChange",this,"_toggleBingLogo"),this._toggleBingLogo(e.visible)},_onBingLayerRemove:function(e){s.disconnect(this["__"+e.id+"_vis_connect"]),delete this["__"+e.id+"_vis_connect"];var t=this.layerIds,i=o.some(t,(function(t){return(e=this._layers[t])&&e.visible&&-1!==e.declaredClass.indexOf("VETiledLayer")}),this);this._toggleBingLogo(i)},_toggleBingLogo:function(t){if(t&&!this._bingLogo){var i={left:this._mapParams&&this._mapParams.nav?"25px":""};6===g("ie")&&(i.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='"+e.toUrl("./images/map/bing-logo-lg.png")+"')");var n=this._bingLogo=u.create("div",{style:i},this.root);_.add(n,"bingLogo-lg")}else!t&&this._bingLogo&&(u.destroy(this._bingLogo),delete this._bingLogo)},__panStart:function(e,t){var i=this._zoomAnim,n=this._panAnim;if(i&&i._active)i.stop(),i._fire("onEnd",[i.node]);else if(n&&n._active){n.stop(),this._panAnim=null;var s=n.curve.getValue(n._getStep()),a=Math.round(parseFloat(s.left)),r=Math.round(parseFloat(s.top)),o=this.navigationManager._dragOrigin;return this.__pan(a,r),void(o&&(o.x-=a,o.y-=r))}this.__panning=!0,this.onPanStart(this.extent,new S(e,t))},__pan:function(e,t){var i=this.extent,n=this._ratioW,s=this._ratioH;this.onPan(new T(i.xmin-e/n,i.ymin+t/s,i.xmax-e/n,i.ymax+t/s,this.spatialReference),new S(e,t))},__panEnd:function(e,t){var i=this.__visibleRect,n=this.__visibleDelta;i.x+=e,i.y+=t,n.x+=e,n.y+=t;var s=new S(e,t),a=this.extent,r=this._ratioW,o=this._ratioH;a=new T(a.xmin-e/r,a.ymin+t/o,a.xmax-e/r,a.ymax+t/o,this.spatialReference),this.__panning=!1,this._updateExtent(a),this.onPanEnd(a,s),this._fireExtChg([a,s,!1,this.__LOD])},__zoomStart:function(e,t){this.__zooming=!0,this.onZoomStart(e,1,t,this.__LOD?this.__LOD.level:null)},__zoom:function(e,t,i){this.onZoom(e,t,i)},__zoomEnd:function(e,t,i,n,s){ee(this._layersDiv,{left:"0px",top:"0px"}),this._delta=new S(0,0),this.__visibleRect.x=this.__visibleRect.y=0,e=new T(e),this.__LOD=n,this._ratioW=this.width/e.getWidth(),this._ratioH=this.height/e.getHeight();var a=this._delta;this._delta=null,this.__zooming=!1,this._updateExtent(e,s),this.onZoomEnd(e,t,i,n?n.level:null),this._fireExtChg([e,a,s,n])},_extentUtil:function(e,t,i,n,s){var o,h,l,d,c,_,u,p,f,g,m,y,x,v=new a,L=this.width,w=this.height;e&&(o=e.numLevels,h=e.targetLevel,m=b.isDefined(h),l=e.factor,d=e.mapAnchor,c=e.screenAnchor,_=e.mapCenter,y=e.levelOrFactor,u=e.targetScale,p=b.isDefined(u)&&u>0),t&&(f=t.dx,g=t.dy,_=t.mapCenter),r.isArray(_)&&(_=new W(_));var E,R,I,C,M=this._panAnim,z=this._stopAnim(),A=z?z.divExtent:this.extent,D=this.__tileInfo,O=this._params;if(!this.loaded)return i?(A&&(i=this._convertGeometry(A,i)),i&&(this.extent=i,O.zoom=O.scale=-1,O.center=null)):(_||m||p)&&(_&&(A?(_=this._convertGeometry(A,_))&&(this.extent=A.centerAt(_),O.center=null):O.center=_),m&&h>-1?(O.zoom=h,O.scale=-1):p&&(O.scale=u,O.zoom=-1)),v.resolve(),v;if(_&&!(_=this._convertGeometry(this,_)))return v.reject(),v;if(d&&!(d=this._convertGeometry(this,d)))return v.reject(),v;if(i&&!(i=this._convertGeometry(this,i)))return v.reject(),v;if(M&&d&&c&&(d=q(this.extent,L,w,c)),z&&d&&c&&(d=q(z.divExtent,L,w,c)),m)if(D){var P=this.getMinZoom(),G=this.getMaxZoom();h<P?h=P:h>G&&(h=G),o=h-(z?z.level:this.getLevel())}else o=h>0?-1:1,x=y?h:null;if(!i)if(b.isDefined(o)){var F;if(D){var U=z?z.level:this.getLevel();F=this.__getExtentForLevel(U+o,_,A).extent}else{F=(z?z.end:this.extent).expand(x||(o>0?.5*o:2*-o)),x&&_&&(F=F.centerAt(_))}if(F)if(_)i=F;else{var j=d||A.getCenter(),k=F.getWidth(),B=F.getHeight(),Z=j.x>=A.xmin&&j.x<=A.xmax?(j.x-A.xmin)/A.getWidth():.5,N=j.y>=A.ymin&&j.y<=A.ymax?(j.y-A.ymin)/A.getHeight():.5;E=j.x-Z*k,R=j.y-N*B,i=new T(E,R,E+k,R+B,this.spatialReference)}}else if(p)i=H.getExtentForScale(this,u,A);else if(b.isDefined(l))i=A.expand(l);else if(f||g)if(z){var V=z.end,$=V.getCenter(),J=X(V,L,w,$);J.x+=f,J.y+=g,J=q(V,L,w,J),i=V.offset(J.x-$.x,J.y-$.y)}else{var Q=new S(L/2+f,w/2+g),Y=q(A,L,w,Q);I=A.getWidth(),C=A.getHeight(),E=Y.x-I/2,R=Y.y-C/2,i=new T(E,R,E+I,R+C,this.spatialReference)}if(!i)if(_){var K=z?z.end:A;I=K.getWidth(),C=K.getHeight(),E=_.x-I/2,R=_.y-C/2,i=new T(E,R,E+I,R+C,this.spatialReference)}else z&&(i=z.end);return i?(this._extentDfd&&-1===this._extentDfd.fired&&(this._extentDfd.then(null,le),this._extentDfd.reject()),this._extentDfd=v,this.__setExtent(i,null,c,n,z,s)):v.reject(),v},__setExtent:function(e,t,i,n,s,a){try{if(this._firstLayerId)return void(this.extent=e);var r=!0,o=this.spatialReference,h=s?s.divExtent:this.extent,l=this._fixExtent(e,n||!1),d=(e=l.extent).getWidth(),c=e.getHeight(),_=Math.round;if(h){var u=_(1e6*h.getWidth()),p=_(1e6*d),f=_(1e6*h.getHeight()),g=_(1e6*c);r=u!==p||f!==g}var m,y,x=s&&s.rect,v=s&&s.divExtent;if(se.zoomDuration&&r&&h){v=v||new T(h),x=x||{left:h.xmin,top:h.ymax,width:h.getWidth(),height:h.getHeight()},y={left:e.xmin,top:e.ymax,width:d,height:c},x.width/y.width,x.height/y.height;var L=new W(e.xmin,e.ymax,o),b=new W(e.xmin,e.ymin,o),w=new W(this.extent.xmin,this.extent.ymax,o),R=new W(this.extent.xmin,this.extent.ymin,o);(m=P.getLineIntersection(w,L,R,b,o))||s||(r=!1)}this._ratioW=this.width/d,this._ratioH=this.height/c;var I=this._zoomAnimDiv;if(r)if(ee(this._layersDiv,{left:"0px",top:"0px"}),t=new S(0,0),this.__visibleRect.x=this.__visibleRect.y=0,x&&y){this._delta=t,I.id="_zAD",I.startingExtent=v,I.extent=e,I.levelChange=r,I.newLod=l.lod,I.anchor=i||(!m&&s?s.anchor:X(this.extent,this.width,this.height,m));var C=this.extent.getWidth()/e.getWidth(),M=(C<1?1/C:C)>1024;se.zoomAnimationThrottled&&M?(this.__zoomStart(v,I.anchor),this.__zoom(v,1,I.anchor),this._fireOnScale(1,I.anchor,!0),this.__zoomEnd(e,C,I.anchor,l.lod,r)):(this._zoomAnim=E.resize({node:I,start:x,end:y,duration:se.zoomDuration,rate:se.zoomRate,beforeBegin:s?null:this._zoomStartHandler,onAnimate:this._zoomingHandler,onEnd:this._zoomEndHandler}).play(),this._fireOnScale(C,I.anchor,a))}else this._updateExtent(e,r,a),this._fireExtChg([this.extent,t,r,this.__LOD=l.lod]);else if(!this.__panning)if(!1===this.loaded||a)this._updateExtent(e,r,a),this._fireExtChg([this.extent,t,r,this.__LOD=l.lod]);else{this.__panning=!0,(x=new O(0,0,this.width,this.height,this.spatialReference).getCenter()).x=_(x.x),x.y=_(x.y);var z=this._delta=this.toScreen(e.getCenter()),A=Math.abs(x.x-z.x),D=Math.abs(x.y-z.y);this.optimizePanAnimation&&(A>2*this.width||D>2*this.height)?(this.__panStart(0,0),this.__pan(0,0),this.__visibleRect.x=this.__visibleRect.y=this.__visibleDelta.x=this.__visibleDelta.y=0,this.__panning=!1,this._delta=null,this._updateExtent(e,!1,a),this.onPanEnd(this.extent,new S(0,0)),this._fireExtChg([this.extent,new S(0,0),!0,this.__LOD])):(this.onPanStart(this.extent,new S(0,0)),this._panAnim=E.slideTo({node:I,left:x.x-z.x,top:x.y-z.y,duration:se.panDuration,rate:se.panRate,onAnimate:this._panningHandler,onEnd:this._panEndHandler}),this._panAnim.play())}}catch(e){console.log(e.stack),console.error(e)}},_fireOnScale:function(e,t,i){if("css-transforms"===this.navigationMode){var n=this.__visibleDelta;this.onScale(y.scaleAt(e,{x:-1*(this.width/2-(t.x-n.x)),y:-1*(this.height/2-(t.y-n.y))}),i)}},_stopAnim:function(){var e=this._zoomAnim,t=this._panAnim;if(e&&e._active){e.stop();var i=e.curve.getValue(e._getStep()),n=parseFloat(i.left),s=parseFloat(i.top),a=e.node;return{anchor:a.anchor,start:a.startingExtent,end:a.extent,level:a.newLod&&a.newLod.level,rect:i,divExtent:new T(n,s-parseFloat(i.height),n+parseFloat(i.width),s,this.spatialReference)}}t&&t._active&&(t.stop(),t._fire("onEnd",[t.node]))},__getExtentForLevel:function(e,t,i){var n=this.__tileInfo,s=n&&n.lods;if(e=b.isDefined(e)?e:0,i=i||this.extent,t=t||i&&i.getCenter(),s){if(!t)return void console.log("Map: "+this.invalidExtent);var a=this.getMinZoom(),r=this.getMaxZoom();e>r&&(e=r),e<a&&(e=a);var o=s[e],h=this.width*o.resolution/2,l=this.height*o.resolution/2;return{extent:new T(t.x-h,t.y-l,t.x+h,t.y+l,t.spatialReference),lod:o}}return i?(e=!e||e<1?1:e,{extent:i.expand(e).centerAt(t)}):void console.log("Map: "+this.invalidExtent)},_jobs:0,_incr:function(){1==++this._jobs&&(this.updating=!0,this.attr("data-updating",""),this.onUpdateStart())},_decr:function(){var e=--this._jobs;e?e<0&&(this._jobs=0):(this.updating=!1,this.attr("data-updating"),this.onUpdateEnd())},_fireEvent:function(e,t){this[e]&&this[e].apply(this,t)},_updateExtent:function(e,t,i){this.extent=e;var n=this.spatialReference;this._viewInfo={view:new D({viewingMode:"map",scale:this.getScale()}),sr:n,version:t?++de:de},(t||i)&&this._setClipRect(),this._calcGeographicExtent()},_calcGeographicExtent:function(){var e=this.spatialReference;e&&(e.isWebMercator()?this.geographicExtent=F.webMercatorToGeographic(this._getAvailExtent(),!0):4326===e.wkid&&(this.geographicExtent=new T(this._getAvailExtent().toJson())))},_fireExtChg:function(e){this.attr("data-zoom",this.getZoom()),this.attr("data-scale",this.getScale()),this._fireEvent("onExtentChange",e);var t=this._extentDfd;t&&(delete this._extentDfd,t.resolve())},attr:function(e,t){var i=this.container;return i&&(null==t?i.removeAttribute(e):i.setAttribute(e,t)),this},onUpdateStart:function(){},onUpdateEnd:function(){},onLoad:function(){this._setClipRect(),this._calcGeographicExtent()},onBeforeUnload:function(){},onUnload:function(){},onExtentChange:function(e,t,i){},onTimeExtentChange:function(){},onWebGLEnabledChange:function(){},onLayerAdd:function(){},onLayerAddResult:function(){},onLayersAddResult:function(){},onLayerRemove:function(){},onLayersRemoved:function(){},onLayerReorder:function(){},onLayersReordered:function(){},onLayerSuspend:function(){},onLayerResume:function(){},onPanStart:function(){},onPan:function(){},onPanEnd:function(){},onScale:function(){},onZoomStart:function(){},onZoom:function(){},onZoomEnd:function(){},onResize:function(){this._setClipRect()},onReposition:function(){},destroy:function(){this._destroyed||(this.onBeforeUnload(this),this.removeAllLayers(),this.releaseAllWebGLContexts(),this._cleanUp(),clearTimeout(this._resizeTimerHandle),this._gc&&this._gc._cleanUp(),this._destroyed=!0,this.onUnload(this))},setCursor:function(e){ee(this.__container,"cursor",this.cursor=e)},setMapCursor:function(e){this.setCursor(this._cursor=e)},resetMapCursor:function(){this.setCursor(this._cursor)},setBackgroundColor:function(e){e&&!e.declaredClass&&(e=new z(e)),this.backgroundColor=e||null;var t="";e&&(t=g("ie")<9?e.toHex():"rgba("+e.toRgba().join(",")+")"),f.set(this.root,{backgroundColor:t})},setInfoWindow:function(e){var t=this.infoWindow;t&&t.unsetMap(this),this.infoWindow=e,this.loaded&&e&&e.setMap(this)},setInfoWindowOnClick:function(e){this._params.showInfoWindowOnClick=e,this.popupManager&&this.popupManager.set("enabled",e)},getInfoWindowAnchor:function(e){return this.infoWindow&&this.infoWindow._getAnchor&&this.infoWindow._getAnchor(e)||"upperright"},toScreen:function(e,t){return X(this.extent,this.width,this.height,e,t)},toMap:function(e){return q(this.extent,this.width,this.height,e)},addLayer:function(e,t){return e&&!this.getLayer(e.id)&&this._addLayer(e,e instanceof U?this.graphicsLayerIds:this.layerIds,t),e},addLayers:function(e){var t,i,n=[],a=e.length,r=e.length;for(t=s.connect(this,"onLayerAddResult",(function(i,r){-1!==o.indexOf(e,i)&&(a--,n.push({layer:i,success:!r,error:r}),a||(s.disconnect(t),this.onLayersAddResult(n)))})),i=0;i<r;i++)this.addLayer(e[i]);return this},removeLayer:function(e,t){var i=e.id,n=e instanceof U?this.graphicsLayerIds:this.layerIds,s=te(n,i);s>=0&&(this._forgetLayer(e),n.splice(s,1),this.loaded||this._firstLayerId!==i||(this._firstLayerId=null),e instanceof U?this._detachGraphicsLayer(e):e.loaded&&(e.getMap()&&e._unsetMap(this,this._layersDiv),-1!==e.declaredClass.indexOf("VETiledLayer")&&this._onBingLayerRemove(e)),delete this._layers[i],delete this._layerDivs[i],t||this._reorderLayers(n),this.onLayerRemove(e))},removeAllLayers:function(){var e,t=this.layerIds;for(e=t.length-1;e>=0;e--)this.removeLayer(this._layers[t[e]],1);for(e=(t=this.graphicsLayerIds).length-1;e>=0;e--)this.removeLayer(this._layers[t[e]],1);this.onLayersRemoved()},reorderLayer:function(e,t){r.isString(e)&&(i.deprecated(this.declaredClass+": Map.reorderLayer(/*String*/ id, /*Number*/ index) deprecated. Use Map.reorderLayer(/*Layer*/ layer, /*Number*/ index).",null,"v2.0"),e=this.getLayer(e));var n,s=e.id,a=e instanceof U?this.graphicsLayerIds:this.layerIds;t<0?t=0:t>=a.length&&(t=a.length-1),-1!==(n=te(a,s))&&n!==t&&(a.splice(n,1),a.splice(t,0,s),this._reorderLayers(a))},getLayer:function(e){return this._layers[e]},setWebGLEnabled:function(e){e=e||!1;var t=this.webglEnabled;this.webglEnabled=e&&_e,t!==this.webglEnabled&&this.onWebGLEnabledChange()},isWebGLContextAvailable:function(){return V.isContextAvailable()&&(-1===this.maxWebGLContexts||this.maxWebGLContexts>0&&this._webglContextOwners.length<this.maxWebGLContexts)},ownsWebGLContext:function(e){return-1!==o.indexOf(this._webglContextOwners,e)},acquireWebGLContext:function(e){return-1!==o.indexOf(this._webglContextOwners,e)||!!this.isWebGLContextAvailable()&&(V.acquireContext(e),this._webglContextOwners.push(e),!0)},releaseWebGLContext:function(e){var t=o.indexOf(this._webglContextOwners,e);-1!==t&&this._webglContextOwners.splice(t,1),V.releaseContext(e)},releaseAllWebGLContexts:function(){var e=this._webglContextOwners.slice(0);o.forEach(e,(function(e){this.releaseWebGLContext(e)}),this)},syncHitTestForWebGL:function(e){var t,i=e.screenPoint,n=this.graphicsLayerIds.slice(0).reverse();return o.some(n,(function(e){var n=this.getLayer(e);if(n.loaded&&!n.suspended&&n.hasWebGLSurface()){var s=n._div.syncHitTest(i.x,i.y);t=s}return!!t}),this),t},setExtent:function(e,t){var i=(e=new T(e.toJson())).getWidth(),n=e.getHeight();return 0===i&&0===n?this.centerAt(new W({x:e.xmin,y:e.ymin,spatialReference:e.spatialReference&&e.spatialReference.toJson()})):this._extentUtil(null,null,e,t)},getTargetExtent:function(e){if(e)return 0!==(e=new T(e.toJson())).getWidth()&&0!==e.getHeight()&&(e=(e=this._convertGeometry(this,e))&&this._fixExtent(e).extent),e},centerAt:function(e){return this._extentUtil(null,{mapCenter:e})},centerAndZoom:function(e,t){return this._extentUtil({targetLevel:t,mapCenter:e,levelOrFactor:!0})},getScale:function(){return this.__LOD?this.__LOD.scale:H.getScale(this)},getResolution:function(){return this.__LOD?this.__LOD.resolution:this.extent?this.extent.getWidth()/this.width:0},getResolutionInMeters:function(){return this.getResolution()*H.getUnitValueForSR(this.spatialReference)},getResolutionForPopup:function(){var e=this.getResolution(),t=this.getResolutionInMeters(),i=t/16;return i<=10?0:e/t*i},getMinResolution:function(){return this._minResolution},getMaxResolution:function(){return this._maxResolution},getMinScale:function(){return this._params.minScale},getMaxScale:function(){return this._params.maxScale},getViewInfo:function(){return this._viewInfo},setScale:function(e){return this._extentUtil({targetScale:e})},getLayersVisibleAtScale:function(e){var t=[];return(e=e||this.getScale())&&o.forEach(this.layerIds.concat(this.graphicsLayerIds),(function(i){(i=this.getLayer(i)).isVisibleAtScale(e)&&t.push(i)}),this),t},getNumLevels:function(){var e=this.getMinZoom(),t=this.getMaxZoom();return e===t&&e<0?0:t-e+1},getLevel:function(){return this.__LOD?this.__LOD.level:-1},setLevel:function(e){if(e>-1)return this._extentUtil({targetLevel:e})},getZoom:function(){return this.getLevel()},setZoom:function(e){return this.setLevel(e)},getMinZoom:function(){return this._params.minZoom},getMaxZoom:function(){return this._params.maxZoom},setBasemap:function(e){var t;if(r.isObject(e)?e=(t=e).title:t=L&&L[e],t){this._basemapDfd&&!this._basemapDfd.isFulfilled()&&this._basemapDfd.cancel();var i=[],n=0;if(o.forEach(t.baseMapLayers||t.layers,(function(t){var s={id:t.id,displayLevels:t.displayLevels,opacity:b.isDefined(t.opacity)?t.opacity:null,visible:b.isDefined(t.visibility)?t.visibility:null},a=this._createBaseLayerInstance(t,s,e);a&&(i.push(a),t.isReference||n++)}),this),!i.length||!n)return void console.log("Map.setBasemap: "+b.substitute({basemapName:e},this.invalidBasemap));this._basemapDfd=A(i).otherwise(K(this,(function(e){throw this._basemapPending=!1,e&&"cancel"===e.dojoType&&o.forEach(i,(function(e){e.cancel()})),e}))).then((function(t){var i=[],n=[];return o.forEach(t,(function(e){e&&(e.layerInfo&&i.push(e.layerInfo),e.layer&&n.push(e.layer))})),{basemapName:e,infos:i,layers:n}})).then(K(this,this._waitForBaseLayers)).then(K(this,this._setBasemap)),this._basemapPending=!this.loaded&&!this._basemapDfd.isFulfilled()}else{var s,a=[];for(s in L)a.push(s);console.log("Map.setBasemap: "+b.substitute({basemapName:e,list:a.join(",")},this.unknownBasemap))}},_createBaseLayerInstance:function(t,i,n){var s,r=new a;if(t.type)switch(t.type){case"OpenStreetMap":r.resolve({layerInfo:t,layer:new N(i)});break;case"VectorTile":e(["./layers/VectorTileLayer"],(function(e){s=C.normalize(t.url),r.promise.isFulfilled()||r.resolve({layerInfo:t,layer:new e(s,i)})}));break;default:return console.log("Map.setBasemap: "+b.substitute({basemapName:n,type:t.type},this.unknownLayerType)),null}else s=C.normalize(t.url),r.resolve({layerInfo:t,layer:new B(s,i)});return r.promise},_waitForBaseLayers:function(e){var t=new a(R._dfdCanceller);if(t.promise.otherwise((function(e){if(e&&"cancel"===e.dojoType){var i;for(i in t._layerEvents){var n=t._layerEvents[i];s.disconnect(n[0]),s.disconnect(n[1])}delete t._layerEvents}})),!this.loaded)return t.resolve(e),t.promise;var i=function(i){t._pendingLayers--;var n=o.indexOf(e.layers,this);if(n>-1){var a=t._layerEvents[n];a&&(s.disconnect(a[0]),s.disconnect(a[1]))}t._pendingLayers<=0&&(delete t._layerEvents,t.isFulfilled()||t.resolve(e))};return t._pendingLayers=0,t._layerEvents={},o.forEach(e.layers,(function(e,i){e&&t._pendingLayers++})),o.forEach(e.layers,(function(e,n){e&&(e.loaded?i():t._layerEvents[n]=[s.connect(e,"onLoad",e,i),s.connect(e,"onError",e,i)])})),t.promise},_setBasemap:function(e){var t,i=e.layers,n=e.infos,s=0,a=!0;this._basemapPending=!1,this.loaded&&(o.forEach(i,(function(e,t){e.loaded&&(n[t].isReference||s++)})),a=s),a&&(this.basemapLayerIds&&((t={basemapName:this._basemap,infos:L&&L[this._basemap]&&L[this._basemap].baseMapLayers}).basemapName||(o.forEach(this.basemapLayerIds,(function(e){if(this.getLayer(e)instanceof N)return t.basemapName="osm",t.infos=L&&L.osm&&L.osm.baseMapLayers,!1}),this),t.basemapName||(t=null))),this._removeBasemap(),this._basemap=e.basemapName,this.basemapLayerIds=this._addBasemapLayers(i,n),this.attr("data-basemap",this.getBasemap()),this.emit("basemap-change",{current:e,previous:t}))},_addBasemapLayers:function(e,t){var i=[],n=[],s=0;return o.forEach(e,(function(e,a){t[a].isReference?i.push(e):(this.addLayer(e,s++),n.push(e.id))}),this),i.length&&o.forEach(i,(function(e){e.attr("data-reference",!0),this.addLayer(e,"top"),n.push(e.id)}),this),n},_removeBasemap:function(){var e,t=this.basemapLayerIds;t&&t.length&&o.forEach(t,(function(t){(e=this.getLayer(t))&&this.removeLayer(e)}),this)},getBasemap:function(){return this._basemap||""},translate:function(e,t){if(e=e||0,t=t||0,!this._txTimer){this._tx=this._ty=0;var i=this.toScreen(this.extent.getCenter());this.__panStart(i.x,i.y)}this._tx+=e,this._ty+=t,this.__pan(this._tx,this._ty),clearTimeout(this._txTimer),this._txTimer=setTimeout(this._endTranslate,150)},_endTranslate:function(){clearTimeout(this._txTimer),this._txTimer=null;var e=this._tx,t=this._ty;this._tx=this._ty=0,this.__panEnd(e,t)},setTimeExtent:function(e){this.timeExtent=e;var t=e?new e.constructor(e.toJson()):null;this.onTimeExtentChange(t)},setTimeSlider:function(e){this.timeSlider&&(Y(this._tsTimeExtentChange_connect),this._tsTimeExtentChange_connect=null,this.timeSlider=null),e&&(this.timeSlider=e,this.setTimeExtent(e.getCurrentTimeExtent()),this._tsTimeExtentChange_connect=Q(e,"onTimeExtentChange",this,"setTimeExtent"))},setVisibility:function(e){if(this.visible!==e){if(this.visible=e,e||(this._display=this.container.style.display),this.container.style.display=e?this._display:"none",this.autoResize){var t=e?"resume":"pause";this._rszSignal[t](),this._oriSignal[t]()}e&&this.resize()}return this},resize:function(e){clearTimeout(this._resizeTimerHandle),this._destroyed||(!0===e?this._execResize():this._resizeTimerHandle=setTimeout(this._execResize,this.resizeDelay))},_timedResize:function(){this._resizeTimerHandle||this._execResize()},_execResize:function(){clearTimeout(this._resizeTimerHandle),this._resizeTimerHandle=null,this.reposition(),this._resize(),this.autoResize&&this._startResizeTimer()},_resize:function(){var e=this.width,t=this.height,i=f.get(this.container,"display"),n=p.getContentBox(this.container);if(!("none"===i||n.w<=0||n.h<=0||e===n.w&&t===n.h)){var s=this._zoomAnim||this._panAnim;s&&(s.stop(),s._fire("onEnd",[s.node])),ee(this.root,{width:(this.width=n.w)+"px",height:(this.height=n.h)+"px"});var a=this.width,r=this.height;this.attribution&&this.attribution.domNode&&f.set(this.attribution.domNode,"maxWidth",Math.floor(a*this._mapParams.attributionWidth)+"px"),this.__visibleRect.update(this.__visibleRect.x,this.__visibleRect.y,a,r),this.__visibleDelta.update(this.__visibleDelta.x,this.__visibleDelta.y,a,r);var o=new O(this.extent),h=new O(o.x,o.y,o.width*(a/e),o.height*(r/t),this.spatialReference).getExtent();this.onResize(h,a,r),this._extentUtil(null,null,h,null,!0)}},reposition:function(){var e=this.position,t=e.x,i=e.y;this._reposition(),t===(e=this.position).x&&i===e.y||this.onReposition(e.x,e.y)},_reposition:function(){var e=p.position(this.container,!0),t=p.getPadBorderExtents(this.container);this.position.update(e.x+t.l,e.y+t.t)},_setClipRect:function(){delete this._clip;var e=g("ie")<=7||void 0===g("ie")&&g("trident")>=7?"rect(auto,auto,auto,auto)":"auto";if(this.wrapAround180){var t=this.width,i=this.height,n=this._getFrameWidth(),s=t-n;if(s>0){var a=s/2;e="rect(0px,"+(a+n)+"px,"+i+"px,"+a+"px)";var r=this.extent.getWidth(),o=r*(n/t);this._clip=[(r-o)/2,o]}}ee(this.__container,"clip",e)},_getAvailExtent:function(){var e=this.extent,t=this._clip;if(t){if(!e._clip){var i=new O(e);i.width=t[1],i.x=i.x+t[0],e._clip=i.getExtent()}return e._clip}return e},_fixedPan:function(e,t){return this._extentUtil(null,{dx:e,dy:t})},panUp:function(){return this._fixedPan(0,-.75*this.height)},panUpperRight:function(){return this._fixedPan(.75*this.width,-.75*this.height)},panRight:function(){return this._fixedPan(.75*this.width,0)},panLowerRight:function(){return this._fixedPan(.75*this.width,.75*this.height)},panDown:function(){return this._fixedPan(0,.75*this.height)},panLowerLeft:function(){return this._fixedPan(-.75*this.width,.75*this.height)},panLeft:function(){return this._fixedPan(-.75*this.width,0)},panUpperLeft:function(){return this._fixedPan(-.75*this.width,-.75*this.height)},enableSnapping:function(t){if("esri.SnappingManager"===(t=t||{}).declaredClass)this.snappingManager=t;else{var i=ne++,n=this;this._rids&&this._rids.push(i),e(["./SnappingManager"],(function(e){var s=n._rids?o.indexOf(n._rids,i):-1;-1!==s&&(n._rids.splice(s,1),n.snappingManager=new e(r.mixin({map:n},t)))}))}return this.snappingManager},disableSnapping:function(){this.snappingManager&&this.snappingManager.destroy(),this.snappingManager=null},_createLabelLayer:function(){!this._labels&&J&&this.loaded&&(this._labels=new J({id:"_internal_LabelLayer"}),this._labels._setMap(this,this._gc._surface),this._processLabelLayers(),this.on("layers-reordered",this._processLabelLayers))},_processLabelLayers:function(){null==this._labelProcessor&&(this._labelProcessor=setTimeout(this._updateLabelLayers,0))},_updateLabelLayers:function(){this._labelProcessor=null,this._labels&&(this._labels.removeAllFeatureLayers(),o.forEach(this.graphicsLayerIds,(function(e){var t=this.getLayer(e);"function"==typeof t.applyEdits?this._labels.addFeatureLayer(t):"esri.layers.WFSLayer"===t.declaredClass&&this._labels.addFeatureLayer(t)}),this))},_getMapImageLyr:function(){return this.loaded&&!this._mapImageLyr&&(this._mapImageLyr=new Z,this._mapImageLyr._setMap(this,this._layersDiv),this._placeMapImageLyr()),this._mapImageLyr},_placeMapImageLyr:function(){for(var e,t,i=this.layerIds,n=this._layerDivs,s=!1,a=i.length-1;a>=0;a--){var r=i[a];if(t=this.getLayer(r),e=n[r],t&&e&&!t._isReference){u.place(this._mapImageLyr._div,e,"after"),s=!0;break}}s||u.place(this._mapImageLyr._div,this._layersDiv,"first")}});return g("extend-esri")&&(x._CoreMap=ue),ue}));