@arcgis/core 4.34.0-next.24 → 4.34.0-next.26

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 (384) hide show
  1. package/Basemap.js +1 -1
  2. package/analysis/VolumeMeasurement/CutFillOptions.d.ts +4 -0
  3. package/analysis/VolumeMeasurement/CutFillOptions.js +1 -1
  4. package/analysis/VolumeMeasurementAnalysis.js +1 -1
  5. package/applications/Components/imageryUtils.d.ts +7 -0
  6. package/applications/Components/imageryUtils.js +5 -0
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{0867aa688fa8938906da.js → 03bef3f4b6b09b1e864b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/03ee4d63aa8de44958ab.js +1 -0
  10. package/assets/esri/core/workers/chunks/06cdbccc9f325dcc303d.js +1 -0
  11. package/assets/esri/core/workers/chunks/09618761df5c4fdd52a0.js +1 -0
  12. package/assets/esri/core/workers/chunks/0ae00339991f5387203e.js +1 -0
  13. package/assets/esri/core/workers/chunks/0b4b294f3ce74fde5620.js +1 -0
  14. package/assets/esri/core/workers/chunks/{146520d263b910b5bdc7.js → 0e96a3b7228f1ff8e6c5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/109ef17dd4f9430bb686.js +1 -0
  16. package/assets/esri/core/workers/chunks/1597aca21334cab3b802.js +1 -0
  17. package/assets/esri/core/workers/chunks/196564ad230bef6b59cf.js +1 -0
  18. package/assets/esri/core/workers/chunks/19f8d551cbebc11db1eb.js +1 -0
  19. package/assets/esri/core/workers/chunks/1ceee047e3fa617b0600.js +1 -0
  20. package/assets/esri/core/workers/chunks/1d27701832ea139fcc20.js +1 -0
  21. package/assets/esri/core/workers/chunks/1f296f85becf1ca6714d.js +1 -0
  22. package/assets/esri/core/workers/chunks/1f8d7bd44d53c30df383.js +1 -0
  23. package/assets/esri/core/workers/chunks/1fabb5ec59da698c1618.js +1 -0
  24. package/assets/esri/core/workers/chunks/{919d2fd7ebc0c840a759.js → 219b2911668db120452b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/21a8ae88cfa644a30058.js +1 -0
  26. package/assets/esri/core/workers/chunks/2b4b073254fe8b6a081c.js +1 -0
  27. package/assets/esri/core/workers/chunks/2c2128201c80a1b1aeb6.js +1 -0
  28. package/assets/esri/core/workers/chunks/2d3679289b34b7da6bf4.js +1 -0
  29. package/assets/esri/core/workers/chunks/30293b88501b5d6162fc.js +1 -0
  30. package/assets/esri/core/workers/chunks/31533f5e8b76b307f61c.js +1 -0
  31. package/assets/esri/core/workers/chunks/347117e61e1c6edd074f.js +1 -0
  32. package/assets/esri/core/workers/chunks/3616eb2607843524483f.js +1 -0
  33. package/assets/esri/core/workers/chunks/36648facd56ee91afc7c.js +1 -0
  34. package/assets/esri/core/workers/chunks/394477e88be0c6790f02.js +1 -0
  35. package/assets/esri/core/workers/chunks/3b80b01551d124534a1b.js +1 -0
  36. package/assets/esri/core/workers/chunks/{89d91ce2f566dd3f57f7.js → 3be9ec0503a669bcfce6.js} +1 -1
  37. package/assets/esri/core/workers/chunks/3c9cf06ac6aa1db6c4f6.js +1 -0
  38. package/assets/esri/core/workers/chunks/40fc7c43feaeef8b814d.js +1 -0
  39. package/assets/esri/core/workers/chunks/42cddc8f8c8d73e22ee2.js +1 -0
  40. package/assets/esri/core/workers/chunks/437a4100a837ee16df7c.js +1 -0
  41. package/assets/esri/core/workers/chunks/472c677a74d779ce62d7.js +1 -0
  42. package/assets/esri/core/workers/chunks/4ce671bc4d36387b55fa.js +1 -0
  43. package/assets/esri/core/workers/chunks/4de6c479df609398dee0.js +1 -0
  44. package/assets/esri/core/workers/chunks/51cfa2f70ec222e1582b.js +1 -0
  45. package/assets/esri/core/workers/chunks/5284d46aecd6fe0345b8.js +1 -0
  46. package/assets/esri/core/workers/chunks/567385709e18ace93b1e.js +1 -0
  47. package/assets/esri/core/workers/chunks/{4c2f3e43992a918e4c2d.js → 5ef3256c32c4b622bd11.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{55e9b02d70812f7cdac2.js → 63966066a963e9a1fb14.js} +1 -1
  49. package/assets/esri/core/workers/chunks/63f50ff2ae94f684d56b.js +1 -0
  50. package/assets/esri/core/workers/chunks/6b6ab092f578b20c8e56.js +1 -0
  51. package/assets/esri/core/workers/chunks/6deaa08e3a61a455e564.js +1 -0
  52. package/assets/esri/core/workers/chunks/6e9b4bfe2a1497c96100.js +1 -0
  53. package/assets/esri/core/workers/chunks/6efc3d120c9c2c09cb06.js +1 -0
  54. package/assets/esri/core/workers/chunks/7338ce95bceb2c7fab87.js +1 -0
  55. package/assets/esri/core/workers/chunks/7359652de3d7f969a712.js +1 -0
  56. package/assets/esri/core/workers/chunks/{c64fa94cba71ba2794e2.js → 771012f129890f9a089c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{d1b363c418a67b087306.js → 780ff9314f26ae62f75f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{04c17957c15234ca0321.js → 7b736885278af9676f3a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/8161b0a674ef9bf536a2.js +1 -0
  60. package/assets/esri/core/workers/chunks/820cf4337b248a0cb63c.js +1 -0
  61. package/assets/esri/core/workers/chunks/{fedbf639a0788417a70f.js → 86abfce1f2ac93cc4d54.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{c94cc026c4ed330408fb.js → 8894483b91bcda845b6f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{f050ab9d100012b77bb9.js → 8c5b1114cc2a58305a81.js} +1 -1
  64. package/assets/esri/core/workers/chunks/908ec8165d567f052155.js +1 -0
  65. package/assets/esri/core/workers/chunks/{97324f030738fc0d456b.js → 9182fe69b9863e1de714.js} +1 -1
  66. package/assets/esri/core/workers/chunks/91e6030a2845f5404e82.js +1 -0
  67. package/assets/esri/core/workers/chunks/9511e55e4fabb3235eac.js +1 -0
  68. package/assets/esri/core/workers/chunks/9d85e20a3d6ca1161c26.js +1 -0
  69. package/assets/esri/core/workers/chunks/9f8341caab3b1d02f387.js +1 -0
  70. package/assets/esri/core/workers/chunks/a08d018d8c137fc4ca17.js +1 -0
  71. package/assets/esri/core/workers/chunks/a19689f8d1ef48fd2159.js +1 -0
  72. package/assets/esri/core/workers/chunks/{7051bcc178eb512819f6.js → a55338add265d330124b.js} +1 -1
  73. package/assets/esri/core/workers/chunks/a8f37681f8f6feebbd50.js +1 -0
  74. package/assets/esri/core/workers/chunks/{6ca764b4baadef5c1515.js → aeedc543320ee307d14a.js} +1 -1
  75. package/assets/esri/core/workers/chunks/afe4fd3b1b3521712edd.js +1 -0
  76. package/assets/esri/core/workers/chunks/b3794c513a13facc98d3.js +1 -0
  77. package/assets/esri/core/workers/chunks/{9991bd3c7991bffd8260.js → b37f3c416cefc1a6ea2c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/bb50b4a3af627f91d789.js +1 -0
  79. package/assets/esri/core/workers/chunks/{f42155b7a4e6c5e80757.js → bbc2a4976d044b990193.js} +1 -1
  80. package/assets/esri/core/workers/chunks/bbf2c31d217de1b8ba6e.js +1 -0
  81. package/assets/esri/core/workers/chunks/be3977f7fe0c46a1b493.js +1 -0
  82. package/assets/esri/core/workers/chunks/befba7ceeb26a38732c1.js +1 -0
  83. package/assets/esri/core/workers/chunks/bf3fc71881aa559fc931.js +1 -0
  84. package/assets/esri/core/workers/chunks/c1fb5290e0e259b74389.js +1 -0
  85. package/assets/esri/core/workers/chunks/c361bf4d41a1843d4640.js +1 -0
  86. package/assets/esri/core/workers/chunks/c51099eab5a99c88e5de.js +1 -0
  87. package/assets/esri/core/workers/chunks/{909a6218db87cba2c9ba.js → c6c0263fbcf2ca245c1b.js} +3 -3
  88. package/assets/esri/core/workers/chunks/c6c3e703b18e1bb7113a.js +1 -0
  89. package/assets/esri/core/workers/chunks/c82e78590c2fabc67609.js +1 -0
  90. package/assets/esri/core/workers/chunks/{7d7f8f2936ddee65e3da.js → c9e580867f7ac17be329.js} +1 -1
  91. package/assets/esri/core/workers/chunks/d29ae64703a947bfb83b.js +1 -0
  92. package/assets/esri/core/workers/chunks/de1457b07f4e263f1524.js +1 -0
  93. package/assets/esri/core/workers/chunks/{6bf43bc3714d7b3878fa.js → e547318638c8f496c1a0.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{53781ccca16e53d4a8c3.js → f291ccf9da6aa7d7ae23.js} +1 -1
  95. package/assets/esri/core/workers/chunks/f5ee10a8afb7f70833bb.js +346 -0
  96. package/assets/esri/core/workers/chunks/f61a8cc7e2b198e521ba.js +1 -0
  97. package/assets/esri/core/workers/chunks/f9442a281cb91c64c7cd.js +1 -0
  98. package/assets/esri/core/workers/chunks/{4f14e78d0560050c1a81.js → fa7243f080bcf6444929.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{c3213b487c11076985af.js → fbf3240b36718fa5dc76.js} +1 -1
  100. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  101. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  102. package/chunks/ComponentShader.glsl.js +36 -36
  103. package/chunks/RibbonLine.glsl.js +40 -33
  104. package/chunks/persistableUrlUtils.js +1 -1
  105. package/config.js +1 -1
  106. package/core/AsyncUpdate.js +1 -1
  107. package/core/Clonable.js +1 -1
  108. package/core/Evented.js +1 -1
  109. package/core/Identifiable.js +1 -1
  110. package/core/JSONSupport.js +1 -1
  111. package/core/Loadable.js +1 -1
  112. package/core/MapUtils.js +1 -1
  113. package/core/MemCache.js +1 -1
  114. package/core/MultiOriginJSONSupport.js +1 -1
  115. package/core/ObjectPool.js +1 -1
  116. package/core/PooledArray.js +1 -1
  117. package/core/Promise.js +1 -1
  118. package/core/ReadOnlyMultiOriginJSONSupport.js +1 -1
  119. package/core/heapSort.js +5 -0
  120. package/core/mathUtils.js +1 -1
  121. package/core/quantity.d.ts +1 -0
  122. package/geometry/support/buffer/BufferPool.js +1 -1
  123. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  124. package/interfaces.d.ts +202 -12
  125. package/kernel.js +1 -1
  126. package/layers/CatalogLayer.js +1 -1
  127. package/layers/FeatureLayer.js +1 -1
  128. package/layers/GeoJSONLayer.js +1 -1
  129. package/layers/SubtypeGroupLayer.js +1 -1
  130. package/layers/knowledgeGraph/KnowledgeGraphSublayerBase.js +1 -1
  131. package/layers/mixins/APIKeyMixin.js +1 -1
  132. package/layers/mixins/ArcGISCachedService.js +1 -1
  133. package/layers/mixins/ArcGISImageService.js +1 -1
  134. package/layers/mixins/ArcGISMapService.js +1 -1
  135. package/layers/mixins/ArcGISService.js +1 -1
  136. package/layers/mixins/BlendLayer.js +1 -1
  137. package/layers/mixins/CustomParametersMixin.js +1 -1
  138. package/layers/mixins/DisplayFilteredLayer.js +1 -1
  139. package/layers/mixins/EditBusLayer.js +1 -1
  140. package/layers/mixins/FeatureEffectLayer.js +1 -1
  141. package/layers/mixins/FeatureLayerBase.js +1 -1
  142. package/layers/mixins/FeatureReductionLayer.js +1 -1
  143. package/layers/mixins/ImageryTileMixin.js +1 -1
  144. package/layers/mixins/OperationalLayer.js +1 -1
  145. package/layers/mixins/OrderedLayer.js +1 -1
  146. package/layers/mixins/PortalLayer.js +1 -1
  147. package/layers/mixins/PublishableLayer.js +1 -1
  148. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  149. package/layers/mixins/RasterPresetRendererMixin.js +1 -1
  150. package/layers/mixins/RefreshableLayer.js +1 -1
  151. package/layers/mixins/ScaleRangeLayer.js +1 -1
  152. package/layers/mixins/SceneService.js +1 -1
  153. package/layers/mixins/SublayersOwner.js +1 -1
  154. package/layers/mixins/TemporalLayer.js +1 -1
  155. package/layers/mixins/TemporalSceneLayer.js +1 -1
  156. package/layers/mixins/TrackableLayer.js +1 -1
  157. package/layers/ogc/wfsUtils.js +1 -1
  158. package/layers/support/RasterJobHandler.js +1 -1
  159. package/layers/support/RasterWorker.js +1 -1
  160. package/layers/support/Sublayer.js +1 -1
  161. package/layers/support/arcgisLayerUrl.js +1 -1
  162. package/layers/support/multiLayerServiceUtils.js +1 -1
  163. package/layers/support/rasterDatasets/pixelReader.js +5 -0
  164. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  165. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  166. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  167. package/package.json +1 -1
  168. package/renderers/mixins/VisualVariablesMixin.js +1 -1
  169. package/rest/support/CameraInfoMixin.js +1 -1
  170. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  171. package/smartMapping/renderers/color.js +1 -1
  172. package/smartMapping/renderers/heatmap.js +1 -1
  173. package/smartMapping/renderers/pieChart.js +1 -1
  174. package/smartMapping/renderers/size.js +1 -1
  175. package/smartMapping/renderers/support/regenerateUtils.js +1 -1
  176. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  177. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  178. package/smartMapping/renderers/type.js +1 -1
  179. package/smartMapping/symbology/color.js +1 -1
  180. package/smartMapping/symbology/support/utils.js +1 -1
  181. package/support/LayersMixin.js +1 -1
  182. package/support/TablesMixin.js +1 -1
  183. package/support/revision.js +1 -1
  184. package/symbols/support/utils.js +1 -1
  185. package/views/2d/engine/ParentChildStage.js +1 -1
  186. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  187. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  188. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  189. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
  190. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  192. package/views/2d/engine/webgl/textureUtils.js +1 -1
  193. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  194. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  195. package/views/2d/layers/LayerView2D.js +1 -1
  196. package/views/2d/layers/MediaLayerView2D.js +1 -1
  197. package/views/2d/layers/TileLayerView2D.js +1 -1
  198. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  199. package/views/2d/layers/support/DebugOverlay.js +1 -1
  200. package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
  201. package/views/3d/analysis/AnalysisView3D.js +1 -1
  202. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +5 -0
  203. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  204. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  205. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  206. package/views/3d/layers/BuildingSublayerView3D.js +1 -1
  207. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  208. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  209. package/views/3d/layers/FlowSubView3D.js +1 -1
  210. package/views/3d/layers/I3SMeshView3D.js +1 -1
  211. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  212. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  213. package/views/3d/layers/LayerView3D.js +1 -1
  214. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  215. package/views/3d/layers/StreamLayerView3D.js +1 -1
  216. package/views/3d/layers/TiledLayerView3D.js +1 -1
  217. package/views/3d/layers/graphics/DeconflictAABR.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  219. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  220. package/views/3d/layers/graphics/Labeler.js +1 -1
  221. package/views/3d/layers/graphics/StreamController.js +5 -0
  222. package/views/3d/layers/graphics/StreamGraphics3DGraphicsPipeline.js +1 -1
  223. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  224. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  225. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  226. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  227. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  228. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  229. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  230. package/views/3d/layers/support/fetchTile.js +1 -1
  231. package/views/3d/support/MemoryController.js +1 -1
  232. package/views/3d/support/ResourceController.js +1 -1
  233. package/views/3d/support/StreamDataLoader.js +1 -1
  234. package/views/3d/support/StreamDataRequester.js +5 -0
  235. package/views/3d/support/StreamTextureCollection.js +1 -1
  236. package/views/3d/support/engineContent/line.js +1 -1
  237. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  238. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  239. package/views/3d/support/flow/StreamlinesResources3D.js +1 -1
  240. package/views/3d/support/flow/geometryUtils.js +1 -1
  241. package/views/3d/support/index.js +1 -1
  242. package/views/3d/terrain/OverlayRenderer.js +1 -1
  243. package/views/3d/terrain/TerrainRenderer.js +1 -1
  244. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  245. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  246. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
  247. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  248. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  249. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  250. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  251. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  252. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  253. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  254. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  255. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  256. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +17 -0
  257. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  258. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  259. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  260. package/views/BreakpointsOwner.js +1 -1
  261. package/views/DOMContainer.js +1 -1
  262. package/views/PopupView.js +1 -1
  263. package/views/VideoView.js +1 -1
  264. package/views/Viewport2DBaseMixin.js +1 -1
  265. package/views/Viewport2DMixin.js +1 -1
  266. package/views/draw/DrawGraphicTool.js +1 -1
  267. package/views/draw/DrawScreenTool.js +1 -1
  268. package/views/draw/DrawTool.js +1 -1
  269. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  270. package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
  271. package/views/layers/CatalogFootprintLayerView.js +1 -1
  272. package/views/layers/CatalogLayerView.js +1 -1
  273. package/views/layers/DimensionLayerView.js +1 -1
  274. package/views/layers/FeatureLayerView.js +1 -1
  275. package/views/layers/ImageryLayerView.js +1 -1
  276. package/views/layers/ImageryTileLayerView.js +1 -1
  277. package/views/layers/LineOfSightLayerView.js +1 -1
  278. package/views/layers/MapImageLayerView.js +1 -1
  279. package/views/layers/MediaLayerView.js +1 -1
  280. package/views/layers/OGCFeatureLayerView.js +1 -1
  281. package/views/layers/PointCloudLayerView.js +1 -1
  282. package/views/layers/RefreshableLayerView.js +1 -1
  283. package/views/layers/StreamLayerView.js +1 -1
  284. package/views/layers/ViewshedLayerView.js +1 -1
  285. package/views/layers/WMSLayerView.js +1 -1
  286. package/views/support/Scheduler.js +1 -1
  287. package/views/video/VideoOperationalDataView.js +1 -1
  288. package/views/webgl/BufferObject.js +1 -1
  289. package/views/webgl/Program.js +1 -1
  290. package/views/webgl/Renderbuffer.js +1 -1
  291. package/views/webgl/Texture.js +1 -1
  292. package/views/webgl/Util.js +1 -1
  293. package/webscene/SunLighting.js +1 -1
  294. package/webscene/VirtualLighting.js +1 -1
  295. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  296. package/widgets/Directions/DirectionsSearchTool.js +1 -1
  297. package/widgets/Editor/EditorViewModel.js +1 -1
  298. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  299. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  300. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  301. package/widgets/Feature/support/FeatureContentMixin.js +1 -1
  302. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  303. package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
  304. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  305. package/widgets/OrientedImageryViewer/mixins/ImageMeasurementMixin.js +1 -1
  306. package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
  307. package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +1 -1
  308. package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +1 -1
  309. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  310. package/widgets/PanoramicViewer/PanoramicZoomConditions.js +1 -1
  311. package/widgets/PanoramicViewer.js +1 -1
  312. package/widgets/Sketch/support/ResponsiveToolbar/ToolbarGroupBase.js +1 -1
  313. package/widgets/support/GoTo.js +1 -1
  314. package/assets/esri/core/workers/chunks/0202c2ac73354e3970b2.js +0 -1
  315. package/assets/esri/core/workers/chunks/02dc6e31b1244e5bb785.js +0 -1
  316. package/assets/esri/core/workers/chunks/080c79d6caca3b6a2db2.js +0 -1
  317. package/assets/esri/core/workers/chunks/084236ca316aad980192.js +0 -1
  318. package/assets/esri/core/workers/chunks/0b484224a92b52c34330.js +0 -1
  319. package/assets/esri/core/workers/chunks/0f6203ae32663b2b52db.js +0 -1
  320. package/assets/esri/core/workers/chunks/16a78f5a82f5ca163816.js +0 -1
  321. package/assets/esri/core/workers/chunks/1cc30073f8200b67cff6.js +0 -1
  322. package/assets/esri/core/workers/chunks/1d75cb1747ffb7b8b050.js +0 -1
  323. package/assets/esri/core/workers/chunks/242b216d61940aebe8e1.js +0 -1
  324. package/assets/esri/core/workers/chunks/32756905bcf11699b3f7.js +0 -1
  325. package/assets/esri/core/workers/chunks/35d238a5a6501f89bed7.js +0 -1
  326. package/assets/esri/core/workers/chunks/36a2a8b6547604bad2ab.js +0 -1
  327. package/assets/esri/core/workers/chunks/3fcd73ba832cb53d3a07.js +0 -1
  328. package/assets/esri/core/workers/chunks/40c1d65039c8f1d6afa0.js +0 -1
  329. package/assets/esri/core/workers/chunks/49dce142ad1ea4c01d00.js +0 -1
  330. package/assets/esri/core/workers/chunks/4b89d5b9e35bf79b321e.js +0 -1
  331. package/assets/esri/core/workers/chunks/4c47d327815e281c457e.js +0 -1
  332. package/assets/esri/core/workers/chunks/4ea96aff38bb301dc40d.js +0 -346
  333. package/assets/esri/core/workers/chunks/54a49a25845897a15ab1.js +0 -1
  334. package/assets/esri/core/workers/chunks/576e408fb0834f3948e8.js +0 -1
  335. package/assets/esri/core/workers/chunks/5ce62d9fff80d014d186.js +0 -1
  336. package/assets/esri/core/workers/chunks/5e805c9e9012dd39ec86.js +0 -1
  337. package/assets/esri/core/workers/chunks/6136bf09950adc46bc33.js +0 -1
  338. package/assets/esri/core/workers/chunks/666afe669866c44830bd.js +0 -1
  339. package/assets/esri/core/workers/chunks/6a0fbc54638f7de138c1.js +0 -1
  340. package/assets/esri/core/workers/chunks/7d0c4e1518a6a63a3f87.js +0 -1
  341. package/assets/esri/core/workers/chunks/843b6029d4c13115e1ac.js +0 -1
  342. package/assets/esri/core/workers/chunks/86d6007c45f2aa643ac8.js +0 -1
  343. package/assets/esri/core/workers/chunks/8bf04be4052bf148777a.js +0 -1
  344. package/assets/esri/core/workers/chunks/8ea34878a1ef24b4ded3.js +0 -1
  345. package/assets/esri/core/workers/chunks/8eea6251aa09725e654e.js +0 -1
  346. package/assets/esri/core/workers/chunks/90145d49a0cec902435c.js +0 -1
  347. package/assets/esri/core/workers/chunks/916691122d7fb38497d6.js +0 -1
  348. package/assets/esri/core/workers/chunks/92ad9098006568358550.js +0 -1
  349. package/assets/esri/core/workers/chunks/9ae18a17f62d91167202.js +0 -1
  350. package/assets/esri/core/workers/chunks/9c510df592befb9ff892.js +0 -1
  351. package/assets/esri/core/workers/chunks/a273f80298417edecc07.js +0 -1
  352. package/assets/esri/core/workers/chunks/a2ed7a3cd518dd136ec7.js +0 -1
  353. package/assets/esri/core/workers/chunks/a6a7279b09d7962147ec.js +0 -1
  354. package/assets/esri/core/workers/chunks/aba520714efc01bead36.js +0 -1
  355. package/assets/esri/core/workers/chunks/acb9c166259872828646.js +0 -1
  356. package/assets/esri/core/workers/chunks/accff253af360c34e8a8.js +0 -1
  357. package/assets/esri/core/workers/chunks/ae6eed26fc932bc08356.js +0 -1
  358. package/assets/esri/core/workers/chunks/b32c1b60896a72e0ae90.js +0 -1
  359. package/assets/esri/core/workers/chunks/b4bb461955a4c2bce072.js +0 -1
  360. package/assets/esri/core/workers/chunks/b98279213f45a0c27600.js +0 -1
  361. package/assets/esri/core/workers/chunks/ba5b24beebeb703b5919.js +0 -1
  362. package/assets/esri/core/workers/chunks/bd7d19ba0c7d9143a455.js +0 -1
  363. package/assets/esri/core/workers/chunks/bffaf1f20f18c75fad4e.js +0 -1
  364. package/assets/esri/core/workers/chunks/c4f8da6c238eb5e91f91.js +0 -1
  365. package/assets/esri/core/workers/chunks/cdabea4718a7e7d34cb8.js +0 -1
  366. package/assets/esri/core/workers/chunks/ce7155ae63e7bb74be00.js +0 -1
  367. package/assets/esri/core/workers/chunks/d45383d76ba99718b6d9.js +0 -1
  368. package/assets/esri/core/workers/chunks/d915d0a30d9beb24bd3a.js +0 -1
  369. package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +0 -1
  370. package/assets/esri/core/workers/chunks/dc6538a2d5a1e60d0209.js +0 -1
  371. package/assets/esri/core/workers/chunks/dca633ae3bfd4a3f9bb3.js +0 -1
  372. package/assets/esri/core/workers/chunks/dfa7976085f7408a366c.js +0 -1
  373. package/assets/esri/core/workers/chunks/e0a5b499b3ae38c21278.js +0 -1
  374. package/assets/esri/core/workers/chunks/e1a20ba7d6279f59adc0.js +0 -1
  375. package/assets/esri/core/workers/chunks/e49a135a2933306a6105.js +0 -1
  376. package/assets/esri/core/workers/chunks/e9a9174c4d1a0a9effb6.js +0 -1
  377. package/assets/esri/core/workers/chunks/edead1a123860cc74b1b.js +0 -1
  378. package/assets/esri/core/workers/chunks/f90573c9dc36e51cd588.js +0 -1
  379. package/assets/esri/core/workers/chunks/fa9658dbfb921f9c13af.js +0 -1
  380. package/assets/esri/core/workers/chunks/fb5e2b1ced03eef28e96.js +0 -1
  381. package/assets/esri/core/workers/chunks/fd8f4eabb8bbc593dd9c.js +0 -1
  382. package/assets/esri/core/workers/chunks/fe1902d63f610cebd947.js +0 -1
  383. package/core/HeapSort.js +0 -5
  384. package/layers/graphics/controllers/StreamController.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerViewPerformanceInfo as l}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as s,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as o}from"../terrain/terrainUtils.js";import{isScaleRangeActive as c,validateScaleRange as h}from"../../support/layerViewUtils.js";const p=p=>{let m=class extends p{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get visibleAtCurrentScale(){if(!c(this.layer.minScale,this.layer.maxScale)||!this.view.scale)return!0;const e=Math.round(this.view.basemapTerrain.tilingScheme.levelAtScale(this.view.scale));return e>=this.displayLevelRange.minLevel&&e<=this.displayLevelRange.maxLevel}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:a}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(a).scale}return{minScale:t,maxScale:i}}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&!this.parent?.suspended&&this.view?.ready&&h(e)&&this.visibleAtCurrentTimeExtent||!1}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}get performanceInfo(){return new l(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return this.layer.getTileUrl(e[0],e[1],e[2])}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t="tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,i=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(i)throw i}))}_getTileInfoSupportError(e,i){const a=o(e,i,this.view.spatialReference,this.view.state.viewingMode,"tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!a)return;const r={layer:this.layer,error:a};switch(a.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":return new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",r);default:return new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",r)}}_getTileInfoCompatibilityError(e,i,a){return null!=e&&i.compatibleWith(e,a)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},a=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!a)return i;const r=a.levels[0],l=e=>{const t=Math.log(r.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([a({readOnly:!0})],m.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],m.prototype,"updating",void 0),e([a(s)],m.prototype,"updatingProgress",void 0),e([a(n)],m.prototype,"updatingProgressValue",void 0),e([a()],m.prototype,"hasMixedImageFormats",void 0),e([a()],m.prototype,"fullExtent",null),e([a({readOnly:!0})],m.prototype,"isOpaque",null),e([a({readOnly:!0})],m.prototype,"visibleAtCurrentScale",null),e([a()],m.prototype,"dataScaleRange",null),e([a({readOnly:!0})],m.prototype,"dataLevelRange",null),e([a({readOnly:!0})],m.prototype,"displayLevelRange",null),e([a()],m.prototype,"layer",void 0),m=e([r("esri.views.3d.layers.TiledLayerView3D")],m),m};export{p as TiledLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerViewPerformanceInfo as l}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as s,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as o}from"../terrain/terrainUtils.js";import{isScaleRangeActive as c,validateScaleRange as h}from"../../support/layerViewUtils.js";const p=p=>{const m=p;let u=class extends m{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get visibleAtCurrentScale(){if(!c(this.layer.minScale,this.layer.maxScale)||!this.view.scale)return!0;const e=Math.round(this.view.basemapTerrain.tilingScheme.levelAtScale(this.view.scale));return e>=this.displayLevelRange.minLevel&&e<=this.displayLevelRange.maxLevel}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:a}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(a).scale}return{minScale:t,maxScale:i}}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&!this.parent?.suspended&&this.view?.ready&&h(e)&&this.visibleAtCurrentTimeExtent||!1}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}get performanceInfo(){return new l(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return this.layer.getTileUrl(e[0],e[1],e[2])}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t="tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,i=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(i)throw i}))}_getTileInfoSupportError(e,i){const a=o(e,i,this.view.spatialReference,this.view.state.viewingMode,"tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!a)return;const r={layer:this.layer,error:a};switch(a.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":return new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",r);default:return new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",r)}}_getTileInfoCompatibilityError(e,i,a){return null!=e&&i.compatibleWith(e,a)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},a=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!a)return i;const r=a.levels[0],l=e=>{const t=Math.log(r.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([a({readOnly:!0})],u.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],u.prototype,"updating",void 0),e([a(s)],u.prototype,"updatingProgress",void 0),e([a(n)],u.prototype,"updatingProgressValue",void 0),e([a()],u.prototype,"hasMixedImageFormats",void 0),e([a()],u.prototype,"fullExtent",null),e([a({readOnly:!0})],u.prototype,"isOpaque",null),e([a({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([a()],u.prototype,"dataScaleRange",null),e([a({readOnly:!0})],u.prototype,"dataLevelRange",null),e([a({readOnly:!0})],u.prototype,"displayLevelRange",null),e([a()],u.prototype,"layer",void 0),u=e([r("esri.views.3d.layers.TiledLayerView3D")],u),u};export{p as TiledLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import i from"../../../../core/HeapSort.js";import s from"../../../../core/PooledArray.js";import{intersects as t}from"../../../../geometry/support/aaBoundingRect.js";import{drawPoly as n,drawAccelerationStruct as c}from"./deconflictorDebug.js";class e{constructor(i,s,t){this._setVisibility=i,this._canConflict=s,this._compare=t,this.done=!1,this._items=new Array,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null}destroy(){this._generator=null,this._accBins=null,this._items.length=0}reset(i,s){this._initBins(i,s),this._items.length=0,this.done=!1,this._generator=null}add(i){this._items.push(i)}run(i){this._generator??=this._run(i),this.done=!!this._generator.next(i).done}*_run(i){yield*this._sort(i),yield*this._deconflict(i),c(()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:0,numVisible:this._items.length}))}*_sort(s){for(const t of i.iterableSort(this._items,0,this._items.length,this._compare))s.madeProgress(),s.done&&(s=yield)}_isConflicted(i){let s=!0;return this._forEachBin(i.aabr,n=>(s=!1,n.some(s=>this._canConflict(s,i)&&t(s.aabr,i.aabr))))||s}*_deconflict(i){for(const s of this._items){i.done&&(i=yield);const t=!this._isConflicted(s);this._setVisibility(s,t),n(s.aabr,t),t&&this._addToBins(s),i.madeProgress()}}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY}_addToBins(i){this._forEachBin(i.aabr,s=>s.push(i))}_forEachBin(i,s){if(!this._accBins)return!1;const t=Math.max(Math.floor(i[0]/this._accBinsSizeX),0),n=Math.max(Math.floor(i[1]/this._accBinsSizeY),0),c=Math.min(Math.floor(i[2]/this._accBinsSizeX),this._accBinsNumX-1),e=Math.min(Math.floor(i[3]/this._accBinsSizeY),this._accBinsNumY-1);for(let h=t;h<=c;h++)for(let i=n;i<=e;i++)if(s(this._accBins[h][i]))return!0;return!1}}export{e as DeconflictAABR};
5
+ import{iterableSort as i}from"../../../../core/heapSort.js";import s from"../../../../core/PooledArray.js";import{intersects as t}from"../../../../geometry/support/aaBoundingRect.js";import{drawPoly as n,drawAccelerationStruct as c}from"./deconflictorDebug.js";class e{constructor(i,s,t){this._setVisibility=i,this._canConflict=s,this._compare=t,this.done=!1,this._items=new Array,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null}destroy(){this._generator=null,this._accBins=null,this._items.length=0}reset(i,s){this._initBins(i,s),this._items.length=0,this.done=!1,this._generator=null}add(i){this._items.push(i)}run(i){this._generator??=this._run(i),this.done=!!this._generator.next(i).done}*_run(i){yield*this._sort(i),yield*this._deconflict(i),c(()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:0,numVisible:this._items.length}))}*_sort(s){for(const t of i(this._items,0,this._items.length,this._compare))s.madeProgress(),s.done&&(s=yield)}_isConflicted(i){let s=!0;return this._forEachBin(i.aabr,n=>(s=!1,n.some(s=>this._canConflict(s,i)&&t(s.aabr,i.aabr))))||s}*_deconflict(i){for(const s of this._items){i.done&&(i=yield);const t=!this._isConflicted(s);this._setVisibility(s,t),n(s.aabr,t),t&&this._addToBins(s),i.madeProgress()}}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY}_addToBins(i){this._forEachBin(i.aabr,s=>s.push(i))}_forEachBin(i,s){if(!this._accBins)return!1;const t=Math.max(Math.floor(i[0]/this._accBinsSizeX),0),n=Math.max(Math.floor(i[1]/this._accBinsSizeY),0),c=Math.min(Math.floor(i[2]/this._accBinsSizeX),this._accBinsNumX-1),e=Math.min(Math.floor(i[3]/this._accBinsSizeY),this._accBinsNumY-1);for(let h=t;h<=c;h++)for(let i=n;i<=e;i++)if(s(this._accBins[h][i]))return!0;return!1}}export{e as DeconflictAABR};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as i,d as o}from"../../../../chunks/vec42.js";import{ONES as n,ZEROS as s,fromArray as a,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as d}from"./elevationAlignmentUtils.js";import{ElevationContext as u}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as y}from"./graphicUtils.js";import{ApplyRendererDiffResult as f}from"./interfaces.js";import{Loadable as m}from"./Loadable.js";import{getAttributeValue as v}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as g}from"../support/symbolColorUtils.js";const _=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class C extends m{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=_(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new u,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=x(this._context.renderer,o)),this._updateElevationContext()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get usedMemory(){const e=this.complexity;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=x(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&n&&0===n.length&&"rings"===r&&t.length>0&&t[0].length>2&&_().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):_().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}updateFocus(e,t){}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(_().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(_().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return _().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return b}_defaultElevationInfoZ(){return E}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new u){const r=e.geometry,i=this.getDefaultElevationInfo(r);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,t.mode=this.getGeometryElevationMode(r,i),t.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?h:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,r,i){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=O){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=O){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return y(null,o);const n=null!=t?e.toUnitRGB(t):r;return y(n,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:a,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:s),c=a?t??p:null,d=t||i||o,u=a?null:p[3];return y(c,l&&d?r??u:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,s){const p=n?a(e.toUnitRGBA(n)):l(NaN,NaN,NaN,s?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),g(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,r,e)!==d.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=d.UPDATE;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=d.RECREATE}),i}applyRendererDiff(e,t){return f.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,o=t.opacity?v(t.opacity.field,e):0;return l(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&_().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function x(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const b={mode:"on-the-ground",offset:0,unit:"meters"},E={mode:"absolute-height",offset:0,unit:"meters"},O={hasIntrinsicColor:!1},w=l(NaN,NaN,NaN,NaN);export{C as Graphics3DSymbolLayer,x as getDrivenProperties,w as nanFallbackColor};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as i,d as o}from"../../../../chunks/vec42.js";import{ONES as s,ZEROS as n,fromArray as a,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as d}from"./elevationAlignmentUtils.js";import{ElevationContext as u}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as y}from"./graphicUtils.js";import{ApplyRendererDiffResult as f}from"./interfaces.js";import{Loadable as m}from"./Loadable.js";import{getAttributeValue as v}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as g}from"../support/symbolColorUtils.js";const _=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class C extends m{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=_(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new u,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=x(this._context.renderer,o)),this._updateElevationContext()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const e=this.complexity;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=x(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&_().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):_().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}updateFocus(e,t){}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(_().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(_().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return _().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return b}_defaultElevationInfoZ(){return E}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new u){const r=e.geometry,i=this.getDefaultElevationInfo(r);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,t.mode=this.getGeometryElevationMode(r,i),t.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const s=o?h:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(s,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,r,i){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=O){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=O){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return y(null,o);const s=null!=t?e.toUnitRGB(t):r;return y(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:a,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?s:n),c=a?t??p:null,d=t||i||o,u=a?null:p[3];return y(c,l&&d?r??u:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},s,n){const p=s?a(e.toUnitRGBA(s)):l(NaN,NaN,NaN,n?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),g(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,r,e)!==d.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=d.UPDATE;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=d.RECREATE}),i}applyRendererDiff(e,t){return f.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,o=t.opacity?v(t.opacity.field,e):0;return l(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&_().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function x(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const b={mode:"on-the-ground",offset:0,unit:"meters"},E={mode:"absolute-height",offset:0,unit:"meters"},O={hasIntrinsicColor:!1},w=l(NaN,NaN,NaN,NaN);export{C as Graphics3DSymbolLayer,x as getDrivenProperties,w as nanFallbackColor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends j{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?I(this.symbolLayer.waveDirection):i(0,0);const o=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=R[o];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new D(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(o,2*n,2*i),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.objectAndLayerIdColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=L(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function I(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%B.unitSizeOfTexture,c=W[1]%B.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),W=d(),z=n(),k=c();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,I as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends j{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?I(this.symbolLayer.waveDirection):i(0,0);const o=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=R[o];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new D(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(o,2*n,2*i),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.objectAndLayerIdColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=L(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new F(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function I(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%B.unitSizeOfTexture,c=W[1]%B.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),W=d(),z=n(),k=c();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class F extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,I as headingVectorFromAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as C,LineCalloutSymbolLayerRenderingInfo as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as T}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as j,isInEffectiveScaleRange as E}from"../../../support/layerViewUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";import{Yield as O}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class U{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,l,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let H=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c(()=>this.view.state?.camera,()=>this.setDirty()),c(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),c(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(V.LABELER,this)]),j()&&this.addHandles(c(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new T({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),$.graphic=null,$.renderingInfo=null,$.layer=null}_updateFocus(){this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreasView?.containsGeometry(s)??!0;t.labelLayers.forEach(s=>{s.stageObject.geometries.some(e=>e.material.parameters.isFocused!==i)&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new F(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>k(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(B(t))this._dirty=!0;else if(N(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const l=new U(s,h,b,i,p.value);this._updateLabelClassContextVisibility(l),e.labelClassContexts[r]=l}else l.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.labelClassContexts.length=0}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,a){const r=new v(s,G(s.anchor),w(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return $.graphic=t,$.layer=i,$.renderingInfo=null,l.createLabel($,r,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,l){$.graphic=e,$.layer=l;const a=i.screenOffset[0];return $.renderingInfo=new x(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic($,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(N(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const a=t.graphic,r=s.layer,o=Z(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=W(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,r,d,y);if(null==f)return!1;f.labelClass=b.labelClass,f.labelClassContextIndex=n,t.addLabelGraphic(f,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,b.scaleVisibility??!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),j()&&b.graphics.set(a.uid,t),l=!0;const C=b.graphics3DCalloutSymbolLayer;if(C&&h.hasLabelVerticalOffset){C.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,C,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(N(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=r.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=D(g);e.textRenderers[a]=new I(n,m,r.textRenderParameters,T.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new F(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l.labelClass)continue;if(!e.labelClassContexts[l.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=Z(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,l,a,Z(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>Z(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!B(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!j())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},l=E(i,this.view.scale),a=null==e.scaleVisibility||e.scaleVisibility!==l;e.scaleVisibility=l,a&&s.size&&(s.forEach(e=>e.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,l)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>B(e))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(B(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function M(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function k(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function B(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function N(e){return!e||0===e.length}function W(e){return"label-3d"===e.symbol?.type?e.symbol:null}function Z(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([h({constructOnly:!0})],H.prototype,"view",void 0),e([h({constructOnly:!0})],H.prototype,"deconflictor",void 0),e([h()],H.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],H.prototype,"updating",null),H=e([b("esri.views.3d.layers.graphics.Labeler")],H);const $=new C(null,null,null);export{H as Labeler,Z as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as x,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as A}from"./placementUtils.js";import{placePointOnGeometry as D}from"./pointUtils.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as j,isInEffectiveScaleRange as E}from"../../../support/layerViewUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";import{Yield as O}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class U{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,l,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c(()=>this.view.state?.camera,()=>this.setDirty()),c(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),c(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(V.LABELER,this)]),j()&&this.addHandles(c(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new S({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),$.graphic=null,$.renderingInfo=null,$.layer=null}_updateFocus(){this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{if(0===t.labelLayers.length)return;const s=D(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreasView?.containsGeometry(s)??!0;t.labelLayers.forEach(s=>{s.stageObject.geometries.some(e=>e.material.parameters.isFocused!==i)&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new F(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>k(t.stageObject,e))),H(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(B(t))this._dirty=!0;else if(N(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const u=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const l=new U(s,h,b,i,u.value);this._updateLabelClassContextVisibility(l),e.labelClassContexts[r]=l}else l.getLogger(this).error(`Label expression failed to evaluate: ${u.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.labelClassContexts.length=0}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,a){if(!this._textTextureAtlas)return null;const r=new v(s,G(s.anchor),w(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return $.graphic=t,$.layer=i,$.renderingInfo=null,l.createLabel($,r,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,l){$.graphic=e,$.layer=l;const a=i.screenOffset[0];return $.renderingInfo=new C(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic($,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(N(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const a=t.graphic,r=s.layer,o=Z(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],u=b.graphics3DSymbol,p=W(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,p,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,r,d,y);if(null==f)return!1;f.labelClass=b.labelClass,f.labelClassContextIndex=n,t.addLabelGraphic(f,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,b.scaleVisibility??!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),j()&&b.graphics.set(a.uid,t),l=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,x,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(N(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,d=t.disablePlacement,y=new L(h,b,u,d).placement;if(null==y)continue;const g=G(y.anchor),m=A(g);e.textRenderers[a]=new I(n,m,r.textRenderParameters,S.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new F(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l.labelClass)continue;if(!e.labelClassContexts[l.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=Z(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,l,a,Z(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>Z(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!B(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!j())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},l=E(i,this.view.scale),a=null==e.scaleVisibility||e.scaleVisibility!==l;e.scaleVisibility=l,a&&s.size&&(s.forEach(e=>e.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,l)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>B(e))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(B(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function H(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function k(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function B(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function N(e){return!e||0===e.length}function W(e){return"label-3d"===e.symbol?.type?e.symbol:null}function Z(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([h({constructOnly:!0})],M.prototype,"view",void 0),e([h({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([h()],M.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([b("esri.views.3d.layers.graphics.Labeler")],M);const $=new x(null,null,null);export{M as Labeler,Z as areLabelsVisible};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import s from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import o from"../../../../core/Promise.js";import{watch as a,initial as n}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as h}from"../../../../geometry/support/typeUtils.js";import{StreamFeatureManager as p}from"../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as l}from"../../../../layers/graphics/sources/connections/createConnection.js";import{EventedSet as u}from"../../support/EventedSet.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as y}from"../../../support/Yield.js";const f=2500;let g=class extends t{constructor(e){super(e)}getObjectId(){return this.objectId}};e([c({type:Number,json:{read:!0}})],g.prototype,"objectId",void 0),g=e([d("esri.views.3d.layers.graphics.StreamController.StreamGraphic")],g);class _{constructor(e){this.onUpdate=e,this._idToGraphic=new Map}destroy(){this._idToGraphic.clear()}add(e){this._idToGraphic.set(e.objectId,e)}get(e){return this._idToGraphic.get(e)}forEach(e){this._idToGraphic.forEach(e)}removeById(e){const t=this._idToGraphic.get(e);return t?(t.sourceLayer=t.layer=null,this._idToGraphic.delete(e),t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._idToGraphic.size}}const v=Symbol("startup-watches"),j=Symbol("update-interval");let w=class extends(o.EsriPromiseMixin(s)){constructor(){super(...arguments),this.isPaused=!1,this.graphics=new u,this._updateInfo={websocket:0,client:0},this._updateRequested=!1,this._lastUpdateRateTime=0,this._outSpatialReference=null}initialize(){this.addResolvingPromise(this.layer.when(()=>this._startup()))}destroy(){this.clear()}clear(){this._shutdown(),this.graphics.clear()}get updating(){return!this.connection||this.running}get running(){return!this.isPaused&&null!=this.connection&&this._updateRequested}runTask(){if(this._updateRequested=!1,this._emitUpdateRate(),!this.featuresManager.checkForUpdates())return y}_emitUpdateRate(){const e=performance.now(),t=e-this._lastUpdateRateTime;if(t<f)return;this._lastUpdateRateTime=e;const s=Math.round(this._updateInfo.client/(t/1e3)),r=Math.round(this._updateInfo.websocket/(t/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.layerView.emit("update-rate",{client:s,websocket:r})}_shutdown(){this.connection=i(this.connection),this.store=i(this.store),this.removeAllHandles()}_startup(){const{layer:e,layerView:t}=this,{spatialReference:s,definitionExpression:i,geometryDefinition:o,timeInfo:c,purgeOptions:d,maxReconnectionAttempts:u,maxReconnectionInterval:y,customParameters:f}=e,g=e.geometryType?h.toJSON(e.geometryType):null,w=s,b=t.view.spatialReference,I={type:"object-id",fieldName:e.objectIdField};this.clear(),this._set("connection",l(e.parsedUrl,w,b,g,i,o,u,y,f??void 0)),this._outSpatialReference=b.toJSON(),this.store=new _(this._onUpdate.bind(this)),this.featuresManager=new p(this.store,I,c.toJSON(),d),this.removeHandles(v),this.removeHandles(j),this.addHandles([e.on("send-message-to-socket",e=>this.connection.sendMessageToSocket(e)),e.on("send-message-to-client",e=>this.connection.sendMessageToClient(e)),this.connection.on("data-received",e=>this._onFeature(e)),this.connection.on("message-received",e=>this._onWebSocketMessage(e)),a(()=>[e.definitionExpression,e.geometryDefinition,e.purgeOptions],()=>this._startup()),a(()=>this.isPaused?null:this.layer.updateInterval,e=>{if(this.removeHandles(j),null==e)return;const t=setInterval(()=>{this._updateRequested=!0},e);this.addHandles(r(()=>clearInterval(t)),j)},n),this.layerView.view.resourceController.scheduler.registerTask(m.STREAM_CONTROLLER,this)],v),this._updateRequested=!0}_onWebSocketMessage(e){if(this.layerView.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this.featuresManager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this.featuresManager.removeByTrackId(t);break;case"clear":this.store.forEach(e=>this.featuresManager.removeById(e.objectId))}}_onFeature(e){this._updateInfo.websocket++,this.layerView.hasEventListener("data-received")&&this.layerView.emit("data-received",{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry});try{null==e.geometry||e.geometry.spatialReference||(e.geometry.spatialReference=this._outSpatialReference);const t=g.fromJSON(e);t.sourceLayer=t.layer=this.layer,this.featuresManager.add(t)}catch{}}_onUpdate(e,t){null!=t&&this.graphics.removeMany(t),null!=e&&(this._updateInfo.client+=e.length,this.graphics.addMany(e))}pauseStream(){this.isPaused=!0}resumeStream(){this.isPaused=!1}disconnect(){this._shutdown()}connect(){null==this.connection&&this._startup()}clearGraphics(){this.graphics.clear()}};e([c()],w.prototype,"isPaused",void 0),e([c({constructOnly:!0})],w.prototype,"layer",void 0),e([c({constructOnly:!0})],w.prototype,"layerView",void 0),e([c()],w.prototype,"connection",void 0),e([c({readOnly:!0})],w.prototype,"updating",null),e([c()],w.prototype,"running",null),e([c()],w.prototype,"_updateRequested",void 0),w=e([d("esri.views.3d.layers.graphics.StreamController")],w);export{w as StreamController,g as StreamGraphic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{StreamController as t}from"../../../../layers/graphics/controllers/StreamController.js";import{Graphics3DGraphicsPipeline as s}from"./Graphics3DGraphicsPipeline.js";let c=class extends s{constructor(r){super(r),this.suspendResumeExtentMode="computed"}get connection(){return this.controller?.connection}createController(){return new t({layer:this.layer,layerView:this.layerView})}beforeSetController(){}pause(){this.controller?.pauseStream()}resume(){this.controller?.resumeStream()}disconnect(){this.controller?.disconnect()}connect(){this.controller?.connect()}clear(){this.controller?.clearGraphics()}};r([e()],c.prototype,"controller",void 0),r([e()],c.prototype,"connection",null),r([e()],c.prototype,"suspendResumeExtentMode",void 0),c=r([o("esri.views.3d.layers.graphics.StreamGraphics3DGraphicsPipeline")],c);export{c as StreamGraphics3DGraphicsPipeline};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{Graphics3DGraphicsPipeline as t}from"./Graphics3DGraphicsPipeline.js";import{StreamController as s}from"./StreamController.js";let c=class extends t{constructor(e){super(e),this.suspendResumeExtentMode="computed"}get connection(){return this.controller?.connection}createController(){return new s({layer:this.layer,layerView:this.layerView})}beforeSetController(){}pause(){this.controller?.pauseStream()}resume(){this.controller?.resumeStream()}disconnect(){this.controller?.disconnect()}connect(){this.controller?.connect()}clear(){this.controller?.clearGraphics()}};e([r()],c.prototype,"controller",void 0),e([r()],c.prototype,"connection",null),e([r()],c.prototype,"suspendResumeExtentMode",void 0),c=e([o("esri.views.3d.layers.graphics.StreamGraphics3DGraphicsPipeline")],c);export{c as StreamGraphics3DGraphicsPipeline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{defaultPrimitive as r}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{pathNumCircleProfileSubdivisions as t,pathNumRoundJoinSubdivisions as a,pathNumRoundCapExtrusionSubdivisions as s}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as o,SymbolComplexity as b,SymbolComplexityMemory as y,EstimatedAggregateSymbolComplexity as i,AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{hasEdges as n}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const P=new o({});function m(e){if("web-style"===e.type)return P;return F(e.symbolLayers.toArray().map(r=>L(e,r)))}function F(e){let r=0,t=0,a=0,s=!1,u=0;const o=new y;for(const b of e)null!=b&&(r+=b.verticesPerFeature,t+=b.verticesPerCoordinate,a+=b.drawCallsPerFeature,o.bytesPerFeature+=b.memory.bytesPerFeature,o.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,o.resourceBytes+=b.memory.resourceBytes,o.draped.bytesPerFeature+=b.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,s=s||b.estimated,++u);return s?new i(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o}):new c(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o})}function d(e){const r=F(e);return r.numComplexities>0&&(r.verticesPerFeature/=r.numComplexities,r.verticesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities),r}const p={};function L(u,y){const i=C(u,y),c=n(y)?2:0;switch(y.type){case"extrude":return new b({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:c,memory:i});case"fill":if("mesh-3d"===u.type)return new b({drawCallsPerFeature:c,memory:i});if(null!=y.outline&&y.outline.size>0)return new b({verticesPerFeature:-12,verticesPerCoordinate:9,memory:i});case"water":return new b({verticesPerFeature:-6,verticesPerCoordinate:3,memory:i});case"line":return new b({verticesPerFeature:-6,verticesPerCoordinate:6,memory:i});case"object":return y.resource?.href?new o({verticesPerFeature:100,memory:i}):{...f(y.resource?.primitive??r),memory:i};case"path":{let r=0,u=0;switch(y.profile){case"circle":r=t;break;case"quad":r=4;break;default:return void e(y.profile)}switch(y.join){case"round":u=a;break;case"miter":case"bevel":u=1;break;default:return}const o=2*r,c=r*u*2,n=c+o;let l=-2*c-o;switch(y.cap){case"none":break;case"butt":case"square":l+=2*(r-1);break;case"round":l+=2*(r*(s-1)*2+r);break;default:return}return new b({verticesPerFeature:l,verticesPerCoordinate:n,memory:i})}case"text":{const e="label-3d"===u.type?0:2;return new b({verticesPerFeature:6,memory:i,drawCallsPerFeature:e})}case"icon":return new b({verticesPerFeature:6,memory:i});default:return}}function C(r,t){const a="point-3d"===r.type;switch(t.type){case"extrude":return t.edges&&t.edges.size>0?E.EXTRUDE_EDGES:E.EXTRUDE;case"fill":return null!=t.outline&&t.outline.size>0?E.FILL_OUTLINE:E.FILL;case"water":return E.FILL;case"line":return"round"===t.join?E.LINE_ROUND:E.LINE_MITER;case"path":switch(t.join){case"round":switch(t.profile){case"circle":return E.PATH_ROUND_CIRCLE;case"quad":return E.PATH_ROUND_QUAD;default:return void e(t.profile)}case"miter":case"bevel":switch(t.profile){case"circle":return E.PATH_MITER_CIRCLE;case"quad":return E.PATH_MITER_QUAD;default:return void e(t.profile)}default:return}case"object":return a?E.OBJECT_POINT:E.OBJECT_POLYGON;case"icon":case"text":return a?E.ICON_POINT:E.ICON_POLYGON;default:return}}function f(e){const r=p[e];if(r)return r;const t=w(u(e,new l({},{spherical:!0})).levels);return p[e]=new b({verticesPerFeature:t}),p[e]}function w(e){return e.reduce((e,r,t)=>e+r.numVertices*(1/10**t),0)/e.reduce((e,r,t)=>e+1/10**t,0)}const E={ICON_POINT:{bytesPerFeature:3062.2534325974652,bytesPerFeatureLabel:3605.891255,resourceBytes:0,draped:{bytesPerFeature:2029.6324697040875,bytesPerFeatureLabel:3844.951315}},ICON_POLYGON:{bytesPerFeature:3379.2552364427283,bytesPerFeatureLabel:3144.1341316666667,resourceBytes:0,draped:{bytesPerFeature:2594.5439970589305,bytesPerFeatureLabel:3391.0192816666668}},OBJECT_POINT:{bytesPerFeature:755.5754513856272,bytesPerFeatureLabel:3229.7766,resourceBytes:0,draped:{bytesPerFeature:755.5754513856272,bytesPerFeatureLabel:3229.7766}},OBJECT_POLYGON:{bytesPerFeature:1235.9612556276838,bytesPerFeatureLabel:2710.5796950000004,resourceBytes:0,draped:{bytesPerFeature:1235.9612556276838,bytesPerFeatureLabel:2710.5796950000004}},LINE_MITER:{bytesPerFeature:2343.0098144295366,bytesPerFeatureLabel:2863.2415183333333,resourceBytes:0,draped:{bytesPerFeature:2118.062960542706,bytesPerFeatureLabel:2993.8707950000003}},LINE_ROUND:{bytesPerFeature:3180.281669156425,bytesPerFeatureLabel:2884.062711666667,resourceBytes:0,draped:{bytesPerFeature:2687.1048133674676,bytesPerFeatureLabel:2965.844025}},PATH_MITER_CIRCLE:{bytesPerFeature:26642.015762630304,bytesPerFeatureLabel:3147.8341749999995,resourceBytes:0,draped:{bytesPerFeature:26642.015762630304,bytesPerFeatureLabel:3147.8341749999995}},PATH_ROUND_CIRCLE:{bytesPerFeature:21137.659435445064,bytesPerFeatureLabel:2827.1294000000003,resourceBytes:0,draped:{bytesPerFeature:21137.659435445064,bytesPerFeatureLabel:2827.1294000000003}},PATH_MITER_QUAD:{bytesPerFeature:25592.283303929427,bytesPerFeatureLabel:3354.641775,resourceBytes:0,draped:{bytesPerFeature:25592.283303929427,bytesPerFeatureLabel:3354.641775}},PATH_ROUND_QUAD:{bytesPerFeature:23212.92773696872,bytesPerFeatureLabel:3173.6644499999998,resourceBytes:0,draped:{bytesPerFeature:23212.92773696872,bytesPerFeatureLabel:3173.6644499999998}},FILL:{bytesPerFeature:3069.6014181747005,bytesPerFeatureLabel:3050.617135,resourceBytes:0,draped:{bytesPerFeature:2547.9765396831167,bytesPerFeatureLabel:3166.2821483333337}},FILL_OUTLINE:{bytesPerFeature:3653.779598313774,bytesPerFeatureLabel:2787.5897050000003,resourceBytes:0,draped:{bytesPerFeature:2884.528596112384,bytesPerFeatureLabel:2907.420548333333}},EXTRUDE:{bytesPerFeature:5785.658350054202,bytesPerFeatureLabel:2787.498365,resourceBytes:0,draped:{bytesPerFeature:5785.658350054202,bytesPerFeatureLabel:2787.498365}},EXTRUDE_EDGES:{bytesPerFeature:3380.451670091342,bytesPerFeatureLabel:2245.881308333333,resourceBytes:0,draped:{bytesPerFeature:3380.451670091342,bytesPerFeatureLabel:2245.881308333333}}};export{d as averageSymbolComplexities,m as defaultSymbolComplexity,L as defaultSymbolLayerComplexity,C as defaultSymbolLayerMemoryComplexity,P as emptySymbolComplexity,w as estimateNumVerticesForLods,F as totalSymbolComplexities};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import has from"../../../../core/has.js";import{defaultPrimitive as r}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{pathNumCircleProfileSubdivisions as t,pathNumRoundJoinSubdivisions as a,pathNumRoundCapExtrusionSubdivisions as s}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as o,SymbolComplexity as b,SymbolComplexityMemory as y,EstimatedAggregateSymbolComplexity as i,AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{hasEdges as n}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const P=new o({});function m(e){if("web-style"===e.type)return P;return F(e.symbolLayers.toArray().map(r=>L(e,r)))}function F(e){let r=0,t=0,a=0,s=!1,u=0;const o=new y;for(const b of e)null!=b&&(r+=b.verticesPerFeature,t+=b.verticesPerCoordinate,a+=b.drawCallsPerFeature,o.bytesPerFeature+=b.memory.bytesPerFeature,o.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,o.resourceBytes+=b.memory.resourceBytes,o.draped.bytesPerFeature+=b.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,s=s||b.estimated,++u);return s?new i(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o}):new c(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o})}function d(e){const r=F(e);return r.numComplexities>0&&(r.verticesPerFeature/=r.numComplexities,r.verticesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities),r}const p={};function L(u,y){const i=C(u,y),c=n(y)?2:0;switch(y.type){case"extrude":return new b({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:c,memory:i});case"fill":if("mesh-3d"===u.type)return new b({drawCallsPerFeature:c,memory:i});if(null!=y.outline&&y.outline.size>0)return new b({verticesPerFeature:-12,verticesPerCoordinate:9,memory:i});case"water":return new b({verticesPerFeature:-6,verticesPerCoordinate:3,memory:i});case"line":return new b({verticesPerFeature:-6,verticesPerCoordinate:6,memory:i});case"object":return y.resource?.href?new o({verticesPerFeature:100,memory:i}):{...f(y.resource?.primitive??r),memory:i};case"path":{let r=0,u=0;switch(y.profile){case"circle":r=t;break;case"quad":r=4;break;default:return void e(y.profile)}switch(y.join){case"round":u=a;break;case"miter":case"bevel":u=1;break;default:return}const o=2*r,c=r*u*2,n=c+o;let l=-2*c-o;switch(y.cap){case"none":break;case"butt":case"square":l+=2*(r-1);break;case"round":l+=2*(r*(s-1)*2+r);break;default:return}return new b({verticesPerFeature:l,verticesPerCoordinate:n,memory:i})}case"text":{const e="label-3d"===u.type?0:2;return new b({verticesPerFeature:6,memory:i,drawCallsPerFeature:e})}case"icon":return new b({verticesPerFeature:6,memory:i});default:return}}function C(r,t){const a="point-3d"===r.type;switch(t.type){case"extrude":return t.edges&&t.edges.size>0?E.EXTRUDE_EDGES:E.EXTRUDE;case"fill":return null!=t.outline&&t.outline.size>0?E.FILL_OUTLINE:E.FILL;case"water":return E.FILL;case"line":return"round"===t.join?E.LINE_ROUND:E.LINE_MITER;case"path":switch(t.join){case"round":switch(t.profile){case"circle":return E.PATH_ROUND_CIRCLE;case"quad":return E.PATH_ROUND_QUAD;default:return void e(t.profile)}case"miter":case"bevel":switch(t.profile){case"circle":return E.PATH_MITER_CIRCLE;case"quad":return E.PATH_MITER_QUAD;default:return void e(t.profile)}default:return}case"object":return a?E.OBJECT_POINT:E.OBJECT_POLYGON;case"icon":case"text":return a?E.ICON_POINT:E.ICON_POLYGON;default:return}}function f(e){const r=p[e];if(r)return r;const t=w(u(e,new l({},{spherical:!0})).levels);return p[e]=new b({verticesPerFeature:t}),p[e]}function w(e){return e.reduce((e,r,t)=>e+r.numVertices*(1/10**t),0)/e.reduce((e,r,t)=>e+1/10**t,0)}const E={ICON_POINT:{bytesPerFeature:3062.2534325974652,bytesPerFeatureLabel:3605.891255,resourceBytes:0,draped:{bytesPerFeature:2029.6324697040875,bytesPerFeatureLabel:3844.951315}},ICON_POLYGON:{bytesPerFeature:3379.2552364427283,bytesPerFeatureLabel:3144.1341316666667,resourceBytes:0,draped:{bytesPerFeature:2594.5439970589305,bytesPerFeatureLabel:3391.0192816666668}},OBJECT_POINT:{bytesPerFeature:755.5754513856272,bytesPerFeatureLabel:3229.7766,resourceBytes:0,draped:{bytesPerFeature:755.5754513856272,bytesPerFeatureLabel:3229.7766}},OBJECT_POLYGON:{bytesPerFeature:1235.9612556276838,bytesPerFeatureLabel:2710.5796950000004,resourceBytes:0,draped:{bytesPerFeature:1235.9612556276838,bytesPerFeatureLabel:2710.5796950000004}},LINE_MITER:{bytesPerFeature:2343.0098144295366,bytesPerFeatureLabel:2863.2415183333333,resourceBytes:0,draped:{bytesPerFeature:2118.062960542706,bytesPerFeatureLabel:2993.8707950000003}},LINE_ROUND:{bytesPerFeature:3180.281669156425,bytesPerFeatureLabel:2884.062711666667,resourceBytes:0,draped:{bytesPerFeature:2687.1048133674676,bytesPerFeatureLabel:2965.844025}},PATH_MITER_CIRCLE:{bytesPerFeature:26642.015762630304,bytesPerFeatureLabel:3147.8341749999995,resourceBytes:0,draped:{bytesPerFeature:26642.015762630304,bytesPerFeatureLabel:3147.8341749999995}},PATH_ROUND_CIRCLE:{bytesPerFeature:21137.659435445064,bytesPerFeatureLabel:2827.1294000000003,resourceBytes:0,draped:{bytesPerFeature:21137.659435445064,bytesPerFeatureLabel:2827.1294000000003}},PATH_MITER_QUAD:{bytesPerFeature:25592.283303929427,bytesPerFeatureLabel:3354.641775,resourceBytes:0,draped:{bytesPerFeature:25592.283303929427,bytesPerFeatureLabel:3354.641775}},PATH_ROUND_QUAD:{bytesPerFeature:23212.92773696872,bytesPerFeatureLabel:3173.6644499999998,resourceBytes:0,draped:{bytesPerFeature:23212.92773696872,bytesPerFeatureLabel:3173.6644499999998}},FILL:{bytesPerFeature:3069.6014181747005,bytesPerFeatureLabel:3050.617135,resourceBytes:0,draped:{bytesPerFeature:2547.9765396831167,bytesPerFeatureLabel:3166.2821483333337}},FILL_OUTLINE:{bytesPerFeature:3653.779598313774,bytesPerFeatureLabel:2787.5897050000003,resourceBytes:0,draped:{bytesPerFeature:2884.528596112384,bytesPerFeatureLabel:2907.420548333333}},EXTRUDE:{bytesPerFeature:5785.658350054202,bytesPerFeatureLabel:2787.498365,resourceBytes:0,draped:{bytesPerFeature:5785.658350054202,bytesPerFeatureLabel:2787.498365}},EXTRUDE_EDGES:{bytesPerFeature:3380.451670091342,bytesPerFeatureLabel:2245.881308333333,resourceBytes:0,draped:{bytesPerFeature:3380.451670091342,bytesPerFeatureLabel:2245.881308333333}}};if(has("esri-tests-disable-symbol-memory-estimators"))for(const _ in E){const e=E[_];e.bytesPerFeature=0,e.bytesPerFeatureLabel=0,e.draped.bytesPerFeature=0,e.draped.bytesPerFeatureLabel=0}export{d as averageSymbolComplexities,m as defaultSymbolComplexity,L as defaultSymbolLayerComplexity,C as defaultSymbolLayerMemoryComplexity,P as emptySymbolComplexity,w as estimateNumVerticesForLods,F as totalSymbolComplexities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as d,AlphaDiscardMode as g}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{Texture as w}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as x}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as h}from"../../../webgl/enums.js";const v=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class j{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function A(e,t){const r=await I(e,t),n=await T(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new j(r,n,o+s(r))}async function I(r,n){const s=n?.streamDataRequester;if(s)return P(r,s,n);const o=await t(e(r,n));if(!0===o.ok)return o.value.data;a(o.error),M(o.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;a(s.error),M(s.error.details.url)}function M(e){throw new r("",`Request for object resource failed: ${e}`)}function E(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(v().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(v().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(v().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(v().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else v().warn("Indexed geometries must specify faces"),n=!1;break}default:v().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(v().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(v().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function U(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");R.validate(c);const p=u.model.name,g=u.model.geometries,h=u.materialDefinitions??{},v=e.textures;let j=0;const A=new Map;for(let o=0;o<g.length;o++){const e=g[o];if(!E(e))continue;const i=q(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[b.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,U=v&&v[M];if(U&&!A.has(M)){const{image:e,parameters:t}=U,r=new w(e,t);n.push(r),A.set(M,r)}const O=A.get(M),T=O?O.id:void 0,R=i.material;let B=a.get(R,M);if(null==B){const e=h[R.slice(R.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=U?k(U.alphaChannelUsage):void 0,n={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:T,doubleSided:!0,cullFace:d.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:U?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(n,t.materialParameters),B=new x(n,t),a.set(R,M,B)}s.push(B);const C=new y(B,c);j+=c.find(e=>e[0]===b.POSITION)?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:j,lodThreshold:null}],referenceBoundingBox:O(r)}}function O(e){const t=u();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))}),t}async function T(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){v().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:h.REPEAT,t:h.REPEAT},preMultiplyAlpha:k(l)!==g.Opaque},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then(e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l})))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function k(e){switch(e){case"mask":return g.Mask;case"maskAndTransparency":return g.MaskBlend;case"none":return g.Opaque;default:return g.Blend}}function q(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new i(1,2,"wosr");export{j as LoaderResultWOSR,T as createTextureResources,A as load,U as processLoadResult};
5
+ import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{DocType as f}from"../../support/index.js";import{Attribute as d}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as g,AlphaDiscardMode as y}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{Texture as b}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as x}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as h}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as v}from"../../../webgl/enums.js";const j=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class A{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function I(e,t){const r=await P(e,t),n=await k(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new A(r,n,o+s(r))}async function P(r,n){const s=n?.streamDataRequester;if(s)return M(r,s,n);const o=await t(e(r,n));if(!0===o.ok)return o.value.data;a(o.error),E(o.error)}async function M(e,r,n){const s=await t(r.request(e,f.JSON,n));if(!0===s.ok)return s.value;a(s.error),E(s.error.details.url)}function E(e){throw new r("",`Request for object resource failed: ${e}`)}function O(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(j().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(j().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(j().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(j().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else j().warn("Indexed geometries must specify faces"),n=!1;break}default:j().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(j().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(j().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function U(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");B.validate(c);const p=u.model.name,f=u.model.geometries,y=u.materialDefinitions??{},v=e.textures;let j=0;const A=new Map;for(let o=0;o<f.length;o++){const e=f[o];if(!O(e))continue;const i=R(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[x.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new d(r,n,e.valuesPerElement,!0)])}const M=i.texture,E=v&&v[M];if(E&&!A.has(M)){const{image:e,parameters:t}=E,r=new b(e,t);n.push(r),A.set(M,r)}const U=A.get(M),T=U?U.id:void 0,k=i.material;let B=a.get(k,M);if(null==B){const e=y[k.slice(k.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=E?q(E.alphaChannelUsage):void 0,n={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:T,doubleSided:!0,cullFace:g.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:E?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(n,t.materialParameters),B=new h(n,t),a.set(k,M,B)}s.push(B);const C=new w(B,c);j+=c.find(e=>e[0]===x.POSITION)?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:j,lodThreshold:null}],referenceBoundingBox:T(r)}}function T(e){const t=u();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))}),t}async function k(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){j().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:v.REPEAT,t:v.REPEAT},preMultiplyAlpha:q(l)!==y.Opaque},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then(e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l})))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function q(e){switch(e){case"mask":return y.Mask;case"maskAndTransparency":return y.MaskBlend;case"none":return y.Opaque;default:return y.Blend}}function R(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const B=new i(1,2,"wosr");export{A as LoaderResultWOSR,k as createTextureResources,I as load,U as processLoadResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{l as s,h as n,c as o,u as r}from"../../../../chunks/sphere.js";import{LodMetric as a,NodeBase as l,Node as d,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{invalidateMbs as g,addWraparound as _}from"./I3SUtil.js";import{ValidatedNode as f}from"./ValidatedNode.js";import{ElevationRange as m}from"../../support/ElevationRange.js";import{Obb as v}from"../../support/orientedBoundingBox.js";class N{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=h.NotChecked,this.traversalState=null,this.parent=-1}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.ref?.invalidateServiceBVsInRenderSR()}}class p{constructor(e=new Array,t=new Array){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}}class b{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,l,d,h,u,c,g,_,f,m,v){this.viewingMode=t,this._layer=i,this._streamDataController=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=l,this.holeFilling=d,this._isLoaded=h,this._isReloading=u,this._isSelected=c,this._enable=g,this._needsUpdate=_,this._canRequest=f,this._computeVisibilityObb=m,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=a.None,this._lodConversion=e=>e,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=x(0),this._visibilityCacheVersion=x(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new y(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(s)}_init(e){if("page"===e.type){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=a.MaxScreenThreshold,this._lodConversion=F}if(this._isEditable){this._rootIndex=-1;const i=E(e.rootIndex,e.pageSize),s=t.nodes[i],n={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:s.obb,lodThreshold:s.lodThreshold}]};this._addPage(w(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=e.rootIndex;this._addPage(w(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix;const t=new p;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new p;const t={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new l(t.id,null),-1);const i=this._validateNode(t.id,t);i&&this._addNode(i,this._rootIndex)}else this._rootIndex=this._makeRefNode(new l(e.rootNode.id,null),-1);const i=this._validateNode(e.rootNode.id,e.rootNode);i&&this._addNode(i,0)}}addClientNodeToIndex(e,t){const i=-1,s=new l(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const i=this._urlPrefix+e;this._streamDataController.request(i,"json").then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parent;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this.getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=v.fromJSON(t.obb),u=s(h.center,h.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,_=t.mesh?.material,f={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=_?.resource?`${_.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:_?_.definition:-1},m=new d(l,M(o,e,this._pageSize),u,a,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return m.serviceObbInIndexSR=h,m.visibilityObbInRenderSR=this._computeVisibilityObb(m),m.vertexCount=g?g.vertexCount:0,new N(r,a,P(this._visibilityCacheVersion),null,m)}),r=new p(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=E(t,this._pageSize),r=n.nodes[o];r.parent=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=w(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeInternal(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[E(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=O(e.lodSelection),r=this._getNodeInternal(t),a=new d(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=v.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.ref;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new N(0,0,P(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new N(0,0,P(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=E(e,this._pageSize),n=E(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const l of i.nodes)l.childOffset>r&&(l.childOffset+=a);i.nodes[n].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this.getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=E(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.ref?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const l=s.nodes,d=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<l.length;++g){const e=l[g];if(o.has(e))continue;const t=u.length,s=M(g,-1,this._pageSize),n=M(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.ref?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=M(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=d[s];if(t>=0)c.push(t);else{const i=E(t,this._pageSize),s=l[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parent=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.nodes=u,s.children=c,this._updateParentBoundingInformation(h[E(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,l=this._getNodeInternal(t);if(null==l)return;for(let o=0;o<l.childCount;o++){const l=this.getChildIndex(t,o),d=this._getNodeInternal(l),h=null!=d?d.ref||d.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,D);else{const t=z,n=k,o=T;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):g(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(l.ref),d(l.node),this.invalidateNodeVisibilityCacheInternal(l),t=this.getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeInternal(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeInternal(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.ref&&i.ref.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[E(e,this._pageSize)];return i.children[s.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[E(e,this._pageSize)]?.parent:null}getParent(e){const t=this.getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=x(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=P(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.ref;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.ref;return!t||t.elevationRangeValid}updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){const i=this._getNodeInternal(e);if(!i)return!1;const s=i?.node??i?.ref;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new m;let o=!1;for(let l=0;l<i.childCount;l++){const t=this.getChildIndex(e,l),i=this._updateElevationRangeInternal(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}const r=s.elevationRangeMin,a=s.elevationRangeMax;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.ref?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeInternal(e);if(null==t)return!0;const i=t.ref;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&R(t.visibilityCache,this._visibilityCacheVersion))return C(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=S(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&t.filterImpact===h.NotChecked){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):h.Unmodified}const o=null!=s&&t.filterImpact===h.Culled;let r=!(null!=s&&s.imModificationImpact===u.Culled)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this.updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=S(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&t.node.imModificationImpact===u.NotChecked)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let l=t.childOffset;l<r;++l){const e=o.children[l],t=this._getNodeInternal(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const l of a){const e=l.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,l,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeInternal(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(R(t.useAsHole,this._version))return C(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=S(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=x(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=u.NotChecked,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=h.NotChecked;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),I.clear();let s=!0;const n=new A,o=new L,r=this._imModificationUncategorized;r.clear();const a=new Set;let l=0;const d=(a,d,h)=>{const c=w(a,this._pageSize);if(null==d){let e=this._entryPriority(a);return e===1/0&&(e=this._entryPriority(h)),I.set(c,Math.max(e,I.get(c)||0)),this._loadingPages.has(c)||this._failedPages.has(c)||(this._missingPagesAndNodes.push(c),++l),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const g=d.node;if(this._updateNodeFeatureEstimate(g,o),null==g){const e=this._entryPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),I.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(0===this._missingPagesAndNodes.length&&!this._useNodePages)for(let e=0;e<d.childCount;e++){const t=_.children[d.childOffset+e],i=this._getNodeInternal(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(I.set(t,this._entryPriority(t)),this._prefetchNodes.push(t))}if(g.failed||g.resources.isEmpty)return void(s&&d.childCount>0&&this._isSelected(g)&&(s=!1));if(this._isLoaded(a)){if(n.known+=g.memory,++n.knownNodes,this._isSelected(g)?d.childCount>0&&(s=!1):(n.unremoved+=g.memory,s=!1),this._needsUpdate(g)){const e=this._entryPriority(a);I.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(g.memory&&(n.known+=g.memory,++n.knownNodes),!this._isSelected(g))return void(this._isReloading(a)&&this._updates.remove.push(a));if(d.childCount>0&&(s=!1),g.memory?(n.missing+=g.memory,n.known+=g.memory,++n.knownNodes):++n.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const f=this._entryPriority(a);I.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=g&&g.imModificationImpact===u.NotChecked&&r.push(a)};this.traverseVisible(d,a),this._frameNumber++,this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>I.get(e)-I.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=I.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear()),this._removeUnusedNodePages(a,l);const h=this._updates.add;h.length>0&&this.layerHasModifications&&(r.length>0&&i?.(r),h.filterInPlace(e=>{const t=this._getNodeInternal(e),i=null==t?.node||t.node.imModificationImpact!==u.Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=n.missing-n.unremoved,n.knownNodes>3&&n.missingNodes>0&&(this._unloadedMemoryEstimate+=n.known/n.knownNodes*n.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>I.get(e)>=this._maxUnloadedPrio).sort((e,t)=>I.get(e)-I.get(t)),this._updates.update.sort((e,t)=>I.get(e)-I.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,I.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new L;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=x(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>B&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=B})}}_updateFeatureEstimate(e,t){this._version=x(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._isSelected(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>I.get(e)-I.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeInternal(t);if(!i)return null;let s=i?.traversalState;if(s&&R(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this.getParentIndex(t);if(null!=e){const t=this._getNodeInternal(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=S(!0,this._version),s):(s=new c(o,r,n,S(!0,this._version)),i.traversalState=s,s)}async _loadNode(e){this._loadingNodes.add(e);const i=this._getNodeInternal(e).ref;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this._urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};let r=null;try{r=e>=0?await this._streamDataController.request(n,"json"):await this._clientNodeLoader.loadNodeJSON(s)}catch(d){return o(),void(t(d)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}o();const a=this._validateNode(s,r);if(null==a)return;a.obb&&this.invalidateNodeVisibilityCache(e);const l=this._addNode(a,e);this.nodeTraversalState(l)}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,a=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new l(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?v.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},d=Array.isArray(t.children)?t.children.map(a).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new f(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},d,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._entryPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeInternal(i).traversalState;null!=e&&(s=e.lodLevel)}let n=this.progressiveLoadPenalty;for(let r=e;null!=r;r=this.getParentIndex(r))if(this._isLoaded(r)){n=0;break}const o=null!=t.ref?this._viewportQueries.distToPOI(t.ref):null!=t.node?this._viewportQueries.distToPOI(t.node):0;return-o-s*(o+this.progressiveLoadPenalty)+n}traverseVisible(e,t){const i=this._getNodeInternal(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=w(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let l=0;l<i.childCount;l++){const t=a.children[i.childOffset+l],o=this._getNodeInternal(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=w(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=w(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,l=E(i,s),d=o.nodes[l],h=d.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=d,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:l}=r;if(0===l)continue;const{childOffset:d}=r,h=d+l;for(let e=d;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,l=o,d=l.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=l;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,l=o,d=l.nodes,i=s*e}const h=d[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,N=v+_;for(let e=v;e<N;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:l}=n,d=l+r;for(let e=l;e<d;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.ref?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(w(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){}}const I=new Map;class y{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function P(e){return _(e,-2)}function x(e){return _(e,2)}function S(e,t){return t+(e?1:0)}function R(e,t){return(-2&e)===t}function C(e){return!(1&~e)}function w(e,t){return e<0?-1:t>0?e/t|0:0}function E(e,t){return e<0?-e-1:0===t?e:e%t}function M(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const V=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function O(e){if(e)for(let t=0;t<e.length;t++)for(const i of V)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class A{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class L{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function F(e){return Math.sqrt(e*(4/Math.PI))}const D=o(),z=o(),k=o(),T=o(),B=has("esri-mobile")?100:300;export{b as I3SIndex,O as selectErrorMetric};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{l as s,h as n,c as o,u as r}from"../../../../chunks/sphere.js";import{DocType as a}from"../../support/index.js";import{LodMetric as l,NodeBase as d,Node as h,NodeFilterImpact as u,NodeIMModificationImpact as c,NodeTraversalState as g}from"./I3SNode.js";import{invalidateMbs as _,addWraparound as f}from"./I3SUtil.js";import{ValidatedNode as m}from"./ValidatedNode.js";import{ElevationRange as v}from"../../support/ElevationRange.js";import{Obb as N}from"../../support/orientedBoundingBox.js";class p{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=u.NotChecked,this.traversalState=null,this.parent=-1}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.ref?.invalidateServiceBVsInRenderSR()}}class b{constructor(e=new Array,t=new Array){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}}class I{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,a,d,h,u,c,g,_,f,m,v){this.viewingMode=t,this._layer=i,this._streamDataController=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=a,this.holeFilling=d,this._isLoaded=h,this._isReloading=u,this._isSelected=c,this._enable=g,this._needsUpdate=_,this._canRequest=f,this._computeVisibilityObb=m,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=l.None,this._lodConversion=e=>e,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=S(0),this._visibilityCacheVersion=S(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new P(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(s)}_init(e){if("page"===e.type){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=l.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=l.MaxScreenThreshold,this._lodConversion=D}if(this._isEditable){this._rootIndex=-1;const i=M(e.rootIndex,e.pageSize),s=t.nodes[i],n={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:s.obb,lodThreshold:s.lodThreshold}]};this._addPage(E(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=e.rootIndex;this._addPage(E(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix;const t=new b;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new b;const t={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new d(t.id,null),-1);const i=this._validateNode(t.id,t);i&&this._addNode(i,this._rootIndex)}else this._rootIndex=this._makeRefNode(new d(e.rootNode.id,null),-1);const i=this._validateNode(e.rootNode.id,e.rootNode);i&&this._addNode(i,0)}}addClientNodeToIndex(e,t){const i=-1,s=new d(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const i=this._urlPrefix+e;this._streamDataController.request(i,a.JSON).then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parent;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this.getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,d=N.fromJSON(t.obb),u=s(d.center,d.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,_=t.mesh?.material,f={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=_?.resource?`${_.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:_?_.definition:-1},m=new h(l,O(o,e,this._pageSize),u,a,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return m.serviceObbInIndexSR=d,m.visibilityObbInRenderSR=this._computeVisibilityObb(m),m.vertexCount=g?g.vertexCount:0,new p(r,a,x(this._visibilityCacheVersion),null,m)}),r=new b(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=M(t,this._pageSize),r=n.nodes[o];r.parent=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=E(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeInternal(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[M(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=A(e.lodSelection),r=this._getNodeInternal(t),a=new h(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=N.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.ref;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new p(0,0,x(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new p(0,0,x(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=M(e,this._pageSize),n=M(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const l of i.nodes)l.childOffset>r&&(l.childOffset+=a);i.nodes[n].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this.getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=M(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.ref?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const l=s.nodes,d=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<l.length;++g){const e=l[g];if(o.has(e))continue;const t=u.length,s=O(g,-1,this._pageSize),n=O(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.ref?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=O(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=d[s];if(t>=0)c.push(t);else{const i=M(t,this._pageSize),s=l[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parent=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.nodes=u,s.children=c,this._updateParentBoundingInformation(h[M(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,l=this._getNodeInternal(t);if(null==l)return;for(let o=0;o<l.childCount;o++){const l=this.getChildIndex(t,o),d=this._getNodeInternal(l),h=null!=d?d.ref||d.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,z);else{const t=k,n=T,o=B;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):_(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(l.ref),d(l.node),this.invalidateNodeVisibilityCacheInternal(l),t=this.getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeInternal(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeInternal(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.ref&&i.ref.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[M(e,this._pageSize)];return i.children[s.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[M(e,this._pageSize)]?.parent:null}getParent(e){const t=this.getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=S(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=x(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.ref;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.ref;return!t||t.elevationRangeValid}updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){const i=this._getNodeInternal(e);if(!i)return!1;const s=i?.node??i?.ref;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new v;let o=!1;for(let l=0;l<i.childCount;l++){const t=this.getChildIndex(e,l),i=this._updateElevationRangeInternal(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}const r=s.elevationRangeMin,a=s.elevationRangeMax;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.ref?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeInternal(e);if(null==t)return!0;const i=t.ref;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&C(t.visibilityCache,this._visibilityCacheVersion))return w(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=R(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&t.filterImpact===u.NotChecked){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):u.Unmodified}const o=null!=s&&t.filterImpact===u.Culled;let r=!(null!=s&&s.imModificationImpact===c.Culled)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this.updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=R(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&t.node.imModificationImpact===c.NotChecked)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let l=t.childOffset;l<r;++l){const e=o.children[l],t=this._getNodeInternal(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const l of a){const e=l.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,l,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeInternal(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(C(t.useAsHole,this._version))return w(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=R(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=S(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=c.NotChecked,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=u.NotChecked;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),y.clear();let s=!0;const n=new L,o=new F,r=this._imModificationUncategorized;r.clear();const a=new Set;let l=0;const d=(a,d,h)=>{const u=E(a,this._pageSize);if(null==d){let e=this._entryPriority(a);return e===1/0&&(e=this._entryPriority(h)),y.set(u,Math.max(e,y.get(u)||0)),this._loadingPages.has(u)||this._failedPages.has(u)||(this._missingPagesAndNodes.push(u),++l),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const g=d.node;if(this._updateNodeFeatureEstimate(g,o),null==g){const e=this._entryPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),y.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(0===this._missingPagesAndNodes.length&&!this._useNodePages)for(let e=0;e<d.childCount;e++){const t=_.children[d.childOffset+e],i=this._getNodeInternal(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(y.set(t,this._entryPriority(t)),this._prefetchNodes.push(t))}if(g.failed||g.resources.isEmpty)return void(s&&d.childCount>0&&this._isSelected(g)&&(s=!1));if(this._isLoaded(a)){if(n.known+=g.memory,++n.knownNodes,this._isSelected(g)?d.childCount>0&&(s=!1):(n.unremoved+=g.memory,s=!1),this._needsUpdate(g)){const e=this._entryPriority(a);y.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(g.memory&&(n.known+=g.memory,++n.knownNodes),!this._isSelected(g))return void(this._isReloading(a)&&this._updates.remove.push(a));if(d.childCount>0&&(s=!1),g.memory?(n.missing+=g.memory,n.known+=g.memory,++n.knownNodes):++n.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const f=this._entryPriority(a);y.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=g&&g.imModificationImpact===c.NotChecked&&r.push(a)};this.traverseVisible(d,a),this._frameNumber++,this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>y.get(e)-y.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=y.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear()),this._removeUnusedNodePages(a,l);const h=this._updates.add;h.length>0&&this.layerHasModifications&&(r.length>0&&i?.(r),h.filterInPlace(e=>{const t=this._getNodeInternal(e),i=null==t?.node||t.node.imModificationImpact!==c.Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=n.missing-n.unremoved,n.knownNodes>3&&n.missingNodes>0&&(this._unloadedMemoryEstimate+=n.known/n.knownNodes*n.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>y.get(e)>=this._maxUnloadedPrio).sort((e,t)=>y.get(e)-y.get(t)),this._updates.update.sort((e,t)=>y.get(e)-y.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,y.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new F;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=S(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>U&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=U})}}_updateFeatureEstimate(e,t){this._version=S(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._isSelected(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>y.get(e)-y.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeInternal(t);if(!i)return null;let s=i?.traversalState;if(s&&C(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this.getParentIndex(t);if(null!=e){const t=this._getNodeInternal(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=R(!0,this._version),s):(s=new g(o,r,n,R(!0,this._version)),i.traversalState=s,s)}async _loadNode(e){this._loadingNodes.add(e);const i=this._getNodeInternal(e).ref;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this._urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};let r=null;try{r=e>=0?await this._streamDataController.request(n,a.JSON):await this._clientNodeLoader.loadNodeJSON(s)}catch(h){return o(),void(t(h)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}o();const l=this._validateNode(s,r);if(null==l)return;l.obb&&this.invalidateNodeVisibilityCache(e);const d=this._addNode(l,e);this.nodeTraversalState(d)}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,a=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new d(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?N.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},l=Array.isArray(t.children)?t.children.map(a).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new m(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},l,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._entryPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeInternal(i).traversalState;null!=e&&(s=e.lodLevel)}let n=this.progressiveLoadPenalty;for(let r=e;null!=r;r=this.getParentIndex(r))if(this._isLoaded(r)){n=0;break}const o=null!=t.ref?this._viewportQueries.distToPOI(t.ref):null!=t.node?this._viewportQueries.distToPOI(t.node):0;return-o-s*(o+this.progressiveLoadPenalty)+n}traverseVisible(e,t){const i=this._getNodeInternal(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=E(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let l=0;l<i.childCount;l++){const t=a.children[i.childOffset+l],o=this._getNodeInternal(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=E(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=E(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,l=M(i,s),d=o.nodes[l],h=d.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=d,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:l}=r;if(0===l)continue;const{childOffset:d}=r,h=d+l;for(let e=d;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,l=o,d=l.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=l;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,l=o,d=l.nodes,i=s*e}const h=d[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,N=v+_;for(let e=v;e<N;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:l}=n,d=l+r;for(let e=l;e<d;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.ref?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(E(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){}}const y=new Map;class P{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function x(e){return f(e,-2)}function S(e){return f(e,2)}function R(e,t){return t+(e?1:0)}function C(e,t){return(-2&e)===t}function w(e){return!(1&~e)}function E(e,t){return e<0?-1:t>0?e/t|0:0}function M(e,t){return e<0?-e-1:0===t?e:e%t}function O(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const V=[["maxScreenThreshold",l.MaxScreenThreshold],["screenSpaceRelative",l.ScreenSpaceRelative],["removedFeatureDiameter",l.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",l.DistanceRangeFromDefaultCamera]];function A(e){if(e)for(let t=0;t<e.length;t++)for(const i of V)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:l.None,maxError:0}}class L{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class F{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function D(e){return Math.sqrt(e*(4/Math.PI))}const z=o(),k=o(),T=o(),B=o(),U=has("esri-mobile")?100:300;export{I as I3SIndex,A as selectErrorMetric};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as s,createGeometryDescriptor as a}from"./I3SBinaryReader.js";import{getMaterialAndTextures as u,getMaterialAndTexturesFromShared as l,selectEncoding as f}from"./I3SMaterialUtil.js";class d{constructor(e,t,r,i,o,n){if(this._streamDataController=t,this._logger=r,this._defaultGeometrySchema=i,this._requiredAttributes=o,this._options=n,this._logLayer=e,this._layerUrl=e.parsedUrl.path,this._geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this._materialAndTextures=e.materialDefinitions.map(r=>u(t,r,"integrated-mesh"===e.type))}}_load(e,t,r){return this._streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then(e=>s(t,e))}async loadAttributes(e,t,r){const o=await Promise.allSettled(t.map(t=>this._loadAttribute(e,t.attributeStorageInfo,r))),n={};for(let s=0;s<t.length;++s){const r=o[s],a=t[s];if("fulfilled"===r.status){const e=r.value;n[a.name]=e}else{const t=r.reason;i(t),this._logger.error("#loadAttributes",this._logLayer,`Failed to load attributeData for '${a.name}' on node '${e.id}'`,t)}}return n}async loadNodeData(r,i){const o=null!=this._requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this._requiredAttributes,i)):null,{bufferDefinition:n,bufferIndex:s}=_(this._geometryDefinitions,r),u=!!r.resources.geometry,f=u?e(this._loadGeometry(r.resources.geometry,s,i)):null,d=r.resources.hasSharedResource?await this._loadShared(r,i):null,y=r.resources.materialDefinition,D=this._materialAndTextures&&null!=y&&y>=0?this._materialAndTextures[y]:null!=d?l(d):null,b=D?.material,x=D?.textures??[],p=`${r.id}`,A=!u&&this._options.loadFeatureData,$=A?await this._loadFeatureData(p,i):null,T=A?m($):c(b),j=null==T?h($):null,w=x.length>0?e(this.loadTextures(r,x,i)):null;let I=null,S=null;if(f){I=t(await f);const e=g(this._defaultGeometrySchema,d);S=a(n,e)}const U=w?t(await w):null,q=o?t(await o):{},B=q?{attributeData:q,loadedAttributes:this._requiredAttributes}:null;if(null!=T)return{geometryData:T,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};if(null!=j)return{pointData:j,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map(e=>o(e,t)):e.hrefConcat=o(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.slice(0,5)&&(e.encoding[t]=r.slice(5))}else{const t=e.encoding;"data:"===t.slice(0,5)&&(e.encoding=t.slice(5))}}}async _loadShared(e,t){if(null==e.resources.geometry)return{};const r=`${this._layerUrl}/nodes/${e.resources.geometry}/shared`,i=await this._load(r,"json",t);return d._fixTextureEncodings(i),d._addAbsoluteHrefTexture(i,r),i}_loadTexture(e,t,r,i,o){return i===n.DDS_S3TC||i===n.KTX2||i===n.Basis?this._load(e,"binary",o).then(e=>({id:t,usage:r,data:e,encoding:i})):this._load(e,"image",o).then(e=>({id:t,usage:r,data:e,encoding:i}))}loadTextures(e,t,r){const i=this._options.textureUsageMask;return Promise.all(t.map(t=>{if(0===(t.usage&i))return null;const o=f(t.encodings,this._options.textureEncodings);if(null==o)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const n=e.resources.texture||e.id,s=`${this._layerUrl}/nodes/${n}/textures/${o.name}`;return this._loadTexture(s,t.id,t.usage,o.encoding,r)}))}_loadFeatureData(e,t){const r=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(r,"json",t)}_loadGeometry(e,t,r){const i=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,"binary",r)}}function c(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function m(e){if(!e)return null;for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function h(e){if(!e)return null;const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:[]});return t}function g(e,t){if(!e||!t?.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=r(e)).vertexAttributes.region,e}function _(e,t){const r={bufferDefinition:null,bufferIndex:0},i=t.resources.geometryDefinition;if(null==e||null==i||i<0)return r;const o=i>=0?e[i].geometryBuffers:null;if(null==o)return r;for(let n=0;n<o.length;n++){const e=o[n];if(null==e.compressedAttributes)r.bufferIndex=n,r.bufferDefinition=o[n];else if("draco"===e.compressedAttributes.encoding&&!has("disable-feature:i3s-draco"))return r.bufferIndex=n,r.bufferDefinition=e,r}return r}export{d as default};
5
+ import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{DocType as s}from"../../support/index.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as a,createGeometryDescriptor as u}from"./I3SBinaryReader.js";import{getMaterialAndTextures as l,getMaterialAndTexturesFromShared as f,selectEncoding as d}from"./I3SMaterialUtil.js";class c{constructor(e,t,r,i,o,s){if(this._streamDataController=t,this._logger=r,this._defaultGeometrySchema=i,this._requiredAttributes=o,this._options=s,this._logLayer=e,this._layerUrl=e.parsedUrl.path,this._geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this._materialAndTextures=e.materialDefinitions.map(r=>l(t,r,"integrated-mesh"===e.type))}}_load(e,t,r){return this._streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,s.BINARY,r).then(e=>a(t,e))}async loadAttributes(e,t,r){const o=await Promise.allSettled(t.map(t=>this._loadAttribute(e,t.attributeStorageInfo,r))),s={};for(let n=0;n<t.length;++n){const r=o[n],a=t[n];if("fulfilled"===r.status){const e=r.value;s[a.name]=e}else{const t=r.reason;i(t),this._logger.error("#loadAttributes",this._logLayer,`Failed to load attributeData for '${a.name}' on node '${e.id}'`,t)}}return s}async loadNodeData(r,i){const o=null!=this._requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this._requiredAttributes,i)):null,{bufferDefinition:s,bufferIndex:n}=y(this._geometryDefinitions,r),a=!!r.resources.geometry,l=a?e(this._loadGeometry(r.resources.geometry,n,i)):null,d=r.resources.hasSharedResource?await this._loadShared(r,i):null,c=r.resources.materialDefinition,D=this._materialAndTextures&&null!=c&&c>=0?this._materialAndTextures[c]:null!=d?f(d):null,p=D?.material,x=D?.textures??[],b=`${r.id}`,A=!a&&this._options.loadFeatureData,$=A?await this._loadFeatureData(b,i):null,I=A?h($):m(p),T=null==I?g($):null,S=x.length>0?e(this.loadTextures(r,x,i)):null;let j=null,w=null;if(l){j=t(await l);const e=_(this._defaultGeometrySchema,d);w=u(s,e)}const U=S?t(await S):null,B=o?t(await o):{},q=B?{attributeData:B,loadedAttributes:this._requiredAttributes}:null;if(null!=I)return{geometryData:I,attributeDataInfo:q,geometryBuffer:j,geometryDescriptor:w,requiredTextures:x,textureData:U};if(null!=T)return{pointData:T,attributeDataInfo:q,geometryBuffer:j,geometryDescriptor:w,requiredTextures:x,textureData:U};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map(e=>o(e,t)):e.hrefConcat=o(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.slice(0,5)&&(e.encoding[t]=r.slice(5))}else{const t=e.encoding;"data:"===t.slice(0,5)&&(e.encoding=t.slice(5))}}}async _loadShared(e,t){if(null==e.resources.geometry)return{};const r=`${this._layerUrl}/nodes/${e.resources.geometry}/shared`,i=await this._load(r,s.JSON,t);return c._fixTextureEncodings(i),c._addAbsoluteHrefTexture(i,r),i}_loadTexture(e,t,r,i,o){return i===n.DDS_S3TC||i===n.KTX2||i===n.Basis?this._load(e,s.BINARY,o).then(e=>({id:t,usage:r,data:e,encoding:i})):this._load(e,s.IMAGE,o).then(e=>({id:t,usage:r,data:e,encoding:i}))}loadTextures(e,t,r){const i=this._options.textureUsageMask;return Promise.all(t.map(t=>{if(0===(t.usage&i))return null;const o=d(t.encodings,this._options.textureEncodings);if(null==o)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const s=e.resources.texture||e.id,n=`${this._layerUrl}/nodes/${s}/textures/${o.name}`;return this._loadTexture(n,t.id,t.usage,o.encoding,r)}))}_loadFeatureData(e,t){const r=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(r,s.JSON,t)}_loadGeometry(e,t,r){const i=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,s.BINARY,r)}}function m(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function h(e){if(!e)return null;for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function g(e){if(!e)return null;const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:[]});return t}function _(e,t){if(!e||!t?.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=r(e)).vertexAttributes.region,e}function y(e,t){const r={bufferDefinition:null,bufferIndex:0},i=t.resources.geometryDefinition;if(null==e||null==i||i<0)return r;const o=i>=0?e[i].geometryBuffers:null;if(null==o)return r;for(let s=0;s<o.length;s++){const e=o[s];if(null==e.compressedAttributes)r.bufferIndex=s,r.bufferDefinition=o[s];else if("draco"===e.compressedAttributes.encoding&&!has("disable-feature:i3s-draco"))return r.bufferIndex=s,r.bufferDefinition=e,r}return r}export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{let p=class extends t{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer?.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,{fieldsIndex:this.i3slayer.fieldsIndex});if(!r.isStandardized)return e.getLogger(this).error("definitionExpression is using non standard function"),null;const i=[],s=r.fieldNames;return n(s,this.i3slayer.fieldsIndex,{missingFields:i}),i.length>0?(e.getLogger(this).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return e.getLogger(this).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){if(null==r)return!0;try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return r([i({readOnly:!0})],p.prototype,"parsedDefinitionExpression",null),r([i({readOnly:!0})],p.prototype,"definitionExpressionFields",null),p=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],p),p};export{t as DefinitionExpressionSceneLayerView};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{const p=t;let d=class extends p{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer?.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,{fieldsIndex:this.i3slayer.fieldsIndex});if(!r.isStandardized)return e.getLogger(this).error("definitionExpression is using non standard function"),null;const i=[],s=r.fieldNames;return n(s,this.i3slayer.fieldsIndex,{missingFields:i}),i.length>0?(e.getLogger(this).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return e.getLogger(this).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){if(null==r)return!0;try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return r([i({readOnly:!0})],d.prototype,"parsedDefinitionExpression",null),r([i({readOnly:!0})],d.prototype,"definitionExpressionFields",null),d=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],d),d};export{t as DefinitionExpressionSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as s,populateMissingFields as a}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as o,getRequiredFields as p}from"../../../layers/support/popupUtils.js";const i=i=>{let c=class extends i{_validateFetchPopupFeatures(e){const{layer:r}=this,{popupEnabled:s}=r;if(!s)throw new t("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:r});if(!o(r,e))throw new t("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:r})}async prepareFetchPopupFeatures(e){}async fetchPopupFeaturesFromGraphics(e,t){if(this._validateFetchPopupFeatures(t),0===e.length)return[];const r="scene"===this.layer.type&&null!=this.layer.associatedLayer?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=s(this.layer.fieldsIndex,await p(r,o(this.layer,t)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],l=[];for(const s of e)a(s,i,c)?l.push(s):n.push(s);if(0===l.length)return n;const u=new Map;for(let s=0;s<e.length;s++)u.set(e[s].getObjectId()??0,s);const h=await this.whenGraphicAttributes(l,[...c]).catch(()=>l).then(e=>n.concat(e));return h.sort((e,t)=>{const r=e.getObjectId()??0,s=u.get(r)??0,a=t.getObjectId()??0;return s-(u.get(a)??0)}),h}};return c=e([r("esri.views.3d.layers.support.PopupSceneLayerView")],c),c};export{i as PopupSceneLayerView};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as s,populateMissingFields as o}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as a,getRequiredFields as p}from"../../../layers/support/popupUtils.js";const i=i=>{const c=i;let n=class extends c{_validateFetchPopupFeatures(e){const{layer:r}=this,{popupEnabled:s}=r;if(!s)throw new t("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:r});if(!a(r,e))throw new t("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:r})}async prepareFetchPopupFeatures(e){}async fetchPopupFeaturesFromGraphics(e,t){if(this._validateFetchPopupFeatures(t),0===e.length)return[];const r="scene"===this.layer.type&&null!=this.layer.associatedLayer?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=s(this.layer.fieldsIndex,await p(r,a(this.layer,t)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],l=[];for(const s of e)o(s,i,c)?l.push(s):n.push(s);if(0===l.length)return n;const u=new Map;for(let s=0;s<e.length;s++)u.set(e[s].getObjectId()??0,s);const h=await this.whenGraphicAttributes(l,[...c]).catch(()=>l).then(e=>n.concat(e));return h.sort((e,t)=>{const r=e.getObjectId()??0,s=u.get(r)??0,o=t.getObjectId()??0;return s-(u.get(o)??0)}),h}};return n=e([r("esri.views.3d.layers.support.PopupSceneLayerView")],n),n};export{i as PopupSceneLayerView};