define(["exports","./when-b60132fc","./Cartographic-3309dd0d","./Check-7b2a090c","./IndexDatatype-8a5eead4","./WebGLConstants-4ae0db90","./PrimitiveType-a54dc62f","./ComponentDatatype-c140a87d"],(function(e,t,n,r,a,i,s,o){"use strict";var f=Object.freeze({LUMINANCE_8:1,LUMINANCE_16:2,ALPHA:3,ALPHA_4_LUMINANCE_4:4,LUMINANCE_ALPHA:5,RGB_565:6,BGR565:7,RGB:10,BGR:11,ARGB:12,ABGR:13,BGRA:14,WEBP:25,RGBA:28,DXT1:17,DXT2:18,DXT3:19,DXT4:20,DXT5:21,CRN_DXT5:26,STANDARD_CRN:27,KTX2:31});function u(e,t,n,r){var a=e|t<<8,i=a>>11&31,s=a>>5&63,o=31&a;return n[r+0]=i<<3|i>>2,n[r+1]=s<<2|s>>4,n[r+2]=o<<3|o>>2,n[r+3]=255,a}function c(e,t,n,r){var a=0;0!=(6&r)&&(a=8),function(e,t,n,r){for(var a=new Uint8Array(16),i=u(t[n+0],t[n+1],a,0),s=u(t[n+2],t[n+3],a,4),o=0;o<3;o++){var f=a[o],c=a[4+o];r&&i<=s?(a[8+o]=(f+c)/2,a[12+o]=0):(a[8+o]=(2*f+c)/3,a[12+o]=(f+2*c)/3)}a[11]=255,a[15]=r&&i<=s?0:255;var y=new Uint8Array(16);for(o=0;o<4;++o){var p=t[n+4+o];y[4*o+0]=3&p,y[4*o+1]=p>>2&3,y[4*o+2]=p>>4&3,y[4*o+3]=p>>6&3}for(o=0;o<16;++o)for(var d=4*y[o],l=0;l<4;++l)e[4*o+l]=a[d+l]}(e,t,n+a,0!=(1&r)),0!=(2&r)?function(e,t,n){for(var r=0;r<8;++r){var a=bytes[n+r],i=15&a,s=240&a;e[8*r+3]=i|i<<4,e[8*r+7]=s|s>>4}}(e,0,n):0!=(4&r)&&function(e,t,n){var r=t[n+0],a=t[n+1],i=new Uint8Array(8);if(i[0]=r,i[1]=a,r<=a){for(var s=1;s<5;++s)i[1+s]=((5-s)*r+s*a)/5;i[6]=0,i[7]=255}else for(s=1;s<7;++s)i[1+s]=((7-s)*r+s*a)/7;var o=new Uint8Array(16),f=(n+=2,0);for(s=0;s<2;++s){for(var u=0,c=0;c<3;++c)u|=t[n++]<<8*c;for(c=0;c<8;++c){var y=u>>3*c&7;o[f++]=y}}for(s=0;s<16;++s)e[4*s+3]=i[o[s]]}(e,t,n)}function y(e){}y.decode=function(e,t,n,r,a){if(null!=e&&null!=r&&0!=n&&0!=t){var i=0;1&(i=a>f.BGR||a===f.LUMINANCE_ALPHA?4:33)&&32&i?function(e,t,n,r){for(var a=new Uint16Array(4),i=e,s=0,o=0,f=0,u=0,c=0,y=0,p=0,d=0,l=0,A=t/4,v=n/4,h=0;h<v;h++)for(var x=0;x<A;x++)f=4*((v-h)*A+x),a[0]=r[f],a[1]=r[f+1],u=31&a[0],c=2016&a[0],y=63488&a[0],p=31&a[1],d=2016&a[1],l=63488&a[1],a[2]=5*u+3*p>>3|5*c+3*d>>3&2016|5*y+3*l>>3&63488,a[3]=5*p+3*u>>3|5*d+3*c>>3&2016|5*l+3*y>>3&63488,s=r[f+2],i[o=4*h*t+4*x]=a[3&s],i[o+1]=a[s>>2&3],i[o+2]=a[s>>4&3],i[o+3]=a[s>>6&3],i[o+=t]=a[s>>8&3],i[o+1]=a[s>>10&3],i[o+2]=a[s>>12&3],i[o+3]=a[s>>14],s=r[f+3],i[o+=t]=a[3&s],i[o+1]=a[s>>2&3],i[o+2]=a[s>>4&3],i[o+3]=a[s>>6&3],i[o+=t]=a[s>>8&3],i[o+1]=a[s>>10&3],i[o+2]=a[s>>12&3],i[o+3]=a[s>>14]}
/*! @brief Decompresses an image in memory.

     @param rgba		Storage for the decompressed pixels.
     @param width	The width of the source image.
     @param height	The height of the source image.
     @param blocks	The compressed DXT blocks.
     @param flags	Compression flags.

     The decompressed pixels will be written as a contiguous array of width*height
     16 rgba values, with each component as 1 byte each. In memory this is:

     { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height

     The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
     however, DXT1 will be used by default if none is specified. All other flags
     are ignored.

     Internally this function calls squish::Decompress for each block.
     */(e,t,n,r):function(e,t,n,r,a){for(var i=0!=(1&a)?8:16,s=0,o=0;o<n;o+=4)for(var f=0;f<t;f+=4){var u=new Uint8Array(64);c(u,r,s,a);for(var y=0,p=0;p<4;++p)for(var d=0;d<4;++d){var l=f+d,A=o+p;if(l<t&&A<n)for(var v=4*(t*(n-A)+l),h=0;h<4;++h)e[v++]=u[y++];else y+=4}s+=i}}(e,t,n,r,i)}};var p=Object.freeze({SVC_Vertex:1,SVC_Normal:2,SVC_VertexColor:4,SVC_SecondColor:8,SVC_TexutreCoord:16,SVC_TexutreCoordIsW:32});function d(){return!0}var l={STREAM_DRAW:i.WebGLConstants.STREAM_DRAW,STATIC_DRAW:i.WebGLConstants.STATIC_DRAW,DYNAMIC_DRAW:i.WebGLConstants.DYNAMIC_DRAW,validate:function(e){return e===l.STREAM_DRAW||e===l.STATIC_DRAW||e===l.DYNAMIC_DRAW}};function A(e){var n=(e=t.defaultValue(e,t.defaultValue.EMPTY_OBJECT)).context._gl,r=e.bufferTarget,a=e.typedArray,i=e.sizeInBytes,s=e.usage,o=t.defined(a);o&&(i=a.byteLength);var f=n.createBuffer();n.bindBuffer(r,f),n.bufferData(r,o?a:i,s),n.bindBuffer(r,null),this._gl=n,this._webgl2=e.context._webgl2,this._bufferTarget=r,this._sizeInBytes=i,this._usage=s,this._buffer=f,this.vertexArrayDestroyable=!0,this.context=e.context,e.context.memorySize+=i}function v(){}A.createVertexBuffer=function(e){return new A({context:e.context,bufferTarget:i.WebGLConstants.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},A.createIndexBuffer=function(e){var t=e.context,n=e.indexDatatype,r=a.IndexDatatype.getSizeInBytes(n),s=new A({context:t,bufferTarget:i.WebGLConstants.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),o=s.sizeInBytes/r;return Object.defineProperties(s,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return r}},numberOfIndices:{get:function(){return o}}}),s},Object.defineProperties(A.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),A.prototype._getBuffer=function(){return this._buffer},A.prototype.copyFromArrayView=function(e,n){n=t.defaultValue(n,0);var r=this._gl,a=this._bufferTarget;r.bindBuffer(a,this._buffer),r.bufferSubData(a,n,e),r.bindBuffer(a,null)},A.prototype.copyFromBuffer=function(e,t,n,r){var a=i.WebGLConstants.COPY_READ_BUFFER,s=i.WebGLConstants.COPY_WRITE_BUFFER,o=this._gl;o.bindBuffer(s,this._buffer),o.bindBuffer(a,e._buffer),o.copyBufferSubData(a,s,t,n,r),o.bindBuffer(s,null),o.bindBuffer(a,null)},A.prototype.getBufferData=function(e,n,r,a){n=t.defaultValue(n,0),r=t.defaultValue(r,0);var s=this._gl,o=i.WebGLConstants.COPY_READ_BUFFER;s.bindBuffer(o,this._buffer),s.getBufferSubData(o,n,e,r,a),s.bindBuffer(o,null)},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),this.context.memorySize-=this.sizeInBytes,function(e,t){function n(){}for(var r in e)"function"==typeof e[r]&&(e[r]=n);e.isDestroyed=d}(this)},v.computeNeighbors=function(e,t){for(var n=e.length/3,r=new Uint32Array(t+1),a=new Uint32Array(t+1),i=function(e,t){e<t?r[e+1]++:a[t+1]++},s=0;s<n;s++){var o=e[3*s],f=e[3*s+1],u=e[3*s+2];i(o,f),i(f,u),i(u,o)}for(s=f=o=0;s<t;s++)u=r[s+1],i=a[s+1],r[s+1]=o,a[s+1]=f,o+=u,f+=i;var c=new Uint32Array(6*n),y=r[t];for(i=function(e,t,n){if(e<t){var i=r[e+1]++;c[2*i]=t,c[2*i+1]=n}else i=a[t+1]++,c[2*y+2*i]=e,c[2*y+2*i+1]=n},s=0;s<n;s++)o=e[3*s],f=e[3*s+1],u=e[3*s+2],i(o,f,s),i(f,u,s),i(u,o,s);for(o=function(e,t){var n=2*e;for(e=t-e,t=1;t<e;t++){for(var r=c[n+2*t],a=c[n+2*t+1],i=t-1;0<=i&&c[n+2*i]>r;i--)c[n+2*i+2]=c[n+2*i],c[n+2*i+3]=c[n+2*i+1];c[n+2*i+2]=r,c[n+2*i+3]=a}},s=0;s<t;s++)o(r[s],r[s+1]),o(y+a[s],y+a[s+1]);var p=new Int32Array(3*n),d=function(t,n){return t===e[3*n]?0:t===e[3*n+1]?1:t===e[3*n+2]?2:-1};for(n=function(e,t){e=d(e,t),p[3*t+e]=-1},o=function(e,t,n,r){e=d(e,t),p[3*t+e]=r,n=d(n,r),p[3*r+n]=t},s=0;s<t;s++){f=r[s],u=r[s+1],i=a[s];for(var l=a[s+1];f<u&&i<l;){var A=c[2*f],v=c[2*y+2*i];A===v?(o(s,c[2*f+1],v,c[2*y+2*i+1]),f++,i++):A<v?(n(s,c[2*f+1]),f++):(n(v,c[2*y+2*i+1]),i++)}for(;f<u;)n(s,c[2*f+1]),f++;for(;i<l;)n(v=c[2*y+2*i],c[2*y+2*i+1]),i++}return p};var h=null;function x(){}function C(e){return e*Math.PI/180}v.deduplicate=function(e,t,n,r,a){void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=e.byteLength/(4*t)),e=new Uint32Array(e,r,a*t),r=new Uint32Array(a);var i=Math.floor(1.1*a)+1;(null==h||h.length<2*i)&&(h=new Uint32Array(function(e){--e;for(var t=1;32>t;t<<=1)e|=e>>t;return e+1}(2*i)));for(var s=0;s<2*i;s++)h[s]=0;var o=0,f=0!==n?Math.ceil(7.84*1.96/(n*n)*n*(1-n)):a;for(s=0;s<a;s++){if(s===f){if((c=1-o/s)+1.96*Math.sqrt(c*(1-c)/s)<n)return null;f*=2}for(var u,c=s*t,y=u=0;y<t;y++)u=(u=e[c+y]+u|0)+(u<<11)+(u>>>2)|0;y=(u>>>=0)%i;for(var p=o;0!==h[2*y+1];){if(h[2*y]===u){var d=h[2*y+1]-1,l=d*t;e:{for(var A=0;A<t;A++)if(e[c+A]!==e[l+A]){l=!1;break e}l=!0}if(l){p=r[d];break}}++y>=i&&(y-=i)}p===o&&(h[2*y]=u,h[2*y+1]=s+1,o++),r[s]=p}if(0!==n&&1-o/a<n)return null;for(n=new Uint32Array(t*o),s=o=0;s<a;s++)if(r[s]===o){for(i=e,f=s*t,c=n,u=o*t,y=t,p=0;p<y;p++)c[u+p]=i[f+p];o++}return{buffer:n.buffer,indices:r,uniqueCount:o}};var b=C(4),m=C(35),D=Math.cos(m),B=Math.cos(b);var g={position0:new n.Cartesian3,position1:new n.Cartesian3,faceNormal0:new n.Cartesian3,faceNormal1:new n.Cartesian3,cosAngle:0},I=new n.Cartesian3,T=new n.Cartesian3;function z(e,t){var r,a=(r=e.cosAngle,Math.acos(1<r?1:-1>r?-1:r));return function(e,t,n){var r=n.x-t.x,a=n.y-t.y;(n=r*r+a*a+(t=n.z-t.z)*t)?(n=1/Math.sqrt(n),e.x=r*n,e.y=a*n,e.z=t*n):(e.x=0,e.y=0,e.z=0)}(T,e.position1,e.position0),n.Cartesian3.cross(e.faceNormal0,e.faceNormal1,I),a*(0<n.Cartesian3.dot(I,T)?-1:1)>t}var _=new n.Cartesian3,S=new n.Cartesian3,w=new n.Cartesian3;function L(e){var t=e.x*e.x+e.y*e.y+e.z*e.z;t>0&&(t=1/Math.sqrt(t),e.x*=t,e.y*=t,e.z*=t)}function P(e){}function R(e){if(t.defined(e.cachedSidenessVertexBuffer))return e.cachedSidenessVertexBuffer;var n=new Float32Array(8),r=0;return n[r++]=0,n[r++]=0,n[r++]=0,n[r++]=1,n[r++]=1,n[r++]=1,n[r++]=1,n[r++]=0,e.cachedSidenessVertexBuffer=A.createVertexBuffer({context:e,typedArray:n,usage:l.STATIC_DRAW}),e.cachedSidenessVertexBuffer.vertexArrayDestroyable=!1,e.cachedSidenessVertexBuffer}function V(e,t){for(var r,a,i,s=t.componentsPerAttribute,o=e.vertCompressConstant,f=new n.Cartesian3(e.minVerticesValue.x,e.minVerticesValue.y,e.minVerticesValue.z),u=new Uint16Array(t.typedArray.buffer,t.typedArray.byteOffset,t.typedArray.byteLength/2),c=new Float32Array(3*e.verticesCount),y=0;y<e.verticesCount;y++)r=u[s*y]*o+f.x,a=u[s*y+1]*o+f.y,i=u[s*y+2]*o+f.z,c[3*y]=r,c[3*y+1]=a,c[3*y+2]=i;return c}x.extractEdges=function(e){var t=e.vertices,r=e.dim,a=g,i=a.position0,s=a.position1,o=a.faceNormal0,f=a.faceNormal1,u=function(e){for(var t=e.faces.length/3,r=e.vertices,a=e.dim,i=e.faces,s=new Float32Array(3*t),o=0;o<t;o++){var f=i[3*o+0],u=i[3*o+1],c=i[3*o+2];_.x=r[a*f],_.y=r[a*f+1],_.z=r[a*f+2],S.x=r[a*u],S.y=r[a*u+1],S.z=r[a*u+2],w.x=r[a*c],w.y=r[a*c+1],w.z=r[a*c+2],n.Cartesian3.subtract(S,_,S),n.Cartesian3.subtract(w,_,w),n.Cartesian3.cross(S,w,_),L(_),s[3*o+0]=_.x,s[3*o+1]=_.y,s[3*o+2]=_.z}return s}(e),c=function(e){var t=e.faces.length/3,n=e.faces,r=e.neighbors,a=0,i=0;for(i=0;i<t;i++){var s=r[3*i+0],o=r[3*i+1],f=r[3*i+2],u=n[3*i+0],c=n[3*i+1],y=n[3*i+2];a+=-1===s||u<c?1:0,a+=-1===o||c<y?1:0,a+=-1===f||y<u?1:0}var p=new Int32Array(4*a),d=0;for(i=0;i<t;i++)s=r[3*i+0],o=r[3*i+1],f=r[3*i+2],u=n[3*i+0],c=n[3*i+1],y=n[3*i+2],(-1===s||u<c)&&(p[d++]=u,p[d++]=c,p[d++]=i,p[d++]=s),(-1===o||c<y)&&(p[d++]=c,p[d++]=y,p[d++]=i,p[d++]=o),(-1===f||y<u)&&(p[d++]=y,p[d++]=u,p[d++]=i,p[d++]=f);return p}(e),y=c.length/4,p=new Float32Array(9*y),d=0,l=new Float32Array(12*y),A=0,v=0,h=0,x=function(e,t){0===t&&(t=e,e=0);for(var n=Array(t-e),r=e;r<t;r++)n[r-e]=r;return n}(0,y),C=new Float32Array(y);C.forEach((function(e,a,o){var f=c[4*a+0],u=c[4*a+1];i.x=t[f*r],i.y=t[f*r+1],i.z=t[f*r+2],s.x=t[u*r],s.y=t[u*r+1],s.z=t[u*r+2],o[a]=n.Cartesian3.distance(i,s)})),x.sort((function(e,t){return C[t]-C[e]}));for(var m=[],I=[],T=0;T<y;T++){var P=x[T],R=C[P],V=c[4*P+0],E=c[4*P+1],F=c[4*P+2],N=c[4*P+3],O=-1===N;if(i.x=t[V*r],i.y=t[V*r+1],i.z=t[V*r+2],s.x=t[E*r],s.y=t[E*r+1],s.z=t[E*r+2],O)o.x=u[3*F],o.y=u[3*F+1],o.z=u[3*F+2],f.x=o.x,f.y=o.y,f.z=o.z,a.cosAngle=n.Cartesian3.dot(o,f);else if(o.x=u[3*F],o.y=u[3*F+1],o.z=u[3*F+2],f.x=u[3*N],f.y=u[3*N+1],f.z=u[3*N+2],a.cosAngle=n.Cartesian3.dot(o,f),a.cosAngle>B)continue;v+=R,h++,O||a.cosAngle<D?(p[d++]=a.position0.x,p[d++]=a.position0.y,p[d++]=a.position0.z,p[d++]=a.position1.x,p[d++]=a.position1.y,p[d++]=a.position1.z,p[d++]=a.faceNormal0.x,p[d++]=a.faceNormal0.y,p[d++]=a.faceNormal0.z,m.push(R)):z(a,b)&&(l[A++]=a.position0.x,l[A++]=a.position0.y,l[A++]=a.position0.z,l[A++]=a.position1.x,l[A++]=a.position1.y,l[A++]=a.position1.z,l[A++]=a.faceNormal0.x,l[A++]=a.faceNormal0.y,l[A++]=a.faceNormal0.z,l[A++]=a.faceNormal1.x,l[A++]=a.faceNormal1.y,l[A++]=a.faceNormal1.z,I.push(R))}p=p.slice(0,d),l=l.slice(0,A);var U=v/h,M=m.length,W=I.length;return{regular:{instancesData:p,instanceCount:M,edgeLength:M*U},silhouette:{instancesData:l,instanceCount:W,edgeLength:W*U},averageEdgeLength:U}},P.RegularInstanceStride=12,P.SilhouetteInstanceStride=15,P.createEdgeData=function(e,n,r){if(0==n.length)return null;var a,i=n[0];a=0===i.indexType?new Uint16Array(i.indicesTypedArray.buffer,i.indicesTypedArray.byteOffset,i.indicesTypedArray.byteLength/2):new Uint32Array(i.indicesTypedArray.buffer,i.indicesTypedArray.byteOffset,i.indicesTypedArray.byteLength/4);var s=P.extractEdgeInformation(e,!1,a),o=x.extractEdges(s);return t.defined(r)&&(t.defined(o.regular.instancesData)&&r.push(o.regular.instancesData.buffer),t.defined(o.silhouette.instancesData)&&r.push(o.silhouette.instancesData.buffer)),o},P.createIndexBuffer=function(e){return t.defined(e.cachedSidenessIndexBuffer)||(e.cachedSidenessIndexBuffer=A.createIndexBuffer({context:e,typedArray:(n=new Uint16Array(6),r=0,n[r++]=2,n[r++]=1,n[r++]=0,n[r++]=3,n[r++]=2,n[r++]=0,n),usage:l.STATIC_DRAW,indexDatatype:a.IndexDatatype.UNSIGNED_SHORT}),e.cachedSidenessIndexBuffer.vertexArrayDestroyable=!1),e.cachedSidenessIndexBuffer;var n,r},P.createRegularEdgeAttributes=function(e,n){if(t.defined(n.instancesData)&&0!=n.instancesData.length){var r={},a=[];n.attributeLocations=r,n.attributes=a;var i=A.createVertexBuffer({context:e,typedArray:n.instancesData,usage:l.STATIC_DRAW});n.instancesData=null;var s=o.ComponentDatatype.getSizeInBytes(o.ComponentDatatype.FLOAT),f=R(e),u=0;r.aSideness=u++,a.push({index:r.aSideness,vertexBuffer:f,componentsPerAttribute:2,componentDatatype:o.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:2*o.ComponentDatatype.getSizeInBytes(o.ComponentDatatype.FLOAT),normalize:!1});var c=P.RegularInstanceStride,y=0;r.aPosition0=u++,a.push({index:r.aPosition0,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!1,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=3,r.aPosition1=u++,a.push({index:r.aPosition1,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!1,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=3,r.aNormal=u++,a.push({index:r.aNormal,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=3,r.batchId=u++,a.push({index:r.batchId,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=1,r.aVariantStroke=u++,a.push({index:r.aVariantStroke,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=1,r.aVariantExtension=u++,a.push({index:r.aVariantExtension,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*y,strideInBytes:s*c,instanceDivisor:1}),y+=1}},P.createSilhouetteEdgeAttributes=function(e,n){if(t.defined(n.instancesData)&&0!=n.instancesData.length){var r={},a=[];n.attributeLocations=r,n.attributes=a;var i=A.createVertexBuffer({context:e,typedArray:n.instancesData,usage:l.STATIC_DRAW});n.instancesData=null;var s=o.ComponentDatatype.getSizeInBytes(o.ComponentDatatype.FLOAT),f=0;r.aSideness=f++,a.push({index:r.aSideness,vertexBuffer:R(e),componentsPerAttribute:2,componentDatatype:o.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:2*s,normalize:!1});var u=P.SilhouetteInstanceStride,c=0;r.aPosition0=f++,a.push({index:r.aPosition0,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!1,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=3,r.aPosition1=f++,a.push({index:r.aPosition1,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!1,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=3,r.aNormalA=f++,a.push({index:r.aNormalA,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=3,r.aNormalB=f++,a.push({index:r.aNormalB,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=3,r.batchId=f++,a.push({index:r.batchId,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=1,r.aVariantStroke=f++,a.push({index:r.aVariantStroke,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=1,r.aVariantExtension=f++,a.push({index:r.aVariantExtension,vertexBuffer:i,componentsPerAttribute:1,componentDatatype:o.ComponentDatatype.FLOAT,normalize:!0,offsetInBytes:s*c,strideInBytes:s*u,instanceDivisor:1}),c+=1}},P.extractEdgeInformation=function(e,n,r){var a,i=e.attrLocation.aPosition,s=e.vertexAttributes[i],o=t.defined(e.nCompressOptions)&&(e.nCompressOptions&p.SVC_Vertex)===p.SVC_Vertex,f=s.componentsPerAttribute;o?(f=3,a=V(e,s)):a=new Float32Array(s.typedArray.buffer,s.typedArray.byteOffset,s.typedArray.byteLength/4);var u=a.length/f;if(n&&r)return{faces:r,neighbors:v.computeNeighbors(r,u),vertices:a,dim:f};var c,y=s.typedArray.buffer;c=o?a.buffer:y.slice(s.typedArray.byteOffset,s.typedArray.byteOffset+s.typedArray.byteLength);var d=v.deduplicate(c,f),l=P.selectIndexData(d.indices,r);return{faces:l,neighbors:v.computeNeighbors(l,d.uniqueCount),vertices:new Float32Array(d.buffer),dim:f}},P.selectIndexData=function(e,t){if(t){t=t.slice();for(var n=0;n<t.length;n++)t[n]=e[t[n]];return t}return e};var E=new n.Cartesian3,F=new n.Cartesian3,N=new n.Cartesian3,O=new n.Cartesian3,U=new n.Cartesian3,M=new n.Cartesian3,W=new n.Cartesian3,G=new n.Cartesian3;function q(e,n){function r(e,t,n){var r=48217*e%2147483647,a=t+r/2147483647*(n-=t);return{seed:r,result:Math.round(a)}}var a=function(e,t){var n=new Float32Array(6),r=new Uint32Array(n.buffer),a=new Uint32Array(1);n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=t.x,n[4]=t.y,n[5]=t.z,a[0]=5381;for(var i=0;i<r.length;i++)a[0]=31*a[0]+r[i];return a[0]}(e,n);t.defined(a)||(a=2147483647*Math.random());var i=r(a,0,255);a=i.seed,i.result,a=(i=r(a,0,5)).seed;var s=i.result;i=function(e){var t=48217*e%2147483647;return{seed:t,result:t/2147483646}}(a),a=i.seed;var o=i.result;return o=-(1-Math.min(o/.7,1))+Math.max(0,o-.7)/(1-.7),{variantStroke:s,variantExtension:o=255*(Math.abs(o)**1.2*(0>o?-1:1)*.5+.5)}}P.createEdgeDataByIndices=function(e,r){var a,i,s=e.attrLocation.aPosition,o=e.vertexAttributes[s],f=t.defined(e.nCompressOptions)&&(e.nCompressOptions&p.SVC_Vertex)===p.SVC_Vertex,u=o.componentsPerAttribute;f?(u=3,a=V(e,o)):a=new Float32Array(o.typedArray.buffer,o.typedArray.byteOffset,o.typedArray.byteLength/4);for(var c=[],y=[],d=(i=0===r.indexType?new Uint16Array(r.indicesTypedArray.buffer,r.indicesTypedArray.byteOffset,r.indicesTypedArray.byteLength/2):new Uint32Array(r.indicesTypedArray.buffer,r.indicesTypedArray.byteOffset,r.indicesTypedArray.byteLength/4)).length,l=0,A=0,v=4*Math.floor(d/4);A<v;A+=4){var h=i[A],x=i[A+1],C=i[A+2],b=i[A+3];if(E.x=a[u*h],E.y=a[u*h+1],E.z=a[u*h+2],F.x=a[u*x],F.y=a[u*x+1],F.z=a[u*x+2],N.x=a[u*C],N.y=a[u*C+1],N.z=a[u*C+2],O.x=a[u*b],O.y=a[u*b+1],O.z=a[u*b+2],!(n.Cartesian3.equals(F,N)||n.Cartesian3.equals(F,O)||n.Cartesian3.equals(F,E)||n.Cartesian3.equals(N,E)||n.Cartesian3.equals(O,E))){if(C===b){if(n.Cartesian3.subtract(F,E,U),n.Cartesian3.subtract(N,E,M),n.Cartesian3.cross(U,M,U),n.Cartesian3.equals(U,n.Cartesian3.ZERO))continue;n.Cartesian3.normalize(U,U),c.push(E.x),c.push(E.y),c.push(E.z),c.push(F.x),c.push(F.y),c.push(F.z),c.push(U.x),c.push(U.y),c.push(U.z),c.push(h);var m=(B=q(E,F)).variantStroke,D=B.variantExtension;c.push(m),c.push(D)}else{if(n.Cartesian3.subtract(F,E,U),n.Cartesian3.subtract(N,E,M),n.Cartesian3.cross(U,M,U),n.Cartesian3.equals(U,n.Cartesian3.ZERO))continue;if(n.Cartesian3.normalize(U,U),n.Cartesian3.subtract(F,E,W),n.Cartesian3.subtract(O,E,G),n.Cartesian3.cross(W,G,W),n.Cartesian3.equals(W,n.Cartesian3.ZERO))continue;n.Cartesian3.normalize(W,W),y.push(E.x),y.push(E.y),y.push(E.z),y.push(F.x),y.push(F.y),y.push(F.z),y.push(U.x),y.push(U.y),y.push(U.z),y.push(W.x),y.push(W.y),y.push(W.z),y.push(h);var B;m=(B=q(E,F)).variantStroke,D=B.variantExtension;y.push(m),y.push(D)}l+=n.Cartesian3.distance(E,F)}}var g=l/(d/4),I=c.length/P.RegularInstanceStride,T=y.length/P.SilhouetteInstanceStride;return{regular:{instancesData:new Float32Array(c),instanceCount:I,edgeLength:I*g},silhouette:{instancesData:new Float32Array(y),instanceCount:T,edgeLength:T},averageEdgeLength:g}};var k=Object.freeze({encNONE:0,enrS3TCDXTN:14,enrPVRTPF_PVRTC2:19,enrPVRTPF_PVRTC:20,enrPVRTPF_PVRTC_4bpp:21,enrPVRTPF_ETC1:22});e.DXTTextureDecode=y,e.S3MCompressType=k,e.S3MEdgeProcessor=P,e.S3MPixelFormat=f,e.VertexCompressOption=p}));
