define(["exports","./defaultValue-865ac579","./Math-76ce6367"],(function(e,t,n){"use strict";const i={ellipsoidCoordinates:null,isMoon:function(){return"MOON2000"===i.ellipsoidCoordinates}};var r=i;function a(e,n,i){this.x=t.defaultValue(e,0),this.y=t.defaultValue(n,0),this.z=t.defaultValue(i,0)}a.fromSpherical=function(e,n){t.defined(n)||(n=new a);const i=e.clock,r=e.cone,o=t.defaultValue(e.magnitude,1),u=o*Math.sin(r);return n.x=u*Math.cos(i),n.y=u*Math.sin(i),n.z=o*Math.cos(r),n},a.fromElements=function(e,n,i,r){return t.defined(r)?(r.x=e,r.y=n,r.z=i,r):new a(e,n,i)},a.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z)},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,i){return i=t.defaultValue(i,0),n[i++]=e.x,n[i++]=e.y,n[i]=e.z,n},a.unpack=function(e,n,i){return n=t.defaultValue(n,0),t.defined(i)||(i=new a),i.x=e[n++],i.y=e[n++],i.z=e[n],i},a.packArray=function(e,n){const i=e.length,r=3*i;t.defined(n)?(Array.isArray(n)||n.length===r)&&n.length!==r&&(n.length=r):n=new Array(r);for(let t=0;tn.CesiumMath.EPSILON12);return t.defined(u)?(u.x=s*b,u.y=c*E,u.z=d*T,u):new a(s*b,c*E,d*T)}function z(e,n,i){this.longitude=t.defaultValue(e,0),this.latitude=t.defaultValue(n,0),this.height=t.defaultValue(i,0)}z.fromRadians=function(e,n,i,r){return i=t.defaultValue(i,0),t.defined(r)?(r.longitude=e,r.latitude=n,r.height=i,r):new z(e,n,i)},z.fromDegrees=function(e,t,i,r){return e=n.CesiumMath.toRadians(e),t=n.CesiumMath.toRadians(t),z.fromRadians(e,t,i,r)};const M=new a,w=new a,S=new a,C=new a(1/6378137,1/6378137,1/6356752.314245179),O=new a(1/40680631590769,1/40680631590769,1/40408299984661.445),R=new a(1/1737400,1/1737400,1/1737400),q=new a(1/301855876e4,1/301855876e4,1/301855876e4),_=new a(1/6378137,1/6378137,1/6356752.314140356),b=new a(1/40680631590769,1/40680631590769,1/40408299983328.77),E=n.CesiumMath.EPSILON1;function T(e,i,r,o){i=t.defaultValue(i,0),r=t.defaultValue(r,0),o=t.defaultValue(o,0),e._radii=new a(i,r,o),e._radiiSquared=new a(i*i,r*r,o*o),e._radiiToTheFourth=new a(i*i*i*i,r*r*r*r,o*o*o*o),e._oneOverRadii=new a(0===i?0:1/i,0===r?0:1/r,0===o?0:1/o),e._oneOverRadiiSquared=new a(0===i?0:1/(i*i),0===r?0:1/(r*r),0===o?0:1/(o*o)),e._minimumRadius=Math.min(i,r,o),e._maximumRadius=Math.max(i,r,o),e._centerToleranceSquared=n.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function N(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,T(this,e,t,n)}z.fromCartesian=function(e,i,o){let u=null,s=null;const c=t.defined(i)?i._centerToleranceSquared:E;"CGCS2000"===r.ellipsoidCoordinates?(u=_,s=b):"MOON"===r.ellipsoidCoordinates||"MOON2000"===r.ellipsoidCoordinates?(u=R,s=q):(u=t.defined(i)?i.oneOverRadii:C,s=t.defined(i)?i.oneOverRadiiSquared:O);const d=x(e,u,s,c,w);if(!t.defined(d))return;let l=a.multiplyComponents(d,s,M);l=a.normalize(l,l);const f=a.subtract(e,d,S),h=Math.atan2(l.y,l.x),m=Math.asin(l.z),y=n.CesiumMath.sign(a.dot(f,e))*a.magnitude(f);return t.defined(o)?(o.longitude=h,o.latitude=m,o.height=y,o):new z(h,m,y)},z.toCartesian=function(e,t,n){return a.fromRadians(e.longitude,e.latitude,e.height,t,n)},z.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new z(e.longitude,e.latitude,e.height)},z.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},z.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e.longitude-n.longitude)<=i&&Math.abs(e.latitude-n.latitude)<=i&&Math.abs(e.height-n.height)<=i},z.ZERO=Object.freeze(new z(0,0,0)),z.prototype.clone=function(e){return z.clone(this,e)},z.prototype.equals=function(e){return z.equals(this,e)},z.prototype.equalsEpsilon=function(e,t){return z.equalsEpsilon(this,e,t)},z.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(N.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),N.clone=function(e,n){if(!t.defined(e))return;const i=e._radii;return t.defined(n)?(a.clone(i,n._radii),a.clone(e._radiiSquared,n._radiiSquared),a.clone(e._radiiToTheFourth,n._radiiToTheFourth),a.clone(e._oneOverRadii,n._oneOverRadii),a.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new N(i.x,i.y,i.z)},N.fromCartesian3=function(e,n){return t.defined(n)||(n=new N),t.defined(e)?(T(n,e.x,e.y,e.z),n):n},N.WGS84=Object.freeze(new N(6378137,6378137,6356752.314245179)),N.CGCS2000=Object.freeze(new N(6378137,6378137,6356752.314140356)),N.MOON2000=Object.freeze(new N(1737400,1737400,1737400)),N.UNIT_SPHERE=Object.freeze(new N(1,1,1)),N.MOON=Object.freeze(new N(n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS)),N.prototype.clone=function(e){return N.clone(this,e)},N.packedLength=a.packedLength,N.pack=function(e,n,i){return i=t.defaultValue(i,0),a.pack(e._radii,n,i),n},N.unpack=function(e,n,i){n=t.defaultValue(n,0);const r=a.unpack(e,n);return N.fromCartesian3(r,i)},N.prototype.geocentricSurfaceNormal=a.normalize,N.prototype.geodeticSurfaceNormalCartographic=function(e,n){const i=e.longitude,r=e.latitude,o=Math.cos(r),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(r);return t.defined(n)||(n=new a),n.x=u,n.y=s,n.z=c,a.normalize(n,n)},N.prototype.geodeticSurfaceNormal=function(e,i){if(!a.equalsEpsilon(e,a.ZERO,n.CesiumMath.EPSILON14))return t.defined(i)||(i=new a),i=a.multiplyComponents(e,this._oneOverRadiiSquared,i),a.normalize(i,i)};const A=new a,v=new a;N.prototype.cartographicToCartesian=function(e,n){const i=A,r=v;this.geodeticSurfaceNormalCartographic(e,i),a.multiplyComponents(this._radiiSquared,i,r);const o=Math.sqrt(a.dot(i,r));return a.divideByScalar(r,o,r),a.multiplyByScalar(i,e.height,i),t.defined(n)||(n=new a),a.add(r,i,n)},N.prototype.cartographicArrayToCartesianArray=function(e,n){const i=e.length;t.defined(n)?n.length=i:n=new Array(i);for(let t=0;t=this._radii.z-n))return i};const k=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],L=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function B(e,t,n){const i=.5*(t+e),r=.5*(t-e);let a=0;for(let e=0;e<5;e++){const t=r*k[e];a+=L[e]*(n(i+t)+n(i-t))}return a*=r,a}function j(e,n,i,r,a,o,u,s,c){this[0]=t.defaultValue(e,0),this[1]=t.defaultValue(r,0),this[2]=t.defaultValue(u,0),this[3]=t.defaultValue(n,0),this[4]=t.defaultValue(a,0),this[5]=t.defaultValue(s,0),this[6]=t.defaultValue(i,0),this[7]=t.defaultValue(o,0),this[8]=t.defaultValue(c,0)}N.prototype.surfaceArea=function(e){const t=e.west;let i=e.east;const r=e.south,a=e.north;for(;ir&&(a=t,r=n)}let o=1,u=0;const s=G[a],c=X[a];if(Math.abs(e[j.getElementIndex(c,s)])>i){const t=(e[j.getElementIndex(c,c)]-e[j.getElementIndex(s,s)])/2/e[j.getElementIndex(c,s)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),u=n*o}return(t=j.clone(j.IDENTITY,t))[j.getElementIndex(s,s)]=t[j.getElementIndex(c,c)]=o,t[j.getElementIndex(c,s)]=u,t[j.getElementIndex(s,c)]=-u,t}const Q=new j,J=new j;j.computeEigenDecomposition=function(e,i){const r=n.CesiumMath.EPSILON20;let a=0,o=0;t.defined(i)||(i={});const u=i.unitary=j.clone(j.IDENTITY,i.unitary),s=i.diagonal=j.clone(e,i.diagonal),c=r*function(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}(s);for(;o<10&&Y(s)>c;)H(s,Q),j.transpose(Q,J),j.multiply(s,Q,s),j.multiply(J,s,s),j.multiply(u,Q,u),++a>2&&(++o,a=0);return i},j.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},j.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+r*(s*i-n*c)+u*(n*o-a*i)},j.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],u=e[5],s=e[6],c=e[7],d=e[8],l=j.determinant(e);t[0]=o*d-c*u,t[1]=c*r-i*d,t[2]=i*u-o*r,t[3]=s*u-a*d,t[4]=n*d-s*r,t[5]=a*r-n*u,t[6]=a*c-s*o,t[7]=s*i-n*c,t[8]=n*o-a*i;const f=1/l;return j.multiplyByScalar(t,f,t)};const K=new j;j.inverseTranspose=function(e,t){return j.inverse(j.transpose(e,K),t)},j.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&e[4]===n[4]&&e[5]===n[5]&&e[6]===n[6]&&e[7]===n[7]&&e[8]===n[8]},j.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e[0]-n[0])<=i&&Math.abs(e[1]-n[1])<=i&&Math.abs(e[2]-n[2])<=i&&Math.abs(e[3]-n[3])<=i&&Math.abs(e[4]-n[4])<=i&&Math.abs(e[5]-n[5])<=i&&Math.abs(e[6]-n[6])<=i&&Math.abs(e[7]-n[7])<=i&&Math.abs(e[8]-n[8])<=i},j.IDENTITY=Object.freeze(new j(1,0,0,0,1,0,0,0,1)),j.ZERO=Object.freeze(new j(0,0,0,0,0,0,0,0,0)),j.COLUMN0ROW0=0,j.COLUMN0ROW1=1,j.COLUMN0ROW2=2,j.COLUMN1ROW0=3,j.COLUMN1ROW1=4,j.COLUMN1ROW2=5,j.COLUMN2ROW0=6,j.COLUMN2ROW1=7,j.COLUMN2ROW2=8,Object.defineProperties(j.prototype,{length:{get:function(){return j.packedLength}}}),j.prototype.clone=function(e){return j.clone(this,e)},j.prototype.equals=function(e){return j.equals(this,e)},j.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},j.prototype.equalsEpsilon=function(e,t){return j.equalsEpsilon(this,e,t)},j.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},e.Cartesian3=a,e.Cartographic=z,e.Ellipsoid=N,e.Matrix3=j}));