text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/4.8/esri/copyright.txt for details.
  //>>built
  define("require exports ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../core/lang ../core/accessorSupport/decorators ./Geometry ./Point ./SpatialReference ./support/contains ./support/intersects ./support/spatialReferenceUtils ./support/webMercatorUtils".split(" "),function(m,C,x,e,y,f,z,A,u,w,B,v,h){function k(f,b,e){return null==b?e:null==e?b:f(b,e)}m=function(m){function b(){for(var a=0;a<arguments.length;a++);a=m.call(this)||this;a.type="extent";a.xmin=0;a.ymin=0;a.mmin=
  void 0;a.zmin=void 0;a.xmax=0;a.ymax=0;a.mmax=void 0;a.zmax=void 0;return a}x(b,m);n=b;b.prototype.normalizeCtorArgs=function(a,c,d,b,g){return!a||"esri.geometry.SpatialReference"!==a.declaredClass&&null==a.wkid?"object"===typeof a?(a.spatialReference=null!=a.spatialReference?a.spatialReference:u.WGS84,a):{xmin:a,ymin:c,xmax:d,ymax:b,spatialReference:null!=g?g:u.WGS84}:{spatialReference:a,xmin:0,ymin:0,xmax:0,ymax:0}};Object.defineProperty(b.prototype,"center",{get:function(){var a=new A({x:.5*(this.xmin+
  this.xmax),y:.5*(this.ymin+this.ymax),spatialReference:this.spatialReference});this.hasZ&&(a.z=.5*(this.zmin+this.zmax));this.hasM&&(a.m=.5*(this.mmin+this.mmax));return a},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"extent",{get:function(){return this.clone()},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"hasM",{get:function(){return null!=this.mmin&&null!=this.mmax},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"hasZ",{get:function(){return null!=
  this.zmin&&null!=this.zmax},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"height",{get:function(){return Math.abs(this.ymax-this.ymin)},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"width",{get:function(){return Math.abs(this.xmax-this.xmin)},enumerable:!0,configurable:!0});b.prototype.centerAt=function(a){var c=this.center;return null!=a.z&&this.hasZ?this.offset(a.x-c.x,a.y-c.y,a.z-c.z):this.offset(a.x-c.x,a.y-c.y)};b.prototype.clone=function(){var a=new n;
  a.xmin=this.xmin;a.ymin=this.ymin;a.xmax=this.xmax;a.ymax=this.ymax;a.spatialReference=this.spatialReference;null!=this.zmin&&(a.zmin=this.zmin,a.zmax=this.zmax);null!=this.mmin&&(a.mmin=this.mmin,a.mmax=this.mmax);return a};b.prototype.contains=function(a){if(!a)return!1;var c=this.spatialReference,d=a.spatialReference;c&&d&&!c.equals(d)&&h.canProject(c,d)&&(a=c.isWebMercator?h.geographicToWebMercator(a):h.webMercatorToGeographic(a,!0));return"point"===a.type?w.extentContainsPoint(this,a):"extent"===
  a.type?w.extentContainsExtent(this,a):!1};b.prototype.equals=function(a){if(!a)return!1;var c=this.spatialReference,d=a.spatialReference;c&&d&&!c.equals(d)&&h.canProject(c,d)&&(a=c.isWebMercator?h.geographicToWebMercator(a):h.webMercatorToGeographic(a,!0));return this.xmin===a.xmin&&this.ymin===a.ymin&&this.zmin===a.zmin&&this.mmin===a.mmin&&this.xmax===a.xmax&&this.ymax===a.ymax&&this.zmax===a.zmax&&this.mmax===a.mmax};b.prototype.expand=function(a){a=.5*(1-a);var c=this.width*a,d=this.height*a;
  this.xmin+=c;this.ymin+=d;this.xmax-=c;this.ymax-=d;this.hasZ&&(c=(this.zmax-this.zmin)*a,this.zmin+=c,this.zmax-=c);this.hasM&&(a*=this.mmax-this.mmin,this.mmin+=a,this.mmax-=a);return this};b.prototype.intersects=function(a){if(!a)return!1;var c=this.spatialReference,d=a.spatialReference;c&&d&&!c.equals(d)&&h.canProject(c,d)&&(a=c.isWebMercator?h.geographicToWebMercator(a):h.webMercatorToGeographic(a,!0));c=B.getExtentIntersector(a.type);return"mesh"!==a.type?c(this,a):c(this,a.extent)};b.prototype.normalize=
  function(){var a=this._normalize(!1,!0);return Array.isArray(a)?a:[a]};b.prototype.offset=function(a,c,d){this.xmin+=a;this.ymin+=c;this.xmax+=a;this.ymax+=c;null!=d&&(this.zmin+=d,this.zmax+=d);return this};b.prototype.shiftCentralMeridian=function(){return this._normalize(!0)};b.prototype.union=function(a){this.xmin=Math.min(this.xmin,a.xmin);this.ymin=Math.min(this.ymin,a.ymin);this.xmax=Math.max(this.xmax,a.xmax);this.ymax=Math.max(this.ymax,a.ymax);if(this.hasZ||a.hasZ)this.zmin=k(Math.min,this.zmin,
  a.zmin),this.zmax=k(Math.max,this.zmax,a.zmax);if(this.hasM||a.hasM)this.mmin=k(Math.min,this.mmin,a.mmin),this.mmax=k(Math.max,this.mmax,a.mmax);return this};b.prototype.intersection=function(a){if(!this.intersects(a))return null;this.xmin=Math.max(this.xmin,a.xmin);this.ymin=Math.max(this.ymin,a.ymin);this.xmax=Math.min(this.xmax,a.xmax);this.ymax=Math.min(this.ymax,a.ymax);if(this.hasZ||a.hasZ)this.zmin=k(Math.max,this.zmin,a.zmin),this.zmax=k(Math.min,this.zmax,a.zmax);if(this.hasM||a.hasM)this.mmin=
  k(Math.max,this.mmin,a.mmin),this.mmax=k(Math.min,this.mmax,a.mmax);return this};b.prototype.toJSON=function(a){return this.write(null,a)};b.prototype._shiftCM=function(a){void 0===a&&(a=v.getInfo(this.spatialReference));if(!a||!this.spatialReference)return this;var c=this.spatialReference,d=this._getCM(a);if(d){var b=c.isWebMercator?h.webMercatorToGeographic(d):d;this.xmin-=d.x;this.xmax-=d.x;c.isWebMercator||(b.x=this._normalizeX(b.x,a).x);this.spatialReference=new u(y.substitute({Central_Meridian:b.x},
  c.isWGS84?a.altTemplate:a.wkTemplate))}return this};b.prototype._getCM=function(a){var c=null,d=a.valid;a=d[0];var d=d[1],b=this.xmin,g=this.xmax;b>=a&&b<=d&&g>=a&&g<=d||(c=this.center);return c};b.prototype._normalize=function(a,c,d){var b=this.spatialReference;if(!b)return this;d=d||v.getInfo(b);if(!d)return this;var g=this._getParts(d).map(function(a){return a.extent});if(2>g.length)return g[0]||this;if(2<g.length)return a?this._shiftCM(d):this.set({xmin:d.valid[0],xmax:d.valid[1]});if(a)return this._shiftCM(d);
  if(c)return g;var e=!0,f=!0;g.forEach(function(a){a.hasZ||(e=!1);a.hasM||(f=!1)});return{rings:g.map(function(a){var c=[[a.xmin,a.ymin],[a.xmin,a.ymax],[a.xmax,a.ymax],[a.xmax,a.ymin],[a.xmin,a.ymin]];if(e)for(var d=(a.zmax-a.zmin)/2,b=0;b<c.length;b++)c[b].push(d);if(f)for(a=(a.mmax-a.mmin)/2,b=0;b<c.length;b++)c[b].push(a);return c}),hasZ:e,hasM:f,spatialReference:b}};b.prototype._getParts=function(a){var c=this.cache._parts;if(!c){var c=[],b=this.ymin,e=this.ymax,g=this.spatialReference,f=this.width,
  h=this.xmin,k=this.xmax,p=void 0;a=a||v.getInfo(g);var l=a.valid,q=l[0],m=l[1],p=this._normalizeX(this.xmin,a),r=p.x,l=p.frameId,p=this._normalizeX(this.xmax,a),t=p.x;a=p.frameId;p=r===t&&0<f;if(f>2*m){f=new n(h<k?r:t,b,m,e,g);h=new n(q,b,h<k?t:r,e,g);k=new n(0,b,m,e,g);b=new n(q,b,0,e,g);e=[];g=[];f.contains(k)&&e.push(l);f.contains(b)&&g.push(l);h.contains(k)&&e.push(a);h.contains(b)&&g.push(a);for(q=l+1;q<a;q++)e.push(q),g.push(q);c.push({extent:f,frameIds:[l]},{extent:h,frameIds:[a]},{extent:k,
  frameIds:e},{extent:b,frameIds:g})}else r>t||p?c.push({extent:new n(r,b,m,e,g),frameIds:[l]},{extent:new n(q,b,t,e,g),frameIds:[a]}):c.push({extent:new n(r,b,t,e,g),frameIds:[l]});this.cache._parts=c}a=this.hasZ;b=this.hasM;if(a||b)for(l={},a&&(l.zmin=this.zmin,l.zmax=this.zmax),b&&(l.mmin=this.mmin,l.mmax=this.mmax),a=0;a<c.length;a++)c[a].extent.set(l);return c};b.prototype._normalizeX=function(a,b){var c=b.valid;b=c[0];var e=c[1],c=2*e,f=0;a>e?(b=Math.ceil(Math.abs(a-e)/c),a-=b*c,f=b):a<b&&(b=
  Math.ceil(Math.abs(a-b)/c),a+=b*c,f=-b);return{x:a,frameId:f}};e([f.property({dependsOn:"xmin ymin zmin mmin xmax ymax zmax mmax spatialReference".split(" ")})],b.prototype,"cache",void 0);e([f.property({readOnly:!0,dependsOn:["cache"]})],b.prototype,"center",null);e([f.property({readOnly:!0,dependsOn:["cache"]})],b.prototype,"extent",null);e([f.property({readOnly:!0,dependsOn:["mmin","mmax"],json:{write:{enabled:!1,overridePolicy:null}}})],b.prototype,"hasM",null);e([f.property({readOnly:!0,dependsOn:["zmin",
  "zmax"],json:{write:{enabled:!1,overridePolicy:null}}})],b.prototype,"hasZ",null);e([f.property({readOnly:!0,dependsOn:["ymin","ymax"]})],b.prototype,"height",null);e([f.property({readOnly:!0,dependsOn:["xmin","xmax"]})],b.prototype,"width",null);e([f.property({type:Number,json:{write:!0}})],b.prototype,"xmin",void 0);e([f.property({type:Number,json:{write:!0}})],b.prototype,"ymin",void 0);e([f.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy:function(){return{enabled:this.hasM}}}}})],
  b.prototype,"mmin",void 0);e([f.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy:function(){return{enabled:this.hasZ}}}}})],b.prototype,"zmin",void 0);e([f.property({type:Number,json:{write:!0}})],b.prototype,"xmax",void 0);e([f.property({type:Number,json:{write:!0}})],b.prototype,"ymax",void 0);e([f.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy:function(){return{enabled:this.hasM}}}}})],b.prototype,"mmax",void 0);e([f.property({type:Number,
  json:{origins:{"web-scene":{write:!1}},write:{overridePolicy:function(){return{enabled:this.hasZ}}}}})],b.prototype,"zmax",void 0);return b=n=e([f.subclass("esri.geometry.Extent")],b);var n}(f.declared(z));m.prototype.toJSON.isDefaultToJSON=!0;return m});