@anov/gis 1.7.7 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/.claude/settings.local.json +37 -0
  2. package/CHANGELOG.md +82 -0
  3. package/README.md +338 -127
  4. package/dist/index.css +1 -1
  5. package/dist/index.js +18012 -58
  6. package/dist/resources/Assets/approximateTerrainHeights.json +1 -1
  7. package/dist/resources/ThirdParty/Workers/package.json +1 -0
  8. package/dist/resources/ThirdParty/Workers/zip-web-worker.js +1 -0
  9. package/dist/resources/ThirdParty/draco_decoder.wasm +0 -0
  10. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -1
  11. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  12. package/dist/resources/ThirdParty/zip-module.wasm +0 -0
  13. package/dist/resources/Widgets/Animation/Animation.css +127 -1
  14. package/dist/resources/Widgets/Animation/lighter.css +70 -1
  15. package/dist/resources/Widgets/BaseLayerPicker/BaseLayerPicker.css +108 -1
  16. package/dist/resources/Widgets/BaseLayerPicker/lighter.css +22 -1
  17. package/dist/resources/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +102 -1
  18. package/dist/resources/Widgets/CesiumInspector/CesiumInspector.css +113 -1
  19. package/dist/resources/Widgets/CesiumWidget/CesiumWidget.css +119 -1
  20. package/dist/resources/Widgets/CesiumWidget/lighter.css +14 -1
  21. package/dist/resources/Widgets/FullscreenButton/FullscreenButton.css +8 -1
  22. package/dist/resources/Widgets/Geocoder/Geocoder.css +70 -1
  23. package/dist/resources/Widgets/Geocoder/lighter.css +17 -1
  24. package/dist/resources/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +27 -0
  25. package/dist/resources/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
  26. package/dist/resources/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
  27. package/dist/resources/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
  28. package/dist/resources/Widgets/Images/ImageryProviders/azureAerial.png +0 -0
  29. package/dist/resources/Widgets/Images/ImageryProviders/azureRoads.png +0 -0
  30. package/dist/resources/Widgets/Images/ImageryProviders/googleContour.png +0 -0
  31. package/dist/resources/Widgets/Images/ImageryProviders/googleRoadmap.png +0 -0
  32. package/dist/resources/Widgets/Images/ImageryProviders/googleSatellite.png +0 -0
  33. package/dist/resources/Widgets/Images/ImageryProviders/googleSatelliteLabels.png +0 -0
  34. package/dist/resources/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
  35. package/dist/resources/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
  36. package/dist/resources/Widgets/InfoBox/InfoBox.css +92 -1
  37. package/dist/resources/Widgets/InfoBox/InfoBoxDescription.css +178 -1
  38. package/dist/resources/Widgets/NavigationHelpButton/NavigationHelpButton.css +93 -1
  39. package/dist/resources/Widgets/NavigationHelpButton/lighter.css +38 -1
  40. package/dist/resources/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +15 -1
  41. package/dist/resources/Widgets/ProjectionPicker/ProjectionPicker.css +38 -1
  42. package/dist/resources/Widgets/SceneModePicker/SceneModePicker.css +56 -1
  43. package/dist/resources/Widgets/SelectionIndicator/SelectionIndicator.css +20 -1
  44. package/dist/resources/Widgets/Timeline/Timeline.css +103 -1
  45. package/dist/resources/Widgets/Timeline/lighter.css +23 -1
  46. package/dist/resources/Widgets/VRButton/VRButton.css +8 -1
  47. package/dist/resources/Widgets/Viewer/Viewer.css +107 -1
  48. package/dist/resources/Widgets/VoxelInspector/VoxelInspector.css +16 -0
  49. package/dist/resources/Widgets/lighter.css +237 -1
  50. package/dist/resources/Widgets/lighterShared.css +46 -1
  51. package/dist/resources/Widgets/shared.css +103 -1
  52. package/dist/resources/Widgets/widgets.css +1342 -1
  53. package/dist/resources/Workers/chunk-2AIOP76V.js +25 -0
  54. package/dist/resources/Workers/chunk-37ETYCYM.js +25 -0
  55. package/dist/resources/Workers/chunk-3E7FIXV7.js +25 -0
  56. package/dist/resources/Workers/chunk-3N6OW3OY.js +25 -0
  57. package/dist/resources/Workers/{ArcType-de5d8777.js → chunk-3VUCSHGU.js} +2 -2
  58. package/dist/resources/Workers/chunk-4KY4VMEH.js +25 -0
  59. package/dist/resources/Workers/chunk-4WQ4VT5S.js +25 -0
  60. package/dist/resources/Workers/chunk-5AAMOBJK.js +25 -0
  61. package/dist/resources/Workers/chunk-5DGDPBQU.js +25 -0
  62. package/dist/resources/Workers/chunk-5VFNV3LW.js +25 -0
  63. package/dist/resources/Workers/chunk-5Z36UAB7.js +25 -0
  64. package/dist/resources/Workers/chunk-6AEO73KW.js +25 -0
  65. package/dist/resources/Workers/chunk-6DLS2UKD.js +25 -0
  66. package/dist/resources/Workers/{GeometryAttributes-734a3446.js → chunk-6EINM7EY.js} +2 -2
  67. package/dist/resources/Workers/chunk-6W2XFGWI.js +25 -0
  68. package/dist/resources/Workers/chunk-7GCQCPLT.js +25 -0
  69. package/dist/resources/Workers/chunk-7TN3TOVQ.js +25 -0
  70. package/dist/resources/Workers/chunk-A4I25VN7.js +25 -0
  71. package/dist/resources/Workers/{GeometryOffsetAttribute-59b14f45.js → chunk-AJH5KBOO.js} +2 -2
  72. package/dist/resources/Workers/chunk-AKELQO2L.js +25 -0
  73. package/dist/resources/Workers/chunk-ALIHIWSS.js +25 -0
  74. package/dist/resources/Workers/chunk-ATKJRN2G.js +25 -0
  75. package/dist/resources/Workers/chunk-BDWA46XV.js +25 -0
  76. package/dist/resources/Workers/chunk-BKIYVF74.js +25 -0
  77. package/dist/resources/Workers/chunk-BPABSUDY.js +25 -0
  78. package/dist/resources/Workers/chunk-D3TVNJ6W.js +25 -0
  79. package/dist/resources/Workers/chunk-DM7KUSL2.js +25 -0
  80. package/dist/resources/Workers/chunk-E7EKLP3B.js +25 -0
  81. package/dist/resources/Workers/{GeometryInstance-4bfcfe78.js → chunk-G2QPRBZU.js} +2 -2
  82. package/dist/resources/Workers/chunk-G3GDHHWO.js +25 -0
  83. package/dist/resources/Workers/chunk-G72JFEXW.js +25 -0
  84. package/dist/resources/Workers/chunk-IAE6APK2.js +25 -0
  85. package/dist/resources/Workers/chunk-IEITL4VO.js +25 -0
  86. package/dist/resources/Workers/chunk-LHBFSFJE.js +25 -0
  87. package/dist/resources/Workers/chunk-LN2UT4R3.js +25 -0
  88. package/dist/resources/Workers/chunk-LNJEJFV5.js +66 -0
  89. package/dist/resources/Workers/{defaultValue-97284df2.js → chunk-ML6MR2RA.js} +2 -2
  90. package/dist/resources/Workers/chunk-MOHWP7VV.js +25 -0
  91. package/dist/resources/Workers/chunk-NZBME2JK.js +25 -0
  92. package/dist/resources/Workers/chunk-P5EFSOUF.js +25 -0
  93. package/dist/resources/Workers/chunk-P7N43FDO.js +25 -0
  94. package/dist/resources/Workers/{combine-d11b1f00.js → chunk-PEDE2P3Q.js} +2 -2
  95. package/dist/resources/Workers/chunk-PSIOCLX7.js +25 -0
  96. package/dist/resources/Workers/chunk-PYMQNHFO.js +25 -0
  97. package/dist/resources/Workers/chunk-QJTXFT4R.js +25 -0
  98. package/dist/resources/Workers/chunk-QNPYEODC.js +25 -0
  99. package/dist/resources/Workers/chunk-QS7V5G6Y.js +25 -0
  100. package/dist/resources/Workers/chunk-RDX4QSUS.js +25 -0
  101. package/dist/resources/Workers/chunk-RESOCDYZ.js +25 -0
  102. package/dist/resources/Workers/chunk-SRA5MBUT.js +25 -0
  103. package/dist/resources/Workers/chunk-TCOMWBL2.js +25 -0
  104. package/dist/resources/Workers/chunk-UA7PAMQQ.js +25 -0
  105. package/dist/resources/Workers/chunk-W5OEMTMB.js +25 -0
  106. package/dist/resources/Workers/chunk-WGIRJIIK.js +25 -0
  107. package/dist/resources/Workers/{CylinderGeometryLibrary-24ad1484.js → chunk-XRJOFXJF.js} +2 -2
  108. package/dist/resources/Workers/chunk-YP4SXJYZ.js +25 -0
  109. package/dist/resources/Workers/chunk-Z7Q4J7AE.js +25 -0
  110. package/dist/resources/Workers/combineGeometry.js +2 -2
  111. package/dist/resources/Workers/createBoxGeometry.js +2 -2
  112. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -2
  113. package/dist/resources/Workers/createCircleGeometry.js +2 -2
  114. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -2
  115. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -2
  116. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -2
  117. package/dist/resources/Workers/createCorridorGeometry.js +2 -2
  118. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -2
  119. package/dist/resources/Workers/createCylinderGeometry.js +2 -2
  120. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -2
  121. package/dist/resources/Workers/createEllipseGeometry.js +2 -2
  122. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -2
  123. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -2
  124. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -2
  125. package/dist/resources/Workers/createFrustumGeometry.js +2 -2
  126. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -2
  127. package/dist/resources/Workers/createGeometry.js +2 -2
  128. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -2
  129. package/dist/resources/Workers/createPlaneGeometry.js +2 -2
  130. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -2
  131. package/dist/resources/Workers/createPolygonGeometry.js +2 -2
  132. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -2
  133. package/dist/resources/Workers/createPolylineGeometry.js +2 -2
  134. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -2
  135. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -2
  136. package/dist/resources/Workers/createRectangleGeometry.js +2 -2
  137. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -2
  138. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -2
  139. package/dist/resources/Workers/createSphereGeometry.js +2 -2
  140. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -2
  141. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -2
  142. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -2
  143. package/dist/resources/Workers/createVectorTileGeometries.js +2 -2
  144. package/dist/resources/Workers/createVectorTilePoints.js +2 -2
  145. package/dist/resources/Workers/createVectorTilePolygons.js +2 -2
  146. package/dist/resources/Workers/createVectorTilePolylines.js +2 -2
  147. package/dist/resources/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -0
  148. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -2
  149. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -4
  150. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -2
  151. package/dist/resources/Workers/createWallGeometry.js +2 -2
  152. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -2
  153. package/dist/resources/Workers/decodeDraco.js +2 -2
  154. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
  155. package/dist/resources/Workers/decodeI3S.js +25 -0
  156. package/dist/resources/Workers/gaussianSplatSorter.js +25 -0
  157. package/dist/resources/Workers/{_commonjsHelpers-3aae1032-65601a27.js → gaussianSplatTextureGenerator.js} +2 -2
  158. package/dist/resources/Workers/incrementallyBuildTerrainPicker.js +25 -0
  159. package/dist/resources/Workers/transcodeKTX2.js +2 -2
  160. package/dist/resources/Workers/transferTypedArrayTest.js +25 -1
  161. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -2
  162. package/dist/resources/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -0
  163. package/dist/resources/static/js/viewerCesiumNavigationMixin.js +1 -1
  164. package/package.json +11 -7
  165. package/scripts/release.js +323 -0
  166. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -1
  167. package/dist/resources/ThirdParty/Workers/draco_decoder_nodejs.js +0 -1
  168. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +0 -1
  169. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +0 -1
  170. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +0 -1
  171. package/dist/resources/Widgets/Images/ImageryProviders/esriNationalGeographic.png +0 -0
  172. package/dist/resources/Widgets/Images/ImageryProviders/esriWorldImagery.png +0 -0
  173. package/dist/resources/Widgets/Images/ImageryProviders/esriWorldStreetMap.png +0 -0
  174. package/dist/resources/Workers/AttributeCompression-5744d52e.js +0 -25
  175. package/dist/resources/Workers/AxisAlignedBoundingBox-b1c095aa.js +0 -25
  176. package/dist/resources/Workers/BoundingRectangle-2b0ebbdd.js +0 -25
  177. package/dist/resources/Workers/BoxGeometry-acd0c697.js +0 -25
  178. package/dist/resources/Workers/Color-c7fd1307.js +0 -25
  179. package/dist/resources/Workers/ComponentDatatype-e7fbe225.js +0 -25
  180. package/dist/resources/Workers/CoplanarPolygonGeometryLibrary-edaba606.js +0 -25
  181. package/dist/resources/Workers/CorridorGeometryLibrary-ab3e6481.js +0 -25
  182. package/dist/resources/Workers/CylinderGeometry-679e50b4.js +0 -25
  183. package/dist/resources/Workers/EllipseGeometry-e6f948bb.js +0 -25
  184. package/dist/resources/Workers/EllipseGeometryLibrary-0adcaeed.js +0 -25
  185. package/dist/resources/Workers/EllipseOutlineGeometry-418492dc.js +0 -25
  186. package/dist/resources/Workers/EllipsoidGeodesic-ed8a0e40.js +0 -25
  187. package/dist/resources/Workers/EllipsoidGeometry-539fb9e2.js +0 -25
  188. package/dist/resources/Workers/EllipsoidOutlineGeometry-6c13760b.js +0 -25
  189. package/dist/resources/Workers/EllipsoidRhumbLine-60f14314.js +0 -25
  190. package/dist/resources/Workers/EllipsoidTangentPlane-7ae496b2.js +0 -25
  191. package/dist/resources/Workers/EncodedCartesian3-a9a8a281.js +0 -25
  192. package/dist/resources/Workers/FrustumGeometry-be9b9578.js +0 -25
  193. package/dist/resources/Workers/GeometryAttribute-fd1d7e90.js +0 -25
  194. package/dist/resources/Workers/GeometryPipeline-a847e31f.js +0 -25
  195. package/dist/resources/Workers/IndexDatatype-65271ba3.js +0 -25
  196. package/dist/resources/Workers/IntersectionTests-33ace2d6.js +0 -25
  197. package/dist/resources/Workers/Matrix2-73789715.js +0 -25
  198. package/dist/resources/Workers/OrientedBoundingBox-ee3011f6.js +0 -25
  199. package/dist/resources/Workers/Plane-e916220d.js +0 -25
  200. package/dist/resources/Workers/PolygonGeometryLibrary-0f0c78d4.js +0 -25
  201. package/dist/resources/Workers/PolygonPipeline-00dc0c6e.js +0 -25
  202. package/dist/resources/Workers/PolylinePipeline-ebd42f23.js +0 -25
  203. package/dist/resources/Workers/PolylineVolumeGeometryLibrary-a4b92b4e.js +0 -25
  204. package/dist/resources/Workers/PrimitivePipeline-42d69f96.js +0 -25
  205. package/dist/resources/Workers/RectangleGeometryLibrary-cff60d30.js +0 -25
  206. package/dist/resources/Workers/RuntimeError-4f8ec8a2.js +0 -25
  207. package/dist/resources/Workers/TerrainEncoding-080f16eb.js +0 -25
  208. package/dist/resources/Workers/Transforms-d3d3b2a9.js +0 -66
  209. package/dist/resources/Workers/VertexFormat-9886cb81.js +0 -25
  210. package/dist/resources/Workers/WallGeometryLibrary-27f90b78.js +0 -25
  211. package/dist/resources/Workers/WebGLConstants-6da700a2.js +0 -25
  212. package/dist/resources/Workers/WebMercatorProjection-04ef6bc3.js +0 -25
  213. package/dist/resources/Workers/arrayRemoveDuplicates-6f91355d.js +0 -25
  214. package/dist/resources/Workers/cesiumWorkerBootstrapper.js +0 -6
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,6 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./Matrix2-73789715","./AxisAlignedBoundingBox-b1c095aa","./Transforms-d3d3b2a9","./defaultValue-97284df2","./RuntimeError-4f8ec8a2","./TerrainEncoding-080f16eb","./ComponentDatatype-e7fbe225","./OrientedBoundingBox-ee3011f6","./WebMercatorProjection-04ef6bc3","./_commonjsHelpers-3aae1032-65601a27","./createTaskProcessorWorker","./combine-d11b1f00","./AttributeCompression-5744d52e","./WebGLConstants-6da700a2","./EllipsoidTangentPlane-7ae496b2","./IntersectionTests-33ace2d6","./Plane-e916220d"],(function(e,t,i,a,n,r,s,l,o,f,u,c,d,h,m,g,p){"use strict";var x=Object.freeze({NONE:0,LERC:1});const w={};w.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const k=new e.Cartesian3,y=new e.Matrix4,I=new e.Cartesian3,b=new e.Cartesian3;w.computeVertices=function(n){const f=Math.cos,u=Math.sin,c=Math.sqrt,d=Math.atan,h=Math.exp,m=s.CesiumMath.PI_OVER_TWO,g=s.CesiumMath.toRadians,p=n.heightmap,x=n.width,U=n.height,T=n.skirtHeight,M=T>0,V=a.defaultValue(n.isGeographic,!0),v=a.defaultValue(n.ellipsoid,e.Ellipsoid.WGS84),A=1/v.maximumRadius,B=e.Rectangle.clone(n.nativeRectangle),D=e.Rectangle.clone(n.rectangle);let S,P,E,C;a.defined(D)?(S=D.west,P=D.south,E=D.east,C=D.north):V?(S=g(B.west),P=g(B.south),E=g(B.east),C=g(B.north)):(S=B.west*A,P=m-2*d(h(-B.south*A)),E=B.east*A,C=m-2*d(h(-B.north*A)));let F=n.relativeToCenter;const N=a.defined(F);F=N?F:e.Cartesian3.ZERO;const O=a.defaultValue(n.includeWebMercatorT,!1),R=a.defaultValue(n.exaggeration,1),L=a.defaultValue(n.exaggerationRelativeHeight,0),z=1!==R,H=a.defaultValue(n.structure,w.DEFAULT_STRUCTURE),_=a.defaultValue(H.heightScale,w.DEFAULT_STRUCTURE.heightScale),Y=a.defaultValue(H.heightOffset,w.DEFAULT_STRUCTURE.heightOffset),W=a.defaultValue(H.elementsPerHeight,w.DEFAULT_STRUCTURE.elementsPerHeight),X=a.defaultValue(H.stride,w.DEFAULT_STRUCTURE.stride),Z=a.defaultValue(H.elementMultiplier,w.DEFAULT_STRUCTURE.elementMultiplier),j=a.defaultValue(H.isBigEndian,w.DEFAULT_STRUCTURE.isBigEndian);let G=e.Rectangle.computeWidth(B),q=e.Rectangle.computeHeight(B);const Q=G/(x-1),J=q/(U-1);V||(G*=A,q*=A);const K=v.radiiSquared,$=K.x,ee=K.y,te=K.z;let ie=65536,ae=-65536;const ne=i.Transforms.eastNorthUpToFixedFrame(F,v),re=e.Matrix4.inverseTransformation(ne,y);let se,le;O&&(se=o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(P),le=1/(o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(C)-se));const oe=I;oe.x=Number.POSITIVE_INFINITY,oe.y=Number.POSITIVE_INFINITY,oe.z=Number.POSITIVE_INFINITY;const fe=b;fe.x=Number.NEGATIVE_INFINITY,fe.y=Number.NEGATIVE_INFINITY,fe.z=Number.NEGATIVE_INFINITY;let ue=Number.POSITIVE_INFINITY;const ce=x*U,de=ce+(T>0?2*x+2*U:0),he=new Array(de),me=new Array(de),ge=new Array(de),pe=O?new Array(de):[],xe=z?new Array(de):[];let we=0,ke=U,ye=0,Ie=x;M&&(--we,++ke,--ye,++Ie);const be=1e-5;for(let t=we;t<ke;++t){let i=t;i<0&&(i=0),i>=U&&(i=U-1);let a=B.north-J*i;a=V?g(a):m-2*d(h(-a*A));let n=(a-P)/(C-P);n=s.CesiumMath.clamp(n,0,1);const r=t===we,l=t===ke-1;T>0&&(r?a+=be*q:l&&(a-=be*q));const w=f(a),y=u(a),I=te*y;let b;O&&(b=(o.WebMercatorProjection.geodeticLatitudeToMercatorAngle(a)-se)*le);for(let t=ye;t<Ie;++t){let a=t;a<0&&(a=0),a>=x&&(a=x-1);const o=i*(x*X)+a*X;let d;if(1===W)d=p[o];else{let e;if(d=0,j)for(e=0;e<W;++e)d=d*Z+p[o+e];else for(e=W-1;e>=0;--e)d=d*Z+p[o+e]}d=d*_+Y,ae=Math.max(ae,d),ie=Math.min(ie,d);let h=B.west+Q*a;V?h=g(h):h*=A;let m=(h-S)/(E-S);m=s.CesiumMath.clamp(m,0,1);let M=i*x+a;if(T>0){const e=t===ye,n=t===Ie-1,s=r||l||e||n;if((r||l)&&(e||n))continue;s&&(d-=T,e?(M=ce+(U-i-1),h-=be*G):l?M=ce+U+(x-a-1):n?(M=ce+U+x+i,h+=be*G):r&&(M=ce+U+x+U+a))}const D=w*f(h),P=w*u(h),C=$*D,F=ee*P,N=1/c(C*D+F*P+I*y),R=C*N,L=F*N,H=I*N,q=new e.Cartesian3;q.x=R+D*d,q.y=L+P*d,q.z=H+y*d,e.Matrix4.multiplyByPoint(re,q,k),e.Cartesian3.minimumByComponent(k,oe,oe),e.Cartesian3.maximumByComponent(k,fe,fe),ue=Math.min(ue,d),he[M]=q,ge[M]=new e.Cartesian2(m,n),me[M]=d,O&&(pe[M]=b),z&&(xe[M]=v.geodeticSurfaceNormal(q))}}const Ue=i.BoundingSphere.fromPoints(he);let Te,Me;a.defined(D)&&(Te=l.OrientedBoundingBox.fromRectangle(D,ie,ae,v)),N&&(Me=new r.EllipsoidalOccluder(v).computeHorizonCullingPointPossiblyUnderEllipsoid(F,he,ie));const Ve=new t.AxisAlignedBoundingBox(oe,fe,F),ve=new r.TerrainEncoding(F,Ve,ue,ae,ne,!1,O,z,R,L),Ae=new Float32Array(de*ve.stride);let Be=0;for(let e=0;e<de;++e)Be=ve.encode(Ae,Be,he[e],ge[e],me[e],void 0,pe[e],xe[e]);return{vertices:Ae,maximumHeight:ae,minimumHeight:ie,encoding:ve,boundingSphere3D:Ue,orientedBoundingBox:Te,occludeePointInScaledSpace:Me}};var U=f.createCommonjsModule((function(e){
26
- /* 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 */
27
- !function(){var t,i,a,n,r,s,l,o,f,u,c,d,h,m,g,p,x=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,s){var l=(s=s||{}).encodedMaskData||null===s.encodedMaskData,o=r(e,s.inputOffset||0,l),f=null!==s.noDataValue?s.noDataValue:t.defaultNoDataValue,u=i(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};return u.resultMask&&(c.maskData=u.resultMask),s.returnEncodedMask&&o.mask&&(c.encodedMaskData=o.mask.bitset?o.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=a(o),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(o))),c}},i=function(e,t,i,a,n){var r,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=new t(e.width*e.height),n&&i&&(o=new Uint8Array(e.width*e.height));for(var p,x,w=new Float32Array(d*h),k=0;k<=c;k++){var y=k!==c?h:e.height%c;if(0!==y)for(var I=0;I<=u;I++){var b=I!==u?d:e.width%u;if(0!==b){var U,T,M,V,v=k*e.width*h+I*d,A=e.width-b,B=e.pixels.blocks[f];if(B.encoding<2?(0===B.encoding?U=B.rawData:(s(B.stuffedData,B.bitsPerPixel,B.numValidPixels,B.offset,m,w,e.pixels.maxValue),U=w),T=0):M=2===B.encoding?0:B.offset,i)for(x=0;x<y;x++){for(7&v&&(V=i[v>>3],V<<=7&v),p=0;p<b;p++)7&v||(V=i[v>>3]),128&V?(o&&(o[v]=1),g=g>(r=B.encoding<2?U[T++]:M)?r:g,l[v++]=r):(o&&(o[v]=0),l[v++]=a),V<<=1;v+=A}else if(B.encoding<2)for(x=0;x<y;x++){for(p=0;p<b;p++)g=g>(r=U[T++])?r:g,l[v++]=r;v+=A}else for(g=g>M?M:g,x=0;x<y;x++){for(p=0;p<b;p++)l[v++]=M;v+=A}if(1===B.encoding&&T!==B.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:l,resultMask:o,minValue:g}},a=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(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},a=0;a<t;a++){var n=e.pixels.blocks[a];0===n.encoding?i.float32=!0:1===n.encoding?i[n.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},r=function(e,t,i){var a={},n=new Uint8Array(e,t,10);if(a.fileIdentifierString=String.fromCharCode.apply(null,n),"CntZImage"!==a.fileIdentifierString.trim())throw"Unexpected file identifier string: "+a.fileIdentifierString;t+=10;var r=new DataView(e,t,24);if(a.fileVersion=r.getInt32(0,!0),a.imageType=r.getInt32(4,!0),a.height=r.getUint32(8,!0),a.width=r.getUint32(12,!0),a.maxZError=r.getFloat64(16,!0),t+=24,!i)if(r=new DataView(e,t,16),a.mask={},a.mask.numBlocksY=r.getUint32(0,!0),a.mask.numBlocksX=r.getUint32(4,!0),a.mask.numBytes=r.getUint32(8,!0),a.mask.maxValue=r.getFloat32(12,!0),t+=16,a.mask.numBytes>0){var s=new Uint8Array(Math.ceil(a.width*a.height/8)),l=(r=new DataView(e,t,a.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(l>0)for(;l--;)s[f++]=r.getUint8(o++);else{var u=r.getUint8(o++);for(l=-l;l--;)s[f++]=u}l=r.getInt16(o,!0),o+=2}while(o<a.mask.numBytes);if(-32768!==l||f<s.length)throw"Unexpected end of mask RLE encoding";a.mask.bitset=s,t+=a.mask.numBytes}else 0==(a.mask.numBytes|a.mask.numBlocksY|a.mask.maxValue)&&(a.mask.bitset=new Uint8Array(Math.ceil(a.width*a.height/8)));r=new DataView(e,t,16),a.pixels={},a.pixels.numBlocksY=r.getUint32(0,!0),a.pixels.numBlocksX=r.getUint32(4,!0),a.pixels.numBytes=r.getUint32(8,!0),a.pixels.maxValue=r.getFloat32(12,!0),t+=16;var c=a.pixels.numBlocksX,d=a.pixels.numBlocksY,h=c+(a.width%c>0?1:0),m=d+(a.height%d>0?1:0);a.pixels.blocks=new Array(h*m);for(var g=0,p=0;p<m;p++)for(var x=0;x<h;x++){var w=0,k=e.byteLength-t;r=new DataView(e,t,Math.min(10,k));var y={};a.pixels.blocks[g++]=y;var I=r.getUint8(0);if(w++,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),w++;else if(1===I)y.offset=r.getInt16(1,!0),w+=2;else{if(0!==I)throw"Invalid block offset type";y.offset=r.getFloat32(1,!0),w+=4}if(1===y.encoding)if(I=r.getUint8(w),w++,y.bitsPerPixel=63&I,I>>=6,y.numValidPixelsType=I,2===I)y.numValidPixels=r.getUint8(w),w++;else if(1===I)y.numValidPixels=r.getUint16(w,!0),w+=2;else{if(0!==I)throw"Invalid valid pixel count type";y.numValidPixels=r.getUint32(w,!0),w+=4}}var b;if(t+=w,3!==y.encoding)if(0===y.encoding){var U=(a.pixels.numBytes-1)/4;if(U!==Math.floor(U))throw"uncompressed block has invalid length";b=new ArrayBuffer(4*U),new Uint8Array(b).set(new Uint8Array(e,t,4*U));var T=new Float32Array(b);y.rawData=T,t+=4*U}else if(1===y.encoding){var M=Math.ceil(y.numValidPixels*y.bitsPerPixel/8),V=Math.ceil(M/4);b=new ArrayBuffer(4*V),new Uint8Array(b).set(new Uint8Array(e,t,M)),y.stuffedData=new Uint32Array(b),t+=M}}else t++}return a.eofOffset=t,a},s=function(e,t,i,a,n,r,s){var l,o,f,u=(1<<t)-1,c=0,d=0,h=Math.ceil((s-a)/n),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{var g=t-d;o=(f&u)<<g&u,o+=(f=e[c++])>>>(d=32-g)}r[l]=o<h?a+o*n:s}return r},t),w=(l=function(e,t,i,a,n,r,s,l){var o,f,u,c,d,h=(1<<i)-1,m=0,g=0,p=4*e.length-Math.ceil(i*a/8);if(e[e.length-1]<<=8*p,n)for(o=0;o<a;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(f=(u&h)<<(c=i-g)&h,f+=(u=e[m++])>>>(g=32-c)),t[o]=n[f];else for(d=Math.ceil((l-r)/s),o=0;o<a;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(f=(u&h)<<(c=i-g)&h,f+=(u=e[m++])>>>(g=32-c)),t[o]=f<d?r+f*s:l},o=function(e,t,i,a,n,r){var s,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;var g=Math.ceil((r-a)/n);for(f=0;f<i;f++)0===c&&(s=e[o++],c=32),c>=t?(d=s>>>c-t&l,c-=t):(d=(s&l)<<(u=t-c)&l,d+=(s=e[o++])>>>(c=32-u)),h[f]=d<g?a+d*n:r;return h.unshift(a),h},f=function(e,t,i,a,n,r,s,l){var o,f,u,c,d=(1<<i)-1,h=0,m=0,g=0;if(n)for(o=0;o<a;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(f=u>>>g&d,m=32-(c=i-m),f|=((u=e[h++])&(1<<c)-1)<<i-c,g=c),t[o]=n[f];else{var p=Math.ceil((l-r)/s);for(o=0;o<a;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(f=u>>>g&d,m=32-(c=i-m),f|=((u=e[h++])&(1<<c)-1)<<i-c,g=c),t[o]=f<p?r+f*s:l}return t},u=function(e,t,i,a,n,r){var s,l=(1<<t)-1,o=0,f=0,u=0,c=0,d=0,h=0,m=[],g=Math.ceil((r-a)/n);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):(d=s>>>h&l,c=32-(u=t-c),d|=((s=e[o++])&(1<<u)-1)<<t-u,h=u),m[f]=d<g?a+d*n:r;return m.unshift(a),m},c=function(e,t,i,a){var n,r,s,l,o=(1<<i)-1,f=0,u=0,c=4*e.length-Math.ceil(i*a/8);for(e[e.length-1]<<=8*c,n=0;n<a;n++)0===u&&(s=e[f++],u=32),u>=i?(r=s>>>u-i&o,u-=i):(r=(s&o)<<(l=i-u)&o,r+=(s=e[f++])>>>(u=32-l)),t[n]=r;return t},d=function(e,t,i,a){var n,r,s,l,o=(1<<i)-1,f=0,u=0,c=0;for(n=0;n<a;n++)0===u&&(s=e[f++],u=32,c=0),u>=i?(r=s>>>c&o,u-=i,c+=i):(r=s>>>c&o,u=32-(l=i-u),r|=((s=e[f++])&(1<<l)-1)<<i-l,c=l),t[n]=r;return t},h={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,i=65535,a=e.length,n=Math.floor(a/2),r=0;n;){var s=n>=359?359:n;n-=s;do{t+=e[r++]<<8,i+=t+=e[r++]}while(--s);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return 1&a&&(i+=t+=e[r]<<8),((i=(65535&i)+(i>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var i=t.ptr,a=new Uint8Array(e,i,6),n={};if(n.fileIdentifierString=String.fromCharCode.apply(null,a),0!==n.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+n.fileIdentifierString;i+=6;var r,s=new DataView(e,i,8),l=s.getInt32(0,!0);if(n.fileVersion=l,i+=4,l>=3&&(n.checksum=s.getUint32(4,!0),i+=4),s=new DataView(e,i,12),n.height=s.getUint32(0,!0),n.width=s.getUint32(4,!0),i+=8,l>=4?(n.numDims=s.getUint32(8,!0),i+=4):n.numDims=1,s=new DataView(e,i,40),n.numValidPixel=s.getUint32(0,!0),n.microBlockSize=s.getInt32(4,!0),n.blobSize=s.getInt32(8,!0),n.imageType=s.getInt32(12,!0),n.maxZError=s.getFloat64(16,!0),n.zMin=s.getFloat64(24,!0),n.zMax=s.getFloat64(32,!0),i+=40,t.headerInfo=n,t.ptr=i,l>=3&&(r=l>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,i-r,n.blobSize-14))!==n.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var i=t.headerInfo,a=this.getDataTypeArray(i.imageType),n=i.numDims*this.getDataTypeSize(i.imageType),r=this.readSubArray(e,t.ptr,a,n),s=this.readSubArray(e,t.ptr+n,a,n);t.ptr+=2*n;var l,o=!0;for(l=0;l<i.numDims;l++)if(r[l]!==s[l]){o=!1;break}return i.minValues=r,i.maxValues=s,o},readSubArray:function(e,t,i,a){var n;if(i===Uint8Array)n=new Uint8Array(e,t,a);else{var r=new ArrayBuffer(a);new Uint8Array(r).set(new Uint8Array(e,t,a)),n=new i(r)}return n},readMask:function(e,t){var i,a,n=t.ptr,r=t.headerInfo,s=r.width*r.height,l=r.numValidPixel,o=new DataView(e,n,4),f={};if(f.numBytes=o.getUint32(0,!0),n+=4,(0===l||s===l)&&0!==f.numBytes)throw"invalid mask";if(0===l)i=new Uint8Array(Math.ceil(s/8)),f.bitset=i,a=new Uint8Array(s),t.pixels.resultMask=a,n+=f.numBytes;else if(f.numBytes>0){i=new Uint8Array(Math.ceil(s/8));var u=(o=new DataView(e,n,f.numBytes)).getInt16(0,!0),c=2,d=0,h=0;do{if(u>0)for(;u--;)i[d++]=o.getUint8(c++);else for(h=o.getUint8(c++),u=-u;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";a=new Uint8Array(s);var m=0,g=0;for(g=0;g<s;g++)7&g?(m=i[g>>3],m<<=7&g):m=i[g>>3],128&m&&(a[g]=1);t.pixels.resultMask=a,f.bitset=i,n+=f.numBytes}return t.ptr=n,t.mask=f,!0},readDataOneSweep:function(e,t,i){var a,n=t.ptr,r=t.headerInfo,s=r.numDims,l=r.width*r.height,o=r.imageType,f=r.numValidPixel*h.getDataTypeSize(o)*s,u=t.pixels.resultMask;if(i===Uint8Array)a=new Uint8Array(e,n,f);else{var c=new ArrayBuffer(f);new Uint8Array(c).set(new Uint8Array(e,n,f)),a=new i(c)}if(a.length===l*s)t.pixels.resultPixels=a;else{t.pixels.resultPixels=new i(l*s);var d=0,m=0,g=0,p=0;if(s>1)for(g=0;g<s;g++)for(p=g*l,m=0;m<l;m++)u[m]&&(t.pixels.resultPixels[p+m]=a[d++]);else for(m=0;m<l;m++)u[m]&&(t.pixels.resultPixels[m]=a[d++])}return n+=f,t.ptr=n,!0},readHuffmanTree:function(e,t){var i=this.HUFFMAN_LUT_BITS_MAX,a=new DataView(e,t.ptr,16);if(t.ptr+=16,a.getInt32(0,!0)<2)throw"unsupported Huffman version";var n=a.getInt32(4,!0),r=a.getInt32(8,!0),s=a.getInt32(12,!0);if(r>=s)return!1;var l=new Uint32Array(s-r);h.decodeBits(e,t,l);var o,f,u,c,d=[];for(o=r;o<s;o++)d[f=o-(o<n?0:n)]={first:l[o-r],second:null};var g=e.byteLength-t.ptr,p=Math.ceil(g/4),x=new ArrayBuffer(4*p);new Uint8Array(x).set(new Uint8Array(e,t.ptr,g));var w,k=new Uint32Array(x),y=0,I=0;for(w=k[0],o=r;o<s;o++)(c=d[f=o-(o<n?0:n)].first)>0&&(d[f].second=w<<y>>>32-c,32-y>=c?32===(y+=c)&&(y=0,w=k[++I]):(y+=c-32,w=k[++I],d[f].second|=w>>>32-y));var b,U=0,T=new m;for(o=0;o<d.length;o++)void 0!==d[o]&&(U=Math.max(U,d[o].first));b=U>=i?i:U,U>=30&&console.log("WARning, large NUM LUT BITS IS "+U);var M,V,v,A,B,D=[];for(o=r;o<s;o++)if((c=d[f=o-(o<n?0:n)].first)>0)if(M=[c,f],c<=b)for(V=d[f].second<<b-c,v=1<<b-c,u=0;u<v;u++)D[V|u]=M;else for(V=d[f].second,B=T,A=c-1;A>=0;A--)V>>>A&1?(B.right||(B.right=new m),B=B.right):(B.left||(B.left=new m),B=B.left),0!==A||B.val||(B.val=M[1]);return{decodeLut:D,numBitsLUTQick:b,numBitsLUT:U,tree:T,stuffedData:k,srcPtr:I,bitPos:y}},readHuffman:function(e,t,i){var a,n,r,s,l,o,f,u,c,d=t.headerInfo,h=d.numDims,m=t.headerInfo.height,g=t.headerInfo.width,p=g*m,x=this.readHuffmanTree(e,t),w=x.decodeLut,k=x.tree,y=x.stuffedData,I=x.srcPtr,b=x.bitPos,U=x.numBitsLUTQick,T=x.numBitsLUT,M=0===t.headerInfo.imageType?128:0,V=t.pixels.resultMask,v=0;b>0&&(I++,b=0);var A,B=y[I],D=1===t.encodeMode,S=new i(p*h),P=S;for(A=0;A<d.numDims;A++){if(h>1&&(P=new i(S.buffer,p*A,p),v=0),t.headerInfo.numValidPixel===g*m)for(u=0,o=0;o<m;o++)for(f=0;f<g;f++,u++){if(n=0,l=s=B<<b>>>32-U,32-b<U&&(l=s|=y[I+1]>>>64-b-U),w[l])n=w[l][1],b+=w[l][0];else for(l=s=B<<b>>>32-T,32-b<T&&(l=s|=y[I+1]>>>64-b-T),a=k,c=0;c<T;c++)if(!(a=s>>>T-c-1&1?a.right:a.left).left&&!a.right){n=a.val,b=b+c+1;break}b>=32&&(b-=32,B=y[++I]),r=n-M,D?(r+=f>0?v:o>0?P[u-g]:v,r&=255,P[u]=r,v=r):P[u]=r}else for(u=0,o=0;o<m;o++)for(f=0;f<g;f++,u++)if(V[u]){if(n=0,l=s=B<<b>>>32-U,32-b<U&&(l=s|=y[I+1]>>>64-b-U),w[l])n=w[l][1],b+=w[l][0];else for(l=s=B<<b>>>32-T,32-b<T&&(l=s|=y[I+1]>>>64-b-T),a=k,c=0;c<T;c++)if(!(a=s>>>T-c-1&1?a.right:a.left).left&&!a.right){n=a.val,b=b+c+1;break}b>=32&&(b-=32,B=y[++I]),r=n-M,D?(f>0&&V[u-1]?r+=v:o>0&&V[u-g]?r+=P[u-g]:r+=v,r&=255,P[u]=r,v=r):P[u]=r}t.ptr=t.ptr+4*(I+1)+(b>0?4:0)}t.pixels.resultPixels=S},decodeBits:function(e,t,i,a,n){var r=t.headerInfo,s=r.fileVersion,h=0,m=new DataView(e,t.ptr,5),g=m.getUint8(0);h++;var p=g>>6,x=0===p?4:3-p,w=(32&g)>0,k=31&g,y=0;if(1===x)y=m.getUint8(h),h++;else if(2===x)y=m.getUint16(h,!0),h+=2;else{if(4!==x)throw"Invalid valid pixel count type";y=m.getUint32(h,!0),h+=4}var I,b,U,T,M,V,v,A,B,D=2*r.maxZError,S=r.numDims>1?r.maxValues[n]:r.zMax;if(w){for(t.counter.lut++,A=m.getUint8(h),h++,T=Math.ceil((A-1)*k/8),M=Math.ceil(T/4),b=new ArrayBuffer(4*M),U=new Uint8Array(b),t.ptr+=h,U.set(new Uint8Array(e,t.ptr,T)),v=new Uint32Array(b),t.ptr+=T,B=0;A-1>>>B;)B++;T=Math.ceil(y*B/8),M=Math.ceil(T/4),b=new ArrayBuffer(4*M),(U=new Uint8Array(b)).set(new Uint8Array(e,t.ptr,T)),I=new Uint32Array(b),t.ptr+=T,V=s>=3?u(v,k,A-1,a,D,S):o(v,k,A-1,a,D,S),s>=3?f(I,i,B,y,V):l(I,i,B,y,V)}else t.counter.bitstuffer++,B=k,t.ptr+=h,B>0&&(T=Math.ceil(y*B/8),M=Math.ceil(T/4),b=new ArrayBuffer(4*M),(U=new Uint8Array(b)).set(new Uint8Array(e,t.ptr,T)),I=new Uint32Array(b),t.ptr+=T,s>=3?null==a?d(I,i,B,y):f(I,i,B,y,!1,a,D,S):null==a?c(I,i,B,y):l(I,i,B,y,!1,a,D,S))},readTiles:function(e,t,i){var a=t.headerInfo,n=a.width,r=a.height,s=a.microBlockSize,l=a.imageType,o=h.getDataTypeSize(l),f=Math.ceil(n/s),u=Math.ceil(r/s);t.pixels.numBlocksY=u,t.pixels.numBlocksX=f,t.pixels.ptr=0;var c,d,m,g,p,x,w,k,y=0,I=0,b=0,U=0,T=0,M=0,V=0,v=0,A=0,B=0,D=0,S=0,P=0,E=0,C=0,F=new i(s*s),N=r%s||s,O=n%s||s,R=a.numDims,L=t.pixels.resultMask,z=t.pixels.resultPixels;for(b=0;b<u;b++)for(T=b!==u-1?s:N,U=0;U<f;U++)for(B=b*n*s+U*s,D=n-(M=U!==f-1?s:O),k=0;k<R;k++){if(R>1&&(z=new i(t.pixels.resultPixels.buffer,n*r*k*o,n*r)),V=e.byteLength-t.ptr,d={},C=0,C++,A=(v=(c=new DataView(e,t.ptr,Math.min(10,V))).getUint8(0))>>6&255,(v>>2&15)!=(U*s>>3&15))throw"integrity issue";if((p=3&v)>3)throw t.ptr+=C,"Invalid block encoding ("+p+")";if(2!==p)if(0===p){if(t.counter.uncompressed++,t.ptr+=C,S=(S=T*M*o)<(P=e.byteLength-t.ptr)?S:P,m=new ArrayBuffer(S%o==0?S:S+o-S%o),new Uint8Array(m).set(new Uint8Array(e,t.ptr,S)),g=new i(m),E=0,L)for(y=0;y<T;y++){for(I=0;I<M;I++)L[B]&&(z[B]=g[E++]),B++;B+=D}else for(y=0;y<T;y++){for(I=0;I<M;I++)z[B++]=g[E++];B+=D}t.ptr+=E*o}else if(x=h.getDataTypeUsed(l,A),w=h.getOnePixel(d,C,x,c),C+=h.getDataTypeSize(x),3===p)if(t.ptr+=C,t.counter.constantoffset++,L)for(y=0;y<T;y++){for(I=0;I<M;I++)L[B]&&(z[B]=w),B++;B+=D}else for(y=0;y<T;y++){for(I=0;I<M;I++)z[B++]=w;B+=D}else if(t.ptr+=C,h.decodeBits(e,t,F,w,k),C=0,L)for(y=0;y<T;y++){for(I=0;I<M;I++)L[B]&&(z[B]=F[C++]),B++;B+=D}else for(y=0;y<T;y++){for(I=0;I<M;I++)z[B++]=F[C++];B+=D}else t.counter.constant++,t.ptr+=C}},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:h.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){var t=e.headerInfo.zMax,i=e.headerInfo.numDims,a=e.headerInfo.height*e.headerInfo.width,n=a*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*a,s=0;s<a;s++)o[s]&&(e.pixels.resultPixels[l+s]=t);else for(s=0;s<a;s++)o[s]&&(e.pixels.resultPixels[s]=t);else if(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);else for(s=0;s<n;s++)e.pixels.resultPixels[s]=t},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var i;switch(e){case 0:i=t>=-128&&t<=127;break;case 1:i=t>=0&&t<=255;break;case 2:i=t>=-32768&&t<=32767;break;case 3:i=t>=0&&t<=65536;break;case 4:i=t>=-2147483648&&t<=2147483647;break;case 5:i=t>=0&&t<=4294967296;break;case 6:i=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:i=t>=5e-324&&t<=17976931348623157e292;break;default:i=!1}return i},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var i=e;switch(e){case 2:case 4:i=e-t;break;case 3:case 5:i=e-2*t;break;case 6:i=0===t?e:1===t?2:1;break;case 7:i=0===t?e:e-2*t+1;break;default:i=e}return i},getOnePixel:function(e,t,i,a){var n=0;switch(i){case 0:n=a.getInt8(t);break;case 1:n=a.getUint8(t);break;case 2:n=a.getInt16(t,!0);break;case 3:n=a.getUint16(t,!0);break;case 4:n=a.getInt32(t,!0);break;case 5:n=a.getUInt32(t,!0);break;case 6:n=a.getFloat32(t,!0);break;case 7:n=a.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return n}},m=function(e,t,i){this.val=e,this.left=t,this.right=i},{decode:function(e,t){var i=(t=t||{}).noDataValue,a=0,n={};n.ptr=t.inputOffset||0,n.pixels={},h.readHeaderInfo(e,n);var r=n.headerInfo,s=r.fileVersion,l=h.getDataTypeArray(r.imageType);h.readMask(e,n),r.numValidPixel===r.width*r.height||n.pixels.resultMask||(n.pixels.resultMask=t.maskData);var o,f=r.width*r.height;if(n.pixels.resultPixels=new l(f*r.numDims),n.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==r.numValidPixel)if(r.zMax===r.zMin)h.constructConstantSurface(n);else if(s>=4&&h.checkMinMaxRanges(e,n))h.constructConstantSurface(n);else{var u=new DataView(e,n.ptr,2),c=u.getUint8(0);if(n.ptr++,c)h.readDataOneSweep(e,n,l);else if(s>1&&r.imageType<=1&&Math.abs(r.maxZError-.5)<1e-5){var d=u.getUint8(1);if(n.ptr++,n.encodeMode=d,d>2||s<4&&d>1)throw"Invalid Huffman flag "+d;d?h.readHuffman(e,n,l):h.readTiles(e,n,l)}else h.readTiles(e,n,l)}n.eofOffset=n.ptr,t.inputOffset?(o=n.headerInfo.blobSize+t.inputOffset-n.ptr,Math.abs(o)>=1&&(n.eofOffset=t.inputOffset+n.headerInfo.blobSize)):(o=n.headerInfo.blobSize-n.ptr,Math.abs(o)>=1&&(n.eofOffset=n.headerInfo.blobSize));var m={width:r.width,height:r.height,pixelData:n.pixels.resultPixels,minValue:r.zMin,maxValue:r.zMax,validPixelCount:r.numValidPixel,dimCount:r.numDims,dimStats:{minValues:r.minValues,maxValues:r.maxValues},maskData:n.pixels.resultMask};if(n.pixels.resultMask&&h.isValidPixelValue(r.imageType,i)){var g=n.pixels.resultMask;for(a=0;a<f;a++)g[a]||(m.pixelData[a]=i);m.noDataValue=i}return n.noDataValue=i,t.returnFileInfo&&(m.fileInfo=h.formatFileInfo(n)),m},getBandCount:function(e){for(var t=0,i=0,a={ptr:0,pixels:{}};i<e.byteLength-58;)h.readHeaderInfo(e,a),i+=a.headerInfo.blobSize,t++,a.ptr=i;return t}}),k=(g=new ArrayBuffer(4),p=new Uint8Array(g),new Uint32Array(g)[0]=1,1===p[0]),y={decode:function(e,t){if(!k)throw"Big endian system is not supported.";var i,a,n=(t=t||{}).inputOffset||0,r=new Uint8Array(e,n,10),s=String.fromCharCode.apply(null,r);if("CntZImage"===s.trim())i=x,a=1;else{if("Lerc2"!==s.substring(0,5))throw"Unexpected file identifier string: "+s;i=w,a=2}for(var l,o,f,u,c,d,h=0,m=e.byteLength-10,g=[],p={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]};n<m;){var y=i.decode(e,{inputOffset:n,encodedMaskData:l,maskData:f,returnMask:0===h,returnEncodedMask:0===h,returnFileInfo:!0,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});n=y.fileInfo.eofOffset,0===h&&(l=y.encodedMaskData,f=y.maskData,p.width=y.width,p.height=y.height,p.dimCount=y.dimCount||1,p.pixelType=y.pixelType||y.fileInfo.pixelType,p.mask=y.maskData),a>1&&y.fileInfo.mask&&y.fileInfo.mask.numBytes>0&&g.push(y.maskData),h++,p.pixels.push(y.pixelData),p.statistics.push({minValue:y.minValue,maxValue:y.maxValue,noDataValue:y.noDataValue,dimStats:y.dimStats})}if(a>1&&g.length>1){for(d=p.width*p.height,p.bandMasks=g,(f=new Uint8Array(d)).set(g[0]),u=1;u<g.length;u++)for(o=g[u],c=0;c<d;c++)f[c]=f[c]&o[c];p.maskData=f}return p}};e.exports?e.exports=y:this.Lerc=y}()}));return u((function(t,i){if(t.encoding===x.LERC){let e;try{e=U.decode(t.heightmap)}catch(e){throw new n.RuntimeError(e)}if(e.statistics[0].minValue===Number.MAX_VALUE)throw new n.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);const a=w.computeVertices(t),r=a.vertices;return i.push(r.buffer),{vertices:r.buffer,numberOfAttributes:a.encoding.stride,minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight,gridWidth:t.width,gridHeight:t.height,boundingSphere3D:a.boundingSphere3D,orientedBoundingBox:a.orientedBoundingBox,occludeePointInScaledSpace:a.occludeePointInScaledSpace,encoding:a.encoding,westIndicesSouthToNorth:a.westIndicesSouthToNorth,southIndicesEastToWest:a.southIndicesEastToWest,eastIndicesNorthToSouth:a.eastIndicesNorthToSouth,northIndicesWestToEast:a.northIndicesWestToEast}}))}));
25
+ import{a as ar,c as sr}from"./chunk-PYMQNHFO.js";import{a as ir}from"./chunk-BKIYVF74.js";import{a as xe}from"./chunk-LN2UT4R3.js";import{a as nr}from"./chunk-P5EFSOUF.js";import"./chunk-G72JFEXW.js";import"./chunk-BDWA46XV.js";import{a as tr}from"./chunk-5VFNV3LW.js";import"./chunk-SRA5MBUT.js";import"./chunk-5AAMOBJK.js";import{c as rr}from"./chunk-D3TVNJ6W.js";import"./chunk-3VUCSHGU.js";import{i as er,j as ne}from"./chunk-LNJEJFV5.js";import{b as Ie}from"./chunk-BPABSUDY.js";import"./chunk-ATKJRN2G.js";import"./chunk-RDX4QSUS.js";import{a as Re}from"./chunk-G3GDHHWO.js";import{b as Pe,c as pe}from"./chunk-2AIOP76V.js";import{a as re}from"./chunk-IAE6APK2.js";import{a as he}from"./chunk-3E7FIXV7.js";import{a as me}from"./chunk-NZBME2JK.js";import{c as Ir,d as xr,f as W}from"./chunk-6DLS2UKD.js";var ur=Ir(((e,t)=>{/* 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(){var e,r,i,a,n,s,l=(e={defaultNoDataValue:-34027999387901484e22,decode:function(t,s){var l=(s=s||{}).encodedMaskData||null===s.encodedMaskData,o=n(t,s.inputOffset||0,l),f=null!==s.noDataValue?s.noDataValue:e.defaultNoDataValue,u=r(o,s.pixelType||Float32Array,s.encodedMaskData,f,s.returnMask),h={width:o.width,height:o.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:o.pixels.maxValue,noDataValue:f};return u.resultMask&&(h.maskData=u.resultMask),s.returnEncodedMask&&o.mask&&(h.encodedMaskData=o.mask.bitset?o.mask.bitset:null),s.returnFileInfo&&(h.fileInfo=i(o),s.computeUsedBitDepths&&(h.fileInfo.bitDepths=a(o))),h}},r=function(e,t,r,i,a){var n,l,o,f=0,u=e.pixels.numBlocksX,h=e.pixels.numBlocksY,c=Math.floor(e.width/u),m=Math.floor(e.height/h),d=2*e.maxZError,g=Number.MAX_VALUE;r=r||(e.mask?e.mask.bitset:null),l=new t(e.width*e.height),a&&r&&(o=new Uint8Array(e.width*e.height));for(var p,w,k=new Float32Array(c*m),x=0;x<=h;x++){var y=x!==h?m:e.height%h;if(0!==y)for(var I=0;I<=u;I++){var U=I!==u?c:e.width%u;if(0!==U){var b,v,T,A,V=x*e.width*m+I*c,M=e.width-U,D=e.pixels.blocks[f];if(D.encoding<2?(0===D.encoding?b=D.rawData:(s(D.stuffedData,D.bitsPerPixel,D.numValidPixels,D.offset,d,k,e.pixels.maxValue),b=k),v=0):T=2===D.encoding?0:D.offset,r)for(w=0;w<y;w++){for(7&V&&(A=r[V>>3],A<<=7&V),p=0;p<U;p++)7&V||(A=r[V>>3]),128&A?(o&&(o[V]=1),g=g>(n=D.encoding<2?b[v++]:T)?n:g,l[V++]=n):(o&&(o[V]=0),l[V++]=i),A<<=1;V+=M}else if(D.encoding<2)for(w=0;w<y;w++){for(p=0;p<U;p++)g=g>(n=b[v++])?n:g,l[V++]=n;V+=M}else for(g=g>T?T:g,w=0;w<y;w++){for(p=0;p<U;p++)l[V++]=T;V+=M}if(1===D.encoding&&v!==D.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}}},a=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,r={},i=0;i<t;i++){var a=e.pixels.blocks[i];0===a.encoding?r.float32=!0:1===a.encoding?r[a.bitsPerPixel]=!0:r[0]=!0}return Object.keys(r)},n=function(e,t,r){var i={},a=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,a),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var n=new DataView(e,t,24);if(i.fileVersion=n.getInt32(0,!0),i.imageType=n.getInt32(4,!0),i.height=n.getUint32(8,!0),i.width=n.getUint32(12,!0),i.maxZError=n.getFloat64(16,!0),t+=24,!r)if(n=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=n.getUint32(0,!0),i.mask.numBlocksX=n.getUint32(4,!0),i.mask.numBytes=n.getUint32(8,!0),i.mask.maxValue=n.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var s=new Uint8Array(Math.ceil(i.width*i.height/8)),l=(n=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(l>0)for(;l--;)s[f++]=n.getUint8(o++);else{var u=n.getUint8(o++);for(l=-l;l--;)s[f++]=u}l=n.getInt16(o,!0),o+=2}while(o<i.mask.numBytes);if(-32768!==l||f<s.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=s,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));n=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=n.getUint32(0,!0),i.pixels.numBlocksX=n.getUint32(4,!0),i.pixels.numBytes=n.getUint32(8,!0),i.pixels.maxValue=n.getFloat32(12,!0),t+=16;var h=i.pixels.numBlocksX,c=i.pixels.numBlocksY,m=h+(i.width%h>0?1:0),d=c+(i.height%c>0?1:0);i.pixels.blocks=new Array(m*d);for(var g=0,p=0;p<d;p++)for(var w=0;w<m;w++){var k=0,x=e.byteLength-t;n=new DataView(e,t,Math.min(10,x));var y={};i.pixels.blocks[g++]=y;var I=n.getUint8(0);if(k++,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=n.getInt8(1),k++;else if(1===I)y.offset=n.getInt16(1,!0),k+=2;else{if(0!==I)throw"Invalid block offset type";y.offset=n.getFloat32(1,!0),k+=4}if(1===y.encoding)if(I=n.getUint8(k),k++,y.bitsPerPixel=63&I,I>>=6,y.numValidPixelsType=I,2===I)y.numValidPixels=n.getUint8(k),k++;else if(1===I)y.numValidPixels=n.getUint16(k,!0),k+=2;else{if(0!==I)throw"Invalid valid pixel count type";y.numValidPixels=n.getUint32(k,!0),k+=4}}var U;if(t+=k,3!==y.encoding)if(0===y.encoding){var b=(i.pixels.numBytes-1)/4;if(b!==Math.floor(b))throw"uncompressed block has invalid length";U=new ArrayBuffer(4*b),new Uint8Array(U).set(new Uint8Array(e,t,4*b));var v=new Float32Array(U);y.rawData=v,t+=4*b}else if(1===y.encoding){var T=Math.ceil(y.numValidPixels*y.bitsPerPixel/8),A=Math.ceil(T/4);U=new ArrayBuffer(4*A),new Uint8Array(U).set(new Uint8Array(e,t,T)),y.stuffedData=new Uint32Array(U),t+=T}}else t++}return i.eofOffset=t,i},s=function(e,t,r,i,a,n,s){var l,o,f,u=(1<<t)-1,h=0,c=0,m=Math.ceil((s-i)/a),d=4*e.length-Math.ceil(t*r/8);for(e[e.length-1]<<=8*d,l=0;l<r;l++){if(0===c&&(f=e[h++],c=32),c>=t)o=f>>>c-t&u,c-=t;else{var g=t-c;o=(f&u)<<g&u,o+=(f=e[h++])>>>(c=32-g)}n[l]=o<m?i+o*a:s}return n},e),o=function(){"use strict";var e=function(e,t,r,i,a,n,s,l){var o,f,u,h,c,m=(1<<r)-1,d=0,g=0,p=4*e.length-Math.ceil(r*i/8);if(e[e.length-1]<<=8*p,a)for(o=0;o<i;o++)0===g&&(u=e[d++],g=32),g>=r?(f=u>>>g-r&m,g-=r):(f=(u&m)<<(h=r-g)&m,f+=(u=e[d++])>>>(g=32-h)),t[o]=a[f];else for(c=Math.ceil((l-n)/s),o=0;o<i;o++)0===g&&(u=e[d++],g=32),g>=r?(f=u>>>g-r&m,g-=r):(f=(u&m)<<(h=r-g)&m,f+=(u=e[d++])>>>(g=32-h)),t[o]=f<c?n+f*s:l},t=function(e,t,r,i,a,n){var s,l=(1<<t)-1,o=0,f=0,u=0,h=0,c=0,m=[],d=4*e.length-Math.ceil(t*r/8);e[e.length-1]<<=8*d;var g=Math.ceil((n-i)/a);for(f=0;f<r;f++)0===h&&(s=e[o++],h=32),h>=t?(c=s>>>h-t&l,h-=t):(c=(s&l)<<(u=t-h)&l,c+=(s=e[o++])>>>(h=32-u)),m[f]=c<g?i+c*a:n;return m.unshift(i),m},r=function(e,t,r,i,a,n,s,l){var o,f,u,h,c=(1<<r)-1,m=0,d=0,g=0;if(a)for(o=0;o<i;o++)0===d&&(u=e[m++],d=32,g=0),d>=r?(f=u>>>g&c,d-=r,g+=r):(f=u>>>g&c,d=32-(h=r-d),f|=((u=e[m++])&(1<<h)-1)<<r-h,g=h),t[o]=a[f];else{var p=Math.ceil((l-n)/s);for(o=0;o<i;o++)0===d&&(u=e[m++],d=32,g=0),d>=r?(f=u>>>g&c,d-=r,g+=r):(f=u>>>g&c,d=32-(h=r-d),f|=((u=e[m++])&(1<<h)-1)<<r-h,g=h),t[o]=f<p?n+f*s:l}return t},i=function(e,t,r,i,a,n){var s,l=(1<<t)-1,o=0,f=0,u=0,h=0,c=0,m=0,d=[],g=Math.ceil((n-i)/a);for(f=0;f<r;f++)0===h&&(s=e[o++],h=32,m=0),h>=t?(c=s>>>m&l,h-=t,m+=t):(c=s>>>m&l,h=32-(u=t-h),c|=((s=e[o++])&(1<<u)-1)<<t-u,m=u),d[f]=c<g?i+c*a:n;return d.unshift(i),d},a=function(e,t,r,i){var a,n,s,l,o=(1<<r)-1,f=0,u=0,h=4*e.length-Math.ceil(r*i/8);for(e[e.length-1]<<=8*h,a=0;a<i;a++)0===u&&(s=e[f++],u=32),u>=r?(n=s>>>u-r&o,u-=r):(n=(s&o)<<(l=r-u)&o,n+=(s=e[f++])>>>(u=32-l)),t[a]=n;return t},n=function(e,t,r,i){var a,n,s,l,o=(1<<r)-1,f=0,u=0,h=0;for(a=0;a<i;a++)0===u&&(s=e[f++],u=32,h=0),u>=r?(n=s>>>h&o,u-=r,h+=r):(n=s>>>h&o,u=32-(l=r-u),n|=((s=e[f++])&(1<<l)-1)<<r-l,h=l),t[a]=n;return t},s={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,r=65535,i=e.length,a=Math.floor(i/2),n=0;a;){var s=a>=359?359:a;a-=s;do{t+=e[n++]<<8,r+=t+=e[n++]}while(--s);t=(65535&t)+(t>>>16),r=(65535&r)+(r>>>16)}return 1&i&&(r+=t+=e[n]<<8),((r=(65535&r)+(r>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var r=t.ptr,i=new Uint8Array(e,r,6),a={};if(a.fileIdentifierString=String.fromCharCode.apply(null,i),0!==a.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+a.fileIdentifierString;r+=6;var n,s=new DataView(e,r,8),l=s.getInt32(0,!0);if(a.fileVersion=l,r+=4,l>=3&&(a.checksum=s.getUint32(4,!0),r+=4),s=new DataView(e,r,12),a.height=s.getUint32(0,!0),a.width=s.getUint32(4,!0),r+=8,l>=4?(a.numDims=s.getUint32(8,!0),r+=4):a.numDims=1,s=new DataView(e,r,40),a.numValidPixel=s.getUint32(0,!0),a.microBlockSize=s.getInt32(4,!0),a.blobSize=s.getInt32(8,!0),a.imageType=s.getInt32(12,!0),a.maxZError=s.getFloat64(16,!0),a.zMin=s.getFloat64(24,!0),a.zMax=s.getFloat64(32,!0),r+=40,t.headerInfo=a,t.ptr=r,l>=3&&(n=l>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,r-n,a.blobSize-14))!==a.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var r=t.headerInfo,i=this.getDataTypeArray(r.imageType),a=r.numDims*this.getDataTypeSize(r.imageType),n=this.readSubArray(e,t.ptr,i,a),s=this.readSubArray(e,t.ptr+a,i,a);t.ptr+=2*a;var l,o=!0;for(l=0;l<r.numDims;l++)if(n[l]!==s[l]){o=!1;break}return r.minValues=n,r.maxValues=s,o},readSubArray:function(e,t,r,i){var a;if(r===Uint8Array)a=new Uint8Array(e,t,i);else{var n=new ArrayBuffer(i);new Uint8Array(n).set(new Uint8Array(e,t,i)),a=new r(n)}return a},readMask:function(e,t){var r,i,a=t.ptr,n=t.headerInfo,s=n.width*n.height,l=n.numValidPixel,o=new DataView(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)r=new Uint8Array(Math.ceil(s/8)),f.bitset=r,i=new Uint8Array(s),t.pixels.resultMask=i,a+=f.numBytes;else if(f.numBytes>0){r=new Uint8Array(Math.ceil(s/8));var u=(o=new DataView(e,a,f.numBytes)).getInt16(0,!0),h=2,c=0,m=0;do{if(u>0)for(;u--;)r[c++]=o.getUint8(h++);else for(m=o.getUint8(h++),u=-u;u--;)r[c++]=m;u=o.getInt16(h,!0),h+=2}while(h<f.numBytes);if(-32768!==u||c<r.length)throw"Unexpected end of mask RLE encoding";i=new Uint8Array(s);var d=0,g=0;for(g=0;g<s;g++)7&g?(d=r[g>>3],d<<=7&g):d=r[g>>3],128&d&&(i[g]=1);t.pixels.resultMask=i,f.bitset=r,a+=f.numBytes}return t.ptr=a,t.mask=f,!0},readDataOneSweep:function(e,t,r){var i,a=t.ptr,n=t.headerInfo,l=n.numDims,o=n.width*n.height,f=n.imageType,u=n.numValidPixel*s.getDataTypeSize(f)*l,h=t.pixels.resultMask;if(r===Uint8Array)i=new Uint8Array(e,a,u);else{var c=new ArrayBuffer(u);new Uint8Array(c).set(new Uint8Array(e,a,u)),i=new r(c)}if(i.length===o*l)t.pixels.resultPixels=i;else{t.pixels.resultPixels=new r(o*l);var m=0,d=0,g=0,p=0;if(l>1)for(g=0;g<l;g++)for(p=g*o,d=0;d<o;d++)h[d]&&(t.pixels.resultPixels[p+d]=i[m++]);else for(d=0;d<o;d++)h[d]&&(t.pixels.resultPixels[d]=i[m++])}return a+=u,t.ptr=a,!0},readHuffmanTree:function(e,t){var r=this.HUFFMAN_LUT_BITS_MAX,i=new DataView(e,t.ptr,16);if(t.ptr+=16,i.getInt32(0,!0)<2)throw"unsupported Huffman version";var a=i.getInt32(4,!0),n=i.getInt32(8,!0),o=i.getInt32(12,!0);if(n>=o)return!1;var f=new Uint32Array(o-n);s.decodeBits(e,t,f);var u,h,c,m,d=[];for(u=n;u<o;u++)d[h=u-(u<a?0:a)]={first:f[u-n],second:null};var g=e.byteLength-t.ptr,p=Math.ceil(g/4),w=new ArrayBuffer(4*p);new Uint8Array(w).set(new Uint8Array(e,t.ptr,g));var k,x=new Uint32Array(w),y=0,I=0;for(k=x[0],u=n;u<o;u++)(m=d[h=u-(u<a?0:a)].first)>0&&(d[h].second=k<<y>>>32-m,32-y>=m?32===(y+=m)&&(y=0,k=x[++I]):(y+=m-32,k=x[++I],d[h].second|=k>>>32-y));var U=0,b=0,v=new l;for(u=0;u<d.length;u++)void 0!==d[u]&&(U=Math.max(U,d[u].first));b=U>=r?r:U,U>=30&&console.log("WARning, large NUM LUT BITS IS "+U);var T,A,V,M,D,B=[];for(u=n;u<o;u++)if((m=d[h=u-(u<a?0:a)].first)>0)if(T=[m,h],m<=b)for(A=d[h].second<<b-m,V=1<<b-m,c=0;c<V;c++)B[A|c]=T;else for(A=d[h].second,D=v,M=m-1;M>=0;M--)A>>>M&1?(D.right||(D.right=new l),D=D.right):(D.left||(D.left=new l),D=D.left),0===M&&!D.val&&(D.val=T[1]);return{decodeLut:B,numBitsLUTQick:b,numBitsLUT:U,tree:v,stuffedData:x,srcPtr:I,bitPos:y}},readHuffman:function(e,t,r){var i,a,n,s,l,o,f,u,h,c=t.headerInfo,m=c.numDims,d=t.headerInfo.height,g=t.headerInfo.width,p=g*d,w=this.readHuffmanTree(e,t),k=w.decodeLut,x=w.tree,y=w.stuffedData,I=w.srcPtr,U=w.bitPos,b=w.numBitsLUTQick,v=w.numBitsLUT,T=0===t.headerInfo.imageType?128:0,A=t.pixels.resultMask,V=0;U>0&&(I++,U=0);var M,D=y[I],B=1===t.encodeMode,S=new r(p*m),P=S;for(M=0;M<c.numDims;M++){if(m>1&&(P=new r(S.buffer,p*M,p),V=0),t.headerInfo.numValidPixel===g*d)for(u=0,o=0;o<d;o++)for(f=0;f<g;f++,u++){if(a=0,l=s=D<<U>>>32-b,32-U<b&&(l=s|=y[I+1]>>>64-U-b),k[l])a=k[l][1],U+=k[l][0];else for(l=s=D<<U>>>32-v,32-U<v&&(l=s|=y[I+1]>>>64-U-v),i=x,h=0;h<v;h++)if(!(i=s>>>v-h-1&1?i.right:i.left).left&&!i.right){a=i.val,U=U+h+1;break}U>=32&&(U-=32,D=y[++I]),n=a-T,B?(n+=f>0?V:o>0?P[u-g]:V,n&=255,P[u]=n,V=n):P[u]=n}else for(u=0,o=0;o<d;o++)for(f=0;f<g;f++,u++)if(A[u]){if(a=0,l=s=D<<U>>>32-b,32-U<b&&(l=s|=y[I+1]>>>64-U-b),k[l])a=k[l][1],U+=k[l][0];else for(l=s=D<<U>>>32-v,32-U<v&&(l=s|=y[I+1]>>>64-U-v),i=x,h=0;h<v;h++)if(!(i=s>>>v-h-1&1?i.right:i.left).left&&!i.right){a=i.val,U=U+h+1;break}U>=32&&(U-=32,D=y[++I]),n=a-T,B?(f>0&&A[u-1]?n+=V:o>0&&A[u-g]?n+=P[u-g]:n+=V,n&=255,P[u]=n,V=n):P[u]=n}t.ptr=t.ptr+4*(I+1)+(U>0?4:0)}t.pixels.resultPixels=S},decodeBits:function(s,l,o,f,u){var h=l.headerInfo,c=h.fileVersion,m=0,d=new DataView(s,l.ptr,5),g=d.getUint8(0);m++;var p=g>>6,w=0===p?4:3-p,k=(32&g)>0,x=31&g,y=0;if(1===w)y=d.getUint8(m),m++;else if(2===w)y=d.getUint16(m,!0),m+=2;else{if(4!==w)throw"Invalid valid pixel count type";y=d.getUint32(m,!0),m+=4}var I,U,b,v,T,A,V,M,D,B=2*h.maxZError,S=h.numDims>1?h.maxValues[u]:h.zMax;if(k){for(l.counter.lut++,M=d.getUint8(m),x,m++,v=Math.ceil((M-1)*x/8),T=Math.ceil(v/4),U=new ArrayBuffer(4*T),b=new Uint8Array(U),l.ptr+=m,b.set(new Uint8Array(s,l.ptr,v)),V=new Uint32Array(U),l.ptr+=v,D=0;M-1>>>D;)D++;v=Math.ceil(y*D/8),T=Math.ceil(v/4),U=new ArrayBuffer(4*T),(b=new Uint8Array(U)).set(new Uint8Array(s,l.ptr,v)),I=new Uint32Array(U),l.ptr+=v,A=c>=3?i(V,x,M-1,f,B,S):t(V,x,M-1,f,B,S),c>=3?r(I,o,D,y,A):e(I,o,D,y,A)}else l.counter.bitstuffer++,D=x,l.ptr+=m,D>0&&(v=Math.ceil(y*D/8),T=Math.ceil(v/4),U=new ArrayBuffer(4*T),(b=new Uint8Array(U)).set(new Uint8Array(s,l.ptr,v)),I=new Uint32Array(U),l.ptr+=v,c>=3?null==f?n(I,o,D,y):r(I,o,D,y,!1,f,B,S):null==f?a(I,o,D,y):e(I,o,D,y,!1,f,B,S))},readTiles:function(e,t,r){var i=t.headerInfo,a=i.width,n=i.height,l=i.microBlockSize,o=i.imageType,f=s.getDataTypeSize(o),u=Math.ceil(a/l),h=Math.ceil(n/l);t.pixels.numBlocksY=h,t.pixels.numBlocksX=u,t.pixels.ptr=0;var c,m,d,g,p,w,k,x,y=0,I=0,U=0,b=0,v=0,T=0,A=0,V=0,M=0,D=0,B=0,S=0,P=0,E=0,F=0,N=new r(l*l),O=n%l||l,L=a%l||l,R=i.numDims,z=t.pixels.resultMask,H=t.pixels.resultPixels;for(U=0;U<h;U++)for(v=U!==h-1?l:O,b=0;b<u;b++)for(D=U*a*l+b*l,B=a-(T=b!==u-1?l:L),x=0;x<R;x++){if(R>1&&(H=new r(t.pixels.resultPixels.buffer,a*n*x*f,a*n)),A=e.byteLength-t.ptr,m={},F=0,F++,M=(V=(c=new DataView(e,t.ptr,Math.min(10,A))).getUint8(0))>>6&255,(V>>2&15)!==(b*l>>3&15))throw"integrity issue";if((p=3&V)>3)throw t.ptr+=F,"Invalid block encoding ("+p+")";if(2!==p)if(0===p){if(t.counter.uncompressed++,t.ptr+=F,S=(S=v*T*f)<(P=e.byteLength-t.ptr)?S:P,d=new ArrayBuffer(S%f==0?S:S+f-S%f),new Uint8Array(d).set(new Uint8Array(e,t.ptr,S)),g=new r(d),E=0,z)for(y=0;y<v;y++){for(I=0;I<T;I++)z[D]&&(H[D]=g[E++]),D++;D+=B}else for(y=0;y<v;y++){for(I=0;I<T;I++)H[D++]=g[E++];D+=B}t.ptr+=E*f}else if(w=s.getDataTypeUsed(o,M),k=s.getOnePixel(m,F,w,c),F+=s.getDataTypeSize(w),3===p)if(t.ptr+=F,t.counter.constantoffset++,z)for(y=0;y<v;y++){for(I=0;I<T;I++)z[D]&&(H[D]=k),D++;D+=B}else for(y=0;y<v;y++){for(I=0;I<T;I++)H[D++]=k;D+=B}else if(t.ptr+=F,s.decodeBits(e,t,N,k,x),F=0,z)for(y=0;y<v;y++){for(I=0;I<T;I++)z[D]&&(H[D]=N[F++]),D++;D+=B}else for(y=0;y<v;y++){for(I=0;I<T;I++)H[D++]=N[F++];D+=B}else t.counter.constant++,t.ptr+=F}},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:s.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){var t=e.headerInfo.zMax,r=e.headerInfo.numDims,i=e.headerInfo.height*e.headerInfo.width,a=i*r,n=0,s=0,l=0,o=e.pixels.resultMask;if(o)if(r>1)for(n=0;n<r;n++)for(l=n*i,s=0;s<i;s++)o[s]&&(e.pixels.resultPixels[l+s]=t);else for(s=0;s<i;s++)o[s]&&(e.pixels.resultPixels[s]=t);else if(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);else for(s=0;s<a;s++)e.pixels.resultPixels[s]=t},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var r;switch(e){case 0:r=t>=-128&&t<=127;break;case 1:r=t>=0&&t<=255;break;case 2:r=t>=-32768&&t<=32767;break;case 3:r=t>=0&&t<=65536;break;case 4:r=t>=-2147483648&&t<=2147483647;break;case 5:r=t>=0&&t<=4294967296;break;case 6:r=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:r=t>=5e-324&&t<=17976931348623157e292;break;default:r=!1}return r},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var r=e;switch(e){case 2:case 4:r=e-t;break;case 3:case 5:r=e-2*t;break;case 6:r=0===t?e:1===t?2:1;break;case 7:r=0===t?e:e-2*t+1;break;default:r=e}return r},getOnePixel:function(e,t,r,i){var a=0;switch(r){case 0:a=i.getInt8(t);break;case 1:a=i.getUint8(t);break;case 2:a=i.getInt16(t,!0);break;case 3:a=i.getUint16(t,!0);break;case 4:a=i.getInt32(t,!0);break;case 5:a=i.getUInt32(t,!0);break;case 6:a=i.getFloat32(t,!0);break;case 7:a=i.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return a}},l=function(e,t,r){this.val=e,this.left=t,this.right=r},o={decode:function(e,t){var r=(t=t||{}).noDataValue,i=0,a={};if(a.ptr=t.inputOffset||0,a.pixels={},s.readHeaderInfo(e,a)){var n=a.headerInfo,l=n.fileVersion,o=s.getDataTypeArray(n.imageType);s.readMask(e,a),n.numValidPixel!==n.width*n.height&&!a.pixels.resultMask&&(a.pixels.resultMask=t.maskData);var f,u=n.width*n.height;if(a.pixels.resultPixels=new o(u*n.numDims),a.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==n.numValidPixel)if(n.zMax===n.zMin)s.constructConstantSurface(a);else if(l>=4&&s.checkMinMaxRanges(e,a))s.constructConstantSurface(a);else{var h=new DataView(e,a.ptr,2),c=h.getUint8(0);if(a.ptr++,c)s.readDataOneSweep(e,a,o);else if(l>1&&n.imageType<=1&&Math.abs(n.maxZError-.5)<1e-5){var m=h.getUint8(1);if(a.ptr++,a.encodeMode=m,m>2||l<4&&m>1)throw"Invalid Huffman flag "+m;m?s.readHuffman(e,a,o):s.readTiles(e,a,o)}else s.readTiles(e,a,o)}a.eofOffset=a.ptr,t.inputOffset?(f=a.headerInfo.blobSize+t.inputOffset-a.ptr,Math.abs(f)>=1&&(a.eofOffset=t.inputOffset+a.headerInfo.blobSize)):(f=a.headerInfo.blobSize-a.ptr,Math.abs(f)>=1&&(a.eofOffset=a.headerInfo.blobSize));var d={width:n.width,height:n.height,pixelData:a.pixels.resultPixels,minValue:n.zMin,maxValue:n.zMax,validPixelCount:n.numValidPixel,dimCount:n.numDims,dimStats:{minValues:n.minValues,maxValues:n.maxValues},maskData:a.pixels.resultMask};if(a.pixels.resultMask&&s.isValidPixelValue(n.imageType,r)){var g=a.pixels.resultMask;for(i=0;i<u;i++)g[i]||(d.pixelData[i]=r);d.noDataValue=r}return a.noDataValue=r,t.returnFileInfo&&(d.fileInfo=s.formatFileInfo(a)),d}},getBandCount:function(e){for(var t=0,r=0,i={ptr:0,pixels:{}};r<e.byteLength-58;)s.readHeaderInfo(e,i),r+=i.headerInfo.blobSize,t++,i.ptr=r;return t}};return o}(),f=function(){var e=new ArrayBuffer(4),t=new Uint8Array(e);return new Uint32Array(e)[0]=1,1===t[0]}(),u={decode:function(e,t){if(!f)throw"Big endian system is not supported.";var r,i,a,n,s,u=(t=t||{}).inputOffset||0,h=new Uint8Array(e,u,10),c=String.fromCharCode.apply(null,h);if("CntZImage"===c.trim())r=l,i=1;else{if("Lerc2"!==c.substring(0,5))throw"Unexpected file identifier string: "+c;r=o,i=2}for(var m,d,g,p=0,w=e.byteLength-10,k=[],x={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]};u<w;){var y=r.decode(e,{inputOffset:u,encodedMaskData:m,maskData:g,returnMask:0===p,returnEncodedMask:0===p,returnFileInfo:!0,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});u=y.fileInfo.eofOffset,0===p&&(m=y.encodedMaskData,g=y.maskData,x.width=y.width,x.height=y.height,x.dimCount=y.dimCount||1,x.pixelType=y.pixelType||y.fileInfo.pixelType,x.mask=y.maskData),i>1&&y.fileInfo.mask&&y.fileInfo.mask.numBytes>0&&k.push(y.maskData),p++,x.pixels.push(y.pixelData),x.statistics.push({minValue:y.minValue,maxValue:y.maxValue,noDataValue:y.noDataValue,dimStats:y.dimStats})}if(i>1&&k.length>1){for(s=x.width*x.height,x.bandMasks=k,(g=new Uint8Array(s)).set(k[0]),a=1;a<k.length;a++)for(d=k[a],n=0;n<s;n++)g[n]=g[n]&d[n];x.maskData=g}return x}};"function"==typeof define&&define.amd?define([],(function(){return u})):typeof t<"u"&&t.exports?t.exports=u:this.Lerc=u}()})),fr={NONE:0,LERC:1};Object.freeze(fr);var or=fr,G={};G.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var He=new re,Ur=new Ie,Tr=new re,kr=new re;G.computeVertices=function(e){if(!W(e)||!W(e.heightmap))throw new me("options.heightmap is required.");if(!W(e.width)||!W(e.height))throw new me("options.width and options.height are required.");if(!W(e.nativeRectangle))throw new me("options.nativeRectangle is required.");if(!W(e.skirtHeight))throw new me("options.skirtHeight is required.");let t,r,i,a,n=Math.cos,s=Math.sin,l=Math.sqrt,o=Math.atan,f=Math.exp,u=he.PI_OVER_TWO,h=he.toRadians,c=e.heightmap,m=e.width,d=e.height,g=e.skirtHeight,p=g>0,w=e.isGeographic??!0,k=e.ellipsoid??pe.default,x=1/k.maximumRadius,y=ne.clone(e.nativeRectangle),I=ne.clone(e.rectangle);W(I)?(t=I.west,r=I.south,i=I.east,a=I.north):w?(t=h(y.west),r=h(y.south),i=h(y.east),a=h(y.north)):(t=y.west*x,r=u-2*o(f(-y.south*x)),i=y.east*x,a=u-2*o(f(-y.north*x)));let U=e.relativeToCenter,b=W(U);U=b?U:re.ZERO;let v=e.includeWebMercatorT??!1,T=e.exaggeration??1,A=e.exaggerationRelativeHeight??0,V=1!==T,M=e.structure??G.DEFAULT_STRUCTURE,D=M.heightScale??G.DEFAULT_STRUCTURE.heightScale,B=M.heightOffset??G.DEFAULT_STRUCTURE.heightOffset,S=M.elementsPerHeight??G.DEFAULT_STRUCTURE.elementsPerHeight,P=M.stride??G.DEFAULT_STRUCTURE.stride,E=M.elementMultiplier??G.DEFAULT_STRUCTURE.elementMultiplier,F=M.isBigEndian??G.DEFAULT_STRUCTURE.isBigEndian,N=ne.computeWidth(y),O=ne.computeHeight(y),L=N/(m-1),R=O/(d-1);w||(N*=x,O*=x);let z,H,C=k.radiiSquared,j=C.x,_=C.y,Y=C.z,X=65536,Z=-65536,K=er.eastNorthUpToFixedFrame(U,k),J=Ie.inverseTransformation(K,Ur);v&&(z=xe.geodeticLatitudeToMercatorAngle(r),H=1/(xe.geodeticLatitudeToMercatorAngle(a)-z));let q=Tr;q.x=Number.POSITIVE_INFINITY,q.y=Number.POSITIVE_INFINITY,q.z=Number.POSITIVE_INFINITY;let Q=kr;Q.x=Number.NEGATIVE_INFINITY,Q.y=Number.NEGATIVE_INFINITY,Q.z=Number.NEGATIVE_INFINITY;let $=Number.POSITIVE_INFINITY,ee=m*d,te=ee+(g>0?2*m+2*d:0),ie=new Array(te),ae=new Array(te),se=new Array(te),le=v?new Array(te):[],oe=V?new Array(te):[],fe=0,ue=d,ce=0,de=m;p&&(--fe,++ue,--ce,++de);let ge=1e-5;for(let e=fe;e<ue;++e){let p=e;p<0&&(p=0),p>=d&&(p=d-1);let I=y.north-R*p;I=w?h(I):u-2*o(f(-I*x));let U=(I-r)/(a-r);U=he.clamp(U,0,1);let b=e===fe,T=e===ue-1;g>0&&(b?I+=ge*O:T&&(I-=ge*O));let A,M=n(I),C=s(I),W=Y*C;v&&(A=(xe.geodeticLatitudeToMercatorAngle(I)-z)*H);for(let e=ce;e<de;++e){let r=e;r<0&&(r=0),r>=m&&(r=m-1);let a,o=p*(m*P)+r*P;if(1===S)a=c[o];else{let e;if(a=0,F)for(e=0;e<S;++e)a=a*E+c[o+e];else for(e=S-1;e>=0;--e)a=a*E+c[o+e]}a=a*D+B,Z=Math.max(Z,a),X=Math.min(X,a);let f=y.west+L*r;w?f=h(f):f*=x;let u=(f-t)/(i-t);u=he.clamp(u,0,1);let I=p*m+r;if(g>0){let t=e===ce,i=e===de-1,n=b||T||t||i;if((b||T)&&(t||i))continue;n&&(a-=g,t?(I=ee+(d-p-1),f-=ge*N):T?I=ee+d+(m-r-1):i?(I=ee+d+m+p,f+=ge*N):b&&(I=ee+d+m+d+r))}let O=M*n(f),R=M*s(f),z=j*O,H=_*R,Y=1/l(z*O+H*R+W*C),G=z*Y,K=H*Y,te=W*Y,ne=new re;ne.x=G+O*a,ne.y=K+R*a,ne.z=te+C*a,Ie.multiplyByPoint(J,ne,He),re.minimumByComponent(He,q,q),re.maximumByComponent(He,Q,Q),$=Math.min($,a),ie[I]=ne,se[I]=new Pe(u,U),ae[I]=a,v&&(le[I]=A),V&&(oe[I]=k.geodeticSurfaceNormal(ne))}}let we,ke,ye=rr.fromPoints(ie);W(I)&&(we=nr.fromRectangle(I,X,Z,k)),b&&(ke=new ar(k).computeHorizonCullingPointPossiblyUnderEllipsoid(U,ie,X));let Ue=new tr(q,Q,U),be=new sr(U,Ue,$,Z,K,!1,v,V,T,A),ve=new Float32Array(te*be.stride),Te=0;for(let e=0;e<te;++e)Te=be.encode(ve,Te,ie[e],se[e],ae[e],void 0,le[e],oe[e]);return{vertices:ve,maximumHeight:Z,minimumHeight:X,encoding:be,boundingSphere3D:ye,orientedBoundingBox:we,occludeePointInScaledSpace:ke}};var lr=G,cr=xr(ur(),1);function yr(e,t){if(e.encoding===or.LERC){let t;try{t=cr.default.decode(e.heightmap)}catch(e){throw new Re(e)}if(t.statistics[0].minValue===Number.MAX_VALUE)throw new Re("Invalid tile data");e.heightmap=t.pixels[0],e.width=t.width,e.height=t.height}e.ellipsoid=pe.clone(e.ellipsoid),e.rectangle=ne.clone(e.rectangle);let r=lr.computeVertices(e),i=r.vertices;return t.push(i.buffer),{vertices:i.buffer,numberOfAttributes:r.encoding.stride,minimumHeight:r.minimumHeight,maximumHeight:r.maximumHeight,gridWidth:e.width,gridHeight:e.height,boundingSphere3D:r.boundingSphere3D,orientedBoundingBox:r.orientedBoundingBox,occludeePointInScaledSpace:r.occludeePointInScaledSpace,encoding:r.encoding,westIndicesSouthToNorth:r.westIndicesSouthToNorth,southIndicesEastToWest:r.southIndicesEastToWest,eastIndicesNorthToSouth:r.eastIndicesNorthToSouth,northIndicesWestToEast:r.northIndicesWestToEast}}var Kr=ir(yr);export{Kr as default};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,4 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./AxisAlignedBoundingBox-b1c095aa","./Matrix2-73789715","./defaultValue-97284df2","./TerrainEncoding-080f16eb","./IndexDatatype-65271ba3","./ComponentDatatype-e7fbe225","./RuntimeError-4f8ec8a2","./Transforms-d3d3b2a9","./WebMercatorProjection-04ef6bc3","./createTaskProcessorWorker","./AttributeCompression-5744d52e","./WebGLConstants-6da700a2","./_commonjsHelpers-3aae1032-65601a27","./combine-d11b1f00"],(function(e,t,r,n,o,i,a,s,c,d,h,u,l,I){"use strict";function g(){a.DeveloperError.throwInstantiationError()}Object.defineProperties(g.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}});const m=[];g.getRegularGridIndices=function(e,t){let n=m[e];r.defined(n)||(m[e]=n=[]);let o=n[t];return r.defined(o)||(o=e*t<i.CesiumMath.SIXTY_FOUR_KILOBYTES?n[t]=new Uint16Array((e-1)*(t-1)*6):n[t]=new Uint32Array((e-1)*(t-1)*6),p(e,t,o,0)),o};const T=[];g.getRegularGridIndicesAndEdgeIndices=function(e,t){let n=T[e];r.defined(n)||(T[e]=n=[]);let o=n[t];if(!r.defined(o)){const r=g.getRegularGridIndices(e,t),i=f(e,t),a=i.westIndicesSouthToNorth,s=i.southIndicesEastToWest,c=i.eastIndicesNorthToSouth,d=i.northIndicesWestToEast;o=n[t]={indices:r,westIndicesSouthToNorth:a,southIndicesEastToWest:s,eastIndicesNorthToSouth:c,northIndicesWestToEast:d}}return o};const E=[];function f(e,t){const r=new Array(t),n=new Array(e),o=new Array(t),i=new Array(e);let a;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}}function p(e,t,r,n){let o=0;for(let i=0;i<t-1;++i){for(let t=0;t<e-1;++t){const t=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}}function y(e,t,r,n){let o=e[0];const i=e.length;for(let a=1;a<i;++a){const i=e[a];r[n++]=o,r[n++]=i,r[n++]=t,r[n++]=t,r[n++]=i,r[n++]=t+1,o=i,++t}return n}g.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){let n=E[e];r.defined(n)||(E[e]=n=[]);let i=n[t];if(!r.defined(i)){const r=e*t,a=(e-1)*(t-1)*6,s=2*e+2*t,c=r+s,d=a+6*Math.max(0,s-4),h=f(e,t),u=h.westIndicesSouthToNorth,l=h.southIndicesEastToWest,I=h.eastIndicesNorthToSouth,m=h.northIndicesWestToEast,T=o.IndexDatatype.createTypedArray(c,d);p(e,t,T,0),g.addSkirtIndices(u,l,I,m,r,T,a),i=n[t]={indices:T,westIndicesSouthToNorth:u,southIndicesEastToWest:l,eastIndicesNorthToSouth:I,northIndicesWestToEast:m,indexCountWithoutSkirts:a}}return i},g.addSkirtIndices=function(e,t,r,n,o,i,a){let s=o;a=y(e,s,i,a),s+=e.length,a=y(t,s,i,a),s+=t.length,a=y(r,s,i,a),s+=r.length,y(n,s,i,a)},g.heightmapTerrainQuality=.25,g.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return 2*e.maximumRadius*Math.PI*g.heightmapTerrainQuality/(t*r)},g.prototype.requestTileGeometry=a.DeveloperError.throwInstantiationError,g.prototype.getLevelMaximumGeometricError=a.DeveloperError.throwInstantiationError,g.prototype.getTileDataAvailable=a.DeveloperError.throwInstantiationError,g.prototype.loadTileDataAvailability=a.DeveloperError.throwInstantiationError;const N=32767,w=new t.Cartesian3,S=new t.Cartesian3,b=new t.Cartesian3,M=new t.Cartographic,x=new t.Cartesian2;function A(e,r,n,o,a,s,c,d,h){let u=Number.POSITIVE_INFINITY;const l=a.north,I=a.south;let g=a.east;const m=a.west;g<m&&(g+=i.CesiumMath.TWO_PI);const T=e.length;for(let a=0;a<T;++a){const T=e[a],E=n[T],f=o[T];M.longitude=i.CesiumMath.lerp(m,g,f.x),M.latitude=i.CesiumMath.lerp(I,l,f.y),M.height=E-r;const p=s.cartographicToCartesian(M,w);t.Matrix4.multiplyByPoint(c,p,p),t.Cartesian3.minimumByComponent(p,d,d),t.Cartesian3.maximumByComponent(p,h,h),u=Math.min(u,M.height)}return u}function C(e,t,n,o,a,s,d,h,u,l,I,g,m,T){const E=r.defined(d),f=u.north,p=u.south;let y=u.east;const N=u.west;y<N&&(y+=i.CesiumMath.TWO_PI);const S=n.length;for(let r=0;r<S;++r){const u=n[r],S=a[u],b=s[u];M.longitude=i.CesiumMath.lerp(N,y,b.x)+m,M.latitude=i.CesiumMath.lerp(p,f,b.y)+T,M.height=S-l;const A=h.cartographicToCartesian(M,w);if(E){const e=2*u;x.x=d[e],x.y=d[e+1]}let C,W;o.hasWebMercatorT&&(C=(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(M.latitude)-I)*g),o.hasGeodeticSurfaceNormals&&(W=h.geodeticSurfaceNormal(A)),t=o.encode(e,t,A,b,M.height,x,C,W)}}function W(e,t){let n;return"function"==typeof e.slice&&(n=e.slice(),"function"!=typeof n.sort&&(n=void 0)),r.defined(n)||(n=Array.prototype.slice.call(e)),n.sort(t),n}return d((function(a,d){const h=a.quantizedVertices,u=h.length/3,l=a.octEncodedNormals,I=a.westIndices.length+a.eastIndices.length+a.southIndices.length+a.northIndices.length,m=a.includeWebMercatorT,T=a.exaggeration,E=a.exaggerationRelativeHeight,f=1!==T,p=t.Rectangle.clone(a.rectangle),y=p.west,v=p.south,P=p.east,D=p.north,k=t.Ellipsoid.clone(a.ellipsoid),F=a.minimumHeight,H=a.maximumHeight,_=a.relativeToCenter,G=s.Transforms.eastNorthUpToFixedFrame(_,k),V=t.Matrix4.inverseTransformation(G,new t.Matrix4);let Y,O;m&&(Y=c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(v),O=1/(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(D)-Y));const B=h.subarray(0,u),R=h.subarray(u,2*u),L=h.subarray(2*u,3*u),j=r.defined(l),U=new Array(u),z=new Array(u),q=new Array(u),Q=m?new Array(u):[],K=f?new Array(u):[],X=S;X.x=Number.POSITIVE_INFINITY,X.y=Number.POSITIVE_INFINITY,X.z=Number.POSITIVE_INFINITY;const Z=b;Z.x=Number.NEGATIVE_INFINITY,Z.y=Number.NEGATIVE_INFINITY,Z.z=Number.NEGATIVE_INFINITY;let J=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,ee=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY;for(let e=0;e<u;++e){const r=B[e],n=R[e],o=r/N,a=n/N,s=i.CesiumMath.lerp(F,H,L[e]/N);M.longitude=i.CesiumMath.lerp(y,P,o),M.latitude=i.CesiumMath.lerp(v,D,a),M.height=s,J=Math.min(M.longitude,J),$=Math.max(M.longitude,$),ee=Math.min(M.latitude,ee),te=Math.max(M.latitude,te);const d=k.cartographicToCartesian(M);U[e]=new t.Cartesian2(o,a),z[e]=s,q[e]=d,m&&(Q[e]=(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(M.latitude)-Y)*O),f&&(K[e]=k.geodeticSurfaceNormal(d)),t.Matrix4.multiplyByPoint(V,d,w),t.Cartesian3.minimumByComponent(w,X,X),t.Cartesian3.maximumByComponent(w,Z,Z)}const re=W(a.westIndices,(function(e,t){return U[e].y-U[t].y})),ne=W(a.eastIndices,(function(e,t){return U[t].y-U[e].y})),oe=W(a.southIndices,(function(e,t){return U[t].x-U[e].x})),ie=W(a.northIndices,(function(e,t){return U[e].x-U[t].x}));let ae;F<0&&(ae=new n.EllipsoidalOccluder(k).computeHorizonCullingPointPossiblyUnderEllipsoid(_,q,F));let se=F;se=Math.min(se,A(a.westIndices,a.westSkirtHeight,z,U,p,k,V,X,Z)),se=Math.min(se,A(a.southIndices,a.southSkirtHeight,z,U,p,k,V,X,Z)),se=Math.min(se,A(a.eastIndices,a.eastSkirtHeight,z,U,p,k,V,X,Z)),se=Math.min(se,A(a.northIndices,a.northSkirtHeight,z,U,p,k,V,X,Z));const ce=new e.AxisAlignedBoundingBox(X,Z,_),de=new n.TerrainEncoding(_,ce,se,H,G,j,m,f,T,E),he=de.stride,ue=new Float32Array(u*he+I*he);let le=0;for(let e=0;e<u;++e){if(j){const t=2*e;x.x=l[t],x.y=l[t+1]}le=de.encode(ue,le,q[e],U[e],z[e],x,Q[e],K[e])}const Ie=Math.max(0,2*(I-4)),ge=a.indices.length+3*Ie,me=o.IndexDatatype.createTypedArray(u+I,ge);me.set(a.indices,0);const Te=1e-4,Ee=($-J)*Te,fe=(te-ee)*Te,pe=-Ee,ye=Ee,Ne=fe,we=-fe;let Se=u*he;return C(ue,Se,re,de,z,U,l,k,p,a.westSkirtHeight,Y,O,pe,0),Se+=a.westIndices.length*he,C(ue,Se,oe,de,z,U,l,k,p,a.southSkirtHeight,Y,O,0,we),Se+=a.southIndices.length*he,C(ue,Se,ne,de,z,U,l,k,p,a.eastSkirtHeight,Y,O,ye,0),Se+=a.eastIndices.length*he,C(ue,Se,ie,de,z,U,l,k,p,a.northSkirtHeight,Y,O,0,Ne),g.addSkirtIndices(re,oe,ne,ie,u,me,a.indices.length),d.push(ue.buffer,me.buffer),{vertices:ue.buffer,indices:me.buffer,westIndicesSouthToNorth:re,southIndicesEastToWest:oe,eastIndicesNorthToSouth:ne,northIndicesWestToEast:ie,vertexStride:he,center:_,minimumHeight:F,maximumHeight:H,occludeePointInScaledSpace:ae,encoding:de,indexCountWithoutSkirts:a.indices.length}}))}));
25
+ import{a as At}from"./chunk-W5OEMTMB.js";import{a as Ot,c as pt}from"./chunk-PYMQNHFO.js";import{a as Et}from"./chunk-BKIYVF74.js";import{a as z}from"./chunk-LN2UT4R3.js";import"./chunk-G72JFEXW.js";import{a as bt}from"./chunk-5VFNV3LW.js";import{a as Mt}from"./chunk-4WQ4VT5S.js";import"./chunk-D3TVNJ6W.js";import"./chunk-3VUCSHGU.js";import{i as wt,j as yt}from"./chunk-LNJEJFV5.js";import{b as Y}from"./chunk-BPABSUDY.js";import"./chunk-ATKJRN2G.js";import"./chunk-RDX4QSUS.js";import"./chunk-G3GDHHWO.js";import{a as xt,b as rt,c as St}from"./chunk-2AIOP76V.js";import{a as O}from"./chunk-IAE6APK2.js";import{a as T}from"./chunk-3E7FIXV7.js";import"./chunk-NZBME2JK.js";import{f as D}from"./chunk-6DLS2UKD.js";var ut=32767,G=new O,Gt=new O,Ut=new O,n=new xt,F=new rt;function qt(t,e){let r,i,o=t.quantizedVertices,a=o.length/3,s=t.octEncodedNormals,u=t.westIndices.length+t.eastIndices.length+t.southIndices.length+t.northIndices.length,c=t.includeWebMercatorT,h=t.exaggeration,l=t.exaggerationRelativeHeight,m=1!==h,I=yt.clone(t.rectangle),d=I.west,g=I.south,N=I.east,p=I.north,f=St.clone(t.ellipsoid),y=t.minimumHeight,S=t.maximumHeight,k=t.relativeToCenter,w=wt.eastNorthUpToFixedFrame(k,f),E=Y.inverseTransformation(w,new Y);c&&(r=z.geodeticLatitudeToMercatorAngle(g),i=1/(z.geodeticLatitudeToMercatorAngle(p)-r));let b=o.subarray(0,a),x=o.subarray(a,2*a),A=o.subarray(2*a,3*a),M=D(s),V=new Array(a),j=new Array(a),H=new Array(a),P=c?new Array(a):[],W=m?new Array(a):[],_=Gt;_.x=Number.POSITIVE_INFINITY,_.y=Number.POSITIVE_INFINITY,_.z=Number.POSITIVE_INFINITY;let B=Ut;B.x=Number.NEGATIVE_INFINITY,B.y=Number.NEGATIVE_INFINITY,B.z=Number.NEGATIVE_INFINITY;let C=Number.POSITIVE_INFINITY,U=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY;for(let t=0;t<a;++t){let e=b[t],o=x[t],a=e/ut,s=o/ut,u=T.lerp(y,S,A[t]/ut);n.longitude=T.lerp(d,N,a),n.latitude=T.lerp(g,p,s),n.height=u,C=Math.min(n.longitude,C),U=Math.max(n.longitude,U),v=Math.min(n.latitude,v),L=Math.max(n.latitude,L);let h=f.cartographicToCartesian(n);V[t]=new rt(a,s),j[t]=u,H[t]=h,c&&(P[t]=(z.geodeticLatitudeToMercatorAngle(n.latitude)-r)*i),m&&(W[t]=f.geodeticSurfaceNormal(h)),Y.multiplyByPoint(E,h,G),O.minimumByComponent(G,_,_),O.maximumByComponent(G,B,B)}let R,q=K(t.westIndices,(function(t,e){return V[t].y-V[e].y})),X=K(t.eastIndices,(function(t,e){return V[e].y-V[t].y})),Z=K(t.southIndices,(function(t,e){return V[e].x-V[t].x})),$=K(t.northIndices,(function(t,e){return V[t].x-V[e].x}));y<0&&(R=new Ot(f).computeHorizonCullingPointPossiblyUnderEllipsoid(k,H,y));let tt=y;tt=Math.min(tt,Q(t.westIndices,t.westSkirtHeight,j,V,I,f,E,_,B)),tt=Math.min(tt,Q(t.southIndices,t.southSkirtHeight,j,V,I,f,E,_,B)),tt=Math.min(tt,Q(t.eastIndices,t.eastSkirtHeight,j,V,I,f,E,_,B)),tt=Math.min(tt,Q(t.northIndices,t.northSkirtHeight,j,V,I,f,E,_,B));let et=new bt(_,B,k),nt=new pt(k,et,tt,S,w,M,c,m,h,l),it=nt.stride,ot=new Float32Array(a*it+u*it),at=0;for(let t=0;t<a;++t){if(M){let e=2*t;F.x=s[e],F.y=s[e+1]}at=nt.encode(ot,at,H[t],V[t],j[t],F,P[t],W[t])}let st=Math.max(0,2*(u-4)),ct=t.indices.length+3*st,ht=Mt.createTypedArray(a+u,ct);ht.set(t.indices,0);let lt=1e-4,mt=(U-C)*lt,It=(L-v)*lt,dt=-mt,gt=mt,Tt=It,Nt=-It,ft=a*it;return J(ot,ft,q,nt,j,V,s,f,I,t.westSkirtHeight,r,i,dt,0),ft+=t.westIndices.length*it,J(ot,ft,Z,nt,j,V,s,f,I,t.southSkirtHeight,r,i,0,Nt),ft+=t.southIndices.length*it,J(ot,ft,X,nt,j,V,s,f,I,t.eastSkirtHeight,r,i,gt,0),ft+=t.eastIndices.length*it,J(ot,ft,$,nt,j,V,s,f,I,t.northSkirtHeight,r,i,0,Tt),At.addSkirtIndices(q,Z,X,$,a,ht,t.indices.length),e.push(ot.buffer,ht.buffer),{vertices:ot.buffer,indices:ht.buffer,westIndicesSouthToNorth:q,southIndicesEastToWest:Z,eastIndicesNorthToSouth:X,northIndicesWestToEast:$,vertexStride:it,center:k,minimumHeight:y,maximumHeight:S,occludeePointInScaledSpace:R,encoding:nt,indexCountWithoutSkirts:t.indices.length}}function Q(t,e,r,i,o,a,s,u,c){let h=Number.POSITIVE_INFINITY,l=o.north,m=o.south,I=o.east,d=o.west;I<d&&(I+=T.TWO_PI);let g=t.length;for(let o=0;o<g;++o){let g=t[o],N=r[g],p=i[g];n.longitude=T.lerp(d,I,p.x),n.latitude=T.lerp(m,l,p.y),n.height=N-e;let f=a.cartographicToCartesian(n,G);Y.multiplyByPoint(s,f,f),O.minimumByComponent(f,u,u),O.maximumByComponent(f,c,c),h=Math.min(h,n.height)}return h}function J(t,e,r,i,o,a,s,u,c,h,l,m,I,d){let g=D(s),N=c.north,p=c.south,f=c.east,y=c.west;f<y&&(f+=T.TWO_PI);let S=r.length;for(let c=0;c<S;++c){let S=r[c],k=o[S],w=a[S];n.longitude=T.lerp(y,f,w.x)+I,n.latitude=T.lerp(p,N,w.y)+d,n.height=k-h;let E,b,x=u.cartographicToCartesian(n,G);if(g){let t=2*S;F.x=s[t],F.y=s[t+1]}i.hasWebMercatorT&&(E=(z.geodeticLatitudeToMercatorAngle(n.latitude)-l)*m),i.hasGeodeticSurfaceNormals&&(b=u.geodeticSurfaceNormal(x)),e=i.encode(t,e,x,w,n.height,F,E,b)}}function K(t,e){let n;return"function"==typeof t.slice&&(n=t.slice(),"function"!=typeof n.sort&&(n=void 0)),D(n)||(n=Array.prototype.slice.call(t)),n.sort(e),n}var re=Et(qt);export{re as default};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,4 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./defaultValue-97284df2","./Matrix2-73789715","./Transforms-d3d3b2a9","./ComponentDatatype-e7fbe225","./RuntimeError-4f8ec8a2","./GeometryAttribute-fd1d7e90","./GeometryAttributes-734a3446","./IndexDatatype-65271ba3","./VertexFormat-9886cb81","./WallGeometryLibrary-27f90b78","./_commonjsHelpers-3aae1032-65601a27","./combine-d11b1f00","./WebGLConstants-6da700a2","./arrayRemoveDuplicates-6f91355d","./PolylinePipeline-ebd42f23","./EllipsoidGeodesic-ed8a0e40","./EllipsoidRhumbLine-60f14314","./IntersectionTests-33ace2d6","./Plane-e916220d"],(function(e,t,n,i,a,o,r,s,l,m,u,d,p,c,f,y,g,h,C){"use strict";const x=new t.Cartesian3,b=new t.Cartesian3,A=new t.Cartesian3,_=new t.Cartesian3,E=new t.Cartesian3,w=new t.Cartesian3,F=new t.Cartesian3;function v(n){const a=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).positions,o=n.maximumHeights,r=n.minimumHeights,s=e.defaultValue(n.vertexFormat,l.VertexFormat.DEFAULT),m=e.defaultValue(n.granularity,i.CesiumMath.RADIANS_PER_DEGREE),u=e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84);this._positions=a,this._minimumHeights=r,this._maximumHeights=o,this._vertexFormat=l.VertexFormat.clone(s),this._granularity=m,this._ellipsoid=t.Ellipsoid.clone(u),this._workerName="createWallGeometry";let d=1+a.length*t.Cartesian3.packedLength+2;e.defined(r)&&(d+=r.length),e.defined(o)&&(d+=o.length),this.packedLength=d+t.Ellipsoid.packedLength+l.VertexFormat.packedLength+1}v.pack=function(n,i,a){let o;a=e.defaultValue(a,0);const r=n._positions;let s=r.length;for(i[a++]=s,o=0;o<s;++o,a+=t.Cartesian3.packedLength)t.Cartesian3.pack(r[o],i,a);const m=n._minimumHeights;if(s=e.defined(m)?m.length:0,i[a++]=s,e.defined(m))for(o=0;o<s;++o)i[a++]=m[o];const u=n._maximumHeights;if(s=e.defined(u)?u.length:0,i[a++]=s,e.defined(u))for(o=0;o<s;++o)i[a++]=u[o];return t.Ellipsoid.pack(n._ellipsoid,i,a),a+=t.Ellipsoid.packedLength,l.VertexFormat.pack(n._vertexFormat,i,a),i[a+=l.VertexFormat.packedLength]=n._granularity,i};const L=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),H=new l.VertexFormat,V={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:L,vertexFormat:H,granularity:void 0};return v.unpack=function(n,i,a){let o;i=e.defaultValue(i,0);let r=n[i++];const s=new Array(r);for(o=0;o<r;++o,i+=t.Cartesian3.packedLength)s[o]=t.Cartesian3.unpack(n,i);let m,u;if(r=n[i++],r>0)for(m=new Array(r),o=0;o<r;++o)m[o]=n[i++];if(r=n[i++],r>0)for(u=new Array(r),o=0;o<r;++o)u[o]=n[i++];const d=t.Ellipsoid.unpack(n,i,L);i+=t.Ellipsoid.packedLength;const p=l.VertexFormat.unpack(n,i,H),c=n[i+=l.VertexFormat.packedLength];return e.defined(a)?(a._positions=s,a._minimumHeights=m,a._maximumHeights=u,a._ellipsoid=t.Ellipsoid.clone(d,a._ellipsoid),a._vertexFormat=l.VertexFormat.clone(p,a._vertexFormat),a._granularity=c,a):(V.positions=s,V.minimumHeights=m,V.maximumHeights=u,V.granularity=c,new v(V))},v.fromConstantHeights=function(t){const n=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions;let i,a;const o=t.minimumHeight,r=t.maximumHeight,s=e.defined(o),l=e.defined(r);if(s||l){const e=n.length;i=s?new Array(e):void 0,a=l?new Array(e):void 0;for(let t=0;t<e;++t)s&&(i[t]=o),l&&(a[t]=r)}return new v({positions:n,maximumHeights:a,minimumHeights:i,ellipsoid:t.ellipsoid,vertexFormat:t.vertexFormat})},v.createGeometry=function(a){const l=a._positions,u=a._minimumHeights,d=a._maximumHeights,p=a._vertexFormat,c=a._granularity,f=a._ellipsoid,y=m.WallGeometryLibrary.computePositions(f,l,d,u,c,!0);if(!e.defined(y))return;const g=y.bottomPositions,h=y.topPositions,C=y.numCorners;let v=h.length,L=2*v;const H=p.position?new Float64Array(L):void 0,V=p.normal?new Float32Array(L):void 0,k=p.tangent?new Float32Array(L):void 0,G=p.bitangent?new Float32Array(L):void 0,D=p.st?new Float32Array(L/3*2):void 0;let P,T=0,z=0,O=0,R=0,S=0,I=F,N=w,M=E,W=!0;v/=3;let B=0;const U=1/(v-C-1);for(P=0;P<v;++P){const e=3*P,n=t.Cartesian3.fromArray(h,e,x),a=t.Cartesian3.fromArray(g,e,b);if(p.position&&(H[T++]=a.x,H[T++]=a.y,H[T++]=a.z,H[T++]=n.x,H[T++]=n.y,H[T++]=n.z),p.st&&(D[S++]=B,D[S++]=0,D[S++]=B,D[S++]=1),p.normal||p.tangent||p.bitangent){let a=t.Cartesian3.clone(t.Cartesian3.ZERO,_);const o=t.Cartesian3.subtract(n,f.geodeticSurfaceNormal(n,b),b);if(P+1<v&&(a=t.Cartesian3.fromArray(h,e+3,_)),W){const e=t.Cartesian3.subtract(a,n,A),i=t.Cartesian3.subtract(o,n,x);I=t.Cartesian3.normalize(t.Cartesian3.cross(i,e,I),I),W=!1}t.Cartesian3.equalsEpsilon(n,a,i.CesiumMath.EPSILON10)?W=!0:(B+=U,p.tangent&&(N=t.Cartesian3.normalize(t.Cartesian3.subtract(a,n,N),N)),p.bitangent&&(M=t.Cartesian3.normalize(t.Cartesian3.cross(I,N,M),M))),p.normal&&(V[z++]=I.x,V[z++]=I.y,V[z++]=I.z,V[z++]=I.x,V[z++]=I.y,V[z++]=I.z),p.tangent&&(k[R++]=N.x,k[R++]=N.y,k[R++]=N.z,k[R++]=N.x,k[R++]=N.y,k[R++]=N.z),p.bitangent&&(G[O++]=M.x,G[O++]=M.y,G[O++]=M.z,G[O++]=M.x,G[O++]=M.y,G[O++]=M.z)}}const q=new r.GeometryAttributes;p.position&&(q.position=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:H})),p.normal&&(q.normal=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:V})),p.tangent&&(q.tangent=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:k})),p.bitangent&&(q.bitangent=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:G})),p.st&&(q.st=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:D}));const J=L/3;L-=6*(C+1);const Y=s.IndexDatatype.createTypedArray(J,L);let j=0;for(P=0;P<J-2;P+=2){const e=P,n=P+2,a=t.Cartesian3.fromArray(H,3*e,x),o=t.Cartesian3.fromArray(H,3*n,b);if(t.Cartesian3.equalsEpsilon(a,o,i.CesiumMath.EPSILON10))continue;const r=P+1,s=P+3;Y[j++]=r,Y[j++]=e,Y[j++]=s,Y[j++]=s,Y[j++]=e,Y[j++]=n}return new o.Geometry({attributes:q,indices:Y,primitiveType:o.PrimitiveType.TRIANGLES,boundingSphere:new n.BoundingSphere.fromVertices(H)})},function(n,i){return e.defined(i)&&(n=v.unpack(n,i)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),v.createGeometry(n)}}));
25
+ import{a as nt}from"./chunk-7TN3TOVQ.js";import"./chunk-6AEO73KW.js";import"./chunk-WGIRJIIK.js";import{a as w}from"./chunk-AKELQO2L.js";import"./chunk-G2QPRBZU.js";import"./chunk-37ETYCYM.js";import"./chunk-SRA5MBUT.js";import"./chunk-5AAMOBJK.js";import{a as ot}from"./chunk-4WQ4VT5S.js";import{a as it}from"./chunk-6EINM7EY.js";import{b as tt,c as et,d as R}from"./chunk-A4I25VN7.js";import{c as I}from"./chunk-D3TVNJ6W.js";import"./chunk-3VUCSHGU.js";import"./chunk-LNJEJFV5.js";import"./chunk-BPABSUDY.js";import{a as N}from"./chunk-ATKJRN2G.js";import"./chunk-RDX4QSUS.js";import"./chunk-G3GDHHWO.js";import{c as l}from"./chunk-2AIOP76V.js";import{a as s,c as K}from"./chunk-IAE6APK2.js";import{a as V}from"./chunk-3E7FIXV7.js";import{a as y}from"./chunk-NZBME2JK.js";import{f as r}from"./chunk-6DLS2UKD.js";var Q=new s,J=new s,lt=new s,st=new s,pt=new s,ut=new s,ft=new s;function E(t){let e=(t=t??K.EMPTY_OBJECT).positions,i=t.maximumHeights,n=t.minimumHeights;if(!r(e))throw new y("options.positions is required.");if(r(i)&&i.length!==e.length)throw new y("options.positions and options.maximumHeights must have the same length.");if(r(n)&&n.length!==e.length)throw new y("options.positions and options.minimumHeights must have the same length.");let o=t.vertexFormat??w.DEFAULT,a=t.granularity??V.RADIANS_PER_DEGREE,m=t.ellipsoid??l.default;this._positions=e,this._minimumHeights=n,this._maximumHeights=i,this._vertexFormat=w.clone(o),this._granularity=a,this._ellipsoid=l.clone(m),this._workerName="createWallGeometry";let p=1+e.length*s.packedLength+2;r(n)&&(p+=n.length),r(i)&&(p+=i.length),this.packedLength=p+l.packedLength+w.packedLength+1}E.pack=function(t,e,i){if(!r(t))throw new y("value is required");if(!r(e))throw new y("array is required");i=i??0;let n,o=t._positions,a=o.length;for(e[i++]=a,n=0;n<a;++n,i+=s.packedLength)s.pack(o[n],e,i);let m=t._minimumHeights;if(a=r(m)?m.length:0,e[i++]=a,r(m))for(n=0;n<a;++n)e[i++]=m[n];let p=t._maximumHeights;if(a=r(p)?p.length:0,e[i++]=a,r(p))for(n=0;n<a;++n)e[i++]=p[n];return l.pack(t._ellipsoid,e,i),i+=l.packedLength,w.pack(t._vertexFormat,e,i),e[i+=w.packedLength]=t._granularity,e};var mt=l.clone(l.UNIT_SPHERE),rt=new w,U={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:mt,vertexFormat:rt,granularity:void 0};E.unpack=function(t,e,i){if(!r(t))throw new y("array is required");e=e??0;let n,o,a,m=t[e++],p=new Array(m);for(n=0;n<m;++n,e+=s.packedLength)p[n]=s.unpack(t,e);if(m=t[e++],m>0)for(o=new Array(m),n=0;n<m;++n)o[n]=t[e++];if(m=t[e++],m>0)for(a=new Array(m),n=0;n<m;++n)a[n]=t[e++];let u=l.unpack(t,e,mt);e+=l.packedLength;let h=w.unpack(t,e,rt),c=t[e+=w.packedLength];return r(i)?(i._positions=p,i._minimumHeights=o,i._maximumHeights=a,i._ellipsoid=l.clone(u,i._ellipsoid),i._vertexFormat=w.clone(h,i._vertexFormat),i._granularity=c,i):(U.positions=p,U.minimumHeights=o,U.maximumHeights=a,U.granularity=c,new E(U))},E.fromConstantHeights=function(t){let e=(t=t??K.EMPTY_OBJECT).positions;if(!r(e))throw new y("options.positions is required.");let i,n,o=t.minimumHeight,s=t.maximumHeight,a=r(o),m=r(s);if(a||m){let t=e.length;i=a?new Array(t):void 0,n=m?new Array(t):void 0;for(let e=0;e<t;++e)a&&(i[e]=o),m&&(n[e]=s)}return new E({positions:e,maximumHeights:n,minimumHeights:i,ellipsoid:t.ellipsoid,vertexFormat:t.vertexFormat})},E.createGeometry=function(t){let e=t._positions,i=t._minimumHeights,n=t._maximumHeights,o=t._vertexFormat,a=t._granularity,m=t._ellipsoid,l=nt.computePositions(m,e,n,i,a,!0);if(!r(l))return;let p=l.bottomPositions,u=l.topPositions,h=l.numCorners,c=u.length,g=2*c,f=o.position?new Float64Array(g):void 0,w=o.normal?new Float32Array(g):void 0,y=o.tangent?new Float32Array(g):void 0,d=o.bitangent?new Float32Array(g):void 0,k=o.st?new Float32Array(g/3*2):void 0,A=0,E=0,_=0,v=0,x=0,H=ft,j=ut,L=pt,F=!0;c/=3;let T,b=0,O=1/(c-h-1);for(T=0;T<c;++T){let t=3*T,e=s.fromArray(u,t,Q),i=s.fromArray(p,t,J);if(o.position&&(f[A++]=i.x,f[A++]=i.y,f[A++]=i.z,f[A++]=e.x,f[A++]=e.y,f[A++]=e.z),o.st&&(k[x++]=b,k[x++]=0,k[x++]=b,k[x++]=1),o.normal||o.tangent||o.bitangent){let i=s.clone(s.ZERO,st),n=s.subtract(e,m.geodeticSurfaceNormal(e,J),J);if(T+1<c&&(i=s.fromArray(u,t+3,st)),F){let t=s.subtract(i,e,lt),r=s.subtract(n,e,Q);H=s.normalize(s.cross(r,t,H),H),F=!1}s.equalsEpsilon(e,i,V.EPSILON10)?F=!0:(b+=O,o.tangent&&(j=s.normalize(s.subtract(i,e,j),j)),o.bitangent&&(L=s.normalize(s.cross(H,j,L),L))),o.normal&&(w[E++]=H.x,w[E++]=H.y,w[E++]=H.z,w[E++]=H.x,w[E++]=H.y,w[E++]=H.z),o.tangent&&(y[v++]=j.x,y[v++]=j.y,y[v++]=j.z,y[v++]=j.x,y[v++]=j.y,y[v++]=j.z),o.bitangent&&(d[_++]=L.x,d[_++]=L.y,d[_++]=L.z,d[_++]=L.x,d[_++]=L.y,d[_++]=L.z)}}let P=new it;o.position&&(P.position=new R({componentDatatype:N.DOUBLE,componentsPerAttribute:3,values:f})),o.normal&&(P.normal=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:w})),o.tangent&&(P.tangent=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:y})),o.bitangent&&(P.bitangent=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:d})),o.st&&(P.st=new R({componentDatatype:N.FLOAT,componentsPerAttribute:2,values:k}));let U=g/3;g-=6*(h+1);let D=ot.createTypedArray(U,g),S=0;for(T=0;T<U-2;T+=2){let t=T,e=T+2,i=s.fromArray(f,3*t,Q),n=s.fromArray(f,3*e,J);if(s.equalsEpsilon(i,n,V.EPSILON10))continue;let r=T+1,o=T+3;D[S++]=r,D[S++]=t,D[S++]=o,D[S++]=o,D[S++]=t,D[S++]=e}return new et({attributes:P,indices:D,primitiveType:tt.TRIANGLES,boundingSphere:I.fromVertices(f)})};var X=E;function ht(t,e){return r(e)&&(t=X.unpack(t,e)),t._ellipsoid=l.clone(t._ellipsoid),X.createGeometry(t)}var Ot=ht;export{Ot as default};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,4 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./defaultValue-97284df2","./Matrix2-73789715","./Transforms-d3d3b2a9","./ComponentDatatype-e7fbe225","./RuntimeError-4f8ec8a2","./GeometryAttribute-fd1d7e90","./GeometryAttributes-734a3446","./IndexDatatype-65271ba3","./WallGeometryLibrary-27f90b78","./_commonjsHelpers-3aae1032-65601a27","./combine-d11b1f00","./WebGLConstants-6da700a2","./arrayRemoveDuplicates-6f91355d","./PolylinePipeline-ebd42f23","./EllipsoidGeodesic-ed8a0e40","./EllipsoidRhumbLine-60f14314","./IntersectionTests-33ace2d6","./Plane-e916220d"],(function(e,i,t,n,o,a,s,r,l,d,m,u,p,c,f,h,g,y){"use strict";const _=new i.Cartesian3,E=new i.Cartesian3;function H(t){const o=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions,a=t.maximumHeights,s=t.minimumHeights,r=e.defaultValue(t.granularity,n.CesiumMath.RADIANS_PER_DEGREE),l=e.defaultValue(t.ellipsoid,i.Ellipsoid.WGS84);this._positions=o,this._minimumHeights=s,this._maximumHeights=a,this._granularity=r,this._ellipsoid=i.Ellipsoid.clone(l),this._workerName="createWallOutlineGeometry";let d=1+o.length*i.Cartesian3.packedLength+2;e.defined(s)&&(d+=s.length),e.defined(a)&&(d+=a.length),this.packedLength=d+i.Ellipsoid.packedLength+1}H.pack=function(t,n,o){let a;o=e.defaultValue(o,0);const s=t._positions;let r=s.length;for(n[o++]=r,a=0;a<r;++a,o+=i.Cartesian3.packedLength)i.Cartesian3.pack(s[a],n,o);const l=t._minimumHeights;if(r=e.defined(l)?l.length:0,n[o++]=r,e.defined(l))for(a=0;a<r;++a)n[o++]=l[a];const d=t._maximumHeights;if(r=e.defined(d)?d.length:0,n[o++]=r,e.defined(d))for(a=0;a<r;++a)n[o++]=d[a];return i.Ellipsoid.pack(t._ellipsoid,n,o),n[o+=i.Ellipsoid.packedLength]=t._granularity,n};const C=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),b={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:C,granularity:void 0};return H.unpack=function(t,n,o){let a;n=e.defaultValue(n,0);let s=t[n++];const r=new Array(s);for(a=0;a<s;++a,n+=i.Cartesian3.packedLength)r[a]=i.Cartesian3.unpack(t,n);let l,d;if(s=t[n++],s>0)for(l=new Array(s),a=0;a<s;++a)l[a]=t[n++];if(s=t[n++],s>0)for(d=new Array(s),a=0;a<s;++a)d[a]=t[n++];const m=i.Ellipsoid.unpack(t,n,C),u=t[n+=i.Ellipsoid.packedLength];return e.defined(o)?(o._positions=r,o._minimumHeights=l,o._maximumHeights=d,o._ellipsoid=i.Ellipsoid.clone(m,o._ellipsoid),o._granularity=u,o):(b.positions=r,b.minimumHeights=l,b.maximumHeights=d,b.granularity=u,new H(b))},H.fromConstantHeights=function(i){const t=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).positions;let n,o;const a=i.minimumHeight,s=i.maximumHeight,r=e.defined(a),l=e.defined(s);if(r||l){const e=t.length;n=r?new Array(e):void 0,o=l?new Array(e):void 0;for(let i=0;i<e;++i)r&&(n[i]=a),l&&(o[i]=s)}return new H({positions:t,maximumHeights:o,minimumHeights:n,ellipsoid:i.ellipsoid})},H.createGeometry=function(o){const d=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;const h=f.bottomPositions,g=f.topPositions;let y=g.length,H=2*y;const C=new Float64Array(H);let b,A=0;for(y/=3,b=0;b<y;++b){const e=3*b,t=i.Cartesian3.fromArray(g,e,_),n=i.Cartesian3.fromArray(h,e,E);C[A++]=n.x,C[A++]=n.y,C[A++]=n.z,C[A++]=t.x,C[A++]=t.y,C[A++]=t.z}const k=new s.GeometryAttributes({position:new a.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:C})}),w=H/3;H=2*w-4+w;const x=r.IndexDatatype.createTypedArray(w,H);let G=0;for(b=0;b<w-2;b+=2){const e=b,t=b+2,o=i.Cartesian3.fromArray(C,3*e,_),a=i.Cartesian3.fromArray(C,3*t,E);if(i.Cartesian3.equalsEpsilon(o,a,n.CesiumMath.EPSILON10))continue;const s=b+1,r=b+3;x[G++]=s,x[G++]=e,x[G++]=s,x[G++]=r,x[G++]=e,x[G++]=t}return x[G++]=w-2,x[G++]=w-1,new a.Geometry({attributes:k,indices:x,primitiveType:a.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere.fromVertices(C)})},function(t,n){return e.defined(n)&&(t=H.unpack(t,n)),t._ellipsoid=i.Ellipsoid.clone(t._ellipsoid),H.createGeometry(t)}}));
25
+ import{a as z}from"./chunk-7TN3TOVQ.js";import"./chunk-6AEO73KW.js";import"./chunk-WGIRJIIK.js";import"./chunk-G2QPRBZU.js";import"./chunk-37ETYCYM.js";import"./chunk-SRA5MBUT.js";import"./chunk-5AAMOBJK.js";import{a as W}from"./chunk-4WQ4VT5S.js";import{a as N}from"./chunk-6EINM7EY.js";import{b as R,c as S,d as M}from"./chunk-A4I25VN7.js";import{c as D}from"./chunk-D3TVNJ6W.js";import"./chunk-3VUCSHGU.js";import"./chunk-LNJEJFV5.js";import"./chunk-BPABSUDY.js";import{a as q}from"./chunk-ATKJRN2G.js";import"./chunk-RDX4QSUS.js";import"./chunk-G3GDHHWO.js";import{c as l}from"./chunk-2AIOP76V.js";import{a as p,c as O}from"./chunk-IAE6APK2.js";import{a as b}from"./chunk-3E7FIXV7.js";import{a as H}from"./chunk-NZBME2JK.js";import{f as m}from"./chunk-6DLS2UKD.js";var B=new p,U=new p;function _(i){let t=(i=i??O.EMPTY_OBJECT).positions,e=i.maximumHeights,o=i.minimumHeights;if(!m(t))throw new H("options.positions is required.");if(m(e)&&e.length!==t.length)throw new H("options.positions and options.maximumHeights must have the same length.");if(m(o)&&o.length!==t.length)throw new H("options.positions and options.minimumHeights must have the same length.");let n=i.granularity??b.RADIANS_PER_DEGREE,r=i.ellipsoid??l.default;this._positions=t,this._minimumHeights=o,this._maximumHeights=e,this._granularity=n,this._ellipsoid=l.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*p.packedLength+2;m(o)&&(s+=o.length),m(e)&&(s+=e.length),this.packedLength=s+l.packedLength+1}_.pack=function(i,t,e){if(!m(i))throw new H("value is required");if(!m(t))throw new H("array is required");e=e??0;let o,n=i._positions,r=n.length;for(t[e++]=r,o=0;o<r;++o,e+=p.packedLength)p.pack(n[o],t,e);let s=i._minimumHeights;if(r=m(s)?s.length:0,t[e++]=r,m(s))for(o=0;o<r;++o)t[e++]=s[o];let a=i._maximumHeights;if(r=m(a)?a.length:0,t[e++]=r,m(a))for(o=0;o<r;++o)t[e++]=a[o];return l.pack(i._ellipsoid,t,e),t[e+=l.packedLength]=i._granularity,t};var G=l.clone(l.UNIT_SPHERE),L={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:G,granularity:void 0};_.unpack=function(i,t,e){if(!m(i))throw new H("array is required");t=t??0;let o,n,r,s=i[t++],a=new Array(s);for(o=0;o<s;++o,t+=p.packedLength)a[o]=p.unpack(i,t);if(s=i[t++],s>0)for(n=new Array(s),o=0;o<s;++o)n[o]=i[t++];if(s=i[t++],s>0)for(r=new Array(s),o=0;o<s;++o)r[o]=i[t++];let h=l.unpack(i,t,G),u=i[t+=l.packedLength];return m(e)?(e._positions=a,e._minimumHeights=n,e._maximumHeights=r,e._ellipsoid=l.clone(h,e._ellipsoid),e._granularity=u,e):(L.positions=a,L.minimumHeights=n,L.maximumHeights=r,L.granularity=u,new _(L))},_.fromConstantHeights=function(i){let t=(i=i??O.EMPTY_OBJECT).positions;if(!m(t))throw new H("options.positions is required.");let e,o,n=i.minimumHeight,r=i.maximumHeight,s=m(n),a=m(r);if(s||a){let i=t.length;e=s?new Array(i):void 0,o=a?new Array(i):void 0;for(let t=0;t<i;++t)s&&(e[t]=n),a&&(o[t]=r)}return new _({positions:t,maximumHeights:o,minimumHeights:e,ellipsoid:i.ellipsoid})},_.createGeometry=function(i){let t=i._positions,e=i._minimumHeights,o=i._maximumHeights,n=i._granularity,r=i._ellipsoid,s=z.computePositions(r,t,o,e,n,!1);if(!m(s))return;let a,l=s.bottomPositions,h=s.topPositions,u=h.length,c=2*u,g=new Float64Array(c),f=0;for(u/=3,a=0;a<u;++a){let i=3*a,t=p.fromArray(h,i,B),e=p.fromArray(l,i,U);g[f++]=e.x,g[f++]=e.y,g[f++]=e.z,g[f++]=t.x,g[f++]=t.y,g[f++]=t.z}let d=new N({position:new M({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:g})}),k=c/3;c=2*k-4+k;let _=W.createTypedArray(k,c),H=0;for(a=0;a<k-2;a+=2){let i=a,t=a+2,e=p.fromArray(g,3*i,B),o=p.fromArray(g,3*t,U);if(p.equalsEpsilon(e,o,b.EPSILON10))continue;let n=a+1,r=a+3;_[H++]=n,_[H++]=i,_[H++]=n,_[H++]=r,_[H++]=i,_[H++]=t}return _[H++]=k-2,_[H++]=k-1,new S({attributes:d,indices:_,primitiveType:R.LINES,boundingSphere:D.fromVertices(g)})};var C=_;function J(i,t){return m(t)&&(i=C.unpack(i,t)),i._ellipsoid=l.clone(i._ellipsoid),C.createGeometry(i)}var pi=J;export{pi as default};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,4 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./ComponentDatatype-e7fbe225","./defaultValue-97284df2","./IndexDatatype-65271ba3","./RuntimeError-4f8ec8a2","./createTaskProcessorWorker","./WebGLConstants-6da700a2"],(function(t,e,r,n,o,a){"use strict";let i;function s(t,e){const n=t.num_points(),o=t.num_faces(),a=new i.DracoInt32Array,s=3*o,u=r.IndexDatatype.createTypedArray(n,s);let c=0;for(let r=0;r<o;++r)e.GetFaceFromMesh(t,r,a),u[c+0]=a.GetValue(0),u[c+1]=a.GetValue(1),u[c+2]=a.GetValue(2),c+=3;return i.destroy(a),{typedArray:u,numberOfIndices:s}}function u(r,n,o){const a=r.num_points(),s=o.num_components();let u,c=new i.AttributeQuantizationTransform;if(c.InitFromAttribute(o)){const t=new Array(s);for(let e=0;e<s;++e)t[e]=c.min_value(e);u={quantizationBits:c.quantization_bits(),minValues:t,range:c.range(),octEncoded:!1}}i.destroy(c),c=new i.AttributeOctahedronTransform,c.InitFromAttribute(o)&&(u={quantizationBits:c.quantization_bits(),octEncoded:!0}),i.destroy(c);const d=a*s;let f;f=e.defined(u)?function(t,e,r,n,o){let a,s;n.quantizationBits<=8?(s=new i.DracoUInt8Array,a=new Uint8Array(o),e.GetAttributeUInt8ForAllPoints(t,r,s)):(s=new i.DracoUInt16Array,a=new Uint16Array(o),e.GetAttributeUInt16ForAllPoints(t,r,s));for(let t=0;t<o;++t)a[t]=s.GetValue(t);return i.destroy(s),a}(r,n,o,u,d):function(t,e,r,n){let o,a;switch(r.data_type()){case 1:case 11:a=new i.DracoInt8Array,o=new Int8Array(n),e.GetAttributeInt8ForAllPoints(t,r,a);break;case 2:a=new i.DracoUInt8Array,o=new Uint8Array(n),e.GetAttributeUInt8ForAllPoints(t,r,a);break;case 3:a=new i.DracoInt16Array,o=new Int16Array(n),e.GetAttributeInt16ForAllPoints(t,r,a);break;case 4:a=new i.DracoUInt16Array,o=new Uint16Array(n),e.GetAttributeUInt16ForAllPoints(t,r,a);break;case 5:case 7:a=new i.DracoInt32Array,o=new Int32Array(n),e.GetAttributeInt32ForAllPoints(t,r,a);break;case 6:case 8:a=new i.DracoUInt32Array,o=new Uint32Array(n),e.GetAttributeUInt32ForAllPoints(t,r,a);break;case 9:case 10:a=new i.DracoFloat32Array,o=new Float32Array(n),e.GetAttributeFloatForAllPoints(t,r,a)}for(let t=0;t<n;++t)o[t]=a.GetValue(t);return i.destroy(a),o}(r,n,o,d);const y=t.ComponentDatatype.fromTypedArray(f);return{array:f,data:{componentsPerAttribute:s,componentDatatype:y,byteOffset:o.byte_offset(),byteStride:t.ComponentDatatype.getSizeInBytes(y)*s,normalized:o.normalized(),quantization:u}}}function c(t){return e.defined(t.bufferView)?function(t){const e=new i.Decoder,r=["POSITION","NORMAL","COLOR","TEX_COORD"];if(t.dequantizeInShader)for(let t=0;t<r.length;++t)e.SkipAttributeTransform(i[r[t]]);const o=t.bufferView,a=new i.DecoderBuffer;if(a.Init(t.array,o.byteLength),e.GetEncodedGeometryType(a)!==i.TRIANGULAR_MESH)throw new n.RuntimeError("Unsupported draco mesh geometry type.");const c=new i.Mesh,d=e.DecodeBufferToMesh(a,c);if(!d.ok()||0===c.ptr)throw new n.RuntimeError(`Error decoding draco mesh geometry: ${d.error_msg()}`);i.destroy(a);const f={},y=t.compressedAttributes;for(const t in y)if(y.hasOwnProperty(t)){const r=y[t],n=e.GetAttributeByUniqueId(c,r);f[t]=u(c,e,n)}const A={indexArray:s(c,e),attributeData:f};return i.destroy(c),i.destroy(e),A}(t):function(t){const e=new i.Decoder;t.dequantizeInShader&&(e.SkipAttributeTransform(i.POSITION),e.SkipAttributeTransform(i.NORMAL));const r=new i.DecoderBuffer;if(r.Init(t.buffer,t.buffer.length),e.GetEncodedGeometryType(r)!==i.POINT_CLOUD)throw new n.RuntimeError("Draco geometry type must be POINT_CLOUD.");const o=new i.PointCloud,a=e.DecodeBufferToPointCloud(r,o);if(!a.ok()||0===o.ptr)throw new n.RuntimeError(`Error decoding draco point cloud: ${a.error_msg()}`);i.destroy(r);const s={},c=t.properties;for(const t in c)if(c.hasOwnProperty(t)){let r;if("POSITION"===t||"NORMAL"===t){const n=e.GetAttributeId(o,i[t]);r=e.GetAttribute(o,n)}else{const n=c[t];r=e.GetAttributeByUniqueId(o,n)}s[t]=u(o,e,r)}return i.destroy(o),i.destroy(e),s}(t)}function d(t){i=t,self.onmessage=o(c),self.postMessage(!0)}return function(t){const r=t.data.webAssemblyConfig;if(e.defined(r))return require([r.modulePath],(function(t){e.defined(r.wasmBinaryFile)?(e.defined(t)||(t=self.DracoDecoderModule),t(r).then((function(t){d(t)}))):d(t())}))}}));
25
+ import{a as D}from"./chunk-RESOCDYZ.js";import{a as I}from"./chunk-BKIYVF74.js";import{a as m}from"./chunk-4WQ4VT5S.js";import{a as w}from"./chunk-ATKJRN2G.js";import"./chunk-RDX4QSUS.js";import{a as A}from"./chunk-G3GDHHWO.js";import"./chunk-3E7FIXV7.js";import"./chunk-NZBME2JK.js";import{d as P,f as d}from"./chunk-6DLS2UKD.js";var r,b=P(D(),1);function F(t,e){let n=t.num_points(),o=t.num_faces(),a=new r.DracoInt32Array,i=3*o,s=m.createTypedArray(n,i),u=0;for(let r=0;r<o;++r)e.GetFaceFromMesh(t,r,a),s[u+0]=a.GetValue(0),s[u+1]=a.GetValue(1),s[u+2]=a.GetValue(2),u+=3;return r.destroy(a),{typedArray:s,numberOfIndices:i}}function U(t,e,n,o,a){let i,s;o.quantizationBits<=8?(s=new r.DracoUInt8Array,i=new Uint8Array(a),e.GetAttributeUInt8ForAllPoints(t,n,s)):o.quantizationBits<=16?(s=new r.DracoUInt16Array,i=new Uint16Array(a),e.GetAttributeUInt16ForAllPoints(t,n,s)):(s=new r.DracoFloat32Array,i=new Float32Array(a),e.GetAttributeFloatForAllPoints(t,n,s));for(let t=0;t<a;++t)i[t]=s.GetValue(t);return r.destroy(s),i}function k(t,e,n,o){let a,i;switch(n.data_type()){case 1:case 11:i=new r.DracoInt8Array,a=new Int8Array(o),e.GetAttributeInt8ForAllPoints(t,n,i);break;case 2:i=new r.DracoUInt8Array,a=new Uint8Array(o),e.GetAttributeUInt8ForAllPoints(t,n,i);break;case 3:i=new r.DracoInt16Array,a=new Int16Array(o),e.GetAttributeInt16ForAllPoints(t,n,i);break;case 4:i=new r.DracoUInt16Array,a=new Uint16Array(o),e.GetAttributeUInt16ForAllPoints(t,n,i);break;case 5:case 7:i=new r.DracoInt32Array,a=new Int32Array(o),e.GetAttributeInt32ForAllPoints(t,n,i);break;case 6:case 8:i=new r.DracoUInt32Array,a=new Uint32Array(o),e.GetAttributeUInt32ForAllPoints(t,n,i);break;case 9:case 10:i=new r.DracoFloat32Array,a=new Float32Array(o),e.GetAttributeFloatForAllPoints(t,n,i)}for(let t=0;t<o;++t)a[t]=i.GetValue(t);return r.destroy(i),a}function p(t,e,n){let o,a=t.num_points(),i=n.num_components(),s=new r.AttributeQuantizationTransform;if(s.InitFromAttribute(n)){let t=new Array(i);for(let r=0;r<i;++r)t[r]=s.min_value(r);o={quantizationBits:s.quantization_bits(),minValues:t,range:s.range(),octEncoded:!1}}r.destroy(s),s=new r.AttributeOctahedronTransform,s.InitFromAttribute(n)&&(o={quantizationBits:s.quantization_bits(),octEncoded:!0}),r.destroy(s);let u,l=a*i;u=d(o)?U(t,e,n,o,l):k(t,e,n,l);let c=w.fromTypedArray(u);return{array:u,data:{componentsPerAttribute:i,componentDatatype:c,byteOffset:n.byte_offset(),byteStride:w.getSizeInBytes(c)*i,normalized:n.normalized(),quantization:o}}}function O(t){let e=new r.Decoder;t.dequantizeInShader&&(e.SkipAttributeTransform(r.POSITION),e.SkipAttributeTransform(r.NORMAL));let n=new r.DecoderBuffer;if(n.Init(t.buffer,t.buffer.length),e.GetEncodedGeometryType(n)!==r.POINT_CLOUD)throw new A("Draco geometry type must be POINT_CLOUD.");let o=new r.PointCloud,a=e.DecodeBufferToPointCloud(n,o);if(!a.ok()||0===o.ptr)throw new A(`Error decoding draco point cloud: ${a.error_msg()}`);r.destroy(n);let i={},s=t.properties;for(let t in s)if(s.hasOwnProperty(t)){let n;if("POSITION"===t||"NORMAL"===t){let a=e.GetAttributeId(o,r[t]);n=e.GetAttribute(o,a)}else{let r=s[t];n=e.GetAttributeByUniqueId(o,r)}i[t]=p(o,e,n)}return r.destroy(o),r.destroy(e),i}function g(t){let e=new r.Decoder;if(t.dequantizeInShader)for(let n=0;n<t.attributesToSkipTransform.length;++n)e.SkipAttributeTransform(r[t.attributesToSkipTransform[n]]);let n=t.bufferView,o=new r.DecoderBuffer;if(o.Init(t.array,n.byteLength),e.GetEncodedGeometryType(o)!==r.TRIANGULAR_MESH)throw new A("Unsupported draco mesh geometry type.");let a=new r.Mesh,i=e.DecodeBufferToMesh(o,a);if(!i.ok()||0===a.ptr)throw new A(`Error decoding draco mesh geometry: ${i.error_msg()}`);r.destroy(o);let s={},u=t.compressedAttributes;for(let t in u)if(u.hasOwnProperty(t)){let r=u[t],n=e.GetAttributeByUniqueId(a,r);s[t]=p(a,e,n)}let l={indexArray:F(a,e),attributeData:s};return r.destroy(a),r.destroy(e),l}async function z(t,r){return d(t.bufferView)?g(t):O(t)}async function G(t,e){let n=t.webAssemblyConfig;return r=d(n)&&d(n.wasmBinaryFile)?await(0,b.default)(n):await(0,b.default)(),!0}async function S(t,r){let e=t.webAssemblyConfig;return d(e)?G(t,r):z(t,r)}var h=I(S);export{h as default};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.95
4
+ * Version 1.143.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -22,4 +22,4 @@
22
22
  * Portions licensed separately.
23
23
  * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
24
  */
25
- define(["./RuntimeError-4f8ec8a2","./defaultValue-97284df2","./_commonjsHelpers-3aae1032-65601a27","./createTaskProcessorWorker"],(function(e,t,n,i){"use strict";function r(t,n){if(r.passThroughDataForTesting)return n;const i=t.byteLength;if(0===i||i%4!=0)throw new e.RuntimeError("The length of key must be greater than 0 and a multiple of 4.");const a=new DataView(n),o=a.getUint32(0,!0);if(1953029805===o||2917034100===o)return n;const s=new DataView(t);let f=0;const l=n.byteLength,d=l-l%8,h=i;let c,u=8;for(;f<d;)for(u=(u+8)%24,c=u;f<d&&c<h;)a.setUint32(f,a.getUint32(f,!0)^s.getUint32(c,!0),!0),a.setUint32(f+4,a.getUint32(f+4,!0)^s.getUint32(c+4,!0),!0),f+=8,c+=24;if(f<l)for(c>=h&&(u=(u+8)%24,c=u);f<l;)a.setUint8(f,a.getUint8(f)^s.getUint8(c)),f++,c++}function a(e,t){return 0!=(e&t)}r.passThroughDataForTesting=!1;const o=[1,2,4,8];function s(e,t,n,i,r,a){this._bits=e,this.cnodeVersion=t,this.imageryVersion=n,this.terrainVersion=i,this.imageryProvider=r,this.terrainProvider=a,this.ancestorHasTerrain=!1,this.terrainState=void 0}s.clone=function(e,n){return t.defined(n)?(n._bits=e._bits,n.cnodeVersion=e.cnodeVersion,n.imageryVersion=e.imageryVersion,n.terrainVersion=e.terrainVersion,n.imageryProvider=e.imageryProvider,n.terrainProvider=e.terrainProvider):n=new s(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),n.ancestorHasTerrain=e.ancestorHasTerrain,n.terrainState=e.terrainState,n},s.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},s.prototype.hasSubtree=function(){return a(this._bits,16)},s.prototype.hasImagery=function(){return a(this._bits,64)},s.prototype.hasTerrain=function(){return a(this._bits,128)},s.prototype.hasChildren=function(){return a(this._bits,15)},s.prototype.hasChild=function(e){return a(this._bits,o[e])},s.prototype.getChildBitmask=function(){return 15&this._bits};var f=n.createCommonjsModule((function(e,t){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),r);else for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){var t,n,i,r,a,o;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,r),r+=a.length;return o}},a={arraySet:function(e,t,n,i,r){for(var a=0;a<i;a++)e[r+a]=t[n+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(n)})),l=function(e,t,n,i){for(var r=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(r=r+t[i++]|0)|0}while(--o);r%=65521,a%=65521}return r|a<<16|0},d=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}(),h=function(e,t,n,i){var r=d,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[255&(e^t[o])];return-1^e},c=function(e,t){var n,i,r,a,o,s,f,l,d,h,c,u,w,m,b,g,k,v,p,y,_,x,B,E,A;n=e.state,i=e.next_in,E=e.input,r=i+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),f=n.dmax,l=n.wsize,d=n.whave,h=n.wnext,c=n.window,u=n.hold,w=n.bits,m=n.lencode,b=n.distcode,g=(1<<n.lenbits)-1,k=(1<<n.distbits)-1;e:do{w<15&&(u+=E[i++]<<w,w+=8,u+=E[i++]<<w,w+=8),v=m[u&g];t:for(;;){if(u>>>=p=v>>>24,w-=p,0==(p=v>>>16&255))A[a++]=65535&v;else{if(!(16&p)){if(0==(64&p)){v=m[(65535&v)+(u&(1<<p)-1)];continue t}if(32&p){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}y=65535&v,(p&=15)&&(w<p&&(u+=E[i++]<<w,w+=8),y+=u&(1<<p)-1,u>>>=p,w-=p),w<15&&(u+=E[i++]<<w,w+=8,u+=E[i++]<<w,w+=8),v=b[u&k];n:for(;;){if(u>>>=p=v>>>24,w-=p,!(16&(p=v>>>16&255))){if(0==(64&p)){v=b[(65535&v)+(u&(1<<p)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(_=65535&v,w<(p&=15)&&(u+=E[i++]<<w,(w+=8)<p&&(u+=E[i++]<<w,w+=8)),(_+=u&(1<<p)-1)>f){e.msg="invalid distance too far back",n.mode=30;break e}if(u>>>=p,w-=p,_>(p=a-o)){if((p=_-p)>d&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(x=0,B=c,0===h){if(x+=l-p,p<y){y-=p;do{A[a++]=c[x++]}while(--p);x=a-_,B=A}}else if(h<p){if(x+=l+h-p,(p-=h)<y){y-=p;do{A[a++]=c[x++]}while(--p);if(x=0,h<y){y-=p=h;do{A[a++]=c[x++]}while(--p);x=a-_,B=A}}}else if(x+=h-p,p<y){y-=p;do{A[a++]=c[x++]}while(--p);x=a-_,B=A}for(;y>2;)A[a++]=B[x++],A[a++]=B[x++],A[a++]=B[x++],y-=3;y&&(A[a++]=B[x++],y>1&&(A[a++]=B[x++]))}else{x=a-_;do{A[a++]=A[x++],A[a++]=A[x++],A[a++]=A[x++],y-=3}while(y>2);y&&(A[a++]=A[x++],y>1&&(A[a++]=A[x++]))}break}}break}}while(i<r&&a<s);i-=y=w>>3,u&=(1<<(w-=y<<3))-1,e.next_in=i,e.next_out=a,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=a<s?s-a+257:257-(a-s),n.hold=u,n.bits=w},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],w=[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],m=[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],b=[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],g=function(e,t,n,i,r,a,o,s){var l,d,h,c,g,k,v,p,y,_=s.bits,x=0,B=0,E=0,A=0,T=0,U=0,S=0,R=0,C=0,I=0,z=null,D=0,V=new f.Buf16(16),P=new f.Buf16(16),O=null,j=0;for(x=0;x<=15;x++)V[x]=0;for(B=0;B<i;B++)V[t[n+B]]++;for(T=_,A=15;A>=1&&0===V[A];A--);if(T>A&&(T=A),0===A)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(E=1;E<A&&0===V[E];E++);for(T<E&&(T=E),R=1,x=1;x<=15;x++)if(R<<=1,(R-=V[x])<0)return-1;if(R>0&&(0===e||1!==A))return-1;for(P[1]=0,x=1;x<15;x++)P[x+1]=P[x]+V[x];for(B=0;B<i;B++)0!==t[n+B]&&(o[P[t[n+B]]++]=B);if(0===e?(z=O=o,k=19):1===e?(z=u,D-=257,O=w,j-=257,k=256):(z=m,O=b,k=-1),I=0,B=0,x=E,g=a,U=T,S=0,h=-1,c=(C=1<<T)-1,1===e&&C>852||2===e&&C>592)return 1;for(;;){v=x-S,o[B]<k?(p=0,y=o[B]):o[B]>k?(p=O[j+o[B]],y=z[D+o[B]]):(p=96,y=0),l=1<<x-S,E=d=1<<U;do{r[g+(I>>S)+(d-=l)]=v<<24|p<<16|y|0}while(0!==d);for(l=1<<x-1;I&l;)l>>=1;if(0!==l?(I&=l-1,I+=l):I=0,B++,0==--V[x]){if(x===A)break;x=t[n+o[B]]}if(x>T&&(I&c)!==h){for(0===S&&(S=T),g+=E,R=1<<(U=x-S);U+S<A&&!((R-=V[U+S])<=0);)U++,R<<=1;if(C+=1<<U,1===e&&C>852||2===e&&C>592)return 1;r[h=I&c]=T<<24|U<<16|g-a|0}}return 0!==I&&(r[g+I]=x-S<<24|64<<16|0),s.bits=T,0},k=-2,v=12,p=30;function y(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function _(){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=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(e){var t;return e&&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=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new f.Buf32(852),t.distcode=t.distdyn=new f.Buf32(592),t.sane=1,t.back=-1,0):k}function B(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,x(e)):k}function E(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?k:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,B(e))):k}function A(e,t){var n,i;return e?(i=new _,e.state=i,i.window=null,0!==(n=E(e,t))&&(e.state=null),n):k}var T,U,S=!0;function R(e){if(S){var t;for(T=new f.Buf32(512),U=new f.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(g(1,e.lens,0,288,T,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;g(2,e.lens,0,32,U,0,e.work,{bits:5}),S=!1}e.lencode=T,e.lenbits=9,e.distcode=U,e.distbits=5}function C(e,t,n,i){var r,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new f.Buf8(a.wsize)),i>=a.wsize?(f.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((r=a.wsize-a.wnext)>i&&(r=i),f.arraySet(a.window,t,n-i,r,a.wnext),(i-=r)?(f.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}var I={inflateReset:B,inflateReset2:E,inflateResetKeep:x,inflateInit:function(e){return A(e,15)},inflateInit2:A,inflate:function(e,t){var n,i,r,a,o,s,d,u,w,m,b,_,x,B,E,A,T,U,S,I,z,D,V,P,O=0,j=new f.Buf8(4),M=[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)return k;(n=e.state).mode===v&&(n.mode=13),o=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,u=n.hold,w=n.bits,m=s,b=d,D=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;w<16;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(2&n.wrap&&35615===u){n.check=0,j[0]=255&u,j[1]=u>>>8&255,n.check=h(n.check,j,2,0),u=0,w=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=p;break}if(8!=(15&u)){e.msg="unknown compression method",n.mode=p;break}if(w-=4,z=8+(15&(u>>>=4)),0===n.wbits)n.wbits=z;else if(z>n.wbits){e.msg="invalid window size",n.mode=p;break}n.dmax=1<<z,e.adler=n.check=1,n.mode=512&u?10:v,u=0,w=0;break;case 2:for(;w<16;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(n.flags=u,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=p;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=p;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&(j[0]=255&u,j[1]=u>>>8&255,n.check=h(n.check,j,2,0)),u=0,w=0,n.mode=3;case 3:for(;w<32;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.head&&(n.head.time=u),512&n.flags&&(j[0]=255&u,j[1]=u>>>8&255,j[2]=u>>>16&255,j[3]=u>>>24&255,n.check=h(n.check,j,4,0)),u=0,w=0,n.mode=4;case 4:for(;w<16;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&(j[0]=255&u,j[1]=u>>>8&255,n.check=h(n.check,j,2,0)),u=0,w=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&(j[0]=255&u,j[1]=u>>>8&255,n.check=h(n.check,j,2,0)),u=0,w=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((_=n.length)>s&&(_=s),_&&(n.head&&(z=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),f.arraySet(n.head.extra,i,a,_,z)),512&n.flags&&(n.check=h(n.check,i,_,a)),s-=_,a+=_,n.length-=_),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;_=0;do{z=i[a+_++],n.head&&z&&n.length<65536&&(n.head.name+=String.fromCharCode(z))}while(z&&_<s);if(512&n.flags&&(n.check=h(n.check,i,_,a)),s-=_,a+=_,z)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;_=0;do{z=i[a+_++],n.head&&z&&n.length<65536&&(n.head.comment+=String.fromCharCode(z))}while(z&&_<s);if(512&n.flags&&(n.check=h(n.check,i,_,a)),s-=_,a+=_,z)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;w<16;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=p;break}u=0,w=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=v;break;case 10:for(;w<32;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}e.adler=n.check=y(u),u=0,w=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=d,e.next_in=a,e.avail_in=s,n.hold=u,n.bits=w,2;e.adler=n.check=1,n.mode=v;case v:if(5===t||6===t)break e;case 13:if(n.last){u>>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}switch(n.last=1&u,w-=1,3&(u>>>=1)){case 0:n.mode=14;break;case 1:if(R(n),n.mode=20,6===t){u>>>=2,w-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=p}u>>>=2,w-=2;break;case 14:for(u>>>=7&w,w-=7&w;w<32;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=p;break}if(n.length=65535&u,u=0,w=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(_=n.length){if(_>s&&(_=s),_>d&&(_=d),0===_)break e;f.arraySet(r,i,a,_,o),s-=_,a+=_,d-=_,o+=_,n.length-=_;break}n.mode=v;break;case 17:for(;w<14;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(n.nlen=257+(31&u),u>>>=5,w-=5,n.ndist=1+(31&u),u>>>=5,w-=5,n.ncode=4+(15&u),u>>>=4,w-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=p;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;w<3;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.lens[M[n.have++]]=7&u,u>>>=3,w-=3}for(;n.have<19;)n.lens[M[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,V={bits:n.lenbits},D=g(0,n.lens,0,19,n.lencode,0,n.work,V),n.lenbits=V.bits,D){e.msg="invalid code lengths set",n.mode=p;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;A=(O=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(T<16)u>>>=E,w-=E,n.lens[n.have++]=T;else{if(16===T){for(P=E+2;w<P;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(u>>>=E,w-=E,0===n.have){e.msg="invalid bit length repeat",n.mode=p;break}z=n.lens[n.have-1],_=3+(3&u),u>>>=2,w-=2}else if(17===T){for(P=E+3;w<P;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}w-=E,z=0,_=3+(7&(u>>>=E)),u>>>=3,w-=3}else{for(P=E+7;w<P;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}w-=E,z=0,_=11+(127&(u>>>=E)),u>>>=7,w-=7}if(n.have+_>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=p;break}for(;_--;)n.lens[n.have++]=z}}if(n.mode===p)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=p;break}if(n.lenbits=9,V={bits:n.lenbits},D=g(1,n.lens,0,n.nlen,n.lencode,0,n.work,V),n.lenbits=V.bits,D){e.msg="invalid literal/lengths set",n.mode=p;break}if(n.distbits=6,n.distcode=n.distdyn,V={bits:n.distbits},D=g(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,V),n.distbits=V.bits,D){e.msg="invalid distances set",n.mode=p;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&d>=258){e.next_out=o,e.avail_out=d,e.next_in=a,e.avail_in=s,n.hold=u,n.bits=w,c(e,b),o=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,u=n.hold,w=n.bits,n.mode===v&&(n.back=-1);break}for(n.back=0;A=(O=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(A&&0==(240&A)){for(U=E,S=A,I=T;A=(O=n.lencode[I+((u&(1<<U+S)-1)>>U)])>>>16&255,T=65535&O,!(U+(E=O>>>24)<=w);){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}u>>>=U,w-=U,n.back+=U}if(u>>>=E,w-=E,n.back+=E,n.length=T,0===A){n.mode=26;break}if(32&A){n.back=-1,n.mode=v;break}if(64&A){e.msg="invalid literal/length code",n.mode=p;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(P=n.extra;w<P;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(O=n.distcode[u&(1<<n.distbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(0==(240&A)){for(U=E,S=A,I=T;A=(O=n.distcode[I+((u&(1<<U+S)-1)>>U)])>>>16&255,T=65535&O,!(U+(E=O>>>24)<=w);){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}u>>>=U,w-=U,n.back+=U}if(u>>>=E,w-=E,n.back+=E,64&A){e.msg="invalid distance code",n.mode=p;break}n.offset=T,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(P=n.extra;w<P;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=p;break}n.mode=25;case 25:if(0===d)break e;if(_=b-d,n.offset>_){if((_=n.offset-_)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=p;break}_>n.wnext?(_-=n.wnext,x=n.wsize-_):x=n.wnext-_,_>n.length&&(_=n.length),B=n.window}else B=r,x=o-n.offset,_=n.length;_>d&&(_=d),d-=_,n.length-=_;do{r[o++]=B[x++]}while(--_);0===n.length&&(n.mode=21);break;case 26:if(0===d)break e;r[o++]=n.length,d--,n.mode=21;break;case 27:if(n.wrap){for(;w<32;){if(0===s)break e;s--,u|=i[a++]<<w,w+=8}if(b-=d,e.total_out+=b,n.total+=b,b&&(e.adler=n.check=n.flags?h(n.check,r,b,o-b):l(n.check,r,b,o-b)),b=d,(n.flags?u:y(u))!==n.check){e.msg="incorrect data check",n.mode=p;break}u=0,w=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;w<32;){if(0===s)break e;s--,u+=i[a++]<<w,w+=8}if(u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=p;break}u=0,w=0}n.mode=29;case 29:D=1;break e;case p:D=-3;break e;case 31:return-4;default:return k}return e.next_out=o,e.avail_out=d,e.next_in=a,e.avail_in=s,n.hold=u,n.bits=w,(n.wsize||b!==e.avail_out&&n.mode<p&&(n.mode<27||4!==t))&&C(e,e.output,e.next_out,b-e.avail_out),m-=e.avail_in,b-=e.avail_out,e.total_in+=m,e.total_out+=b,n.total+=b,n.wrap&&b&&(e.adler=n.check=n.flags?h(n.check,r,b,e.next_out-b):l(n.check,r,b,e.next_out-b)),e.data_type=n.bits+(n.last?64:0)+(n.mode===v?128:0)+(20===n.mode||15===n.mode?256:0),(0===m&&0===b||4===t)&&0===D&&(D=-5),D},inflateEnd:function(e){if(!e||!e.state)return k;var t=e.state;return t.window&&(t.window=null),e.state=null,0},inflateGetHeader:function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?k:(n.head=t,t.done=!1,0):k},inflateSetDictionary:function(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?k:11===n.mode&&l(1,t,i,0)!==n.check?-3:C(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,0):k},inflateInfo:"pako inflate (from Nodeca project)"},z=!0,D=!0;try{String.fromCharCode.apply(null,[0])}catch(e){z=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){D=!1}for(var V=new f.Buf8(256),P=0;P<256;P++)V[P]=P>=252?6:P>=248?5:P>=240?4:P>=224?3:P>=192?2:1;V[254]=V[254]=1;var O=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new f.Buf8(s),a=0,r=0;a<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},j=function(e,t){var n,i,r,a,o=t||e.length,s=new Array(2*o);for(i=0,n=0;n<o;)if((r=e[n++])<128)s[i++]=r;else if((a=V[r])>4)s[i++]=65533,n+=a-1;else{for(r&=2===a?31:3===a?15:7;a>1&&n<o;)r=r<<6|63&e[n++],a--;a>1?s[i++]=65533:r<65536?s[i++]=r:(r-=65536,s[i++]=55296|r>>10&1023,s[i++]=56320|1023&r)}return function(e,t){if(t<65534&&(e.subarray&&D||!e.subarray&&z))return String.fromCharCode.apply(null,f.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}(s,i)},M=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+V[e[n]]>t?n:t},H=0,N={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"},L=function(){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},Y=function(){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},F=Object.prototype.toString;function G(e){if(!(this instanceof G))return new G(e);this.options=f.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=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=new L,this.strm.avail_out=0;var n=I.inflateInit2(this.strm,t.windowBits);if(n!==H)throw new Error(N[n]);if(this.header=new Y,I.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=O(t.dictionary):"[object ArrayBuffer]"===F.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=I.inflateSetDictionary(this.strm,t.dictionary))!==H))throw new Error(N[n])}function K(e,t){var n=new G(t);if(n.push(e,!0),n.err)throw n.msg||N[n.err];return n.result}G.prototype.push=function(e,t){var n,i,r,a,o,s=this.strm,l=this.options.chunkSize,d=this.options.dictionary,h=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=function(e){for(var t=new f.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t}(e):"[object ArrayBuffer]"===F.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new f.Buf8(l),s.next_out=0,s.avail_out=l),2===(n=I.inflate(s,0))&&d&&(n=I.inflateSetDictionary(this.strm,d)),-5===n&&!0===h&&(n=H,h=!1),1!==n&&n!==H)return this.onEnd(n),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&1!==n&&(0!==s.avail_in||4!==i&&2!==i)||("string"===this.options.to?(r=M(s.output,s.next_out),a=s.next_out-r,o=j(s.output,r),s.next_out=a,s.avail_out=l-a,a&&f.arraySet(s.output,s.output,r,a,0),this.onData(o)):this.onData(f.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(h=!0)}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 1===n&&(i=4),4===i?(n=I.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===H):2!==i||(this.onEnd(H),s.avail_out=0,!0)},G.prototype.onData=function(e){this.chunks.push(e)},G.prototype.onEnd=function(e){e===H&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=f.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Q={Inflate:G,inflate:K,inflateRaw:function(e,t){return(t=t||{}).raw=!0,K(e,t)},ungzip:K};const q=Uint16Array.BYTES_PER_ELEMENT,W=Int32Array.BYTES_PER_ELEMENT,J=Uint32Array.BYTES_PER_ELEMENT,X={METADATA:0,TERRAIN:1,DBROOT:2,fromString:function(e){return"Metadata"===e?X.METADATA:"Terrain"===e?X.TERRAIN:"DbRoot"===e?X.DBROOT:void 0}},Z=1953029805;return i((function(t,n){const i=X.fromString(t.type);let a=t.buffer;r(t.key,a);const o=function(t){const n=new DataView(t);let i=0;const r=n.getUint32(i,!0);if(i+=J,r!==Z&&2917034100!==r)throw new e.RuntimeError("Invalid magic");const a=n.getUint32(i,r===Z);i+=J;const o=new Uint8Array(t,i),s=Q.inflate(o);if(s.length!==a)throw new e.RuntimeError("Size of packet doesn't match header");return s}(a);a=o.buffer;const f=o.length;switch(i){case X.METADATA:return function(t,n,i){const r=new DataView(t);let a=0;const o=r.getUint32(a,!0);if(a+=J,32301!==o)throw new e.RuntimeError("Invalid magic");const f=r.getUint32(a,!0);if(a+=J,1!==f)throw new e.RuntimeError("Invalid data type. Must be 1 for QuadTreePacket");const l=r.getUint32(a,!0);if(a+=J,2!==l)throw new e.RuntimeError("Invalid QuadTreePacket version. Only version 2 is supported.");const d=r.getInt32(a,!0);a+=W;const h=r.getInt32(a,!0);if(a+=W,32!==h)throw new e.RuntimeError("Invalid instance size.");const c=r.getInt32(a,!0);a+=W;const u=r.getInt32(a,!0);a+=W;const w=r.getInt32(a,!0);if(a+=W,c!==d*h+a)throw new e.RuntimeError("Invalid dataBufferOffset");if(c+u+w!==n)throw new e.RuntimeError("Invalid packet offsets");const m=[];for(let e=0;e<d;++e){const e=r.getUint8(a);++a,++a;const t=r.getUint16(a,!0);a+=q;const n=r.getUint16(a,!0);a+=q;const i=r.getUint16(a,!0);a+=q,a+=q,a+=q,a+=W,a+=W,a+=8;const o=r.getUint8(a++),f=r.getUint8(a++);a+=q,m.push(new s(e,t,n,i,o,f))}const b=[];let g=0;let k=0;const v=m[g++];return""===i?++k:b[i]=v,function e(t,n,i){let r=!1;if(4===i){if(n.hasSubtree())return;r=!0}for(let a=0;a<4;++a){const o=t+a.toString();if(r)b[o]=null;else if(i<4)if(n.hasChild(a)){if(g===d)return void console.log("Incorrect number of instances");const t=m[g++];b[o]=t,e(o,t,i+1)}else b[o]=null}}(i,v,k),b}(a,f,t.quadKey);case X.TERRAIN:return function(t,n,i){const r=new DataView(t),a=function(t){for(let i=0;i<4;++i){const i=r.getUint32(t,!0);if(t+=J,(t+=i)>n)throw new e.RuntimeError("Malformed terrain packet found.")}return t};let o=0;const s=[];for(;s.length<5;){const e=o;o=a(o);const n=t.slice(e,o);i.push(n),s.push(n)}return s}(a,f,n);case X.DBROOT:return n.push(a),{buffer:a}}}))}));
25
+ import{a as Ct}from"./chunk-BKIYVF74.js";import{a as O}from"./chunk-G3GDHHWO.js";import{b as ht}from"./chunk-NZBME2JK.js";import{f as Rt}from"./chunk-6DLS2UKD.js";var Wr=1953029805,Jr=2917034100;function ct(t,e){if(ct.passThroughDataForTesting)return e;ht.typeOf.object("key",t),ht.typeOf.object("data",e);let r=t.byteLength;if(0===r||r%4!=0)throw new O("The length of key must be greater than 0 and a multiple of 4.");let a=new DataView(e),i=a.getUint32(0,!0);if(i===Wr||i===Jr)return e;let n,s=new DataView(t),o=0,l=e.byteLength,d=l-l%8,h=r,f=8;for(;o<d;)for(f=(f+8)%24,n=f;o<d&&n<h;)a.setUint32(o,a.getUint32(o,!0)^s.getUint32(n,!0),!0),a.setUint32(o+4,a.getUint32(o+4,!0)^s.getUint32(n+4,!0),!0),o+=8,n+=24;if(o<l)for(n>=h&&(f=(f+8)%24,n=f);o<l;)a.setUint8(o,a.getUint8(o)^s.getUint8(n)),o++,n++}ct.passThroughDataForTesting=!1;var Lt=ct;function Kr(t,e){return 0!=(t&e)}var F=Kr,Xr=[1,2,4,8],Nt=15,Zr=16,$r=64,ta=128;function I(t,e,r,a,i,n){this._bits=t,this.cnodeVersion=e,this.imageryVersion=r,this.terrainVersion=a,this.imageryProvider=i,this.terrainProvider=n,this.ancestorHasTerrain=!1,this.terrainState=void 0}I.clone=function(t,e){return Rt(e)?(e._bits=t._bits,e.cnodeVersion=t.cnodeVersion,e.imageryVersion=t.imageryVersion,e.terrainVersion=t.terrainVersion,e.imageryProvider=t.imageryProvider,e.terrainProvider=t.terrainProvider):e=new I(t._bits,t.cnodeVersion,t.imageryVersion,t.terrainVersion,t.imageryProvider,t.terrainProvider),e.ancestorHasTerrain=t.ancestorHasTerrain,e.terrainState=t.terrainState,e},I.prototype.setParent=function(t){this.ancestorHasTerrain=t.ancestorHasTerrain||this.hasTerrain()},I.prototype.hasSubtree=function(){return F(this._bits,Zr)},I.prototype.hasImagery=function(){return F(this._bits,$r)},I.prototype.hasTerrain=function(){return F(this._bits,ta)},I.prototype.hasChildren=function(){return F(this._bits,Nt)},I.prototype.hasChild=function(t){return F(this._bits,Xr[t])},I.prototype.getChildBitmask=function(){return this._bits&Nt};var Gt=I,Ht=0,Ft=1;function q(t){let e=t.length;for(;--e>=0;)t[e]=0}var ra=29,Bt=256,Ot=30,Ar=19,Ur=573,Tr=15,ft=16,Er=256,Sr=16,Br=17,Or=18,aa=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ia=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);var Pr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ea=512,Ir=Array(576);q(Ir);var Dr=Array(2*Ot);q(Dr);var zt=Array(ea);q(zt);var Pt=Array(256);q(Pt);var Vr=Array(ra);q(Vr);var Mr=Array(Ot);q(Mr);var jr=t=>t<256?zt[t]:zt[256+(t>>>7)],st=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},B=(t,e,r)=>{t.bi_valid>ft-r?(t.bi_buf|=e<<t.bi_valid&65535,st(t,t.bi_buf),t.bi_buf=e>>ft-t.bi_valid,t.bi_valid+=r-ft):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},j=(t,e,r)=>{B(t,r[2*e],r[2*e+1])},na=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},sa=(t,e)=>{let r,a,i,n,s,o,l=e.dyn_tree,d=e.max_code,h=e.stat_desc.static_tree,f=e.stat_desc.has_stree,_=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,u=e.stat_desc.max_length,w=0;for(n=0;n<=Tr;n++)t.bl_count[n]=0;for(l[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<Ur;r++)a=t.heap[r],n=l[2*l[2*a+1]+1]+1,n>u&&(n=u,w++),l[2*a+1]=n,!(a>d)&&(t.bl_count[n]++,s=0,a>=c&&(s=_[a-c]),o=l[2*a],t.opt_len+=o*(n+s),f&&(t.static_len+=o*(h[2*a+1]+s)));if(0!==w){do{for(n=u-1;0===t.bl_count[n];)n--;t.bl_count[n]--,t.bl_count[n+1]+=2,t.bl_count[u]--,w-=2}while(w>0);for(n=u;0!==n;n--)for(a=t.bl_count[n];0!==a;)i=t.heap[--r],!(i>d)&&(l[2*i+1]!==n&&(t.opt_len+=(n-l[2*i+1])*l[2*i],l[2*i+1]=n),a--)}},oa=(t,e,r)=>{let a,i,n=Array(16),s=0;for(a=1;a<=Tr;a++)s=s+r[a-1]<<1,n[a]=s;for(i=0;i<=e;i++){let e=t[2*i+1];0!==e&&(t[2*i]=na(n[e]++,e))}},la=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<Ot;e++)t.dyn_dtree[2*e]=0;for(e=0;e<Ar;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*Er]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Rr=t=>{t.bi_valid>8?st(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Yt=(t,e,r,a)=>{let i=2*e,n=2*r;return t[i]<t[n]||t[i]===t[n]&&a[e]<=a[r]},_t=(t,e,r)=>{let a=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&Yt(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Yt(e,a,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=a},Qt=(t,e,r)=>{let a,i,n,s,o=0;if(0!==t.sym_next)do{a=255&t.pending_buf[t.sym_buf+o++],a+=(255&t.pending_buf[t.sym_buf+o++])<<8,i=t.pending_buf[t.sym_buf+o++],0===a?j(t,i,e):(n=Pt[i],j(t,n+Bt+1,e),s=aa[n],0!==s&&(i-=Vr[n],B(t,i,s)),a--,n=jr(a),j(t,n,r),s=ia[n],0!==s&&(a-=Mr[n],B(t,a,s)))}while(o<t.sym_next);j(t,Er,e)},At=(t,e)=>{let r,a,i,n=e.dyn_tree,s=e.stat_desc.static_tree,o=e.stat_desc.has_stree,l=e.stat_desc.elems,d=-1;for(t.heap_len=0,t.heap_max=Ur,r=0;r<l;r++)0===n[2*r]?n[2*r+1]=0:(t.heap[++t.heap_len]=d=r,t.depth[r]=0);for(;t.heap_len<2;)i=t.heap[++t.heap_len]=d<2?++d:0,n[2*i]=1,t.depth[i]=0,t.opt_len--,o&&(t.static_len-=s[2*i+1]);for(e.max_code=d,r=t.heap_len>>1;r>=1;r--)_t(t,n,r);i=l;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],_t(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=a,n[2*i]=n[2*r]+n[2*a],t.depth[i]=(t.depth[r]>=t.depth[a]?t.depth[r]:t.depth[a])+1,n[2*r+1]=n[2*a+1]=i,t.heap[1]=i++,_t(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],sa(t,e),oa(n,d,t.bl_count)},qt=(t,e,r)=>{let a,i,n=-1,s=e[1],o=0,l=7,d=4;for(0===s&&(l=138,d=3),e[2*(r+1)+1]=65535,a=0;a<=r;a++)i=s,s=e[2*(a+1)+1],!(++o<l&&i===s)&&(o<d?t.bl_tree[2*i]+=o:0===i?o<=10?t.bl_tree[2*Br]++:t.bl_tree[2*Or]++:(i!==n&&t.bl_tree[2*i]++,t.bl_tree[2*Sr]++),o=0,n=i,0===s?(l=138,d=3):i===s?(l=6,d=3):(l=7,d=4))},Wt=(t,e,r)=>{let a,i,n=-1,s=e[1],o=0,l=7,d=4;for(0===s&&(l=138,d=3),a=0;a<=r;a++)if(i=s,s=e[2*(a+1)+1],!(++o<l&&i===s)){if(o<d)do{j(t,i,t.bl_tree)}while(0!=--o);else 0===i?o<=10?(j(t,Br,t.bl_tree),B(t,o-3,3)):(j(t,Or,t.bl_tree),B(t,o-11,7)):(i!==n&&(j(t,i,t.bl_tree),o--),j(t,Sr,t.bl_tree),B(t,o-3,2));o=0,n=i,0===s?(l=138,d=3):i===s?(l=6,d=3):(l=7,d=4)}},da=t=>{let e;for(qt(t,t.dyn_ltree,t.l_desc.max_code),qt(t,t.dyn_dtree,t.d_desc.max_code),At(t,t.bl_desc),e=Ar-1;e>=3&&0===t.bl_tree[2*Pr[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e},ha=(t,e,r,a)=>{let i;for(B(t,e-257,5),B(t,r-1,5),B(t,a-4,4),i=0;i<a;i++)B(t,t.bl_tree[2*Pr[i]+1],3);Wt(t,t.dyn_ltree,e-1),Wt(t,t.dyn_dtree,r-1)},ca=t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return Ht;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return Ft;for(e=32;e<Bt;e++)if(0!==t.dyn_ltree[2*e])return Ft;return Ht},Ut=(t,e,r,a)=>{B(t,+!!a+0,3),Rr(t),st(t,r),st(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},fa=(t,e,r,a)=>{let i,n,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=ca(t)),At(t,t.l_desc),At(t,t.d_desc),s=da(t),i=t.opt_len+3+7>>>3,n=t.static_len+3+7>>>3,n<=i&&(i=n)):i=n=r+5,r+4<=i&&-1!==e?Ut(t,e,r,a):4===t.strategy||n===i?(B(t,+!!a+2,3),Qt(t,Ir,Dr)):(B(t,+!!a+4,3),ha(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Qt(t,t.dyn_ltree,t.dyn_dtree)),la(t),a&&Rr(t)},X=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Pt[r]+Bt+1)]++,t.dyn_dtree[2*jr(e)]++),t.sym_next===t.sym_end),ot=(t,e,r,a)=>{let i=65535&t|0,n=t>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+e[a++]|0,n=n+i|0}while(--s);i%=65521,n%=65521}return i|n<<16|0},_a=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var a=0;a<8;a++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})()),P=(t,e,r,a)=>{let i=_a,n=a+r;t^=-1;for(let r=a;r<n;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},ut={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"},E=3,mt=258,V=262,C=1,It=2,Dt=3,Vt=4,ua=t=>{let e,r,a,i=t.w_size;e=t.hash_size,a=e;do{r=t.head[--a],t.head[a]=r>=i?r-i:0}while(--e);e=i,a=e;do{r=t.prev[--a],t.prev[a]=r>=i?r-i:0}while(--e)},Mt=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Q=(t,e)=>{let r;if(t.legacy_hash)r=t.ins_h=Mt(t,t.ins_h,t.window[e+E-1]);else{let a=t.window,i=a[e]|a[e+1]<<8|a[e+2]<<16|a[e+3]<<24;r=t.ins_h=Math.imul(i,66521)+66521>>>16&t.hash_mask}let a=t.prev[e&t.w_mask]=t.head[r];return t.head[r]=e,a},Tt=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},G=(t,e)=>{fa(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Tt(t.strm)},Et=(t,e,r,a)=>{let i=t.avail_in;return i>a&&(i=a),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=ot(t.adler,e,i,r):2===t.state.wrap&&(t.adler=P(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},Cr=(t,e)=>{let r,a,i=t.max_chain_length,n=t.strstart,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-V?t.strstart-(t.w_size-V):0,d=t.window,h=t.w_mask,f=t.prev,_=t.strstart+mt,c=d[n+s-1],u=d[n+s];t.prev_length>=t.good_match&&(i>>=2),o>t.lookahead&&(o=t.lookahead);do{if(r=e,d[r+s]===u&&d[r+s-1]===c&&d[r]===d[n]&&d[++r]===d[n+1]){n+=2,r++;do{}while(d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&d[++n]===d[++r]&&n<_);if(a=mt-(_-n),n=_-mt,a>s){if(t.match_start=e,s=a,a>=o)break;c=d[n+s-1],u=d[n+s]}}}while((e=f[e&h])>l&&0!=--i);return s<=t.lookahead?s:t.lookahead},Lr=t=>{let e,r,a,i=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=i+(i-V)&&(t.window.set(t.window.subarray(i,i+i-r),0),t.match_start-=i,t.strstart-=i,t.block_start-=i,t.insert>t.strstart&&(t.insert=t.strstart),ua(t),r+=i),0===t.strm.avail_in)break;if(e=Et(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=e,t.legacy_hash){if(t.lookahead+t.insert>=E)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=Mt(t,t.ins_h,t.window[a+1]);t.insert&&(Q(t,a),a++,t.insert--,!(t.lookahead+t.insert<E)););}else if(t.lookahead+t.insert>E)for(a=t.strstart-t.insert;t.insert&&(Q(t,a),a++,t.insert--,!(t.lookahead+t.insert<=E)););}while(t.lookahead<V&&0!==t.strm.avail_in)},ma=(t,e)=>{let r,a,i,n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,o=t.strm.avail_in;do{if(r=65535,i=t.bi_valid+42>>3,t.strm.avail_out<i||(i=t.strm.avail_out-i,a=t.strstart-t.block_start,r>a+t.strm.avail_in&&(r=a+t.strm.avail_in),r>i&&(r=i),r<n&&(0===r&&4!==e||0===e||r!==a+t.strm.avail_in)))break;s=+(4===e&&r===a+t.strm.avail_in),Ut(t,0,0,s),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Tt(t.strm),a&&(a>r&&(a=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+a),t.strm.next_out),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a,t.block_start+=a,r-=a),r&&(Et(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===s);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),s?Vt:0!==e&&4!==e&&0===t.strm.avail_in&&t.strstart===t.block_start?It:(i=t.window_size-t.strstart,t.strm.avail_in>i&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Et(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water<t.strstart&&(t.high_water=t.strstart),i=t.bi_valid+42>>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,n=i>t.w_size?t.w_size:i,a=t.strstart-t.block_start,(a>=n||(a||4===e)&&0!==e&&0===t.strm.avail_in&&a<=i)&&(r=a>i?i:a,s=+(4===e&&0===t.strm.avail_in&&r===a),Ut(t,t.block_start,r,s),t.block_start+=r,Tt(t.strm)),s?Dt:C)},wt=(t,e)=>{let r,a;for(;;){if(t.lookahead<V){if(Lr(t),t.lookahead<V&&0===e)return C;if(0===t.lookahead)break}if(r=0,t.lookahead>=E&&(r=Q(t,t.strstart)),0!==r&&t.strstart-r<=t.w_size-V&&(t.match_length=Cr(t,r)),t.match_length>=E)if(a=X(t,t.strstart-t.match_start,t.match_length-E),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=E){t.match_length--;do{t.strstart++,r=Q(t,t.strstart)}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.legacy_hash&&(t.ins_h=t.window[t.strstart],t.ins_h=Mt(t,t.ins_h,t.window[t.strstart+1]));else a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(a&&(G(t,!1),0===t.strm.avail_out))return C}return t.insert=t.strstart<E-1?t.strstart:E-1,4===e?(G(t,!0),0===t.strm.avail_out?Dt:Vt):t.sym_next&&(G(t,!1),0===t.strm.avail_out)?C:It},Y=(t,e)=>{let r,a,i;for(;;){if(t.lookahead<V){if(Lr(t),t.lookahead<V&&0===e)return C;if(0===t.lookahead)break}if(r=0,t.lookahead>=E&&(r=Q(t,t.strstart)),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=E-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-V&&(t.match_length=Cr(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===E&&t.strstart-t.match_start>4096)&&(t.match_length=E-1)),t.prev_length>=E&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-E,a=X(t,t.strstart-1-t.prev_match,t.prev_length-E),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(r=Q(t,t.strstart))}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=E-1,t.strstart++,a&&(G(t,!1),0===t.strm.avail_out))return C}else if(t.match_available){if(a=X(t,0,t.window[t.strstart-1]),a&&G(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return C}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(a=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<E-1?t.strstart:E-1,4===e?(G(t,!0),0===t.strm.avail_out?Dt:Vt):t.sym_next&&(G(t,!1),0===t.strm.avail_out)?C:It},D=class{constructor(t,e,r,a,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=a,this.func=i}};new D(0,0,0,0,ma),new D(4,4,8,4,wt),new D(4,5,16,8,wt),new D(4,6,32,32,wt),new D(4,4,16,16,Y),new D(8,16,32,32,Y),new D(8,16,128,128,Y),new D(8,32,128,256,Y),new D(32,128,258,1024,Y),new D(32,258,258,4096,Y);var at=16209,wa=16191;function ba(t,e){let r,a,i,n,s,o,l,d,h,f,_,c,u,w,m,b,g,k,p,v,y,x,T,z,A=t.state;r=t.next_in,T=t.input,a=r+(t.avail_in-5),i=t.next_out,z=t.output,n=i-(e-t.avail_out),s=i+(t.avail_out-257),o=A.dmax,l=A.wsize,d=A.whave,h=A.wnext,f=A.window,_=A.hold,c=A.bits,u=A.lencode,w=A.distcode,m=(1<<A.lenbits)-1,b=(1<<A.distbits)-1;t:do{c<15&&(_+=T[r++]<<c,c+=8,_+=T[r++]<<c,c+=8),g=u[_&m];e:for(;;){if(k=g>>>24,_>>>=k,c-=k,k=g>>>16&255,0===k)z[i++]=65535&g;else{if(!(16&k)){if(64&k){if(32&k){A.mode=wa;break t}t.msg="invalid literal/length code",A.mode=at;break t}g=u[(65535&g)+(_&(1<<k)-1)];continue e}for(p=65535&g,k&=15,k&&(c<k&&(_+=T[r++]<<c,c+=8),p+=_&(1<<k)-1,_>>>=k,c-=k),c<15&&(_+=T[r++]<<c,c+=8,_+=T[r++]<<c,c+=8),g=w[_&b];;){if(k=g>>>24,_>>>=k,c-=k,k=g>>>16&255,16&k){if(v=65535&g,k&=15,c<k&&(_+=T[r++]<<c,c+=8,c<k&&(_+=T[r++]<<c,c+=8)),v+=_&(1<<k)-1,v>o){t.msg="invalid distance too far back",A.mode=at;break t}if(_>>>=k,c-=k,k=i-n,v>k){if(k=v-k,k>d&&A.sane){t.msg="invalid distance too far back",A.mode=at;break t}if(y=0,x=f,0===h){if(y+=l-k,k<p){p-=k;do{z[i++]=f[y++]}while(--k);y=i-v,x=z}}else if(h<k){if(y+=l+h-k,k-=h,k<p){p-=k;do{z[i++]=f[y++]}while(--k);if(y=0,h<p){k=h,p-=k;do{z[i++]=f[y++]}while(--k);y=i-v,x=z}}}else if(y+=h-k,k<p){p-=k;do{z[i++]=f[y++]}while(--k);y=i-v,x=z}for(;p>2;)z[i++]=x[y++],z[i++]=x[y++],z[i++]=x[y++],p-=3;p&&(z[i++]=x[y++],p>1&&(z[i++]=x[y++]))}else{y=i-v;do{z[i++]=z[y++],z[i++]=z[y++],z[i++]=z[y++],p-=3}while(p>2);p&&(z[i++]=z[y++],p>1&&(z[i++]=z[y++]))}break}if(64&k){t.msg="invalid distance code",A.mode=at;break t}g=w[(65535&g)+(_&(1<<k)-1)]}}break}}while(r<a&&i<s);p=c>>3,r-=p,c-=p<<3,_&=(1<<c)-1,t.next_in=r,t.next_out=i,t.avail_in=r<a?a-r+5:5-(r-a),t.avail_out=i<s?s-i+257:257-(i-s),A.hold=_,A.bits=c}var vt,yt,it=15,Jt=852,Kt=592,Xt=0,bt=1,Zt=2,pa=new Uint16Array([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]),ga=new Uint8Array([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,199,75]),ka=new Uint16Array([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]),va=new Uint8Array([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]),Z=(t,e,r,a,i,n,s,o)=>{let l,d,h,f,_,c,u,w,m,b=o.bits,g=0,k=0,p=0,v=0,y=0,x=0,T=0,z=0,A=0,E=0,U=null,B=new Uint16Array(16),I=new Uint16Array(16),D=null;for(g=0;g<=it;g++)B[g]=0;for(k=0;k<a;k++)B[e[r+k]]++;for(y=b,v=it;v>=1&&0===B[v];v--);if(y>v&&(y=v),0===v)return i[n++]=20971520,i[n++]=20971520,o.bits=1,0;for(p=1;p<v&&0===B[p];p++);for(y<p&&(y=p),z=1,g=1;g<=it;g++)if(z<<=1,z-=B[g],z<0)return-1;if(z>0&&(t===Xt||1!==v))return-1;for(I[1]=0,g=1;g<it;g++)I[g+1]=I[g]+B[g];for(k=0;k<a;k++)0!==e[r+k]&&(s[I[e[r+k]]++]=k);if(t===Xt?(U=D=s,c=20):t===bt?(U=pa,D=ga,c=257):(U=ka,D=va,c=0),E=0,k=0,g=p,_=n,x=y,T=0,h=-1,A=1<<y,f=A-1,t===bt&&A>Jt||t===Zt&&A>Kt)return 1;for(;;){u=g-T,s[k]+1<c?(w=0,m=s[k]):s[k]>=c?(w=D[s[k]-c],m=U[s[k]-c]):(w=96,m=0),l=1<<g-T,d=1<<x,p=d;do{d-=l,i[_+(E>>T)+d]=u<<24|w<<16|m|0}while(0!==d);for(l=1<<g-1;E&l;)l>>=1;if(0===l?E=0:(E&=l-1,E+=l),k++,0==--B[g]){if(g===v)break;g=e[r+s[k]]}if(g>y&&(E&f)!==h){for(0===T&&(T=y),_+=p,x=g-T,z=1<<x;x+T<v&&(z-=B[x+T],!(z<=0));)x++,z<<=1;if(A+=1<<x,t===bt&&A>Jt||t===Zt&&A>Kt)return 1;h=E&f,i[h]=y<<24|x<<16|_-n|0}}return 0!==E&&(i[_+E]=g-T<<24|4194304),o.bits=y,0},ya=0,Nr=1,Gr=2,dt=16180,$t=16181,tr=16182,rr=16183,ar=16184,ir=16185,er=16186,nr=16187,sr=16188,or=16189,lt=16190,M=16191,pt=16192,lr=16193,gt=16194,dr=16195,hr=16196,cr=16197,fr=16198,et=16199,nt=16200,_r=16201,ur=16202,mr=16203,wr=16204,br=16205,kt=16206,pr=16207,gr=16208,T=16209,St=16210,Hr=16211,xa=852,za=592,kr=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24),Aa=class{constructor(){this.strm=null,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=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}},W=t=>{if(!t)return 1;let e=t.state;return+(!e||e.strm!==t||e.mode<dt||e.mode>Hr)},Ua=t=>{if(W(t))return-2;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=dt,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(xa),e.distcode=e.distdyn=new Int32Array(za),e.sane=1,e.back=-1,0},Fr=t=>{if(W(t))return-2;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Ua(t)},Ta=(t,e)=>{let r;if(W(t))return-2;let a=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==a.window&&a.wbits!==e&&(a.window=null),a.wrap=r,a.wbits=e,Fr(t))},Ea=(t,e)=>{if(!t)return-2;let r=new Aa;t.state=r,r.strm=t,r.window=null,r.mode=dt;let a=Ta(t,e);return 0!==a&&(t.state=null),a},vr=!0,Sa=t=>{if(vr){vt=new Int32Array(512),yt=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Z(Nr,t.lens,0,288,vt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Z(Gr,t.lens,0,32,yt,0,t.work,{bits:5}),vr=!1}t.lencode=vt,t.lenbits=9,t.distcode=yt,t.distbits=5},Yr=(t,e,r,a)=>{let i,n=t.state;return null===n.window&&(n.window=new Uint8Array(1<<n.wbits)),0===n.wsize&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0),a>=n.wsize?(n.window.set(e.subarray(r-n.wsize,r),0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>a&&(i=a),n.window.set(e.subarray(r-a,r-a+i),n.wnext),(a-=i)?(n.window.set(e.subarray(r-a,r),0),n.wnext=a,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0},xt=(t,e)=>{let r,a,i,n,s,o,l,d,h,f,_,c,u,w,m,b,g,k,p,v,y,x,z,A,E=0,U=new Uint8Array(4),B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(W(t)||!t.output||!t.input&&0!==t.avail_in)return-2;r=t.state,r.mode===M&&(r.mode=pt),s=t.next_out,i=t.output,l=t.avail_out,n=t.next_in,a=t.input,o=t.avail_in,d=r.hold,h=r.bits,f=o,_=l,x=0;t:for(;;)switch(r.mode){case dt:if(0===r.wrap){r.mode=pt;break}for(;h<16;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(2&r.wrap&&35615===d){0===r.wbits&&(r.wbits=15),r.check=0,U[0]=255&d,U[1]=d>>>8&255,r.check=P(r.check,U,2,0),d=0,h=0,r.mode=$t;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",r.mode=T;break}if(8!=(15&d)){t.msg="unknown compression method",r.mode=T;break}if(d>>>=4,h-=4,y=8+(15&d),0===r.wbits&&(r.wbits=y),y>15||y>r.wbits){t.msg="invalid window size",r.mode=T;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&d?or:M,d=0,h=0;break;case $t:for(;h<16;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(r.flags=d,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=T;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=T;break}r.head&&(r.head.text=d>>8&1),512&r.flags&&4&r.wrap&&(U[0]=255&d,U[1]=d>>>8&255,r.check=P(r.check,U,2,0)),d=0,h=0,r.mode=tr;case tr:for(;h<32;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.head&&(r.head.time=d),512&r.flags&&4&r.wrap&&(U[0]=255&d,U[1]=d>>>8&255,U[2]=d>>>16&255,U[3]=d>>>24&255,r.check=P(r.check,U,4,0)),d=0,h=0,r.mode=rr;case rr:for(;h<16;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.head&&(r.head.xflags=255&d,r.head.os=d>>8),512&r.flags&&4&r.wrap&&(U[0]=255&d,U[1]=d>>>8&255,r.check=P(r.check,U,2,0)),d=0,h=0,r.mode=ar;case ar:if(1024&r.flags){for(;h<16;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.length=d,r.head&&(r.head.extra_len=d),512&r.flags&&4&r.wrap&&(U[0]=255&d,U[1]=d>>>8&255,r.check=P(r.check,U,2,0)),d=0,h=0}else r.head&&(r.head.extra=null);r.mode=ir;case ir:if(1024&r.flags&&(c=r.length,c>o&&(c=o),c&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(a.subarray(n,n+c),y)),512&r.flags&&4&r.wrap&&(r.check=P(r.check,a,c,n)),o-=c,n+=c,r.length-=c),r.length))break t;r.length=0,r.mode=er;case er:if(2048&r.flags){if(0===o)break t;c=0;do{y=a[n+c++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y))}while(y&&c<o);if(512&r.flags&&4&r.wrap&&(r.check=P(r.check,a,c,n)),o-=c,n+=c,y)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=nr;case nr:if(4096&r.flags){if(0===o)break t;c=0;do{y=a[n+c++],r.head&&y&&r.length<65536&&(r.head.comment+=String.fromCharCode(y))}while(y&&c<o);if(512&r.flags&&4&r.wrap&&(r.check=P(r.check,a,c,n)),o-=c,n+=c,y)break t}else r.head&&(r.head.comment=null);r.mode=sr;case sr:if(512&r.flags){for(;h<16;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(4&r.wrap&&d!==(65535&r.check)){t.msg="header crc mismatch",r.mode=T;break}d=0,h=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=M;break;case or:for(;h<32;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}t.adler=r.check=kr(d),d=0,h=0,r.mode=lt;case lt:if(0===r.havedict)return t.next_out=s,t.avail_out=l,t.next_in=n,t.avail_in=o,r.hold=d,r.bits=h,2;t.adler=r.check=1,r.mode=M;case M:if(5===e||6===e)break t;case pt:if(r.last){d>>>=7&h,h-=7&h,r.mode=kt;break}for(;h<3;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}switch(r.last=1&d,d>>>=1,--h,3&d){case 0:r.mode=lr;break;case 1:if(Sa(r),r.mode=et,6===e){d>>>=2,h-=2;break t}break;case 2:r.mode=hr;break;case 3:t.msg="invalid block type",r.mode=T}d>>>=2,h-=2;break;case lr:for(d>>>=7&h,h-=7&h;h<32;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if((65535&d)!=(d>>>16^65535)){t.msg="invalid stored block lengths",r.mode=T;break}if(r.length=65535&d,d=0,h=0,r.mode=gt,6===e)break t;case gt:r.mode=dr;case dr:if(c=r.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;i.set(a.subarray(n,n+c),s),o-=c,n+=c,l-=c,s+=c,r.length-=c;break}r.mode=M;break;case hr:for(;h<14;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(r.nlen=257+(31&d),d>>>=5,h-=5,r.ndist=1+(31&d),d>>>=5,h-=5,r.ncode=4+(15&d),d>>>=4,h-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=T;break}r.have=0,r.mode=cr;case cr:for(;r.have<r.ncode;){for(;h<3;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.lens[B[r.have++]]=7&d,d>>>=3,h-=3}for(;r.have<19;)r.lens[B[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,z={bits:r.lenbits},x=Z(ya,r.lens,0,19,r.lencode,0,r.work,z),r.lenbits=z.bits,x){t.msg="invalid code lengths set",r.mode=T;break}r.have=0,r.mode=fr;case fr:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[d&(1<<r.lenbits)-1],m=E>>>24,b=E>>>16&255,g=65535&E,!(m<=h);){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(g<16)d>>>=m,h-=m,r.lens[r.have++]=g;else{if(16===g){for(A=m+2;h<A;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(d>>>=m,h-=m,0===r.have){t.msg="invalid bit length repeat",r.mode=T;break}y=r.lens[r.have-1],c=3+(3&d),d>>>=2,h-=2}else if(17===g){for(A=m+3;h<A;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}d>>>=m,h-=m,y=0,c=3+(7&d),d>>>=3,h-=3}else{for(A=m+7;h<A;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}d>>>=m,h-=m,y=0,c=11+(127&d),d>>>=7,h-=7}if(r.have+c>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=T;break}for(;c--;)r.lens[r.have++]=y}}if(r.mode===T)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=T;break}if(r.lenbits=9,z={bits:r.lenbits},x=Z(Nr,r.lens,0,r.nlen,r.lencode,0,r.work,z),r.lenbits=z.bits,x){t.msg="invalid literal/lengths set",r.mode=T;break}if(r.distbits=6,r.distcode=r.distdyn,z={bits:r.distbits},x=Z(Gr,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,z),r.distbits=z.bits,x){t.msg="invalid distances set",r.mode=T;break}if(r.mode=et,6===e)break t;case et:r.mode=nt;case nt:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=n,t.avail_in=o,r.hold=d,r.bits=h,ba(t,_),s=t.next_out,i=t.output,l=t.avail_out,n=t.next_in,a=t.input,o=t.avail_in,d=r.hold,h=r.bits,r.mode===M&&(r.back=-1);break}for(r.back=0;E=r.lencode[d&(1<<r.lenbits)-1],m=E>>>24,b=E>>>16&255,g=65535&E,!(m<=h);){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(b&&!(240&b)){for(k=m,p=b,v=g;E=r.lencode[v+((d&(1<<k+p)-1)>>k)],m=E>>>24,b=E>>>16&255,g=65535&E,!(k+m<=h);){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}d>>>=k,h-=k,r.back+=k}if(d>>>=m,h-=m,r.back+=m,r.length=g,0===b){r.mode=br;break}if(32&b){r.back=-1,r.mode=M;break}if(64&b){t.msg="invalid literal/length code",r.mode=T;break}r.extra=15&b,r.mode=_r;case _r:if(r.extra){for(A=r.extra;h<A;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,h-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=ur;case ur:for(;E=r.distcode[d&(1<<r.distbits)-1],m=E>>>24,b=E>>>16&255,g=65535&E,!(m<=h);){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(!(240&b)){for(k=m,p=b,v=g;E=r.distcode[v+((d&(1<<k+p)-1)>>k)],m=E>>>24,b=E>>>16&255,g=65535&E,!(k+m<=h);){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}d>>>=k,h-=k,r.back+=k}if(d>>>=m,h-=m,r.back+=m,64&b){t.msg="invalid distance code",r.mode=T;break}r.offset=g,r.extra=15&b,r.mode=mr;case mr:if(r.extra){for(A=r.extra;h<A;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,h-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=T;break}r.mode=wr;case wr:if(0===l)break t;if(c=_-l,r.offset>c){if(c=r.offset-c,c>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=T;break}c>r.wnext?(c-=r.wnext,u=r.wsize-c):u=r.wnext-c,c>r.length&&(c=r.length),w=r.window}else w=i,u=s-r.offset,c=r.length;c>l&&(c=l),l-=c,r.length-=c;do{i[s++]=w[u++]}while(--c);0===r.length&&(r.mode=nt);break;case br:if(0===l)break t;i[s++]=r.length,l--,r.mode=nt;break;case kt:if(r.wrap){for(;h<32;){if(0===o)break t;o--,d|=a[n++]<<h,h+=8}if(_-=l,t.total_out+=_,r.total+=_,4&r.wrap&&_&&(t.adler=r.check=r.flags?P(r.check,i,_,s-_):ot(r.check,i,_,s-_)),_=l,4&r.wrap&&(r.flags?d:kr(d))!==r.check){t.msg="incorrect data check",r.mode=T;break}d=0,h=0}r.mode=pr;case pr:if(r.wrap&&r.flags){for(;h<32;){if(0===o)break t;o--,d+=a[n++]<<h,h+=8}if(4&r.wrap&&d!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=T;break}d=0,h=0}r.mode=gr;case gr:x=1;break t;case T:x=-3;break t;case St:return-4;default:return-2}return t.next_out=s,t.avail_out=l,t.next_in=n,t.avail_in=o,r.hold=d,r.bits=h,(r.wsize||_!==t.avail_out&&r.mode<T&&(r.mode<kt||4!==e))&&Yr(t,t.output,t.next_out,_-t.avail_out)?(r.mode=St,-4):(f-=t.avail_in,_-=t.avail_out,t.total_in+=f,t.total_out+=_,r.total+=_,4&r.wrap&&_&&(t.adler=r.check=r.flags?P(r.check,i,_,t.next_out-_):ot(r.check,i,_,t.next_out-_)),t.data_type=r.bits+(r.last?64:0)+(r.mode===M?128:0)+(r.mode===et||r.mode===gt?256:0),(0===f&&0===_||4===e)&&0===x&&(x=-5),x)},yr=t=>{if(W(t))return-2;let e=t.state;return e.window&&(e.window=null),t.state=null,0},xr=(t,e)=>{let r,a,i,n=e.length;return W(t)||(r=t.state,0!==r.wrap&&r.mode!==lt)?-2:r.mode===lt&&(a=1,a=ot(a,e,n,0),a!==r.check)?-3:(i=Yr(t,e,n,n),i?(r.mode=St,-4):(r.havedict=1,0))},Ba=class{constructor(){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}},Oa=t=>{let e=new Uint8Array(t.reduce(((t,e)=>t+e.length),0)),r=0;for(let a of t)e.set(a,r),r+=a.length;return e};function $(t){return($="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Pa(t,e){if("object"!=$(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var a=r.call(t,e||"default");if("object"!=$(a))return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function Ia(t){var e=Pa(t,"string");return"symbol"==$(e)?e:e+""}function R(t,e,r){return(e=Ia(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var zr=Object.prototype.toString,Da={chunkSize:65536,windowBits:15,raw:!1,dictionary:new Uint8Array},Va=class{constructor(t={}){R(this,"options",void 0),R(this,"err",void 0),R(this,"msg",void 0),R(this,"ended",void 0),R(this,"started",void 0),R(this,"chunks",void 0),R(this,"strm",void 0),R(this,"result",void 0),this.options=Object.assign({},Da,t);let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!t.windowBits&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array,this.strm=new Ba,this.strm.avail_out=0;let r=Ea(this.strm,e.windowBits);if(0!==r)throw Error(ut[r]);"[object ArrayBuffer]"===zr.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary));let a=e.dictionary;if(e.raw&&a.length&&(r=xr(this.strm,a),0!==r))throw Error(ut[r])}push(t,e=!1){let r,a,i,n=this.strm,s=this.options.chunkSize;if(this.ended)return 0===this.err;for(a="number"==typeof e?e:!0===e?4:0,"[object ArrayBuffer]"===zr.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length,this.started||(this.started=!0,this.onStart(n));;){if(0===n.avail_out&&(n.output=new Uint8Array(s),n.next_out=0,n.avail_out=s),r=xt(n,a),2===r){let t=this.options.dictionary;t.length&&(r=xr(n,t),0===r?r=xt(n,a):-3===r&&(r=2))}for(;n.avail_in>0&&1===r&&2&n.state.wrap&&0!==n.state.flags&&0!==n.input[n.next_in];)Fr(n),r=xt(n,a);if(-2===r||-3===r||2===r||-4===r)break;if(i=n.avail_out,n.next_out&&(0===n.avail_out||1===r||a>0)&&(this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out)),n.avail_out=0,n.next_out=0),0!==r&&-5!==r||0!==i){if(1===r){r=yr(this.strm);break}if(0===n.avail_in){if(4===a){r=yr(this.strm),0===r&&(r=-5);break}return!0}}}return this.err=r,this.msg=n.msg||ut[r],this.ended=!0,this.onEnd(r),0===r}onStart(t){}onData(t){this.chunks.push(t)}onEnd(t){0===t&&(this.result=Oa(this.chunks)),this.chunks=[]}};function Qr(t,e={}){let r=new Va(e);if(r.push(t,!0),r.err)throw Error(r.msg);let a=r.result;return e.toText?(new TextDecoder).decode(a):a}var J=Uint16Array.BYTES_PER_ELEMENT,H=Int32Array.BYTES_PER_ELEMENT,K=Uint32Array.BYTES_PER_ELEMENT,L={METADATA:0,TERRAIN:1,DBROOT:2};function Ma(t,e){let r=L.fromString(t.type),a=t.buffer;Lt(t.key,a);let i=Ha(a);a=i.buffer;let n=i.length;switch(r){case L.METADATA:return Ra(a,n,t.quadKey);case L.TERRAIN:return Na(a,n,e);case L.DBROOT:return e.push(a),{buffer:a}}}L.fromString=function(t){return"Metadata"===t?L.METADATA:"Terrain"===t?L.TERRAIN:"DbRoot"===t?L.DBROOT:void 0};var ja=32301;function Ra(t,e,r){let a=new DataView(t),i=0,n=a.getUint32(i,!0);if(i+=K,n!==ja)throw new O("Invalid magic");let s=a.getUint32(i,!0);if(i+=K,1!==s)throw new O("Invalid data type. Must be 1 for QuadTreePacket");let o=a.getUint32(i,!0);if(i+=K,2!==o)throw new O("Invalid QuadTreePacket version. Only version 2 is supported.");let l=a.getInt32(i,!0);i+=H;let d=a.getInt32(i,!0);if(i+=H,32!==d)throw new O("Invalid instance size.");let h=a.getInt32(i,!0);i+=H;let f=a.getInt32(i,!0);i+=H;let _=a.getInt32(i,!0);if(i+=H,h!==l*d+i)throw new O("Invalid dataBufferOffset");if(h+f+_!==e)throw new O("Invalid packet offsets");let c=[];for(let t=0;t<l;++t){let t=a.getUint8(i);++i,++i;let e=a.getUint16(i,!0);i+=J;let r=a.getUint16(i,!0);i+=J;let n=a.getUint16(i,!0);i+=J,i+=J,i+=J,i+=H,i+=H,i+=8;let s=a.getUint8(i++),o=a.getUint8(i++);i+=J,c.push(new Gt(t,e,r,n,s,o))}let u=[],w=0;let m=0,b=c[w++];return""===r?++m:u[r]=b,function t(e,r,a){let i=!1;if(4===a){if(r.hasSubtree())return;i=!0}for(let n=0;n<4;++n){let s=e+n.toString();if(i)u[s]=null;else if(a<4)if(r.hasChild(n)){if(w===l)return void console.log("Incorrect number of instances");let e=c[w++];u[s]=e,t(s,e,a+1)}else u[s]=null}}(r,b,m),u}var Ca=5,La=4;function Na(t,e,r){let a=new DataView(t),i=function(t){for(let r=0;r<La;++r){let r=a.getUint32(t,!0);if(t+=K,(t+=r)>e)throw new O("Malformed terrain packet found.")}return t},n=0,s=[];for(;s.length<Ca;){let e=n;n=i(n);let a=t.slice(e,n);r.push(a),s.push(a)}return s}var qr=1953029805,Ga=2917034100;function Ha(t){let e=new DataView(t),r=0,a=e.getUint32(r,!0);if(r+=K,a!==qr&&a!==Ga)throw new O("Invalid magic");let i=e.getUint32(r,a===qr);r+=K;let n=Qr(new Uint8Array(t,r));if(n.length!==i)throw new O("Size of packet doesn't match header");return n}var oi=Ct(Ma);export{oi as default};