define(["exports","./Cartesian2-bd414876","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(t,e,a,n,s){"use strict";function u(t,e,a,s){this.west=n.defaultValue(t,0),this.south=n.defaultValue(e,0),this.east=n.defaultValue(a,0),this.north=n.defaultValue(s,0)}Object.defineProperties(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(t,e,a){return a=n.defaultValue(a,0),e[a++]=t.west,e[a++]=t.south,e[a++]=t.east,e[a]=t.north,e},u.unpack=function(t,e,a){return e=n.defaultValue(e,0),n.defined(a)||(a=new u),a.west=t[e++],a.south=t[e++],a.east=t[e++],a.north=t[e],a},u.computeWidth=function(t){let e=t.east;const a=t.west;return e=0?n.longitude:n.longitude+s.CesiumMath.TWO_PI;o=Math.min(o,u),h=Math.max(h,u)}return i-a>h-o&&(a=o,i=h,i>s.CesiumMath.PI&&(i-=s.CesiumMath.TWO_PI),a>s.CesiumMath.PI&&(a-=s.CesiumMath.TWO_PI)),n.defined(e)?(e.west=a,e.south=r,e.east=i,e.north=d,e):new u(a,r,i,d)},u.fromCartesianArray=function(t,a,i){a=n.defaultValue(a,e.Ellipsoid.WGS84);let o=Number.MAX_VALUE,h=-Number.MAX_VALUE,r=Number.MAX_VALUE,d=-Number.MAX_VALUE,l=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let e=0,n=t.length;e=0?n.longitude:n.longitude+s.CesiumMath.TWO_PI;r=Math.min(r,u),d=Math.max(d,u)}return h-o>d-r&&(o=r,h=d,h>s.CesiumMath.PI&&(h-=s.CesiumMath.TWO_PI),o>s.CesiumMath.PI&&(o-=s.CesiumMath.TWO_PI)),n.defined(i)?(i.west=o,i.south=l,i.east=h,i.north=c,i):new u(o,l,h,c)},u.clone=function(t,e){if(n.defined(t))return n.defined(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new u(t.west,t.south,t.east,t.north)},u.equalsEpsilon=function(t,e,a){return a=n.defaultValue(a,0),t===e||n.defined(t)&&n.defined(e)&&Math.abs(t.west-e.west)<=a&&Math.abs(t.south-e.south)<=a&&Math.abs(t.east-e.east)<=a&&Math.abs(t.north-e.north)<=a},u.prototype.clone=function(t){return u.clone(this,t)},u.prototype.equals=function(t){return u.equals(this,t)},u.equals=function(t,e){return t===e||n.defined(t)&&n.defined(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},u.prototype.equalsEpsilon=function(t,e){return u.equalsEpsilon(this,t,e)},u.validate=function(t){},u.southwest=function(t,a){return n.defined(a)?(a.longitude=t.west,a.latitude=t.south,a.height=0,a):new e.Cartographic(t.west,t.south)},u.northwest=function(t,a){return n.defined(a)?(a.longitude=t.west,a.latitude=t.north,a.height=0,a):new e.Cartographic(t.west,t.north)},u.northeast=function(t,a){return n.defined(a)?(a.longitude=t.east,a.latitude=t.north,a.height=0,a):new e.Cartographic(t.east,t.north)},u.southeast=function(t,a){return n.defined(a)?(a.longitude=t.east,a.latitude=t.south,a.height=0,a):new e.Cartographic(t.east,t.south)},u.center=function(t,a){let u=t.east;const i=t.west;u0?i+=s.CesiumMath.TWO_PI:h0&&(h+=s.CesiumMath.TWO_PI),i=m?void 0:n.defined(a)?(a.west=d,a.south=c,a.east=l,a.north=m,a):new u(d,c,l,m)},u.simpleIntersection=function(t,e,a){const s=Math.max(t.west,e.west),i=Math.max(t.south,e.south),o=Math.min(t.east,e.east),h=Math.min(t.north,e.north);if(!(i>=h||s>=o))return n.defined(a)?(a.west=s,a.south=i,a.east=o,a.north=h,a):new u(s,i,o,h)},u.union=function(t,e,a){n.defined(a)||(a=new u);let i=t.east,o=t.west,h=e.east,r=e.west;i0?i+=s.CesiumMath.TWO_PI:h0&&(h+=s.CesiumMath.TWO_PI),iu||s.CesiumMath.equalsEpsilon(a,u,s.CesiumMath.EPSILON14))&&(a=t.south&&n<=t.north};const i=new e.Cartographic;u.subsample=function(t,a,o,h){a=n.defaultValue(a,e.Ellipsoid.WGS84),o=n.defaultValue(o,0),n.defined(h)||(h=[]);let r=0;const d=t.north,l=t.south,c=t.east,m=t.west,M=i;M.height=o,M.longitude=m,M.latitude=d,h[r]=a.cartographicToCartesian(M,h[r]),r++,M.longitude=c,h[r]=a.cartographicToCartesian(M,h[r]),r++,M.latitude=l,h[r]=a.cartographicToCartesian(M,h[r]),r++,M.longitude=m,h[r]=a.cartographicToCartesian(M,h[r]),r++,M.latitude=d<0?d:l>0?l:0;for(let e=1;e<8;++e)M.longitude=-Math.PI+e*s.CesiumMath.PI_OVER_TWO,u.contains(t,M)&&(h[r]=a.cartographicToCartesian(M,h[r]),r++);return 0===M.latitude&&(M.longitude=m,h[r]=a.cartographicToCartesian(M,h[r]),r++,M.longitude=c,h[r]=a.cartographicToCartesian(M,h[r]),r++),h.length=r,h},u.subsection=function(t,e,a,i,o,h){if(n.defined(h)||(h=new u),t.west<=t.east){const a=t.east-t.west;h.west=t.west+e*a,h.east=t.west+i*a}else{const a=s.CesiumMath.TWO_PI+t.east-t.west;h.west=s.CesiumMath.negativePiToPi(t.west+e*a),h.east=s.CesiumMath.negativePiToPi(t.west+i*a)}const r=t.north-t.south;return h.south=t.south+a*r,h.north=t.south+o*r,1===e&&(h.west=t.east),1===i&&(h.east=t.east),1===a&&(h.south=t.north),1===o&&(h.north=t.north),h},u.MAX_VALUE=Object.freeze(new u(-Math.PI,-s.CesiumMath.PI_OVER_TWO,Math.PI,s.CesiumMath.PI_OVER_TWO)),t.Rectangle=u}));