define(["./EllipsoidTangentPlane-b2b18d75","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./when-b60132fc","./TerrainEncoding-e04be3ba","./Math-119be1a3","./OrientedBoundingBox-f1d7843f","./RuntimeError-4a5c8994","./Transforms-cb0006b0","./WebMercatorProjection-01b1b5e7","./createTaskProcessorWorker","./Check-7b2a090c","./Cartesian4-3ca25aab","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./AttributeCompression-90851096","./ComponentDatatype-c140a87d","./WebGLConstants-4ae0db90","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,i,a,r,n,o,s,u,h,d,c,l,g,m,p,v,I,E,C,T){"use strict";var f=Uint16Array.BYTES_PER_ELEMENT,M=Int32Array.BYTES_PER_ELEMENT,b=Uint32Array.BYTES_PER_ELEMENT,N=Float32Array.BYTES_PER_ELEMENT,x=Float64Array.BYTES_PER_ELEMENT;function S(e,t,i){i=r.defaultValue(i,o.CesiumMath);for(var a=e.length,n=0;n0&&u.push(u[C]),t.Matrix4.multiplyByPoint(d.toENU,N,P);var x=d.minimum,S=d.maximum;a.Cartesian3.minimumByComponent(P,x,x),a.Cartesian3.maximumByComponent(P,S,S);var B=d.lastBorderPoint;if(r.defined(B)){var y=B.index;h.push(y,T-1,T,T,C,y)}d.lastBorderPoint=I}}return c((function(c,l){c.ellipsoid=i.Ellipsoid.clone(c.ellipsoid),c.rectangle=i.Rectangle.clone(c.rectangle);var g=function(c,l,g,m,p,v,I,E,C,T){var _,F,W,O,U,Y;r.defined(m)?(_=m.west,F=m.south,W=m.east,O=m.north,U=m.width,Y=m.height):(_=o.CesiumMath.toRadians(p.west),F=o.CesiumMath.toRadians(p.south),W=o.CesiumMath.toRadians(p.east),O=o.CesiumMath.toRadians(p.north),U=o.CesiumMath.toRadians(m.width),Y=o.CesiumMath.toRadians(m.height));var k,V,H=[F,O],L=[_,W],D=h.Transforms.eastNorthUpToFixedFrame(l,g),G=t.Matrix4.inverseTransformation(D,A);E&&(k=d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F),V=1/(d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(O)-k));var j=new DataView(c),z=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY,J=B;J.x=Number.POSITIVE_INFINITY,J.y=Number.POSITIVE_INFINITY,J.z=Number.POSITIVE_INFINITY;var K=y;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;var Q,X,Z=0,$=0,ee=0;for(X=0;X<4;++X){var te=Z;Q=j.getUint32(te,!0),te+=b;var ie=o.CesiumMath.toRadians(180*j.getFloat64(te,!0));te+=x,-1===S(L,ie)&&L.push(ie);var ae=o.CesiumMath.toRadians(180*j.getFloat64(te,!0));te+=x,-1===S(H,ae)&&H.push(ae),te+=2*x;var re=j.getInt32(te,!0);te+=M,$+=re,ee+=3*(re=j.getInt32(te,!0)),Z+=Q+b}var ne=[],oe=[],se=new Array($),ue=new Array($),he=new Array($),de=E?new Array($):[],ce=new Array(ee),le=[],ge=[],me=[],pe=[],ve=0,Ie=0;for(Z=0,X=0;X<4;++X){Q=j.getUint32(Z,!0);var Ee=Z+=b,Ce=o.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=x;var Te=o.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=x;var fe=o.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),Me=.5*fe;Z+=x;var be=o.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),Ne=.5*be;Z+=x;var xe=j.getInt32(Z,!0);Z+=M;var Se=j.getInt32(Z,!0);Z+=M,Z+=M;for(var we=new Array(xe),Pe=0;Pe0&&pe.length>0){var Le=le[0].index,De=Ye,Ge=pe[pe.length-1].index,je=se.length-1;ce.push(Ge,je,De,De,Le,Ge)}$=se.length;var ze,qe=t.BoundingSphere.fromPoints(se);r.defined(m)&&(ze=s.OrientedBoundingBox.fromRectangle(m,z,q,g));for(var Je=new n.EllipsoidalOccluder(g).computeHorizonCullingPointPossiblyUnderEllipsoid(l,se,z),Ke=new e.AxisAlignedBoundingBox(J,K,l),Qe=new n.TerrainEncoding(Ke,Ve.hMin,q,D,!1,E),Xe=new Float32Array($*Qe.getStride()),Ze=0,$e=0;$e<$;++$e)Ze=Qe.encode(Xe,Ze,se[$e],ue[$e],he[$e],void 0,de[$e]);var et=le.map((function(e){return e.index})).reverse(),tt=ge.map((function(e){return e.index})).reverse(),it=me.map((function(e){return e.index})).reverse(),at=pe.map((function(e){return e.index})).reverse();return tt.unshift(it[it.length-1]),tt.push(et[0]),at.unshift(et[et.length-1]),at.push(it[0]),{vertices:Xe,indices:new Uint16Array(ce),maximumHeight:q,minimumHeight:z,encoding:Qe,boundingSphere3D:qe,orientedBoundingBox:ze,occludeePointInScaledSpace:Je,vertexCountWithoutSkirts:Ye,indexCountWithoutSkirts:ke,westIndicesSouthToNorth:et,southIndicesEastToWest:tt,eastIndicesNorthToSouth:it,northIndicesWestToEast:at}}(c.buffer,c.relativeToCenter,c.ellipsoid,c.rectangle,c.nativeRectangle,c.exaggeration,c.skirtHeight,c.includeWebMercatorT,c.negativeAltitudeExponentBias,c.negativeElevationThreshold),m=g.vertices;l.push(m.buffer);var p=g.indices;return l.push(p.buffer),{vertices:m.buffer,indices:p.buffer,numberOfAttributes:g.encoding.getStride(),minimumHeight:g.minimumHeight,maximumHeight:g.maximumHeight,boundingSphere3D:g.boundingSphere3D,orientedBoundingBox:g.orientedBoundingBox,occludeePointInScaledSpace:g.occludeePointInScaledSpace,encoding:g.encoding,vertexCountWithoutSkirts:g.vertexCountWithoutSkirts,indexCountWithoutSkirts:g.indexCountWithoutSkirts,westIndicesSouthToNorth:g.westIndicesSouthToNorth,southIndicesEastToWest:g.southIndicesEastToWest,eastIndicesNorthToSouth:g.eastIndicesNorthToSouth,northIndicesWestToEast:g.northIndicesWestToEast}}))}));