define(["require","./createTaskProcessorWorker","./Check-7b2a090c","./FeatureDetection-806b12f0","./when-b60132fc","./Cartesian2-47311507","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Color-2a095a27","./ComponentDatatype-c140a87d","./getStringFromTypedArray-c37342c0","./buildModuleUrl-8958744c","./S3MCompressType-75aa9ff0","./IndexDatatype-8a5eead4","./RuntimeError-4a5c8994","./BoundingRectangle-1f901ba8","./S3MPixelFormat-4f2b7689","./pako_inflate-f73548c4","./arrayFill-4513d7ad","./CompressedTextureBuffer-290a1ff4","./PixelFormat-9345f1c7","./Math-119be1a3","./WebGLConstants-4ae0db90","./Event-16a2dfbf"],(function(t,e,r,a,n,A,o,i,B,E,C,s,y,l,d,f,u,P,c,p,T,L,D,g){"use strict";function F(t,e,r){if("function"==typeof t.slice)return t.slice(e,r);for(var n=Array.prototype.slice.call(t,e,r),A=a.FeatureDetection.typedArrayTypes,o=A.length,i=0;i=0){n.defined(d)||(r.nCompressOptions|=y.VertexCompressOption.SVC_Vertex);var L=e.GetAttribute(t,B.posUniqueID),D=I(t,e,L),g=D.data.componentsPerAttribute;r.verticesCount=D.array.length/g,r.vertCompressConstant=D.data.quantization.range/(1<3&&(r.minVerticesValue.w=F[3]);var M=r.verticesCount;if(s&&(f=new o.Cartographic,u=new o.Cartographic,P=new Float32Array(2*M),c=new Float64Array(2*M)),n.defined(d)){var m=D.array,v=3===g?o.Cartesian3.unpackArray(m):i.Cartesian4.unpackArray(m);for(let t=0,e=v.length;t=0){r.nCompressOptions|=y.VertexCompressOption.SVC_Normal;var w=e.GetAttribute(t,B.normalUniqueID),Y=I(t,e,w),J=Y.data.quantization;r.normalRangeConstant=(1<=0){r.nCompressOptions|=y.VertexCompressOption.SVC_VertexColor;var k=e.GetAttribute(t,B.colorUniqueID),W=I(t,e,k);T.aColor=p.length,p.push({index:T.aColor,typedArray:W.array,componentsPerAttribute:W.data.componentsPerAttribute,componentDatatype:W.data.componentDatatype,offsetInBytes:W.data.byteOffset,strideInBytes:W.data.byteStride,normalize:W.data.normalized})}for(V=0;V-1?K(e):n.defined(e.clampRegionEdge)?w(e):t>=b.ClampGroundPolygon&&t<=b.ClampObjectLine?V(e):t==b.ClampGroundAndObjectLineCache?w(e):H(e)},U.calcBoundingSphere=function(t,e,r){var a,A=t._fileType;return a=e.instanceIndex>-1?K(e):n.defined(e.clampRegionEdge)?w(e):A>=b.ClampGroundPolygon&&A<=b.ClampObjectLine?V(e):A==b.ClampGroundAndObjectLineCache?w(e):H(e),s.BoundingSphere.transform(a,r,a),a},U.calcBoundingRectangle=function(t,e){var r;return t._fileType===b.ClampGroundPolygon&&(r=function(t){var e,r,a=n.defined(t.nCompressOptions)&&(t.nCompressOptions&y.VertexCompressOption.SVC_Vertex)===y.VertexCompressOption.SVC_Vertex,i=new f.BoundingRectangle,B=t.vertexAttributes[0],E=B.componentsPerAttribute,C=1;a?(C=t.vertCompressConstant,r=new o.Cartesian3(t.minVerticesValue.x,t.minVerticesValue.y,t.minVerticesValue.z),e=new Uint16Array(B.typedArray.buffer,B.typedArray.byteOffset,B.typedArray.byteLength/2)):e=new Float32Array(B.typedArray.buffer,B.typedArray.byteOffset,B.typedArray.byteLength/4);for(var s=[],l=0;l=1&&(_=f[D][F-1]),0!=F&&(c[m-6]=_.x,c[m-5]=_.y,c[m-4]=_.z,c[m-3]=_.x,c[m-2]=_.y,c[m-1]=_.z),F!=g-1&&(c[m]=_.x,c[m+1]=_.y,c[m+2]=_.z,c[m+3]=_.x,c[m+4]=_.y,c[m+5]=_.z),m=2*M+8*F,0!=F&&(T[m-4]=-1,T[m-3]=-1,T[m-2]=1,T[m-1]=-1),F!=g-1&&(T[m]=-1,T[m+1]=1,T[m+2]=1,T[m+3]=1)}L+=f[D].length}var S={vertexAttributes:[],attrLocation:{}},O=S.vertexAttributes,N=S.attrLocation;S.instanceCount=0,S.instanceMode=0,N.aPosition=0,O.push({index:N.aPosition,typedArray:P,componentsPerAttribute:3,componentDatatype:E.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aNormal=1,O.push({index:N.aNormal,typedArray:c,componentsPerAttribute:3,componentDatatype:E.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aTexCoord0=2,O.push({index:N.aTexCoord0,typedArray:p,componentsPerAttribute:3,componentDatatype:E.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aTexCoord1=3,O.push({index:N.aTexCoord1,typedArray:T,componentsPerAttribute:2,componentDatatype:E.ComponentDatatype.BYTE,offsetInBytes:0,strideInBytes:2*Int8Array.BYTES_PER_ELEMENT,normalize:!1});for(var h=[],R=0;R65535?1:0,o.primitiveType=a.PrimitiveType.TRIANGLES,A=0===o.indexType?new Uint16Array(o.indicesCount):new Uint32Array(o.indicesCount);for(var i=0,B=0;B96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}var A=0;for(a=0;a>E,y>>E);if($0){e.getUint16(o+r,!0),o+=Uint16Array.BYTES_PER_ELEMENT,o+=2*Uint8Array.BYTES_PER_ELEMENT;var B=i*Uint8Array.BYTES_PER_ELEMENT*4;A=F(t,o,o+B),o+=B;var C=n.vertexAttributes,s=n.attrLocation;s.aColor=C.length,C.push({index:s.aColor,typedArray:A,componentsPerAttribute:4,componentDatatype:E.ComponentDatatype.UNSIGNED_BYTE,offsetInBytes:0,strideInBytes:4,normalize:!0})}return{bytesOffset:o}}function Ot(t,e,r,a,n){var A=a,o=e.getUint32(A+r,!0);return A+=Uint32Array.BYTES_PER_ELEMENT,o<=0?{bytesOffset:A}:(e.getUint16(A+r,!0),A+=Uint16Array.BYTES_PER_ELEMENT,A+=2*Uint8Array.BYTES_PER_ELEMENT,{bytesOffset:A+=o*Uint8Array.BYTES_PER_ELEMENT*4})}function Nt(t,e,r,a,n){var A=n,o=[],i=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var B=0;B0){var l=0,d=null;1===s||3===s?(l=C*Uint32Array.BYTES_PER_ELEMENT,d=e.subarray(A,A+l)):(l=C*Uint16Array.BYTES_PER_ELEMENT,d=e.subarray(A,A+l),C%2!=0&&(l+=2)),E.indicesTypedArray=d,A+=l}E.indicesCount=C,E.indexType=s,E.primitiveType=y;var f=[],u=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var P=0;P=2&&(e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT);var O,N={};N.posUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.normalUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.colorUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.secondColorUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,3===d?(O=e.getUint32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT):(O=e.getUint16(L+r,!0),L+=Int16Array.BYTES_PER_ELEMENT);for(var h=[],R=0;R0){var Y=(J=ut(e,r,T,L)).string;L=J.bytesOffset,w.materialCode=Y,V.push(w)}3===d&&((zt=(L+r)%4)&&(zt=4-zt),L+=zt);var J,k=new Object,W=e.getUint32(L+r,!0),Z=F(T,L+=Int32Array.BYTES_PER_ELEMENT,L+W);if(H>0?M.dracoDecodeMesh(rt,Z,W,fe,w,N,g,P,k,p):M.dracoDecodePointCloud(rt,Z,W,fe,N),n.defined(k.min)&&n.defined(k.max)||(k=void 0),L+=W,3===d)(zt=(L+r)%4)&&(zt=4-zt),(zt=((L=(J=ut(e,r,T,L+=zt)).bytesOffset)+r)%4)&&(zt=4-zt),L+=zt;B[I]={vertexPackage:fe,arrIndexPackage:V,cartographicBounds:k}}else if(S==ot&&3==d){var Q=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT;var z=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT,fe.minVerticesValue=new i.Cartesian4,fe.minTexCoordValue=[new A.Cartesian2,new A.Cartesian2],fe.texCoordCompressConstant=[new o.Cartesian3,new o.Cartesian3];V=[];for(var j=0;j0){var Ot=e.getInt8(L+r,!0);L+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(L+r,!0),L+=Int8Array.BYTES_PER_ELEMENT;var xt=e.getInt8(L+r,!0);L+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(L+r,!0),L+=Int8Array.BYTES_PER_ELEMENT;var bt,Ut,Kt=e.getInt32(L+r,!0);L+=Int32Array.BYTES_PER_ELEMENT,13!==xt?(bt=new Uint8Array(e.buffer,L+r,Kt),L+=Uint8Array.BYTES_PER_ELEMENT*Kt):(bt=new Uint32Array(e.buffer,L+r,Kt),L+=Uint32Array.BYTES_PER_ELEMENT*Kt),(zt=(L+r)%4)&&(zt=4-zt),L+=zt,13!==xt?(Ut=E.ComponentDatatype.createTypedArray(E.ComponentDatatype.UNSIGNED_BYTE,St*Uint32Array.BYTES_PER_ELEMENT),X.decodeIndexBuffer(Ut,St,Uint32Array.BYTES_PER_ELEMENT,bt)):Ut=bt;var Ht,Vt=e.getInt32(L+r,!0);L+=Int32Array.BYTES_PER_ELEMENT,w.indexType=Ot,0===Ot?Ht=new Uint16Array(St):1===Ot&&(Ht=new Uint32Array(St)),w.indicesCount=St;var wt=new Uint32Array(Ut.buffer,Ut.byteOffset,Ut.byteLength/4);Ht.set(wt,0),w.indicesTypedArray=Ht,w.primitiveType=xt;for(Pt=0;Pt0&&13!==xt){var Wt=fe.preVertexCount;w.indicesTypedArray=wt.map((function(t){return t+Wt})),w.indexType=1}V.push(w),(zt=(L+r)%4)&&(zt=4-zt),L+=zt}}}fe.nCompressOptions=Q,2===V.length&&13===V[1].primitiveType&&V[1].indicesCount>=3&&(Xt=y.S3MEdgeProcessor.createEdgeDataByIndices(fe,V[1],s)),n.defined(k.min)&&n.defined(k.max)||(k=void 0),B[I]={vertexPackage:fe,arrIndexPackage:V,edgeGeometry:Xt,cartographicBounds:k}}else{var Xt;if(S===At||S===nt)L=(kt=Rt(d,T,e,r,L,fe,C,g,P,p,c)).bytesOffset,k=kt.cartographicBounds;else if(S===ot&&(L=(kt=ht(T,e,r,L,fe,C,g,P,p,c)).bytesOffset,k=kt.cartographicBounds,3==d)){var Qt;L=(Qt=ut(e,r,T,L)).bytesOffset,fe.customVertexAttribute=JSON.parse(Qt.string);var zt;gt="aCustom"+fe.customVertexAttribute.TextureCoordMatrix,Ft="aCustom"+fe.customVertexAttribute.VertexWeight,Mt="aCustom"+fe.customVertexAttribute.VertexWeight_1;n.defined(fe.attrLocation[gt])&&(fe.attrLocation.aTextureCoordMatrix=fe.attrLocation[gt],delete fe.attrLocation[gt]),n.defined(fe.attrLocation[Ft])&&(fe.attrLocation.aVertexWeight=fe.attrLocation[Ft],delete fe.attrLocation[Ft]),n.defined(fe.attrLocation[Mt])&&(fe.attrLocation.aVertexWeight_1=fe.attrLocation[Mt],delete fe.attrLocation[Mt]);var jt;for(mt=(jt=Object.keys(fe.attrLocation)).length,It=0;It=3&&(Xt=y.S3MEdgeProcessor.createEdgeDataByIndices(fe,V[1],s)),L=kt.bytesOffset,n.defined(k)&&n.defined(k.min)&&n.defined(k.max)||(k=void 0),B[I]={vertexPackage:fe,arrIndexPackage:V,edgeGeometry:Xt,cartographicBounds:k}}if(3!==d&&n.defined(l)&&l){var $t=e.getUint16(L+r,!0);if(L+=Uint16Array.BYTES_PER_ELEMENT,1===$t){var te=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT;var ee,re=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT,e.getFloat32(L+r,!0),L+=Float32Array.BYTES_PER_ELEMENT;var ae=new Array(te),ne=new Array(te),Ae=new Array(te),oe=new Array(te);for(ee=0;ee-1e-10}function ae(t,e,r,a,A,o,i,B){var E=new DataView(t),s=new Uint8Array(t),y=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var l=C.getStringFromTypedArray(s,r,y);l=l.replace(/(\.s3mblock)|(\.s3mbz)|(\.s3mb)/gi,""),r+=y;var d=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(var f=0;f=3&&(E.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),E.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;var m=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var I=new Uint8Array(t,r,m),v=r+m,_=P.pako.inflate(I).buffer;B.push(_),E=new DataView(_);s=new Uint8Array(_);r=0;var S=E.getUint32(r,!0),O=ft(E,_,r+=Uint32Array.BYTES_PER_ELEMENT),N=O.buffer;r=O.byteOffset;var h=jt(M,N,E,O.dataViewByteOffset),R=r%4;0!==R&&(r+=4-R),kt((O=ft(E,_,r)).buffer,E,O.dataViewByteOffset,F,!1,void 0,void 0,M),r=O.byteOffset,3!==M&&((O=ft(E,_,r)).buffer,r=O.byteOffset);var G={};!function(t,e,r,a,A,o,i,B,E,s){var y=B,l=i.getUint32(y,!0);y+=Uint32Array.BYTES_PER_ELEMENT;for(var d={},f=0;fv[5]?v[4]:v[5];T={left:_,top:S,right:O,bottom:N,minHeight:h,maxHeight:R,width:(p=new dt(_,N,O,S,h,R)).width,length:p.length,height:p.height};var G=new Uint32Array(F,48+I,7),x=G[0],b=G[1],K=G[2],H=G[3];L={nFormat:x,nSideBlockCount:b,nBlockLength:K,nLength:H,nWidth:G[4],nHeight:G[5],nDepth:G[6],imageArray:new Uint8Array(F,76+I,H*H*4)}}}var V=0,w={};w.ignoreNormal=e.ignoreNormal;var Y=e.rootBatchIdMap||{},J=e.ancestorMap||{},k={},W=new DataView(a),X=W.getFloat32(V,!0);if(V+=Float32Array.BYTES_PER_ELEMENT,s)return W.getUint32(V,!0),V+=Uint32Array.BYTES_PER_ELEMENT,ae(a,a.byteLength,V,Y,J,e.isRoot,k,r),k;var Q=!1;if(X>=3&&(W.getUint32(V,!0),V+=Uint32Array.BYTES_PER_ELEMENT),X>=2&&(W.getUint32(V,!0),V+=Uint32Array.BYTES_PER_ELEMENT),re(X-1)||re(X-2)||re(X-3)||X>2.09&&X<2.11){var z=W.getUint32(V,!0);V+=Uint32Array.BYTES_PER_ELEMENT;var j=new Uint8Array(a,V,z);a=P.pako.inflate(j).buffer,r.push(a),W=new DataView(a),V=0}else if(X>1.199&&X<1.201){z=W.getUint32(V,!0);V+=Uint32Array.BYTES_PER_ELEMENT,r.push(a)}else{Q=!0,V=0;z=W.getInt32(V,!0);if(V+=Int32Array.BYTES_PER_ELEMENT,V+=Uint8Array.BYTES_PER_ELEMENT*z,o){W.getUint32(V,!0),V+=Uint32Array.BYTES_PER_ELEMENT;g=new Uint8Array(a,V);a=P.pako.inflate(g).buffer,r.push(a),W=new DataView(a),V=0}}var q=W.getUint32(V,!0),$=ft(W,a,V+=Uint32Array.BYTES_PER_ELEMENT),tt=$.buffer;V=$.byteOffset;var et={},rt=jt(X,tt,W,$.dataViewByteOffset,et,c,i),nt=V%4;0!==nt&&(V+=4-nt);var At=X>2.09&&3!==X;if(kt(($=ft(W,a,V)).buffer,W,$.dataViewByteOffset,w,Q,r,At,X,l,et,f,e.fileType,c),V=$.byteOffset,At)for(var ot=0;otu.S3MPixelFormat.BGR||p===u.S3MPixelFormat.LUMINANCE_ALPHA?new Uint8Array(d*f*4):new Uint16Array(d*f),y.DXTTextureDecode.decode(L,d,f,T,p),A.push(L.buffer),P=0):L=T,n[C]={id:C,width:d,height:f,compressType:P,oriCompressType:D,nFormat:p,imageBuffer:L,mipmapLevel:l}}}(B,($=ft(W,a,V)).buffer,W,$.dataViewByteOffset,pt,r),V=$.byteOffset;var Tt=W.getUint32(V,!0);V+=Uint32Array.BYTES_PER_ELEMENT;var Lt=new Uint8Array(a).subarray(V,V+Tt),Dt=C.getStringFromTypedArray(Lt);V+=Tt,Dt=Dt.replace(/\n\0/,"");var gt=JSON.parse(Dt);(3===X&&(q=W.getUint32(V,!0),V+=Uint32Array.BYTES_PER_ELEMENT),(q&at)==at)&&ee(($=ft(W,a,V)).buffer,W,$.dataViewByteOffset,w,X);if(1==X){var Ft=rt.pageLods,Mt=!0;for(ot=0;ot65535?new Uint32Array(s/2):new Uint16Array(s/2),u=0;for(E=0,C=o.length;E