text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See http://js.arcgis.com/3.25/esri/copyright.txt for details.
  //>>built
  require({cache:{"esri/layers/labelLayerUtils/DynamicLabelClass":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../../kernel ../../geometry/Extent ../../geometry/Polygon".split(" "),function(C,G,B,H,D,E){C=C(null,{declaredClass:"esri.layers.labelLayerUtils.DynamicLabelClass",constructor:function(){this._preparedLabels=[];this._placedLabels=[];this._extent=null;this._y1=this._x1=this._y0=this._x0=this._ymax=this._ymin=this._xmax=this._xmin=0;this._scale=1},setMap:function(l,b){this._labelLayer=
  b;this._xmin=l.extent.xmin;this._xmax=l.extent.xmax;this._ymin=l.extent.ymin;this._ymax=l.extent.ymax;this._scale=(this._xmax-this._xmin)/l.width},_process:function(l){this._preparedLabels=l;this._placedLabels=[];var b;for(l=this._preparedLabels.length-1;0<=l;l--){var a=this._preparedLabels[l],c=Math.min(a.labelWidth,a.labelHeight),g=a.labelWidth+0*c,c=a.labelHeight+0*c,d=(b=a.options)&&void 0!==b.lineLabelPlacement?b.lineLabelPlacement:"PlaceAtCenter",e=b&&void 0!==b.lineLabelPosition?b.lineLabelPosition:
  "Above",f=b&&void 0!==b.pointPriorities?b.pointPriorities:"AboveRight",k=[2,2,1,3,0,2,3,3,2];"AboveLeft"==f?k=[1,2,2,2,0,3,2,3,3]:"AboveCenter"==f?k=[2,1,2,2,0,2,3,3,3]:"AboveRight"==f?k=[2,2,1,3,0,2,3,3,2]:"CenterLeft"==f?k=[2,2,3,1,0,3,2,2,3]:"CenterCenter"==f?k=[0,0,0,0,1,0,0,0,0]:"CenterRight"==f?k=[3,2,2,3,0,1,3,2,2]:"BelowLeft"==f?k=[2,3,3,2,0,3,1,2,2]:"BelowCenter"==f?k=[3,3,3,2,0,2,2,1,2]:"BelowRight"==f&&(k=[3,3,2,3,0,2,2,2,1]);var h=b&&void 0!==b.labelRotation?b.labelRotation:!0,f=Math.PI/
  180*a.angle;b=b&&void 0!==b.howManyLabels?b.howManyLabels:"OneLabel";if("point"==a.geometry.type)this._generatePointPositions(a,a.geometry.x,a.geometry.y,a.text,f,g,c,a.symbolWidth,a.symbolHeight,k);else if("multipoint"==a.geometry.type)for(d=a.geometry,e=0;e<d.points.length;e++)this._generatePointPositions(a,d.points[e][0],d.points[e][1],a.text,f,g,c,a.symbolWidth,a.symbolHeight,k);else"polyline"==a.geometry.type?this._generateLinePositions(a,a.geometry,a.text,g,c,2*a.symbolHeight+c,d,e,h):"polygon"==
  a.geometry.type&&this._generatePolygonPositions(a,b,a.geometry,a.text,f,g,c)}return this._placedLabels},_generatePointPositions:function(l,b,a,c,g,d,e,f,k,h){f=(f+d)*this._scale;k=(k+e)*this._scale;var n,p;for(n=1;3>=n;n++)for(p=1;9>=p;p++)if(h[p-1]==n)switch(p){case 1:if(this._findPlace(l,c,b-f,a+k,g,d,e))return;break;case 2:if(this._findPlace(l,c,b,a+k,g,d,e))return;break;case 3:if(this._findPlace(l,c,b+f,a+k,g,d,e))return;break;case 4:if(this._findPlace(l,c,b-f,a,g,d,e))return;break;case 5:if(this._findPlace(l,
  c,b,a,g,d,e))return;break;case 6:if(this._findPlace(l,c,b+f,a,g,d,e))return;break;case 7:if(this._findPlace(l,c,b-f,a-k,g,d,e))return;break;case 8:if(this._findPlace(l,c,b,a-k,g,d,e))return;break;case 9:if(this._findPlace(l,c,b+f,a-k,g,d,e))return}},_generateLinePositions:function(l,b,a,c,g,d,e,f,k){var h=c*this._scale*c*this._scale,n,p,m;for(n=0;n<b.paths.length;n++){var y=b.paths[n],r=y.length,q=Math.floor((r-1)/2),w=0!==(r-1)%2?1:-1;"PlaceAtStart"==e&&(q=0,w=1);"PlaceAtEnd"==e&&(q=r-2,w=-1);for(;0<=
  q&&q<r-1;){for(p=q;p<r;p++){var u=y[q][0],t=y[q][1],z=y[p][0]-u,x=y[p][1]-t;if(z*z+x*x>h){for(var v=Math.atan2(x,z);v>Math.PI/2;)v-=Math.PI;for(;v<-(Math.PI/2);)v+=Math.PI;var A=Math.sin(v),F=Math.cos(v),I=0,J=0;"Above"==f&&(I=d*A*this._scale,J=d*F*this._scale);"Below"==f&&(I=-d*A*this._scale,J=-d*F*this._scale);if(1==p-q){if(this._clipLine(u,t,y[p][0],y[p][1])&&(u=this._x1-this._x0,m=this._y1-this._y0,u*u+m*m>h&&(p=Math.atan2(m,u),z=c/2+2*g,t=z*this._scale*Math.cos(p),z=z*this._scale*Math.sin(p),
  "PlaceAtStart"==e?(u=this._x0+t,m=this._y0+z):"PlaceAtEnd"==e?(u=this._x1-t,m=this._y1-z):(u=this._x0+u/2,m=this._y0+m/2),this._findPlace(l,a,u-I,m+J,k?-p:0,c,g))))return}else{var K=0;for(m=q;m<=p;m++)K=Math.max(K,Math.abs((y[m][1]-t)*F-(y[m][0]-u)*A));if(K<g&&this._findPlace(l,a,u+z/2-I,t+x/2+J,k?-v:0,c,g))return}break}}q+=w}}},_generatePolygonPositions:function(l,b,a,c,g,d,e){var f;if("ManyLabels"==b)for(b=0;b<a.rings.length;b++)f=a.rings[b],E.prototype.isClockwise(f)&&(f=this._findCentroid(f,this._xmin,
  this._ymin,this._xmax,this._ymax),this._findPlace(l,c,f[0],f[1],g,d,e));else{f=this._findCentroidForFeature(a,this._xmin,this._ymin,this._xmax,this._ymax);var k=f[1],h=0;for(b=0;10>b;b++){h+=e/4;f=this._findCentroidForFeature(a,this._xmin,k+(h-e/4),this._xmax,k+(h+e/4));if(this._findPlace(l,c,f[0],f[1],g,d,e))break;f=this._findCentroidForFeature(a,this._xmin,k-(h+e/4),this._xmax,k-(h-e/4));if(this._findPlace(l,c,f[0],f[1],g,d,e))break}}},_findCentroid:function(l,b,a,c,g){var d=l.length,e=[0,0],f=
  0,k=l[0][0],h=l[0][1];k>c&&(k=c);k<b&&(k=b);h>g&&(h=g);h<a&&(h=a);for(var n=1;n<d-1;n++){var p=l[n][0],m=l[n][1],y=l[n+1][0],r=l[n+1][1];p>c&&(p=c);p<b&&(p=b);m>g&&(m=g);m<a&&(m=a);y>c&&(y=c);y<b&&(y=b);r>g&&(r=g);r<a&&(r=a);var q=(p-k)*(r-h)-(y-k)*(m-h);e[0]+=q*(k+p+y);e[1]+=q*(h+m+r);f+=q}e[0]/=3*f;e[1]/=3*f;if(isNaN(e[0])||isNaN(e[1]))return e;a=[];this._fillBuffer(l,a,e);e[0]=this._sortBuffer(a,e[0],b,c);return e},_findCentroidForFeature:function(l,b,a,c,g){for(var d,e=0,f=[0,0],k=0;k<l.rings.length;k++){var h=
  l.rings[k],n=h.length,p=h[0][0],m=h[0][1];p>c&&(p=c);p<b&&(p=b);m>g&&(m=g);m<a&&(m=a);for(d=1;d<n-1;d++){var y=h[d][0],r=h[d][1],q=h[d+1][0],w=h[d+1][1];y>c&&(y=c);y<b&&(y=b);r>g&&(r=g);r<a&&(r=a);q>c&&(q=c);q<b&&(q=b);w>g&&(w=g);w<a&&(w=a);var u=(y-p)*(w-m)-(q-p)*(r-m);f[0]+=u*(p+y+q);f[1]+=u*(m+r+w);e+=u}}f[0]/=3*e;f[1]/=3*e;if(isNaN(f[0])||isNaN(f[1]))return f;a=[];for(d=0;d<l.rings.length;d++)this._fillBuffer(l.rings[d],a,f);f[0]=this._sortBuffer(a,f[0],b,c);return f},_fillBuffer:function(l,b,
  a){for(var c=l.length-1,g=l[0][1]>=l[c][1]?1:-1,d=0;d<=c;d++){var e=d,f=d+1;d==c&&(f=0);var k=l[e][0],e=l[e][1],h=l[f][0],f=l[f][1],n=f>=e?1:-1;if(e<=a[1]&&a[1]<=f||f<=a[1]&&a[1]<=e)a[1]!=e&&a[1]!=f?(b.push((a[1]-e)*(h-k)/(f-e)+k),g=n):a[1]==e&&a[1]!=f?(g!=n&&b.push(k),g=n):a[1]!=e&&a[1]==f?(b.push(h),g=n):a[1]==e&&a[1]==f&&(1==g&&b.push(k),b.push(h),g=n)}},_sortBuffer:function(l,b,a,c){var g=l.length;l.sort();if(0<g){for(var d=0,e=b=0;e<g-1;e+=2){var f=Math.abs(l[e+1]-l[e]);!(l[e]<=a&&l[e+1]<=a||
  l[e]>=c&&l[e+1]>=c)&&f>d&&(d=f,b=e)}g=l[b];l=l[b+1];g>c&&(g=c);g<a&&(g=a);l>c&&(l=c);l<a&&(l=a);b=(g+l)/2}return b},_findPlace:function(l,b,a,c,g,d,e){if(isNaN(a)||isNaN(c))return!1;for(var f=0;f<this._placedLabels.length;f++){var k=this._placedLabels[f].angle,h=this._placedLabels[f].width*this._scale,n=this._placedLabels[f].height*this._scale,p=this._placedLabels[f].x-a,m=this._placedLabels[f].y-c;if(0===g&&0===k){if(this._findPlace2(-d*this._scale,-e*this._scale,d*this._scale,e*this._scale,p-h,
  m-n,p+h,m+n))return!1}else{var y=new D(-d*this._scale,-e*this._scale,d*this._scale,e*this._scale,null),r=0,q=1;0!==g&&(r=Math.sin(g),q=Math.cos(g));var w=p*q-m*r,p=p*r+m*q,k=k-g,r=Math.sin(k),q=Math.cos(k),u=-h*q- -n*r,m=-h*r+-n*q,k=+h*q- -n*r,t=+h*r+-n*q,h=w+u,n=p-m,r=w+k,q=p-t,u=w-u,m=p+m,w=w-k,p=p+t,k=new E;k.addRing([[h,n],[r,q],[u,m],[w,p],[h,n]]);if(y.intersects(k))return!1}}for(;g>Math.PI/2;)g-=Math.PI;for(;g<-(Math.PI/2);)g+=Math.PI;f={};f.layer=l;f.text=b;f.angle=g;f.x=a;f.y=c;f.width=d;
  f.height=e;this._placedLabels.push(f);return!0},_findPlace2:function(l,b,a,c,g,d,e,f){return(l>=g&&l<=e||a>=g&&a<=e||l<=g&&a>=e)&&(b>=d&&b<=f||c>=d&&c<=f||b<=d&&c>=f)?!0:!1},_clipLine:function(l,b,a,c){for(var g=this._code(l,b),d=this._code(a,c);0!==g||0!==d;){if(0!==(g&d))return!1;var e=a-l,f=c-b;0!==g?(l<this._xmin?(b+=f*(this._xmin-l)/e,l=this._xmin):l>this._xmax?(b+=f*(this._xmax-l)/e,l=this._xmax):b<this._ymin?(l+=e*(this._ymin-b)/f,b=this._ymin):b>this._ymax&&(l+=e*(this._ymax-b)/f,b=this._ymax),
  g=this._code(l,b)):(a<this._xmin?(c+=f*(this._xmin-a)/e,a=this._xmin):a>this._xmax?(c+=f*(this._xmax-a)/e,a=this._xmax):c<this._ymin?(a+=e*(this._ymin-c)/f,c=this._ymin):c>this._ymax&&(a+=e*(this._ymax-c)/f,c=this._ymax),d=this._code(a,c))}this._x0=l;this._y0=b;this._x1=a;this._y1=c;return!0},_code:function(l,b){var a=0;l<this._xmin&&(a+=8);l>this._xmax&&(a+=4);b<this._ymin&&(a+=2);b>this._ymax&&(a+=1);return a}});B("extend-esri")&&G.setObject("layers.labelLayerUtils.DynamicLabelClass",C,H);return C})},
  "esri/layers/labelLayerUtils/StaticLabelClass":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../../kernel ../../geometry/Extent ../../geometry/Point ../../geometry/Polygon".split(" "),function(C,G,B,H,D,E,l){return C(null,{declaredClass:"esri.layers.labelLayerUtils.StaticLabel",constructor:function(){this._preparedLabels=[];this._placedLabels=[];this._extent=null;this._ymax=this._ymin=this._xmax=this._xmin=0;this._scale=1;this._LINE_STEP_CONST=1.5;this._POLYGON_X_STEP_CONST=1;this._POLYGON_Y_STEP_CONST=
  .75;this._OVERRUN=2},setMap:function(b,a){this._labelLayer=a;this._map=b;this._xmin=b.extent.xmin;this._xmax=b.extent.xmax;this._ymin=b.extent.ymin;this._ymax=b.extent.ymax;this._scale=(this._xmax-this._xmin)/b.width},_process:function(b){var a,c,g,d,e,f,k,h,n;this._preparedLabels=b;this._placedLabels=[];for(b=this._preparedLabels.length-1;0<=b;b--){a=this._preparedLabels[b];e=a.labelWidth;f=a.labelHeight;h=(k=a.options)&&k.lineLabelPlacement?k.lineLabelPlacement:"PlaceAtCenter";n=k&&k.lineLabelPosition?
  k.lineLabelPosition:"Above";c=k&&k.labelRotation?k.labelRotation:!0;g=Math.PI/180*a.angle;d=k&&k.howManyLabels?k.howManyLabels:"OneLabel";var p=[];if("point"===a.geometry.type)this._generatePointPositions(a.geometry.x,a.geometry.y,a.text,g,e,f,a.symbolWidth,a.symbolHeight,k,p);else if("multipoint"===a.geometry.type)for(c=0;c<a.geometry.points.length;c++)this._generatePointPositions(a.geometry.points[c][0],a.geometry.points[c][1],a.text,g,e,f,a.symbolWidth,a.symbolHeight,k,p);else if("polyline"===
  a.geometry.type)if("PlaceAtStart"===h)this._generateLinePositionsPlaceAtStart(a.geometry,!0,a.text,e,f,2*a.symbolHeight+f,h,n,c,p);else if("PlaceAtEnd"===h)this._generateLinePositionsPlaceAtEnd(a.geometry,!0,a.text,e,f,2*a.symbolHeight+f,h,n,c,p);else{k=[];var m=a.geometry.getExtent(),y=this._map.extent;if(m.getWidth()<e*this._scale/this._OVERRUN&&m.getHeight()<e*this._scale/this._OVERRUN)continue;else.5*m.getWidth()<y.getWidth()&&.5*m.getHeight()<y.getHeight()?this._generateLinePositionsPlaceAtCenter(a.geometry,
  !1,.1*Math.min(this._map.width,this._map.height)*this._scale,a.text,e,f,2*a.symbolHeight+f,h,n,c,k):this._generateLinePositionsPlaceAtCenter(a.geometry,!0,.2*Math.min(this._map.width,this._map.height)*this._scale,a.text,e,f,2*a.symbolHeight+f,h,n,c,k);this._postSorting(y,k,p)}else if("polygon"===a.geometry.type){h=[];for(c=0;c<a.geometry.rings.length;c++)n=a.geometry.rings[c],1<a.geometry.rings.length&&!l.prototype.isClockwise(n)||(k=this._calcRingExtent(n),k.xmax-k.xmin<4*e*this._scale/this._OVERRUN&&
  k.ymax-k.ymin<4*f*this._scale/this._OVERRUN||h.push(n));h.sort(function(a,b){return b.length-a.length});for(c=0;c<h.length;c++)this._generatePolygonPositionsForManyLabels(h[c],a.geometry.spatialReference,a.text,g,e,f,p)}for(c=0;c<p.length&&(h=p[c].x,n=p[c].y,void 0!==p[c].angle&&(g=p[c].angle),k=this._findPlace(a,a.text,h,n,g,e,f),"OneLabel"!==d||!k||!this._labelLayer._isWithinScreenArea(new E(h,n,a.geometry.spatialReference)));c++);}return this._placedLabels},_generatePointPositions:function(b,a,
  c,g,d,e,f,k,h,n){c=h&&h.pointPriorities?h.pointPriorities:"AboveRight";d=(f+d)*this._scale;e=(k+e)*this._scale;switch(c.toLowerCase()){case "aboveleft":b-=d;a+=e;break;case "abovecenter":a+=e;break;case "aboveright":b+=d;a+=e;break;case "centerleft":b-=d;break;case "centercenter":break;case "centerright":b+=d;break;case "belowleft":b-=d;a-=e;break;case "belowcenter":a-=e;break;case "belowright":b+=d;a-=e;break;default:return}n.push({x:b,y:a})},_generateLinePositionsPlaceAtStart:function(b,a,c,g,d,
  e,f,k,h,n){f=g*this._scale;var p=this._LINE_STEP_CONST*Math.min(this._map.width,this._map.height)*this._scale,m,l,r,q,w,u,t,z;for(m=0;m<b.paths.length;m++){var x=b.paths[m],v=f,A=0;for(l=0;l<x.length-1;l++)r=x[l][0],q=x[l][1],w=x[l+1][0],u=x[l+1][1],t=w-r,z=u-q,t=Math.sqrt(t*t+z*z),A+t>v?(A=this._generatePositionsOnLine(b.spatialReference,a,v,p,A,r,q,w,u,c,g,d,e,k,h,n),v=p):A+=t}},_generateLinePositionsPlaceAtEnd:function(b,a,c,g,d,e,f,k,h,l){f=g*this._scale;var p=this._LINE_STEP_CONST*Math.min(this._map.width,
  this._map.height)*this._scale,m,n,r,q,w,u,t,z;for(m=0;m<b.paths.length;m++){var x=b.paths[m],v=f,A=0;for(n=x.length-2;0<=n;n--)r=x[n+1][0],q=x[n+1][1],w=x[n][0],u=x[n][1],t=w-r,z=u-q,t=Math.sqrt(t*t+z*z),A+t>v?(A=this._generatePositionsOnLine(b.spatialReference,a,v,p,A,r,q,w,u,c,g,d,e,k,h,l),v=p):A+=t}},_generateLinePositionsPlaceAtCenter:function(b,a,c,g,d,e,f,k,h,l,p){var m,n,r,q,w,u,t,z;for(k=0;k<b.paths.length;k++){var x=b.paths[k];if(!(2>x.length)){if(2==x.length){q=x[0];m=x[1];r=q[0];q=q[1];
  x=m[0];u=m[1];w=(x-r)*(x-r)+(u-q)*(u-q);t=Math.atan2(u-q,x-r);u=Math.cos(t);t=Math.sin(t);x=[];z=r;for(var v=q;(z-r)*(z-r)+(v-q)*(v-q)<w;)x.push([z,v]),z+=c/2*u,v+=c/2*t;x.push(m)}var A=0;for(m=0;m<x.length-1;m++)r=x[m][0],q=x[m][1],w=x[m+1][0],u=x[m+1][1],t=w-r,z=u-q,A+=Math.sqrt(t*t+z*z);for(m=v=0;m<x.length-1;m++){r=x[m][0];q=x[m][1];w=x[m+1][0];u=x[m+1][1];t=w-r;z=u-q;t=Math.sqrt(t*t+z*z);if(v+t>A/2)break;v+=t}m==x.length-1&&m--;r=x[m][0];q=x[m][1];w=x[m+1][0];u=x[m+1][1];t=w-r;z=u-q;v=A/2-v;
  t=Math.atan2(z,t);z=r+v*Math.cos(t);t=q+v*Math.sin(t);r=this._angleAndShifts(r,q,w,u,f,h,l);p.push({x:z+r.shiftX,y:t+r.shiftY,angle:r.angle});var A=z,F=t,v=0;for(n=m;n<x.length-1;n++)n==m?(r=A,q=F):(r=x[n][0],q=x[n][1]),w=x[n+1][0],u=x[n+1][1],t=w-r,z=u-q,t=Math.sqrt(t*t+z*z),v=v+t>c?this._generatePositionsOnLine(b.spatialReference,a,c,c,v,r,q,w,u,g,d,e,f,h,l,p):v+t;v=0;for(n=m;0<=n;n--)n==m?(r=A,q=F):(r=x[n+1][0],q=x[n+1][1]),w=x[n][0],u=x[n][1],t=w-r,z=u-q,t=Math.sqrt(t*t+z*z),v=v+t>c?this._generatePositionsOnLine(b.spatialReference,
  a,c,c,v,r,q,w,u,g,d,e,f,h,l,p):v+t}}},_generatePositionsOnLine:function(b,a,c,g,d,e,f,k,h,n,p,m,l,r,q,w){n=Math.atan2(h-f,k-e);p=e;m=f;var u=p,t=m;do if(d=c-d,p+=d*Math.cos(n),m+=d*Math.sin(n),this._belongs(p,m,e,f,k,h))d=this._angleAndShifts(e,f,k,h,l,r,q),c=p+d.shiftX,t=m+d.shiftY,a?this._labelLayer._isWithinScreenArea(new D(c,t,c,t,b))&&w.push({x:c,y:t,angle:d.angle}):w.push({x:c,y:t,angle:d.angle}),u=p,t=m,d=0,c=g;else return b=k-u,h-=t,Math.sqrt(b*b+h*h);while(1)},_postSorting:function(b,a,c){if(b&&
  0<a.length){var g=.5*(b.xmin+b.xmax);b=.5*(b.ymin+b.ymax);for(var d=a[0].x,e=a[0].y,f=Math.sqrt((d-g)*(d-g)+(e-b)*(e-b)),k=a[0].angle,h=0;h<a.length;h++){var n=a[h].x,p=a[h].y,m=Math.sqrt((n-g)*(n-g)+(p-b)*(p-b));m<f&&(d=n,e=p,f=m,k=a[h].angle)}c.push({x:d,y:e,angle:k})}},_belongs:function(b,a,c,g,d,e){if(d==c&&e==g)return!1;if(d>c){if(b>d||b<c)return!1}else if(b<d||b>c)return!1;if(e>g){if(a>e||a<g)return!1}else if(a<e||a>g)return!1;return!0},_angleAndShifts:function(b,a,c,g,d,e,f){for(b=Math.atan2(g-
  a,c-b);b>Math.PI/2;)b-=Math.PI;for(;b<-(Math.PI/2);)b+=Math.PI;g=Math.sin(b);var k=Math.cos(b);c=a=0;"Above"==e&&(a=d*g*this._scale,c=d*k*this._scale);"Below"==e&&(a=-d*g*this._scale,c=-d*k*this._scale);d=[];d.angle=f?-b:0;d.shiftX=-a;d.shiftY=c;return d},_generatePolygonPositionsForManyLabels:function(b,a,c,g,d,e,f){d=this._findCentroidForRing(b);g=d[0];var k=d[1],h=this._calcRingExtent(b);d=h.xmin;e=h.ymin;var n=h.xmax,h=h.ymax,p=(h-e)/(this._map.height*this._scale);if(!(10<(n-d)/(this._map.width*
  this._scale)&&10<p)){var m=!0;if(n-d>this._map.width*this._scale||h-e>this._map.height*this._scale)m=!1;var p=this._map.width*this._scale*(m?.1875:.5),m=this._map.height*this._scale*(m?.1875:.5),l=!0,r=!0,q=0;do{k+=(q%2?-1:1)*q*m;if(this._scanRingByX(c,a,b,g,k,d,n,p,f))break;k<e&&(l=!1);k>h&&(r=!1);q++}while(l||r)}},_scanRingByX:function(b,a,c,g,d,e,f,k,h){var n=!0,l=!0,m=0,y=1E3;do{g+=(m%2?-1:1)*m*k;var r=this._movePointInsideRing(c,g,d),q=this._labelLayer._isWithinScreenArea(new D(r,d,r,d,a)),w=
  this._isPointWithinRing(b,c,r,d);if(q&&w)return h.push({x:r,y:d}),!0;g<e&&(n=!1);g>f&&(l=!1);m++;y--;if(0>=y)return!0}while(n||l);return!1},_movePointInsideRing:function(b,a,c){for(var g=[],d=b.length-1,e=b[0][1]>=b[d][1]?1:-1,f=0;f<=d;f++){var k=f,h=f+1;f==d&&(h=0);var l=b[k][0],k=b[k][1],p=b[h][0],h=b[h][1],m=h>=k?1:-1;if(k<=c&&c<=h||h<=c&&c<=k)c!=k&&c!=h?(g.push((c-k)*(p-l)/(h-k)+l),e=m):c==k&&c!=h?(e!=m&&g.push(l),e=m):c!=k&&c==h?(g.push(p),e=m):c==k&&c==h&&(1==e&&g.push(l),g.push(p),e=m)}g.sort(function(a,
  b){return a-b});b=g.length;if(0<b){for(f=c=a=0;f<b-1;f+=2)d=Math.abs(g[f+1]-g[f]),d>a&&(a=d,c=f);a=(g[c]+g[c+1])/2}return a},_calcRingExtent:function(b){var a,c;c=new D;for(a=0;a<b.length-1;a++){var g=b[a][0],d=b[a][1];if(void 0===c.xmin||g<c.xmin)c.xmin=g;if(void 0===c.ymin||d<c.ymin)c.ymin=d;if(void 0===c.xmax||g>c.xmax)c.xmax=g;if(void 0===c.ymax||d>c.ymax)c.ymax=d}return c},_isPointWithinPolygon:function(b,a,c,g){var d;for(d=0;d<a.rings.length;d++)if(this._isPointWithinRing(b,a.rings[d],c,g))return!0;
  return!1},_isPointWithinRing:function(b,a,c,g){var d,e,f,k,h=[],l=a.length;for(b=0;b<l-1;b++)if(d=a[b][0],e=a[b][1],f=a[b+1][0],k=a[b+1][1],d!=f||e!=k){if(e==k)if(g==e)h.push(d);else continue;d==f?(e<k&&g>=e&&g<k&&h.push(d),e>k&&g<=e&&g>k&&h.push(d)):(e=(f-d)/(k-e)*(g-e)+d,d<f&&e>=d&&e<f&&h.push(e),d>f&&e<=d&&e>f&&h.push(e))}h.sort(function(a,b){return a-b});for(b=0;b<h.length-1;b++)if(d=h[b],f=h[b+1],c>=d&&c<f)if(b%2)break;else return!0;return!1},_findCentroidForRing:function(b){for(var a=b.length,
  c=[0,0],g=0,d=b[0][0],e=b[0][1],f=1;f<a-1;f++){var k=b[f][0],h=b[f][1],l=b[f+1][0],p=b[f+1][1],m=(k-d)*(p-e)-(l-d)*(h-e);c[0]+=m*(d+k+l);c[1]+=m*(e+h+p);g+=m}c[0]/=3*g;c[1]/=3*g;return c},_findCentroidForFeature:function(b){for(var a=0,c=[0,0],g=0;g<b.rings.length;g++)for(var d=b.rings[g],e=d.length,f=d[0][0],k=d[0][1],h=1;h<e-1;h++){var l=d[h][0],p=d[h][1],m=d[h+1][0],y=d[h+1][1],r=(l-f)*(y-k)-(m-f)*(p-k);c[0]+=r*(f+l+m);c[1]+=r*(k+p+y);a+=r}c[0]/=3*a;c[1]/=3*a;return c},_findPlace:function(b,a,
  c,g,d,e,f){if(isNaN(c)||isNaN(g))return!1;for(var k=0;k<this._placedLabels.length;k++){var h=this._placedLabels[k].angle,n=this._placedLabels[k].width*this._scale,p=this._placedLabels[k].height*this._scale,m=this._placedLabels[k].x-c,y=this._placedLabels[k].y-g;if(0===d&&0===h){if(this._findPlace2(-e*this._scale,-f*this._scale,e*this._scale,f*this._scale,m-n,y-p,m+n,y+p))return!1}else{var r=new D(-e*this._scale,-f*this._scale,e*this._scale,f*this._scale,null),q=0,w=1;0!==d&&(q=Math.sin(d),w=Math.cos(d));
  var u=m*w-y*q,m=m*q+y*w,h=h-d,q=Math.sin(h),w=Math.cos(h),t=-n*w- -p*q,y=-n*q+-p*w,h=+n*w- -p*q,z=+n*q+-p*w,n=u+t,p=m-y,q=u+h,w=m-z,t=u-t,y=m+y,u=u-h,m=m+z,h=new l;h.addRing([[n,p],[q,w],[t,y],[u,m],[n,p]]);if(r.intersects(h))return!1}}for(;d>Math.PI/2;)d-=Math.PI;for(;d<-(Math.PI/2);)d+=Math.PI;k={};k.layer=b;k.text=a;k.angle=d;k.x=c;k.y=g;k.width=e;k.height=f;this._placedLabels.push(k);return!0},_findPlace2:function(b,a,c,g,d,e,f,k){return(b>=d&&b<=f||c>=d&&c<=f||b<=d&&c>=f)&&(a>=e&&a<=k||g>=e&&
  g<=k||a<=e&&g>=k)?!0:!1}})})},"*noref":1}});
  define("esri/layers/LabelLayer","require dojo/_base/declare dojo/_base/lang dojo/number dojo/i18n!dojo/cldr/nls/number dojo/_base/array dojo/_base/connect dojo/has dojox/gfx/_base ../kernel ../lang ../graphic ../PopupInfo ../core/timerUtils ./labelLayerUtils/DynamicLabelClass ./labelLayerUtils/StaticLabelClass ./support/attributeUtils ../symbols/TextSymbol ../symbols/ShieldLabelSymbol ../geometry/Extent ../geometry/Point ../geometry/webMercatorUtils ./GraphicsLayer ./LabelClass ../renderers/SimpleRenderer ../support/expressionUtils".split(" "),function(C,
  G,B,H,D,E,l,b,a,c,g,d,e,f,k,h,n,p,m,y,r,q,w,u,t,z){function x(a){return"sizeInfo"===a.type}C=G(w,{declaredClass:"esri.layers.LabelLayer",constructor:function(a){this._refreshLabels=B.hitch(this,this._refreshLabels);this.id="labels";this.featureLayers=[];this._featureLayerInfos=[];this._preparedLabels=[];this._engineType="STATIC";this._mapEventHandlers=[];a&&(a.id&&(this.id=a.id),a.mode&&(this._engineType="DYNAMIC"===a.mode.toUpperCase()?"DYNAMIC":"STATIC"))},_setMap:function(a){this._mapEventHandlers.push(a.on("extent-change",
  B.hitch(this,"_handleLevelChange")));var b=this.inherited(arguments);this.refresh();return b},_unsetMap:function(){var a;for(a=0;a<this._mapEventHandlers.length;a++)l.disconnect(this._mapEventHandlers[a]);this.refresh();f.clearTimeout(this._refreshHandle);this._refreshHandle=null;this.inherited(arguments)},setAlgorithmType:function(a){this._engineType=a&&"DYNAMIC"===a.toUpperCase()?"DYNAMIC":"STATIC";this.refresh()},addFeatureLayer:function(a,b,c,f){if(!this.getFeatureLayer(a.layerId)){var e=[];e.push(a.on("update-end",
  B.hitch(this,"refresh")));e.push(a.on("suspend",B.hitch(this,"refresh")));e.push(a.on("resume",B.hitch(this,"refresh")));e.push(a.on("edits-complete",B.hitch(this,"refresh")));e.push(a.on("labeling-info-change",B.hitch(this,"refresh")));e.push(a.on("time-extent-change",B.hitch(this,"refresh")));e.push(a.on("show-labels-change",B.hitch(this,"refresh")));e.push(a.on("feature-reduction-change",B.hitch(this,"refresh")));this._featureLayerInfos.push({FeatureLayer:a,LabelExpressionInfo:c,LabelingOptions:f,
  LabelRenderer:b,EventHandlers:e});this.featureLayers.push(a);this.refresh()}},getFeatureLayer:function(a){var b,c;for(b=0;b<this.featureLayers.length;b++)if(c=this.featureLayers[b],void 0!==c&&c.id==a)return c;return null},removeFeatureLayer:function(a){var b;a=this.getFeatureLayer(a);if(void 0!==a&&(b=E.indexOf(this.featureLayers,a),-1<b)){this.featureLayers.splice(b,1);for(a=0;a<this._featureLayerInfos[b].EventHandlers.length;a++)l.disconnect(this._featureLayerInfos[b].EventHandlers[a]);this._featureLayerInfos.splice(b,
  1);this.refresh()}},removeAllFeatureLayers:function(){var a;for(a=0;a<this.featureLayers.length;a++){for(var b=0;b<this._featureLayerInfos[a].EventHandlers.length;b++)l.disconnect(this._featureLayerInfos[a].EventHandlers[b]);this.featureLayers=[];this._featureLayerInfos=[]}this.refresh()},getFeatureLayers:function(){return this.featureLayers},getFeatureLayerInfo:function(a){var b,c;for(b=0;b<this.featureLayers.length;b++)if(c=this.featureLayers[b],void 0!==c&&c.id==a)return this._featureLayerInfos[b];
  return null},refresh:function(){null==this._refreshHandle&&(this._refreshHandle=f.setTimeout(this._refreshLabels,f.priority.LOW))},_handleLevelChange:function(a){a.levelChange&&this.clear();this.refresh()},_refreshLabels:function(a){this._refreshHandle=null;var b,c,e,f,d,g=[],v,m="DYNAMIC"===this._engineType?new k:new h;if(this._map){m.setMap(this._map,this);this._preparedLabels=[];for(a=0;a<this.featureLayers.length;a++)if(c=this.featureLayers[a],c.visible&&c.showLabels&&c.visibleAtMapScale&&!c._suspended)if(b=
  this._featureLayerInfos[a],d=this._convertOptions(null),b.LabelRenderer){if(g=c.labelingInfo)if(v=g[0])f=this._getLabelExpression(v),d=this._convertOptions(v);e=b.LabelRenderer;b.LabelExpressionInfo&&(f=b.LabelExpressionInfo);b.LabelingOptions&&(d=this._convertOptions(null),void 0!==b.LabelingOptions.pointPriorities&&(g=b.LabelingOptions.pointPriorities,d.pointPriorities="above-center"==g||"AboveCenter"==g||"esriServerPointLabelPlacementAboveCenter"==g?"AboveCenter":"above-left"==g||"AboveLeft"==
  g||"esriServerPointLabelPlacementAboveLeft"==g?"AboveLeft":"above-right"==g||"AboveRight"==g||"esriServerPointLabelPlacementAboveRight"==g?"AboveRight":"below-center"==g||"BelowCenter"==g||"esriServerPointLabelPlacementBelowCenter"==g?"BelowCenter":"below-left"==g||"BelowLeft"==g||"esriServerPointLabelPlacementBelowLeft"==g?"BelowLeft":"below-right"==g||"BelowRight"==g||"esriServerPointLabelPlacementBelowRight"==g?"BelowRight":"center-center"==g||"CenterCenter"==g||"esriServerPointLabelPlacementCenterCenter"==
  g?"CenterCenter":"center-left"==g||"CenterLeft"==g||"esriServerPointLabelPlacementCenterLeft"==g?"CenterLeft":"center-right"==g||"CenterRight"==g||"esriServerPointLabelPlacementCenterRight"==g?"CenterRight":"AboveRight"),void 0!==b.LabelingOptions.lineLabelPlacement&&(d.lineLabelPlacement=b.LabelingOptions.lineLabelPlacement),void 0!==b.LabelingOptions.lineLabelPosition&&(d.lineLabelPosition=b.LabelingOptions.lineLabelPosition),void 0!==b.LabelingOptions.labelRotation&&(d.labelRotation=b.LabelingOptions.labelRotation),
  void 0!==b.LabelingOptions.howManyLabels&&(d.howManyLabels=b.LabelingOptions.howManyLabels));e instanceof u&&(f=this._getLabelExpression(e),e=new t(e.symbol),d=this._convertOptions(e));this._addLabels(c,e,f,d)}else if(g=c.labelingInfo)for(b=g.length-1;0<=b;b--)if(v=g[b])e=new u(v instanceof u?v.toJson():v),f=this._getLabelExpression(v),d=this._convertOptions(v),this._addLabels(c,e,f,d);f=m._process(this._preparedLabels);this.clear();this.drawLabels(this._map,f)}},drawLabels:function(a,b){this._scale=
  (a.extent.xmax-a.extent.xmin)/a.width;var c;for(c=0;c<b.length;c++){var e=b[c],f=e.x,g=e.y,k=e.text,v=e.angle,h=e.layer.labelSymbol;"polyline"==e.layer.geometry.type&&e.layer.options.labelRotation&&h.setAngle(180/Math.PI*v);h.setText(k);e=f;h instanceof p&&(f=h.getHeight(),e-=.25*f*this._scale*Math.sin(v),g-=.33*f*this._scale);v=new d(new r(e,g,a.extent.spatialReference));v.setSymbol(h);this.add(v)}},_addLabels:function(a,b,c,e){var f,d,g,k;if(this._isWithinScaleRange(b.minScale,b.maxScale)&&c&&""!==
  c){var h=this._map,v=!a.url&&!h.spatialReference.equals(a.spatialReference);for(f=0;f<a.graphics.length;f++)if(d=a.graphics[f],!1!==d.visible&&!d._suspended){g=d.geometry;if(v){if(!q.canProject(g,h))continue;g=q.project(g,h)}g&&this._isWhere(b.where,d.attributes)&&this._isWithinScreenArea(g)&&(k=this._buildLabelText(c,d,a.fields,e),this._addLabel(k,b,a.renderer,d,e,g,h))}}},_isWithinScreenArea:function(a){a="point"===a.type?new y(a.x,a.y,a.x,a.y,a.spatialReference):a.getExtent();if(void 0===a)return!1;
  a=this._intersects(this._map,a);return null===a||0===a.length?!1:!0},_isWithinScaleRange:function(a,b){var c=this._map.getScale();return 0<a&&c>=a||0<b&&c<b?!1:!0},_isWhere:function(a,b){try{if(!a)return!0;if(a){var c=a.split(" ");if(3===c.length)return this._sqlEquation(b[this._removeQuotes(c[0])],c[1],this._removeQuotes(c[2]));if(7===c.length){var e=this._sqlEquation(b[this._removeQuotes(c[0])],c[1],this._removeQuotes(c[2])),f=c[3],d=this._sqlEquation(b[this._removeQuotes(c[4])],c[5],this._removeQuotes(c[6]));
  switch(f){case "AND":return e&&d;case "OR":return e||d}}}return!1}catch(L){console.log("Error.: can't parse \x3d "+a)}},_sqlEquation:function(a,b,c){switch(b){case "\x3d":return a==c?!0:!1;case "\x3c\x3e":return a!=c?!0:!1;case "\x3e":return a>c?!0:!1;case "\x3e\x3d":return a>=c?!0:!1;case "\x3c":return a<c?!0:!1;case "\x3c\x3d":return a<=c?!0:!1}return!1},_removeQuotes:function(a){var b=a.indexOf('"'),c=a.lastIndexOf('"');if(-1!=b&&-1!=c)return a.substr(1,a.length-2);b=a.indexOf("'");c=a.lastIndexOf("'");
  return-1!=b&&-1!=c?a.substr(1,a.length-2):a},_getSizeInfo:function(a){return a?a.sizeInfo||E.filter(a.visualVariables,x)[0]:null},_addLabel:function(b,c,e,f,d,g,k){var h,l,n,v;if(b&&""!==B.trim(b)&&c){b=b.replace(/\s+/g," ");h=c.getSymbol(f);h instanceof p?(h=new p(h.toJson()),h.setVerticalAlignment("baseline"),h.setHorizontalAlignment("center")):h=h instanceof m?new m(h.toJson()):new p;h.setText(b);c.symbol=h;if(n=this._getProportionalSize(c.sizeInfo,f.attributes))h instanceof p?h.setSize(n):h instanceof
  m&&(h.setWidth(n),h.setHeight(n));v=n=0;if(e){l=e.getSymbol(f);var q=this._getSizeInfo(e);if((e=q?e.getSize(f,{sizeInfo:q,resolution:k.getResolutionInMeters()}):f.size)&&null!==e)n=v=e;else if(l)if("simplemarkersymbol"==l.type)v=n=l.size;else if("picturemarkersymbol"==l.type)n=l.width,v=l.height;else if("simplelinesymbol"==l.type||"cartographiclinesymbol"==l.type)n=l.width}e={};e.graphic=f;e.options=d;e.geometry=g;e.labelRenderer=c;e.labelSymbol=h;e.labelWidth=h.getWidth()/2;e.labelHeight=h.getHeight()/
  2;e.symbolWidth=a.normalizedLength(n)/2;e.symbolHeight=a.normalizedLength(v)/2;e.text=b;e.angle=h.angle;this._preparedLabels.push(e)}},_buildLabelText:function(a,b,c,f){if(f.hasExpression)return a=f.arcadeCache,b=b._getDataValue(a.attributeInfo,a,z),g.isDefined(b)?""+b:"";var d=b.attributes;return a.replace(/{[^}]*}/g,function(a){var b,h=a;for(b=0;b<c.length;b++)if("{"+c[b].name+"}"==a){var h=d[c[b].name],k=c[b].domain;if(k&&B.isObject(k)){if("codedValue"==k.type&&f.useCodedValues)for(b=h,a=0;a<k.codedValues.length;a++)if(k.codedValues[a].code==
  b){h=k.codedValues[a].name;break}break}k=c[b].type;if(f.fieldInfos){var l=f.fieldInfos;for(b=0;b<l.length;b++)if("{"+l[b].fieldName+"}"==a){a=l[b].format;"esriFieldTypeDate"==k?(a="DateFormat"+e.prototype._dateFormats[a.dateFormat?a.dateFormat:"shortDate"])&&(h=g.substitute({myKey:h},"${myKey:"+a+"}")):"esriFieldTypeInteger"!=k&&"esriFieldTypeSingle"!=k&&"esriFieldTypeSmallInteger"!=k&&"esriFieldTypeLong"!=k&&"esriFieldTypeDouble"!=k||!a||(h=H.format(h,{places:a.places}),a.digitSeparator||D.group&&
  (h=h.replace(new RegExp("\\"+D.group,"g"),"")));break}}break}else h="";return null==h?"":h})},_getLabelExpression:function(a){var b="";a.labelExpressionInfo?b=a.labelExpressionInfo.value||a.labelExpressionInfo.expression:this._validSyntax(a.labelExpression)&&(b=this._convertLabelExpression(a.labelExpression));return b},_validSyntax:function(a){return/^(\s*\[[^\]]+\]\s*)+$/i.test(a)},_convertLabelExpression:function(a){return a.replace(/\[/g,"{").replace(/\]/g,"}")},_getProportionalSize:function(a,
  b){if(!a)return null;b=g.substitute(b,"${"+a.field+"}",{first:!0});return!(a.minSize&&a.maxSize&&a.minDataValue&&a.maxDataValue&&b)||0>=a.maxDataValue-a.minDataValue?null:(a.maxSize-a.minSize)/(a.maxDataValue-a.minDataValue)*(b-a.minDataValue)+a.minSize},_convertOptions:function(a){var b=!0,c="shortDate",e=null,f=null,d="",g=!0,h,k;if(a&&(a.format&&(c=a.format.dateFormat,e={places:a.format.places,digitSeparator:a.format.digitSeparator}),f=a.fieldInfos,d=a.labelPlacement,null!=a.useCodedValues&&(b=
  a.useCodedValues),a=a.labelExpressionInfo)){var l=a.expression;l&&!a.value&&(k=!0,h=n.createAttributeCache({valueExpression:l},!0))}if("always-horizontal"==d||"esriServerPolygonPlacementAlwaysHorizontal"==d)g=!1;return{useCodedValues:b,dateFormat:c,numberFormat:e,fieldInfos:f,pointPriorities:"above-center"==d||"esriServerPointLabelPlacementAboveCenter"==d?"AboveCenter":"above-left"==d||"esriServerPointLabelPlacementAboveLeft"==d?"AboveLeft":"above-right"==d||"esriServerPointLabelPlacementAboveRight"==
  d?"AboveRight":"below-center"==d||"esriServerPointLabelPlacementBelowCenter"==d?"BelowCenter":"below-left"==d||"esriServerPointLabelPlacementBelowLeft"==d?"BelowLeft":"below-right"==d||"esriServerPointLabelPlacementBelowRight"==d?"BelowRight":"center-center"==d||"esriServerPointLabelPlacementCenterCenter"==d?"CenterCenter":"center-left"==d||"esriServerPointLabelPlacementCenterLeft"==d?"CenterLeft":"center-right"==d||"esriServerPointLabelPlacementCenterRight"==d?"CenterRight":"AboveRight",lineLabelPlacement:"above-start"==
  d||"below-start"==d||"center-start"==d?"PlaceAtStart":"above-end"==d||"below-end"==d||"center-end"==d?"PlaceAtEnd":"PlaceAtCenter",lineLabelPosition:"above-after"==d||"esriServerLinePlacementAboveAfter"==d||"above-along"==d||"esriServerLinePlacementAboveAlong"==d||"above-before"==d||"esriServerLinePlacementAboveBefore"==d||"above-start"==d||"esriServerLinePlacementAboveStart"==d||"above-end"==d||"esriServerLinePlacementAboveEnd"==d?"Above":"below-after"==d||"esriServerLinePlacementBelowAfter"==d||
  "below-along"==d||"esriServerLinePlacementBelowAlong"==d||"below-before"==d||"esriServerLinePlacementBelowBefore"==d||"below-start"==d||"esriServerLinePlacementBelowStart"==d||"below-end"==d||"esriServerLinePlacementBelowEnd"==d?"Below":"center-after"==d||"esriServerLinePlacementCenterAfter"==d||"center-along"==d||"esriServerLinePlacementCenterAlong"==d||"center-before"==d||"esriServerLinePlacementCenterBefore"==d||"center-start"==d||"esriServerLinePlacementCenterStart"==d||"center-end"==d||"esriServerLinePlacementCenterEnd"==
  d?"OnLine":"Above",labelRotation:g,howManyLabels:"OneLabel",hasExpression:k,arcadeCache:h}}});b("extend-esri")&&B.setObject("layers.LabelLayer",C,c);return C});