define(["./Matrix2-fc7e9822","./AxisAlignedBoundingBox-7a3018c0","./Transforms-3ac41eb6","./defaultValue-94c3e563","./RuntimeError-c581ca93","./TerrainEncoding-229275c2","./ComponentDatatype-4a60b8d6","./OrientedBoundingBox-1e0d2855","./WebMercatorProjection-843df830","./_commonjsHelpers-3aae1032-f55dc0c4","./createTaskProcessorWorker","./combine-761d9c3f","./AttributeCompression-4d18cc04","./WebGLConstants-7dccdc96","./EllipsoidTangentPlane-53e32153","./IntersectionTests-68fbc42d","./Plane-e20fba8c"],(function(e,t,i,n,a,r,s,l,o,f,u,c,d,h,m,g,p){"use strict";constw={NONE:0,LERC:1};varx=Object.freeze(w);constk={};k.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});consty=newe.Cartesian3,I=newe.Matrix4,U=newe.Cartesian3,b=newe.Cartesian3;k.computeVertices=function(f){if(!n.defined(f)||!n.defined(f.heightmap))thrownewa.DeveloperError("options.heightmap is required.");if(!n.defined(f.width)||!n.defined(f.height))thrownewa.DeveloperError("options.width and options.height are required.");if(!n.defined(f.nativeRectangle))thrownewa.DeveloperError("options.nativeRectangle is required.");if(!n.defined(f.skirtHeight))thrownewa.DeveloperError("options.skirtHeight is required.");constu=Math.cos,c=Math.sin,d=Math.sqrt,h=Math.atan,m=Math.exp,g=s.CesiumMath.PI_OVER_TWO,p=s.CesiumMath.toRadians,w=f.heightmap,x=f.width,v=f.height,T=f.skirtHeight,M=T>0,V=n.defaultValue(f.isGeographic,!0),A=n.defaultValue(f.ellipsoid,e.Ellipsoid.WGS84),B=1/A.maximumRadius,D=e.Rectangle.clone(f.nativeRectangle),S=e.Rectangle.clone(f.rectangle);letP,E,C,F;n.defined(S)?(P=S.west,E=S.south,C=S.east,F=S.north):V?(P=p(D.west),E=p(D.south),C=p(D.east),F=p(D.north)):(P=D.west*B,E=g-2*h(m(-D.south*B)),C=D.east*B,F=g-2*h(m(-D.north*B)));letL=f.relativeToCenter;constR=n.defined(L);L=R?L:e.Cartesian3.ZERO;constN=n.defaultValue(f.includeWebMercatorT,!1),O=n.defaultValue(f.exaggeration,1),z=n.defaultValue(f.exaggerationRelativeHeight,0),H=1!==O,_=H,Y=n.defaultValue(f.structure,k.DEFAULT_STRUCTURE),W=n.defaultValue(Y.heightScale,k.DEFAULT_STRUCTURE.heightScale),X=n.defaultValue(Y.heightOffset,k.DEFAULT_STRUCTURE.heightOffset),Z=n.defaultValue(Y.elementsPerHeight,k.DEFAULT_STRUCTURE.elementsPerHeight),j=n.defaultValue(Y.stride,k.DEFAULT_STRUCTURE.stride),q=n.defaultValue(Y.elementMultiplier,k.DEFAULT_STRUCTURE.elementMultiplier),G=n.defaultValue(Y.isBigEndian,k.DEFAULT_STRUCTURE.isBigEndian);letQ=e.Rectangle.computeWidth(D),J=e.Rectangle.computeHeight(D);constK=Q/(x-1),$=J/(v-1);V||(Q*=B,J*=B);constee=A.radiiSquared,te=ee.x,ie=ee.y,ne=ee.z;letae=65536,re=-65536;constse=i.Transforms.eastNorthUpToFixedFrame(L,A),le=e.Matrix4.inverseTransformation(se,I);letoe,fe;N&&(oe=o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(E),fe=1/(o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F)-oe));constue=U;ue.x=Number.POSITIVE_INFINITY,ue.y=Number.POSITIVE_INFINITY,ue.z=Number.POSITIVE_INFINITY;constce=b;ce.x=Number.NEGATIVE_INFINITY,ce.y=Number.NEGATIVE_INFINITY,ce.z=Number.NEGATIVE_INFINITY;letde=Number.POSITIVE_INFINITY;consthe=x*v,me=T>0?2*x+2*v:0,ge=he+me,pe=newArray(ge),we=newArray(ge),xe=newArray(ge),ke=N?newArray(ge):[],ye=_?newArray(ge):[];letIe=0,Ue=v,be=0,ve=x;M&&(--Ie,++Ue,--be,++ve);constTe=1e-5;for(lett=Ie;t<Ue;++t){leti=t;i<0&&(i=0),i>=v&&(i=v-1);letn=D.north-$*i;n=V?p(n):g-2*h(m(-n*B));leta=(n-E)/(F-E);a=s.CesiumMath.clamp(a,0,1);constr=t===Ie,l=t===Ue-1;T>0&&(r?n+=Te*J:l&&(n-=Te*J));constf=u(n),k=c(n),I=ne*k;letU;N&&(U=(o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(n)-oe)*fe);for(lett=be;t<ve;++t){letn=t;n<0&&(n=0),n>=x&&(n=x-1);consto=i*(x*j)+n*j;leth;if(1===Z)h=w[o];else{lete;if(h=0,G)for(e=0;e<Z;++e)h=h*q+w[o+e];elsefor(e=Z-1;e>=0;--e)h=h*q+w[o+e]}h=h*W+X,re=Math.max(re,h),ae=Math.min(ae,h);letm=D.west+K*n;V?m=p(m):m*=B;letg=(m-P)/(C-P);g=s.CesiumMath.clamp(g,0,1);letb=i*x+n;if(T>0){conste=t===be,a=t===ve-1,s=r||l||e||a,o=(r||l)&&(e||a);if(o)continue;s&&(h-=T,e?(b=he+(v-i-1),m-=Te*Q):l?b=he+v+(x-n-1):a?(b=he+v+x+i,m+=Te*Q):r&&(b=he+v+x+v+n))}constM=f*u(m),S=f*c(m),E=te*M,F=ie*S,L=d(E*M+F*S+I*k),R=1/L,O=E*R,z=F*R,H=I*R,Y=newe.Cartesian3;Y.x=O+M*h,Y.y=z+S*h,Y.z=H+k*h,e.Matrix4.multiplyByPoint(le,Y,y),e.Cartesian3.minimumByComponent(y,ue,ue),e.Cartesian3.maximumByComponent(y,ce,ce),de=Math.min(de,h),pe[b]=Y,xe[b]=newe.Cartesian2(g,a),we[b]=h,N&&(ke[b]=U),_&&(ye[b]=A.geodeticSurfaceNormal(Y))}}constMe=i.BoundingSphere.fromPoints(pe);letVe,Ae;if(n.defined(S)&&(Ve=l.OrientedBoundingBox.fromRectangle(S,ae,re,A)),R){conste=newr.EllipsoidalOccluder(A);Ae=e.computeHorizonCullingPointPossiblyUnderEllipsoid(L,pe,ae)}constBe=newt.AxisAlignedBoundingBox(ue,ce,L),De=newr.TerrainEncoding(L,Be,de,re,se,!1,N,_,O,z),Se=newFloat32Array(ge*De.stride);letPe=0;for(lete=0;e<ge;++e)Pe=De.encode(Se,Pe,pe[e],xe[e],we[e],void0,ke[e],ye[e]);return{vertices:Se,maximumHeight:re,minimumHeight:ae,encoding:De,boundingSphere3D:Me,orientedBoundingBox:Ve,occludeePointInScaledSpace:Ae}};varv=f.createCommonjsModule((function(e){
/* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
(function(){vart=function(){vare={defaultNoDataValue:-34027999387901484e22,decode:function(r,s){s=s||{};varl=s.encodedMaskData||null===s.encodedMaskData,o=a(r,s.inputOffset||0,l),f=null!==s.noDataValue?s.noDataValue:e.defaultNoDataValue,u=t(o,s.pixelType||Float32Array,s.encodedMaskData,f,s.returnMask),c={width:o.width,height:o.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:o.pixels.maxValue,noDataValue:f};returnu.resultMask&&(c.maskData=u.resultMask),s.returnEncodedMask&&o.mask&&(c.encodedMaskData=o.mask.bitset?o.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=i(o),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(o))),c}},t=function(e,t,i,n,a){vars,l,o,f=0,u=e.pixels.numBlocksX,c=e.pixels.numBlocksY,d=Math.floor(e.width/u),h=Math.floor(e.height/c),m=2*e.maxZError,g=Number.MAX_VALUE;i=i||(e.mask?e.mask.bitset:null),l=newt(e.width*e.height),a&&i&&(o=newUint8Array(e.width*e.height));for(varp,w,x=newFloat32Array(d*h),k=0;k<=c;k++){vary=k!==c?h:e.height%c;if(0!==y)for(varI=0;I<=u;I++){varU=I!==u?d:e.width%u;if(0!==U){varb,v,T,M,V=k*e.width*h+I*d,A=e.width-U,B=e.pixels.blocks[f];if(B.encoding<2?(0===B.encoding?b=B.rawData:(r(B.stuffedData,B.bitsPerPixel,B.numValidPixels,B.offset,m,x,e.pixels.maxValue),b=x),v=0):T=2===B.encoding?0:B.offset,i)for(w=0;w<y;w++){for(7&V&&(M=i[V>>3],M<<=7&V),p=0;p<U;p++)7&V||(M=i[V>>3]),128&M?(o&&(o[V]=1),s=B.encoding<2?b[v++]:T,g=g>s?s:g,l[V++]=s):(o&&(o[V]=0),l[V++]=n),M<<=1;V+=A}elseif(B.encoding<2)for(w=0;w<y;w++){for(p=0;p<U;p++)s=b[v++],g=g>s?s:g,l[V++]=s;V+=A}elsefor(g=g>T?T:g,w=0;w<y;w++){for(p=0;p<U;p++)l[V++]=T;V+=A}if(1===B.encoding&&v!==B.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:l,resultMask:o,minValue:g}},i=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},n=function(e){for(vart=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},n=0;n<t;n++){vara=e.pixels.blocks[n];0===a.encoding?i.float32=!0:1===a.encoding?i[a.bitsPerPixel]=!0:i[0]=!0}returnObject.keys(i)},a=function(e,t,i){varn={},a=newUint8Array(e,t,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,a),"CntZImage"!==n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;t+=10;varr=newDataView(e,t,24);if(n.fileVersion=r.getInt32(0,!0),n.imageType=r.getInt32(4,!0),n.height=r.getUint32(8,!0),n.width=r.getUint32(12,!0),n.maxZError=r.getFloat64(16,!0),t+=24,!i)if(r=newDataView(e,t,16),n.mask={},n.mask.numBlocksY=r.getUint32(0,!0),n.mask.numBlocksX=r.getUint32(4,!0),n.mask.numBytes=r.getUint32(8,!0),n.mask.maxValue=r.getFloat32(12,!0),t+=16,n.mask.numBytes>0){vars=newUint8Array(Math.ceil(n.width*n.height/8));r=newDataView(e,t,n.mask.numBytes);varl=r.getInt16(0,!0),o=2,f=0;do{if(l>0)while(l--)s[f++]=r.getUint8(o++);else{varu=r.getUint8(o++);l=-l;while(l--)s[f++]=u}l=r.getInt16(o,!0),o+=2}while(o<n.mask.numBytes);if(-32768!==l||f<s.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=s,t+=n.mask.numBytes}else0===(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)&&(n.mask.bitset=newUint8Array(Math.ceil(n.width*n.height/8)));r=newDataView(e,t,16),n.pixels={},n.pixels.numBlocksY=r.getUint32(0,!0),n.pixels.numBlocksX=r.getUint32(4,!0),n.pixels.numBytes=r.getUint32(8,!0),n.pixels.maxValue=r.getFloat32(12,!0),t+=16;varc=n.pixels.numBlocksX,d=n.pixels.numBlocksY,h=c+(n.width%c>0?1:0),m=d+(n.height%d>0?1:0);n.pixels.blocks=newArray(h*m);for(varg=0,p=0;p<m;p++)for(varw=0;w<h;w++){varx=0,k=e.byteLength-t;r=newDataView(e,t,Math.min(10,k));vary={};n.pixels.blocks[g++]=y;varI=r.getUint8(0);if(x++,y.encoding=63&I,y.encoding>3)throw"Invalid block encoding ("+y.encoding+")";if(2!==y.encoding){if(0!==I&&2!==I){if(I>>=6,y.offsetType=I,2===I)y.offset=r.getInt8(1),x++;elseif(1===I)y.offset=r.getInt16(1,!0),x+=2;else{if(0!==I)throw"Invalid block offset type";y.offset=r.getFloat32(1,!0),x+=4}if(1===y.encoding)if(I=r.getUint8(x),x++,y.bitsPerPixel=63&I,I>>=6,y.numValidPixelsType=I,2===I)y.numValidPixels=r.getUint8(x),x++;elseif(1===I)y.numValidPixels=r.getUint16(x,!0),x+=2;else{if(0!==I)throw"Invalid valid pixel count type";y.numValidPixels=r.getUint32(x,!0),x+=4}}varU,b;if(t+=x,3!==y.encoding)if(0===y.encoding){varv=(n.pixels.numBytes-1)/4;if(v!==Math.floor(v))throw"uncompressed block has invalid length";U=newArrayBuffer(4*v),b=newUint8Array(U),b.set(newUint8Array(e,t,4*v));varT=newFloat32Array(U);y.rawData=T,t+=4*v}elseif(1===y.encoding){varM=Math.ceil(y.numValidPixels*y.bitsPerPixel/8),V=Math.ceil(M/4);U=newArrayBuffer(4*V),b=newUint8Array(U),b.set(newUint8Array(e,t,M)),y.stuffedData=newUint32Array(U),t+=M}}elset++}returnn.eofOffset=t,n},r=function(e,t,i,n,a,r,s){varl,o,f,u=(1<<t)-1,c=0,d=0,h=Math.ceil((s-n)/a),m=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*m,l=0;l<i;l++){if(0===d&&(f=e[c++],d=32),d>=t)o=f>>>d-t&u,d-=t;else{varg=t-d;o=(f&u)<<g&u,f=e[c++],d=32-g,o+=f>>>d}r[l]=o<h?n+o*a:s}returnr};returne}(),i=function(){vare={unstuff:function(e,t,i,n,a,r,s,l){varo,f,u,c,d,h=(1<<i)-1,m=0,g=0,p=4*e.length-Math.ceil(i*n/8);if(e[e.length-1]<<=8*p,a)for(o=0;o<n;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(c=i-g,f=(u&h)<<c&h,u=e[m++],g=32-c,f+=u>>>g),t[o]=a[f];elsefor(d=Math.ceil((l-r)/s),o=0;o<n;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(c=i-g,f=(u&h)<<c&h,u=e[m++],g=32-c,f+=u>>>g),t[o]=f<d?r+f*s:l},unstuffLUT:function(e,t,i,n,a,r){vars,l=(1<<t)-1,o=0,f=0,u=0,c=0,d=0,h=[],m=4*e.length-Math.ceil(t*i/8);e[e.length-1]<<=8*m;varg=Math.ceil((r-n)/a);for(f=0;f<i;f++)0===c&&(s=e[o++],c=32),c>=t?(d=s>>>c-t&l,c-=t):(u=t-c,d=(s&l)<<u&l,s=e[o++],c=32-u,d+=s>>>c),h[f]=d<g?n+d*a:r;returnh.unshift(n),h},unstuff2:function(e,t,i,n,a,r,s,l){varo,f,u,c,d=(1<<i)-1,h=0,m=0,g=0;if(a)for(o=0;o<n;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(c=i-m,f=u>>>g&d,u=e[h++],m=32-c,f|=(u&(1<<c)-1)<<i-c,g=c),t[o]=a[f];else{varp=Math.ceil((l-r)/s);for(o=0;o<n;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(c=i-m,f=u>>>g&d,u=e[h++],m=32-c,f|=(u&(1<<c)-1)<<i-c,g=c),t[o]=f<p?r+f*s:l}returnt},unstuffLUT2:function(e,t,i,n,a,r){vars,l=(1<<t)-1,o=0,f=0,u=0,c=0,d=0,h=0,m=[],g=Math.ceil((r-n)/a);for(f=0;f<i;f++)0===c&&(s=e[o++],c=32,h=0),c>=t?(d=s>>>h&l,c-=t,h+=t):(u=t-c,d=s>>>h&l,s=e[o++],c=32-u,d|=(s&(1<<u)-1)<<t-u,h=u),m[f]=d<g?n+d*a:r;returnm.unshift(n),m},originalUnstuff:function(e,t,i,n){vara,r,s,l,o=(1<<i)-1,f=0,u=0,c=4*e.length-Math.ceil(i*n/8);for(e[e.length-1]<<=8*c,a=0;a<n;a++)0===u&&(s=e[f++],u=32),u>=i?(r=s>>>u-i&o,u-=i):(l=i-u,r=(s&o)<<l&o,s=e[f++],u=32-l,r+=s>>>u),t[a]=r;returnt},originalUnstuff2:function(e,t,i,n){vara,r,s,l,o=(1<<i)-1,f=0,u=0,c=0;for(a=0;a<n;a++)0===u&&(s=e[f++],u=32,c=0),u>=i?(r=s>>>c&o,u-=i,c+=i):(l=i-u,r=s>>>c&o,s=e[f++],u=32-l,r|=(s&(1<<l)-1)<<i-l,c=l),t[a]=r;returnt}},t={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){vart=65535,i=65535,n=e.length,a=Math.floor(n/2),r=0;while(a){vars=a>=359?359:a;a-=s;do{t+=e[r++]<<8,i+=t+=e[r++]}while(--s);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return1&n&&(i+=t+=e[r]<<8),t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16),(i<<16|t)>>>0},readHeaderInfo:function(e,t){vari=t.ptr,n=newUint8Array(e,i,6),a={};if(a.fileIdentifierString=String.fromCharCode.apply(null,n),0!==a.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+a.fileIdentifierString;i+=6;varr,s,l=newDataView(e,i,8),o=l.getInt32(0,!0);if(a.fileVersion=o,i+=4,o>=3&&(a.checksum=l.getUint32(4,!0),i+=4),l=newDataView(e,i,12),a.height=l.getUint32(0,!0),a.width=l.getUint32(4,!0),i+=8,o>=4?(a.numDims=l.getUint32(8,!0),i+=4):a.numDims=1,l=newDataView(e,i,40),a.numValidPixel=l.getUint32(0,!0),a.microBlockSize=l.getInt32(4,!0),a.blobSize=l.getInt32(8,!0),a.imageType=l.getInt32(12,!0),a.maxZError=l.getFloat64(16,!0),a.zMin=l.getFloat64(24,!0),a.zMax=l.getFloat64(32,!0),i+=40,t.headerInfo=a,t.ptr=i,o>=3&&(s=o>=4?52:48,r=this.computeChecksumFletcher32(newUint8Array(e,i-s,a.blobSize-14)),r!==a.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){vari=t.headerInfo,n=this.getDataTypeArray(i.imageType),a=i.numDims*this.getDataTypeSize(i.imageType),r=this.readSubArray(e,t.ptr,n,a),s=this.readSubArray(e,t.ptr+a,n,a);t.ptr+=2*a;varl,o=!0;for(l=0;l<i.numDims;l++)if(r[l]!==s[l]){o=!1;break}returni.minValues=r,i.maxValues=s,o},readSubArray:function(e,t,i,n){vara;if(i===Uint8Array)a=newUint8Array(e,t,n);else{varr=newArrayBuffer(n),s=newUint8Array(r);s.set(newUint8Array(e,t,n)),a=newi(r)}returna},readMask:function(e,t){vari,n,a=t.ptr,r=t.headerInfo,s=r.width*r.height,l=r.numValidPixel,o=newDataView(e,a,4),f={};if(f.numBytes=o.getUint32(0,!0),a+=4,(0===l||s===l)&&0!==f.numBytes)throw"invalid mask";if(0===l)i=newUint8Array(Math.ceil(s/8)),f.bitset=i,n=newUint8Array(s),t.pixels.resultMask=n,a+=f.numBytes;elseif(f.numBytes>0){i=newUint8Array(Math.ceil(s/8)),o=newDataView(e,a,f.numBytes);varu=o.getInt16(0,!0),c=2,d=0,h=0;do{if(u>0)while(u--)i[d++]=o.getUint8(c++);else{h=o.getUint8(c++),u=-u;while(u--)i[d++]=h}u=o.getInt16(c,!0),c+=2}while(c<f.numBytes);if(-32768!==u||d<i.length)throw"Unexpected end of mask RLE encoding";n=newUint8Array(s);varm=0,g=0;for(g=0;g<s;g++)7&g?(m=i[g>>3],m<<=7&g):m=i[g>>3],128&m&&(n[g]=1);t.pixels.resultMask=n,f.bitset=i,a+=f.numBytes}returnt.ptr=a,t.mask=f,!0},readDataOneSweep:function(e,i,n){vara,r=i.ptr,s=i.headerInfo,l=s.numDims,o=s.width*s.height,f=s.imageType,u=s.numValidPixel*t.getDataTypeSize(f)*l,c=i.pixels.resultMask;if(n===Uint8Array)a=newUint8Array(e,r,u);else{vard=newArrayBuffer(u),h=newUint8Array(d);h.set(newUint8Array(e,r,u)),a=newn(d)}if(a.length===o*l)i.pixels.resultPixels=a;else{i.pixels.resultPixels=newn(o*l);varm=0,g=0,p=0,w=0;if(l>1)for(p=0;p<l;p++)for(w=p*o,g=0;g<o;g++)c[g]&&(i.pixels.resultPixels[w+g]=a[m++]);elsefor(g=0;g<o;g++)c[g]&&(i.pixels.resultPixels[g]=a[m++])}returnr+=u,i.ptr=r,!0},readHuffmanTree:function(e,n){vara=this.HUFFMAN_LUT_BITS_MAX,r=newDataView(e,n.ptr,16);n.ptr+=16;vars=r.getInt32(0,!0);if(s<2)throw"unsupported Huffman version";varl=r.getInt32(4,!0),o=r.getInt32(8,!0),f=r.getInt32(12,!0);if(o>=f)return!1;varu=newUint32Array(f-o);t.decodeBits(e,n,u);varc,d,h,m,g=[];for(c=o;c<f;c++)d=c-(c<l?0:l),g[d]={first:u[c-o],second:null};varp=e.byteLength-n.ptr,w=Math.ceil(p/4),x=newArrayBuffer(4*w),k=newUint8Array(x);k.set(newUint8Array(e,n.ptr,p));vary,I=newUint32Array(x),U=0,b=0;for(y=I[0],c=o;c<f;c++)d=c-(c<l?0:l),m=g[d].first,m>0&&(g[d].second=y<<U>>>32-m,32-U>=m?(U+=m,32===U&&(U=0,b++,y=I[b])):(U+=m-32,b++,y=I[b],g[d].second|=y>>>32-U));varv=0,T=0,M=newi;for(c=0;c<g.length;c++)void0!==g[c]&&(v=Math.max(v,g[c].first));T=v>=a?a:v,v>=30&&console.log("WARning, large NUM LUT BITS IS "+v);varV,A,B,D,S,P,E=[];for(c=o;c<f;c++)if(d=c-(c<l?0:l),m=g[d].first,m>0)if(V=[m,d],m<=T)for(A=g[d].second<<T-m,B=1<<T-m,h=0;h<B;h++)E[A|h]=V;elsefor(A=g[d].second,P=M,D=m-1;D>=0;D--)S=A>>>D&1,S?(P.right||(P.right=newi),P=P.right):(P.left||(P.left=newi),P=P.left),0!==D||P.val||(P.val=V[1]);return{decodeLut:E,numBitsLUTQick:T,numBitsLUT:v,tree:M,stuffedData:I,srcPtr:b,bitPos:U}},readHuffman:function(e,t,i){varn,a,r,s,l,o,f,u,c,d,h=t.headerInfo,m=h.numDims,g=t.headerInfo.height,p=t.headerInfo.width,w=p*g,x=this.readHuffmanTree(e,t),k=x.decodeLut,y=x.tree,I=x.stuffedData,U=x.srcPtr,b=x.bitPos,v=x.numBitsLUTQick,T=x.numBitsLUT,M=0===t.headerInfo.imageType?128:0,V=t.pixels.resultMask,A=0;b>0&&(U++,b=0);varB,D=I[U],S=1===t.encodeMode,P=newi(w*m),E=P;for(B=0;B<h.numDims;B++){if(m>1&&(E=newi(P.buffer,w*B,w),A=0),t.headerInfo.numValidPixel===p*g)for(c=0,f=0;f<g;f++)for(u=0;u<p;u++,c++){if(a=0,s=D<<b>>>32-v,l=s,32-b<v&&(s|=I[U+1]>>>64-b-v,l=s),k[l])a=k[l][1],b+=k[l][0];elsefor(s=D<<b>>>32-T,l=s,32-b<T&&(s|=I[U+1]>>>64-b-T,l=s),n=y,d=0;d<T;d++)if(o=s>>>T-d-1&1,n=o?n.right:n.left,!n.left&&!n.right){a=n.val,b=b+d+1;break}b>=32&&(b-=32,U++,D=I[U]),r=a-M,S?(r+=u>0?A:f>0?E[c-p]:A,r&=255,E[c]=r,A=r):E[c]=r}elsefor(c=0,f=0;f<g;f++)for(u=0;u<p;u++,c++)if(V[c]){if(a=0,s=D<<b>>>32-v,l=s,32-b<v&&(s|=I[U+1]>>>64-b-v,l=s),k[l])a=k[l][1],b+=k[l][0];elsefor(s=D<<b>>>32-T,l=s,32-b<T&&(s|=I[U+1]>>>64-b-T,l=s),n=y,d=0;d<T;d++)if(o=s>>>T-d-1&1,n=o?n.right:n.left,!n.left&&!n.right){a=n.val,b=b+d+1;break}b>=32&&(b-=32,U++,D=I[U]),r=a-M,S?(u>0&&V[c-1]?r+=A:f>0&&V[c-p]?r+=E[c-p]:r+=A,r&=255,E[c]=r,A=r):E[c]=r}t.ptr=t.ptr+4*(U+1)+(b>0?4:0)}t.pixels.resultPixels=P},decodeBits:function(t,i,n,a,r){vars=i.headerInfo,l=s.fileVersion,o=0,f=newDataView(t,i.ptr,5),u=f.getUint8(0);o++;varc=u>>6,d=0===c?4:3-c,h=(32&u)>0,m=31&u,g=0;if(1===d)g=f.getUint8(o),o++;elseif(2===d)g=f.getUint16(o,!0),o+=2;else{if(4!==d)throw"Invalid valid pixel count type";g=f.getUint32(o,!0),o+=4}varp,w,x,k,y,I,U,b,v,T=2*s.maxZError,M=s.numDims>1?s.maxValues[r]:s.zMax;if(h){i.counter.lut++,b=f.getUint8(o),o++,k=Math.ceil((b-1)*m/8),y=Math.ceil(k/4),w=newArrayBuffer(4*y),x=newUint8Array(w),i.ptr+=o,x.set(newUint8Array(t,i.ptr,k)),U=newUint32Array(w),i.ptr+=k,v=0;while(b-1>>>v)v++;k=Math.ceil(g*v/8),y=Math.ceil(k/4),w=newArrayBuffer(4*y),x=newUint8Array(w),x.set(newUint8Array(t,i.ptr,k)),p=newUint32Array(w),i.ptr+=k,I=l>=3?e.unstuffLUT2(U,m,b-1,a,T,M):e.unstuffLUT(U,m,b-1,a,T,M),l>=3?e.unstuff2(p,n,v,g,I):e.unstuff(p,n,v,g,I)}elsei.counter.bitstuffer++,v=m,i.ptr+=o,v>0&&(k=Math.ceil(g*v/8),y=Math.ceil(k/4),w=newArrayBuffer(4*y),x=newUint8Array(w),x.set(newUint8Array(t,i.ptr,k)),p=newUint32Array(w),i.ptr+=k,l>=3?null==a?e.originalUnstuff2(p,n,v,g):e.unstuff2(p,n,v,g,!1,a,T,M):null==a?e.originalUnstuff(p,n,v,g):e.unstuff(p,n,v,g,!1,a,T,M))},readTiles:function(e,i,n){vara=i.headerInfo,r=a.width,s=a.height,l=a.microBlockSize,o=a.imageType,f=t.getDataTypeSize(o),u=Math.ceil(r/l),c=Math.ceil(s/l);i.pixels.numBlocksY=c,i.pixels.numBlocksX=u,i.pixels.ptr=0;vard,h,m,g,p,w,x,k,y,I=0,U=0,b=0,v=0,T=0,M=0,V=0,A=0,B=0,D=0,S=0,P=0,E=0,C=0,F=0,L=0,R=newn(l*l),N=s%l||l,O=r%l||l,z=a.numDims,H=i.pixels.resultMask,_=i.pixels.resultPixels;for(b=0;b<c;b++)for(T=b!==c-1?l:N,v=0;v<u;v++)for(M=v!==u-1?l:O,S=b*r*l+v*l,P=r-M,y=0;y<z;y++){if(z>1&&(_=newn(i.pixels.resultPixels.buffer,r*s*y*f,r*s)),V=e.byteLength-i.ptr,d=newDataView(e,i.ptr,Math.min(10,V)),h={},L=0,A=d.getUint8(0),L++,B=A>>6&255,D=A>>2&15,D!==(v*l>>3&15))throw"integrity issue";if(w=3&A,w>3)throwi.ptr+=L,"Invalid block encoding ("+w+")";if(2!==w)if(0===w){if(i.counter.uncompressed++,i.ptr+=L,E=T*M*f,C=e.byteLength-i.ptr,E=E<C?E:C,m=newArrayBuffer(E%f===0?E:E+f-E%f),g=newUint8Array(m),g.set(newUint8Array(e,i.ptr,E)),p=newn(m),F=0,H)for(I=0;I<T;I++){for(U=0;U<M;U++)H[S]&&(_[S]=p[F++]),S++;S+=P}elsefor(I=0;I<T;I++){for(U=0;U<M;U++)_[S++]=p[F++];S+=P}i.ptr+=F*f}elseif(x=t.getDataTypeUsed(o,B),k=t.getOnePixel(h,L,x,d),L+=t.getDataTypeSize(x),3===w)if(i.ptr+=L,i.counter.constantoffset++,H)for(I=0;I<T;I++){for(U=0;U<M;U++)H[S]&&(_[S]=k),S++;S+=P}elsefor(I=0;I<T;I++){for(U=0;U<M;U++)_[S++]=k;S+=P}elseif(i.ptr+=L,t.decodeBits(e,i,R,k,y),L=0,H)for(I=0;I<T;I++){for(U=0;U<M;U++)H[S]&&(_[S]=R[L++]),S++;S+=P}elsefor(I=0;I<T;I++){for(U=0;U<M;U++)_[S++]=R[L++];S+=P}elsei.counter.constant++,i.ptr+=L}},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:t.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e){vart=e.headerInfo.zMax,i=e.headerInfo.numDims,n=e.headerInfo.height*e.headerInfo.width,a=n*i,r=0,s=0,l=0,o=e.pixels.resultMask;if(o)if(i>1)for(r=0;r<i;r++)for(l=r*n,s=0;s<n;s++)o[s]&&(e.pixels.resultPixels[l+s]=t);elsefor(s=0;s<n;s++)o[s]&&(e.pixels.resultPixels[s]=t);elseif(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);elsefor(s=0;s<a;s++)e.pixels.resultPixels[s]=t},getDataTypeArray:function(e){vart;switch(e){case0:t=Int8Array;break;case1:t=Uint8Array;break;case2:t=Int16Array;break;case3:t=Uint16Array;break;case4:t=Int32Array;break;case5:t=Uint32Array;break;case6:t=Float32Array;break;case7:t=Float64Array;break;default:t=Float32Array}returnt},getPixelType:function(e){vart;switch(e){case0:t="S8";break;case1:t="U8";break;case2:t="S16";break;case3:t="U16";break;case4:t="S32";break;case5:t="U32";break;case6:t="F32";break;case7:t="F64";break;default:t="F32"}returnt},isValidPixelValue:function(e,t){if(null==t)return!1;vari;switch(e){case0:i=t>=-128&&t<=127;break;case1:i=t>=0&&t<=255;break;case2:i=t>=-32768&&t<=32767;break;case3:i=t>=0&&t<=65536;break;case4:i=t>=-2147483648&&t<=2147483647;break;case5:i=t>=0&&t<=4294967296;break;case6:i=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case7:i=t>=5e-324&&t<=17976931348623157e292;break;default:i=!1}returni},getDataTypeSize:function(e){vart=0;switch(e){case0:case1:t=1;break;case2:case3:t=2;break;case4:case5:case6:t=4;break;case7:t=8;break;default:t=e}returnt},getDataTypeUsed:function(e,t){vari=e;switch(e){case2:case4:i=e-t;break;case3:case5:i=e-2*t;break;case6:i=0===t?e:1===t?2:1;break;case7:i=0===t?e:e-2*t+1;break;default:i=e;break}returni},getOnePixel:function(e,t,i,n){vara=0;switch(i){case0:a=n.getInt8(t);break;case1:a=n.getUint8(t);break;case2:a=n.getInt16(t,!0);break;case3:a=n.getUint16(t,!0);break;case4:a=n.getInt32(t,!0);break;case5:a=n.getUInt32(t,!0);break;case6:a=n.getFloat32(t,!0);break;case7:a=n.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}returna}},i=function(e,t,i){this.val=e,this.left=t,this.right=i},n={decode:function(e,i){i=i||{};varn=i.noDataValue,a=0,r={};r.ptr=i.inputOffset||0,r.pixels={},t.readHeaderInfo(e,r);vars=r.headerInfo,l=s.fileVersion,o=t.getDataTypeArray(s.imageType);t.readMask(e,r),s.numValidPixel===s.width*s.height||r.pixels.resultMask||(r.pixels.resultMask=i.maskData);varf,u=s.width*s.height;if(r.pixels.resultPixels=newo(u*s.numDims),r.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==s.numValidPixel)if(s.zMax===s.zMin)t.constructConstantSurface(r);elseif(l>=4&&t.checkMinMaxRanges(e,r))t.constructConstantSurface(r);else{varc=newDataView(e,r.ptr,2),d=c.getUint8(0);if(r.ptr++,d)t.readDataOneSweep(e,r,o);elseif(l>1&&s.imageType<=1&&Math.abs(s.maxZError-.5)<1e-5){varh=c.getUint8(1);if(r.ptr++,r.encodeMode=h,h>2||l<4&&h>1)throw"Invalid Huffman flag "+h;h?t.readHuffman(e,r,o):t.readTiles(e,r,o)}elset.readTiles(e,r,o)}r.eofOffset=r.ptr,i.inputOffset?(f=r.headerInfo.blobSize+i.inputOffset-r.ptr,Math.abs(f)>=1&&(r.eofOffset=i.inputOffset+r.headerInfo.blobSize)):(f=r.headerInfo.blobSize-r.ptr,Math.abs(f)>=1&&(r.eofOffset=r.headerInfo.blobSize));varm={width:s.width,height:s.height,pixelData:r.pixels.resultPixels,minValue:s.zMin,maxValue:s.zMax,validPixelCount:s.numValidPixel,dimCount:s.numDims,dimStats:{minValues:s.minValues,maxValues:s.maxValues},maskData:r.pixels.resultMask};if(r.pixels.resultMask&&t.isValidPixelValue(s.imageType,n)){varg=r.pixels.resultMask;for(a=0;a<u;a++)g[a]||(m.pixelData[a]=n);m.noDataValue=n}returnr.noDataValue=n,i.returnFileInfo&&(m.fileInfo=t.formatFileInfo(r)),m},getBandCount:function(e){vari=0,n=0,a={ptr:0,pixels:{}};while(n<e.byteLength-58)t.readHeaderInfo(e,a),n+=a.headerInfo.blobSize,i++,a.ptr=n;returni}};returnn}(),n=function(){vare=newArrayBuffer(4),t=newUint8Array(e),i=newUint32Array(e);returni[0]=1,1===t[0]}(),a={decode:function(e,a){if(!n)throw"Big endian system is not supported.";a=a||{};varr,s,l=a.inputOffset||0,o=newUint8Array(e,l,10),f=String.fromCharCode.apply(null,o);if("CntZImage"===f.trim())r=t,s=1;else{if("Lerc2"!==f.substring(0,5))throw"Unexpected file identifier string: "+f;r=i,s=2}varu,c,d,h,m,g,p=0,w=e.byteLength-10,x=[],k={width:0,height:0,pixels:[],pixelType:a.pixelType,mask:null,statistics:[]};while(l<w){vary=r.decode(e,{inputOffset:l,encodedMaskData:u,maskData:d,returnMask:0===p,returnEncodedMask:0===p,returnFileInfo:!0,pixelType:a.pixelType||null,noDataValue:a.noDataValue||null});l=y.fileInfo.eofOffset,0===p&&(u=y.encodedMaskData,d=y.maskData,k.width=y.width,k.height=y.height,k.dimCount=y.dimCount||1,k.pixelType=y.pixelType||y.fileInfo.pixelType,k.mask=y.maskData),s>1&&y.fileInfo.mask&&y.fileInfo.mask.numBytes>0&&x.push(y.maskData),p++,k.pixels.push(y.pixelData),k.statistics.push({minValue:y.minValue,maxValue:y.maxValue,noDataValue:y.noDataValue,dimStats:y.dimStats})}if(s>1&&x.length>1){for(g=k.width*k.height,k.bandMasks=x,d=newUint8Array(g),d.set(x[0]),h=1;h<x.length;h++)for(c=x[h],m=0;m<g;m++)d[m]=d[m]&c[m];k.maskData=d}returnk}};e.exports?e.exports=a:this.Lerc=a})()}));functionT(t,i){if(t.encoding===x.LERC){lete;try{e=v.decode(t.heightmap)}catch(s){thrownewa.RuntimeError(s)}consti=e.statistics[0];if(i.minValue===Number.MAX_VALUE)thrownewa.RuntimeError("Invalid tile data");t.heightmap=e.pixels[0],t.width=e.width,t.height=e.height}t.ellipsoid=e.Ellipsoid.clone(t.ellipsoid),t.rectangle=e.Rectangle.clone(t.rectangle);constn=k.computeVertices(t),r=n.vertices;returni.push(r.buffer),{vertices:r.buffer,numberOfAttributes:n.encoding.stride,minimumHeight:n.minimumHeight,maximumHeight:n.maximumHeight,gridWidth:t.width,gridHeight:t.height,boundingSphere3D:n.boundingSphere3D,orientedBoundingBox:n.orientedBoundingBox,occludeePointInScaledSpace:n.occludeePointInScaledSpace,encoding:n.encoding,westIndicesSouthToNorth:n.westIndicesSouthToNorth,southIndicesEastToWest:n.southIndicesEastToWest,eastIndicesNorthToSouth:n.eastIndicesNorthToSouth,northIndicesWestToEast:n.northIndicesWestToEast}}varM=u(T);returnM}));
define(["./AxisAlignedBoundingBox-7a3018c0","./Matrix2-fc7e9822","./defaultValue-94c3e563","./TerrainEncoding-229275c2","./IndexDatatype-db156785","./ComponentDatatype-4a60b8d6","./RuntimeError-c581ca93","./Transforms-3ac41eb6","./WebMercatorProjection-843df830","./createTaskProcessorWorker","./AttributeCompression-4d18cc04","./WebGLConstants-7dccdc96","./_commonjsHelpers-3aae1032-f55dc0c4","./combine-761d9c3f"],(function(e,t,r,n,o,i,a,s,c,h,d,u,l,I){"use strict";functionm(){a.DeveloperError.throwInstantiationError()}Object.defineProperties(m.prototype,{errorEvent:{get:a.DeveloperError.throwInstantiationError},credit:{get:a.DeveloperError.throwInstantiationError},tilingScheme:{get:a.DeveloperError.throwInstantiationError},ready:{get:a.DeveloperError.throwInstantiationError},readyPromise:{get:a.DeveloperError.throwInstantiationError},hasWaterMask:{get:a.DeveloperError.throwInstantiationError},hasVertexNormals:{get:a.DeveloperError.throwInstantiationError},availability:{get:a.DeveloperError.throwInstantiationError}});constg=[];m.getRegularGridIndices=function(e,t){if(e*t>=i.CesiumMath.FOUR_GIGABYTES)thrownewa.DeveloperError("The total number of vertices (width * height) must be less than 4,294,967,296.");letn=g[e];r.defined(n)||(g[e]=n=[]);leto=n[t];returnr.defined(o)||(o=e*t<i.CesiumMath.SIXTY_FOUR_KILOBYTES?n[t]=newUint16Array((e-1)*(t-1)*6):n[t]=newUint32Array((e-1)*(t-1)*6),p(e,t,o,0)),o};constT=[];m.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=i.CesiumMath.FOUR_GIGABYTES)thrownewa.DeveloperError("The total number of vertices (width * height) must be less than 4,294,967,296.");letn=T[e];r.defined(n)||(T[e]=n=[]);leto=n[t];if(!r.defined(o)){constr=m.getRegularGridIndices(e,t),i=f(e,t),a=i.westIndicesSouthToNorth,s=i.southIndicesEastToWest,c=i.eastIndicesNorthToSouth,h=i.northIndicesWestToEast;o=n[t]={indices:r,westIndicesSouthToNorth:a,southIndicesEastToWest:s,eastIndicesNorthToSouth:c,northIndicesWestToEast:h}}returno};constE=[];functionf(e,t){constr=newArray(t),n=newArray(e),o=newArray(t),i=newArray(e);leta;for(a=0;a<e;++a)i[a]=a,n[a]=e*t-1-a;for(a=0;a<t;++a)o[a]=(a+1)*e-1,r[a]=(t-a-1)*e;return{westIndicesSouthToNorth:r,southIndicesEastToWest:n,eastIndicesNorthToSouth:o,northIndicesWestToEast:i}}functionp(e,t,r,n){leto=0;for(leti=0;i<t-1;++i){for(lett=0;t<e-1;++t){constt=o,i=t+e,a=i+1,s=t+1;r[n++]=t,r[n++]=i,r[n++]=s,r[n++]=s,r[n++]=i,r[n++]=a,++o}++o}}functionw(e,t,r,n){leto=e[0];consti=e.length;for(leta=1;a<i;++a){consti=e[a];r[n++]=o,r[n++]=i,r[n++]=t,r[n++]=t,r[n++]=i,r[n++]=t+1,o=i,++t}returnn}m.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=i.CesiumMath.FOUR_GIGABYTES)thrownewa.DeveloperError("The total number of vertices (width * height) must be less than 4,294,967,296.");letn=E[e];r.defined(n)||(E[e]=n=[]);lets=n[t];if(!r.defined(s)){constr=e*t,i=(e-1)*(t-1)*6,a=2*e+2*t,c=6*Math.max(0,a-4),h=r+a,d=i+c,u=f(e,t),l=u.westIndicesSouthToNorth,I=u.southIndicesEastToWest,g=u.eastIndicesNorthToSouth,T=u.northIndicesWestToEast,E=o.IndexDatatype.createTypedArray(h,d);p(e,t,E,0),m.addSkirtIndices(l,I,g,T,r,E,i),s=n[t]={indices:E,westIndicesSouthToNorth:l,southIndicesEastToWest:I,eastIndicesNorthToSouth:g,northIndicesWestToEast:T,indexCountWithoutSkirts:i}}returns},m.addSkirtIndices=function(e,t,r,n,o,i,a){lets=o;a=w(e,s,i,a),s+=e.length,a=w(t,s,i,a),s+=t.length,a=w(r,s,i,a),s+=r.length,w(n,s,i,a)},m.heightmapTerrainQuality=.25,m.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return2*e.maximumRadius*Math.PI*m.heightmapTerrainQuality/(t*r)},m.prototype.requestTileGeometry=a.DeveloperError.throwInstantiationError,m.prototype.getLevelMaximumGeometricError=a.DeveloperError.throwInstantiationError,m.prototype.getTileDataAvailable=a.DeveloperError.throwInstantiationError,m.prototype.loadTileDataAvailability=a.DeveloperError.throwInstantiationError;consty=32767,N=newt.Cartesian3,S=newt.Cartesian3,M=newt.Cartesian3,b=newt.Cartographic,x=newt.Cartesian2;functionA(a,h){constd=a.quantizedVertices,u=d.length/3,l=a.octEncodedNormals,I=a.westIndices.length+a.eastIndices.length+a.southIndices.length+a.northIndices.length,g=a.includeWebMercatorT,T=a.exaggeration,E=a.exaggerationRelativeHeight,f=1!==T,p=f,w=t.Rectangle.clone(a.rectangle),A=w.west,D=w.south,P=w.east,G=w.north,F=t.Ellipsoid.clone(a.ellipsoid),_=a.minimumHeight,k=a.maximumHeight,H=a.relativeToCenter,Y=s.Transforms.eastNorthUpToFixedFrame(H,F),O=t.Matrix4.inverseTransformation(Y,newt.Matrix4);letB,V;g&&(B=c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(D),V=1/(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(G)-B));constR=d.subarray(0,u),L=d.subarray(u,2*u),U=d.subarray(2*u,3*u),j=r.defined(l),z=newArray(u),q=newArray(u),Q=newArray(u),K=g?newArray(u):[],X=p?newArray(u):[],Z=S;Z.x=Number.POSITIVE_INFINITY,Z.y=Number.POSITIVE_INFINITY,Z.z=Number.POSITIVE_INFINITY;constJ=M;J.x=Number.NEGATIVE_INFINITY,J.y=Number.NEGATIVE_INFINITY,J.z=Number.NEGATIVE_INFINITY;let$=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,te=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY;for(lete=0;e<u;++e){constr=R[e],n=L[e],o=r/y,a=n/y,s=i.CesiumMath.lerp(_,k,U[e]/y);b.longitude=i.CesiumMath.lerp(A,P,o),b.latitude=i.CesiumMath.lerp(D,G,a),b.height=s,$=Math.min(b.longitude,$),ee=Math.max(b.longitude,ee),te=Math.min(b.latitude,te),re=Math.max(b.latitude,re);consth=F.cartographicToCartesian(b);z[e]=newt.Cartesian2(o,a),q[e]=s,Q[e]=h,g&&(K[e]=(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(b.latitude)-B)*V),p&&(X[e]=F.geodeticSurfaceNormal(h)),t.Matrix4.multiplyByPoint(O,h,N),t.Cartesian3.minimumByComponent(N,Z,Z),t.Cartesian3.maximumByComponent(N,J,J)}constne=W(a.westIndices,(function(e,t){returnz[e].y-z[t].y})),oe=W(a.eastIndices,(function(e,t){returnz[t].y-z[e].y})),ie=W(a.southIndices,(function(e,t){returnz[t].x-z[e].x})),ae=W(a.northIndices,(function(e,t){returnz[e].x-z[t].x}));letse;if(_<0){conste=newn.EllipsoidalOccluder(F);se=e.computeHorizonCullingPointPossiblyUnderEllipsoid(H,Q,_)}letce=_;ce=Math.min(ce,C(a.westIndices,a.westSkirtHeight,q,z,w,F,O,Z,J)),ce=Math.min(ce,C(a.southIndices,a.southSkirtHeight,q,z,w,F,O,Z,J)),ce=Math.min(ce,C(a.eastIndices,a.eastSkirtHeight,q,z,w,F,O,Z,J)),ce=Math.min(ce,C(a.northIndices,a.northSkirtHeight,q,z,w,F,O,Z,J));consthe=newe.AxisAlignedBoundingBox(Z,J,H),de=newn.TerrainEncoding(H,he,ce,k,Y,j,g,p,T,E),ue=de.stride,le=u*ue+I*ue,Ie=newFloat32Array(le);letme=0;for(lete=0;e<u;++e){if(j){constt=2*e;x.x=l[t],x.y=l[t+1]}me=de.encode(Ie,me,Q[e],z[e],q[e],x,K[e],X[e])}constge=Math.max(0,2*(I-4)),Te=a.indices.length+3*ge,Ee=o.IndexDatatype.createTypedArray(u+I,Te);Ee.set(a.indices,0);constfe=1e-4,pe=(ee-$)*fe,we=(re-te)*fe,ye=-pe,Ne=0,Se=pe,Me=0,be=0,xe=we,Ae=0,Ce=-we;letve=u*ue;returnv(Ie,ve,ne,de,q,z,l,F,w,a.westSkirtHeight,B,V,ye,Ne),ve+=a.westIndices.length*ue,v(Ie,ve,ie,de,q,z,l,F,w,a.southSkirtHeight,B,V,Ae,Ce),ve+=a.southIndices.length*ue,v(Ie,ve,oe,de,q,z,l,F,w,a.eastSkirtHeight,B,V,Se,Me),ve+=a.eastIndices.length*ue,v(Ie,ve,ae,de,q,z,l,F,w,a.northSkirtHeight,B,V,be,xe),m.addSkirtIndices(ne,ie,oe,ae,u,Ee,a.indices.length),h.push(Ie.buffer,Ee.buffer),{vertices:Ie.buffer,indices:Ee.buffer,westIndicesSouthToNorth:ne,southIndicesEastToWest:ie,eastIndicesNorthToSouth:oe,northIndicesWestToEast:ae,vertexStride:ue,center:H,minimumHeight:_,maximumHeight:k,occludeePointInScaledSpace:se,encoding:de,indexCountWithoutSkirts:a.indices.length}}functionC(e,r,n,o,a,s,c,h,d){letu=Number.POSITIVE_INFINITY;constl=a.north,I=a.south;letm=a.east;constg=a.west;m<g&&(m+=i.CesiumMath.TWO_PI);constT=e.length;for(letE=0;E<T;++E){consta=e[E],T=n[a],f=o[a];b.longitude=i.CesiumMath.lerp(g,m,f.x),b.latitude=i.CesiumMath.lerp(I,l,f.y),b.height=T-r;constp=s.cartographicToCartesian(b,N);t.Matrix4.multiplyByPoint(c,p,p),t.Cartesian3.minimumByComponent(p,h,h),t.Cartesian3.maximumByComponent(p,d,d),u=Math.min(u,b.height)}returnu}functionv(e,t,n,o,a,s,h,d,u,l,I,m,g,T){constE=r.defined(h),f=u.north,p=u.south;letw=u.east;consty=u.west;w<y&&(w+=i.CesiumMath.TWO_PI);constS=n.length;for(letr=0;r<S;++r){constu=n[r],S=a[u],M=s[u];b.longitude=i.CesiumMath.lerp(y,w,M.x)+g,b.latitude=i.CesiumMath.lerp(p,f,M.y)+T,b.height=S-l;constA=d.cartographicToCartesian(b,N);if(E){conste=2*u;x.x=h[e],x.y=h[e+1]}letC,v;o.hasWebMercatorT&&(C=(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(b.latitude)-I)*m),o.hasGeodeticSurfaceNormals&&(v=d.geodeticSurfaceNormal(A)),t=o.encode(e,t,A,M,b.height,x,C,v)}}functionW(e,t){letn;return"function"===typeofe.slice&&(n=e.slice(),"function"!==typeofn.sort&&(n=void0)),r.defined(n)||(n=Array.prototype.slice.call(e)),n.sort(t),n}varD=h(A);returnD}));
define(["./defaultValue-94c3e563","./Matrix2-fc7e9822","./Transforms-3ac41eb6","./ComponentDatatype-4a60b8d6","./RuntimeError-c581ca93","./GeometryAttribute-a441ff32","./GeometryAttributes-7df9bef6","./IndexDatatype-db156785","./VertexFormat-e46f29d6","./WallGeometryLibrary-627e5288","./_commonjsHelpers-3aae1032-f55dc0c4","./combine-761d9c3f","./WebGLConstants-7dccdc96","./arrayRemoveDuplicates-06991c15","./PolylinePipeline-0e310844","./EllipsoidGeodesic-dc94f381","./EllipsoidRhumbLine-daebc75b","./IntersectionTests-68fbc42d","./Plane-e20fba8c"],(function(e,t,i,n,r,o,a,s,l,m,d,p,u,c,f,h,g,y,C){"use strict";constw=newt.Cartesian3,x=newt.Cartesian3,b=newt.Cartesian3,E=newt.Cartesian3,v=newt.Cartesian3,A=newt.Cartesian3,_=newt.Cartesian3;functionF(i){i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT);consto=i.positions,a=i.maximumHeights,s=i.minimumHeights;if(!e.defined(o))thrownewr.DeveloperError("options.positions is required.");if(e.defined(a)&&a.length!==o.length)thrownewr.DeveloperError("options.positions and options.maximumHeights must have the same length.");if(e.defined(s)&&s.length!==o.length)thrownewr.DeveloperError("options.positions and options.minimumHeights must have the same length.");constm=e.defaultValue(i.vertexFormat,l.VertexFormat.DEFAULT),d=e.defaultValue(i.granularity,n.CesiumMath.RADIANS_PER_DEGREE),p=e.defaultValue(i.ellipsoid,t.Ellipsoid.WGS84);this._positions=o,this._minimumHeights=s,this._maximumHeights=a,this._vertexFormat=l.VertexFormat.clone(m),this._granularity=d,this._ellipsoid=t.Ellipsoid.clone(p),this._workerName="createWallGeometry";letu=1+o.length*t.Cartesian3.packedLength+2;e.defined(s)&&(u+=s.length),e.defined(a)&&(u+=a.length),this.packedLength=u+t.Ellipsoid.packedLength+l.VertexFormat.packedLength+1}F.pack=function(i,n,o){if(!e.defined(i))thrownewr.DeveloperError("value is required");if(!e.defined(n))thrownewr.DeveloperError("array is required");leta;o=e.defaultValue(o,0);consts=i._positions;letm=s.length;for(n[o++]=m,a=0;a<m;++a,o+=t.Cartesian3.packedLength)t.Cartesian3.pack(s[a],n,o);constd=i._minimumHeights;if(m=e.defined(d)?d.length:0,n[o++]=m,e.defined(d))for(a=0;a<m;++a)n[o++]=d[a];constp=i._maximumHeights;if(m=e.defined(p)?p.length:0,n[o++]=m,e.defined(p))for(a=0;a<m;++a)n[o++]=p[a];returnt.Ellipsoid.pack(i._ellipsoid,n,o),o+=t.Ellipsoid.packedLength,l.VertexFormat.pack(i._vertexFormat,n,o),o+=l.VertexFormat.packedLength,n[o]=i._granularity,n};constD=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),H=newl.VertexFormat,L={positions:void0,minimumHeights:void0,maximumHeights:void0,ellipsoid:D,vertexFormat:H,granularity:void0};functionV(i,n){returne.defined(n)&&(i=F.unpack(i,n)),i._ellipsoid=t.Ellipsoid.clone(i._ellipsoid),F.createGeometry(i)}returnF.unpack=function(i,n,o){if(!e.defined(i))thrownewr.DeveloperError("array is required");leta;n=e.defaultValue(n,0);lets=i[n++];constm=newArray(s);for(a=0;a<s;++a,n+=t.Cartesian3.packedLength)m[a]=t.Cartesian3.unpack(i,n);letd,p;if(s=i[n++],s>0)for(d=newArray(s),a=0;a<s;++a)d[a]=i[n++];if(s=i[n++],s>0)for(p=newArray(s),a=0;a<s;++a)p[a]=i[n++];constu=t.Ellipsoid.unpack(i,n,D);n+=t.Ellipsoid.packedLength;constc=l.VertexFormat.unpack(i,n,H);n+=l.VertexFormat.packedLength;constf=i[n];returne.defined(o)?(o._positions=m,o._minimumHeights=d,o._maximumHeights=p,o._ellipsoid=t.Ellipsoid.clone(u,o._ellipsoid),o._vertexFormat=l.VertexFormat.clone(c,o._vertexFormat),o._granularity=f,o):(L.positions=m,L.minimumHeights=d,L.maximumHeights=p,L.granularity=f,newF(L))},F.fromConstantHeights=function(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT);consti=t.positions;if(!e.defined(i))thrownewr.DeveloperError("options.positions is required.");letn,o;consta=t.minimumHeight,s=t.maximumHeight,l=e.defined(a),m=e.defined(s);if(l||m){conste=i.length;n=l?newArray(e):void0,o=m?newArray(e):void0;for(lett=0;t<e;++t)l&&(n[t]=a),m&&(o[t]=s)}constd={positions:i,maximumHeights:o,minimumHeights:n,ellipsoid:t.ellipsoid,vertexFormat:t.vertexFormat};returnnewF(d)},F.createGeometry=function(r){constl=r._positions,d=r._minimumHeights,p=r._maximumHeights,u=r._vertexFormat,c=r._granularity,f=r._ellipsoid,h=m.WallGeometryLibrary.computePositions(f,l,p,d,c,!0);if(!e.defined(h))return;constg=h.bottomPositions,y=h.topPositions,C=h.numCorners;letF=y.length,D=2*F;constH=u.position?newFloat64Array(D):void0,L=u.normal?newFloat32Array(D):void0,V=u.tangent?newFloat32Array(D):void0,k=u.bitangent?newFloat32Array(D):void0,G=u.st?newFloat32Array(D/3*2):void0;letP,T=0,z=0,O=0,R=0,S=0,I=_,q=A,N=v,M=!0;F/=3;letW=0;constB=1/(F-C-1);for(P=0;P<F;++P){conste=3*P,i=t.Cartesian3.fromArray(y,e,w),r=t.Cartesian3.fromArray(g,e,x);if(u.position&&(H[T++]=r.x,H[T++]=r.y,H[T++]=r.z,H[T++]=i.x,H[T++]=i.y,H[T++]=i.z),u.st&&(G[S++]=W,G[S++]=0,G[S++]=W,G[S++]=1),u.normal||u.tangent||u.bitangent){letr=t.Cartesian3.clone(t.Cartesian3.ZERO,E);consto=t.Cartesian3.subtract(i,f.geodeticSurfaceNormal(i,x),x);if(P+1<F&&(r=t.Cartesian3.fromArray(y,e+3,E)),M){conste=t.Cartesian3.subtract(r,i,b),n=t.Cartesian3.subtract(o,i,w);I=t.Cartesian3.normalize(t.Cartesian3.cross(n,e,I),I),M=!1}t.Cartesian3.equalsEpsilon(i,r,n.CesiumMath.EPSILON10)?M=!0:(W+=B,u.tangent&&(q=t.Cartesian3.normalize(t.Cartesian3.subtract(r,i,q),q)),u.bitangent&&(N=t.Cartesian3.normalize(t.Cartesian3.cross(I,q,N),N))),u.normal&&(L[z++]=I.x,L[z++]=I.y,L[z++]=I.z,L[z++]=I.x,L[z++]=I.y,L[z++]=I.z),u.tangent&&(V[R++]=q.x,V[R++]=q.y,V[R++]=q.z,V[R++]=q.x,V[R++]=q.y,V[R++]=q.z),u.bitangent&&(k[O++]=N.x,k[O++]=N.y,k[O++]=N.z,k[O++]=N.x,k[O++]=N.y,k[O++]=N.z)}}constU=newa.GeometryAttributes;u.position&&(U.position=newo.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:H})),u.normal&&(U.normal=newo.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),u.tangent&&(U.tangent=newo.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:V})),u.bitangent&&(U.bitangent=newo.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:k})),u.st&&(U.st=newo.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:G}));constJ=D/3;D-=6*(C+1);constY=s.IndexDatatype.createTypedArray(J,D);letj=0;for(P=0;P<J-2;P+=2){conste=P,i=P+2,r=t.Cartesian3.fromArray(H,3*e,w),o=t.Cartesian3.fromArray(H,3*i,x);if(t.Cartesian3.equalsEpsilon(r,o,n.CesiumMath.EPSILON10))continue;consta=P+1,s=P+3;Y[j++]=a,Y[j++]=e,Y[j++]=s,Y[j++]=s,Y[j++]=e,Y[j++]=i}returnnewo.Geometry({attributes:U,indices:Y,primitiveType:o.PrimitiveType.TRIANGLES,boundingSphere:newi.BoundingSphere.fromVertices(H)})},V}));
define(["./defaultValue-94c3e563","./Matrix2-fc7e9822","./Transforms-3ac41eb6","./ComponentDatatype-4a60b8d6","./RuntimeError-c581ca93","./GeometryAttribute-a441ff32","./GeometryAttributes-7df9bef6","./IndexDatatype-db156785","./WallGeometryLibrary-627e5288","./_commonjsHelpers-3aae1032-f55dc0c4","./combine-761d9c3f","./WebGLConstants-7dccdc96","./arrayRemoveDuplicates-06991c15","./PolylinePipeline-0e310844","./EllipsoidGeodesic-dc94f381","./EllipsoidRhumbLine-daebc75b","./IntersectionTests-68fbc42d","./Plane-e20fba8c"],(function(e,i,t,n,o,r,s,a,l,d,m,u,p,c,f,h,g,y){"use strict";constE=newi.Cartesian3,_=newi.Cartesian3;functionw(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT);constr=t.positions,s=t.maximumHeights,a=t.minimumHeights;if(!e.defined(r))thrownewo.DeveloperError("options.positions is required.");if(e.defined(s)&&s.length!==r.length)thrownewo.DeveloperError("options.positions and options.maximumHeights must have the same length.");if(e.defined(a)&&a.length!==r.length)thrownewo.DeveloperError("options.positions and options.minimumHeights must have the same length.");constl=e.defaultValue(t.granularity,n.CesiumMath.RADIANS_PER_DEGREE),d=e.defaultValue(t.ellipsoid,i.Ellipsoid.WGS84);this._positions=r,this._minimumHeights=a,this._maximumHeights=s,this._granularity=l,this._ellipsoid=i.Ellipsoid.clone(d),this._workerName="createWallOutlineGeometry";letm=1+r.length*i.Cartesian3.packedLength+2;e.defined(a)&&(m+=a.length),e.defined(s)&&(m+=s.length),this.packedLength=m+i.Ellipsoid.packedLength+1}w.pack=function(t,n,r){if(!e.defined(t))thrownewo.DeveloperError("value is required");if(!e.defined(n))thrownewo.DeveloperError("array is required");lets;r=e.defaultValue(r,0);consta=t._positions;letl=a.length;for(n[r++]=l,s=0;s<l;++s,r+=i.Cartesian3.packedLength)i.Cartesian3.pack(a[s],n,r);constd=t._minimumHeights;if(l=e.defined(d)?d.length:0,n[r++]=l,e.defined(d))for(s=0;s<l;++s)n[r++]=d[s];constm=t._maximumHeights;if(l=e.defined(m)?m.length:0,n[r++]=l,e.defined(m))for(s=0;s<l;++s)n[r++]=m[s];returni.Ellipsoid.pack(t._ellipsoid,n,r),r+=i.Ellipsoid.packedLength,n[r]=t._granularity,n};constH=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),b={positions:void0,minimumHeights:void0,maximumHeights:void0,ellipsoid:H,granularity:void0};functionv(t,n){returne.defined(n)&&(t=w.unpack(t,n)),t._ellipsoid=i.Ellipsoid.clone(t._ellipsoid),w.createGeometry(t)}returnw.unpack=function(t,n,r){if(!e.defined(t))thrownewo.DeveloperError("array is required");lets;n=e.defaultValue(n,0);leta=t[n++];constl=newArray(a);for(s=0;s<a;++s,n+=i.Cartesian3.packedLength)l[s]=i.Cartesian3.unpack(t,n);letd,m;if(a=t[n++],a>0)for(d=newArray(a),s=0;s<a;++s)d[s]=t[n++];if(a=t[n++],a>0)for(m=newArray(a),s=0;s<a;++s)m[s]=t[n++];constu=i.Ellipsoid.unpack(t,n,H);n+=i.Ellipsoid.packedLength;constp=t[n];returne.defined(r)?(r._positions=l,r._minimumHeights=d,r._maximumHeights=m,r._ellipsoid=i.Ellipsoid.clone(u,r._ellipsoid),r._granularity=p,r):(b.positions=l,b.minimumHeights=d,b.maximumHeights=m,b.granularity=p,neww(b))},w.fromConstantHeights=function(i){i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT);constt=i.positions;if(!e.defined(t))thrownewo.DeveloperError("options.positions is required.");letn,r;consts=i.minimumHeight,a=i.maximumHeight,l=e.defined(s),d=e.defined(a);if(l||d){conste=t.length;n=l?newArray(e):void0,r=d?newArray(e):void0;for(leti=0;i<e;++i)l&&(n[i]=s),d&&(r[i]=a)}constm={positions:t,maximumHeights:r,minimumHeights:n,ellipsoid:i.ellipsoid};returnneww(m)},w.createGeometry=function(o){constd=o._positions,m=o._minimumHeights,u=o._maximumHeights,p=o._granularity,c=o._ellipsoid,f=l.WallGeometryLibrary.computePositions(c,d,u,m,p,!1);if(!e.defined(f))return;consth=f.bottomPositions,g=f.topPositions;lety=g.length,w=2*y;constH=newFloat64Array(w);letb,v=0;for(y/=3,b=0;b<y;++b){conste=3*b,t=i.Cartesian3.fromArray(g,e,E),n=i.Cartesian3.fromArray(h,e,_);H[v++]=n.x,H[v++]=n.y,H[v++]=n.z,H[v++]=t.x,H[v++]=t.y,H[v++]=t.z}constC=news.GeometryAttributes({position:newr.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:H})}),A=w/3;w=2*A-4+A;constD=a.IndexDatatype.createTypedArray(A,w);letk=0;for(b=0;b<A-2;b+=2){conste=b,t=b+2,o=i.Cartesian3.fromArray(H,3*e,E),r=i.Cartesian3.fromArray(H,3*t,_);if(i.Cartesian3.equalsEpsilon(o,r,n.CesiumMath.EPSILON10))continue;consts=b+1,a=b+3;D[k++]=s,D[k++]=e,D[k++]=s,D[k++]=a,D[k++]=e,D[k++]=t}returnD[k++]=A-2,D[k++]=A-1,newr.Geometry({attributes:C,indices:D,primitiveType:r.PrimitiveType.LINES,boundingSphere:newt.BoundingSphere.fromVertices(H)})},v}));
define(["./RuntimeError-c581ca93","./defaultValue-94c3e563","./_commonjsHelpers-3aae1032-f55dc0c4","./createTaskProcessorWorker"],(function(e,t,i,n){"use strict";constr=1953029805,a=2917034100;functiono(t,i){if(o.passThroughDataForTesting)returni;e.Check.typeOf.object("key",t),e.Check.typeOf.object("data",i);constn=t.byteLength;if(0===n||n%4!==0)thrownewe.RuntimeError("The length of key must be greater than 0 and a multiple of 4.");consts=newDataView(i),l=s.getUint32(0,!0);if(l===r||l===a)returni;consth=newDataView(t);letf=0;constc=i.byteLength,d=c-c%8,u=n;letw,b=8;while(f<d){b=(b+8)%24,w=b;while(f<d&&w<u)s.setUint32(f,s.getUint32(f,!0)^h.getUint32(w,!0),!0),s.setUint32(f+4,s.getUint32(f+4,!0)^h.getUint32(w+4,!0),!0),f+=8,w+=24}if(f<c){w>=u&&(b=(b+8)%24,w=b);while(f<c)s.setUint8(f,s.getUint8(f)^h.getUint8(w)),f++,w++}}functions(e,t){return0!==(e&t)}o.passThroughDataForTesting=!1;constl=[1,2,4,8],h=15,f=16,c=64,d=128;functionu(e,t,i,n,r,a){this._bits=e,this.cnodeVersion=t,this.imageryVersion=i,this.terrainVersion=n,this.imageryProvider=r,this.terrainProvider=a,this.ancestorHasTerrain=!1,this.terrainState=void0}u.clone=function(e,i){returnt.defined(i)?(i._bits=e._bits,i.cnodeVersion=e.cnodeVersion,i.imageryVersion=e.imageryVersion,i.terrainVersion=e.terrainVersion,i.imageryProvider=e.imageryProvider,i.terrainProvider=e.terrainProvider):i=newu(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),i.ancestorHasTerrain=e.ancestorHasTerrain,i.terrainState=e.terrainState,i},u.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},u.prototype.hasSubtree=function(){returns(this._bits,f)},u.prototype.hasImagery=function(){returns(this._bits,c)},u.prototype.hasTerrain=function(){returns(this._bits,d)},u.prototype.hasChildren=function(){returns(this._bits,h)},u.prototype.hasChild=function(e){returns(this._bits,l[e])},u.prototype.getChildBitmask=function(){returnthis._bits&h};varw=i.createCommonjsModule((function(e,t){vari="undefined"!==typeofUint8Array&&"undefined"!==typeofUint16Array&&"undefined"!==typeofInt32Array;functionn(e,t){returnObject.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){vart=Array.prototype.slice.call(arguments,1);while(t.length){vari=t.shift();if(i){if("object"!==typeofi)thrownewTypeError(i+"must be non-object");for(varrini)n(i,r)&&(e[r]=i[r])}}returne},t.shrinkBuf=function(e,t){returne.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};varr={arraySet:function(e,t,i,n,r){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+n),r);elsefor(vara=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){vart,i,n,r,a,o;for(n=0,t=0,i=e.length;t<i;t++)n+=e[t].length;for(o=newUint8Array(n),r=0,t=0,i=e.length;t<i;t++)a=e[t],o.set(a,r),r+=a.length;returno}},a={arraySet:function(e,t,i,n,r){for(vara=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,a))},t.setTyped(i)}));functionb(e,t,i,n){varr=65535&e|0,a=e>>>16&65535|0,o=0;while(0!==i){o=i>2e3?2e3:i,i-=o;do{r=r+t[n++]|0,a=a+r|0}while(--o);r%=65521,a%=65521}returnr|a<<16|0}varm=b;functiong(){for(vare,t=[],i=0;i<256;i++){e=i;for(varn=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}returnt}vark=g();function_(e,t,i,n){varr=k,a=n+i;e^=-1;for(varo=n;o<a;o++)e=e>>>8^r[255&(e^t[o])];return-1^e}varv=_,p=30,y=12,E=function(e,t){vari,n,r,a,o,s,l,h,f,c,d,u,w,b,m,g,k,_,v,E,x,S,T,R,A;i=e.state,n=e.next_in,R=e.input,r=n+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),l=i.dmax,h=i.wsize,f=i.whave,c=i.wnext,d=i.window,u=i.hold,w=i.bits,b=i.lencode,m=i.distcode,g=(1<<i.lenbits)-1,k=(1<<i.distbits)-1;e:do{w<15&&(u+=R[n++]<<w,w+=8,u+=R[n++]<<w,w+=8),_=b[u&g];t:for(;;){if(v=_>>>24,u>>>=v,w-=v,v=_>>>16&255,0===v)A[a++]=65535&_;else{if(!(16&v)){if(0===(64&v)){_=b[(65535&_)+(u&(1<<v)-1)];continuet}if(32&v){i.mode=y;breake}e.msg="invalid literal/length code",i.mode=p;breake}E=65535&_,v&=15,v&&(w<v&&(u+=R[n++]<<w,w+=8),E+=u&(1<<v)-1,u>>>=v,w-=v),w<15&&(u+=R[n++]<<w,w+=8,u+=R[n++]<<w,w+=8),_=m[u&k];i:for(;;){if(v=_>>>24,u>>>=v,w-=v,v=_>>>16&255,!(16&v)){if(0===(64&v)){_=m[(65535&_)+(u&(1<<v)-1)];continuei}e.msg="invalid distance code",i.mode=p;breake}if(x=65535&_,v&=15,w<v&&(u+=R[n++]<<w,w+=8,w<v&&(u+=R[n++]<<w,w+=8)),x+=u&(1<<v)-1,x>l){e.msg="invalid distance too far back",i.mode=p;breake}if(u>>>=v,w-=v,v=a-o,x>v){if(v=x-v,v>f&&i.sane){e.msg="invalid distance too far back",i.mode=p;breake}if(S=0,T=d,0===c){if(S+=h-v,v<E){E-=v;do{A[a++]=d[S++]}while(--v);S=a-x,T=A}}elseif(c<v){if(S+=h+c-v,v-=c,v<E){E-=v;do{A[a++]=d[S++]}while(--v);if(S=0,c<E){v=c,E-=v;do{A[a++]=d[S++]}while(--v);S=a-x,T=A}}}elseif(S+=c-v,v<E){E-=v;do{A[a++]=d[S++]}while(--v);S=a-x,T=A}while(E>2)A[a++]=T[S++],A[a++]=T[S++],A[a++]=T[S++],E-=3;E&&(A[a++]=T[S++],E>1&&(A[a++]=T[S++]))}else{S=a-x;do{A[a++]=A[S++],A[a++]=A[S++],A[a++]=A[S++],E-=3}while(E>2);E&&(A[a++]=A[S++],E>1&&(A[a++]=A[S++]))}break}}break}}while(n<r&&a<s);E=w>>3,n-=E,w-=E<<3,u&=(1<<w)-1,e.next_in=n,e.next_out=a,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=a<s?s-a+257:257-(a-s),i.hold=u,i.bits=w},x=15,S=852,T=592,R=0,A=1,B=2,U=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Z=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],I=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],O=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],D=function(e,t,i,n,r,a,o,s){varl,h,f,c,d,u,b,m,g,k=s.bits,_=0,v=0,p=0,y=0,E=0,D=0,C=0,N=0,F=0,L=0,H=null,z=0,P=neww.Buf16(x+1),M=neww.Buf16(x+1),V=null,j=0;for(_=0;_<=x;_++)P[_]=0;for(v=0;v<n;v++)P[t[i+v]]++;for(E=k,y=x;y>=1;y--)if(0!==P[y])break;if(E>y&&(E=y),0===y)returnr[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(p=1;p<y;p++)if(0!==P[p])break;for(E<p&&(E=p),N=1,_=1;_<=x;_++)if(N<<=1,N-=P[_],N<0)return-1;if(N>0&&(e===R||1!==y))return-1;for(M[1]=0,_=1;_<x;_++)M[_+1]=M[_]+P[_];for(v=0;v<n;v++)0!==t[i+v]&&(o[M[t[i+v]]++]=v);if(e===R?(H=V=o,u=19):e===A?(H=U,z-=257,V=Z,j-=257,u=256):(H=I,V=O,u=-1),L=0,v=0,_=p,d=a,D=E,C=0,f=-1,F=1<<E,c=F-1,e===A&&F>S||e===B&&F>T)return1;for(;;){b=_-C,o[v]<u?(m=0,g=o[v]):o[v]>u?(m=V[j+o[v]],g=H[z+o[v]]):(m=96,g=0),l=1<<_-C,h=1<<D,p=h;do{h-=l,r[d+(L>>C)+h]=b<<24|m<<16|g|0}while(0!==h);l=1<<_-1;while(L&l)l>>=1;if(0!==l?(L&=l-1,L+=l):L=0,v++,0===--P[_]){if(_===y)break;_=t[i+o[v]]}if(_>E&&(L&c)!==f){0===C&&(C=E),d+=p,D=_-C,N=1<<D;while(D+C<y){if(N-=P[D+C],N<=0)break;D++,N<<=1}if(F+=1<<D,e===A&&F>S||e===B&&F>T)return1;f=L&c,r[f]=E<<24|D<<16|d-a|0}}return0!==L&&(r[d+L]=_-C<<24|64<<16|0),s.bits=E,0},C=0,N=1,F=2,L=4,H=5,z=6,P=0,M=1,V=2,j=-2,K=-3,Y=-4,G=-5,Q=8,W=1,X=2,q=3,J=4,$=5,ee=6,te=7,ie=8,ne=9,re=10,ae=11,oe=12,se=13,le=14,he=15,fe=16,ce=17,de=18,ue=19,we=20,be=21,me=22,ge=23,ke=24,_e=25,ve=26,pe=27,ye=28,Ee=29,xe=30,Se=31,Te=32,Re=852,Ae=592,Be=15,Ue=Be;functionZe(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}functionIe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=neww.Buf16(320),this.work=neww.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}functionOe(e){vart;returne&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=W,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=neww.Buf32(Re),t.distcode=t.distdyn=neww.Buf32(Ae),t.sane=1,t.back=-1,P):j}functionDe(e){vart;returne&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Oe(e)):j}functionCe(e,t){vari,n;returne&&e.state?(n=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?j:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,De(e))):j}functionNe(e,t){vari,n;returne?(n=newIe,e.state=n,n.window=null,i=Ce(e,t),i!==P&&(e.state=null),i):j}functionFe(e){returnNe(e,Ue)}varLe,He,ze=!0;functionPe(e){if(ze){vart;Le=neww.Buf32(512),He=neww.Buf32(32),t=0;while(t<144)e.lens[t++]=8;while(t<256)e.lens[t++]=9;while(t<280)e.lens[t++]=7;while(t<288)e.lens[t++]=8;D(N,e.lens,0,288,Le,0,e.work,{bits:9}),t=0;while(t<32)e.lens[t++]=5;D(F,e.lens,0,32,He,0,e.work,{bits:5}),ze=!1}e.lencode=Le,e.lenbits=9,e.distcode=He,e.distbits=5}functionMe(e,t,i,n){varr,a=e.state;returnnull===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=neww.Buf8(a.wsize)),n>=a.wsize?(w.arraySet(a.window,t,i-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>n&&(r=n),w.arraySet(a.window,t,i-n,r,a.wnext),n-=r,n?(w.arraySet(a.window,t,i-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}functionVe(e,t){vari,n,r,a,o,s,l,h,f,c,d,u,b,g,k,_,p,y,x,S,T,R,A,B,U=0,Z=neww.Buf8(4),I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)returnj;i=e.state,i.mode===oe&&(i.mode=se),o=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,h=i.hold,f=i.bits,c=s,d=l,R=P;e:for(;;)switch(i.mode){caseW:if(0===i.wrap){i.mode=se;break}while(f<16){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(2&i.wrap&&35615===h){i.check=0,Z[0]=255&h,Z[1]=h>>>8&255,i.check=v(i.check,Z,2,0),h=0,f=0,i.mode=X;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",i.mode=xe;break}if((15&h)!==Q){e.msg="unknown compression method",i.mode=xe;break}if(h>>>=4,f-=4,T=8+(15&h),0===i.wbits)i.wbits=T;elseif(T>i.wbits){e.msg="invalid window size",i.mode=xe;break}i.dmax=1<<T,e.adler=i.check=1,i.mode=512&h?re:oe,h=0,f=0;break;caseX:while(f<16){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(i.flags=h,(255&i.flags)!==Q){e.msg="unknown compression method",i.mode=xe;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=xe;break}i.head&&(i.head.text=h>>8&1),512&i.flags&&(Z[0]=255&h,Z[1]=h>>>8&255,i.check=v(i.check,Z,2,0)),h=0,f=0,i.mode=q;caseq:while(f<32){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.head&&(i.head.time=h),512&i.flags&&(Z[0]=255&h,Z[1]=h>>>8&255,Z[2]=h>>>16&255,Z[3]=h>>>24&255,i.check=v(i.check,Z,4,0)),h=0,f=0,i.mode=J;caseJ:while(f<16){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.head&&(i.head.xflags=255&h,i.head.os=h>>8),512&i.flags&&(Z[0]=255&h,Z[1]=h>>>8&255,i.check=v(i.check,Z,2,0)),h=0,f=0,i.mode=$;case$:if(1024&i.flags){while(f<16){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.length=h,i.head&&(i.head.extra_len=h),512&i.flags&&(Z[0]=255&h,Z[1]=h>>>8&255,i.check=v(i.check,Z,2,0)),h=0,f=0}elsei.head&&(i.head.extra=null);i.mode=ee;caseee:if(1024&i.flags&&(u=i.length,u>s&&(u=s),u&&(i.head&&(T=i.head.extra_len-i.length,i.head.extra||(i.head.extra=newArray(i.head.extra_len)),w.arraySet(i.head.extra,n,a,u,T)),512&i.flags&&(i.check=v(i.check,n,u,a)),s-=u,a+=u,i.length-=u),i.length))breake;i.length=0,i.mode=te;casete:if(2048&i.flags){if(0===s)breake;u=0;do{T=n[a+u++],i.head&&T&&i.length<65536&&(i.head.name+=String.fromCharCode(T))}while(T&&u<s);if(512&i.flags&&(i.check=v(i.check,n,u,a)),s-=u,a+=u,T)breake}elsei.head&&(i.head.name=null);i.length=0,i.mode=ie;caseie:if(4096&i.flags){if(0===s)breake;u=0;do{T=n[a+u++],i.head&&T&&i.length<65536&&(i.head.comment+=String.fromCharCode(T))}while(T&&u<s);if(512&i.flags&&(i.check=v(i.check,n,u,a)),s-=u,a+=u,T)breake}elsei.head&&(i.head.comment=null);i.mode=ne;casene:if(512&i.flags){while(f<16){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(h!==(65535&i.check)){e.msg="header crc mismatch",i.mode=xe;break}h=0,f=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=oe;break;casere:while(f<32){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}e.adler=i.check=Ze(h),h=0,f=0,i.mode=ae;caseae:if(0===i.havedict)returne.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=h,i.bits=f,V;e.adler=i.check=1,i.mode=oe;caseoe:if(t===H||t===z)breake;casese:if(i.last){h>>>=7&f,f-=7&f,i.mode=pe;break}while(f<3){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}switch(i.last=1&h,h>>>=1,f-=1,3&h){case0:i.mode=le;break;case1:if(Pe(i),i.mode=we,t===z){h>>>=2,f-=2;breake}break;case2:i.mode=ce;break;case3:e.msg="invalid block type",i.mode=xe}h>>>=2,f-=2;break;casele:h>>>=7&f,f-=7&f;while(f<32){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if((65535&h)!==(h>>>16^65535)){e.msg="invalid stored block lengths",i.mode=xe;break}if(i.length=65535&h,h=0,f=0,i.mode=he,t===z)breake;casehe:i.mode=fe;casefe:if(u=i.length,u){if(u>s&&(u=s),u>l&&(u=l),0===u)breake;w.arraySet(r,n,a,u,o),s-=u,a+=u,l-=u,o+=u,i.length-=u;break}i.mode=oe;break;casece:while(f<14){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(i.nlen=257+(31&h),h>>>=5,f-=5,i.ndist=1+(31&h),h>>>=5,f-=5,i.ncode=4+(15&h),h>>>=4,f-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=xe;break}i.have=0,i.mode=de;casede:while(i.have<i.ncode){while(f<3){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.lens[I[i.have++]]=7&h,h>>>=3,f-=3}while(i.have<19)i.lens[I[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},R=D(C,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,R){e.msg="invalid code lengths set",i.mode=xe;break}i.have=0,i.mode=ue;caseue:while(i.have<i.nlen+i.ndist){for(;;){if(U=i.lencode[h&(1<<i.lenbits)-1],k=U>>>24,_=U>>>16&255,p=65535&U,k<=f)break;if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(p<16)h>>>=k,f-=k,i.lens[i.have++]=p;else{if(16===p){B=k+2;while(f<B){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(h>>>=k,f-=k,0===i.have){e.msg="invalid bit length repeat",i.mode=xe;break}T=i.lens[i.have-1],u=3+(3&h),h>>>=2,f-=2}elseif(17===p){B=k+3;while(f<B){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}h>>>=k,f-=k,T=0,u=3+(7&h),h>>>=3,f-=3}else{B=k+7;while(f<B){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}h>>>=k,f-=k,T=0,u=11+(127&h),h>>>=7,f-=7}if(i.have+u>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=xe;break}while(u--)i.lens[i.have++]=T}}if(i.mode===xe)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=xe;break}if(i.lenbits=9,A={bits:i.lenbits},R=D(N,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,R){e.msg="invalid literal/lengths set",i.mode=xe;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},R=D(F,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,R){e.msg="invalid distances set",i.mode=xe;break}if(i.mode=we,t===z)breake;casewe:i.mode=be;casebe:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=h,i.bits=f,E(e,d),o=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,h=i.hold,f=i.bits,i.mode===oe&&(i.back=-1);break}for(i.back=0;;){if(U=i.lencode[h&(1<<i.lenbits)-1],k=U>>>24,_=U>>>16&255,p=65535&U,k<=f)break;if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(_&&0===(240&_)){for(y=k,x=_,S=p;;){if(U=i.lencode[S+((h&(1<<y+x)-1)>>y)],k=U>>>24,_=U>>>16&255,p=65535&U,y+k<=f)break;if(0===s)breake;s--,h+=n[a++]<<f,f+=8}h>>>=y,f-=y,i.back+=y}if(h>>>=k,f-=k,i.back+=k,i.length=p,0===_){i.mode=ve;break}if(32&_){i.back=-1,i.mode=oe;break}if(64&_){e.msg="invalid literal/length code",i.mode=xe;break}i.extra=15&_,i.mode=me;caseme:if(i.extra){B=i.extra;while(f<B){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.length+=h&(1<<i.extra)-1,h>>>=i.extra,f-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=ge;casege:for(;;){if(U=i.distcode[h&(1<<i.distbits)-1],k=U>>>24,_=U>>>16&255,p=65535&U,k<=f)break;if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(0===(240&_)){for(y=k,x=_,S=p;;){if(U=i.distcode[S+((h&(1<<y+x)-1)>>y)],k=U>>>24,_=U>>>16&255,p=65535&U,y+k<=f)break;if(0===s)breake;s--,h+=n[a++]<<f,f+=8}h>>>=y,f-=y,i.back+=y}if(h>>>=k,f-=k,i.back+=k,64&_){e.msg="invalid distance code",i.mode=xe;break}i.offset=p,i.extra=15&_,i.mode=ke;caseke:if(i.extra){B=i.extra;while(f<B){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}i.offset+=h&(1<<i.extra)-1,h>>>=i.extra,f-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=xe;break}i.mode=_e;case_e:if(0===l)breake;if(u=d-l,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=xe;break}u>i.wnext?(u-=i.wnext,b=i.wsize-u):b=i.wnext-u,u>i.length&&(u=i.length),g=i.window}elseg=r,b=o-i.offset,u=i.length;u>l&&(u=l),l-=u,i.length-=u;do{r[o++]=g[b++]}while(--u);0===i.length&&(i.mode=be);break;caseve:if(0===l)breake;r[o++]=i.length,l--,i.mode=be;break;casepe:if(i.wrap){while(f<32){if(0===s)breake;s--,h|=n[a++]<<f,f+=8}if(d-=l,e.total_out+=d,i.total+=d,d&&(e.adler=i.check=i.flags?v(i.check,r,d,o-d):m(i.check,r,d,o-d)),d=l,(i.flags?h:Ze(h))!==i.check){e.msg="incorrect data check",i.mode=xe;break}h=0,f=0}i.mode=ye;caseye:if(i.wrap&&i.flags){while(f<32){if(0===s)breake;s--,h+=n[a++]<<f,f+=8}if(h!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=xe;break}h=0,f=0}i.mode=Ee;caseEe:R=M;breake;casexe:R=K;breake;caseSe:returnY;caseTe:default:returnj}returne.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=h,i.bits=f,(i.wsize||d!==e.avail_out&&i.mode<xe&&(i.mode<pe||t!==L))&&Me(e,e.output,e.next_out,d-e.avail_out),c-=e.avail_in,d-=e.avail_out,e.total_in+=c,e.total_out+=d,i.total+=d,i.wrap&&d&&(e.adler=i.check=i.flags?v(i.check,r,d,e.next_out-d):m(i.check,r,d,e.next_out-d)),e.data_type=i.bits+(i.last?64:0)+(i.mode===oe?128:0)+(i.mode===we||i.mode===he?256:0),(0===c&&0===d||t===L)&&R===P&&(R=G),R}functionje(e){if(!e||!e.state)returnj;vart=e.state;returnt.window&&(t.window=null),e.state=null,P}functionKe(e,t){vari;returne&&e.state?(i=e.state,0===(2&i.wrap)?j:(i.head=t,t.done=!1,P)):j}functionYe(e,t){vari,n,r,a=t.length;returne&&e.state?(i=e.state,0!==i.wrap&&i.mode!==ae?j:i.mode===ae&&(n=1,n=m(n,t,a,0),n!==i.check)?K:(r=Me(e,t,a,a),r?(i.mode=Se,Y):(i.havedict=1,P))):j}varGe=De,Qe=Ce,We=Oe,Xe=Fe,qe=Ne,Je=Ve,$e=je,et=Ke,tt=Ye,it="pako inflate (from Nodeca project)",nt={inflateReset:Ge,inflateReset2:Qe,inflateResetKeep:We,inflateInit:Xe,inflateInit2:qe,inflate:Je,inflateEnd:$e,inflateGetHeader:et,inflateSetDictionary:tt,inflateInfo:it},rt=!0,at=!0;try{String.fromCharCode.apply(null,[0])}catch(jt){rt=!1}try{String.fromCharCode.apply(null,newUint8Array(1))}catch(jt){at=!1}for(varot=neww.Buf8(256),st=0;st<256;st++)ot[st]=st>=252?6:st>=248?5:st>=240?4:st>=224?3:st>=192?2:1;ot[254]=ot[254]=1;varlt=function(e){vart,i,n,r,a,o=e.length,s=0;for(r=0;r<o;r++)i=e.charCodeAt(r),55296===(64512&i)&&r+1<o&&(n=e.charCodeAt(r+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=neww.Buf8(s),a=0,r=0;a<s;r++)i=e.charCodeAt(r),55296===(64512&i)&&r+1<o&&(n=e.charCodeAt(r+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|63&i):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|63&i):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|63&i);returnt};functionht(e,t){if(t<65534&&(e.subarray&&at||!e.subarray&&rt))returnString.fromCharCode.apply(null,w.shrinkBuf(e,t));for(vari="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);returni}varft=function(e){returnht(e,e.length)},ct=function(e){for(vart=neww.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);returnt},dt=function(e,t){vari,n,r,a,o=t||e.length,s=newArray(2*o);for(n=0,i=0;i<o;)if(r=e[i++],r<128)s[n++]=r;elseif(a=ot[r],a>4)s[n++]=65533,i+=a-1;else{r&=2===a?31:3===a?15:7;while(a>1&&i<o)r=r<<6|63&e[i++],a--;a>1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}returnht(s,n)},ut=function(e,t){vari;t=t||e.length,t>e.length&&(t=e.length),i=t-1;while(i>=0&&128===(192&e[i]))i--;returni<0||0===i?t:i+ot[e[i]]>t?i:t},wt={string2buf:lt,buf2binstring:ft,binstring2buf:ct,buf2string:dt,utf8border:ut},bt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},mt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};functiongt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}varkt=gt;function_t(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}varvt=_t,pt=Object.prototype.toString;functionyt(e){if(!(thisinstanceofyt))returnnewyt(e);this.options=w.assign({chunkSize:16384,windowBits:0,to:""},e||{});vart=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=newkt,this.strm.avail_out=0;vari=nt.inflateInit2(this.strm,t.windowBits);if(i!==bt.Z_OK)thrownewError(mt[i]);if(this.header=newvt,nt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"===typeoft.dictionary?t.dictionary=wt.string2buf(t.dictionary):"[object ArrayBuffer]"===pt.call(t.dictionary)&&(t.dictionary=newUint8Array(t.dictionary)),t.raw&&(i=nt.inflateSetDictionary(this.strm,t.dictionary),i!==bt.Z_OK)))thrownewError(mt[i])}functionEt(e,t){vari=newyt(t);if(i.push(e,!0),i.err)throwi.msg||mt[i.err];returni.result}functionxt(e,t){returnt=t||{},t.raw=!0,Et(e,t)}yt.prototype.push=function(e,t){vari,n,r,a,o,s=this.strm,l=this.options.chunkSize,h=this.options.dictionary,f=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?bt.Z_FINISH:bt.Z_NO_FLUSH,"string"===typeofe?s.input=wt.binstring2buf(e):"[object ArrayBuffer]"===pt.call(e)?s.input=newUint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=neww.Buf8(l),s.next_out=0,s.avail_out=l),i=nt.inflate(s,bt.Z_NO_FLUSH),i===bt.Z_NEED_DICT&&h&&(i=nt.inflateSetDictionary(this.strm,h)),i===bt.Z_BUF_ERROR&&!0===f&&(i=bt.Z_OK,f=!1),i!==bt.Z_STREAM_END&&i!==bt.Z_OK)returnthis.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==bt.Z_STREAM_END&&(0!==s.avail_in||n!==bt.Z_FINISH&&n!==bt.Z_SYNC_FLUSH)||("string"===this.options.to?(r=wt.utf8border(s.output,s.next_out),a=s.next_out-r,o=wt.buf2string(s.output,r),s.next_out=a,s.avail_out=l-a,a&&w.arraySet(s.output,s.output,r,a,0),this.onData(o)):this.onData(w.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(f=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==bt.Z_STREAM_END);returni===bt.Z_STREAM_END&&(n=bt.Z_FINISH),n===bt.Z_FINISH?(i=nt.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===bt.Z_OK):n!==bt.Z_SYNC_FLUSH||(this.onEnd(bt.Z_OK),s.avail_out=0,!0)},yt.prototype.onData=function(e){this.chunks.push(e)},yt.prototype.onEnd=function(e){e===bt.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=w.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};varSt=yt,Tt=Et,Rt=xt,At=Et,Bt={Inflate:St,inflate:Tt,inflateRaw:Rt,ungzip:At};constUt=Uint16Array.BYTES_PER_ELEMENT,Zt=Int32Array.BYTES_PER_ELEMENT,It=Uint32Array.BYTES_PER_ELEMENT,Ot={METADATA:0,TERRAIN:1,DBROOT:2};functionDt(e,t){consti=Ot.fromString(e.type);letn=e.buffer;o(e.key,n);constr=Mt(n);n=r.buffer;consta=r.length;switch(i){caseOt.METADATA:returnNt(n,a,e.quadKey);caseOt.TERRAIN:returnHt(n,a,t);caseOt.DBROOT:returnt.push(n),{buffer:n}}}Ot.fromString=function(e){return"Metadata"===e?Ot.METADATA:"Terrain"===e?Ot.TERRAIN:"DbRoot"===e?Ot.DBROOT:void0};constCt=32301;functionNt(t,i,n){constr=newDataView(t);leta=0;consto=r.getUint32(a,!0);if(a+=It,o!==Ct)thrownewe.RuntimeError("Invalid magic");consts=r.getUint32(a,!0);if(a+=It,1!==s)thrownewe.RuntimeError("Invalid data type. Must be 1 for QuadTreePacket");constl=r.getUint32(a,!0);if(a+=It,2!==l)thrownewe.RuntimeError("Invalid QuadTreePacket version. Only version 2 is supported.");consth=r.getInt32(a,!0);a+=Zt;constf=r.getInt32(a,!0);if(a+=Zt,32!==f)thrownewe.RuntimeError("Invalid instance size.");constc=r.getInt32(a,!0);a+=Zt;constd=r.getInt32(a,!0);a+=Zt;constw=r.getInt32(a,!0);if(a+=Zt,c!==h*f+a)thrownewe.RuntimeError("Invalid dataBufferOffset");if(c+d+w!==i)thrownewe.RuntimeError("Invalid packet offsets");constb=[];for(lete=0;e<h;++e){conste=r.getUint8(a);++a,++a;constt=r.getUint16(a,!0);a+=Ut;consti=r.getUint16(a,!0);a+=Ut;constn=r.getUint16(a,!0);a+=Ut,a+=Ut,a+=Ut,a+=Zt,a+=Zt,a+=8;consto=r.getUint8(a++),s=r.getUint8(a++);a+=Ut,b.push(newu(e,t,i,n,o,s))}constm=[];letg=0;functionk(e,t,i){letn=!1;if(4===i){if(t.hasSubtree())return;n=!0}for(letr=0;r<4;++r){consta=e+r.toString();if(n)m[a]=null;elseif(i<4)if(t.hasChild(r)){if(g===h)returnvoidconsole.log("Incorrect number of instances");conste=b[g++];m[a]=e,k(a,e,i+1)}elsem[a]=null}}let_=0;constv=b[g++];return""===n?++_:m[n]=v,k(n,v,_),m}constFt=5,Lt=4;functionHt(t,i,n){constr=newDataView(t),a=function(t){for(letn=0;n<Lt;++n){constn=r.getUint32(t,!0);if(t+=It,t+=n,t>i)thrownewe.RuntimeError("Malformed terrain packet found.")}returnt};leto=0;consts=[];while(s.length<Ft){conste=o;o=a(o);consti=t.slice(e,o);n.push(i),s.push(i)}returns}constzt=1953029805,Pt=2917034100;functionMt(t){consti=newDataView(t);letn=0;constr=i.getUint32(n,!0);if(n+=It,r!==zt&&r!==Pt)thrownewe.RuntimeError("Invalid magic");consta=i.getUint32(n,r===zt);n+=It;consto=newUint8Array(t,n),s=Bt.inflate(o);if(s.length!==a)thrownewe.RuntimeError("Size of packet doesn't match header");returns}varVt=n(Dt);returnVt}));
define(["./defaultValue-94c3e563","./RuntimeError-c581ca93","./WebGLConstants-7dccdc96","./createTaskProcessorWorker"],(function(_,R,t,A){"use strict";conste={UNSIGNED_BYTE:t.WebGLConstants.UNSIGNED_BYTE,UNSIGNED_SHORT:t.WebGLConstants.UNSIGNED_SHORT,UNSIGNED_INT:t.WebGLConstants.UNSIGNED_INT,FLOAT:t.WebGLConstants.FLOAT,HALF_FLOAT:t.WebGLConstants.HALF_FLOAT_OES,UNSIGNED_INT_24_8:t.WebGLConstants.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:t.WebGLConstants.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:t.WebGLConstants.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:t.WebGLConstants.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(_,R){switch(_){casee.UNSIGNED_BYTE:returnt.WebGLConstants.UNSIGNED_BYTE;casee.UNSIGNED_SHORT:returnt.WebGLConstants.UNSIGNED_SHORT;casee.UNSIGNED_INT:returnt.WebGLConstants.UNSIGNED_INT;casee.FLOAT:returnt.WebGLConstants.FLOAT;casee.HALF_FLOAT:returnR.webgl2?t.WebGLConstants.HALF_FLOAT:t.WebGLConstants.HALF_FLOAT_OES;casee.UNSIGNED_INT_24_8:returnt.WebGLConstants.UNSIGNED_INT_24_8;casee.UNSIGNED_SHORT_4_4_4_4:returnt.WebGLConstants.UNSIGNED_SHORT_4_4_4_4;casee.UNSIGNED_SHORT_5_5_5_1:returnt.WebGLConstants.UNSIGNED_SHORT_5_5_5_1;casee.UNSIGNED_SHORT_5_6_5:returne.UNSIGNED_SHORT_5_6_5}},isPacked:function(_){return_===e.UNSIGNED_INT_24_8||_===e.UNSIGNED_SHORT_4_4_4_4||_===e.UNSIGNED_SHORT_5_5_5_1||_===e.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(_){switch(_){casee.UNSIGNED_BYTE:return1;casee.UNSIGNED_SHORT:casee.UNSIGNED_SHORT_4_4_4_4:casee.UNSIGNED_SHORT_5_5_5_1:casee.UNSIGNED_SHORT_5_6_5:casee.HALF_FLOAT:return2;casee.UNSIGNED_INT:casee.FLOAT:casee.UNSIGNED_INT_24_8:return4}},validate:function(_){return_===e.UNSIGNED_BYTE||_===e.UNSIGNED_SHORT||_===e.UNSIGNED_INT||_===e.FLOAT||_===e.HALF_FLOAT||_===e.UNSIGNED_INT_24_8||_===e.UNSIGNED_SHORT_4_4_4_4||_===e.UNSIGNED_SHORT_5_5_5_1||_===e.UNSIGNED_SHORT_5_6_5}};varT=Object.freeze(e);constO={DEPTH_COMPONENT:t.WebGLConstants.DEPTH_COMPONENT,DEPTH_STENCIL:t.WebGLConstants.DEPTH_STENCIL,ALPHA:t.WebGLConstants.ALPHA,RGB:t.WebGLConstants.RGB,RGBA:t.WebGLConstants.RGBA,LUMINANCE:t.WebGLConstants.LUMINANCE,LUMINANCE_ALPHA:t.WebGLConstants.LUMINANCE_ALPHA,RGB_DXT1:t.WebGLConstants.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:t.WebGLConstants.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:t.WebGLConstants.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:t.WebGLConstants.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:t.WebGLConstants.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:t.WebGLConstants.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:t.WebGLConstants.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:t.WebGLConstants.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:t.WebGLConstants.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:t.WebGLConstants.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(_){switch(_){caseO.RGB:return3;caseO.RGBA:return4;caseO.LUMINANCE_ALPHA:return2;caseO.ALPHA:caseO.LUMINANCE:return1;default:return1}},validate:function(_){return_===O.DEPTH_COMPONENT||_===O.DEPTH_STENCIL||_===O.ALPHA||_===O.RGB||_===O.RGBA||_===O.LUMINANCE||_===O.LUMINANCE_ALPHA||_===O.RGB_DXT1||_===O.RGBA_DXT1||_===O.RGBA_DXT3||_===O.RGBA_DXT5||_===O.RGB_PVRTC_4BPPV1||_===O.RGB_PVRTC_2BPPV1||_===O.RGBA_PVRTC_4BPPV1||_===O.RGBA_PVRTC_2BPPV1||_===O.RGBA_ASTC||_===O.RGB_ETC1||_===O.RGB8_ETC2||_===O.RGBA8_ETC2_EAC||_===O.RGBA_BC7},isColorFormat:function(_){return_===O.ALPHA||_===O.RGB||_===O.RGBA||_===O.LUMINANCE||_===O.LUMINANCE_ALPHA},isDepthFormat:function(_){return_===O.DEPTH_COMPONENT||_===O.DEPTH_STENCIL},isCompressedFormat:function(_){return_===O.RGB_DXT1||_===O.RGBA_DXT1||_===O.RGBA_DXT3||_===O.RGBA_DXT5||_===O.RGB_PVRTC_4BPPV1||_===O.RGB_PVRTC_2BPPV1||_===O.RGBA_PVRTC_4BPPV1||_===O.RGBA_PVRTC_2BPPV1||_===O.RGBA_ASTC||_===O.RGB_ETC1||_===O.RGB8_ETC2||_===O.RGBA8_ETC2_EAC||_===O.RGBA_BC7},isDXTFormat:function(_){return_===O.RGB_DXT1||_===O.RGBA_DXT1||_===O.RGBA_DXT3||_===O.RGBA_DXT5},isPVRTCFormat:function(_){return_===O.RGB_PVRTC_4BPPV1||_===O.RGB_PVRTC_2BPPV1||_===O.RGBA_PVRTC_4BPPV1||_===O.RGBA_PVRTC_2BPPV1},isASTCFormat:function(_){return_===O.RGBA_ASTC},isETC1Format:function(_){return_===O.RGB_ETC1},isETC2Format:function(_){return_===O.RGB8_ETC2||_===O.RGBA8_ETC2_EAC},isBC7Format:function(_){return_===O.RGBA_BC7},compressedTextureSizeInBytes:function(_,R,t){switch(_){caseO.RGB_DXT1:caseO.RGBA_DXT1:caseO.RGB_ETC1:caseO.RGB8_ETC2:returnMath.floor((R+3)/4)*Math.floor((t+3)/4)*8;caseO.RGBA_DXT3:caseO.RGBA_DXT5:caseO.RGBA_ASTC:caseO.RGBA8_ETC2_EAC:returnMath.floor((R+3)/4)*Math.floor((t+3)/4)*16;caseO.RGB_PVRTC_4BPPV1:caseO.RGBA_PVRTC_4BPPV1:returnMath.floor((Math.max(R,8)*Math.max(t,8)*4+7)/8);caseO.RGB_PVRTC_2BPPV1:caseO.RGBA_PVRTC_2BPPV1:returnMath.floor((Math.max(R,16)*Math.max(t,8)*2+7)/8);caseO.RGBA_BC7:returnMath.ceil(R/4)*Math.ceil(t/4)*16;default:return0}},textureSizeInBytes:function(_,R,t,A){lete=O.componentsLength(_);returnT.isPacked(R)&&(e=1),e*T.sizeInBytes(R)*t*A},alignmentInBytes:function(_,R,t){constA=O.textureSizeInBytes(_,R,t,1)%4;return0===A?4:2===A?2:1},createTypedArray:function(_,R,t,A){lete;constn=T.sizeInBytes(R);e=n===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:n===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:n===Float32Array.BYTES_PER_ELEMENT&&R===T.FLOAT?Float32Array:Uint32Array;constB=O.componentsLength(_)*t*A;returnnewe(B)},flipY:function(_,R,t,A,e){if(1===e)return_;constT=O.createTypedArray(R,t,A,e),n=O.componentsLength(R),B=A*n;for(letO=0;O<e;++O){constR=O*A*n,t=(e-O-1)*A*n;for(letA=0;A<B;++A)T[t+A]=_[R+A]}returnT},toInternalFormat:function(_,R,A){if(!A.webgl2)return_;if(_===O.DEPTH_STENCIL)returnt.WebGLConstants.DEPTH24_STENCIL8;if(_===O.DEPTH_COMPONENT){if(R===T.UNSIGNED_SHORT)returnt.WebGLConstants.DEPTH_COMPONENT16;if(R===T.UNSIGNED_INT)returnt.WebGLConstants.DEPTH_COMPONENT24}if(R===T.FLOAT)switch(_){caseO.RGBA:returnt.WebGLConstants.RGBA32F;caseO.RGB:returnt.WebGLConstants.RGB32F;caseO.RG:returnt.WebGLConstants.RG32F;caseO.R:returnt.WebGLConstants.R32F}if(R===T.HALF_FLOAT)switch(_){caseO.RGBA:returnt.WebGLConstants.RGBA16F;caseO.RGB:returnt.WebGLConstants.RGB16F;caseO.RG:returnt.WebGLConstants.RG16F;caseO.R:returnt.WebGLConstants.R16F}return_}};varn=Object.freeze(O);constB={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033};varG=Object.freeze(B);constM=[171,75,84,88,32,50,48,187,13,10,26,10];varC,K,s,F,N,r,i,S;!function(_){_[_.NONE=0]="NONE",_[_.BASISLZ=1]="BASISLZ",_[_.ZSTD=2]="ZSTD",_[_.ZLIB=3]="ZLIB"}(C||(C={})),function(_){_[_.BASICFORMAT=0]="BASICFORMAT"}(K||(K={})),function(_){_[_.UNSPECIFIED=0]="UNSPECIFIED",_[_.ETC1S=163]="ETC1S",_[_.UASTC=166]="UASTC"}(s||(s={})),function(_){_[_.UNSPECIFIED=0]="UNSPECIFIED",_[_.SRGB=1]="SRGB"}(F||(F={})),function(_){_[_.UNSPECIFIED=0]="UNSPECIFIED",_[_.LINEAR=1]="LINEAR",_[_.SRGB=2]="SRGB",_[_.ITU=3]="ITU",_[_.NTSC=4]="NTSC",_[_.SLOG=5]="SLOG",_[_.SLOG2=6]="SLOG2"}(N||(N={})),function(_){_[_.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",_[_.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(r||(r={})),function(_){_[_.RGB=0]="RGB",_[_.RRR=3]="RRR",_[_.GGG=4]="GGG",_[_.AAA=15]="AAA"}(i||(i={})),function(_){_[_.RGB=0]="RGB",_[_.RGBA=3]="RGBA",_[_.RRR=4]="RRR",_[_.RRRG=5]="RRRG"}(S||(S={}));classV{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=C.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:K.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:s.UNSPECIFIED,colorPrimaries:F.SRGB,transferFunction:F.SRGB,flags:r.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}classo{constructor(_,R,t,A){this._dataView=newDataView(_.buffer,_.byteOffset+R,t),this._littleEndian=A,this._offset=0}_nextUint8(){const_=this._dataView.getUint8(this._offset);returnthis._offset+=1,_}_nextUint16(){const_=this._dataView.getUint16(this._offset,this._littleEndian);returnthis._offset+=2,_}_nextUint32(){const_=this._dataView.getUint32(this._offset,this._littleEndian);returnthis._offset+=4,_}_nextUint64(){const_=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);returnthis._offset+=8,_}_skip(_){returnthis._offset+=_,this}_scan(_,R=0){constt=this._offset;letA=0;for(;this._dataView.getUint8(this._offset)!==R&&A<_;)A++,this._offset++;returnA<_&&this._offset++,newUint8Array(this._dataView.buffer,this._dataView.byteOffset+t,A)}}functiona(_){return"undefined"!=typeofTextDecoder?(newTextDecoder).decode(_):Buffer.from(_).toString("utf8")}functionU(_){constR=newUint8Array(_.buffer,_.byteOffset,M.length);if(R[0]!==M[0]||R[1]!==M[1]||R[2]!==M[2]||R[3]!==M[3]||R[4]!==M[4]||R[5]!==M[5]||R[6]!==M[6]||R[7]!==M[7]||R[8]!==M[8]||R[9]!==M[9]||R[10]!==M[10]||R[11]!==M[11])thrownewError("Missing KTX 2.0 identifier.");constt=newV,A=17*Uint32Array.BYTES_PER_ELEMENT,e=newo(_,M.length,A,!0);t.vkFormat=e._nextUint32(),t.typeSize=e._nextUint32(),t.pixelWidth=e._nextUint32(),t.pixelHeight=e._nextUint32(),t.pixelDepth=e._nextUint32(),t.layerCount=e._nextUint32(),t.faceCount=e._nextUint32();constT=e._nextUint32();t.supercompressionScheme=e._nextUint32();constO=e._nextUint32(),n=e._nextUint32(),B=e._nextUint32(),G=e._nextUint32(),C=e._nextUint64(),K=e._nextUint64(),s=newo(_,M.length+A,3*T*8,!0);for(letM=0;M<T;M++)t.levels.push({levelData:newUint8Array(_.buffer,_.byteOffset+s._nextUint64(),s._nextUint64()),uncompressedByteLength:s._nextUint64()});constF=newo(_,O,n,!0),N={vendorId:F._skip(4)._nextUint16(),descriptorType:F._nextUint16(),versionNumber:F._nextUint16(),descriptorBlockSize:F._nextUint16(),colorModel:F._nextUint8(),colorPrimaries:F._nextUint8(),transferFunction:F._nextUint8(),flags:F._nextUint8(),texelBlockDimension:{x:F._nextUint8()+1,y:F._nextUint8()+1,z:F._nextUint8()+1,w:F._nextUint8()+1},bytesPlane:[F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8()],samples:[]},r=(N.descriptorBlockSize/4-6)/4;for(letM=0;M<r;M++)N.samples[M]={bitOffset:F._nextUint16(),bitLength:F._nextUint8(),channelID:F._nextUint8(),samplePosition:[F._nextUint8(),F._nextUint8(),F._nextUint8(),F._nextUint8()],sampleLower:F._nextUint32(),sampleUpper:F._nextUint32()};t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(N);consti=newo(_,B,G,!0);for(;i._offset<G;){const_=i._nextUint32(),R=i._scan(_),A=a(R),e=i._scan(_-R.byteLength);t.keyValue[A]=A.match(/^ktx/i)?a(e):e,i._offset%4&&i._skip(4-i._offset%4)}if(K<=0)returnt;constS=newo(_,C,K,!0),U=S._nextUint16(),E=S._nextUint16(),L=S._nextUint32(),P=S._nextUint32(),c=S._nextUint32(),f=S._nextUint32(),I=[];for(letM=0;M<T;M++)I.push({imageFlags:S._nextUint32(),rgbSliceByteOffset:S._nextUint32(),rgbSliceByteLength:S._nextUint32(),alphaSliceByteOffset:S._nextUint32(),alphaSliceByteLength:S._nextUint32()});constl=C+S._offset,u=l+L,X=u+P,D=X+c,x=newUint8Array(_.buffer,_.byteOffset+l,L),h=newUint8Array(_.buffer,_.byteOffset+u,P),H=newUint8Array(_.buffer,_.byteOffset+X,c),d=newUint8Array(_.buffer,_.byteOffset+D,f);returnt.globalData={endpointCount:U,selectorCount:E,imageDescs:I,endpointsData:x,selectorsData:h,tablesData:H,extendedData:d},t}constE=["positiveX","negativeX","positiveY","negativeY","positiveZ","negativeZ"],L=163,P=166;letc;functionf(_,t){R.Check.typeOf.object("transcoderModule",c);constA=_.ktx2Buffer,e=_.supportedTargetFormats;letT;try{T=U(A)}catch(M){thrownewR.RuntimeError("Invalid KTX2 file.")}if(0!==T.layerCount)thrownewR.RuntimeError("KTX2 texture arrays are not supported.");if(0!==T.pixelDepth)thrownewR.RuntimeError("KTX2 3D textures are unsupported.");constO=T.dataFormatDescriptor[0],n=newArray(T.levelCount);return0!==T.vkFormat||O.colorModel!==L&&O.colorModel!==P?(t.push(A.buffer),I(T,n)):l(A,T,e,c,t,n),n}functionI(R,t){constA=R.vkFormat===G.VK_FORMAT_R8G8B8_SRGB?n.RGB:n.RGBA;lete;R.vkFormat===G.VK_FORMAT_R8G8B8A8_UNORM?e=T.UNSIGNED_BYTE:R.vkFormat===G.VK_FORMAT_R16G16B16A16_SFLOAT?e=T.HALF_FLOAT:R.vkFormat===G.VK_FORMAT_R32G32B32A32_SFLOAT&&(e=T.FLOAT);for(letO=0;O<R.levels.length;++O){constB={};t[O]=B;constG=R.levels[O].levelData,M=R.pixelWidth>>O,C=R.pixelHeight>>O,K=M*C*n.componentsLength(A);for(lett=0;t<R.faceCount;++t){constO=G.byteOffset+K*R.typeSize*t;letn;n=_.defined(e)&&1!==T.sizeInBytes(e)?2===T.sizeInBytes(e)?newUint16Array(G.buffer,O,K):newFloat32Array(G.buffer,O,K):newUint8Array(G.buffer,O,K),B[E[t]]={internalFormat:A,datatype:e,width:M,height:C,levelBuffer:n}}}}functionl(t,A,e,T,O,B){constG=newT.KTX2File(t);letM=G.getWidth(),C=G.getHeight();constK=G.getLevels(),s=G.getHasAlpha();if(!(M>0)||!(C>0)||!(K>0))throwG.close(),G.delete(),newR.RuntimeError("Invalid KTX2 file");letF,N;constr=A.dataFormatDescriptor[0],i=T.transcoder_texture_format;if(r.colorModel===L)if(e.etc)F=s?n.RGBA8_ETC2_EAC:n.RGB8_ETC2,N=s?i.cTFETC2_RGBA:i.cTFETC1_RGB;elseif(e.etc1&&!s)F=n.RGB_ETC1,N=i.cTFETC1_RGB;elseif(e.s3tc)F=s?n.RGBA_DXT5:n.RGB_DXT1,N=s?i.cTFBC3_RGBA:i.cTFBC1_RGB;elseif(e.pvrtc)F=s?n.RGBA_PVRTC_4BPPV1:n.RGB_PVRTC_4BPPV1,N=s?i.cTFPVRTC1_4_RGBA:i.cTFPVRTC1_4_RGB;elseif(e.astc)F=n.RGBA_ASTC,N=i.cTFASTC_4x4_RGBA;else{if(!e.bc7)thrownewR.RuntimeError("No transcoding format target available for ETC1S compressed ktx2.");F=n.RGBA_BC7,N=i.cTFBC7_RGBA}elseif(r.colorModel===P)if(e.astc)F=n.RGBA_ASTC,N=i.cTFASTC_4x4_RGBA;elseif(e.bc7)F=n.RGBA_BC7,N=i.cTFBC7_RGBA;elseif(e.s3tc)F=s?n.RGBA_DXT5:n.RGB_DXT1,N=s?i.cTFBC3_RGBA:i.cTFBC1_RGB;elseif(e.etc)F=s?n.RGBA8_ETC2_EAC:n.RGB8_ETC2,N=s?i.cTFETC2_RGBA:i.cTFETC1_RGB;elseif(e.etc1&&!s)F=n.RGB_ETC1,N=i.cTFETC1_RGB;else{if(!e.pvrtc)thrownewR.RuntimeError("No transcoding format target available for UASTC compressed ktx2.");F=s?n.RGBA_PVRTC_4BPPV1:n.RGB_PVRTC_4BPPV1,N=s?i.cTFPVRTC1_4_RGBA:i.cTFPVRTC1_4_RGB}if(!G.startTranscoding())throwG.close(),G.delete(),newR.RuntimeError("startTranscoding() failed");for(letn=0;n<A.levels.length;++n){constt={};B[n]=t,M=A.pixelWidth>>n,C=A.pixelHeight>>n;conste=G.getImageTranscodedSizeInBytes(n,0,0,N.value),T=newUint8Array(e),K=G.transcodeImage(T,n,0,0,N.value,0,-1,-1);if(!_.defined(K))thrownewR.RuntimeError("transcodeImage() failed.");O.push(T.buffer),t[E[0]]={internalFormat:F,width:M,height:C,levelBuffer:T}}returnG.close(),G.delete(),B}functionu(_){c=_,c.initializeBasis(),self.onmessage=A(f),self.postMessage(!0)}functionX(R){constt=R.data,A=t.webAssemblyConfig;if(_.defined(A))returnrequire([A.modulePath],(function(R){if(!_.defined(A.wasmBinaryFile))returnR().then((function(_){u(_)}));_.defined(R)||(R=self.MSC_TRANSCODER),R(A).then((function(_){u(_)}))}))}returnX}));
define(["./AttributeCompression-4d18cc04","./Transforms-3ac41eb6","./Matrix2-fc7e9822","./defaultValue-94c3e563","./TerrainEncoding-229275c2","./IndexDatatype-db156785","./RuntimeError-c581ca93","./ComponentDatatype-4a60b8d6","./OrientedBoundingBox-1e0d2855","./createTaskProcessorWorker","./_commonjsHelpers-3aae1032-f55dc0c4","./combine-761d9c3f","./WebGLConstants-7dccdc96","./EllipsoidTangentPlane-53e32153","./AxisAlignedBoundingBox-7a3018c0","./IntersectionTests-68fbc42d","./Plane-e20fba8c"],(function(e,t,i,n,r,s,o,h,u,d,p,f,l,c,a,g,m){"use strict";constw={clipTriangleAtAxisAlignedThreshold:function(e,t,i,r,s,h){if(!n.defined(e))thrownewo.DeveloperError("threshold is required.");if(!n.defined(t))thrownewo.DeveloperError("keepAbove is required.");if(!n.defined(i))thrownewo.DeveloperError("u0 is required.");if(!n.defined(r))thrownewo.DeveloperError("u1 is required.");if(!n.defined(s))thrownewo.DeveloperError("u2 is required.");letu,d,p;n.defined(h)?h.length=0:h=[],t?(u=i<e,d=r<e,p=s<e):(u=i>e,d=r>e,p=s>e);constf=u+d+p;letl,c,a,g,m,w;return1===f?u?(l=(e-i)/(r-i),c=(e-i)/(s-i),h.push(1),h.push(2),1!==c&&(h.push(-1),h.push(0),h.push(2),h.push(c)),1!==l&&(h.push(-1),h.push(0),h.push(1),h.push(l))):d?(a=(e-r)/(s-r),g=(e-r)/(i-r),h.push(2),h.push(0),1!==g&&(h.push(-1),h.push(1),h.push(0),h.push(g)),1!==a&&(h.push(-1),h.push(1),h.push(2),h.push(a))):p&&(m=(e-s)/(i-s),w=(e-s)/(r-s),h.push(0),h.push(1),1!==w&&(h.push(-1),h.push(2),h.push(1),h.push(w)),1!==m&&(h.push(-1),h.push(2),h.push(0),h.push(m))):2===f?u||i===e?d||r===e?p||s===e||(c=(e-i)/(s-i),a=(e-r)/(s-r),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(c),h.push(-1),h.push(1),h.push(2),h.push(a)):(w=(e-s)/(r-s),l=(e-i)/(r-i),h.push(1),h.push(-1),h.push(2),h.push(1),h.push(w),h.push(-1),h.push(0),h.push(1),h.push(l)):(g=(e-r)/(i-r),m=(e-s)/(i-s),h.push(0),h.push(-1),h.push(1),h.push(0),h.push(g),h.push(-1),h.push(2),h.push(0),h.push(m)):3!==f&&(h.push(0),h.push(1),h.push(2)),h},computeBarycentricCoordinates:function(e,t,r,s,h,u,d,p,f){if(!n.defined(e))thrownewo.DeveloperError("x is required.");if(!n.defined(t))thrownewo.DeveloperError("y is required.");if(!n.defined(r))thrownewo.DeveloperError("x1 is required.");if(!n.defined(s))thrownewo.DeveloperError("y1 is required.");if(!n.defined(h))thrownewo.DeveloperError("x2 is required.");if(!n.defined(u))thrownewo.DeveloperError("y2 is required.");if(!n.defined(d))thrownewo.DeveloperError("x3 is required.");if(!n.defined(p))thrownewo.DeveloperError("y3 is required.");constl=r-d,c=d-h,a=u-p,g=s-p,m=1/(a*l+c*g),w=t-p,x=e-d,C=(a*x+c*w)*m,y=(-g*x+l*w)*m,v=1-C-y;returnn.defined(f)?(f.x=C,f.y=y,f.z=v,f):newi.Cartesian3(C,y,v)},computeLineSegmentLineSegmentIntersection:function(e,t,r,s,h,u,d,p,f){o.Check.typeOf.number("x00",e),o.Check.typeOf.number("y00",t),o.Check.typeOf.number("x01",r),o.Check.typeOf.number("y01",s),o.Check.typeOf.number("x10",h),o.Check.typeOf.number("y10",u),o.Check.typeOf.number("x11",d),o.Check.typeOf.number("y11",p);constl=(d-h)*(t-u)-(p-u)*(e-h),c=(r-e)*(t-u)-(s-t)*(e-h),a=(p-u)*(r-e)-(d-h)*(s-t);if(0===a)return;constg=l/a,m=c/a;returng>=0&&g<=1&&m>=0&&m<=1?(n.defined(f)||(f=newi.Cartesian2),f.x=e+g*(r-e),f.y=t+g*(s-t),f):void0}},x=32767,C=x/2|0,y=[],v=[],B=[],b=newi.Cartographic;letA=newi.Cartesian3;constI=[],E=[],D=[],T=[],O=[],z=newi.Cartesian3,V=newt.BoundingSphere,M=newu.OrientedBoundingBox,N=newi.Cartesian2,k=newi.Cartesian3;functionq(e,n){consto=e.isEastChild,d=e.isNorthChild,p=o?C:0,f=o?x:C,l=d?C:0,c=d?x:C,a=I,g=E,m=D,q=O;a.length=0,g.length=0,m.length=0,q.length=0;constR=T;R.length=0;constS={},U=e.vertices;letF=e.indices;F=F.subarray(0,e.indexCountWithoutSkirts);constP=r.TerrainEncoding.clone(e.encoding),W=P.hasVertexNormals;letK=0;constL=e.vertexCountWithoutSkirts,Y=e.minimumHeight,_=e.maximumHeight,j=newArray(L),G=newArray(L),J=newArray(L),Z=W?newArray(2*L):void0,Q=20;let$,ee,te,ie,ne;for(ee=0,te=0;ee<L;++ee,te+=2){conste=P.decodeTextureCoordinates(U,ee,N);if($=P.decodeHeight(U,ee),ie=h.CesiumMath.clamp(e.x*x|0,0,x),ne=h.CesiumMath.clamp(e.y*x|0,0,x),J[ee]=h.CesiumMath.clamp(($-Y)/(_-Y)*x|0,0,x),ie<Q&&(ie=0),ne<Q&&(ne=0),x-ie<Q&&(ie=x),x-ne<Q&&(ne=x),j[ee]=ie,G[ee]=ne,W){conste=P.getOctEncodedNormal(U,ee,k);Z[te]=e.x,Z[te+1]=e.y}(o&&ie>=C||!o&&ie<=C)&&(d&&ne>=C||!d&&ne<=C)&&(S[ee]=K,a.push(ie),g.push(ne),m.push(J[ee]),W&&(q.push(Z[te]),q.push(Z[te+1])),++K)}constre=[];re.push(newH),re.push(newH),re.push(newH);constse=[];letoe,he;for(se.push(newH),se.push(newH),se.push(newH),ee=0;ee<F.length;ee+=3){conste=F[ee],t=F[ee+1],i=F[ee+2],n=j[e],r=j[t],s=j[i];re[0].initializeIndexed(j,G,J,Z,e),re[1].initializeIndexed(j,G,J,Z,t),re[2].initializeIndexed(j,G,J,Z,i);consth=w.clipTriangleAtAxisAlignedThreshold(C,o,n,r,s,y);oe=0,oe>=h.length||(oe=se[0].initializeFromClipResult(h,oe,re),oe>=h.length||(oe=se[1].initializeFromClipResult(h,oe,re),oe>=h.length||(oe=se[2].initializeFromClipResult(h,oe,re),he=w.clipTriangleAtAxisAlignedThreshold(C,d,se[0].getV(),se[1].getV(),se[2].getV(),v),X(a,g,m,q,R,S,he,se,W),oe<h.length&&(se[2].clone(se[1]),se[2].initializeFromClipResult(h,oe,re),he=w.clipTriangleAtAxisAlignedThreshold(C,d,se[0].getV(),se[1].getV(),se[2].getV(),v),X(a,g,m,q,R,S,he,se,W)))))}constue=o?-x:0,de=d?-x:0,pe=[],fe=[],le=[],ce=[];letae=Number.MAX_VALUE,ge=-ae;constme=B;me.length=0;constwe=i.Ellipsoid.clone(e.ellipsoid),xe=i.Rectangle.clone(e.childRectangle),Ce=xe.north,ye=xe.south;letve=xe.east;constBe=xe.west;for(ve<Be&&(ve+=h.CesiumMath.TWO_PI),ee=0;ee<a.length;++ee)ie=Math.round(a[ee]),ie<=p?(pe.push(ee),ie=0):ie>=f?(le.push(ee),ie=x):ie=2*ie+ue,a[ee]=ie,ne=Math.round(g[ee]),ne<=l?(fe.push(ee),ne=0):ne>=c?(ce.push(ee),ne=x):ne=2*ne+de,g[ee]=ne,$=h.CesiumMath.lerp(Y,_,m[ee]/x),$<ae&&(ae=$),$>ge&&(ge=$),m[ee]=$,b.longitude=h.CesiumMath.lerp(Be,ve,ie/x),b.latitude=h.CesiumMath.lerp(ye,Ce,ne/x),b.height=$,we.cartographicToCartesian(b,A),me.push(A.x),me.push(A.y),me.push(A.z);constbe=t.BoundingSphere.fromVertices(me,i.Cartesian3.ZERO,3,V),Ae=u.OrientedBoundingBox.fromRectangle(xe,ae,ge,we,M),Ie=newr.EllipsoidalOccluder(we),Ee=Ie.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(be.center,me,3,be.center,ae,z),De=ge-ae,Te=newUint16Array(a.length+g.length+m.length);for(ee=0;ee<a.length;++ee)Te[ee]=a[ee];letOe=a.length;for(ee=0;ee<g.length;++ee)Te[Oe+ee]=g[ee];for(Oe+=g.length,ee=0;ee<m.length;++ee)Te[Oe+ee]=x*(m[ee]-ae)/De;constze=s.IndexDatatype.createTypedArray(a.length,R);letVe;if(W){conste=newUint8Array(q);n.push(Te.buffer,ze.buffer,e.buffer),Ve=e.buffer}elsen.push(Te.buffer,ze.buffer);return{vertices:Te.buffer,encodedNormals:Ve,indices:ze.buffer,minimumHeight:ae,maximumHeight:ge,westIndices:pe,southIndices:fe,eastIndices:le,northIndices:ce,boundingSphere:be,orientedBoundingBox:Ae,horizonOcclusionPoint:Ee}}functionH(){this.vertexBuffer=void0,this.index=void0,this.first=void0,this.second=void0,this.ratio=void0}H.prototype.clone=function(e){returnn.defined(e)||(e=newH),e.uBuffer=this.uBuffer,e.vBuffer=this.vBuffer,e.heightBuffer=this.heightBuffer,e.normalBuffer=this.normalBuffer,e.index=this.index,e.first=this.first,e.second=this.second,e.ratio=this.ratio,e},H.prototype.initializeIndexed=function(e,t,i,n,r){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=i,this.normalBuffer=n,this.index=r,this.first=void0,this.second=void0,this.ratio=void0},H.prototype.initializeFromClipResult=function(e,t,i){letn=t+1;return-1!==e[t]?i[e[t]].clone(this):(this.vertexBuffer=void0,this.index=void0,this.first=i[e[n]],++n,this.second=i[e[n]],++n,this.ratio=e[n],++n),n},H.prototype.getKey=function(){returnthis.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},H.prototype.isIndexed=function(){returnn.defined(this.index)},H.prototype.getH=function(){returnn.defined(this.index)?this.heightBuffer[this.index]:h.CesiumMath.lerp(this.first.getH(),this.second.getH(),this.ratio)},H.prototype.getU=function(){returnn.defined(this.index)?this.uBuffer[this.index]:h.CesiumMath.lerp(this.first.getU(),this.second.getU(),this.ratio)},H.prototype.getV=function(){returnn.defined(this.index)?this.vBuffer[this.index]:h.CesiumMath.lerp(this.first.getV(),this.second.getV(),this.ratio)};letR=newi.Cartesian2,S=-1;constU=[newi.Cartesian3,newi.Cartesian3],F=[newi.Cartesian3,newi.Cartesian3];functionP(t,n){++S;letr=U[S],s=F[S];returnr=e.AttributeCompression.octDecode(t.first.getNormalX(),t.first.getNormalY(),r),s=e.AttributeCompression.octDecode(t.second.getNormalX(),t.second.getNormalY(),s),A=i.Cartesian3.lerp(r,s,t.ratio,A),i.Cartesian3.normalize(A,A),e.AttributeCompression.octEncode(A,n),--S,n}H.prototype.getNormalX=function(){returnn.defined(this.index)?this.normalBuffer[2*this.index]:(R=P(this,R),R.x)},H.prototype.getNormalY=function(){returnn.defined(this.index)?this.normalBuffer[2*this.index+1]:(R=P(this,R),R.y)};constW=[];functionX(e,t,i,r,s,o,h,u,d){if(0===h.length)return;letp=0,f=0;while(f<h.length)f=W[p++].initializeFromClipResult(h,f,u);for(letl=0;l<p;++l){consts=W[l];if(s.isIndexed())s.newIndex=o[s.index],s.uBuffer=e,s.vBuffer=t,s.heightBuffer=i,d&&(s.normalBuffer=r);else{consth=s.getKey();if(n.defined(o[h]))s.newIndex=o[h];else{constn=e.length;e.push(s.getU()),t.push(s.getV()),i.push(s.getH()),d&&(r.push(s.getNormalX()),r.push(s.getNormalY())),s.newIndex=n,o[h]=n}}}3===p?(s.push(W[0].newIndex),s.push(W[1].newIndex),s.push(W[2].newIndex)):4===p&&(s.push(W[0].newIndex),s.push(W[1].newIndex),s.push(W[2].newIndex),s.push(W[0].newIndex),s.push(W[2].newIndex),s.push(W[3].newIndex))}W.push(newH),W.push(newH),W.push(newH),W.push(newH);varK=d(q);returnK}));