define(["exports","./GeometryOffsetAttribute-1772960d","./Transforms-d13cc04e","./Matrix2-9aa31791","./RuntimeError-346a3079","./ComponentDatatype-93750d1a","./when-4bbc8319","./EllipseGeometryLibrary-962723df","./GeometryAttribute-43536dc0","./GeometryAttributes-7827a6c2","./GeometryInstance-47b34185","./GeometryPipeline-2356afec","./IndexDatatype-b7d979a6","./VertexFormat-71718faa"],(function(t,e,r,a,i,n,o,s,l,u,m,p,y,c){"use strict";var d=new a.Cartesian3,f=new a.Cartesian3,A=new a.Cartesian3,x=new a.Cartesian3,h=new a.Cartesian2,g=new a.Matrix3,_=new a.Matrix3,b=new r.Quaternion,v=new a.Cartesian3,C=new a.Cartesian3,w=new a.Cartesian3,E=new a.Cartographic,M=new a.Cartesian3,I=new a.Cartesian2,T=new a.Cartesian2;function G(t,i,m){var p=i.vertexFormat,y=i.center,c=i.semiMajorAxis,x=i.semiMinorAxis,G=i.ellipsoid,N=i.stRotation,P=m?t.length/3*2:t.length/3,F=i.shadowVolume,V=p.st?new Float32Array(2*P):void 0,D=p.normal?new Float32Array(3*P):void 0,O=p.tangent?new Float32Array(3*P):void 0,S=p.bitangent?new Float32Array(3*P):void 0,L=F?new Float32Array(3*P):void 0,R=0,j=v,z=C,k=w,B=new r.GeographicProjection(G),Y=B.project(G.cartesianToCartographic(y,E),M),H=G.scaleToGeodeticSurface(y,d);G.geodeticSurfaceNormal(H,H);var U=g,Q=_;if(0!==N){var W=r.Quaternion.fromAxisAngle(H,N,b);U=a.Matrix3.fromQuaternion(W,U),W=r.Quaternion.fromAxisAngle(H,-N,b),Q=a.Matrix3.fromQuaternion(W,Q)}else U=a.Matrix3.clone(a.Matrix3.IDENTITY,U),Q=a.Matrix3.clone(a.Matrix3.IDENTITY,Q);for(var J=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,I),q=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,T),Z=t.length,K=m?Z:0,X=K/3*2,$=0;$1;--i){for(o[s++]=e++,o[s++]=e,o[s++]=a,r=2*i,n=0;nn.CesiumMath.PI&&(d.north=d.north>0?n.CesiumMath.PI_OVER_TWO-n.CesiumMath.EPSILON7:d.north,d.south=d.south<0?n.CesiumMath.EPSILON7-n.CesiumMath.PI_OVER_TWO:d.south,d.east=n.CesiumMath.PI,d.west=-n.CesiumMath.PI),d}function S(t){var e=(t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT)).center,r=o.defaultValue(t.ellipsoid,a.Ellipsoid.WGS84),i=t.semiMajorAxis,s=t.semiMinorAxis,l=o.defaultValue(t.granularity,n.CesiumMath.RADIANS_PER_DEGREE),u=o.defaultValue(t.vertexFormat,c.VertexFormat.DEFAULT),m=o.defaultValue(t.height,0),p=o.defaultValue(t.extrudedHeight,m);this._center=a.Cartesian3.clone(e),this._semiMajorAxis=i,this._semiMinorAxis=s,this._ellipsoid=a.Ellipsoid.clone(r),this._rotation=o.defaultValue(t.rotation,0),this._stRotation=o.defaultValue(t.stRotation,0),this._height=Math.max(p,m),this._granularity=l,this._vertexFormat=c.VertexFormat.clone(u),this._extrudedHeight=Math.min(p,m),this._shadowVolume=o.defaultValue(t.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}S.packedLength=a.Cartesian3.packedLength+a.Ellipsoid.packedLength+c.VertexFormat.packedLength+9,S.pack=function(t,e,r){return r=o.defaultValue(r,0),a.Cartesian3.pack(t._center,e,r),r+=a.Cartesian3.packedLength,a.Ellipsoid.pack(t._ellipsoid,e,r),r+=a.Ellipsoid.packedLength,c.VertexFormat.pack(t._vertexFormat,e,r),r+=c.VertexFormat.packedLength,e[r++]=t._semiMajorAxis,e[r++]=t._semiMinorAxis,e[r++]=t._rotation,e[r++]=t._stRotation,e[r++]=t._height,e[r++]=t._granularity,e[r++]=t._extrudedHeight,e[r++]=t._shadowVolume?1:0,e[r]=o.defaultValue(t._offsetAttribute,-1),e};var L=new a.Cartesian3,R=new a.Ellipsoid,j=new c.VertexFormat,z={center:L,ellipsoid:R,vertexFormat:j,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};S.unpack=function(t,e,r){e=o.defaultValue(e,0);var i=a.Cartesian3.unpack(t,e,L);e+=a.Cartesian3.packedLength;var n=a.Ellipsoid.unpack(t,e,R);e+=a.Ellipsoid.packedLength;var s=c.VertexFormat.unpack(t,e,j);e+=c.VertexFormat.packedLength;var l=t[e++],u=t[e++],m=t[e++],p=t[e++],y=t[e++],d=t[e++],f=t[e++],A=1===t[e++],x=t[e];return o.defined(r)?(r._center=a.Cartesian3.clone(i,r._center),r._ellipsoid=a.Ellipsoid.clone(n,r._ellipsoid),r._vertexFormat=c.VertexFormat.clone(s,r._vertexFormat),r._semiMajorAxis=l,r._semiMinorAxis=u,r._rotation=m,r._stRotation=p,r._height=y,r._granularity=d,r._extrudedHeight=f,r._shadowVolume=A,r._offsetAttribute=-1===x?void 0:x,r):(z.height=y,z.extrudedHeight=f,z.granularity=d,z.stRotation=p,z.rotation=m,z.semiMajorAxis=l,z.semiMinorAxis=u,z.shadowVolume=A,z.offsetAttribute=-1===x?void 0:x,new S(z))},S.computeRectangle=function(t,e){var r=(t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT)).center,i=o.defaultValue(t.ellipsoid,a.Ellipsoid.WGS84),s=t.semiMajorAxis,l=t.semiMinorAxis,u=o.defaultValue(t.granularity,n.CesiumMath.RADIANS_PER_DEGREE);return O(r,s,l,o.defaultValue(t.rotation,0),u,i,e)},S.createGeometry=function(t){if(!(t._semiMajorAxis<=0||t._semiMinorAxis<=0)){var i=t._height,u=t._extrudedHeight,m=!n.CesiumMath.equalsEpsilon(i,u,0,n.CesiumMath.EPSILON2);t._center=t._ellipsoid.scaleToGeodeticSurface(t._center,t._center);var p,c={center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:t._ellipsoid,rotation:t._rotation,height:i,granularity:t._granularity,vertexFormat:t._vertexFormat,stRotation:t._stRotation};if(m)c.extrudedHeight=u,c.shadowVolume=t._shadowVolume,c.offsetAttribute=t._offsetAttribute,p=D(c);else if(p=function(t){var e=t.center;P=a.Cartesian3.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(e,P),t.height,P),P=a.Cartesian3.add(e,P,P);var i=new r.BoundingSphere(P,t.semiMajorAxis),n=s.EllipseGeometryLibrary.computeEllipsePositions(t,!0,!1),o=n.positions,l=n.numPts,u=G(o,t,!1),m=N(l);return{boundingSphere:i,attributes:u,indices:m=y.IndexDatatype.createTypedArray(o.length/3,m)}}(c),o.defined(t._offsetAttribute)){var d=p.attributes.position.values.length,f=new Uint8Array(d/3),A=t._offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(f,A),p.attributes.applyOffset=new l.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new l.Geometry({attributes:p.attributes,indices:p.indices,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:p.boundingSphere,offsetAttribute:t._offsetAttribute})}},S.createShadowVolume=function(t,e,r){var a=t._granularity,i=t._ellipsoid,n=e(a,i),o=r(a,i);return new S({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:i,rotation:t._rotation,stRotation:t._stRotation,granularity:a,extrudedHeight:n,height:o,vertexFormat:c.VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(S.prototype,{rectangle:{get:function(){return o.defined(this._rectangle)||(this._rectangle=O(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return o.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(t){var e=-t._stRotation;if(0===e)return[0,0,0,1,1,0];for(var r=s.EllipseGeometryLibrary.computeEllipsePositions({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,rotation:t._rotation,granularity:t._granularity},!1,!0).outerPositions,i=r.length/3,n=new Array(i),o=0;o