/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.geometry"],["require","dojox.gfx._base"],["require","esri.WKIDUnitConversion"],["require","esri.geometry.utils"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.geometry"]){_4._hasResource["esri.geometry"]=true;_4.provide("esri.geometry");_4.require("dojox.gfx._base");_4.require("esri.WKIDUnitConversion");_4.require("esri.geometry.utils");esri.Units={CENTIMETERS:"esriCentimeters",DECIMAL_DEGREES:"esriDecimalDegrees",DEGREE_MINUTE_SECONDS:"esriDegreeMinuteSeconds",DECIMETERS:"esriDecimeters",FEET:"esriFeet",INCHES:"esriInches",KILOMETERS:"esriKilometers",METERS:"esriMeters",MILES:"esriMiles",MILLIMETERS:"esriMillimeters",NAUTICAL_MILES:"esriNauticalMiles",POINTS:"esriPoints",UNKNOWN:"esriUnknownUnits",YARDS:"esriYards",ACRES:"esriAcres",ARES:"esriAres",SQUARE_KILOMETERS:"esriSquareKilometers",SQUARE_MILES:"esriSquareMiles",SQUARE_FEET:"esriSquareFeet",SQUARE_METERS:"esriSquareMeters",HECTARES:"esriHectares",SQUARE_YARDS:"esriSquareYards",SQUARE_INCHES:"esriSquareInches",SQUARE_MILLIMETERS:"esriSquareMillimeters",SQUARE_CENTIMETERS:"esriSquareCentimeters",SQUARE_DECIMETERS:"esriSquareDecimeters"};(function(){var _7="PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",${Central_Meridian}],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]";var _8=[-20037508.342788905,20037508.342788905];var _9=[-20037508.342787,20037508.342787];_4.declare("esri.SpatialReference",null,{constructor:function(_a){if(_a){if(_4.isObject(_a)){_4.mixin(this,_a);}else{if(_4.isString(_a)){this.wkt=_a;}else{this.wkid=_a;}}}},wkid:null,wkt:null,_info:{"102113":{wkTemplate:"PROJCS[\"WGS_1984_Web_Mercator\",GEOGCS[\"GCS_WGS_1984_Major_Auxiliary_Sphere\",DATUM[\"D_WGS_1984_Major_Auxiliary_Sphere\",SPHEROID[\"WGS_1984_Major_Auxiliary_Sphere\",6378137.0,0.0]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",${Central_Meridian}],PARAMETER[\"Standard_Parallel_1\",0.0],UNIT[\"Meter\",1.0]]",valid:_8,origin:_9,dx:0.00001},"102100":{wkTemplate:_7,valid:_8,origin:_9,dx:0.00001},"3857":{wkTemplate:_7,valid:_8,origin:_9,dx:0.00001},"4326":{wkTemplate:"GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",${Central_Meridian}],UNIT[\"Degree\",0.0174532925199433]]",altTemplate:"PROJCS[\"WGS_1984_Plate_Carree\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Plate_Carree\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",${Central_Meridian}],UNIT[\"Degrees\",111319.491]]",valid:[-180,180],origin:[-180,180],dx:0.00001}},_isWebMercator:function(){return _4.indexOf([102113,102100,3857,3785],this.wkid)!==-1;},_isWrappable:function(){return _4.indexOf([102113,102100,3857,3785,4326],this.wkid)!==-1;},_getInfo:function(){return this.wkid?this._info[this.wkid]:null;},toJson:function(){if(this.wkid!==null){return {wkid:this.wkid};}else{if(this.wkt!==null){return {wkt:this.wkt};}}return null;}});}());_4.mixin(esri.geometry,(function(){var _b=6378137,PI=3.141592653589793,_c=57.29577951308232,_d=0.017453292519943,_e=Math.floor,_f=Math.log,sin=Math.sin,exp=Math.exp,_10=Math.atan;function _11(rad){return rad*_c;};function _12(deg){return deg*_d;};function _13(lng,lat){var _14=_12(lat);return [_12(lng)*_b,_b/2*_f((1+sin(_14))/(1-sin(_14)))];};function _15(x,y,_16){var _17=_11(x/_b);if(_16){return [_17,_11((PI/2)-(2*_10(exp(-1*y/_b))))];}return [_17-(_e((_17+180)/360)*360),_11((PI/2)-(2*_10(exp(-1*y/_b))))];};function _18(_19,_1a,sr,_1b){if(_19 instanceof esri.geometry.Point){var pt=_1a(_19.x,_19.y,_1b);return new esri.geometry.Point(pt[0],pt[1],new esri.SpatialReference(sr));}else{if(_19 instanceof esri.geometry.Extent){var min=_1a(_19.xmin,_19.ymin,_1b),max=_1a(_19.xmax,_19.ymax,_1b);return new esri.geometry.Extent(min[0],min[1],max[0],max[1],new esri.SpatialReference(sr));}else{if(_19 instanceof esri.geometry.Polyline||_19 instanceof esri.geometry.Polygon){var _1c=_19 instanceof esri.geometry.Polyline,_1d=_1c?_19.paths:_19.rings,_1e=[],_1f;_4.forEach(_1d,function(_20){_1e.push(_1f=[]);_4.forEach(_20,function(iPt){_1f.push(_1a(iPt[0],iPt[1],_1b));});});if(_1c){return new esri.geometry.Polyline({paths:_1e,spatialReference:sr});}else{return new esri.geometry.Polygon({rings:_1e,spatialReference:sr});}}else{if(_19 instanceof esri.geometry.Multipoint){var _21=[];_4.forEach(_19.points,function(iPt){_21.push(_1a(iPt[0],iPt[1],_1b));});return new esri.geometry.Multipoint({points:_21,spatialReference:sr});}}}}};var _22=39.37,_23=20015077/180,ecd=esri.config.defaults,_24=esri.WKIDUnitConversion;return {geographicToWebMercator:function(_25){return _18(_25,_13,{wkid:102100});},webMercatorToGeographic:function(_26,_27){return _18(_26,_15,{wkid:4326},_27);},getScale:function(map){var _28,_29,_2a,wkt;if(arguments.length>1){_28=arguments[0];_29=arguments[1];_2a=arguments[2];}else{_28=map.extent;_29=map.width;var sr=map.spatialReference;if(sr){_2a=sr.wkid;wkt=sr.wkt;}}var _2b;if(_2a){_2b=_24.values[_24[_2a]];}else{if(wkt&&(wkt.search(/^PROJCS/i)!==-1)){var _2c=/UNIT\[([^\]]+)\]\]$/i.exec(wkt);if(_2c&&_2c[1]){_2b=parseFloat(_2c[1].split(",")[1]);}}}return esri.geometry._getScale(_28,_29,_2b);},_getScale:function(_2d,_2e,_2f){return (_2d.getWidth()/_2e)*(_2f||_23)*_22*ecd.screenDPI;},getExtentForScale:function(map,_30){var _31,wkt,sr=map.spatialReference;if(sr){_31=sr.wkid;wkt=sr.wkt;}var _32;if(_31){_32=_24.values[_24[_31]];}else{if(wkt&&(wkt.search(/^PROJCS/i)!==-1)){var _33=/UNIT\[([^\]]+)\]\]$/i.exec(wkt);if(_33&&_33[1]){_32=parseFloat(_33[1].split(",")[1]);}}}return esri.geometry._getExtentForScale(map.extent,map.width,_32,_30,true);},_getExtentForScale:function(_34,_35,_36,_37,_38){var _39;if(_38){_39=_36;}else{_39=_24.values[_24[_36]];}return _34.expand(((_37*_35)/((_39||_23)*_22*ecd.screenDPI))/_34.getWidth());}};}()),{defaultPoint:{type:"point",x:0,y:0},defaultMultipoint:{type:"multipoint",points:null},defaultExtent:{type:"extent",xmin:0,ymin:0,xmax:0,ymax:0},defaultPolyline:{type:"polyline",paths:null},defaultPolygon:{type:"polygon",rings:null},_rectToExtent:function(_3a){return new esri.geometry.Extent(parseFloat(_3a.x),parseFloat(_3a.y)-parseFloat(_3a.height),parseFloat(_3a.x)+parseFloat(_3a.width),parseFloat(_3a.y),_3a.spatialReference);},_extentToRect:function(_3b){return new esri.geometry.Rect(_3b.xmin,_3b.ymax,_3b.getWidth(),_3b.getHeight(),_3b.spatialReference);},fromJson:function(_3c){if(_3c.x!==undefined&&_3c.y!==undefined){return new esri.geometry.Point(_3c);}else{if(_3c.paths!==undefined){return new esri.geometry.Polyline(_3c);}else{if(_3c.rings!==undefined){return new esri.geometry.Polygon(_3c);}else{if(_3c.points!==undefined){return new esri.geometry.Multipoint(_3c);}else{if(_3c.xmin!==undefined&&_3c.ymin!==undefined&&_3c.xmax!==undefined&&_3c.ymax!==undefined){return new esri.geometry.Extent(_3c);}}}}}},getJsonType:function(_3d){if(_3d instanceof esri.geometry.Point){return "esriGeometryPoint";}else{if(_3d instanceof esri.geometry.Polyline){return "esriGeometryPolyline";}else{if(_3d instanceof esri.geometry.Polygon){return "esriGeometryPolygon";}else{if(_3d instanceof esri.geometry.Extent){return "esriGeometryEnvelope";}else{if(_3d instanceof esri.geometry.Multipoint){return "esriGeometryMultipoint";}}}}}return null;},getGeometryType:function(_3e){if(_3e==="esriGeometryPoint"){return esri.geometry.Point;}else{if(_3e==="esriGeometryPolyline"){return esri.geometry.Polyline;}else{if(_3e==="esriGeometryPolygon"){return esri.geometry.Polygon;}else{if(_3e==="esriGeometryEnvelope"){return esri.geometry.Extent;}else{if(_3e==="esriGeometryMultipoint"){return esri.geometry.Multipoint;}}}}}return null;},isClockwise:function(arr){var _3f=0,i,il=arr.length,_40=_4.isArray(arr[0])?function(p1,p2){return p1[0]*p2[1]-p2[0]*p1[1];}:function(p1,p2){return p1.x*p2.y-p2.x*p1.y;};for(i=0;i<il;i++){_3f+=_40(arr[i],arr[(i+1)%il]);}return (_3f/2)<=0;},toScreenPoint:function(ext,wd,ht,pt,_41){if(_41){return new esri.geometry.Point((pt.x-ext.xmin)*(wd/ext.getWidth()),(ext.ymax-pt.y)*(ht/ext.getHeight()));}else{return new esri.geometry.Point(Math.round((pt.x-ext.xmin)*(wd/ext.getWidth())),Math.round((ext.ymax-pt.y)*(ht/ext.getHeight())));}},toScreenGeometry:function(ext,wd,ht,g){var x=ext.xmin,y=ext.ymax,rwd=wd/ext.getWidth(),rht=ht/ext.getHeight(),_42=_4.forEach,_43=Math.round;if(g instanceof esri.geometry.Point){return new esri.geometry.Point(_43((g.x-x)*rwd),_43((y-g.y)*rht));}else{if(g instanceof esri.geometry.Multipoint){var mp=new esri.geometry.Multipoint(),mpp=mp.points;_42(g.points,function(pt,i){mpp[i]=[_43((pt[0]-x)*rwd),_43((y-pt[1])*rht)];});return mp;}else{if(g instanceof esri.geometry.Extent){return new esri.geometry.Extent(_43((g.xmin-x)*rwd),_43((y-g.ymin)*rht),_43((g.xmax-x)*rwd),_43((y-g.ymax)*rwd));}else{if(g instanceof esri.geometry.Polyline){var _44=new esri.geometry.Polyline(),_45=_44.paths,_46;_42(g.paths,function(_47,i){_46=(_45[i]=[]);_42(_47,function(pt,j){_46[j]=[_43((pt[0]-x)*rwd),_43((y-pt[1])*rht)];});});return _44;}else{if(g instanceof esri.geometry.Polygon){var _48=new esri.geometry.Polygon(),_49=_48.rings,_4a;_42(g.rings,function(_4b,i){_4a=(_49[i]=[]);_42(_4b,function(pt,j){_4a[j]=[_43((pt[0]-x)*rwd),_43((y-pt[1])*rht)];});});return _48;}}}}}},_toScreenPath:(function(){var _4c=(function(){if(_4.isIE<9){return function(x,y,rwd,rht,dx,dy,_4d){var _4e=[],_4f=Math.round,p,pl=_4d.length,_50,_51,_52,pt,x1,y1,x2,y2;for(p=0;p<pl;p++){_50=_4d[p];pt=_50[0];if((_52=_50.length)>1){pt=_50[0];x1=_4f(((pt[0]-x)*rwd)+dx);y1=_4f(((y-pt[1])*rht)+dy);x2=_4f(((_50[1][0]-x)*rwd)+dx);y2=_4f(((y-_50[1][1])*rht)+dy);_4e.push("M",x1+","+y1,"L",x2+","+y2);for(_51=2;_51<_52;_51++){pt=_50[_51];x1=_4f(((pt[0]-x)*rwd)+dx);y1=_4f(((y-pt[1])*rht)+dy);_4e.push(x1+","+y1);}}else{x1=_4f(((pt[0]-x)*rwd)+dx);y1=_4f(((y-pt[1])*rht)+dy);_4e.push("M",x1+","+y1);}}return _4e;};}else{return function(x,y,rwd,rht,dx,dy,_53){var _54=[],i,j,il,jl,_55,pt,_56=Math.round;for(i=0,il=_53?_53.length:0;i<il;i++){_55=_53[i];_54.push("M");for(j=0,jl=_55?_55.length:0;j<jl;j++){pt=_55[j];_54.push(_56(((pt[0]-x)*rwd)+dx)+","+_56(((y-pt[1])*rht)+dy));}}return _54;};}}());return function(ext,wd,ht,g,dx,dy){var _57=g instanceof esri.geometry.Polyline;return _4c(ext.xmin,ext.ymax,wd/ext.getWidth(),ht/ext.getHeight(),dx,dy,_57?g.paths:g.rings);};}()),toMapPoint:function(ext,wd,ht,pt){return new esri.geometry.Point(ext.xmin+(pt.x/(wd/ext.getWidth())),ext.ymax-(pt.y/(ht/ext.getHeight())),ext.spatialReference);},toMapGeometry:function(ext,wd,ht,g){var x=ext.xmin,y=ext.ymax,sr=ext.spatialReference,rwd=wd/ext.getWidth(),rht=ht/ext.getHeight(),_58=_4.forEach;if(g instanceof esri.geometry.Point){return new esri.geometry.Point(x+(g.x/rwd),y-(g.y/rht),sr);}else{if(g instanceof esri.geometry.Multipoint){var mp=new esri.geometry.Multipoint(sr),mpp=mp.points;_58(g.points,function(pt,i){mpp[i]=[x+(pt[0]/rwd),y-(pt[1]/rht)];});return mp;}else{if(g instanceof esri.geometry.Extent){return new esri.geometry.Extent(x+(g.xmin/rwd),y-(g.ymin/rht),x+(g.xmax/rwd),y-(g.ymax/rht),sr);}else{if(g instanceof esri.geometry.Polyline){var _59=new esri.geometry.Polyline(sr),_5a=_59.paths,_5b;_58(g.paths,function(_5c,i){_5b=(_5a[i]=[]);_58(_5c,function(pt,j){_5b[j]=[x+(pt[0]/rwd),y-(pt[1]/rht)];});});return _59;}else{if(g instanceof esri.geometry.Polygon){var _5d=new esri.geometry.Polygon(sr),_5e=_5d.rings,_5f;_58(g.rings,function(_60,i){_5f=(_5e[i]=[]);_58(_60,function(pt,j){_5f[j]=[x+(pt[0]/rwd),y-(pt[1]/rht)];});});return _5d;}}}}}},getLength:function(pt1,pt2){var dx=pt2.x-pt1.x,dy=pt2.y-pt1.y;return Math.sqrt(dx*dx+dy*dy);},_getLength:function(pt1,pt2){var dx=pt2[0]-pt1[0],dy=pt2[1]-pt1[1];return Math.sqrt(dx*dx+dy*dy);},getMidpoint:function(pt0,pt1){return esri.geometry.getPointOnLine(pt0,pt1,0.5);},getPointOnLine:function(pt0,pt1,_61){if(pt0 instanceof esri.geometry.Point){return new esri.geometry.Point(pt0.x+_61*(pt1.x-pt0.x),pt0.y+_61*(pt1.y-pt0.y));}else{return [pt0[0]+_61*(pt1[0]-pt0[0]),pt0[1]+_61*(pt1[1]-pt0[1])];}},_equals:function(n1,n2){return Math.abs(n1-n2)<1e-8;},getLineIntersection:function(_62,_63,_64,_65){var pt=esri.geometry._getLineIntersection([_62.x,_62.y],[_63.x,_63.y],[_64.x,_64.y],[_65.x,_65.y]);if(pt){pt=new esri.geometry.Point(pt[0],pt[1]);}return pt;},_getLineIntersection:function(p0,p1,p2,p3){var _66=10000000000,x,y,a0=esri.geometry._equals(p0[0],p1[0])?_66:(p0[1]-p1[1])/(p0[0]-p1[0]),a1=esri.geometry._equals(p2[0],p3[0])?_66:(p2[1]-p3[1])/(p2[0]-p3[0]),b0=p0[1]-a0*p0[0],b1=p2[1]-a1*p2[0];if(esri.geometry._equals(a0,a1)){if(!esri.geometry._equals(b0,b1)){return null;}else{if(esri.geometry._equals(p0[0],p1[0])){if(Math.min(p0[1],p1[1])<Math.max(p2[1],p3[1])||Math.max(p0[1],p1[1])>Math.min(p2[1],p3[1])){y=(p0[1]+p1[1]+p2[1]+p3[1]-Math.min(p0[1],p1[1],p2[1],p3[1])-Math.max(p0[1],p1[1],p2[1],p3[1]))/2;x=(y-b0)/a0;}else{return null;}}else{if(Math.min(p0[0],p1[0])<Math.max(p2[0],p3[0])||Math.max(p0[0],p1[0])>Math.min(p2[0],p3[0])){x=(p0[0]+p1[0]+p2[0]+p3[0]-Math.min(p0[0],p1[0],p2[0],p3[0])-Math.max(p0[0],p1[0],p2[0],p3[0]))/2;y=a0*x+b0;}else{return null;}}return [x,y];}}if(esri.geometry._equals(a0,_66)){x=p0[0];y=a1*x+b1;}else{if(esri.geometry._equals(a1,_66)){x=p2[0];y=a0*x+b0;}else{x=-(b0-b1)/(a0-a1);y=a0*x+b0;}}return [x,y];},_getLineIntersection2:function(_67,_68){var p1=_67[0],p2=_67[1],p3=_68[0],p4=_68[1],x1=p1[0],y1=p1[1],x2=p2[0],y2=p2[1],x3=p3[0],y3=p3[1],x4=p4[0],y4=p4[1],x43=x4-x3,x13=x1-x3,x21=x2-x1,y43=y4-y3,y13=y1-y3,y21=y2-y1,_69=(y43*x21)-(x43*y21),ua,ub,px,py;if(_69===0){return false;}ua=((x43*y13)-(y43*x13))/_69;ub=((x21*y13)-(y21*x13))/_69;if(ua>=0&&ua<=1&&ub>=0&&ub<=1){px=x1+(ua*(x2-x1));py=y1+(ua*(y2-y1));return [px,py];}else{return false;}},_pointLineDistance:function(_6a,_6b){var p1=_6b[0],p2=_6b[1],x1=p1[0],y1=p1[1],x2=p2[0],y2=p2[1],x3=_6a[0],y3=_6a[1],x21=x2-x1,y21=y2-y1,x31=x3-x1,y31=y3-y1,_6c=Math.sqrt,pow=Math.pow,mag=_6c(pow(x21,2)+pow(y21,2)),u=((x31*x21)+(y31*y21))/(mag*mag),x=x1+u*x21,y=y1+u*y21;return _6c(pow(x3-x,2)+pow(y3-y,2));}});_4.declare("esri.geometry.Geometry",null,{spatialReference:null,type:null,setSpatialReference:function(sr){this.spatialReference=sr;return this;},getExtent:function(){return null;}});_4.declare("esri.geometry.Point",esri.geometry.Geometry,{constructor:function(x,y,_6d){_4.mixin(this,esri.geometry.defaultPoint);if(_4.isArray(x)){this.x=x[0];this.y=x[1];this.spatialReference=y;}else{if(_4.isObject(x)){_4.mixin(this,x);if(this.spatialReference){this.spatialReference=new esri.SpatialReference(this.spatialReference);}}else{this.x=x;this.y=y;this.spatialReference=_6d;}}},offset:function(x,y){return new esri.geometry.Point(this.x+x,this.y+y,this.spatialReference);},setX:function(x){this.x=x;return this;},setY:function(y){this.y=y;return this;},update:function(x,y){this.x=x;this.y=y;return this;},normalize:function(){var x=this.x,sr=this.spatialReference;if(sr){var _6e=sr._getInfo();if(_6e){var _6f=_6e.valid[0],_70=_6e.valid[1],_71=2*_70,_72;if(x>_70){_72=Math.ceil(Math.abs(x-_70)/_71);x-=(_72*_71);}else{if(x<_6f){_72=Math.ceil(Math.abs(x-_6f)/_71);x+=(_72*_71);}}}}return new esri.geometry.Point(x,this.y,sr);},toJson:function(){var _73={x:this.x,y:this.y},sr=this.spatialReference;if(sr){_73.spatialReference=sr.toJson();}return _73;}});_4.declare("esri.geometry.Polyline",esri.geometry.Geometry,{constructor:function(obj){_4.mixin(this,esri.geometry.defaultPolyline);this.paths=[];this._path=0;if(obj){if(obj.paths){_4.mixin(this,obj);}else{this.spatialReference=obj;}this.spatialReference=new esri.SpatialReference(this.spatialReference);}},_extent:null,addPath:function(_74){this._extent=null;this._path=this.paths.length;this.paths[this._path]=[];if(_4.isArray(_74[0])){_4.forEach(_74,this._addPointArr,this);}else{_4.forEach(_74,this._addPoint,this);}return this;},_addPointArr:function(_75){this.paths[this._path].push(_75);},_addPoint:function(_76){this.paths[this._path].push([_76.x,_76.y]);},_insertPoints:function(_77,_78){this._extent=null;this._path=_78;if(!this.paths[this._path]){this.paths[this._path]=[];}_4.forEach(_77,this._addPoint,this);},_validateInputs:function(_79,_7a){if((_79!==null&&_79!==undefined)&&(_79<0||_79>=this.paths.length)){return false;}if((_7a!==null&&_79!==undefined)&&(_7a<0||_7a>=this.paths[_79].length)){return false;}return true;},getPoint:function(_7b,_7c){if(this._validateInputs(_7b,_7c)){return new esri.geometry.Point(this.paths[_7b][_7c],this.spatialReference);}},setPoint:function(_7d,_7e,_7f){if(this._validateInputs(_7d,_7e)){this._extent=null;this.paths[_7d][_7e]=[_7f.x,_7f.y];return this;}},insertPoint:function(_80,_81,_82){if(this._validateInputs(_80)&&esri._isDefined(_81)&&(_81>=0&&_81<=this.paths[_80].length)){this._extent=null;this.paths[_80].splice(_81,0,[_82.x,_82.y]);return this;}},removePath:function(_83){if(this._validateInputs(_83,null)){this._extent=null;var arr=this.paths.splice(_83,1)[0],i,il=arr.length,_84=esri.geometry.Point,sr=this.spatialReference;for(i=0;i<il;i++){arr[i]=new _84(arr[i],sr);}return arr;}},removePoint:function(_85,_86){if(this._validateInputs(_85,_86)){this._extent=null;return new esri.geometry.Point(this.paths[_85].splice(_86,1)[0],this.spatialReference);}},getExtent:function(){var _87;if(this._extent){_87=new esri.geometry.Extent(this._extent);_87._partwise=this._partwise;return _87;}var _88=this.paths,pal=_88.length;if(!pal||!_88[0].length){return;}var _89,_8a,x,y,_8b,_8c,pa,pt,ptl,_8d=(_8b=_88[0][0][0]),_8e=(_8c=_88[0][0][1]),min=Math.min,max=Math.max,sr=this.spatialReference,_8f=[],_90,_91,_92,_93;for(pa=0;pa<pal;pa++){_89=_88[pa];_90=(_91=_89[0]&&_89[0][0]);_92=(_93=_89[0]&&_89[0][1]);ptl=_89.length;for(pt=0;pt<ptl;pt++){_8a=_89[pt];x=_8a[0];y=_8a[1];_8d=min(_8d,x);_8e=min(_8e,y);_8b=max(_8b,x);_8c=max(_8c,y);_90=min(_90,x);_92=min(_92,y);_91=max(_91,x);_93=max(_93,y);}_8f.push(new esri.geometry.Extent({xmin:_90,ymin:_92,xmax:_91,ymax:_93,spatialReference:(sr?sr.toJson():null)}));}this._extent={xmin:_8d,ymin:_8e,xmax:_8b,ymax:_8c,spatialReference:sr?sr.toJson():null};this._partwise=_8f.length>1?_8f:null;_87=new esri.geometry.Extent(this._extent);_87._partwise=this._partwise;return _87;},toJson:function(){var _94={paths:_4.clone(this.paths)},sr=this.spatialReference;if(sr){_94.spatialReference=sr.toJson();}return _94;}});_4.declare("esri.geometry.Polygon",esri.geometry.Geometry,{constructor:function(obj){_4.mixin(this,esri.geometry.defaultPolygon);this.rings=[];this._ring=0;if(obj){if(obj.rings){_4.mixin(this,obj);}else{this.spatialReference=obj;}this.spatialReference=new esri.SpatialReference(this.spatialReference);}},_extent:null,addRing:function(_95){this._extent=null;this._ring=this.rings.length;this.rings[this._ring]=[];if(_4.isArray(_95[0])){_4.forEach(_95,this._addPointArr,this);}else{_4.forEach(_95,this._addPoint,this);}return this;},_addPointArr:function(_96){this.rings[this._ring].push(_96);},_addPoint:function(_97){this.rings[this._ring].push([_97.x,_97.y]);},_insertPoints:function(_98,_99){this._extent=null;this._ring=_99;if(!this.rings[this._ring]){this.rings[this._ring]=[];}_4.forEach(_98,this._addPoint,this);},_validateInputs:function(_9a,_9b){if((_9a!==null&&_9a!==undefined)&&(_9a<0||_9a>=this.rings.length)){return false;}if((_9b!==null&&_9a!==undefined)&&(_9b<0||_9b>=this.rings[_9a].length)){return false;}return true;},getPoint:function(_9c,_9d){if(this._validateInputs(_9c,_9d)){return new esri.geometry.Point(this.rings[_9c][_9d],this.spatialReference);}},setPoint:function(_9e,_9f,_a0){if(this._validateInputs(_9e,_9f)){this._extent=null;this.rings[_9e][_9f]=[_a0.x,_a0.y];return this;}},insertPoint:function(_a1,_a2,_a3){if(this._validateInputs(_a1)&&esri._isDefined(_a2)&&(_a2>=0&&_a2<=this.rings[_a1].length)){this._extent=null;this.rings[_a1].splice(_a2,0,[_a3.x,_a3.y]);return this;}},removeRing:function(_a4){if(this._validateInputs(_a4,null)){this._extent=null;var arr=this.rings.splice(_a4,1)[0],i,il=arr.length,_a5=esri.geometry.Point,sr=this.spatialReference;for(i=0;i<il;i++){arr[i]=new _a5(arr[i],sr);}return arr;}},removePoint:function(_a6,_a7){if(this._validateInputs(_a6,_a7)){this._extent=null;return new esri.geometry.Point(this.rings[_a6].splice(_a7,1)[0],this.spatialReference);}},getExtent:function(){var _a8;if(this._extent){_a8=new esri.geometry.Extent(this._extent);_a8._partwise=this._partwise;return _a8;}var _a9=this.rings,pal=_a9.length;if(!pal||!_a9[0].length){return;}var _aa,_ab,x,y,_ac,_ad,pa,pt,ptl,_ae=(_ac=_a9[0][0][0]),_af=(_ad=_a9[0][0][1]),min=Math.min,max=Math.max,sr=this.spatialReference,_b0=[],_b1,_b2,_b3,_b4;for(pa=0;pa<pal;pa++){_aa=_a9[pa];_b1=(_b2=_aa[0]&&_aa[0][0]);_b3=(_b4=_aa[0]&&_aa[0][1]);ptl=_aa.length;for(pt=0;pt<ptl;pt++){_ab=_aa[pt];x=_ab[0];y=_ab[1];_ae=min(_ae,x);_af=min(_af,y);_ac=max(_ac,x);_ad=max(_ad,y);_b1=min(_b1,x);_b3=min(_b3,y);_b2=max(_b2,x);_b4=max(_b4,y);}_b0.push(new esri.geometry.Extent({xmin:_b1,ymin:_b3,xmax:_b2,ymax:_b4,spatialReference:(sr?sr.toJson():null)}));}this._extent={xmin:_ae,ymin:_af,xmax:_ac,ymax:_ad,spatialReference:(sr?sr.toJson():null)};this._partwise=_b0.length>1?_b0:null;_a8=new esri.geometry.Extent(this._extent);_a8._partwise=this._partwise;return _a8;},contains:function(_b5){var _b6=this.rings,_b7,_b8=false,pi,pj,_b9,j,i,pa,pal=_b6.length;for(pa=0;pa<pal;pa++){_b7=_b6[pa];_b9=_b7.length;j=0;for(i=0;i<_b9;i++){j++;if(j===_b9){j=0;}pi=_b7[i];pj=_b7[j];if((pi[1]<_b5.y&&pj[1]>=_b5.y||pj[1]<_b5.y&&pi[1]>=_b5.y)&&(pi[0]+(_b5.y-pi[1])/(pj[1]-pi[1])*(pj[0]-pi[0])<_b5.x)){_b8=!_b8;}}}return _b8;},toJson:function(){var _ba={rings:_4.clone(this.rings)},sr=this.spatialReference;if(sr){_ba.spatialReference=sr.toJson();}return _ba;}});_4.declare("esri.geometry.Multipoint",esri.geometry.Geometry,{constructor:function(obj){_4.mixin(this,esri.geometry.defaultMultipoint);this.points=[];if(obj){if(obj.points){_4.mixin(this,obj);}else{this.spatialReference=obj;}this.spatialReference=new esri.SpatialReference(this.spatialReference);}},_extent:null,addPoint:function(_bb){this._extent=null;if(_4.isArray(_bb)){this.points.push(_bb);}else{this.points.push([_bb.x,_bb.y]);}return this;},removePoint:function(_bc){if(this._validateInputs(_bc)){this._extent=null;return new esri.geometry.Point(this.points.splice(_bc,1)[0],this.spatialReference);}},getExtent:function(){if(this._extent){return new esri.geometry.Extent(this._extent);}var _bd=this.points,il=_bd.length;if(!il){return;}var _be=_bd[0],_bf,_c0,_c1=(_bf=_be[0]),_c2=(_c0=_be[1]),min=Math.min,max=Math.max,sr=this.spatialReference,x,y,i;for(i=0;i<il;i++){_be=_bd[i];x=_be[0];y=_be[1];_c1=min(_c1,x);_c2=min(_c2,y);_bf=max(_bf,x);_c0=max(_c0,y);}this._extent={xmin:_c1,ymin:_c2,xmax:_bf,ymax:_c0,spatialReference:sr?sr.toJson():null};return new esri.geometry.Extent(this._extent);},_validateInputs:function(_c3){if(_c3===null||_c3<0||_c3>=this.points.length){return false;}return true;},getPoint:function(_c4){if(this._validateInputs(_c4)){var _c5=this.points[_c4];return new esri.geometry.Point(_c5[0],_c5[1],this.spatialReference);}},setPoint:function(_c6,_c7){if(this._validateInputs(_c6)){this._extent=null;this.points[_c6]=[_c7.x,_c7.y];return this;}},toJson:function(){var _c8={points:_4.clone(this.points)},sr=this.spatialReference;if(sr){_c8.spatialReference=sr.toJson();}return _c8;}});_4.declare("esri.geometry.Extent",esri.geometry.Geometry,{constructor:function(_c9,_ca,_cb,_cc,_cd){_4.mixin(this,esri.geometry.defaultExtent);if(_4.isObject(_c9)){_4.mixin(this,_c9);this.spatialReference=new esri.SpatialReference(this.spatialReference);}else{this.update(_c9,_ca,_cb,_cc,_cd);}},getWidth:function(){return Math.abs(this.xmax-this.xmin);},getHeight:function(){return Math.abs(this.ymax-this.ymin);},getCenter:function(){return new esri.geometry.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2,this.spatialReference);},centerAt:function(_ce){var _cf=this.getCenter(),dx=_ce.x-_cf.x,dy=_ce.y-_cf.y;return new esri.geometry.Extent(this.xmin+dx,this.ymin+dy,this.xmax+dx,this.ymax+dy,this.spatialReference);},update:function(_d0,_d1,_d2,_d3,_d4){this.xmin=_d0;this.ymin=_d1;this.xmax=_d2;this.ymax=_d3;this.spatialReference=_d4;return this;},offset:function(ox,oy){return new esri.geometry.Extent(this.xmin+ox,this.ymin+oy,this.xmax+ox,this.ymax+oy,this.spatialReference);},expand:function(_d5){var _d6=(1-_d5)/2,_d7=this.getWidth()*_d6,_d8=this.getHeight()*_d6;return new esri.geometry.Extent(this.xmin+_d7,this.ymin+_d8,this.xmax-_d7,this.ymax-_d8,this.spatialReference);},intersects:function(_d9){var _da=_d9.type;switch(_da){case "point":return this.contains(_d9);case "multipoint":return this._intersectsMultipoint(_d9);case "extent":return this._intersectsExtent(_d9);case "polygon":return this._intersectsPolygon(_d9);case "polyline":return this._intersectsPolyline(_d9);}},_intersectsMultipoint:function(_db){var len=_db.points.length,i;for(i=0;i<len;i++){if(this.contains(_db.getPoint(i))){return true;}}return false;},_intersectsExtent:function(_dc){var _dd,_de,_df,_e0,_e1=false;if(this.xmin<=_dc.xmin){_dd=_dc.xmin;if(this.xmax<_dd){_e1=true;}else{_df=Math.min(this.xmax,_dc.xmax)-_dd;}}else{_dd=this.xmin;if(_dc.xmax<_dd){_e1=true;}else{_df=Math.min(this.xmax,_dc.xmax)-_dd;}}if(this.ymin<=_dc.ymin){_de=_dc.ymin;if(this.ymax<_de){_e1=true;}else{_e0=Math.min(this.ymax,_dc.ymax)-_de;}}else{_de=this.ymin;if(_dc.ymax<_de){_e1=true;}else{_e0=Math.min(this.ymax,_dc.ymax)-_de;}}if(_e1){return null;}return new esri.geometry.Extent(_dd,_de,_dd+_df,_de+_e0,this.spatialReference);},_intersectsPolygon:function(_e2){var _e3=[this.xmin,this.ymax],_e4=[this.xmax,this.ymax],_e5=[this.xmin,this.ymin],_e6=[this.xmax,this.ymin],_e7=[_e3,_e4,_e5,_e6],_e8=[[_e5,_e3],[_e3,_e4],[_e4,_e6],[_e6,_e5]],i,j,_e9=_e2.rings,_ea=_e9.length,_eb,len,_ec=new esri.geometry.Point(0,0);len=_e7.length;for(i=0;i<len;i++){_ec.update(_e7[i][0],_e7[i][1]);if(_e2.contains(_ec)){return true;}}var pi,pj;for(i=0;i<_ea;i++){_eb=_e9[i];len=_eb.length;pi=_eb[0];_ec.update(pi[0],pi[1]);if(this.contains(_ec)){return true;}for(j=1;j<len;j++){pj=_eb[j];_ec.update(pj[0],pj[1]);if(this.contains(_ec)||this._intersectsLine([pi,pj],_e8)){return true;}pi=pj;}}return false;},_intersectsPolyline:function(_ed){var _ee=[[[this.xmin,this.ymin],[this.xmin,this.ymax]],[[this.xmin,this.ymax],[this.xmax,this.ymax]],[[this.xmax,this.ymax],[this.xmax,this.ymin]],[[this.xmax,this.ymin],[this.xmin,this.ymin]]];var i,j,_ef=_ed.paths,_f0=_ef.length,_f1,len;var pi,pj,_f2=new esri.geometry.Point(0,0);for(i=0;i<_f0;i++){_f1=_ef[i];len=_f1.length;pi=_f1[0];_f2.update(pi[0],pi[1]);if(this.contains(_f2)){return true;}for(j=1;j<len;j++){pj=_f1[j];_f2.update(pj[0],pj[1]);if(this.contains(_f2)||this._intersectsLine([pi,pj],_ee)){return true;}pi=pj;}}return false;},_intersectsLine:function(_f3,_f4){var _f5=esri.geometry._getLineIntersection2,i,len=_f4.length;for(i=0;i<len;i++){if(_f5(_f3,_f4[i])){return true;}}return false;},contains:function(_f6){if(!_f6){return false;}var _f7=_f6.type;switch(_f7){case "point":return _f6.x>=this.xmin&&_f6.x<=this.xmax&&_f6.y>=this.ymin&&_f6.y<=this.ymax;case "extent":return this._containsExtent(_f6);}return false;},_containsExtent:function(_f8){var _f9=_f8.xmin,_fa=_f8.ymin,_fb=_f8.xmax,_fc=_f8.ymax,pt1=new esri.geometry.Point(_f9,_fa),pt2=new esri.geometry.Point(_f9,_fc),pt3=new esri.geometry.Point(_fb,_fc),pt4=new esri.geometry.Point(_fb,_fa);if(this.contains(pt1)&&this.contains(pt2)&&this.contains(pt3)&&this.contains(pt4)){return true;}return false;},union:function(_fd){return new esri.geometry.Extent(Math.min(this.xmin,_fd.xmin),Math.min(this.ymin,_fd.ymin),Math.max(this.xmax,_fd.xmax),Math.max(this.ymax,_fd.ymax),this.spatialReference);},getExtent:function(){var sr=this.spatialReference;return new esri.geometry.Extent(this.xmin,this.ymin,this.xmax,this.ymax,sr&&new esri.SpatialReference(sr.toJson()));},_shiftCM:function(_fe){if(!this._shifted){var EG=esri.geometry,_ff=EG.fromJson(this.toJson()),sr=_ff.spatialReference;_fe=_fe||sr._getInfo();if(_fe){var _100=this._getCM(_fe);if(_100){var _101=sr._isWebMercator()?EG.webMercatorToGeographic(_100):_100;_ff.xmin-=_100.x;_ff.xmax-=_100.x;if(!sr._isWebMercator()){_101.x=this._normalizeX(_101.x,_fe).x;}_ff.spatialReference.wkt=esri.substitute({Central_Meridian:_101.x},sr.wkid===4326?_fe.altTemplate:_fe.wkTemplate);_ff.spatialReference.wkid=null;}}this._shifted=_ff;}return this._shifted;},_getCM:function(info){var _102,_103=info.valid[0],_104=info.valid[1],xmin=this.xmin,xmax=this.xmax;var _105=(xmin>=_103&&xmin<=_104),_106=(xmax>=_103&&xmax<=_104);if(!(_105&&_106)){_102=this.getCenter();}return _102;},_normalize:function(_107,_108,info){var EG=esri.geometry,_109=EG.fromJson(this.toJson()),sr=_109.spatialReference;if(sr){info=info||sr._getInfo();if(info){var _10a=_4.map(this._getParts(info),function(part){return part.extent;});if(_10a.length>2){if(_107){return this._shiftCM(info);}else{return _109.update(info.valid[0],_109.ymin,info.valid[1],_109.ymax,sr);}}else{if(_10a.length===2){if(_107){return this._shiftCM(info);}else{return _108?_10a:new EG.Polygon({"rings":_4.map(_10a,function(_10b){return [[_10b.xmin,_10b.ymin],[_10b.xmin,_10b.ymax],[_10b.xmax,_10b.ymax],[_10b.xmax,_10b.ymin],[_10b.xmin,_10b.ymin]];}),"spatialReference":sr});}}else{return _10a[0]||_109;}}}}return _109;},_getParts:function(info){if(!this._parts){var xmin=this.xmin,xmax=this.xmax,ymin=this.ymin,ymax=this.ymax,sr=this.spatialReference,_10c=this.getWidth(),_10d=xmin,_10e=xmax,_10f=0,_110=0,nrml,_111=[],_112,_113,_114;info=info||sr._getInfo();_112=info.valid[0];_113=info.valid[1];nrml=this._normalizeX(xmin,info);xmin=nrml.x;_10f=nrml.frameId;nrml=this._normalizeX(xmax,info);xmax=nrml.x;_110=nrml.frameId;_114=(xmin===xmax&&_10c>0);if(_10c>(2*_113)){var E1=new esri.geometry.Extent(_10d<_10e?xmin:xmax,ymin,_113,ymax,sr),E2=new esri.geometry.Extent(_112,ymin,_10d<_10e?xmax:xmin,ymax,sr),E3=new esri.geometry.Extent(0,ymin,_113,ymax,sr),E4=new esri.geometry.Extent(_112,ymin,0,ymax,sr),k,_115=[],_116=[];if(E1.contains(E3)){_115.push(_10f);}if(E1.contains(E4)){_116.push(_10f);}if(E2.contains(E3)){_115.push(_110);}if(E2.contains(E4)){_116.push(_110);}for(k=_10f+1;k<_110;k++){_115.push(k);_116.push(k);}_111.push({extent:E1,frameIds:[_10f]},{extent:E2,frameIds:[_110]},{extent:E3,frameIds:_115},{extent:E4,frameIds:_116});}else{if((xmin>xmax)||_114){_111.push({extent:new esri.geometry.Extent(xmin,ymin,_113,ymax,sr),frameIds:[_10f]},{extent:new esri.geometry.Extent(_112,ymin,xmax,ymax,sr),frameIds:[_110]});}else{_111.push({extent:new esri.geometry.Extent(xmin,ymin,xmax,ymax,sr),frameIds:[_10f]});}}this._parts=_111;}return this._parts;},_normalizeX:function(x,info){var _117=0,_118=info.valid[0],_119=info.valid[1],_11a=2*_119,_11b;if(x>_119){_11b=Math.ceil(Math.abs(x-_119)/_11a);x-=(_11b*_11a);_117=_11b;}else{if(x<_118){_11b=Math.ceil(Math.abs(x-_118)/_11a);x+=(_11b*_11a);_117=-_11b;}}return {x:x,frameId:_117};},toJson:function(){var json={xmin:this.xmin,ymin:this.ymin,xmax:this.xmax,ymax:this.ymax},sr=this.spatialReference;if(sr){json.spatialReference=sr.toJson();}return json;}});_4.declare("esri.geometry.Rect",esri.geometry.Geometry,{constructor:function(json,y,_11c,_11d,_11e){_4.mixin(this,_6.gfx.defaultRect);if(_4.isObject(json)){_4.mixin(this,json);this.spatialReference=new esri.SpatialReference(this.spatialReference);}else{this.x=json;this.y=y;this.width=_11c;this.height=_11d;this.spatialReference=_11e;}},getCenter:function(){return new esri.geometry.Point(this.x+this.width/2,this.y+this.height/2,this.spatialReference);},offset:function(ox,oy){return new esri.geometry.Rect(this.x+ox,this.y+oy,this.width,this.height,this.spatialReference);},intersects:function(rect){if((rect.x+rect.width)<=this.x){return false;}if((rect.y+rect.height)<=this.y){return false;}if(rect.y>=(this.y+this.height)){return false;}if(rect.x>=(this.x+this.width)){return false;}return true;},getExtent:function(){return esri.geometry._rectToExtent(this);},update:function(x,y,_11f,_120,_121){this.x=x;this.y=y;this.width=_11f;this.height=_120;this.spatialReference=_121;return this;}});}}};});