define(["./AxisAlignedBoundingBox-ebc959c9","./Transforms-0becfc64","./Matrix2-860854d4","./when-4bbc8319","./TerrainEncoding-f1aea1f9","./ComponentDatatype-8f55628c","./OrientedBoundingBox-07e6723c","./RuntimeError-1349fdaf","./WebMercatorProjection-be9aaee9","./createTaskProcessorWorker","./combine-e9466e32","./AttributeCompression-5f6be9e6","./WebGLConstants-508b9636","./EllipsoidTangentPlane-407b38a6","./IntersectionTests-1d677ce2","./Plane-0e4269ac"],(function(t,e,n,i,o,r,a,s,c,u,h,l,d,g,m,p){"use strict";const I=Uint16Array.BYTES_PER_ELEMENT,f=Int32Array.BYTES_PER_ELEMENT,E=Uint32Array.BYTES_PER_ELEMENT,T=Float32Array.BYTES_PER_ELEMENT,C=Float64Array.BYTES_PER_ELEMENT;function M(t,e,n){n=i.defaultValue(n,r.CesiumMath);const o=t.length;for(let i=0;i0&&a.push(a[E]),s.length>0&&s.push(s[E]),n.Matrix4.multiplyByPoint(u.toENU,S,N);const w=u.minimum,B=u.maximum;n.Cartesian3.minimumByComponent(N,w,w),n.Cartesian3.maximumByComponent(N,B,B);const P=u.lastBorderPoint;if(i.defined(P)){const t=P.index;c.push(t,T-1,T,T,E,t)}u.lastBorderPoint=I}}return u((function(u,h){u.ellipsoid=n.Ellipsoid.clone(u.ellipsoid),u.rectangle=n.Rectangle.clone(u.rectangle);const l=function(u,h,l,d,g,m,p,P,A,y,R){let _,W,v,F,O,Y;i.defined(d)?(_=d.west,W=d.south,v=d.east,F=d.north,O=d.width,Y=d.height):(_=r.CesiumMath.toRadians(g.west),W=r.CesiumMath.toRadians(g.south),v=r.CesiumMath.toRadians(g.east),F=r.CesiumMath.toRadians(g.north),O=r.CesiumMath.toRadians(d.width),Y=r.CesiumMath.toRadians(d.height));const U=[W,F],V=[_,v],k=e.Transforms.eastNorthUpToFixedFrame(h,l),H=n.Matrix4.inverseTransformation(k,w);let L,D;A&&(L=c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(W),D=1/(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F)-L));const G=1!==m,j=new DataView(u);let z=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY;const J=b;J.x=Number.POSITIVE_INFINITY,J.y=Number.POSITIVE_INFINITY,J.z=Number.POSITIVE_INFINITY;const K=S;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;let Q,X,Z=0,$=0,tt=0;for(X=0;X<4;++X){let t=Z;Q=j.getUint32(t,!0),t+=E;const e=r.CesiumMath.toRadians(180*j.getFloat64(t,!0));t+=C,-1===M(V,e)&&V.push(e);const n=r.CesiumMath.toRadians(180*j.getFloat64(t,!0));t+=C,-1===M(U,n)&&U.push(n),t+=2*C;let i=j.getInt32(t,!0);t+=f,$+=i,i=j.getInt32(t,!0),tt+=3*i,Z+=Q+E}const et=[],nt=[],it=new Array($),ot=new Array($),rt=new Array($),at=A?new Array($):[],st=G?new Array($):[],ct=new Array(tt),ut=[],ht=[],lt=[],dt=[];let gt=0,mt=0;for(Z=0,X=0;X<4;++X){Q=j.getUint32(Z,!0),Z+=E;const t=Z,e=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=C;const i=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=C;const o=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),a=.5*o;Z+=C;const u=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),h=.5*u;Z+=C;const d=j.getInt32(Z,!0);Z+=f;const g=j.getInt32(Z,!0);Z+=f,Z+=f;const m=new Array(d);for(let t=0;t0&&dt.length>0){const t=ut[0].index,e=pt,n=dt[dt.length-1].index,i=it.length-1;ct.push(n,i,e,e,t,n)}$=it.length;const Tt=e.BoundingSphere.fromPoints(it);let Ct;i.defined(d)&&(Ct=a.OrientedBoundingBox.fromRectangle(d,z,q,l));const Mt=new o.EllipsoidalOccluder(l).computeHorizonCullingPointPossiblyUnderEllipsoid(h,it,z),xt=new t.AxisAlignedBoundingBox(J,K,h),Nt=new o.TerrainEncoding(h,xt,ft.hMin,q,k,!1,A,G,m,p),bt=new Float32Array($*Nt.stride);let St=0;for(let t=0;t<$;++t)St=Nt.encode(bt,St,it[t],ot[t],rt[t],void 0,at[t],st[t]);const wt=ut.map((function(t){return t.index})).reverse(),Bt=ht.map((function(t){return t.index})).reverse(),Pt=lt.map((function(t){return t.index})).reverse(),At=dt.map((function(t){return t.index})).reverse();return Bt.unshift(Pt[Pt.length-1]),Bt.push(wt[0]),At.unshift(wt[wt.length-1]),At.push(Pt[0]),{vertices:bt,indices:new Uint16Array(ct),maximumHeight:q,minimumHeight:z,encoding:Nt,boundingSphere3D:Tt,orientedBoundingBox:Ct,occludeePointInScaledSpace:Mt,vertexCountWithoutSkirts:pt,indexCountWithoutSkirts:It,westIndicesSouthToNorth:wt,southIndicesEastToWest:Bt,eastIndicesNorthToSouth:Pt,northIndicesWestToEast:At}}(u.buffer,u.relativeToCenter,u.ellipsoid,u.rectangle,u.nativeRectangle,u.exaggeration,u.exaggerationRelativeHeight,u.skirtHeight,u.includeWebMercatorT,u.negativeAltitudeExponentBias,u.negativeElevationThreshold),d=l.vertices;h.push(d.buffer);const g=l.indices;return h.push(g.buffer),{vertices:d.buffer,indices:g.buffer,numberOfAttributes:l.encoding.stride,minimumHeight:l.minimumHeight,maximumHeight:l.maximumHeight,boundingSphere3D:l.boundingSphere3D,orientedBoundingBox:l.orientedBoundingBox,occludeePointInScaledSpace:l.occludeePointInScaledSpace,encoding:l.encoding,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,indexCountWithoutSkirts:l.indexCountWithoutSkirts,westIndicesSouthToNorth:l.westIndicesSouthToNorth,southIndicesEastToWest:l.southIndicesEastToWest,eastIndicesNorthToSouth:l.eastIndicesNorthToSouth,northIndicesWestToEast:l.northIndicesWestToEast}}))}));